History

nfsd: merge stable fix into main nfsd branch

J. Bruce Fields committed 9 years ago

Commit 60709c02 parents 7323f0d 0839ffb183 files · +1692 −1239Browse files

Unified · Split

183 files
  1. MAINTAINERS +1 −2
  2. Makefile +2 −2
  3. arch/arm64/crypto/aes-modes.S +42 −46
  4. arch/powerpc/Kconfig +1 −1
  5. arch/powerpc/include/asm/cpu_has_feature.h +2 −0
  6. arch/powerpc/include/asm/mmu.h +2 −0
  7. arch/powerpc/include/asm/module.h +0 −4
  8. arch/powerpc/include/asm/stackprotector.h +0 −40
  9. arch/powerpc/kernel/Makefile +0 −4
  10. arch/powerpc/kernel/asm-offsets.c +0 −3
  11. arch/powerpc/kernel/eeh_driver.c +1 −1
  12. arch/powerpc/kernel/entry_32.S +1 −5
  13. arch/powerpc/kernel/module_64.c +0 −8
  14. arch/powerpc/kernel/process.c +0 −6
  15. arch/powerpc/kernel/prom_init.c +3 −0
  16. arch/powerpc/mm/pgtable-radix.c +2 −2
  17. arch/sparc/include/asm/mmu_context_64.h +4 −4
  18. arch/sparc/kernel/irq_64.c +1 −1
  19. arch/sparc/kernel/sstate.c +3 −3
  20. arch/sparc/kernel/traps_64.c +73 −0
  21. arch/x86/events/intel/rapl.c +26 −34
  22. arch/x86/events/intel/uncore.c +91 −141
  23. arch/x86/include/asm/microcode.h +1 −0
  24. arch/x86/kernel/apic/io_apic.c +2 −0
  25. arch/x86/kernel/cpu/mcheck/mce.c +12 −19
  26. arch/x86/kernel/cpu/microcode/amd.c +3 −2
  27. arch/x86/kernel/cpu/microcode/core.c +17 −5
  28. arch/x86/kernel/cpu/microcode/intel.c +1 −8
  29. arch/x86/kernel/fpu/core.c +3 −1
  30. arch/x86/kernel/hpet.c +1 −0
  31. arch/x86/kvm/x86.c +1 −0
  32. arch/x86/platform/efi/efi_64.c +16 −0
  33. arch/xtensa/kernel/setup.c +1 −1
  34. crypto/algapi.c +1 −0
  35. drivers/ata/libata-core.c +4 −2
  36. drivers/ata/sata_mv.c +3 −0
  37. drivers/base/firmware_class.c +1 −4
  38. drivers/base/memory.c +6 −6
  39. drivers/bcma/bcma_private.h +3 −0
  40. drivers/bcma/driver_chipcommon.c +3 −8
  41. drivers/bcma/driver_mips.c +3 −0
  42. drivers/dma/cppi41.c +46 −23
  43. drivers/dma/pl330.c +6 −13
  44. drivers/firmware/efi/libstub/fdt.c +3 −11
  45. drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +3 −1
  46. drivers/gpu/drm/drm_atomic.c +8 −5
  47. drivers/gpu/drm/drm_atomic_helper.c +0 −9
  48. drivers/gpu/drm/drm_connector.c +18 −5
  49. drivers/gpu/drm/drm_drv.c +4 −0
  50. drivers/gpu/drm/i915/i915_drv.h +4 −12
  51. drivers/gpu/drm/i915/intel_atomic_plane.c +20 −0
  52. drivers/gpu/drm/i915/intel_display.c +42 −83
  53. drivers/gpu/drm/i915/intel_drv.h +7 −2
  54. drivers/gpu/drm/i915/intel_fbc.c +20 −32
  55. drivers/gpu/drm/i915/intel_fbdev.c +2 −2
  56. drivers/gpu/drm/i915/intel_sprite.c +4 −4
  57. drivers/gpu/drm/nouveau/dispnv04/hw.c +2 −1
  58. drivers/gpu/drm/nouveau/nouveau_fence.h +1 −0
  59. drivers/gpu/drm/nouveau/nouveau_led.h +1 −1
  60. drivers/gpu/drm/nouveau/nouveau_usif.c +2 −1
  61. drivers/gpu/drm/nouveau/nv50_display.c +6 −0
  62. drivers/gpu/drm/nouveau/nv84_fence.c +6 −0
  63. drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c +1 −1
  64. drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c +0 −2
  65. drivers/gpu/drm/radeon/radeon_drv.c +2 −1
  66. drivers/gpu/drm/radeon/radeon_gem.c +2 −2
  67. drivers/hid/hid-cp2112.c +12 −16
  68. drivers/hid/hid-ids.h +3 −0
  69. drivers/hid/hid-lg.c +1 −1
  70. drivers/hid/usbhid/hid-quirks.c +1 −0
  71. drivers/hid/wacom_wac.c +15 −13
  72. drivers/hv/ring_buffer.c +1 −0
  73. drivers/iio/adc/palmas_gpadc.c +2 −2
  74. drivers/iio/health/afe4403.c +2 −2
  75. drivers/iio/health/afe4404.c +2 −2
  76. drivers/iio/health/max30100.c +1 −1
  77. drivers/iio/humidity/dht11.c +4 −2
  78. drivers/input/rmi4/rmi_driver.c +2 −2
  79. drivers/input/touchscreen/wm97xx-core.c +1 −1
  80. drivers/mmc/host/sdhci.c +2 −1
  81. drivers/net/ethernet/adaptec/starfire.c +43 −2
  82. drivers/net/ethernet/cadence/macb.c +130 −58
  83. drivers/net/ethernet/cadence/macb.h +17 −3
  84. drivers/net/ethernet/cavium/thunder/thunder_xcv.c +1 −2
  85. drivers/net/ethernet/emulex/benet/be_main.c +28 −5
  86. drivers/net/ethernet/freescale/gianfar.c +2 −2
  87. drivers/net/ethernet/mellanox/mlx4/catas.c +1 −1
  88. drivers/net/ethernet/mellanox/mlx4/intf.c +12 −0
  89. drivers/net/ethernet/mellanox/mlx4/mlx4.h +1 −0
  90. drivers/net/ethernet/mellanox/mlx5/core/cmd.c +1 −1
  91. drivers/net/ethernet/mellanox/mlx5/core/en.h +4 −3
  92. drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +8 −3
  93. drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +26 −15
  94. drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +1 −1
  95. drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c +1 −1
  96. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +101 −101
  97. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +6 −7
  98. drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +5 −5
  99. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +22 −14
  100. drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +1 −1
  101. drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +1 −1
  102. drivers/net/ethernet/mellanox/mlx5/core/main.c +1 −1
  103. drivers/net/ethernet/mellanox/mlx5/core/port.c +2 −2
  104. drivers/net/ethernet/mellanox/mlx5/core/vport.c +1 −1
  105. drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +4 −0
  106. drivers/net/hyperv/netvsc.c +6 −0
  107. drivers/net/phy/micrel.c +1 −1
  108. drivers/net/wireless/intel/iwlwifi/iwl-8000.c +1 −1
  109. drivers/net/wireless/intel/iwlwifi/mvm/sta.c +4 −3
  110. drivers/net/wireless/intel/iwlwifi/mvm/tt.c +8 −4
  111. drivers/pci/pcie/aspm.c +13 −6
  112. drivers/pinctrl/berlin/berlin-bg4ct.c +1 −1
  113. drivers/pinctrl/intel/pinctrl-baytrail.c +20 −7
  114. drivers/pinctrl/intel/pinctrl-merrifield.c +3 −0
  115. drivers/pinctrl/sunxi/pinctrl-sunxi.c +1 −2
  116. drivers/regulator/axp20x-regulator.c +1 −1
  117. drivers/regulator/fixed.c +0 −46
  118. drivers/regulator/twl6030-regulator.c +1 −1
  119. drivers/rtc/Kconfig +4 −1
  120. drivers/rtc/rtc-jz4740.c +10 −2
  121. drivers/scsi/virtio_scsi.c +10 −1
  122. drivers/staging/greybus/timesync_platform.c +6 −0
  123. drivers/usb/core/quirks.c +4 −0
  124. drivers/usb/gadget/function/f_fs.c +12 −1
  125. drivers/usb/musb/musb_core.c +13 −13
  126. drivers/usb/musb/musb_core.h +0 −1
  127. drivers/usb/serial/option.c +1 −0
  128. drivers/usb/serial/pl2303.c +1 −0
  129. drivers/usb/serial/pl2303.h +1 −0
  130. drivers/usb/serial/qcserial.c +1 −0
  131. drivers/vfio/vfio_iommu_spapr_tce.c +5 −6
  132. drivers/vhost/vhost.c +4 −6
  133. drivers/virtio/virtio_ring.c +0 −7
  134. fs/cifs/readdir.c +1 −0
  135. fs/dax.c +5 −0
  136. fs/fscache/cookie.c +5 −0
  137. fs/fscache/netfs.c +1 −0
  138. fs/fscache/object.c +30 −2
  139. fs/iomap.c +3 −0
  140. fs/nfsd/vfs.c +60 −37
  141. include/asm-generic/export.h +6 −5
  142. include/drm/drmP.h +1 −0
  143. include/drm/drm_connector.h +15 −1
  144. include/linux/can/core.h +3 −4
  145. include/linux/cpuhotplug.h +0 −3
  146. include/linux/export.h +12 −5
  147. include/linux/fscache-cache.h +1 −0
  148. include/linux/hyperv.h +30 −2
  149. include/linux/irq.h +17 −0
  150. include/linux/log2.h +12 −1
  151. include/linux/memory_hotplug.h +2 −1
  152. include/linux/module.h +7 −7
  153. include/linux/netdevice.h +15 −14
  154. include/linux/percpu-refcount.h +2 −2
  155. include/net/ipv6.h +5 −0
  156. include/uapi/linux/ethtool.h +3 −1
  157. init/Kconfig +4 −0
  158. kernel/cgroup.c +5 −8
  159. kernel/events/core.c +46 −23
  160. kernel/irq/irqdomain.c +30 −14
  161. kernel/module.c +25 −28
  162. kernel/trace/trace_hwlat.c +5 −3
  163. kernel/trace/trace_kprobe.c +1 −1
  164. mm/filemap.c +5 −0
  165. mm/kasan/report.c +3 −0
  166. mm/memory_hotplug.c +21 −7
  167. mm/shmem.c +9 −2
  168. mm/zswap.c +29 −1
  169. net/can/af_can.c +10 −2
  170. net/can/af_can.h +2 −1
  171. net/can/bcm.c +18 −9
  172. net/can/gw.c +1 −1
  173. net/can/raw.c +2 −2
  174. net/ipv4/tcp_output.c +4 −2
  175. net/ipv6/ip6_output.c +1 −1
  176. net/ipv6/ip6_tunnel.c +1 −1
  177. net/sched/cls_flower.c +2 −2
  178. net/sched/cls_matchall.c +45 −82
  179. scripts/Makefile.build +2 −0
  180. scripts/genksyms/genksyms.c +14 −5
  181. scripts/kallsyms.c +12 −0
  182. scripts/mod/modpost.c +10 −0
  183. tools/objtool/arch/x86/decode.c +1 −1
MAINTAINERS+1−2
@@ -10195,7 +10195,6 @@ F: drivers/media/tuners/qt1010* · 10194 unmodified lines
1019510195 QUALCOMM ATHEROS ATH9K WIRELESS DRIVER
1019610196 M: QCA ath9k Development <ath9k-devel@qca.qualcomm.com>
1019710197 L: linux-wireless@vger.kernel.org
10198−L: ath9k-devel@lists.ath9k.org
1019910198 W: http://wireless.kernel.org/en/users/Drivers/ath9k
1020010199 S: Supported
1020110200 F: drivers/net/wireless/ath/ath9k/
@@ -13066,7 +13065,7 @@ F: drivers/input/serio/userio.c · 2864 unmodified lines
1306613065 F: include/uapi/linux/userio.h
1306713066
1306813067 VIRTIO CONSOLE DRIVER
13069−M: Amit Shah <amit.shah@redhat.com>
13068+M: Amit Shah <amit@kernel.org>
1307013069 L: virtualization@lists.linux-foundation.org
1307113070 S: Maintained
1307213071 F: drivers/char/virtio_console.c
Makefile+2−2
@@ -1,7 +1,7 @@
11 VERSION = 4
22 PATCHLEVEL = 10
33 SUBLEVEL = 0
4−EXTRAVERSION = -rc6
4+EXTRAVERSION = -rc7
55 NAME = Fearless Coyote
66
77 # *DOCUMENTATION*
@@ -797,7 +797,7 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types) · 789 unmodified lines
797797 KBUILD_ARFLAGS := $(call ar-option,D)
798798
799799 # check for 'asm goto'
800−ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
800+ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
801801 KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
802802 KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
803803 endif
arch/arm64/crypto/aes-modes.S+42−46
@@ -193,15 +193,16 @@ AES_ENTRY(aes_cbc_encrypt) · 192 unmodified lines
193193 cbz w6, .Lcbcencloop
194194
195195 ld1 {v0.16b}, [x5] /* get iv */
196− enc_prepare w3, x2, x5
196+ enc_prepare w3, x2, x6
197197
198198 .Lcbcencloop:
199199 ld1 {v1.16b}, [x1], #16 /* get next pt block */
200200 eor v0.16b, v0.16b, v1.16b /* ..and xor with iv */
201− encrypt_block v0, w3, x2, x5, w6
201+ encrypt_block v0, w3, x2, x6, w7
202202 st1 {v0.16b}, [x0], #16
203203 subs w4, w4, #1
204204 bne .Lcbcencloop
205+ st1 {v0.16b}, [x5] /* return iv */
205206 ret
206207 AES_ENDPROC(aes_cbc_encrypt)
207208
@@ -211,7 +212,7 @@ AES_ENTRY(aes_cbc_decrypt) · 3 unmodified lines
211212 cbz w6, .LcbcdecloopNx
212213
213214 ld1 {v7.16b}, [x5] /* get iv */
214− dec_prepare w3, x2, x5
215+ dec_prepare w3, x2, x6
215216
216217 .LcbcdecloopNx:
217218 #if INTERLEAVE >= 2
@@ -248,7 +249,7 @@ AES_ENTRY(aes_cbc_decrypt) · 30 unmodified lines
248249 .Lcbcdecloop:
249250 ld1 {v1.16b}, [x1], #16 /* get next ct block */
250251 mov v0.16b, v1.16b /* ...and copy to v0 */
251− decrypt_block v0, w3, x2, x5, w6
252+ decrypt_block v0, w3, x2, x6, w7
252253 eor v0.16b, v0.16b, v7.16b /* xor with iv => pt */
253254 mov v7.16b, v1.16b /* ct is next iv */
254255 st1 {v0.16b}, [x0], #16
@@ -256,6 +257,7 @@ AES_ENTRY(aes_cbc_decrypt) · 1 unmodified line
256257 bne .Lcbcdecloop
257258 .Lcbcdecout:
258259 FRAME_POP
260+ st1 {v7.16b}, [x5] /* return iv */
259261 ret
260262 AES_ENDPROC(aes_cbc_decrypt)
261263
@@ -267,24 +269,15 @@ AES_ENDPROC(aes_cbc_decrypt) · 5 unmodified lines
267269
268270 AES_ENTRY(aes_ctr_encrypt)
269271 FRAME_PUSH
270− cbnz w6, .Lctrfirst /* 1st time around? */
271− umov x5, v4.d[1] /* keep swabbed ctr in reg */
272− rev x5, x5
273−#if INTERLEAVE >= 2
274− cmn w5, w4 /* 32 bit overflow? */
275− bcs .Lctrinc
276− add x5, x5, #1 /* increment BE ctr */
277− b .LctrincNx
278−#else
279− b .Lctrinc
280−#endif
281−.Lctrfirst:
272+ cbz w6, .Lctrnotfirst /* 1st time around? */
282273 enc_prepare w3, x2, x6
283274 ld1 {v4.16b}, [x5]
284− umov x5, v4.d[1] /* keep swabbed ctr in reg */
285− rev x5, x5
275+
276+.Lctrnotfirst:
277+ umov x8, v4.d[1] /* keep swabbed ctr in reg */
278+ rev x8, x8
286279 #if INTERLEAVE >= 2
287− cmn w5, w4 /* 32 bit overflow? */
280+ cmn w8, w4 /* 32 bit overflow? */
288281 bcs .Lctrloop
289282 .LctrloopNx:
290283 subs w4, w4, #INTERLEAVE
@@ -292,11 +285,11 @@ AES_ENTRY(aes_ctr_encrypt) · 1 unmodified line
292285 #if INTERLEAVE == 2
293286 mov v0.8b, v4.8b
294287 mov v1.8b, v4.8b
295− rev x7, x5
296− add x5, x5, #1
288+ rev x7, x8
289+ add x8, x8, #1
297290 ins v0.d[1], x7
298− rev x7, x5
299− add x5, x5, #1
291+ rev x7, x8
292+ add x8, x8, #1
300293 ins v1.d[1], x7
301294 ld1 {v2.16b-v3.16b}, [x1], #32 /* get 2 input blocks */
302295 do_encrypt_block2x
@@ -305,7 +298,7 @@ AES_ENTRY(aes_ctr_encrypt) · 2 unmodified lines
305298 st1 {v0.16b-v1.16b}, [x0], #32
306299 #else
307300 ldr q8, =0x30000000200000001 /* addends 1,2,3[,0] */
308− dup v7.4s, w5
301+ dup v7.4s, w8
309302 mov v0.16b, v4.16b
310303 add v7.4s, v7.4s, v8.4s
311304 mov v1.16b, v4.16b
@@ -323,18 +316,12 @@ AES_ENTRY(aes_ctr_encrypt) · 11 unmodified lines
323316 eor v2.16b, v7.16b, v2.16b
324317 eor v3.16b, v5.16b, v3.16b
325318 st1 {v0.16b-v3.16b}, [x0], #64
326− add x5, x5, #INTERLEAVE
319+ add x8, x8, #INTERLEAVE
327320 #endif
328− cbz w4, .LctroutNx
329−.LctrincNx:
330− rev x7, x5
321+ rev x7, x8
331322 ins v4.d[1], x7
323+ cbz w4, .Lctrout
332324 b .LctrloopNx
333−.LctroutNx:
334− sub x5, x5, #1
335− rev x7, x5
336− ins v4.d[1], x7
337− b .Lctrout
338325 .Lctr1x:
339326 adds w4, w4, #INTERLEAVE
340327 beq .Lctrout
@@ -342,30 +329,39 @@ AES_ENTRY(aes_ctr_encrypt) · 1 unmodified line
342329 .Lctrloop:
343330 mov v0.16b, v4.16b
344331 encrypt_block v0, w3, x2, x6, w7
332+
333+ adds x8, x8, #1 /* increment BE ctr */
334+ rev x7, x8
335+ ins v4.d[1], x7
336+ bcs .Lctrcarry /* overflow? */
337+
338+.Lctrcarrydone:
345339 subs w4, w4, #1
346340 bmi .Lctrhalfblock /* blocks < 0 means 1/2 block */
347341 ld1 {v3.16b}, [x1], #16
348342 eor v3.16b, v0.16b, v3.16b
349343 st1 {v3.16b}, [x0], #16
350− beq .Lctrout
351−.Lctrinc:
352− adds x5, x5, #1 /* increment BE ctr */
353− rev x7, x5
354− ins v4.d[1], x7
355− bcc .Lctrloop /* no overflow? */
356− umov x7, v4.d[0] /* load upper word of ctr */
357− rev x7, x7 /* ... to handle the carry */
358− add x7, x7, #1
359− rev x7, x7
360− ins v4.d[0], x7
361− b .Lctrloop
344+ bne .Lctrloop
345+
346+.Lctrout:
347+ st1 {v4.16b}, [x5] /* return next CTR value */
348+ FRAME_POP
349+ ret
350+
362351 .Lctrhalfblock:
363352 ld1 {v3.8b}, [x1]
364353 eor v3.8b, v0.8b, v3.8b
365354 st1 {v3.8b}, [x0]
366−.Lctrout:
367355 FRAME_POP
368356 ret
357+
358+.Lctrcarry:
359+ umov x7, v4.d[0] /* load upper word of ctr */
360+ rev x7, x7 /* ... to handle the carry */
361+ add x7, x7, #1
362+ rev x7, x7
363+ ins v4.d[0], x7
364+ b .Lctrcarrydone
369365 AES_ENDPROC(aes_ctr_encrypt)
370366 .ltorg
371367
arch/powerpc/Kconfig+1−1
@@ -164,7 +164,6 @@ config PPC · 163 unmodified lines
164164 select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE
165165 select HAVE_ARCH_HARDENED_USERCOPY
166166 select HAVE_KERNEL_GZIP
167− select HAVE_CC_STACKPROTECTOR
168167
169168 config GENERIC_CSUM
170169 def_bool CPU_LITTLE_ENDIAN
@@ -484,6 +483,7 @@ config RELOCATABLE · 313 unmodified lines
484483 bool "Build a relocatable kernel"
485484 depends on (PPC64 && !COMPILE_TEST) || (FLATMEM && (44x || FSL_BOOKE))
486485 select NONSTATIC_KERNEL
486+ select MODULE_REL_CRCS if MODVERSIONS
487487 help
488488 This builds a kernel image that is capable of running at the
489489 location the kernel is loaded at. For ppc32, there is no any
arch/powerpc/include/asm/cpu_has_feature.h+2−0
@@ -23,7 +23,9 @@ static __always_inline bool cpu_has_feature(unsigned long feature) · 22 unmodified lines
2323 {
2424 int i;
2525
26+#ifndef __clang__ /* clang can't cope with this */
2627 BUILD_BUG_ON(!__builtin_constant_p(feature));
28+#endif
2729
2830 #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG
2931 if (!static_key_initialized) {
arch/powerpc/include/asm/mmu.h+2−0
@@ -160,7 +160,9 @@ static __always_inline bool mmu_has_feature(unsigned long feature) · 159 unmodified lines
160160 {
161161 int i;
162162
163+#ifndef __clang__ /* clang can't cope with this */
163164 BUILD_BUG_ON(!__builtin_constant_p(feature));
165+#endif
164166
165167 #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG
166168 if (!static_key_initialized) {
arch/powerpc/include/asm/module.h+0−4
@@ -90,9 +90,5 @@ static inline int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sec · 89 unmodified lines
9090 }
9191 #endif
9292
93−#if defined(CONFIG_MODVERSIONS) && defined(CONFIG_PPC64)
94−#define ARCH_RELOCATES_KCRCTAB
95−#define reloc_start PHYSICAL_START
96−#endif
9793 #endif /* __KERNEL__ */
9894 #endif /* _ASM_POWERPC_MODULE_H */
arch/powerpc/include/asm/stackprotector.h+0−40
@@ -1,40 +0,0 @@
1−/*
2− * GCC stack protector support.
3− *
4− * Stack protector works by putting predefined pattern at the start of
5− * the stack frame and verifying that it hasn't been overwritten when
6− * returning from the function. The pattern is called stack canary
7− * and gcc expects it to be defined by a global variable called
8− * "__stack_chk_guard" on PPC. This unfortunately means that on SMP
9− * we cannot have a different canary value per task.
10− */
11−
12−#ifndef _ASM_STACKPROTECTOR_H
13−#define _ASM_STACKPROTECTOR_H
14−
15−#include <linux/random.h>
16−#include <linux/version.h>
17−#include <asm/reg.h>
18−
19−extern unsigned long __stack_chk_guard;
20−
21−/*
22− * Initialize the stackprotector canary value.
23− *
24− * NOTE: this must only be called from functions that never return,
25− * and it must always be inlined.
26− */
27−static __always_inline void boot_init_stack_canary(void)
28−{
29− unsigned long canary;
30−
31− /* Try to get a semi random initial value. */
32− get_random_bytes(&canary, sizeof(canary));
33− canary ^= mftb();
34− canary ^= LINUX_VERSION_CODE;
35−
36− current->stack_canary = canary;
37− __stack_chk_guard = current->stack_canary;
38−}
39−
40−#endif /* _ASM_STACKPROTECTOR_H */
arch/powerpc/kernel/Makefile+0−4
@@ -19,10 +19,6 @@ CFLAGS_init.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) · 18 unmodified lines
1919 CFLAGS_btext.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
2020 CFLAGS_prom.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
2121
22−# -fstack-protector triggers protection checks in this code,
23−# but it is being used too early to link to meaningful stack_chk logic.
24−CFLAGS_prom_init.o += $(call cc-option, -fno-stack-protector)
25−
2622 ifdef CONFIG_FUNCTION_TRACER
2723 # Do not trace early boot code
2824 CFLAGS_REMOVE_cputable.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
arch/powerpc/kernel/asm-offsets.c+0−3
@@ -91,9 +91,6 @@ int main(void) · 90 unmodified lines
9191 DEFINE(TI_livepatch_sp, offsetof(struct thread_info, livepatch_sp));
9292 #endif
9393
94−#ifdef CONFIG_CC_STACKPROTECTOR
95− DEFINE(TSK_STACK_CANARY, offsetof(struct task_struct, stack_canary));
96−#endif
9794 DEFINE(KSP, offsetof(struct thread_struct, ksp));
9895 DEFINE(PT_REGS, offsetof(struct thread_struct, regs));
9996 #ifdef CONFIG_BOOKE
arch/powerpc/kernel/eeh_driver.c+1−1
@@ -545,7 +545,7 @@ static void *eeh_pe_detach_dev(void *data, void *userdata) · 544 unmodified lines
545545 static void *__eeh_clear_pe_frozen_state(void *data, void *flag)
546546 {
547547 struct eeh_pe *pe = (struct eeh_pe *)data;
548− bool *clear_sw_state = flag;
548+ bool clear_sw_state = *(bool *)flag;
549549 int i, rc = 1;
550550
551551 for (i = 0; rc && i < 3; i++)
arch/powerpc/kernel/entry_32.S+1−5
@@ -674,11 +674,7 @@ BEGIN_FTR_SECTION · 673 unmodified lines
674674 mtspr SPRN_SPEFSCR,r0 /* restore SPEFSCR reg */
675675 END_FTR_SECTION_IFSET(CPU_FTR_SPE)
676676 #endif /* CONFIG_SPE */
677−#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
678− lwz r0,TSK_STACK_CANARY(r2)
679− lis r4,__stack_chk_guard@ha
680− stw r0,__stack_chk_guard@l(r4)
681−#endif
677+
682678 lwz r0,_CCR(r1)
683679 mtcrf 0xFF,r0
684680 /* r3-r12 are destroyed -- Cort */
arch/powerpc/kernel/module_64.c+0−8
@@ -286,14 +286,6 @@ static void dedotify_versions(struct modversion_info *vers, · 285 unmodified lines
286286 for (end = (void *)vers + size; vers < end; vers++)
287287 if (vers->name[0] == '.') {
288288 memmove(vers->name, vers->name+1, strlen(vers->name));
289−#ifdef ARCH_RELOCATES_KCRCTAB
290− /* The TOC symbol has no CRC computed. To avoid CRC
291− * check failing, we must force it to the expected
292− * value (see CRC check in module.c).
293− */
294− if (!strcmp(vers->name, "TOC."))
295− vers->crc = -(unsigned long)reloc_start;
296−#endif
297289 }
298290 }
299291
arch/powerpc/kernel/process.c+0−6
@@ -64,12 +64,6 @@ · 63 unmodified lines
6464 #include <linux/kprobes.h>
6565 #include <linux/kdebug.h>
6666
67−#ifdef CONFIG_CC_STACKPROTECTOR
68−#include <linux/stackprotector.h>
69−unsigned long __stack_chk_guard __read_mostly;
70−EXPORT_SYMBOL(__stack_chk_guard);
71−#endif
72−
7367 /* Transactional Memory debug */
7468 #ifdef TM_DEBUG_SW
7569 #define TM_DEBUG(x...) printk(KERN_INFO x)
arch/powerpc/kernel/prom_init.c+3−0
@@ -2834,6 +2834,9 @@ static void __init prom_find_boot_cpu(void) · 2833 unmodified lines
28342834
28352835 cpu_pkg = call_prom("instance-to-package", 1, 1, prom_cpu);
28362836
2837+ if (!PHANDLE_VALID(cpu_pkg))
2838+ return;
2839+
28372840 prom_getprop(cpu_pkg, "reg", &rval, sizeof(rval));
28382841 prom.cpu = be32_to_cpu(rval);
28392842
arch/powerpc/mm/pgtable-radix.c+2−2
@@ -65,7 +65,7 @@ int radix__map_kernel_page(unsigned long ea, unsigned long pa, · 64 unmodified lines
6565 if (!pmdp)
6666 return -ENOMEM;
6767 if (map_page_size == PMD_SIZE) {
68− ptep = (pte_t *)pudp;
68+ ptep = pmdp_ptep(pmdp);
6969 goto set_the_pte;
7070 }
7171 ptep = pte_alloc_kernel(pmdp, ea);
@@ -90,7 +90,7 @@ int radix__map_kernel_page(unsigned long ea, unsigned long pa, · 18 unmodified lines
9090 }
9191 pmdp = pmd_offset(pudp, ea);
9292 if (map_page_size == PMD_SIZE) {
93− ptep = (pte_t *)pudp;
93+ ptep = pmdp_ptep(pmdp);
9494 goto set_the_pte;
9595 }
9696 if (!pmd_present(*pmdp)) {
arch/sparc/include/asm/mmu_context_64.h+4−4
@@ -35,15 +35,15 @@ void __tsb_context_switch(unsigned long pgd_pa, · 34 unmodified lines
3535 static inline void tsb_context_switch(struct mm_struct *mm)
3636 {
3737 __tsb_context_switch(__pa(mm->pgd),
38− &mm->context.tsb_block[0],
38+ &mm->context.tsb_block[MM_TSB_BASE],
3939 #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
40− (mm->context.tsb_block[1].tsb ?
41− &mm->context.tsb_block[1] :
40+ (mm->context.tsb_block[MM_TSB_HUGE].tsb ?
41+ &mm->context.tsb_block[MM_TSB_HUGE] :
4242 NULL)
4343 #else
4444 NULL
4545 #endif
46− , __pa(&mm->context.tsb_descr[0]));
46+ , __pa(&mm->context.tsb_descr[MM_TSB_BASE]));
4747 }
4848
4949 void tsb_grow(struct mm_struct *mm,
arch/sparc/kernel/irq_64.c+1−1
@@ -1021,7 +1021,7 @@ static void __init alloc_one_queue(unsigned long *pa_ptr, unsigned long qmask) · 1020 unmodified lines
10211021 unsigned long order = get_order(size);
10221022 unsigned long p;
10231023
1024− p = __get_free_pages(GFP_KERNEL, order);
1024+ p = __get_free_pages(GFP_KERNEL | __GFP_ZERO, order);
10251025 if (!p) {
10261026 prom_printf("SUN4V: Error, cannot allocate queue.\n");
10271027 prom_halt();
arch/sparc/kernel/sstate.c+3−3
@@ -43,8 +43,8 @@ static const char poweroff_msg[32] __attribute__((aligned(32))) = · 42 unmodified lines
4343 "Linux powering off";
4444 static const char rebooting_msg[32] __attribute__((aligned(32))) =
4545 "Linux rebooting";
46−static const char panicing_msg[32] __attribute__((aligned(32))) =
47− "Linux panicing";
46+static const char panicking_msg[32] __attribute__((aligned(32))) =
47+ "Linux panicking";
4848
4949 static int sstate_reboot_call(struct notifier_block *np, unsigned long type, void *_unused)
5050 {
@@ -76,7 +76,7 @@ static struct notifier_block sstate_reboot_notifier = { · 25 unmodified lines
7676
7777 static int sstate_panic_event(struct notifier_block *n, unsigned long event, void *ptr)
7878 {
79− do_set_sstate(HV_SOFT_STATE_TRANSITION, panicing_msg);
79+ do_set_sstate(HV_SOFT_STATE_TRANSITION, panicking_msg);
8080
8181 return NOTIFY_DONE;
8282 }
arch/sparc/kernel/traps_64.c+73−0
@@ -2051,6 +2051,73 @@ void sun4v_resum_overflow(struct pt_regs *regs) · 2050 unmodified lines
20512051 atomic_inc(&sun4v_resum_oflow_cnt);
20522052 }
20532053
2054+/* Given a set of registers, get the virtual addressi that was being accessed
2055+ * by the faulting instructions at tpc.
2056+ */
2057+static unsigned long sun4v_get_vaddr(struct pt_regs *regs)
2058+{
2059+ unsigned int insn;
2060+
2061+ if (!copy_from_user(&insn, (void __user *)regs->tpc, 4)) {
2062+ return compute_effective_address(regs, insn,
2063+ (insn >> 25) & 0x1f);
2064+ }
2065+ return 0;
2066+}
2067+
2068+/* Attempt to handle non-resumable errors generated from userspace.
2069+ * Returns true if the signal was handled, false otherwise.
2070+ */
2071+bool sun4v_nonresum_error_user_handled(struct pt_regs *regs,
2072+ struct sun4v_error_entry *ent) {
2073+
2074+ unsigned int attrs = ent->err_attrs;
2075+
2076+ if (attrs & SUN4V_ERR_ATTRS_MEMORY) {
2077+ unsigned long addr = ent->err_raddr;
2078+ siginfo_t info;
2079+
2080+ if (addr == ~(u64)0) {
2081+ /* This seems highly unlikely to ever occur */
2082+ pr_emerg("SUN4V NON-RECOVERABLE ERROR: Memory error detected in unknown location!\n");
2083+ } else {
2084+ unsigned long page_cnt = DIV_ROUND_UP(ent->err_size,
2085+ PAGE_SIZE);
2086+
2087+ /* Break the unfortunate news. */
2088+ pr_emerg("SUN4V NON-RECOVERABLE ERROR: Memory failed at %016lX\n",
2089+ addr);
2090+ pr_emerg("SUN4V NON-RECOVERABLE ERROR: Claiming %lu ages.\n",
2091+ page_cnt);
2092+
2093+ while (page_cnt-- > 0) {
2094+ if (pfn_valid(addr >> PAGE_SHIFT))
2095+ get_page(pfn_to_page(addr >> PAGE_SHIFT));
2096+ addr += PAGE_SIZE;
2097+ }
2098+ }
2099+ info.si_signo = SIGKILL;
2100+ info.si_errno = 0;
2101+ info.si_trapno = 0;
2102+ force_sig_info(info.si_signo, &info, current);
2103+
2104+ return true;
2105+ }
2106+ if (attrs & SUN4V_ERR_ATTRS_PIO) {
2107+ siginfo_t info;
2108+
2109+ info.si_signo = SIGBUS;
2110+ info.si_code = BUS_ADRERR;
2111+ info.si_addr = (void __user *)sun4v_get_vaddr(regs);
2112+ force_sig_info(info.si_signo, &info, current);
2113+
2114+ return true;
2115+ }
2116+
2117+ /* Default to doing nothing */
2118+ return false;
2119+}
2120+
20542121 /* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate.
20552122 * Log the event, clear the first word of the entry, and die.
20562123 */
@@ -2075,6 +2142,12 @@ void sun4v_nonresum_error(struct pt_regs *regs, unsigned long offset) · 18 unmodified lines
20752142
20762143 put_cpu();
20772144
2145+ if (!(regs->tstate & TSTATE_PRIV) &&
2146+ sun4v_nonresum_error_user_handled(regs, &local_copy)) {
2147+ /* DON'T PANIC: This userspace error was handled. */
2148+ return;
2149+ }
2150+
20782151 #ifdef CONFIG_PCI
20792152 /* Check for the special PCI poke sequence. */
20802153 if (pci_poke_in_progress && pci_poke_cpu == cpu) {
arch/x86/events/intel/rapl.c+26−34
@@ -161,7 +161,13 @@ static u64 rapl_timer_ms; · 160 unmodified lines
161161
162162 static inline struct rapl_pmu *cpu_to_rapl_pmu(unsigned int cpu)
163163 {
164− return rapl_pmus->pmus[topology_logical_package_id(cpu)];
164+ unsigned int pkgid = topology_logical_package_id(cpu);
165+
166+ /*
167+ * The unsigned check also catches the '-1' return value for non
168+ * existent mappings in the topology map.
169+ */
170+ return pkgid < rapl_pmus->maxpkg ? rapl_pmus->pmus[pkgid] : NULL;
165171 }
166172
167173 static inline u64 rapl_read_counter(struct perf_event *event)
@@ -402,6 +408,8 @@ static int rapl_pmu_event_init(struct perf_event *event) · 234 unmodified lines
402408
403409 /* must be done before validate_group */
404410 pmu = cpu_to_rapl_pmu(event->cpu);
411+ if (!pmu)
412+ return -EINVAL;
405413 event->cpu = pmu->cpu;
406414 event->pmu_private = pmu;
407415 event->hw.event_base = msr;
@@ -585,6 +593,20 @@ static int rapl_cpu_online(unsigned int cpu) · 177 unmodified lines
585593 struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu);
586594 int target;
587595
596+ if (!pmu) {
597+ pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu));
598+ if (!pmu)
599+ return -ENOMEM;
600+
601+ raw_spin_lock_init(&pmu->lock);
602+ INIT_LIST_HEAD(&pmu->active_list);
603+ pmu->pmu = &rapl_pmus->pmu;
604+ pmu->timer_interval = ms_to_ktime(rapl_timer_ms);
605+ rapl_hrtimer_init(pmu);
606+
607+ rapl_pmus->pmus[topology_logical_package_id(cpu)] = pmu;
608+ }
609+
588610 /*
589611 * Check if there is an online cpu in the package which collects rapl
590612 * events already.
@@ -598,27 +620,6 @@ static int rapl_cpu_online(unsigned int cpu) · 7 unmodified lines
598620 return 0;
599621 }
600622
601−static int rapl_cpu_prepare(unsigned int cpu)
602−{
603− struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu);
604−
605− if (pmu)
606− return 0;
607−
608− pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu));
609− if (!pmu)
610− return -ENOMEM;
611−
612− raw_spin_lock_init(&pmu->lock);
613− INIT_LIST_HEAD(&pmu->active_list);
614− pmu->pmu = &rapl_pmus->pmu;
615− pmu->timer_interval = ms_to_ktime(rapl_timer_ms);
616− pmu->cpu = -1;
617− rapl_hrtimer_init(pmu);
618− rapl_pmus->pmus[topology_logical_package_id(cpu)] = pmu;
619− return 0;
620−}
621−
622623 static int rapl_check_hw_unit(bool apply_quirk)
623624 {
624625 u64 msr_rapl_power_unit_bits;
@@ -803,29 +804,21 @@ static int __init rapl_pmu_init(void) · 178 unmodified lines
803804 /*
804805 * Install callbacks. Core will call them for each online cpu.
805806 */
806−
807− ret = cpuhp_setup_state(CPUHP_PERF_X86_RAPL_PREP, "perf/x86/rapl:prepare",
808− rapl_cpu_prepare, NULL);
809− if (ret)
810− goto out;
811−
812807 ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_RAPL_ONLINE,
813808 "perf/x86/rapl:online",
814809 rapl_cpu_online, rapl_cpu_offline);
815810 if (ret)
816− goto out1;
811+ goto out;
817812
818813 ret = perf_pmu_register(&rapl_pmus->pmu, "power", -1);
819814 if (ret)
820− goto out2;
815+ goto out1;
821816
822817 rapl_advertise();
823818 return 0;
824819
825−out2:
826− cpuhp_remove_state(CPUHP_AP_PERF_X86_RAPL_ONLINE);
827820 out1:
828− cpuhp_remove_state(CPUHP_PERF_X86_RAPL_PREP);
821+ cpuhp_remove_state(CPUHP_AP_PERF_X86_RAPL_ONLINE);
829822 out:
830823 pr_warn("Initialization failed (%d), disabled\n", ret);
831824 cleanup_rapl_pmus();
@@ -836,7 +829,6 @@ module_init(rapl_pmu_init); · 4 unmodified lines
836829 static void __exit intel_rapl_exit(void)
837830 {
838831 cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_RAPL_ONLINE);
839− cpuhp_remove_state_nocalls(CPUHP_PERF_X86_RAPL_PREP);
840832 perf_pmu_unregister(&rapl_pmus->pmu);
841833 cleanup_rapl_pmus();
842834 }
arch/x86/events/intel/uncore.c+91−141
@@ -100,7 +100,13 @@ ssize_t uncore_event_show(struct kobject *kobj, · 99 unmodified lines
100100
101101 struct intel_uncore_box *uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu)
102102 {
103− return pmu->boxes[topology_logical_package_id(cpu)];
103+ unsigned int pkgid = topology_logical_package_id(cpu);
104+
105+ /*
106+ * The unsigned check also catches the '-1' return value for non
107+ * existent mappings in the topology map.
108+ */
109+ return pkgid < max_packages ? pmu->boxes[pkgid] : NULL;
104110 }
105111
106112 u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event)
@@ -764,30 +770,6 @@ static void uncore_pmu_unregister(struct intel_uncore_pmu *pmu) · 657 unmodified lines
764770 pmu->registered = false;
765771 }
766772
767−static void __uncore_exit_boxes(struct intel_uncore_type *type, int cpu)
768−{
769− struct intel_uncore_pmu *pmu = type->pmus;
770− struct intel_uncore_box *box;
771− int i, pkg;
772−
773− if (pmu) {
774− pkg = topology_physical_package_id(cpu);
775− for (i = 0; i < type->num_boxes; i++, pmu++) {
776− box = pmu->boxes[pkg];
777− if (box)
778− uncore_box_exit(box);
779− }
780− }
781−}
782−
783−static void uncore_exit_boxes(void *dummy)
784−{
785− struct intel_uncore_type **types;
786−
787− for (types = uncore_msr_uncores; *types; types++)
788− __uncore_exit_boxes(*types++, smp_processor_id());
789−}
790−
791773 static void uncore_free_boxes(struct intel_uncore_pmu *pmu)
792774 {
793775 int pkg;
@@ -1058,86 +1040,6 @@ static void uncore_pci_exit(void) · 264 unmodified lines
10581040 }
10591041 }
10601042
1061−static int uncore_cpu_dying(unsigned int cpu)
1062−{
1063− struct intel_uncore_type *type, **types = uncore_msr_uncores;
1064− struct intel_uncore_pmu *pmu;
1065− struct intel_uncore_box *box;
1066− int i, pkg;
1067−
1068− pkg = topology_logical_package_id(cpu);
1069− for (; *types; types++) {
1070− type = *types;
1071− pmu = type->pmus;
1072− for (i = 0; i < type->num_boxes; i++, pmu++) {
1073− box = pmu->boxes[pkg];
1074− if (box && atomic_dec_return(&box->refcnt) == 0)
1075− uncore_box_exit(box);
1076− }
1077− }
1078− return 0;
1079−}
1080−
1081−static int first_init;
1082−
1083−static int uncore_cpu_starting(unsigned int cpu)
1084−{
1085− struct intel_uncore_type *type, **types = uncore_msr_uncores;
1086− struct intel_uncore_pmu *pmu;
1087− struct intel_uncore_box *box;
1088− int i, pkg, ncpus = 1;
1089−
1090− if (first_init) {
1091− /*
1092− * On init we get the number of online cpus in the package
1093− * and set refcount for all of them.
1094− */
1095− ncpus = cpumask_weight(topology_core_cpumask(cpu));
1096− }
1097−
1098− pkg = topology_logical_package_id(cpu);
1099− for (; *types; types++) {
1100− type = *types;
1101− pmu = type->pmus;
1102− for (i = 0; i < type->num_boxes; i++, pmu++) {
1103− box = pmu->boxes[pkg];
1104− if (!box)
1105− continue;
1106− /* The first cpu on a package activates the box */
1107− if (atomic_add_return(ncpus, &box->refcnt) == ncpus)
1108− uncore_box_init(box);
1109− }
1110− }
1111−
1112− return 0;
1113−}
1114−
1115−static int uncore_cpu_prepare(unsigned int cpu)
1116−{
1117− struct intel_uncore_type *type, **types = uncore_msr_uncores;
1118− struct intel_uncore_pmu *pmu;
1119− struct intel_uncore_box *box;
1120− int i, pkg;
1121−
1122− pkg = topology_logical_package_id(cpu);
1123− for (; *types; types++) {
1124− type = *types;
1125− pmu = type->pmus;
1126− for (i = 0; i < type->num_boxes; i++, pmu++) {
1127− if (pmu->boxes[pkg])
1128− continue;
1129− /* First cpu of a package allocates the box */
1130− box = uncore_alloc_box(type, cpu_to_node(cpu));
1131− if (!box)
1132− return -ENOMEM;
1133− box->pmu = pmu;
1134− box->pkgid = pkg;
1135− pmu->boxes[pkg] = box;
1136− }
1137− }
1138− return 0;
1139−}
1140−
11411043 static void uncore_change_type_ctx(struct intel_uncore_type *type, int old_cpu,
11421044 int new_cpu)
11431045 {
@@ -1177,12 +1079,14 @@ static void uncore_change_context(struct intel_uncore_type **uncores, · 33 unmodified lines
11771079
11781080 static int uncore_event_cpu_offline(unsigned int cpu)
11791081 {
1180− int target;
1082+ struct intel_uncore_type *type, **types = uncore_msr_uncores;
1083+ struct intel_uncore_pmu *pmu;
1084+ struct intel_uncore_box *box;
1085+ int i, pkg, target;
11811086
11821087 /* Check if exiting cpu is used for collecting uncore events */
11831088 if (!cpumask_test_and_clear_cpu(cpu, &uncore_cpu_mask))
1184− return 0;
1185−
1089+ goto unref;
11861090 /* Find a new cpu to collect uncore events */
11871091 target = cpumask_any_but(topology_core_cpumask(cpu), cpu);
11881092
@@ -1194,12 +1098,82 @@ static int uncore_event_cpu_offline(unsigned int cpu) · 5 unmodified lines
11941098
11951099 uncore_change_context(uncore_msr_uncores, cpu, target);
11961100 uncore_change_context(uncore_pci_uncores, cpu, target);
1101+
1102+unref:
1103+ /* Clear the references */
1104+ pkg = topology_logical_package_id(cpu);
1105+ for (; *types; types++) {
1106+ type = *types;
1107+ pmu = type->pmus;
1108+ for (i = 0; i < type->num_boxes; i++, pmu++) {
1109+ box = pmu->boxes[pkg];
1110+ if (box && atomic_dec_return(&box->refcnt) == 0)
1111+ uncore_box_exit(box);
1112+ }
1113+ }
11971114 return 0;
11981115 }
11991116
1117+static int allocate_boxes(struct intel_uncore_type **types,
1118+ unsigned int pkg, unsigned int cpu)
1119+{
1120+ struct intel_uncore_box *box, *tmp;
1121+ struct intel_uncore_type *type;
1122+ struct intel_uncore_pmu *pmu;
1123+ LIST_HEAD(allocated);
1124+ int i;
1125+
1126+ /* Try to allocate all required boxes */
1127+ for (; *types; types++) {
1128+ type = *types;
1129+ pmu = type->pmus;
1130+ for (i = 0; i < type->num_boxes; i++, pmu++) {
1131+ if (pmu->boxes[pkg])
1132+ continue;
1133+ box = uncore_alloc_box(type, cpu_to_node(cpu));
1134+ if (!box)
1135+ goto cleanup;
1136+ box->pmu = pmu;
1137+ box->pkgid = pkg;
1138+ list_add(&box->active_list, &allocated);
1139+ }
1140+ }
1141+ /* Install them in the pmus */
1142+ list_for_each_entry_safe(box, tmp, &allocated, active_list) {
1143+ list_del_init(&box->active_list);
1144+ box->pmu->boxes[pkg] = box;
1145+ }
1146+ return 0;
1147+
1148+cleanup:
1149+ list_for_each_entry_safe(box, tmp, &allocated, active_list) {
1150+ list_del_init(&box->active_list);
1151+ kfree(box);
1152+ }
1153+ return -ENOMEM;
1154+}
1155+
12001156 static int uncore_event_cpu_online(unsigned int cpu)
12011157 {
1202− int target;
1158+ struct intel_uncore_type *type, **types = uncore_msr_uncores;
1159+ struct intel_uncore_pmu *pmu;
1160+ struct intel_uncore_box *box;
1161+ int i, ret, pkg, target;
1162+
1163+ pkg = topology_logical_package_id(cpu);
1164+ ret = allocate_boxes(types, pkg, cpu);
1165+ if (ret)
1166+ return ret;
1167+
1168+ for (; *types; types++) {
1169+ type = *types;
1170+ pmu = type->pmus;
1171+ for (i = 0; i < type->num_boxes; i++, pmu++) {
1172+ box = pmu->boxes[pkg];
1173+ if (!box && atomic_inc_return(&box->refcnt) == 1)
1174+ uncore_box_init(box);
1175+ }
1176+ }
12031177
12041178 /*
12051179 * Check if there is an online cpu in the package
@@ -1389,38 +1363,16 @@ static int __init intel_uncore_init(void) · 183 unmodified lines
13891363 if (cret && pret)
13901364 return -ENODEV;
13911365
1392− /*
1393− * Install callbacks. Core will call them for each online cpu.
1394− *
1395− * The first online cpu of each package allocates and takes
1396− * the refcounts for all other online cpus in that package.
1397− * If msrs are not enabled no allocation is required and
1398− * uncore_cpu_prepare() is not called for each online cpu.
1399− */
1400− if (!cret) {
1401− ret = cpuhp_setup_state(CPUHP_PERF_X86_UNCORE_PREP,
1402− "perf/x86/intel/uncore:prepare",
1403− uncore_cpu_prepare, NULL);
1404− if (ret)
1405− goto err;
1406− } else {
1407− cpuhp_setup_state_nocalls(CPUHP_PERF_X86_UNCORE_PREP,
1408− "perf/x86/intel/uncore:prepare",
1409− uncore_cpu_prepare, NULL);
1410− }
1411− first_init = 1;
1412− cpuhp_setup_state(CPUHP_AP_PERF_X86_UNCORE_STARTING,
1413− "perf/x86/uncore:starting",
1414− uncore_cpu_starting, uncore_cpu_dying);
1415− first_init = 0;
1416− cpuhp_setup_state(CPUHP_AP_PERF_X86_UNCORE_ONLINE,
1417− "perf/x86/uncore:online",
1418− uncore_event_cpu_online, uncore_event_cpu_offline);
1366+ /* Install hotplug callbacks to setup the targets for each package */
1367+ ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_UNCORE_ONLINE,
1368+ "perf/x86/intel/uncore:online",
1369+ uncore_event_cpu_online,
1370+ uncore_event_cpu_offline);
1371+ if (ret)
1372+ goto err;
14191373 return 0;
14201374
14211375 err:
1422− /* Undo box->init_box() */
1423− on_each_cpu_mask(&uncore_cpu_mask, uncore_exit_boxes, NULL, 1);
14241376 uncore_types_exit(uncore_msr_uncores);
14251377 uncore_pci_exit();
14261378 return ret;
@@ -1429,9 +1381,7 @@ module_init(intel_uncore_init); · 2 unmodified lines
14291381
14301382 static void __exit intel_uncore_exit(void)
14311383 {
1432− cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_UNCORE_ONLINE);
1433− cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_UNCORE_STARTING);
1434− cpuhp_remove_state_nocalls(CPUHP_PERF_X86_UNCORE_PREP);
1384+ cpuhp_remove_state(CPUHP_AP_PERF_X86_UNCORE_ONLINE);
14351385 uncore_types_exit(uncore_msr_uncores);
14361386 uncore_pci_exit();
14371387 }
arch/x86/include/asm/microcode.h+1−0
@@ -140,6 +140,7 @@ extern void __init load_ucode_bsp(void); · 139 unmodified lines
140140 extern void load_ucode_ap(void);
141141 void reload_early_microcode(void);
142142 extern bool get_builtin_firmware(struct cpio_data *cd, const char *name);
143+extern bool initrd_gone;
143144 #else
144145 static inline int __init microcode_init(void) { return 0; };
145146 static inline void __init load_ucode_bsp(void) { }
arch/x86/kernel/apic/io_apic.c+2−0
@@ -2117,6 +2117,7 @@ static inline void __init check_timer(void) · 2116 unmodified lines
21172117 if (idx != -1 && irq_trigger(idx))
21182118 unmask_ioapic_irq(irq_get_chip_data(0));
21192119 }
2120+ irq_domain_deactivate_irq(irq_data);
21202121 irq_domain_activate_irq(irq_data);
21212122 if (timer_irq_works()) {
21222123 if (disable_timer_pin_1 > 0)
@@ -2138,6 +2139,7 @@ static inline void __init check_timer(void) · 15 unmodified lines
21382139 * legacy devices should be connected to IO APIC #0
21392140 */
21402141 replace_pin_at_irq_node(data, node, apic1, pin1, apic2, pin2);
2142+ irq_domain_deactivate_irq(irq_data);
21412143 irq_domain_activate_irq(irq_data);
21422144 legacy_pic->unmask(0);
21432145 if (timer_irq_works()) {
arch/x86/kernel/cpu/mcheck/mce.c+12−19
@@ -1373,20 +1373,15 @@ static unsigned long mce_adjust_timer_default(unsigned long interval) · 1372 unmodified lines
13731373
13741374 static unsigned long (*mce_adjust_timer)(unsigned long interval) = mce_adjust_timer_default;
13751375
1376−static void __restart_timer(struct timer_list *t, unsigned long interval)
1376+static void __start_timer(struct timer_list *t, unsigned long interval)
13771377 {
13781378 unsigned long when = jiffies + interval;
13791379 unsigned long flags;
13801380
13811381 local_irq_save(flags);
13821382
1383− if (timer_pending(t)) {
1384− if (time_before(when, t->expires))
1385− mod_timer(t, when);
1386− } else {
1387− t->expires = round_jiffies(when);
1388− add_timer_on(t, smp_processor_id());
1389− }
1383+ if (!timer_pending(t) || time_before(when, t->expires))
1384+ mod_timer(t, round_jiffies(when));
13901385
13911386 local_irq_restore(flags);
13921387 }
@@ -1421,7 +1416,7 @@ static void mce_timer_fn(unsigned long data) · 28 unmodified lines
14211416
14221417 done:
14231418 __this_cpu_write(mce_next_interval, iv);
1424− __restart_timer(t, iv);
1419+ __start_timer(t, iv);
14251420 }
14261421
14271422 /*
@@ -1432,7 +1427,7 @@ void mce_timer_kick(unsigned long interval) · 4 unmodified lines
14321427 struct timer_list *t = this_cpu_ptr(&mce_timer);
14331428 unsigned long iv = __this_cpu_read(mce_next_interval);
14341429
1435− __restart_timer(t, interval);
1430+ __start_timer(t, interval);
14361431
14371432 if (interval < iv)
14381433 __this_cpu_write(mce_next_interval, interval);
@@ -1779,17 +1774,15 @@ static void __mcheck_cpu_clear_vendor(struct cpuinfo_x86 *c) · 340 unmodified lines
17791774 }
17801775 }
17811776
1782−static void mce_start_timer(unsigned int cpu, struct timer_list *t)
1777+static void mce_start_timer(struct timer_list *t)
17831778 {
17841779 unsigned long iv = check_interval * HZ;
17851780
17861781 if (mca_cfg.ignore_ce || !iv)
17871782 return;
17881783
1789− per_cpu(mce_next_interval, cpu) = iv;
1790−
1791− t->expires = round_jiffies(jiffies + iv);
1792− add_timer_on(t, cpu);
1784+ this_cpu_write(mce_next_interval, iv);
1785+ __start_timer(t, iv);
17931786 }
17941787
17951788 static void __mcheck_cpu_setup_timer(void)
@@ -1806,7 +1799,7 @@ static void __mcheck_cpu_init_timer(void) · 10 unmodified lines
18061799 unsigned int cpu = smp_processor_id();
18071800
18081801 setup_pinned_timer(t, mce_timer_fn, cpu);
1809− mce_start_timer(cpu, t);
1802+ mce_start_timer(t);
18101803 }
18111804
18121805 /* Handle unconfigured int18 (should never happen) */
@@ -2566,7 +2559,7 @@ static int mce_cpu_dead(unsigned int cpu) · 753 unmodified lines
25662559
25672560 static int mce_cpu_online(unsigned int cpu)
25682561 {
2569− struct timer_list *t = &per_cpu(mce_timer, cpu);
2562+ struct timer_list *t = this_cpu_ptr(&mce_timer);
25702563 int ret;
25712564
25722565 mce_device_create(cpu);
@@ -2577,13 +2570,13 @@ static int mce_cpu_online(unsigned int cpu) · 4 unmodified lines
25772570 return ret;
25782571 }
25792572 mce_reenable_cpu();
2580− mce_start_timer(cpu, t);
2573+ mce_start_timer(t);
25812574 return 0;
25822575 }
25832576
25842577 static int mce_cpu_pre_down(unsigned int cpu)
25852578 {
2586− struct timer_list *t = &per_cpu(mce_timer, cpu);
2579+ struct timer_list *t = this_cpu_ptr(&mce_timer);
25872580
25882581 mce_disable_cpu();
25892582 del_timer_sync(t);
arch/x86/kernel/cpu/microcode/amd.c+3−2
@@ -384,8 +384,9 @@ void load_ucode_amd_ap(unsigned int family) · 383 unmodified lines
384384 reget:
385385 if (!get_builtin_microcode(&cp, family)) {
386386 #ifdef CONFIG_BLK_DEV_INITRD
387− cp = find_cpio_data(ucode_path, (void *)initrd_start,
388− initrd_end - initrd_start, NULL);
387+ if (!initrd_gone)
388+ cp = find_cpio_data(ucode_path, (void *)initrd_start,
389+ initrd_end - initrd_start, NULL);
389390 #endif
390391 if (!(cp.data && cp.size)) {
391392 /*
arch/x86/kernel/cpu/microcode/core.c+17−5
@@ -46,6 +46,8 @@ · 45 unmodified lines
4646 static struct microcode_ops *microcode_ops;
4747 static bool dis_ucode_ldr = true;
4848
49+bool initrd_gone;
50+
4951 LIST_HEAD(microcode_cache);
5052
5153 /*
@@ -190,21 +192,24 @@ void load_ucode_ap(void) · 138 unmodified lines
190192 static int __init save_microcode_in_initrd(void)
191193 {
192194 struct cpuinfo_x86 *c = &boot_cpu_data;
195+ int ret = -EINVAL;
193196
194197 switch (c->x86_vendor) {
195198 case X86_VENDOR_INTEL:
196199 if (c->x86 >= 6)
197− return save_microcode_in_initrd_intel();
200+ ret = save_microcode_in_initrd_intel();
198201 break;
199202 case X86_VENDOR_AMD:
200203 if (c->x86 >= 0x10)
201− return save_microcode_in_initrd_amd(c->x86);
204+ ret = save_microcode_in_initrd_amd(c->x86);
202205 break;
203206 default:
204207 break;
205208 }
206209
207− return -EINVAL;
210+ initrd_gone = true;
211+
212+ return ret;
208213 }
209214
210215 struct cpio_data find_microcode_in_initrd(const char *path, bool use_pa)
@@ -247,9 +252,16 @@ struct cpio_data find_microcode_in_initrd(const char *path, bool use_pa) · 36 unmodified lines
247252 * has the virtual address of the beginning of the initrd. It also
248253 * possibly relocates the ramdisk. In either case, initrd_start contains
249254 * the updated address so use that instead.
255+ *
256+ * initrd_gone is for the hotplug case where we've thrown out initrd
257+ * already.
250258 */
251− if (!use_pa && initrd_start)
252− start = initrd_start;
259+ if (!use_pa) {
260+ if (initrd_gone)
261+ return (struct cpio_data){ NULL, 0, "" };
262+ if (initrd_start)
263+ start = initrd_start;
264+ }
253265
254266 return find_cpio_data(path, (void *)start, size, NULL);
255267 #else /* !CONFIG_BLK_DEV_INITRD */
arch/x86/kernel/cpu/microcode/intel.c+1−8
@@ -41,7 +41,7 @@ · 40 unmodified lines
4141
4242 static const char ucode_path[] = "kernel/x86/microcode/GenuineIntel.bin";
4343
44−/* Current microcode patch used in early patching */
44+/* Current microcode patch used in early patching on the APs. */
4545 struct microcode_intel *intel_ucode_patch;
4646
4747 static inline bool cpu_signatures_match(unsigned int s1, unsigned int p1,
@@ -607,12 +607,6 @@ int __init save_microcode_in_initrd_intel(void) · 559 unmodified lines
607607 struct ucode_cpu_info uci;
608608 struct cpio_data cp;
609609
610− /*
611− * AP loading didn't find any microcode patch, no need to save anything.
612− */
613− if (!intel_ucode_patch || IS_ERR(intel_ucode_patch))
614− return 0;
615−
616610 if (!load_builtin_intel_microcode(&cp))
617611 cp = find_microcode_in_initrd(ucode_path, false);
618612
@@ -628,7 +622,6 @@ int __init save_microcode_in_initrd_intel(void) · 9 unmodified lines
628622 return 0;
629623 }
630624
631−
632625 /*
633626 * @res_patch, output: a pointer to the patch we found.
634627 */
arch/x86/kernel/fpu/core.c+3−1
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #include <asm/fpu/regset.h>
1010 #include <asm/fpu/signal.h>
1111 #include <asm/fpu/types.h>
12+#include <asm/fpu/xstate.h>
1213 #include <asm/traps.h>
1314
1415 #include <linux/hardirq.h>
@@ -183,7 +184,8 @@ void fpstate_init(union fpregs_state *state) · 168 unmodified lines
183184 * it will #GP. Make sure it is replaced after the memset().
184185 */
185186 if (static_cpu_has(X86_FEATURE_XSAVES))
186− state->xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT;
187+ state->xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT |
188+ xfeatures_mask;
187189
188190 if (static_cpu_has(X86_FEATURE_FXSR))
189191 fpstate_init_fxstate(&state->fxsave);
arch/x86/kernel/hpet.c+1−0
@@ -352,6 +352,7 @@ static int hpet_resume(struct clock_event_device *evt, int timer) · 351 unmodified lines
352352 } else {
353353 struct hpet_dev *hdev = EVT_TO_HPET_DEV(evt);
354354
355+ irq_domain_deactivate_irq(irq_get_irq_data(hdev->irq));
355356 irq_domain_activate_irq(irq_get_irq_data(hdev->irq));
356357 disable_irq(hdev->irq);
357358 irq_set_affinity(hdev->irq, cpumask_of(hdev->cpu));
arch/x86/kvm/x86.c+1−0
@@ -3182,6 +3182,7 @@ static void fill_xsave(u8 *dest, struct kvm_vcpu *vcpu) · 3181 unmodified lines
31823182 memcpy(dest, xsave, XSAVE_HDR_OFFSET);
31833183
31843184 /* Set XSTATE_BV */
3185+ xstate_bv &= vcpu->arch.guest_supported_xcr0 | XFEATURE_MASK_FPSSE;
31853186 *(u64 *)(dest + XSAVE_HDR_OFFSET) = xstate_bv;
31863187
31873188 /*
arch/x86/platform/efi/efi_64.c+16−0
@@ -268,6 +268,22 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) · 267 unmodified lines
268268
269269 efi_scratch.use_pgd = true;
270270
271+ /*
272+ * Certain firmware versions are way too sentimential and still believe
273+ * they are exclusive and unquestionable owners of the first physical page,
274+ * even though they explicitly mark it as EFI_CONVENTIONAL_MEMORY
275+ * (but then write-access it later during SetVirtualAddressMap()).
276+ *
277+ * Create a 1:1 mapping for this page, to avoid triple faults during early
278+ * boot with such firmware. We are free to hand this page to the BIOS,
279+ * as trim_bios_range() will reserve the first page and isolate it away
280+ * from memory allocators anyway.
281+ */
282+ if (kernel_map_pages_in_pgd(pgd, 0x0, 0x0, 1, _PAGE_RW)) {
283+ pr_err("Failed to create 1:1 mapping for the first page!\n");
284+ return 1;
285+ }
286+
271287 /*
272288 * When making calls to the firmware everything needs to be 1:1
273289 * mapped and addressable with 32-bit pointers. Map the kernel
arch/xtensa/kernel/setup.c+1−1
@@ -419,7 +419,7 @@ subsys_initcall(topology_init); · 418 unmodified lines
419419
420420 void cpu_reset(void)
421421 {
422−#if XCHAL_HAVE_PTP_MMU
422+#if XCHAL_HAVE_PTP_MMU && IS_ENABLED(CONFIG_MMU)
423423 local_irq_disable();
424424 /*
425425 * We have full MMU: all autoload ways, ways 7, 8 and 9 of DTLB must
crypto/algapi.c+1−0
@@ -356,6 +356,7 @@ int crypto_register_alg(struct crypto_alg *alg) · 355 unmodified lines
356356 struct crypto_larval *larval;
357357 int err;
358358
359+ alg->cra_flags &= ~CRYPTO_ALG_DEAD;
359360 err = crypto_check_alg(alg);
360361 if (err)
361362 return err;
drivers/ata/libata-core.c+4−2
@@ -1702,6 +1702,8 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, · 1701 unmodified lines
17021702
17031703 if (qc->err_mask & ~AC_ERR_OTHER)
17041704 qc->err_mask &= ~AC_ERR_OTHER;
1705+ } else if (qc->tf.command == ATA_CMD_REQ_SENSE_DATA) {
1706+ qc->result_tf.command |= ATA_SENSE;
17051707 }
17061708
17071709 /* finish up */
@@ -4356,10 +4358,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { · 2648 unmodified lines
43564358 { "ST380013AS", "3.20", ATA_HORKAGE_MAX_SEC_1024 },
43574359
43584360 /*
4359− * Device times out with higher max sects.
4361+ * These devices time out with higher max sects.
43604362 * https://bugzilla.kernel.org/show_bug.cgi?id=121671
43614363 */
4362− { "LITEON CX1-JB256-HP", NULL, ATA_HORKAGE_MAX_SEC_1024 },
4364+ { "LITEON CX1-JB*-HP", NULL, ATA_HORKAGE_MAX_SEC_1024 },
43634365
43644366 /* Devices we expect to fail diagnostics */
43654367
drivers/ata/sata_mv.c+3−0
@@ -4132,6 +4132,9 @@ static int mv_platform_probe(struct platform_device *pdev) · 4131 unmodified lines
41324132 host->iomap = NULL;
41334133 hpriv->base = devm_ioremap(&pdev->dev, res->start,
41344134 resource_size(res));
4135+ if (!hpriv->base)
4136+ return -ENOMEM;
4137+
41354138 hpriv->base -= SATAHC0_REG_BASE;
41364139
41374140 hpriv->clk = clk_get(&pdev->dev, NULL);
drivers/base/firmware_class.c+1−4
@@ -558,9 +558,6 @@ static void fw_load_abort(struct firmware_priv *fw_priv) · 557 unmodified lines
558558 struct firmware_buf *buf = fw_priv->buf;
559559
560560 __fw_load_abort(buf);
561−
562− /* avoid user action after loading abort */
563− fw_priv->buf = NULL;
564561 }
565562
566563 static LIST_HEAD(pending_fw_head);
@@ -713,7 +710,7 @@ static ssize_t firmware_loading_store(struct device *dev, · 146 unmodified lines
713710
714711 mutex_lock(&fw_lock);
715712 fw_buf = fw_priv->buf;
716− if (!fw_buf)
713+ if (fw_state_is_aborted(&fw_buf->fw_st))
717714 goto out;
718715
719716 switch (loading) {
drivers/base/memory.c+6−6
@@ -389,33 +389,33 @@ static ssize_t show_valid_zones(struct device *dev, · 388 unmodified lines
389389 {
390390 struct memory_block *mem = to_memory_block(dev);
391391 unsigned long start_pfn, end_pfn;
392+ unsigned long valid_start, valid_end, valid_pages;
392393 unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block;
393− struct page *first_page;
394394 struct zone *zone;
395395 int zone_shift = 0;
396396
397397 start_pfn = section_nr_to_pfn(mem->start_section_nr);
398398 end_pfn = start_pfn + nr_pages;
399− first_page = pfn_to_page(start_pfn);
400399
401400 /* The block contains more than one zone can not be offlined. */
402− if (!test_pages_in_a_zone(start_pfn, end_pfn))
401+ if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start, &valid_end))
403402 return sprintf(buf, "none\n");
404403
405− zone = page_zone(first_page);
404+ zone = page_zone(pfn_to_page(valid_start));
405+ valid_pages = valid_end - valid_start;
406406
407407 /* MMOP_ONLINE_KEEP */
408408 sprintf(buf, "%s", zone->name);
409409
410410 /* MMOP_ONLINE_KERNEL */
411− zone_can_shift(start_pfn, nr_pages, ZONE_NORMAL, &zone_shift);
411+ zone_can_shift(valid_start, valid_pages, ZONE_NORMAL, &zone_shift);
412412 if (zone_shift) {
413413 strcat(buf, " ");
414414 strcat(buf, (zone + zone_shift)->name);
415415 }
416416
417417 /* MMOP_ONLINE_MOVABLE */
418− zone_can_shift(start_pfn, nr_pages, ZONE_MOVABLE, &zone_shift);
418+ zone_can_shift(valid_start, valid_pages, ZONE_MOVABLE, &zone_shift);
419419 if (zone_shift) {
420420 strcat(buf, " ");
421421 strcat(buf, (zone + zone_shift)->name);
drivers/bcma/bcma_private.h+3−0
@@ -45,6 +45,9 @@ int bcma_sprom_get(struct bcma_bus *bus); · 44 unmodified lines
4545 void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
4646 void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
4747 void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
48+#ifdef CONFIG_BCMA_DRIVER_MIPS
49+void bcma_chipco_serial_init(struct bcma_drv_cc *cc);
50+#endif /* CONFIG_BCMA_DRIVER_MIPS */
4851
4952 /* driver_chipcommon_b.c */
5053 int bcma_core_chipcommon_b_init(struct bcma_drv_cc_b *ccb);
drivers/bcma/driver_chipcommon.c+3−8
@@ -15,8 +15,6 @@ · 14 unmodified lines
1515 #include <linux/platform_device.h>
1616 #include <linux/bcma/bcma.h>
1717
18−static void bcma_chipco_serial_init(struct bcma_drv_cc *cc);
19−
2018 static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset,
2119 u32 mask, u32 value)
2220 {
@@ -186,9 +184,6 @@ void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc) · 163 unmodified lines
186184 if (cc->capabilities & BCMA_CC_CAP_PMU)
187185 bcma_pmu_early_init(cc);
188186
189− if (IS_BUILTIN(CONFIG_BCM47XX) && bus->hosttype == BCMA_HOSTTYPE_SOC)
190− bcma_chipco_serial_init(cc);
191−
192187 if (bus->hosttype == BCMA_HOSTTYPE_SOC)
193188 bcma_core_chipcommon_flash_detect(cc);
194189
@@ -378,9 +373,9 @@ u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value) · 183 unmodified lines
378373 return res;
379374 }
380375
381−static void bcma_chipco_serial_init(struct bcma_drv_cc *cc)
376+#ifdef CONFIG_BCMA_DRIVER_MIPS
377+void bcma_chipco_serial_init(struct bcma_drv_cc *cc)
382378 {
383−#if IS_BUILTIN(CONFIG_BCM47XX)
384379 unsigned int irq;
385380 u32 baud_base;
386381 u32 i;
@@ -422,5 +417,5 @@ static void bcma_chipco_serial_init(struct bcma_drv_cc *cc) · 35 unmodified lines
422417 ports[i].baud_base = baud_base;
423418 ports[i].reg_shift = 0;
424419 }
425−#endif /* CONFIG_BCM47XX */
426420 }
421+#endif /* CONFIG_BCMA_DRIVER_MIPS */
drivers/bcma/driver_mips.c+3−0
@@ -278,9 +278,12 @@ static void bcma_core_mips_nvram_init(struct bcma_drv_mips *mcore) · 277 unmodified lines
278278
279279 void bcma_core_mips_early_init(struct bcma_drv_mips *mcore)
280280 {
281+ struct bcma_bus *bus = mcore->core->bus;
282+
281283 if (mcore->early_setup_done)
282284 return;
283285
286+ bcma_chipco_serial_init(&bus->drv_cc);
284287 bcma_core_mips_nvram_init(mcore);
285288
286289 mcore->early_setup_done = true;
drivers/dma/cppi41.c+46−23
@@ -153,6 +153,8 @@ struct cppi41_dd { · 152 unmodified lines
153153
154154 /* context for suspend/resume */
155155 unsigned int dma_tdfdq;
156+
157+ bool is_suspended;
156158 };
157159
158160 #define FIST_COMPLETION_QUEUE 93
@@ -257,6 +259,10 @@ static struct cppi41_channel *desc_to_chan(struct cppi41_dd *cdd, u32 desc) · 98 unmodified lines
257259 BUG_ON(desc_num >= ALLOC_DECS_NUM);
258260 c = cdd->chan_busy[desc_num];
259261 cdd->chan_busy[desc_num] = NULL;
262+
263+ /* Usecount for chan_busy[], paired with push_desc_queue() */
264+ pm_runtime_put(cdd->ddev.dev);
265+
260266 return c;
261267 }
262268
@@ -317,12 +323,12 @@ static irqreturn_t cppi41_irq(int irq, void *data) · 54 unmodified lines
317323
318324 while (val) {
319325 u32 desc, len;
320− int error;
321326
322− error = pm_runtime_get(cdd->ddev.dev);
323− if (error < 0)
324− dev_err(cdd->ddev.dev, "%s pm runtime get: %i\n",
325− __func__, error);
327+ /*
328+ * This should never trigger, see the comments in
329+ * push_desc_queue()
330+ */
331+ WARN_ON(cdd->is_suspended);
326332
327333 q_num = __fls(val);
328334 val &= ~(1 << q_num);
@@ -343,9 +349,6 @@ static irqreturn_t cppi41_irq(int irq, void *data) · 14 unmodified lines
343349 c->residue = pd_trans_len(c->desc->pd6) - len;
344350 dma_cookie_complete(&c->txd);
345351 dmaengine_desc_get_callback_invoke(&c->txd, NULL);
346−
347− pm_runtime_mark_last_busy(cdd->ddev.dev);
348− pm_runtime_put_autosuspend(cdd->ddev.dev);
349352 }
350353 }
351354 return IRQ_HANDLED;
@@ -447,6 +450,15 @@ static void push_desc_queue(struct cppi41_channel *c) · 95 unmodified lines
447450 */
448451 __iowmb();
449452
453+ /*
454+ * DMA transfers can take at least 200ms to complete with USB mass
455+ * storage connected. To prevent autosuspend timeouts, we must use
456+ * pm_runtime_get/put() when chan_busy[] is modified. This will get
457+ * cleared in desc_to_chan() or cppi41_stop_chan() depending on the
458+ * outcome of the transfer.
459+ */
460+ pm_runtime_get(cdd->ddev.dev);
461+
450462 desc_phys = lower_32_bits(c->desc_phys);
451463 desc_num = (desc_phys - cdd->descs_phys) / sizeof(struct cppi41_desc);
452464 WARN_ON(cdd->chan_busy[desc_num]);
@@ -457,20 +469,26 @@ static void push_desc_queue(struct cppi41_channel *c) · 4 unmodified lines
457469 cppi_writel(reg, cdd->qmgr_mem + QMGR_QUEUE_D(c->q_num));
458470 }
459471
460−static void pending_desc(struct cppi41_channel *c)
472+/*
473+ * Caller must hold cdd->lock to prevent push_desc_queue()
474+ * getting called out of order. We have both cppi41_dma_issue_pending()
475+ * and cppi41_runtime_resume() call this function.
476+ */
477+static void cppi41_run_queue(struct cppi41_dd *cdd)
461478 {
462− struct cppi41_dd *cdd = c->cdd;
463− unsigned long flags;
479+ struct cppi41_channel *c, *_c;
464480
465− spin_lock_irqsave(&cdd->lock, flags);
466− list_add_tail(&c->node, &cdd->pending);
467− spin_unlock_irqrestore(&cdd->lock, flags);
481+ list_for_each_entry_safe(c, _c, &cdd->pending, node) {
482+ push_desc_queue(c);
483+ list_del(&c->node);
484+ }
468485 }
469486
470487 static void cppi41_dma_issue_pending(struct dma_chan *chan)
471488 {
472489 struct cppi41_channel *c = to_cpp41_chan(chan);
473490 struct cppi41_dd *cdd = c->cdd;
491+ unsigned long flags;
474492 int error;
475493
476494 error = pm_runtime_get(cdd->ddev.dev);
@@ -482,10 +500,11 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan) · 5 unmodified lines
482500 return;
483501 }
484502
485− if (likely(pm_runtime_active(cdd->ddev.dev)))
486− push_desc_queue(c);
487− else
488− pending_desc(c);
503+ spin_lock_irqsave(&cdd->lock, flags);
504+ list_add_tail(&c->node, &cdd->pending);
505+ if (!cdd->is_suspended)
506+ cppi41_run_queue(cdd);
507+ spin_unlock_irqrestore(&cdd->lock, flags);
489508
490509 pm_runtime_mark_last_busy(cdd->ddev.dev);
491510 pm_runtime_put_autosuspend(cdd->ddev.dev);
@@ -705,6 +724,9 @@ static int cppi41_stop_chan(struct dma_chan *chan) · 213 unmodified lines
705724 WARN_ON(!cdd->chan_busy[desc_num]);
706725 cdd->chan_busy[desc_num] = NULL;
707726
727+ /* Usecount for chan_busy[], paired with push_desc_queue() */
728+ pm_runtime_put(cdd->ddev.dev);
729+
708730 return 0;
709731 }
710732
@@ -1150,8 +1172,12 @@ static int __maybe_unused cppi41_resume(struct device *dev) · 439 unmodified lines
11501172 static int __maybe_unused cppi41_runtime_suspend(struct device *dev)
11511173 {
11521174 struct cppi41_dd *cdd = dev_get_drvdata(dev);
1175+ unsigned long flags;
11531176
1177+ spin_lock_irqsave(&cdd->lock, flags);
1178+ cdd->is_suspended = true;
11541179 WARN_ON(!list_empty(&cdd->pending));
1180+ spin_unlock_irqrestore(&cdd->lock, flags);
11551181
11561182 return 0;
11571183 }
@@ -1159,14 +1185,11 @@ static int __maybe_unused cppi41_runtime_suspend(struct device *dev) · 1 unmodified line
11591185 static int __maybe_unused cppi41_runtime_resume(struct device *dev)
11601186 {
11611187 struct cppi41_dd *cdd = dev_get_drvdata(dev);
1162− struct cppi41_channel *c, *_c;
11631188 unsigned long flags;
11641189
11651190 spin_lock_irqsave(&cdd->lock, flags);
1166− list_for_each_entry_safe(c, _c, &cdd->pending, node) {
1167− push_desc_queue(c);
1168− list_del(&c->node);
1169− }
1191+ cdd->is_suspended = false;
1192+ cppi41_run_queue(cdd);
11701193 spin_unlock_irqrestore(&cdd->lock, flags);
11711194
11721195 return 0;
drivers/dma/pl330.c+6−13
@@ -1699,7 +1699,6 @@ static bool _chan_ns(const struct pl330_dmac *pl330, int i) · 1698 unmodified lines
16991699 static struct pl330_thread *pl330_request_channel(struct pl330_dmac *pl330)
17001700 {
17011701 struct pl330_thread *thrd = NULL;
1702− unsigned long flags;
17031702 int chans, i;
17041703
17051704 if (pl330->state == DYING)
@@ -1707,8 +1706,6 @@ static struct pl330_thread *pl330_request_channel(struct pl330_dmac *pl330) · 1 unmodified line
17071706
17081707 chans = pl330->pcfg.num_chan;
17091708
1710− spin_lock_irqsave(&pl330->lock, flags);
1711−
17121709 for (i = 0; i < chans; i++) {
17131710 thrd = &pl330->channels[i];
17141711 if ((thrd->free) && (!_manager_ns(thrd) ||
@@ -1726,8 +1723,6 @@ static struct pl330_thread *pl330_request_channel(struct pl330_dmac *pl330) · 11 unmodified lines
17261723 thrd = NULL;
17271724 }
17281725
1729− spin_unlock_irqrestore(&pl330->lock, flags);
1730−
17311726 return thrd;
17321727 }
17331728
@@ -1745,7 +1740,6 @@ static inline void _free_event(struct pl330_thread *thrd, int ev) · 11 unmodified lines
17451740 static void pl330_release_channel(struct pl330_thread *thrd)
17461741 {
17471742 struct pl330_dmac *pl330;
1748− unsigned long flags;
17491743
17501744 if (!thrd || thrd->free)
17511745 return;
@@ -1757,10 +1751,8 @@ static void pl330_release_channel(struct pl330_thread *thrd) · 5 unmodified lines
17571751
17581752 pl330 = thrd->dmac;
17591753
1760− spin_lock_irqsave(&pl330->lock, flags);
17611754 _free_event(thrd, thrd->ev);
17621755 thrd->free = true;
1763− spin_unlock_irqrestore(&pl330->lock, flags);
17641756 }
17651757
17661758 /* Initialize the structure for PL330 configuration, that can be used
@@ -2122,20 +2114,20 @@ static int pl330_alloc_chan_resources(struct dma_chan *chan) · 355 unmodified lines
21222114 struct pl330_dmac *pl330 = pch->dmac;
21232115 unsigned long flags;
21242116
2125− spin_lock_irqsave(&pch->lock, flags);
2117+ spin_lock_irqsave(&pl330->lock, flags);
21262118
21272119 dma_cookie_init(chan);
21282120 pch->cyclic = false;
21292121
21302122 pch->thread = pl330_request_channel(pl330);
21312123 if (!pch->thread) {
2132− spin_unlock_irqrestore(&pch->lock, flags);
2124+ spin_unlock_irqrestore(&pl330->lock, flags);
21332125 return -ENOMEM;
21342126 }
21352127
21362128 tasklet_init(&pch->task, pl330_tasklet, (unsigned long) pch);
21372129
2138− spin_unlock_irqrestore(&pch->lock, flags);
2130+ spin_unlock_irqrestore(&pl330->lock, flags);
21392131
21402132 return 1;
21412133 }
@@ -2238,12 +2230,13 @@ static int pl330_pause(struct dma_chan *chan) · 96 unmodified lines
22382230 static void pl330_free_chan_resources(struct dma_chan *chan)
22392231 {
22402232 struct dma_pl330_chan *pch = to_pchan(chan);
2233+ struct pl330_dmac *pl330 = pch->dmac;
22412234 unsigned long flags;
22422235
22432236 tasklet_kill(&pch->task);
22442237
22452238 pm_runtime_get_sync(pch->dmac->ddma.dev);
2246− spin_lock_irqsave(&pch->lock, flags);
2239+ spin_lock_irqsave(&pl330->lock, flags);
22472240
22482241 pl330_release_channel(pch->thread);
22492242 pch->thread = NULL;
@@ -2251,7 +2244,7 @@ static void pl330_free_chan_resources(struct dma_chan *chan) · 1 unmodified line
22512244 if (pch->cyclic)
22522245 list_splice_tail_init(&pch->work_list, &pch->dmac->desc_pool);
22532246
2254− spin_unlock_irqrestore(&pch->lock, flags);
2247+ spin_unlock_irqrestore(&pl330->lock, flags);
22552248 pm_runtime_mark_last_busy(pch->dmac->ddma.dev);
22562249 pm_runtime_put_autosuspend(pch->dmac->ddma.dev);
22572250 }
drivers/firmware/efi/libstub/fdt.c+3−11
@@ -187,6 +187,7 @@ static efi_status_t update_fdt_memmap(void *fdt, struct efi_boot_memmap *map) · 186 unmodified lines
187187 struct exit_boot_struct {
188188 efi_memory_desc_t *runtime_map;
189189 int *runtime_entry_count;
190+ void *new_fdt_addr;
190191 };
191192
192193 static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg,
@@ -202,7 +203,7 @@ static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg, · 9 unmodified lines
202203 efi_get_virtmap(*map->map, *map->map_size, *map->desc_size,
203204 p->runtime_map, p->runtime_entry_count);
204205
205− return EFI_SUCCESS;
206+ return update_fdt_memmap(p->new_fdt_addr, map);
206207 }
207208
208209 /*
@@ -300,22 +301,13 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, · 91 unmodified lines
300301
301302 priv.runtime_map = runtime_map;
302303 priv.runtime_entry_count = &runtime_entry_count;
304+ priv.new_fdt_addr = (void *)*new_fdt_addr;
303305 status = efi_exit_boot_services(sys_table, handle, &map, &priv,
304306 exit_boot_func);
305307
306308 if (status == EFI_SUCCESS) {
307309 efi_set_virtual_address_map_t *svam;
308310
309− status = update_fdt_memmap((void *)*new_fdt_addr, &map);
310− if (status != EFI_SUCCESS) {
311− /*
312− * The kernel won't get far without the memory map, but
313− * may still be able to print something meaningful so
314− * return success here.
315− */
316− return EFI_SUCCESS;
317− }
318−
319311 /* Install the new virtual address map */
320312 svam = sys_table->runtime->set_virtual_address_map;
321313 status = svam(runtime_entry_count * desc_size, desc_size,
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c+3−1
@@ -254,6 +254,9 @@ static void gmc_v6_0_mc_program(struct amdgpu_device *adev) · 253 unmodified lines
254254 }
255255 WREG32(mmHDP_REG_COHERENCY_FLUSH_CNTL, 0);
256256
257+ if (adev->mode_info.num_crtc)
258+ amdgpu_display_set_vga_render_state(adev, false);
259+
257260 gmc_v6_0_mc_stop(adev, &save);
258261
259262 if (gmc_v6_0_wait_for_idle((void *)adev)) {
@@ -283,7 +286,6 @@ static void gmc_v6_0_mc_program(struct amdgpu_device *adev) · 23 unmodified lines
283286 dev_warn(adev->dev, "Wait for MC idle timedout !\n");
284287 }
285288 gmc_v6_0_mc_resume(adev, &save);
286− amdgpu_display_set_vga_render_state(adev, false);
287289 }
288290
289291 static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
drivers/gpu/drm/drm_atomic.c+8−5
@@ -2032,13 +2032,16 @@ static void complete_crtc_signaling(struct drm_device *dev, · 2031 unmodified lines
20322032 }
20332033
20342034 for_each_crtc_in_state(state, crtc, crtc_state, i) {
2035+ struct drm_pending_vblank_event *event = crtc_state->event;
20352036 /*
2036− * TEST_ONLY and PAGE_FLIP_EVENT are mutually
2037− * exclusive, if they weren't, this code should be
2038− * called on success for TEST_ONLY too.
2037+ * Free the allocated event. drm_atomic_helper_setup_commit
2038+ * can allocate an event too, so only free it if it's ours
2039+ * to prevent a double free in drm_atomic_state_clear.
20392040 */
2040− if (crtc_state->event)
2041− drm_event_cancel_free(dev, &crtc_state->event->base);
2041+ if (event && (event->base.fence || event->base.file_priv)) {
2042+ drm_event_cancel_free(dev, &event->base);
2043+ crtc_state->event = NULL;
2044+ }
20422045 }
20432046
20442047 if (!fence_state)
drivers/gpu/drm/drm_atomic_helper.c+0−9
@@ -1666,9 +1666,6 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev, · 1665 unmodified lines
16661666
16671667 funcs = plane->helper_private;
16681668
1669− if (!drm_atomic_helper_framebuffer_changed(dev, state, plane_state->crtc))
1670− continue;
1671−
16721669 if (funcs->prepare_fb) {
16731670 ret = funcs->prepare_fb(plane, plane_state);
16741671 if (ret)
@@ -1685,9 +1682,6 @@ fail: · 10 unmodified lines
16851682 if (j >= i)
16861683 continue;
16871684
1688− if (!drm_atomic_helper_framebuffer_changed(dev, state, plane_state->crtc))
1689− continue;
1690−
16911685 funcs = plane->helper_private;
16921686
16931687 if (funcs->cleanup_fb)
@@ -1954,9 +1948,6 @@ void drm_atomic_helper_cleanup_planes(struct drm_device *dev, · 260 unmodified lines
19541948 for_each_plane_in_state(old_state, plane, plane_state, i) {
19551949 const struct drm_plane_helper_funcs *funcs;
19561950
1957− if (!drm_atomic_helper_framebuffer_changed(dev, old_state, plane_state->crtc))
1958− continue;
1959−
19601951 funcs = plane->helper_private;
19611952
19621953 if (funcs->cleanup_fb)
drivers/gpu/drm/drm_connector.c+18−5
@@ -225,6 +225,7 @@ int drm_connector_init(struct drm_device *dev, · 224 unmodified lines
225225
226226 INIT_LIST_HEAD(&connector->probed_modes);
227227 INIT_LIST_HEAD(&connector->modes);
228+ mutex_init(&connector->mutex);
228229 connector->edid_blob_ptr = NULL;
229230 connector->status = connector_status_unknown;
230231
@@ -359,6 +360,8 @@ void drm_connector_cleanup(struct drm_connector *connector) · 128 unmodified lines
359360 connector->funcs->atomic_destroy_state(connector,
360361 connector->state);
361362
363+ mutex_destroy(&connector->mutex);
364+
362365 memset(connector, 0, sizeof(*connector));
363366 }
364367 EXPORT_SYMBOL(drm_connector_cleanup);
@@ -374,14 +377,18 @@ EXPORT_SYMBOL(drm_connector_cleanup); · 9 unmodified lines
374377 */
375378 int drm_connector_register(struct drm_connector *connector)
376379 {
377− int ret;
380+ int ret = 0;
378381
379− if (connector->registered)
382+ if (!connector->dev->registered)
380383 return 0;
381384
385+ mutex_lock(&connector->mutex);
386+ if (connector->registered)
387+ goto unlock;
388+
382389 ret = drm_sysfs_connector_add(connector);
383390 if (ret)
384− return ret;
391+ goto unlock;
385392
386393 ret = drm_debugfs_connector_add(connector);
387394 if (ret) {
@@ -397,12 +404,14 @@ int drm_connector_register(struct drm_connector *connector) · 9 unmodified lines
397404 drm_mode_object_register(connector->dev, &connector->base);
398405
399406 connector->registered = true;
400− return 0;
407+ goto unlock;
401408
402409 err_debugfs:
403410 drm_debugfs_connector_remove(connector);
404411 err_sysfs:
405412 drm_sysfs_connector_remove(connector);
413+unlock:
414+ mutex_unlock(&connector->mutex);
406415 return ret;
407416 }
408417 EXPORT_SYMBOL(drm_connector_register);
@@ -415,8 +424,11 @@ EXPORT_SYMBOL(drm_connector_register); · 6 unmodified lines
415424 */
416425 void drm_connector_unregister(struct drm_connector *connector)
417426 {
418− if (!connector->registered)
427+ mutex_lock(&connector->mutex);
428+ if (!connector->registered) {
429+ mutex_unlock(&connector->mutex);
419430 return;
431+ }
420432
421433 if (connector->funcs->early_unregister)
422434 connector->funcs->early_unregister(connector);
@@ -425,6 +437,7 @@ void drm_connector_unregister(struct drm_connector *connector) · 2 unmodified lines
425437 drm_debugfs_connector_remove(connector);
426438
427439 connector->registered = false;
440+ mutex_unlock(&connector->mutex);
428441 }
429442 EXPORT_SYMBOL(drm_connector_unregister);
430443
drivers/gpu/drm/drm_drv.c+4−0
@@ -745,6 +745,8 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags) · 744 unmodified lines
745745 if (ret)
746746 goto err_minors;
747747
748+ dev->registered = true;
749+
748750 if (dev->driver->load) {
749751 ret = dev->driver->load(dev, flags);
750752 if (ret)
@@ -785,6 +787,8 @@ void drm_dev_unregister(struct drm_device *dev) · 34 unmodified lines
785787
786788 drm_lastclose(dev);
787789
790+ dev->registered = false;
791+
788792 if (drm_core_check_feature(dev, DRIVER_MODESET))
789793 drm_modeset_unregister_all(dev);
790794
drivers/gpu/drm/i915/i915_drv.h+4−12
@@ -1012,6 +1012,8 @@ struct intel_fbc { · 1011 unmodified lines
10121012 struct work_struct underrun_work;
10131013
10141014 struct intel_fbc_state_cache {
1015+ struct i915_vma *vma;
1016+
10151017 struct {
10161018 unsigned int mode_flags;
10171019 uint32_t hsw_bdw_pixel_rate;
@@ -1025,15 +1027,14 @@ struct intel_fbc { · 7 unmodified lines
10251027 } plane;
10261028
10271029 struct {
1028− u64 ilk_ggtt_offset;
10291030 uint32_t pixel_format;
10301031 unsigned int stride;
1031− int fence_reg;
1032− unsigned int tiling_mode;
10331032 } fb;
10341033 } state_cache;
10351034
10361035 struct intel_fbc_reg_params {
1036+ struct i915_vma *vma;
1037+
10371038 struct {
10381039 enum pipe pipe;
10391040 enum plane plane;
@@ -1041,10 +1042,8 @@ struct intel_fbc { · 1 unmodified line
10411042 } crtc;
10421043
10431044 struct {
1044− u64 ggtt_offset;
10451045 uint32_t pixel_format;
10461046 unsigned int stride;
1047− int fence_reg;
10481047 } fb;
10491048
10501049 int cfb_size;
@@ -3168,13 +3167,6 @@ i915_gem_object_to_ggtt(struct drm_i915_gem_object *obj, · 2117 unmodified lines
31683167 return i915_gem_obj_to_vma(obj, &to_i915(obj->base.dev)->ggtt.base, view);
31693168 }
31703169
3171−static inline unsigned long
3172−i915_gem_object_ggtt_offset(struct drm_i915_gem_object *o,
3173− const struct i915_ggtt_view *view)
3174−{
3175− return i915_ggtt_offset(i915_gem_object_to_ggtt(o, view));
3176−}
3177−
31783170 /* i915_gem_fence_reg.c */
31793171 int __must_check i915_vma_get_fence(struct i915_vma *vma);
31803172 int __must_check i915_vma_put_fence(struct i915_vma *vma);
drivers/gpu/drm/i915/intel_atomic_plane.c+20−0
@@ -85,6 +85,8 @@ intel_plane_duplicate_state(struct drm_plane *plane) · 84 unmodified lines
8585
8686 __drm_atomic_helper_plane_duplicate_state(plane, state);
8787
88+ intel_state->vma = NULL;
89+
8890 return state;
8991 }
9092
@@ -100,6 +102,24 @@ void · 9 unmodified lines
100102 intel_plane_destroy_state(struct drm_plane *plane,
101103 struct drm_plane_state *state)
102104 {
105+ struct i915_vma *vma;
106+
107+ vma = fetch_and_zero(&to_intel_plane_state(state)->vma);
108+
109+ /*
110+ * FIXME: Normally intel_cleanup_plane_fb handles destruction of vma.
111+ * We currently don't clear all planes during driver unload, so we have
112+ * to be able to unpin vma here for now.
113+ *
114+ * Normally this can only happen during unload when kmscon is disabled
115+ * and userspace doesn't attempt to set a framebuffer at all.
116+ */
117+ if (vma) {
118+ mutex_lock(&plane->dev->struct_mutex);
119+ intel_unpin_fb_vma(vma);
120+ mutex_unlock(&plane->dev->struct_mutex);
121+ }
122+
103123 drm_atomic_helper_plane_destroy_state(plane, state);
104124 }
105125
drivers/gpu/drm/i915/intel_display.c+42−83
@@ -2235,27 +2235,22 @@ intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb, unsigned int rotation) · 2234 unmodified lines
22352235 i915_vma_pin_fence(vma);
22362236 }
22372237
2238+ i915_vma_get(vma);
22382239 err:
22392240 intel_runtime_pm_put(dev_priv);
22402241 return vma;
22412242 }
22422243
2243−void intel_unpin_fb_obj(struct drm_framebuffer *fb, unsigned int rotation)
2244+void intel_unpin_fb_vma(struct i915_vma *vma)
22442245 {
2245− struct drm_i915_gem_object *obj = intel_fb_obj(fb);
2246− struct i915_ggtt_view view;
2247− struct i915_vma *vma;
2248−
2249− WARN_ON(!mutex_is_locked(&obj->base.dev->struct_mutex));
2250−
2251− intel_fill_fb_ggtt_view(&view, fb, rotation);
2252− vma = i915_gem_object_to_ggtt(obj, &view);
2246+ lockdep_assert_held(&vma->vm->dev->struct_mutex);
22532247
22542248 if (WARN_ON_ONCE(!vma))
22552249 return;
22562250
22572251 i915_vma_unpin_fence(vma);
22582252 i915_gem_object_unpin_from_display_plane(vma);
2253+ i915_vma_put(vma);
22592254 }
22602255
22612256 static int intel_fb_pitch(const struct drm_framebuffer *fb, int plane,
@@ -2750,7 +2745,6 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, · 488 unmodified lines
27502745 struct drm_device *dev = intel_crtc->base.dev;
27512746 struct drm_i915_private *dev_priv = to_i915(dev);
27522747 struct drm_crtc *c;
2753− struct intel_crtc *i;
27542748 struct drm_i915_gem_object *obj;
27552749 struct drm_plane *primary = intel_crtc->base.primary;
27562750 struct drm_plane_state *plane_state = primary->state;
@@ -2775,20 +2769,20 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, · 18 unmodified lines
27752769 * an fb with another CRTC instead
27762770 */
27772771 for_each_crtc(dev, c) {
2778− i = to_intel_crtc(c);
2772+ struct intel_plane_state *state;
27792773
27802774 if (c == &intel_crtc->base)
27812775 continue;
27822776
2783− if (!i->active)
2777+ if (!to_intel_crtc(c)->active)
27842778 continue;
27852779
2786− fb = c->primary->fb;
2787− if (!fb)
2780+ state = to_intel_plane_state(c->primary->state);
2781+ if (!state->vma)
27882782 continue;
27892783
2790− obj = intel_fb_obj(fb);
2791− if (i915_gem_object_ggtt_offset(obj, NULL) == plane_config->base) {
2784+ if (intel_plane_ggtt_offset(state) == plane_config->base) {
2785+ fb = c->primary->fb;
27922786 drm_framebuffer_reference(fb);
27932787 goto valid_fb;
27942788 }
@@ -2809,6 +2803,19 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, · 14 unmodified lines
28092803 return;
28102804
28112805 valid_fb:
2806+ mutex_lock(&dev->struct_mutex);
2807+ intel_state->vma =
2808+ intel_pin_and_fence_fb_obj(fb, primary->state->rotation);
2809+ mutex_unlock(&dev->struct_mutex);
2810+ if (IS_ERR(intel_state->vma)) {
2811+ DRM_ERROR("failed to pin boot fb on pipe %d: %li\n",
2812+ intel_crtc->pipe, PTR_ERR(intel_state->vma));
2813+
2814+ intel_state->vma = NULL;
2815+ drm_framebuffer_unreference(fb);
2816+ return;
2817+ }
2818+
28122819 plane_state->src_x = 0;
28132820 plane_state->src_y = 0;
28142821 plane_state->src_w = fb->width << 16;
@@ -3104,13 +3111,13 @@ static void i9xx_update_primary_plane(struct drm_plane *primary, · 289 unmodified lines
31043111 I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]);
31053112 if (INTEL_GEN(dev_priv) >= 4) {
31063113 I915_WRITE(DSPSURF(plane),
3107− intel_fb_gtt_offset(fb, rotation) +
3114+ intel_plane_ggtt_offset(plane_state) +
31083115 intel_crtc->dspaddr_offset);
31093116 I915_WRITE(DSPTILEOFF(plane), (y << 16) | x);
31103117 I915_WRITE(DSPLINOFF(plane), linear_offset);
31113118 } else {
31123119 I915_WRITE(DSPADDR(plane),
3113− intel_fb_gtt_offset(fb, rotation) +
3120+ intel_plane_ggtt_offset(plane_state) +
31143121 intel_crtc->dspaddr_offset);
31153122 }
31163123 POSTING_READ(reg);
@@ -3207,7 +3214,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary, · 90 unmodified lines
32073214
32083215 I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]);
32093216 I915_WRITE(DSPSURF(plane),
3210− intel_fb_gtt_offset(fb, rotation) +
3217+ intel_plane_ggtt_offset(plane_state) +
32113218 intel_crtc->dspaddr_offset);
32123219 if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
32133220 I915_WRITE(DSPOFFSET(plane), (y << 16) | x);
@@ -3230,23 +3237,6 @@ u32 intel_fb_stride_alignment(const struct drm_i915_private *dev_priv, · 16 unmodified lines
32303237 }
32313238 }
32323239
3233−u32 intel_fb_gtt_offset(struct drm_framebuffer *fb,
3234− unsigned int rotation)
3235−{
3236− struct drm_i915_gem_object *obj = intel_fb_obj(fb);
3237− struct i915_ggtt_view view;
3238− struct i915_vma *vma;
3239−
3240− intel_fill_fb_ggtt_view(&view, fb, rotation);
3241−
3242− vma = i915_gem_object_to_ggtt(obj, &view);
3243− if (WARN(!vma, "ggtt vma for display object not found! (view=%u)\n",
3244− view.type))
3245− return -1;
3246−
3247− return i915_ggtt_offset(vma);
3248−}
3249−
32503240 static void skl_detach_scaler(struct intel_crtc *intel_crtc, int id)
32513241 {
32523242 struct drm_device *dev = intel_crtc->base.dev;
@@ -3441,7 +3431,7 @@ static void skylake_update_primary_plane(struct drm_plane *plane, · 188 unmodified lines
34413431 }
34423432
34433433 I915_WRITE(PLANE_SURF(pipe, 0),
3444− intel_fb_gtt_offset(fb, rotation) + surf_addr);
3434+ intel_plane_ggtt_offset(plane_state) + surf_addr);
34453435
34463436 POSTING_READ(PLANE_SURF(pipe, 0));
34473437 }
@@ -11536,7 +11526,7 @@ static void intel_unpin_work_fn(struct work_struct *__work) · 8088 unmodified lines
1153611526 flush_work(&work->mmio_work);
1153711527
1153811528 mutex_lock(&dev->struct_mutex);
11539− intel_unpin_fb_obj(work->old_fb, primary->state->rotation);
11529+ intel_unpin_fb_vma(work->old_vma);
1154011530 i915_gem_object_put(work->pending_flip_obj);
1154111531 mutex_unlock(&dev->struct_mutex);
1154211532
@@ -12246,8 +12236,10 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, · 703 unmodified lines
1224612236 goto cleanup_pending;
1224712237 }
1224812238
12249− work->gtt_offset = intel_fb_gtt_offset(fb, primary->state->rotation);
12250− work->gtt_offset += intel_crtc->dspaddr_offset;
12239+ work->old_vma = to_intel_plane_state(primary->state)->vma;
12240+ to_intel_plane_state(primary->state)->vma = vma;
12241+
12242+ work->gtt_offset = i915_ggtt_offset(vma) + intel_crtc->dspaddr_offset;
1225112243 work->rotation = crtc->primary->state->rotation;
1225212244
1225312245 /*
@@ -12301,7 +12293,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, · 47 unmodified lines
1230112293 cleanup_request:
1230212294 i915_add_request_no_flush(request);
1230312295 cleanup_unpin:
12304− intel_unpin_fb_obj(fb, crtc->primary->state->rotation);
12296+ to_intel_plane_state(primary->state)->vma = work->old_vma;
12297+ intel_unpin_fb_vma(vma);
1230512298 cleanup_pending:
1230612299 atomic_dec(&intel_crtc->unpin_work_count);
1230712300 unlock:
@@ -14794,6 +14787,8 @@ intel_prepare_plane_fb(struct drm_plane *plane, · 2486 unmodified lines
1479414787 DRM_DEBUG_KMS("failed to pin object\n");
1479514788 return PTR_ERR(vma);
1479614789 }
14790+
14791+ to_intel_plane_state(new_state)->vma = vma;
1479714792 }
1479814793
1479914794 return 0;
@@ -14812,19 +14807,12 @@ void · 12 unmodified lines
1481214807 intel_cleanup_plane_fb(struct drm_plane *plane,
1481314808 struct drm_plane_state *old_state)
1481414809 {
14815− struct drm_i915_private *dev_priv = to_i915(plane->dev);
14816− struct intel_plane_state *old_intel_state;
14817− struct drm_i915_gem_object *old_obj = intel_fb_obj(old_state->fb);
14818− struct drm_i915_gem_object *obj = intel_fb_obj(plane->state->fb);
14819−
14820− old_intel_state = to_intel_plane_state(old_state);
14821−
14822− if (!obj && !old_obj)
14823− return;
14810+ struct i915_vma *vma;
1482414811
14825− if (old_obj && (plane->type != DRM_PLANE_TYPE_CURSOR ||
14826− !INTEL_INFO(dev_priv)->cursor_needs_physical))
14827− intel_unpin_fb_obj(old_state->fb, old_state->rotation);
14812+ /* Should only be called after a successful intel_prepare_plane_fb()! */
14813+ vma = fetch_and_zero(&to_intel_plane_state(old_state)->vma);
14814+ if (vma)
14815+ intel_unpin_fb_vma(vma);
1482814816 }
1482914817
1483014818 int
@@ -15166,7 +15154,7 @@ intel_update_cursor_plane(struct drm_plane *plane, · 335 unmodified lines
1516615154 if (!obj)
1516715155 addr = 0;
1516815156 else if (!INTEL_INFO(dev_priv)->cursor_needs_physical)
15169− addr = i915_gem_object_ggtt_offset(obj, NULL);
15157+ addr = intel_plane_ggtt_offset(state);
1517015158 else
1517115159 addr = obj->phys_handle->busaddr;
1517215160
@@ -17066,41 +17054,12 @@ void intel_display_resume(struct drm_device *dev) · 1893 unmodified lines
1706617054 void intel_modeset_gem_init(struct drm_device *dev)
1706717055 {
1706817056 struct drm_i915_private *dev_priv = to_i915(dev);
17069− struct drm_crtc *c;
17070− struct drm_i915_gem_object *obj;
1707117057
1707217058 intel_init_gt_powersave(dev_priv);
1707317059
1707417060 intel_modeset_init_hw(dev);
1707517061
1707617062 intel_setup_overlay(dev_priv);
17077−
17078− /*
17079− * Make sure any fbs we allocated at startup are properly
17080− * pinned & fenced. When we do the allocation it's too early
17081− * for this.
17082− */
17083− for_each_crtc(dev, c) {
17084− struct i915_vma *vma;
17085−
17086− obj = intel_fb_obj(c->primary->fb);
17087− if (obj == NULL)
17088− continue;
17089−
17090− mutex_lock(&dev->struct_mutex);
17091− vma = intel_pin_and_fence_fb_obj(c->primary->fb,
17092− c->primary->state->rotation);
17093− mutex_unlock(&dev->struct_mutex);
17094− if (IS_ERR(vma)) {
17095− DRM_ERROR("failed to pin boot fb on pipe %d\n",
17096− to_intel_crtc(c)->pipe);
17097− drm_framebuffer_unreference(c->primary->fb);
17098− c->primary->fb = NULL;
17099− c->primary->crtc = c->primary->state->crtc = NULL;
17100− update_state_fb(c->primary);
17101− c->state->plane_mask &= ~(1 << drm_plane_index(c->primary));
17102− }
17103− }
1710417063 }
1710517064
1710617065 int intel_connector_register(struct drm_connector *connector)
drivers/gpu/drm/i915/intel_drv.h+7−2
@@ -377,6 +377,7 @@ struct intel_atomic_state { · 376 unmodified lines
377377 struct intel_plane_state {
378378 struct drm_plane_state base;
379379 struct drm_rect clip;
380+ struct i915_vma *vma;
380381
381382 struct {
382383 u32 offset;
@@ -1046,6 +1047,7 @@ struct intel_flip_work { · 663 unmodified lines
10461047 struct work_struct mmio_work;
10471048
10481049 struct drm_crtc *crtc;
1050+ struct i915_vma *old_vma;
10491051 struct drm_framebuffer *old_fb;
10501052 struct drm_i915_gem_object *pending_flip_obj;
10511053 struct drm_pending_vblank_event *event;
@@ -1273,7 +1275,7 @@ void intel_release_load_detect_pipe(struct drm_connector *connector, · 221 unmodified lines
12731275 struct drm_modeset_acquire_ctx *ctx);
12741276 struct i915_vma *
12751277 intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb, unsigned int rotation);
1276−void intel_unpin_fb_obj(struct drm_framebuffer *fb, unsigned int rotation);
1278+void intel_unpin_fb_vma(struct i915_vma *vma);
12771279 struct drm_framebuffer *
12781280 __intel_framebuffer_create(struct drm_device *dev,
12791281 struct drm_mode_fb_cmd2 *mode_cmd,
@@ -1362,7 +1364,10 @@ void intel_mode_from_pipe_config(struct drm_display_mode *mode, · 82 unmodified lines
13621364 int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state);
13631365 int skl_max_scale(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state);
13641366
1365−u32 intel_fb_gtt_offset(struct drm_framebuffer *fb, unsigned int rotation);
1367+static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state)
1368+{
1369+ return i915_ggtt_offset(state->vma);
1370+}
13661371
13671372 u32 skl_plane_ctl_format(uint32_t pixel_format);
13681373 u32 skl_plane_ctl_tiling(uint64_t fb_modifier);
drivers/gpu/drm/i915/intel_fbc.c+20−32
@@ -173,7 +173,7 @@ static void i8xx_fbc_activate(struct drm_i915_private *dev_priv) · 172 unmodified lines
173173 if (IS_I945GM(dev_priv))
174174 fbc_ctl |= FBC_CTL_C3_IDLE; /* 945 needs special SR handling */
175175 fbc_ctl |= (cfb_pitch & 0xff) << FBC_CTL_STRIDE_SHIFT;
176− fbc_ctl |= params->fb.fence_reg;
176+ fbc_ctl |= params->vma->fence->id;
177177 I915_WRITE(FBC_CONTROL, fbc_ctl);
178178 }
179179
@@ -193,8 +193,8 @@ static void g4x_fbc_activate(struct drm_i915_private *dev_priv) · 13 unmodified lines
193193 else
194194 dpfc_ctl |= DPFC_CTL_LIMIT_1X;
195195
196− if (params->fb.fence_reg != I915_FENCE_REG_NONE) {
197− dpfc_ctl |= DPFC_CTL_FENCE_EN | params->fb.fence_reg;
196+ if (params->vma->fence) {
197+ dpfc_ctl |= DPFC_CTL_FENCE_EN | params->vma->fence->id;
198198 I915_WRITE(DPFC_FENCE_YOFF, params->crtc.fence_y_offset);
199199 } else {
200200 I915_WRITE(DPFC_FENCE_YOFF, 0);
@@ -251,13 +251,14 @@ static void ilk_fbc_activate(struct drm_i915_private *dev_priv) · 50 unmodified lines
251251 break;
252252 }
253253
254− if (params->fb.fence_reg != I915_FENCE_REG_NONE) {
254+ if (params->vma->fence) {
255255 dpfc_ctl |= DPFC_CTL_FENCE_EN;
256256 if (IS_GEN5(dev_priv))
257− dpfc_ctl |= params->fb.fence_reg;
257+ dpfc_ctl |= params->vma->fence->id;
258258 if (IS_GEN6(dev_priv)) {
259259 I915_WRITE(SNB_DPFC_CTL_SA,
260− SNB_CPU_FENCE_ENABLE | params->fb.fence_reg);
260+ SNB_CPU_FENCE_ENABLE |
261+ params->vma->fence->id);
261262 I915_WRITE(DPFC_CPU_FENCE_OFFSET,
262263 params->crtc.fence_y_offset);
263264 }
@@ -269,7 +270,8 @@ static void ilk_fbc_activate(struct drm_i915_private *dev_priv) · 5 unmodified lines
269270 }
270271
271272 I915_WRITE(ILK_DPFC_FENCE_YOFF, params->crtc.fence_y_offset);
272− I915_WRITE(ILK_FBC_RT_BASE, params->fb.ggtt_offset | ILK_FBC_RT_VALID);
273+ I915_WRITE(ILK_FBC_RT_BASE,
274+ i915_ggtt_offset(params->vma) | ILK_FBC_RT_VALID);
273275 /* enable it... */
274276 I915_WRITE(ILK_DPFC_CONTROL, dpfc_ctl | DPFC_CTL_EN);
275277
@@ -319,10 +321,11 @@ static void gen7_fbc_activate(struct drm_i915_private *dev_priv) · 43 unmodified lines
319321 break;
320322 }
321323
322− if (params->fb.fence_reg != I915_FENCE_REG_NONE) {
324+ if (params->vma->fence) {
323325 dpfc_ctl |= IVB_DPFC_CTL_FENCE_EN;
324326 I915_WRITE(SNB_DPFC_CTL_SA,
325− SNB_CPU_FENCE_ENABLE | params->fb.fence_reg);
327+ SNB_CPU_FENCE_ENABLE |
328+ params->vma->fence->id);
326329 I915_WRITE(DPFC_CPU_FENCE_OFFSET, params->crtc.fence_y_offset);
327330 } else {
328331 I915_WRITE(SNB_DPFC_CTL_SA,0);
@@ -727,14 +730,6 @@ static bool intel_fbc_hw_tracking_covers_screen(struct intel_crtc *crtc) · 398 unmodified lines
727730 return effective_w <= max_w && effective_h <= max_h;
728731 }
729732
730−/* XXX replace me when we have VMA tracking for intel_plane_state */
731−static int get_fence_id(struct drm_framebuffer *fb)
732−{
733− struct i915_vma *vma = i915_gem_object_to_ggtt(intel_fb_obj(fb), NULL);
734−
735− return vma && vma->fence ? vma->fence->id : I915_FENCE_REG_NONE;
736−}
737−
738733 static void intel_fbc_update_state_cache(struct intel_crtc *crtc,
739734 struct intel_crtc_state *crtc_state,
740735 struct intel_plane_state *plane_state)
@@ -743,7 +738,8 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, · 2 unmodified lines
743738 struct intel_fbc *fbc = &dev_priv->fbc;
744739 struct intel_fbc_state_cache *cache = &fbc->state_cache;
745740 struct drm_framebuffer *fb = plane_state->base.fb;
746− struct drm_i915_gem_object *obj;
741+
742+ cache->vma = NULL;
747743
748744 cache->crtc.mode_flags = crtc_state->base.adjusted_mode.flags;
749745 if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
@@ -758,16 +754,10 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, · 8 unmodified lines
758754 if (!cache->plane.visible)
759755 return;
760756
761− obj = intel_fb_obj(fb);
762−
763− /* FIXME: We lack the proper locking here, so only run this on the
764− * platforms that need. */
765− if (IS_GEN(dev_priv, 5, 6))
766− cache->fb.ilk_ggtt_offset = i915_gem_object_ggtt_offset(obj, NULL);
767757 cache->fb.pixel_format = fb->pixel_format;
768758 cache->fb.stride = fb->pitches[0];
769− cache->fb.fence_reg = get_fence_id(fb);
770− cache->fb.tiling_mode = i915_gem_object_get_tiling(obj);
759+
760+ cache->vma = plane_state->vma;
771761 }
772762
773763 static bool intel_fbc_can_activate(struct intel_crtc *crtc)
@@ -784,7 +774,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) · 10 unmodified lines
784774 return false;
785775 }
786776
787− if (!cache->plane.visible) {
777+ if (!cache->vma) {
788778 fbc->no_fbc_reason = "primary plane not visible";
789779 return false;
790780 }
@@ -807,8 +797,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) · 16 unmodified lines
807797 * so have no fence associated with it) due to aperture constaints
808798 * at the time of pinning.
809799 */
810− if (cache->fb.tiling_mode != I915_TILING_X ||
811− cache->fb.fence_reg == I915_FENCE_REG_NONE) {
800+ if (!cache->vma->fence) {
812801 fbc->no_fbc_reason = "framebuffer not tiled or fenced";
813802 return false;
814803 }
@@ -888,17 +877,16 @@ static void intel_fbc_get_reg_params(struct intel_crtc *crtc, · 73 unmodified lines
888877 * zero. */
889878 memset(params, 0, sizeof(*params));
890879
880+ params->vma = cache->vma;
881+
891882 params->crtc.pipe = crtc->pipe;
892883 params->crtc.plane = crtc->plane;
893884 params->crtc.fence_y_offset = get_crtc_fence_y_offset(crtc);
894885
895886 params->fb.pixel_format = cache->fb.pixel_format;
896887 params->fb.stride = cache->fb.stride;
897− params->fb.fence_reg = cache->fb.fence_reg;
898888
899889 params->cfb_size = intel_fbc_calculate_cfb_size(dev_priv, cache);
900−
901− params->fb.ggtt_offset = cache->fb.ilk_ggtt_offset;
902890 }
903891
904892 static bool intel_fbc_reg_params_equal(struct intel_fbc_reg_params *params1,
drivers/gpu/drm/i915/intel_fbdev.c+2−2
@@ -284,7 +284,7 @@ static int intelfb_create(struct drm_fb_helper *helper, · 283 unmodified lines
284284 out_destroy_fbi:
285285 drm_fb_helper_release_fbi(helper);
286286 out_unpin:
287− intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
287+ intel_unpin_fb_vma(vma);
288288 out_unlock:
289289 mutex_unlock(&dev->struct_mutex);
290290 return ret;
@@ -549,7 +549,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev) · 258 unmodified lines
549549
550550 if (ifbdev->fb) {
551551 mutex_lock(&ifbdev->helper.dev->struct_mutex);
552− intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
552+ intel_unpin_fb_vma(ifbdev->vma);
553553 mutex_unlock(&ifbdev->helper.dev->struct_mutex);
554554
555555 drm_framebuffer_remove(&ifbdev->fb->base);
drivers/gpu/drm/i915/intel_sprite.c+4−4
@@ -273,7 +273,7 @@ skl_update_plane(struct drm_plane *drm_plane, · 272 unmodified lines
273273
274274 I915_WRITE(PLANE_CTL(pipe, plane), plane_ctl);
275275 I915_WRITE(PLANE_SURF(pipe, plane),
276− intel_fb_gtt_offset(fb, rotation) + surf_addr);
276+ intel_plane_ggtt_offset(plane_state) + surf_addr);
277277 POSTING_READ(PLANE_SURF(pipe, plane));
278278 }
279279
@@ -458,7 +458,7 @@ vlv_update_plane(struct drm_plane *dplane, · 178 unmodified lines
458458 I915_WRITE(SPSIZE(pipe, plane), (crtc_h << 16) | crtc_w);
459459 I915_WRITE(SPCNTR(pipe, plane), sprctl);
460460 I915_WRITE(SPSURF(pipe, plane),
461− intel_fb_gtt_offset(fb, rotation) + sprsurf_offset);
461+ intel_plane_ggtt_offset(plane_state) + sprsurf_offset);
462462 POSTING_READ(SPSURF(pipe, plane));
463463 }
464464
@@ -594,7 +594,7 @@ ivb_update_plane(struct drm_plane *plane, · 129 unmodified lines
594594 I915_WRITE(SPRSCALE(pipe), sprscale);
595595 I915_WRITE(SPRCTL(pipe), sprctl);
596596 I915_WRITE(SPRSURF(pipe),
597− intel_fb_gtt_offset(fb, rotation) + sprsurf_offset);
597+ intel_plane_ggtt_offset(plane_state) + sprsurf_offset);
598598 POSTING_READ(SPRSURF(pipe));
599599 }
600600
@@ -721,7 +721,7 @@ ilk_update_plane(struct drm_plane *plane, · 120 unmodified lines
721721 I915_WRITE(DVSSCALE(pipe), dvsscale);
722722 I915_WRITE(DVSCNTR(pipe), dvscntr);
723723 I915_WRITE(DVSSURF(pipe),
724− intel_fb_gtt_offset(fb, rotation) + dvssurf_offset);
724+ intel_plane_ggtt_offset(plane_state) + dvssurf_offset);
725725 POSTING_READ(DVSSURF(pipe));
726726 }
727727
drivers/gpu/drm/nouveau/dispnv04/hw.c+2−1
@@ -222,6 +222,7 @@ nouveau_hw_get_clock(struct drm_device *dev, enum nvbios_pll_type plltype) · 221 unmodified lines
222222 uint32_t mpllP;
223223
224224 pci_read_config_dword(pci_get_bus_and_slot(0, 3), 0x6c, &mpllP);
225+ mpllP = (mpllP >> 8) & 0xf;
225226 if (!mpllP)
226227 mpllP = 4;
227228
@@ -232,7 +233,7 @@ nouveau_hw_get_clock(struct drm_device *dev, enum nvbios_pll_type plltype) · 4 unmodified lines
232233 uint32_t clock;
233234
234235 pci_read_config_dword(pci_get_bus_and_slot(0, 5), 0x4c, &clock);
235− return clock;
236+ return clock / 1000;
236237 }
237238
238239 ret = nouveau_hw_get_pllvals(dev, plltype, &pllvals);
drivers/gpu/drm/nouveau/nouveau_fence.h+1−0
@@ -99,6 +99,7 @@ struct nv84_fence_priv { · 98 unmodified lines
9999 struct nouveau_bo *bo;
100100 struct nouveau_bo *bo_gart;
101101 u32 *suspend;
102+ struct mutex mutex;
102103 };
103104
104105 int nv84_fence_context_new(struct nouveau_channel *);
drivers/gpu/drm/nouveau/nouveau_led.h+1−1
@@ -42,7 +42,7 @@ nouveau_led(struct drm_device *dev) · 41 unmodified lines
4242 }
4343
4444 /* nouveau_led.c */
45−#if IS_ENABLED(CONFIG_LEDS_CLASS)
45+#if IS_REACHABLE(CONFIG_LEDS_CLASS)
4646 int nouveau_led_init(struct drm_device *dev);
4747 void nouveau_led_suspend(struct drm_device *dev);
4848 void nouveau_led_resume(struct drm_device *dev);
drivers/gpu/drm/nouveau/nouveau_usif.c+2−1
@@ -313,7 +313,8 @@ usif_ioctl(struct drm_file *filp, void __user *user, u32 argc) · 312 unmodified lines
313313 if (!(ret = nvif_unpack(-ENOSYS, &data, &size, argv->v0, 0, 0, true))) {
314314 /* block access to objects not created via this interface */
315315 owner = argv->v0.owner;
316− if (argv->v0.object == 0ULL)
316+ if (argv->v0.object == 0ULL &&
317+ argv->v0.type != NVIF_IOCTL_V0_DEL)
317318 argv->v0.owner = NVDRM_OBJECT_ANY; /* except client */
318319 else
319320 argv->v0.owner = NVDRM_OBJECT_USIF;
drivers/gpu/drm/nouveau/nv50_display.c+6−0
@@ -4052,6 +4052,11 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state) · 4051 unmodified lines
40524052 }
40534053 }
40544054
4055+ for_each_crtc_in_state(state, crtc, crtc_state, i) {
4056+ if (crtc->state->event)
4057+ drm_crtc_vblank_get(crtc);
4058+ }
4059+
40554060 /* Update plane(s). */
40564061 for_each_plane_in_state(state, plane, plane_state, i) {
40574062 struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state);
@@ -4101,6 +4106,7 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state) · 43 unmodified lines
41014106 drm_crtc_send_vblank_event(crtc, crtc->state->event);
41024107 spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
41034108 crtc->state->event = NULL;
4109+ drm_crtc_vblank_put(crtc);
41044110 }
41054111 }
41064112
drivers/gpu/drm/nouveau/nv84_fence.c+6−0
@@ -107,8 +107,10 @@ nv84_fence_context_del(struct nouveau_channel *chan) · 106 unmodified lines
107107 struct nv84_fence_chan *fctx = chan->fence;
108108
109109 nouveau_bo_wr32(priv->bo, chan->chid * 16 / 4, fctx->base.sequence);
110+ mutex_lock(&priv->mutex);
110111 nouveau_bo_vma_del(priv->bo, &fctx->vma_gart);
111112 nouveau_bo_vma_del(priv->bo, &fctx->vma);
113+ mutex_unlock(&priv->mutex);
112114 nouveau_fence_context_del(&fctx->base);
113115 chan->fence = NULL;
114116 nouveau_fence_context_free(&fctx->base);
@@ -134,11 +136,13 @@ nv84_fence_context_new(struct nouveau_channel *chan) · 19 unmodified lines
134136 fctx->base.sync32 = nv84_fence_sync32;
135137 fctx->base.sequence = nv84_fence_read(chan);
136138
139+ mutex_lock(&priv->mutex);
137140 ret = nouveau_bo_vma_add(priv->bo, cli->vm, &fctx->vma);
138141 if (ret == 0) {
139142 ret = nouveau_bo_vma_add(priv->bo_gart, cli->vm,
140143 &fctx->vma_gart);
141144 }
145+ mutex_unlock(&priv->mutex);
142146
143147 if (ret)
144148 nv84_fence_context_del(chan);
@@ -212,6 +216,8 @@ nv84_fence_create(struct nouveau_drm *drm) · 67 unmodified lines
212216 priv->base.context_base = dma_fence_context_alloc(priv->base.contexts);
213217 priv->base.uevent = true;
214218
219+ mutex_init(&priv->mutex);
220+
215221 /* Use VRAM if there is any ; otherwise fallback to system memory */
216222 domain = drm->device.info.ram_size != 0 ? TTM_PL_FLAG_VRAM :
217223 /*
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c+1−1
@@ -59,7 +59,7 @@ gt215_hda_eld(NV50_DISP_MTHD_V1) · 58 unmodified lines
5959 );
6060 }
6161 for (i = 0; i < size; i++)
62− nvkm_wr32(device, 0x61c440 + soff, (i << 8) | args->v0.data[0]);
62+ nvkm_wr32(device, 0x61c440 + soff, (i << 8) | args->v0.data[i]);
6363 for (; i < 0x60; i++)
6464 nvkm_wr32(device, 0x61c440 + soff, (i << 8));
6565 nvkm_mask(device, 0x61c448 + soff, 0x80000003, 0x80000003);
drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c+0−2
@@ -433,8 +433,6 @@ nv50_disp_dptmds_war(struct nvkm_device *device) · 432 unmodified lines
433433 case 0x94:
434434 case 0x96:
435435 case 0x98:
436− case 0xaa:
437− case 0xac:
438436 return true;
439437 default:
440438 break;
drivers/gpu/drm/radeon/radeon_drv.c+2−1
@@ -97,9 +97,10 @@ · 96 unmodified lines
9797 * 2.46.0 - Add PFP_SYNC_ME support on evergreen
9898 * 2.47.0 - Add UVD_NO_OP register support
9999 * 2.48.0 - TA_CS_BC_BASE_ADDR allowed on SI
100+ * 2.49.0 - DRM_RADEON_GEM_INFO ioctl returns correct vram_size/visible values
100101 */
101102 #define KMS_DRIVER_MAJOR 2
102−#define KMS_DRIVER_MINOR 48
103+#define KMS_DRIVER_MINOR 49
103104 #define KMS_DRIVER_PATCHLEVEL 0
104105 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
105106 int radeon_driver_unload_kms(struct drm_device *dev);
drivers/gpu/drm/radeon/radeon_gem.c+2−2
@@ -220,8 +220,8 @@ int radeon_gem_info_ioctl(struct drm_device *dev, void *data, · 219 unmodified lines
220220
221221 man = &rdev->mman.bdev.man[TTM_PL_VRAM];
222222
223− args->vram_size = rdev->mc.real_vram_size;
224− args->vram_visible = (u64)man->size << PAGE_SHIFT;
223+ args->vram_size = (u64)man->size << PAGE_SHIFT;
224+ args->vram_visible = rdev->mc.visible_vram_size;
225225 args->vram_visible -= rdev->vram_pin_size;
226226 args->gart_size = rdev->mc.gtt_size;
227227 args->gart_size -= rdev->gart_pin_size;
drivers/hid/hid-cp2112.c+12−16
@@ -168,7 +168,7 @@ struct cp2112_device { · 167 unmodified lines
168168 atomic_t xfer_avail;
169169 struct gpio_chip gc;
170170 u8 *in_out_buffer;
171− spinlock_t lock;
171+ struct mutex lock;
172172
173173 struct gpio_desc *desc[8];
174174 bool gpio_poll;
@@ -186,10 +186,9 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset) · 11 unmodified lines
186186 struct cp2112_device *dev = gpiochip_get_data(chip);
187187 struct hid_device *hdev = dev->hdev;
188188 u8 *buf = dev->in_out_buffer;
189− unsigned long flags;
190189 int ret;
191190
192− spin_lock_irqsave(&dev->lock, flags);
191+ mutex_lock(&dev->lock);
193192
194193 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf,
195194 CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT,
@@ -213,8 +212,8 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset) · 17 unmodified lines
213212 ret = 0;
214213
215214 exit:
216− spin_unlock_irqrestore(&dev->lock, flags);
217− return ret <= 0 ? ret : -EIO;
215+ mutex_unlock(&dev->lock);
216+ return ret < 0 ? ret : -EIO;
218217 }
219218
220219 static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
@@ -222,10 +221,9 @@ static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value) · 1 unmodified line
222221 struct cp2112_device *dev = gpiochip_get_data(chip);
223222 struct hid_device *hdev = dev->hdev;
224223 u8 *buf = dev->in_out_buffer;
225− unsigned long flags;
226224 int ret;
227225
228− spin_lock_irqsave(&dev->lock, flags);
226+ mutex_lock(&dev->lock);
229227
230228 buf[0] = CP2112_GPIO_SET;
231229 buf[1] = value ? 0xff : 0;
@@ -237,7 +235,7 @@ static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value) · 5 unmodified lines
237235 if (ret < 0)
238236 hid_err(hdev, "error setting GPIO values: %d\n", ret);
239237
240− spin_unlock_irqrestore(&dev->lock, flags);
238+ mutex_unlock(&dev->lock);
241239 }
242240
243241 static int cp2112_gpio_get_all(struct gpio_chip *chip)
@@ -245,10 +243,9 @@ static int cp2112_gpio_get_all(struct gpio_chip *chip) · 1 unmodified line
245243 struct cp2112_device *dev = gpiochip_get_data(chip);
246244 struct hid_device *hdev = dev->hdev;
247245 u8 *buf = dev->in_out_buffer;
248− unsigned long flags;
249246 int ret;
250247
251− spin_lock_irqsave(&dev->lock, flags);
248+ mutex_lock(&dev->lock);
252249
253250 ret = hid_hw_raw_request(hdev, CP2112_GPIO_GET, buf,
254251 CP2112_GPIO_GET_LENGTH, HID_FEATURE_REPORT,
@@ -262,7 +259,7 @@ static int cp2112_gpio_get_all(struct gpio_chip *chip) · 7 unmodified lines
262259 ret = buf[1];
263260
264261 exit:
265− spin_unlock_irqrestore(&dev->lock, flags);
262+ mutex_unlock(&dev->lock);
266263
267264 return ret;
268265 }
@@ -284,10 +281,9 @@ static int cp2112_gpio_direction_output(struct gpio_chip *chip, · 15 unmodified lines
284281 struct cp2112_device *dev = gpiochip_get_data(chip);
285282 struct hid_device *hdev = dev->hdev;
286283 u8 *buf = dev->in_out_buffer;
287− unsigned long flags;
288284 int ret;
289285
290− spin_lock_irqsave(&dev->lock, flags);
286+ mutex_lock(&dev->lock);
291287
292288 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf,
293289 CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT,
@@ -308,7 +304,7 @@ static int cp2112_gpio_direction_output(struct gpio_chip *chip, · 14 unmodified lines
308304 goto fail;
309305 }
310306
311− spin_unlock_irqrestore(&dev->lock, flags);
307+ mutex_unlock(&dev->lock);
312308
313309 /*
314310 * Set gpio value when output direction is already set,
@@ -319,7 +315,7 @@ static int cp2112_gpio_direction_output(struct gpio_chip *chip, · 4 unmodified lines
319315 return 0;
320316
321317 fail:
322− spin_unlock_irqrestore(&dev->lock, flags);
318+ mutex_unlock(&dev->lock);
323319 return ret < 0 ? ret : -EIO;
324320 }
325321
@@ -1235,7 +1231,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) · 909 unmodified lines
12351231 if (!dev->in_out_buffer)
12361232 return -ENOMEM;
12371233
1238− spin_lock_init(&dev->lock);
1234+ mutex_init(&dev->lock);
12391235
12401236 ret = hid_parse(hdev);
12411237 if (ret) {
drivers/hid/hid-ids.h+3−0
@@ -76,6 +76,9 @@ · 75 unmodified lines
7676 #define USB_VENDOR_ID_ALPS_JP 0x044E
7777 #define HID_DEVICE_ID_ALPS_U1_DUAL 0x120B
7878
79+#define USB_VENDOR_ID_AMI 0x046b
80+#define USB_DEVICE_ID_AMI_VIRT_KEYBOARD_AND_MOUSE 0xff10
81+
7982 #define USB_VENDOR_ID_ANTON 0x1130
8083 #define USB_DEVICE_ID_ANTON_TOUCH_PAD 0x3101
8184
drivers/hid/hid-lg.c+1−1
@@ -872,7 +872,7 @@ static const struct hid_device_id lg_devices[] = { · 871 unmodified lines
872872 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG),
873873 .driver_data = LG_NOGET | LG_FF4 },
874874 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2),
875− .driver_data = LG_FF2 },
875+ .driver_data = LG_NOGET | LG_FF2 },
876876 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940),
877877 .driver_data = LG_FF3 },
878878 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR),
drivers/hid/usbhid/hid-quirks.c+1−0
@@ -57,6 +57,7 @@ static const struct hid_blacklist { · 56 unmodified lines
5757 { USB_VENDOR_ID_AIREN, USB_DEVICE_ID_AIREN_SLIMPLUS, HID_QUIRK_NOGET },
5858 { USB_VENDOR_ID_AKAI, USB_DEVICE_ID_AKAI_MPKMINI2, HID_QUIRK_NO_INIT_REPORTS },
5959 { USB_VENDOR_ID_AKAI_09E8, USB_DEVICE_ID_AKAI_09E8_MIDIMIX, HID_QUIRK_NO_INIT_REPORTS },
60+ { USB_VENDOR_ID_AMI, USB_DEVICE_ID_AMI_VIRT_KEYBOARD_AND_MOUSE, HID_QUIRK_ALWAYS_POLL },
6061 { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET },
6162 { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET },
6263 { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET },
drivers/hid/wacom_wac.c+15−13
@@ -166,19 +166,21 @@ static int wacom_pl_irq(struct wacom_wac *wacom) · 165 unmodified lines
166166 wacom->id[0] = STYLUS_DEVICE_ID;
167167 }
168168
169− pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1));
170− if (features->pressure_max > 255)
171− pressure = (pressure << 1) | ((data[4] >> 6) & 1);
172− pressure += (features->pressure_max + 1) / 2;
173−
174− input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14));
175− input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14));
176− input_report_abs(input, ABS_PRESSURE, pressure);
177−
178− input_report_key(input, BTN_TOUCH, data[4] & 0x08);
179− input_report_key(input, BTN_STYLUS, data[4] & 0x10);
180− /* Only allow the stylus2 button to be reported for the pen tool. */
181− input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20));
169+ if (prox) {
170+ pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1));
171+ if (features->pressure_max > 255)
172+ pressure = (pressure << 1) | ((data[4] >> 6) & 1);
173+ pressure += (features->pressure_max + 1) / 2;
174+
175+ input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14));
176+ input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14));
177+ input_report_abs(input, ABS_PRESSURE, pressure);
178+
179+ input_report_key(input, BTN_TOUCH, data[4] & 0x08);
180+ input_report_key(input, BTN_STYLUS, data[4] & 0x10);
181+ /* Only allow the stylus2 button to be reported for the pen tool. */
182+ input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20));
183+ }
182184
183185 if (!prox)
184186 wacom->id[0] = 0;
drivers/hv/ring_buffer.c+1−0
@@ -383,6 +383,7 @@ int hv_ringbuffer_read(struct vmbus_channel *channel, · 382 unmodified lines
383383 return ret;
384384 }
385385
386+ init_cached_read_index(channel);
386387 next_read_location = hv_get_next_read_location(inring_info);
387388 next_read_location = hv_copyfrom_ringbuffer(inring_info, &desc,
388389 sizeof(desc),
drivers/iio/adc/palmas_gpadc.c+2−2
@@ -775,7 +775,7 @@ static int palmas_adc_wakeup_reset(struct palmas_gpadc *adc) · 774 unmodified lines
775775
776776 static int palmas_gpadc_suspend(struct device *dev)
777777 {
778− struct iio_dev *indio_dev = dev_to_iio_dev(dev);
778+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
779779 struct palmas_gpadc *adc = iio_priv(indio_dev);
780780 int wakeup = adc->wakeup1_enable || adc->wakeup2_enable;
781781 int ret;
@@ -798,7 +798,7 @@ static int palmas_gpadc_suspend(struct device *dev) · 16 unmodified lines
798798
799799 static int palmas_gpadc_resume(struct device *dev)
800800 {
801− struct iio_dev *indio_dev = dev_to_iio_dev(dev);
801+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
802802 struct palmas_gpadc *adc = iio_priv(indio_dev);
803803 int wakeup = adc->wakeup1_enable || adc->wakeup2_enable;
804804 int ret;
drivers/iio/health/afe4403.c+2−2
@@ -422,7 +422,7 @@ MODULE_DEVICE_TABLE(of, afe4403_of_match); · 421 unmodified lines
422422
423423 static int __maybe_unused afe4403_suspend(struct device *dev)
424424 {
425− struct iio_dev *indio_dev = dev_to_iio_dev(dev);
425+ struct iio_dev *indio_dev = spi_get_drvdata(to_spi_device(dev));
426426 struct afe4403_data *afe = iio_priv(indio_dev);
427427 int ret;
428428
@@ -443,7 +443,7 @@ static int __maybe_unused afe4403_suspend(struct device *dev) · 14 unmodified lines
443443
444444 static int __maybe_unused afe4403_resume(struct device *dev)
445445 {
446− struct iio_dev *indio_dev = dev_to_iio_dev(dev);
446+ struct iio_dev *indio_dev = spi_get_drvdata(to_spi_device(dev));
447447 struct afe4403_data *afe = iio_priv(indio_dev);
448448 int ret;
449449
drivers/iio/health/afe4404.c+2−2
@@ -428,7 +428,7 @@ MODULE_DEVICE_TABLE(of, afe4404_of_match); · 427 unmodified lines
428428
429429 static int __maybe_unused afe4404_suspend(struct device *dev)
430430 {
431− struct iio_dev *indio_dev = dev_to_iio_dev(dev);
431+ struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
432432 struct afe4404_data *afe = iio_priv(indio_dev);
433433 int ret;
434434
@@ -449,7 +449,7 @@ static int __maybe_unused afe4404_suspend(struct device *dev) · 14 unmodified lines
449449
450450 static int __maybe_unused afe4404_resume(struct device *dev)
451451 {
452− struct iio_dev *indio_dev = dev_to_iio_dev(dev);
452+ struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
453453 struct afe4404_data *afe = iio_priv(indio_dev);
454454 int ret;
455455
drivers/iio/health/max30100.c+1−1
@@ -238,7 +238,7 @@ static irqreturn_t max30100_interrupt_handler(int irq, void *private) · 237 unmodified lines
238238
239239 mutex_lock(&data->lock);
240240
241− while (cnt || (cnt = max30100_fifo_count(data) > 0)) {
241+ while (cnt || (cnt = max30100_fifo_count(data)) > 0) {
242242 ret = max30100_read_measurement(data);
243243 if (ret)
244244 break;
drivers/iio/humidity/dht11.c+4−2
@@ -71,7 +71,8 @@ · 70 unmodified lines
7171 * a) select an implementation using busy loop polling on those systems
7272 * b) use the checksum to do some probabilistic decoding
7373 */
74−#define DHT11_START_TRANSMISSION 18 /* ms */
74+#define DHT11_START_TRANSMISSION_MIN 18000 /* us */
75+#define DHT11_START_TRANSMISSION_MAX 20000 /* us */
7576 #define DHT11_MIN_TIMERES 34000 /* ns */
7677 #define DHT11_THRESHOLD 49000 /* ns */
7778 #define DHT11_AMBIG_LOW 23000 /* ns */
@@ -228,7 +229,8 @@ static int dht11_read_raw(struct iio_dev *iio_dev, · 150 unmodified lines
228229 ret = gpio_direction_output(dht11->gpio, 0);
229230 if (ret)
230231 goto err;
231− msleep(DHT11_START_TRANSMISSION);
232+ usleep_range(DHT11_START_TRANSMISSION_MIN,
233+ DHT11_START_TRANSMISSION_MAX);
232234 ret = gpio_direction_input(dht11->gpio);
233235 if (ret)
234236 goto err;
drivers/input/rmi4/rmi_driver.c+2−2
@@ -901,7 +901,7 @@ void rmi_enable_irq(struct rmi_device *rmi_dev, bool clear_wake) · 900 unmodified lines
901901 data->enabled = true;
902902 if (clear_wake && device_may_wakeup(rmi_dev->xport->dev)) {
903903 retval = disable_irq_wake(irq);
904− if (!retval)
904+ if (retval)
905905 dev_warn(&rmi_dev->dev,
906906 "Failed to disable irq for wake: %d\n",
907907 retval);
@@ -936,7 +936,7 @@ void rmi_disable_irq(struct rmi_device *rmi_dev, bool enable_wake) · 28 unmodified lines
936936 disable_irq(irq);
937937 if (enable_wake && device_may_wakeup(rmi_dev->xport->dev)) {
938938 retval = enable_irq_wake(irq);
939− if (!retval)
939+ if (retval)
940940 dev_warn(&rmi_dev->dev,
941941 "Failed to enable irq for wake: %d\n",
942942 retval);
drivers/input/touchscreen/wm97xx-core.c+1−1
@@ -682,7 +682,7 @@ static int wm97xx_probe(struct device *dev) · 681 unmodified lines
682682 }
683683 platform_set_drvdata(wm->battery_dev, wm);
684684 wm->battery_dev->dev.parent = dev;
685− wm->battery_dev->dev.platform_data = pdata->batt_pdata;
685+ wm->battery_dev->dev.platform_data = pdata ? pdata->batt_pdata : NULL;
686686 ret = platform_device_add(wm->battery_dev);
687687 if (ret < 0)
688688 goto batt_reg_err;
drivers/mmc/host/sdhci.c+2−1
@@ -2733,7 +2733,8 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) · 2732 unmodified lines
27332733 if (intmask & SDHCI_INT_RETUNE)
27342734 mmc_retune_needed(host->mmc);
27352735
2736− if (intmask & SDHCI_INT_CARD_INT) {
2736+ if ((intmask & SDHCI_INT_CARD_INT) &&
2737+ (host->ier & SDHCI_INT_CARD_INT)) {
27372738 sdhci_enable_sdio_irq_nolock(host, false);
27382739 host->thread_isr |= SDHCI_INT_CARD_INT;
27392740 result = IRQ_WAKE_THREAD;
drivers/net/ethernet/adaptec/starfire.c+43−2
@@ -1152,6 +1152,12 @@ static void init_ring(struct net_device *dev) · 1151 unmodified lines
11521152 if (skb == NULL)
11531153 break;
11541154 np->rx_info[i].mapping = pci_map_single(np->pci_dev, skb->data, np->rx_buf_sz, PCI_DMA_FROMDEVICE);
1155+ if (pci_dma_mapping_error(np->pci_dev,
1156+ np->rx_info[i].mapping)) {
1157+ dev_kfree_skb(skb);
1158+ np->rx_info[i].skb = NULL;
1159+ break;
1160+ }
11551161 /* Grrr, we cannot offset to correctly align the IP header. */
11561162 np->rx_ring[i].rxaddr = cpu_to_dma(np->rx_info[i].mapping | RxDescValid);
11571163 }
@@ -1182,8 +1188,9 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev) · 24 unmodified lines
11821188 {
11831189 struct netdev_private *np = netdev_priv(dev);
11841190 unsigned int entry;
1191+ unsigned int prev_tx;
11851192 u32 status;
1186− int i;
1193+ int i, j;
11871194
11881195 /*
11891196 * be cautious here, wrapping the queue has weird semantics
@@ -1201,6 +1208,7 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev) · 11 unmodified lines
12011208 }
12021209 #endif /* ZEROCOPY && HAS_BROKEN_FIRMWARE */
12031210
1211+ prev_tx = np->cur_tx;
12041212 entry = np->cur_tx % TX_RING_SIZE;
12051213 for (i = 0; i < skb_num_frags(skb); i++) {
12061214 int wrap_ring = 0;
@@ -1234,6 +1242,11 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev) · 27 unmodified lines
12341242 skb_frag_size(this_frag),
12351243 PCI_DMA_TODEVICE);
12361244 }
1245+ if (pci_dma_mapping_error(np->pci_dev,
1246+ np->tx_info[entry].mapping)) {
1247+ dev->stats.tx_dropped++;
1248+ goto err_out;
1249+ }
12371250
12381251 np->tx_ring[entry].addr = cpu_to_dma(np->tx_info[entry].mapping);
12391252 np->tx_ring[entry].status = cpu_to_le32(status);
@@ -1268,8 +1281,30 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev) · 28 unmodified lines
12681281 netif_stop_queue(dev);
12691282
12701283 return NETDEV_TX_OK;
1271−}
12721284
1285+err_out:
1286+ entry = prev_tx % TX_RING_SIZE;
1287+ np->tx_info[entry].skb = NULL;
1288+ if (i > 0) {
1289+ pci_unmap_single(np->pci_dev,
1290+ np->tx_info[entry].mapping,
1291+ skb_first_frag_len(skb),
1292+ PCI_DMA_TODEVICE);
1293+ np->tx_info[entry].mapping = 0;
1294+ entry = (entry + np->tx_info[entry].used_slots) % TX_RING_SIZE;
1295+ for (j = 1; j < i; j++) {
1296+ pci_unmap_single(np->pci_dev,
1297+ np->tx_info[entry].mapping,
1298+ skb_frag_size(
1299+ &skb_shinfo(skb)->frags[j-1]),
1300+ PCI_DMA_TODEVICE);
1301+ entry++;
1302+ }
1303+ }
1304+ dev_kfree_skb_any(skb);
1305+ np->cur_tx = prev_tx;
1306+ return NETDEV_TX_OK;
1307+}
12731308
12741309 /* The interrupt handler does all of the Rx thread work and cleans up
12751310 after the Tx thread. */
@@ -1569,6 +1604,12 @@ static void refill_rx_ring(struct net_device *dev) · 293 unmodified lines
15691604 break; /* Better luck next round. */
15701605 np->rx_info[entry].mapping =
15711606 pci_map_single(np->pci_dev, skb->data, np->rx_buf_sz, PCI_DMA_FROMDEVICE);
1607+ if (pci_dma_mapping_error(np->pci_dev,
1608+ np->rx_info[entry].mapping)) {
1609+ dev_kfree_skb(skb);
1610+ np->rx_info[entry].skb = NULL;
1611+ break;
1612+ }
15721613 np->rx_ring[entry].rxaddr =
15731614 cpu_to_dma(np->rx_info[entry].mapping | RxDescValid);
15741615 }
drivers/net/ethernet/cadence/macb.c+130−58
@@ -43,13 +43,13 @@ · 42 unmodified lines
4343 #define DEFAULT_RX_RING_SIZE 512 /* must be power of 2 */
4444 #define MIN_RX_RING_SIZE 64
4545 #define MAX_RX_RING_SIZE 8192
46−#define RX_RING_BYTES(bp) (sizeof(struct macb_dma_desc) \
46+#define RX_RING_BYTES(bp) (macb_dma_desc_get_size(bp) \
4747 * (bp)->rx_ring_size)
4848
4949 #define DEFAULT_TX_RING_SIZE 512 /* must be power of 2 */
5050 #define MIN_TX_RING_SIZE 64
5151 #define MAX_TX_RING_SIZE 4096
52−#define TX_RING_BYTES(bp) (sizeof(struct macb_dma_desc) \
52+#define TX_RING_BYTES(bp) (macb_dma_desc_get_size(bp) \
5353 * (bp)->tx_ring_size)
5454
5555 /* level of occupied TX descriptors under which we wake up TX process */
@@ -78,6 +78,37 @@ · 22 unmodified lines
7878 */
7979 #define MACB_HALT_TIMEOUT 1230
8080
81+/* DMA buffer descriptor might be different size
82+ * depends on hardware configuration.
83+ */
84+static unsigned int macb_dma_desc_get_size(struct macb *bp)
85+{
86+#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
87+ if (bp->hw_dma_cap == HW_DMA_CAP_64B)
88+ return sizeof(struct macb_dma_desc) + sizeof(struct macb_dma_desc_64);
89+#endif
90+ return sizeof(struct macb_dma_desc);
91+}
92+
93+static unsigned int macb_adj_dma_desc_idx(struct macb *bp, unsigned int idx)
94+{
95+#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
96+ /* Dma buffer descriptor is 4 words length (instead of 2 words)
97+ * for 64b GEM.
98+ */
99+ if (bp->hw_dma_cap == HW_DMA_CAP_64B)
100+ idx <<= 1;
101+#endif
102+ return idx;
103+}
104+
105+#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
106+static struct macb_dma_desc_64 *macb_64b_desc(struct macb *bp, struct macb_dma_desc *desc)
107+{
108+ return (struct macb_dma_desc_64 *)((void *)desc + sizeof(struct macb_dma_desc));
109+}
110+#endif
111+
81112 /* Ring buffer accessors */
82113 static unsigned int macb_tx_ring_wrap(struct macb *bp, unsigned int index)
83114 {
@@ -87,7 +118,9 @@ static unsigned int macb_tx_ring_wrap(struct macb *bp, unsigned int index) · 3 unmodified lines
87118 static struct macb_dma_desc *macb_tx_desc(struct macb_queue *queue,
88119 unsigned int index)
89120 {
90− return &queue->tx_ring[macb_tx_ring_wrap(queue->bp, index)];
121+ index = macb_tx_ring_wrap(queue->bp, index);
122+ index = macb_adj_dma_desc_idx(queue->bp, index);
123+ return &queue->tx_ring[index];
91124 }
92125
93126 static struct macb_tx_skb *macb_tx_skb(struct macb_queue *queue,
@@ -101,7 +134,7 @@ static dma_addr_t macb_tx_dma(struct macb_queue *queue, unsigned int index) · 7 unmodified lines
101134 dma_addr_t offset;
102135
103136 offset = macb_tx_ring_wrap(queue->bp, index) *
104− sizeof(struct macb_dma_desc);
137+ macb_dma_desc_get_size(queue->bp);
105138
106139 return queue->tx_ring_dma + offset;
107140 }
@@ -113,7 +146,9 @@ static unsigned int macb_rx_ring_wrap(struct macb *bp, unsigned int index) · 5 unmodified lines
113146
114147 static struct macb_dma_desc *macb_rx_desc(struct macb *bp, unsigned int index)
115148 {
116− return &bp->rx_ring[macb_rx_ring_wrap(bp, index)];
149+ index = macb_rx_ring_wrap(bp, index);
150+ index = macb_adj_dma_desc_idx(bp, index);
151+ return &bp->rx_ring[index];
117152 }
118153
119154 static void *macb_rx_buffer(struct macb *bp, unsigned int index)
@@ -560,12 +595,32 @@ static void macb_tx_unmap(struct macb *bp, struct macb_tx_skb *tx_skb) · 440 unmodified lines
560595 }
561596 }
562597
563−static inline void macb_set_addr(struct macb_dma_desc *desc, dma_addr_t addr)
598+static void macb_set_addr(struct macb *bp, struct macb_dma_desc *desc, dma_addr_t addr)
564599 {
565− desc->addr = (u32)addr;
566600 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
567− desc->addrh = (u32)(addr >> 32);
601+ struct macb_dma_desc_64 *desc_64;
602+
603+ if (bp->hw_dma_cap == HW_DMA_CAP_64B) {
604+ desc_64 = macb_64b_desc(bp, desc);
605+ desc_64->addrh = upper_32_bits(addr);
606+ }
568607 #endif
608+ desc->addr = lower_32_bits(addr);
609+}
610+
611+static dma_addr_t macb_get_addr(struct macb *bp, struct macb_dma_desc *desc)
612+{
613+ dma_addr_t addr = 0;
614+#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
615+ struct macb_dma_desc_64 *desc_64;
616+
617+ if (bp->hw_dma_cap == HW_DMA_CAP_64B) {
618+ desc_64 = macb_64b_desc(bp, desc);
619+ addr = ((u64)(desc_64->addrh) << 32);
620+ }
621+#endif
622+ addr |= MACB_BF(RX_WADDR, MACB_BFEXT(RX_WADDR, desc->addr));
623+ return addr;
569624 }
570625
571626 static void macb_tx_error_task(struct work_struct *work)
@@ -649,16 +704,17 @@ static void macb_tx_error_task(struct work_struct *work) · 77 unmodified lines
649704
650705 /* Set end of TX queue */
651706 desc = macb_tx_desc(queue, 0);
652− macb_set_addr(desc, 0);
707+ macb_set_addr(bp, desc, 0);
653708 desc->ctrl = MACB_BIT(TX_USED);
654709
655710 /* Make descriptor updates visible to hardware */
656711 wmb();
657712
658713 /* Reinitialize the TX desc queue */
659− queue_writel(queue, TBQP, (u32)(queue->tx_ring_dma));
714+ queue_writel(queue, TBQP, lower_32_bits(queue->tx_ring_dma));
660715 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
661− queue_writel(queue, TBQPH, (u32)(queue->tx_ring_dma >> 32));
716+ if (bp->hw_dma_cap == HW_DMA_CAP_64B)
717+ queue_writel(queue, TBQPH, upper_32_bits(queue->tx_ring_dma));
662718 #endif
663719 /* Make TX ring reflect state of hardware */
664720 queue->tx_head = 0;
@@ -750,6 +806,7 @@ static void gem_rx_refill(struct macb *bp) · 85 unmodified lines
750806 unsigned int entry;
751807 struct sk_buff *skb;
752808 dma_addr_t paddr;
809+ struct macb_dma_desc *desc;
753810
754811 while (CIRC_SPACE(bp->rx_prepared_head, bp->rx_tail,
755812 bp->rx_ring_size) > 0) {
@@ -759,6 +816,7 @@ static void gem_rx_refill(struct macb *bp) · 3 unmodified lines
759816 rmb();
760817
761818 bp->rx_prepared_head++;
819+ desc = macb_rx_desc(bp, entry);
762820
763821 if (!bp->rx_skbuff[entry]) {
764822 /* allocate sk_buff for this free entry in ring */
@@ -782,14 +840,14 @@ static void gem_rx_refill(struct macb *bp) · 17 unmodified lines
782840
783841 if (entry == bp->rx_ring_size - 1)
784842 paddr |= MACB_BIT(RX_WRAP);
785− macb_set_addr(&(bp->rx_ring[entry]), paddr);
786− bp->rx_ring[entry].ctrl = 0;
843+ macb_set_addr(bp, desc, paddr);
844+ desc->ctrl = 0;
787845
788846 /* properly align Ethernet header */
789847 skb_reserve(skb, NET_IP_ALIGN);
790848 } else {
791− bp->rx_ring[entry].addr &= ~MACB_BIT(RX_USED);
792− bp->rx_ring[entry].ctrl = 0;
849+ desc->addr &= ~MACB_BIT(RX_USED);
850+ desc->ctrl = 0;
793851 }
794852 }
795853
@@ -835,16 +893,13 @@ static int gem_rx(struct macb *bp, int budget) · 39 unmodified lines
835893 bool rxused;
836894
837895 entry = macb_rx_ring_wrap(bp, bp->rx_tail);
838− desc = &bp->rx_ring[entry];
896+ desc = macb_rx_desc(bp, entry);
839897
840898 /* Make hw descriptor updates visible to CPU */
841899 rmb();
842900
843901 rxused = (desc->addr & MACB_BIT(RX_USED)) ? true : false;
844− addr = MACB_BF(RX_WADDR, MACB_BFEXT(RX_WADDR, desc->addr));
845−#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
846− addr |= ((u64)(desc->addrh) << 32);
847−#endif
902+ addr = macb_get_addr(bp, desc);
848903 ctrl = desc->ctrl;
849904
850905 if (!rxused)
@@ -987,15 +1042,17 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, · 136 unmodified lines
9871042 static inline void macb_init_rx_ring(struct macb *bp)
9881043 {
9891044 dma_addr_t addr;
1045+ struct macb_dma_desc *desc = NULL;
9901046 int i;
9911047
9921048 addr = bp->rx_buffers_dma;
9931049 for (i = 0; i < bp->rx_ring_size; i++) {
994− bp->rx_ring[i].addr = addr;
995− bp->rx_ring[i].ctrl = 0;
1050+ desc = macb_rx_desc(bp, i);
1051+ macb_set_addr(bp, desc, addr);
1052+ desc->ctrl = 0;
9961053 addr += bp->rx_buffer_size;
9971054 }
998− bp->rx_ring[bp->rx_ring_size - 1].addr |= MACB_BIT(RX_WRAP);
1055+ desc->addr |= MACB_BIT(RX_WRAP);
9991056 bp->rx_tail = 0;
10001057 }
10011058
@@ -1008,15 +1065,14 @@ static int macb_rx(struct macb *bp, int budget) · 6 unmodified lines
10081065
10091066 for (tail = bp->rx_tail; budget > 0; tail++) {
10101067 struct macb_dma_desc *desc = macb_rx_desc(bp, tail);
1011− u32 addr, ctrl;
1068+ u32 ctrl;
10121069
10131070 /* Make hw descriptor updates visible to CPU */
10141071 rmb();
10151072
1016− addr = desc->addr;
10171073 ctrl = desc->ctrl;
10181074
1019− if (!(addr & MACB_BIT(RX_USED)))
1075+ if (!(desc->addr & MACB_BIT(RX_USED)))
10201076 break;
10211077
10221078 if (ctrl & MACB_BIT(RX_SOF)) {
@@ -1336,7 +1392,7 @@ static unsigned int macb_tx_map(struct macb *bp, · 313 unmodified lines
13361392 i = tx_head;
13371393 entry = macb_tx_ring_wrap(bp, i);
13381394 ctrl = MACB_BIT(TX_USED);
1339− desc = &queue->tx_ring[entry];
1395+ desc = macb_tx_desc(queue, entry);
13401396 desc->ctrl = ctrl;
13411397
13421398 if (lso_ctrl) {
@@ -1358,7 +1414,7 @@ static unsigned int macb_tx_map(struct macb *bp, · 15 unmodified lines
13581414 i--;
13591415 entry = macb_tx_ring_wrap(bp, i);
13601416 tx_skb = &queue->tx_skb[entry];
1361− desc = &queue->tx_ring[entry];
1417+ desc = macb_tx_desc(queue, entry);
13621418
13631419 ctrl = (u32)tx_skb->size;
13641420 if (eof) {
@@ -1379,7 +1435,7 @@ static unsigned int macb_tx_map(struct macb *bp, · 14 unmodified lines
13791435 ctrl |= MACB_BF(MSS_MFS, mss_mfs);
13801436
13811437 /* Set TX buffer descriptor */
1382− macb_set_addr(desc, tx_skb->mapping);
1438+ macb_set_addr(bp, desc, tx_skb->mapping);
13831439 /* desc->addr must be visible to hardware before clearing
13841440 * 'TX_USED' bit in desc->ctrl.
13851441 */
@@ -1586,11 +1642,9 @@ static void gem_free_rx_buffers(struct macb *bp) · 200 unmodified lines
15861642 if (!skb)
15871643 continue;
15881644
1589− desc = &bp->rx_ring[i];
1590− addr = MACB_BF(RX_WADDR, MACB_BFEXT(RX_WADDR, desc->addr));
1591−#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
1592− addr |= ((u64)(desc->addrh) << 32);
1593−#endif
1645+ desc = macb_rx_desc(bp, i);
1646+ addr = macb_get_addr(bp, desc);
1647+
15941648 dma_unmap_single(&bp->pdev->dev, addr, bp->rx_buffer_size,
15951649 DMA_FROM_DEVICE);
15961650 dev_kfree_skb_any(skb);
@@ -1711,15 +1765,17 @@ out_err: · 114 unmodified lines
17111765 static void gem_init_rings(struct macb *bp)
17121766 {
17131767 struct macb_queue *queue;
1768+ struct macb_dma_desc *desc = NULL;
17141769 unsigned int q;
17151770 int i;
17161771
17171772 for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
17181773 for (i = 0; i < bp->tx_ring_size; i++) {
1719− queue->tx_ring[i].addr = 0;
1720− queue->tx_ring[i].ctrl = MACB_BIT(TX_USED);
1774+ desc = macb_tx_desc(queue, i);
1775+ macb_set_addr(bp, desc, 0);
1776+ desc->ctrl = MACB_BIT(TX_USED);
17211777 }
1722− queue->tx_ring[bp->tx_ring_size - 1].ctrl |= MACB_BIT(TX_WRAP);
1778+ desc->ctrl |= MACB_BIT(TX_WRAP);
17231779 queue->tx_head = 0;
17241780 queue->tx_tail = 0;
17251781 }
@@ -1733,16 +1789,18 @@ static void gem_init_rings(struct macb *bp) · 7 unmodified lines
17331789 static void macb_init_rings(struct macb *bp)
17341790 {
17351791 int i;
1792+ struct macb_dma_desc *desc = NULL;
17361793
17371794 macb_init_rx_ring(bp);
17381795
17391796 for (i = 0; i < bp->tx_ring_size; i++) {
1740− bp->queues[0].tx_ring[i].addr = 0;
1741− bp->queues[0].tx_ring[i].ctrl = MACB_BIT(TX_USED);
1797+ desc = macb_tx_desc(&bp->queues[0], i);
1798+ macb_set_addr(bp, desc, 0);
1799+ desc->ctrl = MACB_BIT(TX_USED);
17421800 }
17431801 bp->queues[0].tx_head = 0;
17441802 bp->queues[0].tx_tail = 0;
1745− bp->queues[0].tx_ring[bp->tx_ring_size - 1].ctrl |= MACB_BIT(TX_WRAP);
1803+ desc->ctrl |= MACB_BIT(TX_WRAP);
17461804 }
17471805
17481806 static void macb_reset_hw(struct macb *bp)
@@ -1863,7 +1921,8 @@ static void macb_configure_dma(struct macb *bp) · 114 unmodified lines
18631921 dmacfg &= ~GEM_BIT(TXCOEN);
18641922
18651923 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
1866− dmacfg |= GEM_BIT(ADDR64);
1924+ if (bp->hw_dma_cap == HW_DMA_CAP_64B)
1925+ dmacfg |= GEM_BIT(ADDR64);
18671926 #endif
18681927 netdev_dbg(bp->dev, "Cadence configure DMA with 0x%08x\n",
18691928 dmacfg);
@@ -1910,14 +1969,16 @@ static void macb_init_hw(struct macb *bp) · 40 unmodified lines
19101969 macb_configure_dma(bp);
19111970
19121971 /* Initialize TX and RX buffers */
1913− macb_writel(bp, RBQP, (u32)(bp->rx_ring_dma));
1972+ macb_writel(bp, RBQP, lower_32_bits(bp->rx_ring_dma));
19141973 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
1915− macb_writel(bp, RBQPH, (u32)(bp->rx_ring_dma >> 32));
1974+ if (bp->hw_dma_cap == HW_DMA_CAP_64B)
1975+ macb_writel(bp, RBQPH, upper_32_bits(bp->rx_ring_dma));
19161976 #endif
19171977 for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
1918− queue_writel(queue, TBQP, (u32)(queue->tx_ring_dma));
1978+ queue_writel(queue, TBQP, lower_32_bits(queue->tx_ring_dma));
19191979 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
1920− queue_writel(queue, TBQPH, (u32)(queue->tx_ring_dma >> 32));
1980+ if (bp->hw_dma_cap == HW_DMA_CAP_64B)
1981+ queue_writel(queue, TBQPH, upper_32_bits(queue->tx_ring_dma));
19211982 #endif
19221983
19231984 /* Enable interrupts */
@@ -2627,7 +2688,8 @@ static int macb_init(struct platform_device *pdev) · 703 unmodified lines
26272688 queue->IMR = GEM_IMR(hw_q - 1);
26282689 queue->TBQP = GEM_TBQP(hw_q - 1);
26292690 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
2630− queue->TBQPH = GEM_TBQPH(hw_q -1);
2691+ if (bp->hw_dma_cap == HW_DMA_CAP_64B)
2692+ queue->TBQPH = GEM_TBQPH(hw_q - 1);
26312693 #endif
26322694 } else {
26332695 /* queue0 uses legacy registers */
@@ -2637,7 +2699,8 @@ static int macb_init(struct platform_device *pdev) · 3 unmodified lines
26372699 queue->IMR = MACB_IMR;
26382700 queue->TBQP = MACB_TBQP;
26392701 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
2640− queue->TBQPH = MACB_TBQPH;
2702+ if (bp->hw_dma_cap == HW_DMA_CAP_64B)
2703+ queue->TBQPH = MACB_TBQPH;
26412704 #endif
26422705 }
26432706
@@ -2730,13 +2793,14 @@ static int macb_init(struct platform_device *pdev) · 86 unmodified lines
27302793 static int at91ether_start(struct net_device *dev)
27312794 {
27322795 struct macb *lp = netdev_priv(dev);
2796+ struct macb_dma_desc *desc;
27332797 dma_addr_t addr;
27342798 u32 ctl;
27352799 int i;
27362800
27372801 lp->rx_ring = dma_alloc_coherent(&lp->pdev->dev,
27382802 (AT91ETHER_MAX_RX_DESCR *
2739− sizeof(struct macb_dma_desc)),
2803+ macb_dma_desc_get_size(lp)),
27402804 &lp->rx_ring_dma, GFP_KERNEL);
27412805 if (!lp->rx_ring)
27422806 return -ENOMEM;
@@ -2748,7 +2812,7 @@ static int at91ether_start(struct net_device *dev) · 5 unmodified lines
27482812 if (!lp->rx_buffers) {
27492813 dma_free_coherent(&lp->pdev->dev,
27502814 AT91ETHER_MAX_RX_DESCR *
2751− sizeof(struct macb_dma_desc),
2815+ macb_dma_desc_get_size(lp),
27522816 lp->rx_ring, lp->rx_ring_dma);
27532817 lp->rx_ring = NULL;
27542818 return -ENOMEM;
@@ -2756,13 +2820,14 @@ static int at91ether_start(struct net_device *dev) · 1 unmodified line
27562820
27572821 addr = lp->rx_buffers_dma;
27582822 for (i = 0; i < AT91ETHER_MAX_RX_DESCR; i++) {
2759− lp->rx_ring[i].addr = addr;
2760− lp->rx_ring[i].ctrl = 0;
2823+ desc = macb_rx_desc(lp, i);
2824+ macb_set_addr(lp, desc, addr);
2825+ desc->ctrl = 0;
27612826 addr += AT91ETHER_MAX_RBUFF_SZ;
27622827 }
27632828
27642829 /* Set the Wrap bit on the last descriptor */
2765− lp->rx_ring[AT91ETHER_MAX_RX_DESCR - 1].addr |= MACB_BIT(RX_WRAP);
2830+ desc->addr |= MACB_BIT(RX_WRAP);
27662831
27672832 /* Reset buffer index */
27682833 lp->rx_tail = 0;
@@ -2834,7 +2899,7 @@ static int at91ether_close(struct net_device *dev) · 65 unmodified lines
28342899
28352900 dma_free_coherent(&lp->pdev->dev,
28362901 AT91ETHER_MAX_RX_DESCR *
2837− sizeof(struct macb_dma_desc),
2902+ macb_dma_desc_get_size(lp),
28382903 lp->rx_ring, lp->rx_ring_dma);
28392904 lp->rx_ring = NULL;
28402905
@@ -2885,13 +2950,15 @@ static int at91ether_start_xmit(struct sk_buff *skb, struct net_device *dev) · 44 unmodified lines
28852950 static void at91ether_rx(struct net_device *dev)
28862951 {
28872952 struct macb *lp = netdev_priv(dev);
2953+ struct macb_dma_desc *desc;
28882954 unsigned char *p_recv;
28892955 struct sk_buff *skb;
28902956 unsigned int pktlen;
28912957
2892− while (lp->rx_ring[lp->rx_tail].addr & MACB_BIT(RX_USED)) {
2958+ desc = macb_rx_desc(lp, lp->rx_tail);
2959+ while (desc->addr & MACB_BIT(RX_USED)) {
28932960 p_recv = lp->rx_buffers + lp->rx_tail * AT91ETHER_MAX_RBUFF_SZ;
2894− pktlen = MACB_BF(RX_FRMLEN, lp->rx_ring[lp->rx_tail].ctrl);
2961+ pktlen = MACB_BF(RX_FRMLEN, desc->ctrl);
28952962 skb = netdev_alloc_skb(dev, pktlen + 2);
28962963 if (skb) {
28972964 skb_reserve(skb, 2);
@@ -2905,17 +2972,19 @@ static void at91ether_rx(struct net_device *dev) · 7 unmodified lines
29052972 lp->stats.rx_dropped++;
29062973 }
29072974
2908− if (lp->rx_ring[lp->rx_tail].ctrl & MACB_BIT(RX_MHASH_MATCH))
2975+ if (desc->ctrl & MACB_BIT(RX_MHASH_MATCH))
29092976 lp->stats.multicast++;
29102977
29112978 /* reset ownership bit */
2912− lp->rx_ring[lp->rx_tail].addr &= ~MACB_BIT(RX_USED);
2979+ desc->addr &= ~MACB_BIT(RX_USED);
29132980
29142981 /* wrap after last buffer */
29152982 if (lp->rx_tail == AT91ETHER_MAX_RX_DESCR - 1)
29162983 lp->rx_tail = 0;
29172984 else
29182985 lp->rx_tail++;
2986+
2987+ desc = macb_rx_desc(lp, lp->rx_tail);
29192988 }
29202989 }
29212990
@@ -3211,8 +3280,11 @@ static int macb_probe(struct platform_device *pdev) · 289 unmodified lines
32113280 device_init_wakeup(&pdev->dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET);
32123281
32133282 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
3214− if (GEM_BFEXT(DBWDEF, gem_readl(bp, DCFG1)) > GEM_DBW32)
3283+ if (GEM_BFEXT(DAW64, gem_readl(bp, DCFG6))) {
32153284 dma_set_mask(&pdev->dev, DMA_BIT_MASK(44));
3285+ bp->hw_dma_cap = HW_DMA_CAP_64B;
3286+ } else
3287+ bp->hw_dma_cap = HW_DMA_CAP_32B;
32163288 #endif
32173289
32183290 spin_lock_init(&bp->lock);
drivers/net/ethernet/cadence/macb.h+17−3
@@ -385,6 +385,8 @@ · 384 unmodified lines
385385 /* Bitfields in DCFG6. */
386386 #define GEM_PBUF_LSO_OFFSET 27
387387 #define GEM_PBUF_LSO_SIZE 1
388+#define GEM_DAW64_OFFSET 23
389+#define GEM_DAW64_SIZE 1
388390
389391 /* Constants for CLK */
390392 #define MACB_CLK_DIV8 0
@@ -487,12 +489,20 @@ · 96 unmodified lines
487489 struct macb_dma_desc {
488490 u32 addr;
489491 u32 ctrl;
492+};
493+
490494 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
491− u32 addrh;
492− u32 resvd;
493−#endif
495+enum macb_hw_dma_cap {
496+ HW_DMA_CAP_32B,
497+ HW_DMA_CAP_64B,
494498 };
495499
500+struct macb_dma_desc_64 {
501+ u32 addrh;
502+ u32 resvd;
503+};
504+#endif
505+
496506 /* DMA descriptor bitfields */
497507 #define MACB_RX_USED_OFFSET 0
498508 #define MACB_RX_USED_SIZE 1
@@ -874,6 +884,10 @@ struct macb { · 375 unmodified lines
874884 unsigned int jumbo_max_len;
875885
876886 u32 wol;
887+
888+#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
889+ enum macb_hw_dma_cap hw_dma_cap;
890+#endif
877891 };
878892
879893 static inline bool macb_is_gem(struct macb *bp)
drivers/net/ethernet/cavium/thunder/thunder_xcv.c+1−2
@@ -116,8 +116,7 @@ void xcv_setup_link(bool link_up, int link_speed) · 115 unmodified lines
116116 int speed = 2;
117117
118118 if (!xcv) {
119− dev_err(&xcv->pdev->dev,
120− "XCV init not done, probe may have failed\n");
119+ pr_err("XCV init not done, probe may have failed\n");
121120 return;
122121 }
123122
drivers/net/ethernet/emulex/benet/be_main.c+28−5
@@ -362,8 +362,10 @@ static int be_mac_addr_set(struct net_device *netdev, void *p) · 361 unmodified lines
362362 status = -EPERM;
363363 goto err;
364364 }
365−done:
365+
366+ /* Remember currently programmed MAC */
366367 ether_addr_copy(adapter->dev_mac, addr->sa_data);
368+done:
367369 ether_addr_copy(netdev->dev_addr, addr->sa_data);
368370 dev_info(dev, "MAC address changed to %pM\n", addr->sa_data);
369371 return 0;
@@ -3618,8 +3620,10 @@ static void be_disable_if_filters(struct be_adapter *adapter) · 3248 unmodified lines
36183620 {
36193621 /* Don't delete MAC on BE3 VFs without FILTMGMT privilege */
36203622 if (!BEx_chip(adapter) || !be_virtfn(adapter) ||
3621− check_privilege(adapter, BE_PRIV_FILTMGMT))
3623+ check_privilege(adapter, BE_PRIV_FILTMGMT)) {
36223624 be_dev_mac_del(adapter, adapter->pmac_id[0]);
3625+ eth_zero_addr(adapter->dev_mac);
3626+ }
36233627
36243628 be_clear_uc_list(adapter);
36253629 be_clear_mc_list(adapter);
@@ -3773,12 +3777,27 @@ static int be_enable_if_filters(struct be_adapter *adapter) · 147 unmodified lines
37733777 if (status)
37743778 return status;
37753779
3776− /* Don't add MAC on BE3 VFs without FILTMGMT privilege */
3777− if (!BEx_chip(adapter) || !be_virtfn(adapter) ||
3778− check_privilege(adapter, BE_PRIV_FILTMGMT)) {
3780+ /* Normally this condition usually true as the ->dev_mac is zeroed.
3781+ * But on BE3 VFs the initial MAC is pre-programmed by PF and
3782+ * subsequent be_dev_mac_add() can fail (after fresh boot)
3783+ */
3784+ if (!ether_addr_equal(adapter->dev_mac, adapter->netdev->dev_addr)) {
3785+ int old_pmac_id = -1;
3786+
3787+ /* Remember old programmed MAC if any - can happen on BE3 VF */
3788+ if (!is_zero_ether_addr(adapter->dev_mac))
3789+ old_pmac_id = adapter->pmac_id[0];
3790+
37793791 status = be_dev_mac_add(adapter, adapter->netdev->dev_addr);
37803792 if (status)
37813793 return status;
3794+
3795+ /* Delete the old programmed MAC as we successfully programmed
3796+ * a new MAC
3797+ */
3798+ if (old_pmac_id >= 0 && old_pmac_id != adapter->pmac_id[0])
3799+ be_dev_mac_del(adapter, old_pmac_id);
3800+
37823801 ether_addr_copy(adapter->dev_mac, adapter->netdev->dev_addr);
37833802 }
37843803
@@ -4552,6 +4571,10 @@ static int be_mac_setup(struct be_adapter *adapter) · 767 unmodified lines
45524571
45534572 memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN);
45544573 memcpy(adapter->netdev->perm_addr, mac, ETH_ALEN);
4574+
4575+ /* Initial MAC for BE3 VFs is already programmed by PF */
4576+ if (BEx_chip(adapter) && be_virtfn(adapter))
4577+ memcpy(adapter->dev_mac, mac, ETH_ALEN);
45554578 }
45564579
45574580 return 0;
drivers/net/ethernet/freescale/gianfar.c+2−2
@@ -2010,8 +2010,8 @@ static void free_skb_rx_queue(struct gfar_priv_rx_q *rx_queue) · 2009 unmodified lines
20102010 if (!rxb->page)
20112011 continue;
20122012
2013− dma_unmap_single(rx_queue->dev, rxb->dma,
2014− PAGE_SIZE, DMA_FROM_DEVICE);
2013+ dma_unmap_page(rx_queue->dev, rxb->dma,
2014+ PAGE_SIZE, DMA_FROM_DEVICE);
20152015 __free_page(rxb->page);
20162016
20172017 rxb->page = NULL;
drivers/net/ethernet/mellanox/mlx4/catas.c+1−1
@@ -158,7 +158,7 @@ static int mlx4_reset_slave(struct mlx4_dev *dev) · 157 unmodified lines
158158 return -ETIMEDOUT;
159159 }
160160
161−static int mlx4_comm_internal_err(u32 slave_read)
161+int mlx4_comm_internal_err(u32 slave_read)
162162 {
163163 return (u32)COMM_CHAN_EVENT_INTERNAL_ERR ==
164164 (slave_read & (u32)COMM_CHAN_EVENT_INTERNAL_ERR) ? 1 : 0;
drivers/net/ethernet/mellanox/mlx4/intf.c+12−0
@@ -222,6 +222,18 @@ void mlx4_unregister_device(struct mlx4_dev *dev) · 221 unmodified lines
222222 return;
223223
224224 mlx4_stop_catas_poll(dev);
225+ if (dev->persist->interface_state & MLX4_INTERFACE_STATE_DELETION &&
226+ mlx4_is_slave(dev)) {
227+ /* In mlx4_remove_one on a VF */
228+ u32 slave_read =
229+ swab32(readl(&mlx4_priv(dev)->mfunc.comm->slave_read));
230+
231+ if (mlx4_comm_internal_err(slave_read)) {
232+ mlx4_dbg(dev, "%s: comm channel is down, entering error state.\n",
233+ __func__);
234+ mlx4_enter_error_state(dev->persist);
235+ }
236+ }
225237 mutex_lock(&intf_mutex);
226238
227239 list_for_each_entry(intf, &intf_list, list)
drivers/net/ethernet/mellanox/mlx4/mlx4.h+1−0
@@ -1220,6 +1220,7 @@ void mlx4_qp_event(struct mlx4_dev *dev, u32 qpn, int event_type); · 1219 unmodified lines
12201220 void mlx4_srq_event(struct mlx4_dev *dev, u32 srqn, int event_type);
12211221
12221222 void mlx4_enter_error_state(struct mlx4_dev_persistent *persist);
1223+int mlx4_comm_internal_err(u32 slave_read);
12231224
12241225 int mlx4_SENSE_PORT(struct mlx4_dev *dev, int port,
12251226 enum mlx4_port_type *type);
drivers/net/ethernet/mellanox/mlx5/core/cmd.c+1−1
@@ -1728,7 +1728,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) · 1727 unmodified lines
17281728 if (cmd->cmdif_rev > CMD_IF_REV) {
17291729 dev_err(&dev->pdev->dev, "driver does not support command interface version. driver %d, firmware %d\n",
17301730 CMD_IF_REV, cmd->cmdif_rev);
1731− err = -ENOTSUPP;
1731+ err = -EOPNOTSUPP;
17321732 goto err_free_page;
17331733 }
17341734
drivers/net/ethernet/mellanox/mlx5/core/en.h+4−3
@@ -791,7 +791,8 @@ void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv); · 790 unmodified lines
791791 int mlx5e_modify_rqs_vsd(struct mlx5e_priv *priv, bool vsd);
792792
793793 int mlx5e_redirect_rqt(struct mlx5e_priv *priv, u32 rqtn, int sz, int ix);
794−void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv);
794+void mlx5e_build_indir_tir_ctx_hash(struct mlx5e_priv *priv, void *tirc,
795+ enum mlx5e_traffic_types tt);
795796
796797 int mlx5e_open_locked(struct net_device *netdev);
797798 int mlx5e_close_locked(struct net_device *netdev);
@@ -863,12 +864,12 @@ static inline void mlx5e_arfs_destroy_tables(struct mlx5e_priv *priv) {} · 65 unmodified lines
863864
864865 static inline int mlx5e_arfs_enable(struct mlx5e_priv *priv)
865866 {
866− return -ENOTSUPP;
867+ return -EOPNOTSUPP;
867868 }
868869
869870 static inline int mlx5e_arfs_disable(struct mlx5e_priv *priv)
870871 {
871− return -ENOTSUPP;
872+ return -EOPNOTSUPP;
872873 }
873874 #else
874875 int mlx5e_arfs_create_tables(struct mlx5e_priv *priv);
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c+8−3
@@ -89,7 +89,7 @@ static int mlx5e_dcbnl_ieee_getets(struct net_device *netdev, · 88 unmodified lines
8989 int i;
9090
9191 if (!MLX5_CAP_GEN(priv->mdev, ets))
92− return -ENOTSUPP;
92+ return -EOPNOTSUPP;
9393
9494 ets->ets_cap = mlx5_max_tc(priv->mdev) + 1;
9595 for (i = 0; i < ets->ets_cap; i++) {
@@ -236,7 +236,7 @@ static int mlx5e_dcbnl_ieee_setets(struct net_device *netdev, · 140 unmodified lines
236236 int err;
237237
238238 if (!MLX5_CAP_GEN(priv->mdev, ets))
239− return -ENOTSUPP;
239+ return -EOPNOTSUPP;
240240
241241 err = mlx5e_dbcnl_validate_ets(netdev, ets);
242242 if (err)
@@ -402,7 +402,7 @@ static u8 mlx5e_dcbnl_setall(struct net_device *netdev) · 159 unmodified lines
402402 struct mlx5_core_dev *mdev = priv->mdev;
403403 struct ieee_ets ets;
404404 struct ieee_pfc pfc;
405− int err = -ENOTSUPP;
405+ int err = -EOPNOTSUPP;
406406 int i;
407407
408408 if (!MLX5_CAP_GEN(mdev, ets))
@@ -511,6 +511,11 @@ static void mlx5e_dcbnl_getpgtccfgtx(struct net_device *netdev, · 102 unmodified lines
511511 struct mlx5e_priv *priv = netdev_priv(netdev);
512512 struct mlx5_core_dev *mdev = priv->mdev;
513513
514+ if (!MLX5_CAP_GEN(priv->mdev, ets)) {
515+ netdev_err(netdev, "%s, ets is not supported\n", __func__);
516+ return;
517+ }
518+
514519 if (priority >= CEE_DCBX_MAX_PRIO) {
515520 netdev_err(netdev,
516521 "%s, priority is out of range\n", __func__);
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c+26−15
@@ -595,7 +595,7 @@ static int mlx5e_get_coalesce(struct net_device *netdev, · 594 unmodified lines
595595 struct mlx5e_priv *priv = netdev_priv(netdev);
596596
597597 if (!MLX5_CAP_GEN(priv->mdev, cq_moderation))
598− return -ENOTSUPP;
598+ return -EOPNOTSUPP;
599599
600600 coal->rx_coalesce_usecs = priv->params.rx_cq_moderation.usec;
601601 coal->rx_max_coalesced_frames = priv->params.rx_cq_moderation.pkts;
@@ -620,7 +620,7 @@ static int mlx5e_set_coalesce(struct net_device *netdev, · 18 unmodified lines
620620 int i;
621621
622622 if (!MLX5_CAP_GEN(mdev, cq_moderation))
623− return -ENOTSUPP;
623+ return -EOPNOTSUPP;
624624
625625 mutex_lock(&priv->state_lock);
626626
@@ -980,15 +980,18 @@ static int mlx5e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, · 353 unmodified lines
980980
981981 static void mlx5e_modify_tirs_hash(struct mlx5e_priv *priv, void *in, int inlen)
982982 {
983− struct mlx5_core_dev *mdev = priv->mdev;
984983 void *tirc = MLX5_ADDR_OF(modify_tir_in, in, ctx);
985− int i;
984+ struct mlx5_core_dev *mdev = priv->mdev;
985+ int ctxlen = MLX5_ST_SZ_BYTES(tirc);
986+ int tt;
986987
987988 MLX5_SET(modify_tir_in, in, bitmask.hash, 1);
988− mlx5e_build_tir_ctx_hash(tirc, priv);
989989
990− for (i = 0; i < MLX5E_NUM_INDIR_TIRS; i++)
991− mlx5_core_modify_tir(mdev, priv->indir_tir[i].tirn, in, inlen);
990+ for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) {
991+ memset(tirc, 0, ctxlen);
992+ mlx5e_build_indir_tir_ctx_hash(priv, tirc, tt);
993+ mlx5_core_modify_tir(mdev, priv->indir_tir[tt].tirn, in, inlen);
994+ }
992995 }
993996
994997 static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
@@ -996,6 +999,7 @@ static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir, · 1 unmodified line
996999 {
9971000 struct mlx5e_priv *priv = netdev_priv(dev);
9981001 int inlen = MLX5_ST_SZ_BYTES(modify_tir_in);
1002+ bool hash_changed = false;
9991003 void *in;
10001004
10011005 if ((hfunc != ETH_RSS_HASH_NO_CHANGE) &&
@@ -1017,14 +1021,21 @@ static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir, · 15 unmodified lines
10171021 mlx5e_redirect_rqt(priv, rqtn, MLX5E_INDIR_RQT_SIZE, 0);
10181022 }
10191023
1020− if (key)
1024+ if (hfunc != ETH_RSS_HASH_NO_CHANGE &&
1025+ hfunc != priv->params.rss_hfunc) {
1026+ priv->params.rss_hfunc = hfunc;
1027+ hash_changed = true;
1028+ }
1029+
1030+ if (key) {
10211031 memcpy(priv->params.toeplitz_hash_key, key,
10221032 sizeof(priv->params.toeplitz_hash_key));
1033+ hash_changed = hash_changed ||
1034+ priv->params.rss_hfunc == ETH_RSS_HASH_TOP;
1035+ }
10231036
1024− if (hfunc != ETH_RSS_HASH_NO_CHANGE)
1025− priv->params.rss_hfunc = hfunc;
1026−
1027− mlx5e_modify_tirs_hash(priv, in, inlen);
1037+ if (hash_changed)
1038+ mlx5e_modify_tirs_hash(priv, in, inlen);
10281039
10291040 mutex_unlock(&priv->state_lock);
10301041
@@ -1296,7 +1307,7 @@ static int mlx5e_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) · 265 unmodified lines
12961307 u32 mlx5_wol_mode;
12971308
12981309 if (!wol_supported)
1299− return -ENOTSUPP;
1310+ return -EOPNOTSUPP;
13001311
13011312 if (wol->wolopts & ~wol_supported)
13021313 return -EINVAL;
@@ -1426,7 +1437,7 @@ static int set_pflag_rx_cqe_based_moder(struct net_device *netdev, bool enable) · 123 unmodified lines
14261437
14271438 if (rx_cq_period_mode == MLX5_CQ_PERIOD_MODE_START_FROM_CQE &&
14281439 !MLX5_CAP_GEN(mdev, cq_period_start_from_cqe))
1429− return -ENOTSUPP;
1440+ return -EOPNOTSUPP;
14301441
14311442 if (!rx_mode_changed)
14321443 return 0;
@@ -1452,7 +1463,7 @@ static int set_pflag_rx_cqe_compress(struct net_device *netdev, · 19 unmodified lines
14521463 bool reset;
14531464
14541465 if (!MLX5_CAP_GEN(mdev, cqe_compression))
1455− return -ENOTSUPP;
1466+ return -EOPNOTSUPP;
14561467
14571468 if (enable && priv->tstamp.hwtstamp_config.rx_filter != HWTSTAMP_FILTER_NONE) {
14581469 netdev_err(netdev, "Can't enable cqe compression while timestamping is enabled.\n");
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c+1−1
@@ -1089,7 +1089,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv) · 1088 unmodified lines
10891089 MLX5_FLOW_NAMESPACE_KERNEL);
10901090
10911091 if (!priv->fs.ns)
1092− return -EINVAL;
1092+ return -EOPNOTSUPP;
10931093
10941094 err = mlx5e_arfs_create_tables(priv);
10951095 if (err) {
drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c+1−1
@@ -92,7 +92,7 @@ static struct mlx5e_ethtool_table *get_flow_table(struct mlx5e_priv *priv, · 91 unmodified lines
9292 ns = mlx5_get_flow_namespace(priv->mdev,
9393 MLX5_FLOW_NAMESPACE_ETHTOOL);
9494 if (!ns)
95− return ERR_PTR(-ENOTSUPP);
95+ return ERR_PTR(-EOPNOTSUPP);
9696
9797 table_size = min_t(u32, BIT(MLX5_CAP_FLOWTABLE(priv->mdev,
9898 flow_table_properties_nic_receive.log_max_ft_size)),
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+101−101
@@ -2022,8 +2022,23 @@ static void mlx5e_build_tir_ctx_lro(void *tirc, struct mlx5e_priv *priv) · 2021 unmodified lines
20222022 MLX5_SET(tirc, tirc, lro_timeout_period_usecs, priv->params.lro_timeout);
20232023 }
20242024
2025−void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv)
2025+void mlx5e_build_indir_tir_ctx_hash(struct mlx5e_priv *priv, void *tirc,
2026+ enum mlx5e_traffic_types tt)
20262027 {
2028+ void *hfso = MLX5_ADDR_OF(tirc, tirc, rx_hash_field_selector_outer);
2029+
2030+#define MLX5_HASH_IP (MLX5_HASH_FIELD_SEL_SRC_IP |\
2031+ MLX5_HASH_FIELD_SEL_DST_IP)
2032+
2033+#define MLX5_HASH_IP_L4PORTS (MLX5_HASH_FIELD_SEL_SRC_IP |\
2034+ MLX5_HASH_FIELD_SEL_DST_IP |\
2035+ MLX5_HASH_FIELD_SEL_L4_SPORT |\
2036+ MLX5_HASH_FIELD_SEL_L4_DPORT)
2037+
2038+#define MLX5_HASH_IP_IPSEC_SPI (MLX5_HASH_FIELD_SEL_SRC_IP |\
2039+ MLX5_HASH_FIELD_SEL_DST_IP |\
2040+ MLX5_HASH_FIELD_SEL_IPSEC_SPI)
2041+
20272042 MLX5_SET(tirc, tirc, rx_hash_fn,
20282043 mlx5e_rx_hash_fn(priv->params.rss_hfunc));
20292044 if (priv->params.rss_hfunc == ETH_RSS_HASH_TOP) {
@@ -2035,6 +2050,88 @@ void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv) · 5 unmodified lines
20352050 MLX5_SET(tirc, tirc, rx_hash_symmetric, 1);
20362051 memcpy(rss_key, priv->params.toeplitz_hash_key, len);
20372052 }
2053+
2054+ switch (tt) {
2055+ case MLX5E_TT_IPV4_TCP:
2056+ MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2057+ MLX5_L3_PROT_TYPE_IPV4);
2058+ MLX5_SET(rx_hash_field_select, hfso, l4_prot_type,
2059+ MLX5_L4_PROT_TYPE_TCP);
2060+ MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2061+ MLX5_HASH_IP_L4PORTS);
2062+ break;
2063+
2064+ case MLX5E_TT_IPV6_TCP:
2065+ MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2066+ MLX5_L3_PROT_TYPE_IPV6);
2067+ MLX5_SET(rx_hash_field_select, hfso, l4_prot_type,
2068+ MLX5_L4_PROT_TYPE_TCP);
2069+ MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2070+ MLX5_HASH_IP_L4PORTS);
2071+ break;
2072+
2073+ case MLX5E_TT_IPV4_UDP:
2074+ MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2075+ MLX5_L3_PROT_TYPE_IPV4);
2076+ MLX5_SET(rx_hash_field_select, hfso, l4_prot_type,
2077+ MLX5_L4_PROT_TYPE_UDP);
2078+ MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2079+ MLX5_HASH_IP_L4PORTS);
2080+ break;
2081+
2082+ case MLX5E_TT_IPV6_UDP:
2083+ MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2084+ MLX5_L3_PROT_TYPE_IPV6);
2085+ MLX5_SET(rx_hash_field_select, hfso, l4_prot_type,
2086+ MLX5_L4_PROT_TYPE_UDP);
2087+ MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2088+ MLX5_HASH_IP_L4PORTS);
2089+ break;
2090+
2091+ case MLX5E_TT_IPV4_IPSEC_AH:
2092+ MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2093+ MLX5_L3_PROT_TYPE_IPV4);
2094+ MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2095+ MLX5_HASH_IP_IPSEC_SPI);
2096+ break;
2097+
2098+ case MLX5E_TT_IPV6_IPSEC_AH:
2099+ MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2100+ MLX5_L3_PROT_TYPE_IPV6);
2101+ MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2102+ MLX5_HASH_IP_IPSEC_SPI);
2103+ break;
2104+
2105+ case MLX5E_TT_IPV4_IPSEC_ESP:
2106+ MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2107+ MLX5_L3_PROT_TYPE_IPV4);
2108+ MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2109+ MLX5_HASH_IP_IPSEC_SPI);
2110+ break;
2111+
2112+ case MLX5E_TT_IPV6_IPSEC_ESP:
2113+ MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2114+ MLX5_L3_PROT_TYPE_IPV6);
2115+ MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2116+ MLX5_HASH_IP_IPSEC_SPI);
2117+ break;
2118+
2119+ case MLX5E_TT_IPV4:
2120+ MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2121+ MLX5_L3_PROT_TYPE_IPV4);
2122+ MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2123+ MLX5_HASH_IP);
2124+ break;
2125+
2126+ case MLX5E_TT_IPV6:
2127+ MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2128+ MLX5_L3_PROT_TYPE_IPV6);
2129+ MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2130+ MLX5_HASH_IP);
2131+ break;
2132+ default:
2133+ WARN_ONCE(true, "%s: bad traffic type!\n", __func__);
2134+ }
20382135 }
20392136
20402137 static int mlx5e_modify_tirs_lro(struct mlx5e_priv *priv)
@@ -2404,110 +2501,13 @@ void mlx5e_cleanup_nic_tx(struct mlx5e_priv *priv) · 363 unmodified lines
24042501 static void mlx5e_build_indir_tir_ctx(struct mlx5e_priv *priv, u32 *tirc,
24052502 enum mlx5e_traffic_types tt)
24062503 {
2407− void *hfso = MLX5_ADDR_OF(tirc, tirc, rx_hash_field_selector_outer);
2408−
24092504 MLX5_SET(tirc, tirc, transport_domain, priv->mdev->mlx5e_res.td.tdn);
24102505
2411−#define MLX5_HASH_IP (MLX5_HASH_FIELD_SEL_SRC_IP |\
2412− MLX5_HASH_FIELD_SEL_DST_IP)
2413−
2414−#define MLX5_HASH_IP_L4PORTS (MLX5_HASH_FIELD_SEL_SRC_IP |\
2415− MLX5_HASH_FIELD_SEL_DST_IP |\
2416− MLX5_HASH_FIELD_SEL_L4_SPORT |\
2417− MLX5_HASH_FIELD_SEL_L4_DPORT)
2418−
2419−#define MLX5_HASH_IP_IPSEC_SPI (MLX5_HASH_FIELD_SEL_SRC_IP |\
2420− MLX5_HASH_FIELD_SEL_DST_IP |\
2421− MLX5_HASH_FIELD_SEL_IPSEC_SPI)
2422−
24232506 mlx5e_build_tir_ctx_lro(tirc, priv);
24242507
24252508 MLX5_SET(tirc, tirc, disp_type, MLX5_TIRC_DISP_TYPE_INDIRECT);
24262509 MLX5_SET(tirc, tirc, indirect_table, priv->indir_rqt.rqtn);
2427− mlx5e_build_tir_ctx_hash(tirc, priv);
2428−
2429− switch (tt) {
2430− case MLX5E_TT_IPV4_TCP:
2431− MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2432− MLX5_L3_PROT_TYPE_IPV4);
2433− MLX5_SET(rx_hash_field_select, hfso, l4_prot_type,
2434− MLX5_L4_PROT_TYPE_TCP);
2435− MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2436− MLX5_HASH_IP_L4PORTS);
2437− break;
2438−
2439− case MLX5E_TT_IPV6_TCP:
2440− MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2441− MLX5_L3_PROT_TYPE_IPV6);
2442− MLX5_SET(rx_hash_field_select, hfso, l4_prot_type,
2443− MLX5_L4_PROT_TYPE_TCP);
2444− MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2445− MLX5_HASH_IP_L4PORTS);
2446− break;
2447−
2448− case MLX5E_TT_IPV4_UDP:
2449− MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2450− MLX5_L3_PROT_TYPE_IPV4);
2451− MLX5_SET(rx_hash_field_select, hfso, l4_prot_type,
2452− MLX5_L4_PROT_TYPE_UDP);
2453− MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2454− MLX5_HASH_IP_L4PORTS);
2455− break;
2456−
2457− case MLX5E_TT_IPV6_UDP:
2458− MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2459− MLX5_L3_PROT_TYPE_IPV6);
2460− MLX5_SET(rx_hash_field_select, hfso, l4_prot_type,
2461− MLX5_L4_PROT_TYPE_UDP);
2462− MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2463− MLX5_HASH_IP_L4PORTS);
2464− break;
2465−
2466− case MLX5E_TT_IPV4_IPSEC_AH:
2467− MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2468− MLX5_L3_PROT_TYPE_IPV4);
2469− MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2470− MLX5_HASH_IP_IPSEC_SPI);
2471− break;
2472−
2473− case MLX5E_TT_IPV6_IPSEC_AH:
2474− MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2475− MLX5_L3_PROT_TYPE_IPV6);
2476− MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2477− MLX5_HASH_IP_IPSEC_SPI);
2478− break;
2479−
2480− case MLX5E_TT_IPV4_IPSEC_ESP:
2481− MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2482− MLX5_L3_PROT_TYPE_IPV4);
2483− MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2484− MLX5_HASH_IP_IPSEC_SPI);
2485− break;
2486−
2487− case MLX5E_TT_IPV6_IPSEC_ESP:
2488− MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2489− MLX5_L3_PROT_TYPE_IPV6);
2490− MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2491− MLX5_HASH_IP_IPSEC_SPI);
2492− break;
2493−
2494− case MLX5E_TT_IPV4:
2495− MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2496− MLX5_L3_PROT_TYPE_IPV4);
2497− MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2498− MLX5_HASH_IP);
2499− break;
2500−
2501− case MLX5E_TT_IPV6:
2502− MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
2503− MLX5_L3_PROT_TYPE_IPV6);
2504− MLX5_SET(rx_hash_field_select, hfso, selected_fields,
2505− MLX5_HASH_IP);
2506− break;
2507− default:
2508− WARN_ONCE(true,
2509− "mlx5e_build_indir_tir_ctx: bad traffic type!\n");
2510− }
2510+ mlx5e_build_indir_tir_ctx_hash(priv, tirc, tt);
25112511 }
25122512
25132513 static void mlx5e_build_direct_tir_ctx(struct mlx5e_priv *priv, u32 *tirc,
@@ -3331,7 +3331,7 @@ static const struct net_device_ops mlx5e_netdev_ops_sriov = { · 817 unmodified lines
33313331 static int mlx5e_check_required_hca_cap(struct mlx5_core_dev *mdev)
33323332 {
33333333 if (MLX5_CAP_GEN(mdev, port_type) != MLX5_CAP_PORT_TYPE_ETH)
3334− return -ENOTSUPP;
3334+ return -EOPNOTSUPP;
33353335 if (!MLX5_CAP_GEN(mdev, eth_net_offloads) ||
33363336 !MLX5_CAP_GEN(mdev, nic_flow_table) ||
33373337 !MLX5_CAP_ETH(mdev, csum_cap) ||
@@ -3343,7 +3343,7 @@ static int mlx5e_check_required_hca_cap(struct mlx5_core_dev *mdev) · 5 unmodified lines
33433343 < 3) {
33443344 mlx5_core_warn(mdev,
33453345 "Not creating net device, some required device capabilities are missing\n");
3346− return -ENOTSUPP;
3346+ return -EOPNOTSUPP;
33473347 }
33483348 if (!MLX5_CAP_ETH(mdev, self_lb_en_modifiable))
33493349 mlx5_core_warn(mdev, "Self loop back prevention is not supported\n");
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+6−7
@@ -663,6 +663,7 @@ static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv, · 662 unmodified lines
663663 __be32 *saddr,
664664 int *out_ttl)
665665 {
666+ struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
666667 struct rtable *rt;
667668 struct neighbour *n = NULL;
668669 int ttl;
@@ -677,12 +678,11 @@ static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv, · 8 unmodified lines
677678 #else
678679 return -EOPNOTSUPP;
679680 #endif
680−
681− if (!switchdev_port_same_parent_id(priv->netdev, rt->dst.dev)) {
682− pr_warn("%s: can't offload, devices not on same HW e-switch\n", __func__);
683− ip_rt_put(rt);
684− return -EOPNOTSUPP;
685− }
681+ /* if the egress device isn't on the same HW e-switch, we use the uplink */
682+ if (!switchdev_port_same_parent_id(priv->netdev, rt->dst.dev))
683+ *out_dev = mlx5_eswitch_get_uplink_netdev(esw);
684+ else
685+ *out_dev = rt->dst.dev;
686686
687687 ttl = ip4_dst_hoplimit(&rt->dst);
688688 n = dst_neigh_lookup(&rt->dst, &fl4->daddr);
@@ -693,7 +693,6 @@ static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv, · 4 unmodified lines
693693 *out_n = n;
694694 *saddr = fl4->saddr;
695695 *out_ttl = ttl;
696− *out_dev = rt->dst.dev;
697696
698697 return 0;
699698 }
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c+5−5
@@ -133,7 +133,7 @@ static int modify_esw_vport_cvlan(struct mlx5_core_dev *dev, u32 vport, · 132 unmodified lines
133133
134134 if (!MLX5_CAP_ESW(dev, vport_cvlan_strip) ||
135135 !MLX5_CAP_ESW(dev, vport_cvlan_insert_if_not_exist))
136− return -ENOTSUPP;
136+ return -EOPNOTSUPP;
137137
138138 esw_debug(dev, "Set Vport[%d] VLAN %d qos %d set=%x\n",
139139 vport, vlan, qos, set_flags);
@@ -353,7 +353,7 @@ static int esw_create_legacy_fdb_table(struct mlx5_eswitch *esw, int nvports) · 213 unmodified lines
353353 root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_FDB);
354354 if (!root_ns) {
355355 esw_warn(dev, "Failed to get FDB flow namespace\n");
356− return -ENOMEM;
356+ return -EOPNOTSUPP;
357357 }
358358
359359 flow_group_in = mlx5_vzalloc(inlen);
@@ -962,7 +962,7 @@ static int esw_vport_enable_egress_acl(struct mlx5_eswitch *esw, · 602 unmodified lines
962962 root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_ESW_EGRESS);
963963 if (!root_ns) {
964964 esw_warn(dev, "Failed to get E-Switch egress flow namespace\n");
965− return -EIO;
965+ return -EOPNOTSUPP;
966966 }
967967
968968 flow_group_in = mlx5_vzalloc(inlen);
@@ -1079,7 +1079,7 @@ static int esw_vport_enable_ingress_acl(struct mlx5_eswitch *esw, · 110 unmodified lines
10791079 root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_ESW_INGRESS);
10801080 if (!root_ns) {
10811081 esw_warn(dev, "Failed to get E-Switch ingress flow namespace\n");
1082− return -EIO;
1082+ return -EOPNOTSUPP;
10831083 }
10841084
10851085 flow_group_in = mlx5_vzalloc(inlen);
@@ -1630,7 +1630,7 @@ int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs, int mode) · 544 unmodified lines
16301630 if (!MLX5_CAP_GEN(esw->dev, eswitch_flow_table) ||
16311631 !MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, ft_support)) {
16321632 esw_warn(esw->dev, "E-Switch FDB is not supported, aborting ...\n");
1633− return -ENOTSUPP;
1633+ return -EOPNOTSUPP;
16341634 }
16351635
16361636 if (!MLX5_CAP_ESW_INGRESS_ACL(esw->dev, ft_support))
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c+22−14
@@ -166,7 +166,7 @@ static int esw_add_vlan_action_check(struct mlx5_esw_flow_attr *attr, · 165 unmodified lines
166166 return 0;
167167
168168 out_notsupp:
169− return -ENOTSUPP;
169+ return -EOPNOTSUPP;
170170 }
171171
172172 int mlx5_eswitch_add_vlan_action(struct mlx5_eswitch *esw,
@@ -424,6 +424,7 @@ static int esw_create_offloads_fdb_table(struct mlx5_eswitch *esw, int nvports) · 251 unmodified lines
424424 root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_FDB);
425425 if (!root_ns) {
426426 esw_warn(dev, "Failed to get FDB flow namespace\n");
427+ err = -EOPNOTSUPP;
427428 goto ns_err;
428429 }
429430
@@ -535,7 +536,7 @@ static int esw_create_offloads_table(struct mlx5_eswitch *esw) · 105 unmodified lines
535536 ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_OFFLOADS);
536537 if (!ns) {
537538 esw_warn(esw->dev, "Failed to get offloads flow namespace\n");
538− return -ENOMEM;
539+ return -EOPNOTSUPP;
539540 }
540541
541542 ft_offloads = mlx5_create_flow_table(ns, 0, dev->priv.sriov.num_vfs + 2, 0, 0);
@@ -655,7 +656,7 @@ static int esw_offloads_start(struct mlx5_eswitch *esw) · 113 unmodified lines
655656 esw_warn(esw->dev, "Failed setting eswitch to offloads, err %d\n", err);
656657 err1 = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY);
657658 if (err1)
658− esw_warn(esw->dev, "Failed setting eswitch back to legacy, err %d\n", err);
659+ esw_warn(esw->dev, "Failed setting eswitch back to legacy, err %d\n", err1);
659660 }
660661 if (esw->offloads.inline_mode == MLX5_INLINE_MODE_NONE) {
661662 if (mlx5_eswitch_inline_mode_get(esw,
@@ -674,9 +675,14 @@ int esw_offloads_init(struct mlx5_eswitch *esw, int nvports) · 12 unmodified lines
674675 int vport;
675676 int err;
676677
678+ /* disable PF RoCE so missed packets don't go through RoCE steering */
679+ mlx5_dev_list_lock();
680+ mlx5_remove_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB);
681+ mlx5_dev_list_unlock();
682+
677683 err = esw_create_offloads_fdb_table(esw, nvports);
678684 if (err)
679− return err;
685+ goto create_fdb_err;
680686
681687 err = esw_create_offloads_table(esw);
682688 if (err)
@@ -696,11 +702,6 @@ int esw_offloads_init(struct mlx5_eswitch *esw, int nvports) · 13 unmodified lines
696702 goto err_reps;
697703 }
698704
699− /* disable PF RoCE so missed packets don't go through RoCE steering */
700− mlx5_dev_list_lock();
701− mlx5_remove_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB);
702− mlx5_dev_list_unlock();
703−
704705 return 0;
705706
706707 err_reps:
@@ -717,6 +718,13 @@ create_fg_err: · 10 unmodified lines
717718
718719 create_ft_err:
719720 esw_destroy_offloads_fdb_table(esw);
721+
722+create_fdb_err:
723+ /* enable back PF RoCE */
724+ mlx5_dev_list_lock();
725+ mlx5_add_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB);
726+ mlx5_dev_list_unlock();
727+
720728 return err;
721729 }
722730
@@ -724,11 +732,6 @@ static int esw_offloads_stop(struct mlx5_eswitch *esw) · 1 unmodified line
724732 {
725733 int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs;
726734
727− /* enable back PF RoCE */
728− mlx5_dev_list_lock();
729− mlx5_add_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB);
730− mlx5_dev_list_unlock();
731−
732735 mlx5_eswitch_disable_sriov(esw);
733736 err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY);
734737 if (err) {
@@ -738,6 +741,11 @@ static int esw_offloads_stop(struct mlx5_eswitch *esw) · 3 unmodified lines
738741 esw_warn(esw->dev, "Failed setting eswitch back to offloads, err %d\n", err);
739742 }
740743
744+ /* enable back PF RoCE */
745+ mlx5_dev_list_lock();
746+ mlx5_add_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB);
747+ mlx5_dev_list_unlock();
748+
741749 return err;
742750 }
743751
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c+1−1
@@ -322,7 +322,7 @@ int mlx5_cmd_update_fte(struct mlx5_core_dev *dev, · 321 unmodified lines
322322 flow_table_properties_nic_receive.
323323 flow_modify_en);
324324 if (!atomic_mod_cap)
325− return -ENOTSUPP;
325+ return -EOPNOTSUPP;
326326 opmod = 1;
327327
328328 return mlx5_cmd_set_fte(dev, opmod, modify_mask, ft, group_id, fte);
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c+1−1
@@ -1822,7 +1822,7 @@ static int create_anchor_flow_table(struct mlx5_flow_steering *steering) · 1821 unmodified lines
18221822 struct mlx5_flow_table *ft;
18231823
18241824 ns = mlx5_get_flow_namespace(steering->dev, MLX5_FLOW_NAMESPACE_ANCHOR);
1825− if (!ns)
1825+ if (WARN_ON(!ns))
18261826 return -EINVAL;
18271827 ft = mlx5_create_flow_table(ns, ANCHOR_PRIO, ANCHOR_SIZE, ANCHOR_LEVEL, 0);
18281828 if (IS_ERR(ft)) {
drivers/net/ethernet/mellanox/mlx5/core/main.c+1−1
@@ -807,7 +807,7 @@ static int mlx5_core_set_issi(struct mlx5_core_dev *dev) · 806 unmodified lines
807807 return 0;
808808 }
809809
810− return -ENOTSUPP;
810+ return -EOPNOTSUPP;
811811 }
812812
813813
drivers/net/ethernet/mellanox/mlx5/core/port.c+2−2
@@ -620,7 +620,7 @@ static int mlx5_set_port_qetcr_reg(struct mlx5_core_dev *mdev, u32 *in, · 619 unmodified lines
620620 u32 out[MLX5_ST_SZ_DW(qtct_reg)];
621621
622622 if (!MLX5_CAP_GEN(mdev, ets))
623− return -ENOTSUPP;
623+ return -EOPNOTSUPP;
624624
625625 return mlx5_core_access_reg(mdev, in, inlen, out, sizeof(out),
626626 MLX5_REG_QETCR, 0, 1);
@@ -632,7 +632,7 @@ static int mlx5_query_port_qetcr_reg(struct mlx5_core_dev *mdev, u32 *out, · 5 unmodified lines
632632 u32 in[MLX5_ST_SZ_DW(qtct_reg)];
633633
634634 if (!MLX5_CAP_GEN(mdev, ets))
635− return -ENOTSUPP;
635+ return -EOPNOTSUPP;
636636
637637 memset(in, 0, sizeof(in));
638638 return mlx5_core_access_reg(mdev, in, sizeof(in), out, outlen,
drivers/net/ethernet/mellanox/mlx5/core/vport.c+1−1
@@ -532,7 +532,7 @@ int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev, · 531 unmodified lines
532532 if (!MLX5_CAP_GEN(mdev, vport_group_manager))
533533 return -EACCES;
534534 if (!MLX5_CAP_ESW(mdev, nic_vport_node_guid_modify))
535− return -ENOTSUPP;
535+ return -EOPNOTSUPP;
536536
537537 in = mlx5_vzalloc(inlen);
538538 if (!in)
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c+4−0
@@ -305,8 +305,12 @@ static int dwmac1000_irq_status(struct mac_device_info *hw, · 304 unmodified lines
305305 {
306306 void __iomem *ioaddr = hw->pcsr;
307307 u32 intr_status = readl(ioaddr + GMAC_INT_STATUS);
308+ u32 intr_mask = readl(ioaddr + GMAC_INT_MASK);
308309 int ret = 0;
309310
311+ /* Discard masked bits */
312+ intr_status &= ~intr_mask;
313+
310314 /* Not used events (e.g. MMC interrupts) are not handled. */
311315 if ((intr_status & GMAC_INT_STATUS_MMCTIS))
312316 x->mmc_tx_irq_n++;
drivers/net/hyperv/netvsc.c+6−0
@@ -1295,6 +1295,9 @@ void netvsc_channel_cb(void *context) · 1294 unmodified lines
12951295 ndev = hv_get_drvdata(device);
12961296 buffer = get_per_channel_state(channel);
12971297
1298+ /* commit_rd_index() -> hv_signal_on_read() needs this. */
1299+ init_cached_read_index(channel);
1300+
12981301 do {
12991302 desc = get_next_pkt_raw(channel);
13001303 if (desc != NULL) {
@@ -1347,6 +1350,9 @@ void netvsc_channel_cb(void *context) · 46 unmodified lines
13471350
13481351 bufferlen = bytes_recvd;
13491352 }
1353+
1354+ init_cached_read_index(channel);
1355+
13501356 } while (1);
13511357
13521358 if (bufferlen > NETVSC_PACKET_SIZE)
drivers/net/phy/micrel.c+1−1
@@ -1012,7 +1012,7 @@ static struct phy_driver ksphy_driver[] = { · 1011 unmodified lines
10121012 .phy_id = PHY_ID_KSZ8795,
10131013 .phy_id_mask = MICREL_PHY_ID_MASK,
10141014 .name = "Micrel KSZ8795",
1015− .features = (SUPPORTED_Pause | SUPPORTED_Asym_Pause),
1015+ .features = PHY_BASIC_FEATURES,
10161016 .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
10171017 .config_init = kszphy_config_init,
10181018 .config_aneg = ksz8873mll_config_aneg,
drivers/net/wireless/intel/iwlwifi/iwl-8000.c+1−1
@@ -91,7 +91,7 @@ · 90 unmodified lines
9191
9292 #define IWL8000_FW_PRE "iwlwifi-8000C-"
9393 #define IWL8000_MODULE_FIRMWARE(api) \
94− IWL8000_FW_PRE "-" __stringify(api) ".ucode"
94+ IWL8000_FW_PRE __stringify(api) ".ucode"
9595
9696 #define IWL8265_FW_PRE "iwlwifi-8265-"
9797 #define IWL8265_MODULE_FIRMWARE(api) \
drivers/net/wireless/intel/iwlwifi/mvm/sta.c+4−3
@@ -1164,9 +1164,10 @@ static void iwl_mvm_realloc_queues_after_restart(struct iwl_mvm *mvm, · 1163 unmodified lines
11641164 .frame_limit = IWL_FRAME_LIMIT,
11651165 };
11661166
1167− /* Make sure reserved queue is still marked as such (or allocated) */
1168− mvm->queue_info[mvm_sta->reserved_queue].status =
1169− IWL_MVM_QUEUE_RESERVED;
1167+ /* Make sure reserved queue is still marked as such (if allocated) */
1168+ if (mvm_sta->reserved_queue != IEEE80211_INVAL_HW_QUEUE)
1169+ mvm->queue_info[mvm_sta->reserved_queue].status =
1170+ IWL_MVM_QUEUE_RESERVED;
11701171
11711172 for (i = 0; i <= IWL_MAX_TID_COUNT; i++) {
11721173 struct iwl_mvm_tid_data *tid_data = &mvm_sta->tid_data[i];
drivers/net/wireless/intel/iwlwifi/mvm/tt.c+8−4
@@ -843,8 +843,10 @@ static void iwl_mvm_thermal_zone_unregister(struct iwl_mvm *mvm) · 842 unmodified lines
843843 return;
844844
845845 IWL_DEBUG_TEMP(mvm, "Thermal zone device unregister\n");
846− thermal_zone_device_unregister(mvm->tz_device.tzone);
847− mvm->tz_device.tzone = NULL;
846+ if (mvm->tz_device.tzone) {
847+ thermal_zone_device_unregister(mvm->tz_device.tzone);
848+ mvm->tz_device.tzone = NULL;
849+ }
848850 }
849851
850852 static void iwl_mvm_cooling_device_unregister(struct iwl_mvm *mvm)
@@ -853,8 +855,10 @@ static void iwl_mvm_cooling_device_unregister(struct iwl_mvm *mvm) · 2 unmodified lines
853855 return;
854856
855857 IWL_DEBUG_TEMP(mvm, "Cooling device unregister\n");
856− thermal_cooling_device_unregister(mvm->cooling_dev.cdev);
857− mvm->cooling_dev.cdev = NULL;
858+ if (mvm->cooling_dev.cdev) {
859+ thermal_cooling_device_unregister(mvm->cooling_dev.cdev);
860+ mvm->cooling_dev.cdev = NULL;
861+ }
858862 }
859863 #endif /* CONFIG_THERMAL */
860864
drivers/pci/pcie/aspm.c+13−6
@@ -532,25 +532,32 @@ static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev) · 531 unmodified lines
532532 link = kzalloc(sizeof(*link), GFP_KERNEL);
533533 if (!link)
534534 return NULL;
535+
535536 INIT_LIST_HEAD(&link->sibling);
536537 INIT_LIST_HEAD(&link->children);
537538 INIT_LIST_HEAD(&link->link);
538539 link->pdev = pdev;
539− if (pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT) {
540+
541+ /*
542+ * Root Ports and PCI/PCI-X to PCIe Bridges are roots of PCIe
543+ * hierarchies.
544+ */
545+ if (pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT ||
546+ pci_pcie_type(pdev) == PCI_EXP_TYPE_PCIE_BRIDGE) {
547+ link->root = link;
548+ } else {
540549 struct pcie_link_state *parent;
550+
541551 parent = pdev->bus->parent->self->link_state;
542552 if (!parent) {
543553 kfree(link);
544554 return NULL;
545555 }
556+
546557 link->parent = parent;
558+ link->root = link->parent->root;
547559 list_add(&link->link, &parent->children);
548560 }
549− /* Setup a pointer to the root port link */
550− if (!link->parent)
551− link->root = link;
552− else
553− link->root = link->parent->root;
554561
555562 list_add(&link->sibling, &link_list);
556563 pdev->link_state = link;
drivers/pinctrl/berlin/berlin-bg4ct.c+1−1
@@ -217,7 +217,7 @@ static const struct berlin_desc_group berlin4ct_soc_pinctrl_groups[] = { · 216 unmodified lines
217217 BERLIN_PINCTRL_GROUP("SCRD0_CRD_PRES", 0xc, 0x3, 0x15,
218218 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO20 */
219219 BERLIN_PINCTRL_FUNCTION(0x1, "scrd0"), /* crd pres */
220− BERLIN_PINCTRL_FUNCTION(0x1, "sd1a")), /* DAT3 */
220+ BERLIN_PINCTRL_FUNCTION(0x3, "sd1a")), /* DAT3 */
221221 BERLIN_PINCTRL_GROUP("SPI1_SS0n", 0xc, 0x3, 0x18,
222222 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SS0n */
223223 BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), /* GPIO37 */
drivers/pinctrl/intel/pinctrl-baytrail.c+20−7
@@ -731,16 +731,23 @@ static void __iomem *byt_gpio_reg(struct byt_gpio *vg, unsigned int offset, · 730 unmodified lines
731731 int reg)
732732 {
733733 struct byt_community *comm = byt_get_community(vg, offset);
734− u32 reg_offset = 0;
734+ u32 reg_offset;
735735
736736 if (!comm)
737737 return NULL;
738738
739739 offset -= comm->pin_base;
740− if (reg == BYT_INT_STAT_REG)
740+ switch (reg) {
741+ case BYT_INT_STAT_REG:
741742 reg_offset = (offset / 32) * 4;
742− else
743+ break;
744+ case BYT_DEBOUNCE_REG:
745+ reg_offset = 0;
746+ break;
747+ default:
743748 reg_offset = comm->pad_map[offset] * 16;
749+ break;
750+ }
744751
745752 return comm->reg_base + reg_offset + reg;
746753 }
@@ -1243,10 +1250,12 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev, · 496 unmodified lines
12431250 debounce = readl(db_reg);
12441251 debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
12451252
1253+ if (arg)
1254+ conf |= BYT_DEBOUNCE_EN;
1255+ else
1256+ conf &= ~BYT_DEBOUNCE_EN;
1257+
12461258 switch (arg) {
1247− case 0:
1248− conf &= BYT_DEBOUNCE_EN;
1249− break;
12501259 case 375:
12511260 debounce |= BYT_DEBOUNCE_PULSE_375US;
12521261 break;
@@ -1269,7 +1278,9 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev, · 16 unmodified lines
12691278 debounce |= BYT_DEBOUNCE_PULSE_24MS;
12701279 break;
12711280 default:
1272− ret = -EINVAL;
1281+ if (arg)
1282+ ret = -EINVAL;
1283+ break;
12731284 }
12741285
12751286 if (!ret)
@@ -1612,7 +1623,9 @@ static void byt_gpio_irq_handler(struct irq_desc *desc) · 336 unmodified lines
16121623 continue;
16131624 }
16141625
1626+ raw_spin_lock(&vg->lock);
16151627 pending = readl(reg);
1628+ raw_spin_unlock(&vg->lock);
16161629 for_each_set_bit(pin, &pending, 32) {
16171630 virq = irq_find_mapping(vg->chip.irqdomain, base + pin);
16181631 generic_handle_irq(virq);
drivers/pinctrl/intel/pinctrl-merrifield.c+3−0
@@ -794,6 +794,9 @@ static int mrfld_config_set(struct pinctrl_dev *pctldev, unsigned int pin, · 793 unmodified lines
794794 unsigned int i;
795795 int ret;
796796
797+ if (!mrfld_buf_available(mp, pin))
798+ return -ENOTSUPP;
799+
797800 for (i = 0; i < nconfigs; i++) {
798801 switch (pinconf_to_config_param(configs[i])) {
799802 case PIN_CONFIG_BIAS_DISABLE:
drivers/pinctrl/sunxi/pinctrl-sunxi.c+1−2
@@ -564,8 +564,7 @@ static int sunxi_pconf_group_set(struct pinctrl_dev *pctldev, · 563 unmodified lines
564564 val = arg / 10 - 1;
565565 break;
566566 case PIN_CONFIG_BIAS_DISABLE:
567− val = 0;
568− break;
567+ continue;
569568 case PIN_CONFIG_BIAS_PULL_UP:
570569 if (arg == 0)
571570 return -EINVAL;
drivers/regulator/axp20x-regulator.c+1−1
@@ -272,7 +272,7 @@ static const struct regulator_desc axp806_regulators[] = { · 271 unmodified lines
272272 64, AXP806_DCDCD_V_CTRL, 0x3f, AXP806_PWR_OUT_CTRL1,
273273 BIT(3)),
274274 AXP_DESC(AXP806, DCDCE, "dcdce", "vine", 1100, 3400, 100,
275− AXP806_DCDCB_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL1, BIT(4)),
275+ AXP806_DCDCE_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL1, BIT(4)),
276276 AXP_DESC(AXP806, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
277277 AXP806_ALDO1_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL1, BIT(5)),
278278 AXP_DESC(AXP806, ALDO2, "aldo2", "aldoin", 700, 3400, 100,
drivers/regulator/fixed.c+0−46
@@ -30,9 +30,6 @@ · 29 unmodified lines
3030 #include <linux/of_gpio.h>
3131 #include <linux/regulator/of_regulator.h>
3232 #include <linux/regulator/machine.h>
33−#include <linux/acpi.h>
34−#include <linux/property.h>
35−#include <linux/gpio/consumer.h>
3633
3734 struct fixed_voltage_data {
3835 struct regulator_desc desc;
@@ -97,44 +94,6 @@ of_get_fixed_voltage_config(struct device *dev, · 58 unmodified lines
9794 return config;
9895 }
9996
100−/**
101− * acpi_get_fixed_voltage_config - extract fixed_voltage_config structure info
102− * @dev: device requesting for fixed_voltage_config
103− * @desc: regulator description
104− *
105− * Populates fixed_voltage_config structure by extracting data through ACPI
106− * interface, returns a pointer to the populated structure of NULL if memory
107− * alloc fails.
108− */
109−static struct fixed_voltage_config *
110−acpi_get_fixed_voltage_config(struct device *dev,
111− const struct regulator_desc *desc)
112−{
113− struct fixed_voltage_config *config;
114− const char *supply_name;
115− struct gpio_desc *gpiod;
116− int ret;
117−
118− config = devm_kzalloc(dev, sizeof(*config), GFP_KERNEL);
119− if (!config)
120− return ERR_PTR(-ENOMEM);
121−
122− ret = device_property_read_string(dev, "supply-name", &supply_name);
123− if (!ret)
124− config->supply_name = supply_name;
125−
126− gpiod = gpiod_get(dev, "gpio", GPIOD_ASIS);
127− if (IS_ERR(gpiod))
128− return ERR_PTR(-ENODEV);
129−
130− config->gpio = desc_to_gpio(gpiod);
131− config->enable_high = device_property_read_bool(dev,
132− "enable-active-high");
133− gpiod_put(gpiod);
134−
135− return config;
136−}
137−
13897 static struct regulator_ops fixed_voltage_ops = {
13998 };
14099
@@ -155,11 +114,6 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) · 14 unmodified lines
155114 &drvdata->desc);
156115 if (IS_ERR(config))
157116 return PTR_ERR(config);
158− } else if (ACPI_HANDLE(&pdev->dev)) {
159− config = acpi_get_fixed_voltage_config(&pdev->dev,
160− &drvdata->desc);
161− if (IS_ERR(config))
162− return PTR_ERR(config);
163117 } else {
164118 config = dev_get_platdata(&pdev->dev);
165119 }
drivers/regulator/twl6030-regulator.c+1−1
@@ -452,7 +452,7 @@ static int twl6030smps_map_voltage(struct regulator_dev *rdev, int min_uV, · 451 unmodified lines
452452 vsel = 62;
453453 else if ((min_uV > 1800000) && (min_uV <= 1900000))
454454 vsel = 61;
455− else if ((min_uV > 1350000) && (min_uV <= 1800000))
455+ else if ((min_uV > 1500000) && (min_uV <= 1800000))
456456 vsel = 60;
457457 else if ((min_uV > 1350000) && (min_uV <= 1500000))
458458 vsel = 59;
drivers/rtc/Kconfig+4−1
@@ -1551,12 +1551,15 @@ config RTC_DRV_MPC5121 · 1550 unmodified lines
15511551 will be called rtc-mpc5121.
15521552
15531553 config RTC_DRV_JZ4740
1554− bool "Ingenic JZ4740 SoC"
1554+ tristate "Ingenic JZ4740 SoC"
15551555 depends on MACH_INGENIC || COMPILE_TEST
15561556 help
15571557 If you say yes here you get support for the Ingenic JZ47xx SoCs RTC
15581558 controllers.
15591559
1560+ This driver can also be buillt as a module. If so, the module
1561+ will be called rtc-jz4740.
1562+
15601563 config RTC_DRV_LPC24XX
15611564 tristate "NXP RTC for LPC178x/18xx/408x/43xx"
15621565 depends on ARCH_LPC18XX || COMPILE_TEST
drivers/rtc/rtc-jz4740.c+10−2
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/clk.h>
1818 #include <linux/io.h>
1919 #include <linux/kernel.h>
20+#include <linux/module.h>
2021 #include <linux/of_device.h>
2122 #include <linux/platform_device.h>
2223 #include <linux/reboot.h>
@@ -294,7 +295,7 @@ static void jz4740_rtc_power_off(void) · 271 unmodified lines
294295 JZ_REG_RTC_RESET_COUNTER, reset_counter_ticks);
295296
296297 jz4740_rtc_poweroff(dev_for_power_off);
297− machine_halt();
298+ kernel_halt();
298299 }
299300
300301 static const struct of_device_id jz4740_rtc_of_match[] = {
@@ -302,6 +303,7 @@ static const struct of_device_id jz4740_rtc_of_match[] = { · 1 unmodified line
302303 { .compatible = "ingenic,jz4780-rtc", .data = (void *)ID_JZ4780 },
303304 {},
304305 };
306+MODULE_DEVICE_TABLE(of, jz4740_rtc_of_match);
305307
306308 static int jz4740_rtc_probe(struct platform_device *pdev)
307309 {
@@ -429,6 +431,7 @@ static const struct platform_device_id jz4740_rtc_ids[] = { · 121 unmodified lines
429431 { "jz4780-rtc", ID_JZ4780 },
430432 {}
431433 };
434+MODULE_DEVICE_TABLE(platform, jz4740_rtc_ids);
432435
433436 static struct platform_driver jz4740_rtc_driver = {
434437 .probe = jz4740_rtc_probe,
@@ -440,4 +443,9 @@ static struct platform_driver jz4740_rtc_driver = { · 5 unmodified lines
440443 .id_table = jz4740_rtc_ids,
441444 };
442445
443−builtin_platform_driver(jz4740_rtc_driver);
446+module_platform_driver(jz4740_rtc_driver);
447+
448+MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
449+MODULE_LICENSE("GPL");
450+MODULE_DESCRIPTION("RTC driver for the JZ4740 SoC\n");
451+MODULE_ALIAS("platform:jz4740-rtc");
drivers/scsi/virtio_scsi.c+10−1
@@ -534,7 +534,9 @@ static int virtscsi_queuecommand(struct virtio_scsi *vscsi, · 533 unmodified lines
534534 {
535535 struct Scsi_Host *shost = virtio_scsi_host(vscsi->vdev);
536536 struct virtio_scsi_cmd *cmd = scsi_cmd_priv(sc);
537+ unsigned long flags;
537538 int req_size;
539+ int ret;
538540
539541 BUG_ON(scsi_sg_count(sc) > shost->sg_tablesize);
540542
@@ -562,8 +564,15 @@ static int virtscsi_queuecommand(struct virtio_scsi *vscsi, · 21 unmodified lines
562564 req_size = sizeof(cmd->req.cmd);
563565 }
564566
565− if (virtscsi_kick_cmd(req_vq, cmd, req_size, sizeof(cmd->resp.cmd)) != 0)
567+ ret = virtscsi_kick_cmd(req_vq, cmd, req_size, sizeof(cmd->resp.cmd));
568+ if (ret == -EIO) {
569+ cmd->resp.cmd.response = VIRTIO_SCSI_S_BAD_TARGET;
570+ spin_lock_irqsave(&req_vq->vq_lock, flags);
571+ virtscsi_complete_cmd(vscsi, cmd);
572+ spin_unlock_irqrestore(&req_vq->vq_lock, flags);
573+ } else if (ret != 0) {
566574 return SCSI_MLQUEUE_HOST_BUSY;
575+ }
567576 return 0;
568577 }
569578
drivers/staging/greybus/timesync_platform.c+6−0
@@ -45,12 +45,18 @@ u32 gb_timesync_platform_get_clock_rate(void) · 44 unmodified lines
4545
4646 int gb_timesync_platform_lock_bus(struct gb_timesync_svc *pdata)
4747 {
48+ if (!arche_platform_change_state_cb)
49+ return 0;
50+
4851 return arche_platform_change_state_cb(ARCHE_PLATFORM_STATE_TIME_SYNC,
4952 pdata);
5053 }
5154
5255 void gb_timesync_platform_unlock_bus(void)
5356 {
57+ if (!arche_platform_change_state_cb)
58+ return;
59+
5460 arche_platform_change_state_cb(ARCHE_PLATFORM_STATE_ACTIVE, NULL);
5561 }
5662
drivers/usb/core/quirks.c+4−0
@@ -37,6 +37,10 @@ static const struct usb_device_id usb_quirk_list[] = { · 36 unmodified lines
3737 /* CBM - Flash disk */
3838 { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME },
3939
40+ /* WORLDE easy key (easykey.25) MIDI controller */
41+ { USB_DEVICE(0x0218, 0x0401), .driver_info =
42+ USB_QUIRK_CONFIG_INTF_STRINGS },
43+
4044 /* HP 5300/5370C scanner */
4145 { USB_DEVICE(0x03f0, 0x0701), .driver_info =
4246 USB_QUIRK_STRING_FETCH_255 },
drivers/usb/gadget/function/f_fs.c+12−1
@@ -2269,6 +2269,8 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type, · 2268 unmodified lines
22692269 if (len < sizeof(*d) || h->interface >= ffs->interfaces_count)
22702270 return -EINVAL;
22712271 length = le32_to_cpu(d->dwSize);
2272+ if (len < length)
2273+ return -EINVAL;
22722274 type = le32_to_cpu(d->dwPropertyDataType);
22732275 if (type < USB_EXT_PROP_UNICODE ||
22742276 type > USB_EXT_PROP_UNICODE_MULTI) {
@@ -2277,6 +2279,11 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type, · 2 unmodified lines
22772279 return -EINVAL;
22782280 }
22792281 pnl = le16_to_cpu(d->wPropertyNameLength);
2282+ if (length < 14 + pnl) {
2283+ pr_vdebug("invalid os descriptor length: %d pnl:%d (descriptor %d)\n",
2284+ length, pnl, type);
2285+ return -EINVAL;
2286+ }
22802287 pdl = le32_to_cpu(*(u32 *)((u8 *)data + 10 + pnl));
22812288 if (length != 14 + pnl + pdl) {
22822289 pr_vdebug("invalid os descriptor length: %d pnl:%d pdl:%d (descriptor %d)\n",
@@ -2363,6 +2370,9 @@ static int __ffs_data_got_descs(struct ffs_data *ffs, · 80 unmodified lines
23632370 }
23642371 }
23652372 if (flags & (1 << i)) {
2373+ if (len < 4) {
2374+ goto error;
2375+ }
23662376 os_descs_count = get_unaligned_le32(data);
23672377 data += 4;
23682378 len -= 4;
@@ -2435,7 +2445,8 @@ static int __ffs_data_got_strings(struct ffs_data *ffs, · 66 unmodified lines
24352445
24362446 ENTER();
24372447
2438− if (unlikely(get_unaligned_le32(data) != FUNCTIONFS_STRINGS_MAGIC ||
2448+ if (unlikely(len < 16 ||
2449+ get_unaligned_le32(data) != FUNCTIONFS_STRINGS_MAGIC ||
24392450 get_unaligned_le32(data + 4) != len))
24402451 goto error;
24412452 str_count = get_unaligned_le32(data + 8);
drivers/usb/musb/musb_core.c+13−13
@@ -594,11 +594,11 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, · 593 unmodified lines
594594 | MUSB_PORT_STAT_RESUME;
595595 musb->rh_timer = jiffies
596596 + msecs_to_jiffies(USB_RESUME_TIMEOUT);
597− musb->need_finish_resume = 1;
598−
599597 musb->xceiv->otg->state = OTG_STATE_A_HOST;
600598 musb->is_active = 1;
601599 musb_host_resume_root_hub(musb);
600+ schedule_delayed_work(&musb->finish_resume_work,
601+ msecs_to_jiffies(USB_RESUME_TIMEOUT));
602602 break;
603603 case OTG_STATE_B_WAIT_ACON:
604604 musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL;
@@ -1925,6 +1925,14 @@ static void musb_pm_runtime_check_session(struct musb *musb) · 1320 unmodified lines
19251925 static void musb_irq_work(struct work_struct *data)
19261926 {
19271927 struct musb *musb = container_of(data, struct musb, irq_work.work);
1928+ int error;
1929+
1930+ error = pm_runtime_get_sync(musb->controller);
1931+ if (error < 0) {
1932+ dev_err(musb->controller, "Could not enable: %i\n", error);
1933+
1934+ return;
1935+ }
19281936
19291937 musb_pm_runtime_check_session(musb);
19301938
@@ -1932,6 +1940,9 @@ static void musb_irq_work(struct work_struct *data) · 1 unmodified line
19321940 musb->xceiv_old_state = musb->xceiv->otg->state;
19331941 sysfs_notify(&musb->controller->kobj, NULL, "mode");
19341942 }
1943+
1944+ pm_runtime_mark_last_busy(musb->controller);
1945+ pm_runtime_put_autosuspend(musb->controller);
19351946 }
19361947
19371948 static void musb_recover_from_babble(struct musb *musb)
@@ -2710,11 +2721,6 @@ static int musb_resume(struct device *dev) · 772 unmodified lines
27102721 mask = MUSB_DEVCTL_BDEVICE | MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV;
27112722 if ((devctl & mask) != (musb->context.devctl & mask))
27122723 musb->port1_status = 0;
2713− if (musb->need_finish_resume) {
2714− musb->need_finish_resume = 0;
2715− schedule_delayed_work(&musb->finish_resume_work,
2716− msecs_to_jiffies(USB_RESUME_TIMEOUT));
2717− }
27182724
27192725 /*
27202726 * The USB HUB code expects the device to be in RPM_ACTIVE once it came
@@ -2766,12 +2772,6 @@ static int musb_runtime_resume(struct device *dev) · 45 unmodified lines
27662772
27672773 musb_restore_context(musb);
27682774
2769− if (musb->need_finish_resume) {
2770− musb->need_finish_resume = 0;
2771− schedule_delayed_work(&musb->finish_resume_work,
2772− msecs_to_jiffies(USB_RESUME_TIMEOUT));
2773− }
2774−
27752775 spin_lock_irqsave(&musb->lock, flags);
27762776 error = musb_run_resume_work(musb);
27772777 if (error)
drivers/usb/musb/musb_core.h+0−1
@@ -410,7 +410,6 @@ struct musb { · 409 unmodified lines
410410
411411 /* is_suspended means USB B_PERIPHERAL suspend */
412412 unsigned is_suspended:1;
413− unsigned need_finish_resume :1;
414413
415414 /* may_wakeup means remote wakeup is enabled */
416415 unsigned may_wakeup:1;
drivers/usb/serial/option.c+1−0
@@ -2007,6 +2007,7 @@ static const struct usb_device_id option_ids[] = { · 2006 unmodified lines
20072007 { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_WMD200, 0xff, 0xff, 0xff) },
20082008 { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_6802, 0xff, 0xff, 0xff) },
20092009 { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_WMD300, 0xff, 0xff, 0xff) },
2010+ { USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x421d, 0xff, 0xff, 0xff) }, /* HP lt2523 (Novatel E371) */
20102011 { } /* Terminating entry */
20112012 };
20122013 MODULE_DEVICE_TABLE(usb, option_ids);
drivers/usb/serial/pl2303.c+1−0
@@ -49,6 +49,7 @@ static const struct usb_device_id id_table[] = { · 48 unmodified lines
4949 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
5050 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) },
5151 { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
52+ { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID2) },
5253 { USB_DEVICE(ATEN_VENDOR_ID2, ATEN_PRODUCT_ID) },
5354 { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) },
5455 { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID_UCSGT) },
drivers/usb/serial/pl2303.h+1−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #define ATEN_VENDOR_ID 0x0557
2828 #define ATEN_VENDOR_ID2 0x0547
2929 #define ATEN_PRODUCT_ID 0x2008
30+#define ATEN_PRODUCT_ID2 0x2118
3031
3132 #define IODATA_VENDOR_ID 0x04bb
3233 #define IODATA_PRODUCT_ID 0x0a03
drivers/usb/serial/qcserial.c+1−0
@@ -124,6 +124,7 @@ static const struct usb_device_id id_table[] = { · 123 unmodified lines
124124 {USB_DEVICE(0x1410, 0xa021)}, /* Novatel Gobi 3000 Composite */
125125 {USB_DEVICE(0x413c, 0x8193)}, /* Dell Gobi 3000 QDL */
126126 {USB_DEVICE(0x413c, 0x8194)}, /* Dell Gobi 3000 Composite */
127+ {USB_DEVICE(0x413c, 0x81a6)}, /* Dell DW5570 QDL (MC8805) */
127128 {USB_DEVICE(0x1199, 0x68a4)}, /* Sierra Wireless QDL */
128129 {USB_DEVICE(0x1199, 0x68a5)}, /* Sierra Wireless Modem */
129130 {USB_DEVICE(0x1199, 0x68a8)}, /* Sierra Wireless QDL */
drivers/vfio/vfio_iommu_spapr_tce.c+5−6
@@ -1123,12 +1123,11 @@ static long tce_iommu_ioctl(void *iommu_data, · 1122 unmodified lines
11231123 mutex_lock(&container->lock);
11241124
11251125 ret = tce_iommu_create_default_window(container);
1126− if (ret)
1127− return ret;
1128−
1129− ret = tce_iommu_create_window(container, create.page_shift,
1130− create.window_size, create.levels,
1131− &create.start_addr);
1126+ if (!ret)
1127+ ret = tce_iommu_create_window(container,
1128+ create.page_shift,
1129+ create.window_size, create.levels,
1130+ &create.start_addr);
11321131
11331132 mutex_unlock(&container->lock);
11341133
drivers/vhost/vhost.c+4−6
@@ -130,14 +130,14 @@ static long vhost_get_vring_endian(struct vhost_virtqueue *vq, u32 idx, · 129 unmodified lines
130130
131131 static void vhost_init_is_le(struct vhost_virtqueue *vq)
132132 {
133− if (vhost_has_feature(vq, VIRTIO_F_VERSION_1))
134− vq->is_le = true;
133+ vq->is_le = vhost_has_feature(vq, VIRTIO_F_VERSION_1)
134+ || virtio_legacy_is_little_endian();
135135 }
136136 #endif /* CONFIG_VHOST_CROSS_ENDIAN_LEGACY */
137137
138138 static void vhost_reset_is_le(struct vhost_virtqueue *vq)
139139 {
140− vq->is_le = virtio_legacy_is_little_endian();
140+ vhost_init_is_le(vq);
141141 }
142142
143143 struct vhost_flush_struct {
@@ -1714,10 +1714,8 @@ int vhost_vq_init_access(struct vhost_virtqueue *vq) · 1570 unmodified lines
17141714 int r;
17151715 bool is_le = vq->is_le;
17161716
1717− if (!vq->private_data) {
1718− vhost_reset_is_le(vq);
1717+ if (!vq->private_data)
17191718 return 0;
1720− }
17211719
17221720 vhost_init_is_le(vq);
17231721
drivers/virtio/virtio_ring.c+0−7
@@ -159,13 +159,6 @@ static bool vring_use_dma_api(struct virtio_device *vdev) · 158 unmodified lines
159159 if (xen_domain())
160160 return true;
161161
162− /*
163− * On ARM-based machines, the DMA ops will do the right thing,
164− * so always use them with legacy devices.
165− */
166− if (IS_ENABLED(CONFIG_ARM) || IS_ENABLED(CONFIG_ARM64))
167− return !virtio_has_feature(vdev, VIRTIO_F_VERSION_1);
168−
169162 return false;
170163 }
171164
fs/cifs/readdir.c+1−0
@@ -285,6 +285,7 @@ initiate_cifs_search(const unsigned int xid, struct file *file) · 284 unmodified lines
285285 rc = -ENOMEM;
286286 goto error_exit;
287287 }
288+ spin_lock_init(&cifsFile->file_info_lock);
288289 file->private_data = cifsFile;
289290 cifsFile->tlink = cifs_get_tlink(tlink);
290291 tcon = tlink_tcon(tlink);
fs/dax.c+5−0
@@ -1031,6 +1031,11 @@ dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data, · 1030 unmodified lines
10311031 struct blk_dax_ctl dax = { 0 };
10321032 ssize_t map_len;
10331033
1034+ if (fatal_signal_pending(current)) {
1035+ ret = -EINTR;
1036+ break;
1037+ }
1038+
10341039 dax.sector = dax_iomap_sector(iomap, pos);
10351040 dax.size = (length + offset + PAGE_SIZE - 1) & PAGE_MASK;
10361041 map_len = dax_map_atomic(iomap->bdev, &dax);
fs/fscache/cookie.c+5−0
@@ -542,6 +542,7 @@ void __fscache_disable_cookie(struct fscache_cookie *cookie, bool invalidate) · 541 unmodified lines
542542 hlist_for_each_entry(object, &cookie->backing_objects, cookie_link) {
543543 if (invalidate)
544544 set_bit(FSCACHE_OBJECT_RETIRED, &object->flags);
545+ clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags);
545546 fscache_raise_event(object, FSCACHE_OBJECT_EV_KILL);
546547 }
547548 } else {
@@ -560,6 +561,10 @@ void __fscache_disable_cookie(struct fscache_cookie *cookie, bool invalidate) · 12 unmodified lines
560561 wait_on_atomic_t(&cookie->n_active, fscache_wait_atomic_t,
561562 TASK_UNINTERRUPTIBLE);
562563
564+ /* Make sure any pending writes are cancelled. */
565+ if (cookie->def->type != FSCACHE_COOKIE_TYPE_INDEX)
566+ fscache_invalidate_writes(cookie);
567+
563568 /* Reset the cookie state if it wasn't relinquished */
564569 if (!test_bit(FSCACHE_COOKIE_RELINQUISHED, &cookie->flags)) {
565570 atomic_inc(&cookie->n_active);
fs/fscache/netfs.c+1−0
@@ -48,6 +48,7 @@ int __fscache_register_netfs(struct fscache_netfs *netfs) · 47 unmodified lines
4848 cookie->flags = 1 << FSCACHE_COOKIE_ENABLED;
4949
5050 spin_lock_init(&cookie->lock);
51+ spin_lock_init(&cookie->stores_lock);
5152 INIT_HLIST_HEAD(&cookie->backing_objects);
5253
5354 /* check the netfs type is not already present */
fs/fscache/object.c+30−2
@@ -30,6 +30,7 @@ static const struct fscache_state *fscache_look_up_object(struct fscache_object · 29 unmodified lines
3030 static const struct fscache_state *fscache_object_available(struct fscache_object *, int);
3131 static const struct fscache_state *fscache_parent_ready(struct fscache_object *, int);
3232 static const struct fscache_state *fscache_update_object(struct fscache_object *, int);
33+static const struct fscache_state *fscache_object_dead(struct fscache_object *, int);
3334
3435 #define __STATE_NAME(n) fscache_osm_##n
3536 #define STATE(n) (&__STATE_NAME(n))
@@ -91,7 +92,7 @@ static WORK_STATE(LOOKUP_FAILURE, "LCFL", fscache_lookup_failure); · 55 unmodified lines
9192 static WORK_STATE(KILL_OBJECT, "KILL", fscache_kill_object);
9293 static WORK_STATE(KILL_DEPENDENTS, "KDEP", fscache_kill_dependents);
9394 static WORK_STATE(DROP_OBJECT, "DROP", fscache_drop_object);
94−static WORK_STATE(OBJECT_DEAD, "DEAD", (void*)2UL);
95+static WORK_STATE(OBJECT_DEAD, "DEAD", fscache_object_dead);
9596
9697 static WAIT_STATE(WAIT_FOR_INIT, "?INI",
9798 TRANSIT_TO(INIT_OBJECT, 1 << FSCACHE_OBJECT_EV_NEW_CHILD));
@@ -229,6 +230,10 @@ execute_work_state: · 131 unmodified lines
229230 event = -1;
230231 if (new_state == NO_TRANSIT) {
231232 _debug("{OBJ%x} %s notrans", object->debug_id, state->name);
233+ if (unlikely(state == STATE(OBJECT_DEAD))) {
234+ _leave(" [dead]");
235+ return;
236+ }
232237 fscache_enqueue_object(object);
233238 event_mask = object->oob_event_mask;
234239 goto unmask_events;
@@ -239,7 +244,7 @@ execute_work_state: · 4 unmodified lines
239244 object->state = state = new_state;
240245
241246 if (state->work) {
242− if (unlikely(state->work == ((void *)2UL))) {
247+ if (unlikely(state == STATE(OBJECT_DEAD))) {
243248 _leave(" [dead]");
244249 return;
245250 }
@@ -645,6 +650,12 @@ static const struct fscache_state *fscache_kill_object(struct fscache_object *ob · 399 unmodified lines
645650 fscache_mark_object_dead(object);
646651 object->oob_event_mask = 0;
647652
653+ if (test_bit(FSCACHE_OBJECT_RETIRED, &object->flags)) {
654+ /* Reject any new read/write ops and abort any that are pending. */
655+ clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags);
656+ fscache_cancel_all_ops(object);
657+ }
658+
648659 if (list_empty(&object->dependents) &&
649660 object->n_ops == 0 &&
650661 object->n_children == 0)
@@ -1077,3 +1088,20 @@ void fscache_object_mark_killed(struct fscache_object *object, · 426 unmodified lines
10771088 }
10781089 }
10791090 EXPORT_SYMBOL(fscache_object_mark_killed);
1091+
1092+/*
1093+ * The object is dead. We can get here if an object gets queued by an event
1094+ * that would lead to its death (such as EV_KILL) when the dispatcher is
1095+ * already running (and so can be requeued) but hasn't yet cleared the event
1096+ * mask.
1097+ */
1098+static const struct fscache_state *fscache_object_dead(struct fscache_object *object,
1099+ int event)
1100+{
1101+ if (!test_and_set_bit(FSCACHE_OBJECT_RUN_AFTER_DEAD,
1102+ &object->flags))
1103+ return NO_TRANSIT;
1104+
1105+ WARN(true, "FS-Cache object redispatched after death");
1106+ return NO_TRANSIT;
1107+}
fs/iomap.c+3−0
@@ -114,6 +114,9 @@ iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, unsigned flags, · 113 unmodified lines
114114
115115 BUG_ON(pos + len > iomap->offset + iomap->length);
116116
117+ if (fatal_signal_pending(current))
118+ return -EINTR;
119+
117120 page = grab_cache_page_write_begin(inode->i_mapping, index, flags);
118121 if (!page)
119122 return -ENOMEM;
fs/nfsd/vfs.c+60−37
@@ -332,6 +332,37 @@ nfsd_sanitize_attrs(struct inode *inode, struct iattr *iap) · 331 unmodified lines
332332 }
333333 }
334334
335+static __be32
336+nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp,
337+ struct iattr *iap)
338+{
339+ struct inode *inode = d_inode(fhp->fh_dentry);
340+ int host_err;
341+
342+ if (iap->ia_size < inode->i_size) {
343+ __be32 err;
344+
345+ err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry,
346+ NFSD_MAY_TRUNC | NFSD_MAY_OWNER_OVERRIDE);
347+ if (err)
348+ return err;
349+ }
350+
351+ host_err = get_write_access(inode);
352+ if (host_err)
353+ goto out_nfserrno;
354+
355+ host_err = locks_verify_truncate(inode, NULL, iap->ia_size);
356+ if (host_err)
357+ goto out_put_write_access;
358+ return 0;
359+
360+out_put_write_access:
361+ put_write_access(inode);
362+out_nfserrno:
363+ return nfserrno(host_err);
364+}
365+
335366 /*
336367 * Set various file attributes. After this call fhp needs an fh_put.
337368 */
@@ -346,6 +377,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, · 8 unmodified lines
346377 __be32 err;
347378 int host_err;
348379 bool get_write_count;
380+ int size_change = 0;
349381
350382 if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE))
351383 accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE;
@@ -358,11 +390,11 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, · 6 unmodified lines
358390 /* Get inode */
359391 err = fh_verify(rqstp, fhp, ftype, accmode);
360392 if (err)
361− return err;
393+ goto out;
362394 if (get_write_count) {
363395 host_err = fh_want_write(fhp);
364396 if (host_err)
365− goto out_host_err;
397+ return nfserrno(host_err);
366398 }
367399
368400 dentry = fhp->fh_dentry;
@@ -373,59 +405,50 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, · 4 unmodified lines
373405 iap->ia_valid &= ~ATTR_MODE;
374406
375407 if (!iap->ia_valid)
376− return 0;
408+ goto out;
377409
378410 nfsd_sanitize_attrs(inode, iap);
379411
380− if (check_guard && guardtime != inode->i_ctime.tv_sec)
381− return nfserr_notsync;
382−
383412 /*
384413 * The size case is special, it changes the file in addition to the
385− * attributes, and file systems don't expect it to be mixed with
386− * "random" attribute changes. We thus split out the size change
387− * into a separate call for vfs_truncate, and do the rest as a
388− * a separate setattr call.
414+ * attributes.
389415 */
390416 if (iap->ia_valid & ATTR_SIZE) {
391− struct path path = {
392− .mnt = fhp->fh_export->ex_path.mnt,
393− .dentry = dentry,
394− };
395− bool implicit_mtime = false;
417+ err = nfsd_get_write_access(rqstp, fhp, iap);
418+ if (err)
419+ goto out;
420+ size_change = 1;
396421
397422 /*
398− * vfs_truncate implicity updates the mtime IFF the file size
399− * actually changes. Avoid the additional seattr call below if
400− * the only other attribute that the client sends is the mtime.
423+ * RFC5661, Section 18.30.4:
424+ * Changing the size of a file with SETATTR indirectly
425+ * changes the time_modify and change attributes.
426+ *
427+ * (and similar for the older RFCs)
401428 */
402− if (iap->ia_size != i_size_read(inode) &&
403− ((iap->ia_valid & ~(ATTR_SIZE | ATTR_MTIME)) == 0))
404− implicit_mtime = true;
405−
406− host_err = vfs_truncate(&path, iap->ia_size);
407− if (host_err)
408− goto out_host_err;
409−
410− iap->ia_valid &= ~ATTR_SIZE;
411− if (implicit_mtime)
412− iap->ia_valid &= ~ATTR_MTIME;
413− if (!iap->ia_valid)
414− goto done;
429+ if (iap->ia_size != i_size_read(inode))
430+ iap->ia_valid |= ATTR_MTIME;
415431 }
416432
417433 iap->ia_valid |= ATTR_CTIME;
418434
435+ if (check_guard && guardtime != inode->i_ctime.tv_sec) {
436+ err = nfserr_notsync;
437+ goto out_put_write_access;
438+ }
439+
419440 fh_lock(fhp);
420441 host_err = notify_change(dentry, iap, NULL);
421442 fh_unlock(fhp);
422− if (host_err)
423− goto out_host_err;
443+ err = nfserrno(host_err);
424444
425−done:
426− host_err = commit_metadata(fhp);
427−out_host_err:
428− return nfserrno(host_err);
445+out_put_write_access:
446+ if (size_change)
447+ put_write_access(inode);
448+ if (!err)
449+ err = nfserrno(commit_metadata(fhp));
450+out:
451+ return err;
429452 }
430453
431454 #if defined(CONFIG_NFSD_V4)
include/asm-generic/export.h+6−5
@@ -9,18 +9,15 @@ · 8 unmodified lines
99 #ifndef KSYM_ALIGN
1010 #define KSYM_ALIGN 8
1111 #endif
12−#ifndef KCRC_ALIGN
13−#define KCRC_ALIGN 8
14−#endif
1512 #else
1613 #define __put .long
1714 #ifndef KSYM_ALIGN
1815 #define KSYM_ALIGN 4
1916 #endif
17+#endif
2018 #ifndef KCRC_ALIGN
2119 #define KCRC_ALIGN 4
2220 #endif
23−#endif
2421
2522 #ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX
2623 #define KSYM(name) _##name
@@ -52,7 +49,11 @@ KSYM(__kstrtab_\name): · 25 unmodified lines
5249 .section ___kcrctab\sec+\name,"a"
5350 .balign KCRC_ALIGN
5451 KSYM(__kcrctab_\name):
55− __put KSYM(__crc_\name)
52+#if defined(CONFIG_MODULE_REL_CRCS)
53+ .long KSYM(__crc_\name) - .
54+#else
55+ .long KSYM(__crc_\name)
56+#endif
5657 .weak KSYM(__crc_\name)
5758 .previous
5859 #endif
include/drm/drmP.h+1−0
@@ -517,6 +517,7 @@ struct drm_device { · 516 unmodified lines
517517 struct drm_minor *control; /**< Control node */
518518 struct drm_minor *primary; /**< Primary node */
519519 struct drm_minor *render; /**< Render node */
520+ bool registered;
520521
521522 /* currently active master for this device. Protected by master_mutex */
522523 struct drm_master *master;
include/drm/drm_connector.h+15−1
@@ -381,6 +381,8 @@ struct drm_connector_funcs { · 380 unmodified lines
381381 * core drm connector interfaces. Everything added from this callback
382382 * should be unregistered in the early_unregister callback.
383383 *
384+ * This is called while holding drm_connector->mutex.
385+ *
384386 * Returns:
385387 *
386388 * 0 on success, or a negative error code on failure.
@@ -395,6 +397,8 @@ struct drm_connector_funcs { · 8 unmodified lines
395397 * late_register(). It is called from drm_connector_unregister(),
396398 * early in the driver unload sequence to disable userspace access
397399 * before data structures are torndown.
400+ *
401+ * This is called while holding drm_connector->mutex.
398402 */
399403 void (*early_unregister)(struct drm_connector *connector);
400404
@@ -559,7 +563,6 @@ struct drm_cmdline_mode { · 158 unmodified lines
559563 * @interlace_allowed: can this connector handle interlaced modes?
560564 * @doublescan_allowed: can this connector handle doublescan?
561565 * @stereo_allowed: can this connector handle stereo modes?
562− * @registered: is this connector exposed (registered) with userspace?
563566 * @modes: modes available on this connector (from fill_modes() + user)
564567 * @status: one of the drm_connector_status enums (connected, not, or unknown)
565568 * @probed_modes: list of modes derived directly from the display
@@ -607,6 +610,13 @@ struct drm_connector { · 41 unmodified lines
607610
608611 char *name;
609612
613+ /**
614+ * @mutex: Lock for general connector state, but currently only protects
615+ * @registered. Most of the connector state is still protected by the
616+ * mutex in &drm_mode_config.
617+ */
618+ struct mutex mutex;
619+
610620 /**
611621 * @index: Compacted connector index, which matches the position inside
612622 * the mode_config.list for drivers not supporting hot-add/removing. Can
@@ -620,6 +630,10 @@ struct drm_connector { · 7 unmodified lines
620630 bool interlace_allowed;
621631 bool doublescan_allowed;
622632 bool stereo_allowed;
633+ /**
634+ * @registered: Is this connector exposed (registered) with userspace?
635+ * Protected by @mutex.
636+ */
623637 bool registered;
624638 struct list_head modes; /* list of modes on this connector */
625639
include/linux/can/core.h+3−4
@@ -45,10 +45,9 @@ struct can_proto { · 44 unmodified lines
4545 extern int can_proto_register(const struct can_proto *cp);
4646 extern void can_proto_unregister(const struct can_proto *cp);
4747
48−extern int can_rx_register(struct net_device *dev, canid_t can_id,
49− canid_t mask,
50− void (*func)(struct sk_buff *, void *),
51− void *data, char *ident);
48+int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask,
49+ void (*func)(struct sk_buff *, void *),
50+ void *data, char *ident, struct sock *sk);
5251
5352 extern void can_rx_unregister(struct net_device *dev, canid_t can_id,
5453 canid_t mask,
include/linux/cpuhotplug.h+0−3
@@ -8,9 +8,7 @@ enum cpuhp_state { · 7 unmodified lines
88 CPUHP_CREATE_THREADS,
99 CPUHP_PERF_PREPARE,
1010 CPUHP_PERF_X86_PREPARE,
11− CPUHP_PERF_X86_UNCORE_PREP,
1211 CPUHP_PERF_X86_AMD_UNCORE_PREP,
13− CPUHP_PERF_X86_RAPL_PREP,
1412 CPUHP_PERF_BFIN,
1513 CPUHP_PERF_POWER,
1614 CPUHP_PERF_SUPERH,
@@ -86,7 +84,6 @@ enum cpuhp_state { · 69 unmodified lines
8684 CPUHP_AP_IRQ_ARMADA_XP_STARTING,
8785 CPUHP_AP_IRQ_BCM2836_STARTING,
8886 CPUHP_AP_ARM_MVEBU_COHERENCY,
89− CPUHP_AP_PERF_X86_UNCORE_STARTING,
9087 CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,
9188 CPUHP_AP_PERF_X86_STARTING,
9289 CPUHP_AP_PERF_X86_AMD_IBS_STARTING,
include/linux/export.h+12−5
@@ -43,12 +43,19 @@ extern struct module __this_module; · 42 unmodified lines
4343 #ifdef CONFIG_MODVERSIONS
4444 /* Mark the CRC weak since genksyms apparently decides not to
4545 * generate a checksums for some symbols */
46+#if defined(CONFIG_MODULE_REL_CRCS)
4647 #define __CRC_SYMBOL(sym, sec) \
47− extern __visible void *__crc_##sym __attribute__((weak)); \
48− static const unsigned long __kcrctab_##sym \
49− __used \
50− __attribute__((section("___kcrctab" sec "+" #sym), used)) \
51− = (unsigned long) &__crc_##sym;
48+ asm(" .section \"___kcrctab" sec "+" #sym "\", \"a\" \n" \
49+ " .weak " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \
50+ " .long " VMLINUX_SYMBOL_STR(__crc_##sym) " - . \n" \
51+ " .previous \n");
52+#else
53+#define __CRC_SYMBOL(sym, sec) \
54+ asm(" .section \"___kcrctab" sec "+" #sym "\", \"a\" \n" \
55+ " .weak " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \
56+ " .long " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \
57+ " .previous \n");
58+#endif
5259 #else
5360 #define __CRC_SYMBOL(sym, sec)
5461 #endif
include/linux/fscache-cache.h+1−0
@@ -360,6 +360,7 @@ struct fscache_object { · 359 unmodified lines
360360 #define FSCACHE_OBJECT_IS_AVAILABLE 5 /* T if object has become active */
361361 #define FSCACHE_OBJECT_RETIRED 6 /* T if object was retired on relinquishment */
362362 #define FSCACHE_OBJECT_KILLED_BY_CACHE 7 /* T if object was killed by the cache */
363+#define FSCACHE_OBJECT_RUN_AFTER_DEAD 8 /* T if object has been dispatched after death */
363364
364365 struct list_head cache_link; /* link in cache->object_list */
365366 struct hlist_node cookie_link; /* link in cookie->backing_objects */
include/linux/hyperv.h+30−2
@@ -128,6 +128,7 @@ struct hv_ring_buffer_info { · 127 unmodified lines
128128 u32 ring_data_startoffset;
129129 u32 priv_write_index;
130130 u32 priv_read_index;
131+ u32 cached_read_index;
131132 };
132133
133134 /*
@@ -180,6 +181,19 @@ static inline u32 hv_get_bytes_to_write(struct hv_ring_buffer_info *rbi) · 46 unmodified lines
180181 return write;
181182 }
182183
184+static inline u32 hv_get_cached_bytes_to_write(
185+ const struct hv_ring_buffer_info *rbi)
186+{
187+ u32 read_loc, write_loc, dsize, write;
188+
189+ dsize = rbi->ring_datasize;
190+ read_loc = rbi->cached_read_index;
191+ write_loc = rbi->ring_buffer->write_index;
192+
193+ write = write_loc >= read_loc ? dsize - (write_loc - read_loc) :
194+ read_loc - write_loc;
195+ return write;
196+}
183197 /*
184198 * VMBUS version is 32 bit entity broken up into
185199 * two 16 bit quantities: major_number. minor_number.
@@ -1488,7 +1502,7 @@ hv_get_ring_buffer(struct hv_ring_buffer_info *ring_info) · 1302 unmodified lines
14881502
14891503 static inline void hv_signal_on_read(struct vmbus_channel *channel)
14901504 {
1491− u32 cur_write_sz;
1505+ u32 cur_write_sz, cached_write_sz;
14921506 u32 pending_sz;
14931507 struct hv_ring_buffer_info *rbi = &channel->inbound;
14941508
@@ -1512,12 +1526,24 @@ static inline void hv_signal_on_read(struct vmbus_channel *channel) · 17 unmodified lines
15121526
15131527 cur_write_sz = hv_get_bytes_to_write(rbi);
15141528
1515− if (cur_write_sz >= pending_sz)
1529+ if (cur_write_sz < pending_sz)
1530+ return;
1531+
1532+ cached_write_sz = hv_get_cached_bytes_to_write(rbi);
1533+ if (cached_write_sz < pending_sz)
15161534 vmbus_setevent(channel);
15171535
15181536 return;
15191537 }
15201538
1539+static inline void
1540+init_cached_read_index(struct vmbus_channel *channel)
1541+{
1542+ struct hv_ring_buffer_info *rbi = &channel->inbound;
1543+
1544+ rbi->cached_read_index = rbi->ring_buffer->read_index;
1545+}
1546+
15211547 /*
15221548 * An API to support in-place processing of incoming VMBUS packets.
15231549 */
@@ -1569,6 +1595,8 @@ static inline void put_pkt_raw(struct vmbus_channel *channel, · 45 unmodified lines
15691595 * This call commits the read index and potentially signals the host.
15701596 * Here is the pattern for using the "in-place" consumption APIs:
15711597 *
1598+ * init_cached_read_index();
1599+ *
15721600 * while (get_next_pkt_raw() {
15731601 * process the packet "in-place";
15741602 * put_pkt_raw();
include/linux/irq.h+17−0
@@ -184,6 +184,7 @@ struct irq_data { · 183 unmodified lines
184184 *
185185 * IRQD_TRIGGER_MASK - Mask for the trigger type bits
186186 * IRQD_SETAFFINITY_PENDING - Affinity setting is pending
187+ * IRQD_ACTIVATED - Interrupt has already been activated
187188 * IRQD_NO_BALANCING - Balancing disabled for this IRQ
188189 * IRQD_PER_CPU - Interrupt is per cpu
189190 * IRQD_AFFINITY_SET - Interrupt affinity was set
@@ -202,6 +203,7 @@ struct irq_data { · 12 unmodified lines
202203 enum {
203204 IRQD_TRIGGER_MASK = 0xf,
204205 IRQD_SETAFFINITY_PENDING = (1 << 8),
206+ IRQD_ACTIVATED = (1 << 9),
205207 IRQD_NO_BALANCING = (1 << 10),
206208 IRQD_PER_CPU = (1 << 11),
207209 IRQD_AFFINITY_SET = (1 << 12),
@@ -312,6 +314,21 @@ static inline bool irqd_affinity_is_managed(struct irq_data *d) · 104 unmodified lines
312314 return __irqd_to_state(d) & IRQD_AFFINITY_MANAGED;
313315 }
314316
317+static inline bool irqd_is_activated(struct irq_data *d)
318+{
319+ return __irqd_to_state(d) & IRQD_ACTIVATED;
320+}
321+
322+static inline void irqd_set_activated(struct irq_data *d)
323+{
324+ __irqd_to_state(d) |= IRQD_ACTIVATED;
325+}
326+
327+static inline void irqd_clr_activated(struct irq_data *d)
328+{
329+ __irqd_to_state(d) &= ~IRQD_ACTIVATED;
330+}
331+
315332 #undef __irqd_to_state
316333
317334 static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
include/linux/log2.h+12−1
@@ -203,6 +203,17 @@ unsigned long __rounddown_pow_of_two(unsigned long n) · 202 unmodified lines
203203 * ... and so on.
204204 */
205205
206−#define order_base_2(n) ilog2(roundup_pow_of_two(n))
206+static inline __attribute_const__
207+int __order_base_2(unsigned long n)
208+{
209+ return n > 1 ? ilog2(n - 1) + 1 : 0;
210+}
207211
212+#define order_base_2(n) \
213+( \
214+ __builtin_constant_p(n) ? ( \
215+ ((n) == 0 || (n) == 1) ? 0 : \
216+ ilog2((n) - 1) + 1) : \
217+ __order_base_2(n) \
218+)
208219 #endif /* _LINUX_LOG2_H */
include/linux/memory_hotplug.h+2−1
@@ -85,7 +85,8 @@ extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages); · 84 unmodified lines
8585 extern int add_one_highpage(struct page *page, int pfn, int bad_ppro);
8686 /* VM interface that may be used by firmware interface */
8787 extern int online_pages(unsigned long, unsigned long, int);
88−extern int test_pages_in_a_zone(unsigned long, unsigned long);
88+extern int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn,
89+ unsigned long *valid_start, unsigned long *valid_end);
8990 extern void __offline_isolated_pages(unsigned long, unsigned long);
9091
9192 typedef void (*online_page_callback_t)(struct page *page);
include/linux/module.h+7−7
@@ -346,7 +346,7 @@ struct module { · 345 unmodified lines
346346
347347 /* Exported symbols */
348348 const struct kernel_symbol *syms;
349− const unsigned long *crcs;
349+ const s32 *crcs;
350350 unsigned int num_syms;
351351
352352 /* Kernel parameters. */
@@ -359,18 +359,18 @@ struct module { · 6 unmodified lines
359359 /* GPL-only exported symbols. */
360360 unsigned int num_gpl_syms;
361361 const struct kernel_symbol *gpl_syms;
362− const unsigned long *gpl_crcs;
362+ const s32 *gpl_crcs;
363363
364364 #ifdef CONFIG_UNUSED_SYMBOLS
365365 /* unused exported symbols. */
366366 const struct kernel_symbol *unused_syms;
367− const unsigned long *unused_crcs;
367+ const s32 *unused_crcs;
368368 unsigned int num_unused_syms;
369369
370370 /* GPL-only, unused exported symbols. */
371371 unsigned int num_unused_gpl_syms;
372372 const struct kernel_symbol *unused_gpl_syms;
373− const unsigned long *unused_gpl_crcs;
373+ const s32 *unused_gpl_crcs;
374374 #endif
375375
376376 #ifdef CONFIG_MODULE_SIG
@@ -382,7 +382,7 @@ struct module { · 5 unmodified lines
382382
383383 /* symbols that will be GPL-only in the near future. */
384384 const struct kernel_symbol *gpl_future_syms;
385− const unsigned long *gpl_future_crcs;
385+ const s32 *gpl_future_crcs;
386386 unsigned int num_gpl_future_syms;
387387
388388 /* Exception table */
@@ -523,7 +523,7 @@ struct module *find_module(const char *name); · 134 unmodified lines
523523
524524 struct symsearch {
525525 const struct kernel_symbol *start, *stop;
526− const unsigned long *crcs;
526+ const s32 *crcs;
527527 enum {
528528 NOT_GPL_ONLY,
529529 GPL_ONLY,
@@ -539,7 +539,7 @@ struct symsearch { · 9 unmodified lines
539539 */
540540 const struct kernel_symbol *find_symbol(const char *name,
541541 struct module **owner,
542− const unsigned long **crc,
542+ const s32 **crc,
543543 bool gplok,
544544 bool warn);
545545
include/linux/netdevice.h+15−14
@@ -866,11 +866,15 @@ struct netdev_xdp { · 865 unmodified lines
866866 * of useless work if you return NETDEV_TX_BUSY.
867867 * Required; cannot be NULL.
868868 *
869− * netdev_features_t (*ndo_fix_features)(struct net_device *dev,
870− * netdev_features_t features);
871− * Adjusts the requested feature flags according to device-specific
872− * constraints, and returns the resulting flags. Must not modify
873− * the device state.
869+ * netdev_features_t (*ndo_features_check)(struct sk_buff *skb,
870+ * struct net_device *dev
871+ * netdev_features_t features);
872+ * Called by core transmit path to determine if device is capable of
873+ * performing offload operations on a given packet. This is to give
874+ * the device an opportunity to implement any restrictions that cannot
875+ * be otherwise expressed by feature flags. The check is called with
876+ * the set of features that the stack has calculated and it returns
877+ * those the driver believes to be appropriate.
874878 *
875879 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb,
876880 * void *accel_priv, select_queue_fallback_t fallback);
@@ -1028,6 +1032,12 @@ struct netdev_xdp { · 151 unmodified lines
10281032 * Called to release previously enslaved netdev.
10291033 *
10301034 * Feature/offload setting functions.
1035+ * netdev_features_t (*ndo_fix_features)(struct net_device *dev,
1036+ * netdev_features_t features);
1037+ * Adjusts the requested feature flags according to device-specific
1038+ * constraints, and returns the resulting flags. Must not modify
1039+ * the device state.
1040+ *
10311041 * int (*ndo_set_features)(struct net_device *dev, netdev_features_t features);
10321042 * Called to update device configuration to new features. Passed
10331043 * feature set might be less than what was returned by ndo_fix_features()).
@@ -1100,15 +1110,6 @@ struct netdev_xdp { · 66 unmodified lines
11001110 * Callback to use for xmit over the accelerated station. This
11011111 * is used in place of ndo_start_xmit on accelerated net
11021112 * devices.
1103− * netdev_features_t (*ndo_features_check)(struct sk_buff *skb,
1104− * struct net_device *dev
1105− * netdev_features_t features);
1106− * Called by core transmit path to determine if device is capable of
1107− * performing offload operations on a given packet. This is to give
1108− * the device an opportunity to implement any restrictions that cannot
1109− * be otherwise expressed by feature flags. The check is called with
1110− * the set of features that the stack has calculated and it returns
1111− * those the driver believes to be appropriate.
11121113 * int (*ndo_set_tx_maxrate)(struct net_device *dev,
11131114 * int queue_index, u32 maxrate);
11141115 * Called when a user wants to set a max-rate limitation of specific
include/linux/percpu-refcount.h+2−2
@@ -204,7 +204,7 @@ static inline void percpu_ref_get(struct percpu_ref *ref) · 203 unmodified lines
204204 static inline bool percpu_ref_tryget(struct percpu_ref *ref)
205205 {
206206 unsigned long __percpu *percpu_count;
207− int ret;
207+ bool ret;
208208
209209 rcu_read_lock_sched();
210210
@@ -238,7 +238,7 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref) · 27 unmodified lines
238238 static inline bool percpu_ref_tryget_live(struct percpu_ref *ref)
239239 {
240240 unsigned long __percpu *percpu_count;
241− int ret = false;
241+ bool ret = false;
242242
243243 rcu_read_lock_sched();
244244
include/net/ipv6.h+5−0
@@ -776,6 +776,11 @@ static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb, · 775 unmodified lines
776776 {
777777 u32 hash;
778778
779+ /* @flowlabel may include more than a flow label, eg, the traffic class.
780+ * Here we want only the flow label value.
781+ */
782+ flowlabel &= IPV6_FLOWLABEL_MASK;
783+
779784 if (flowlabel ||
780785 net->ipv6.sysctl.auto_flowlabels == IP6_AUTO_FLOW_LABEL_OFF ||
781786 (!autolabel &&
include/uapi/linux/ethtool.h+3−1
@@ -1384,6 +1384,8 @@ enum ethtool_link_mode_bit_indices { · 1383 unmodified lines
13841384 ETHTOOL_LINK_MODE_10000baseLR_Full_BIT = 44,
13851385 ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT = 45,
13861386 ETHTOOL_LINK_MODE_10000baseER_Full_BIT = 46,
1387+ ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 47,
1388+ ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 48,
13871389
13881390
13891391 /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit
@@ -1393,7 +1395,7 @@ enum ethtool_link_mode_bit_indices { · 3 unmodified lines
13931395 */
13941396
13951397 __ETHTOOL_LINK_MODE_LAST
1396− = ETHTOOL_LINK_MODE_10000baseER_Full_BIT,
1398+ = ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
13971399 };
13981400
13991401 #define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \
init/Kconfig+4−0
@@ -1987,6 +1987,10 @@ config MODVERSIONS · 1986 unmodified lines
19871987 make them incompatible with the kernel you are running. If
19881988 unsure, say N.
19891989
1990+config MODULE_REL_CRCS
1991+ bool
1992+ depends on MODVERSIONS
1993+
19901994 config MODULE_SRCVERSION_ALL
19911995 bool "Source checksum for all modules"
19921996 help
kernel/cgroup.c+5−8
@@ -5221,6 +5221,11 @@ err_free_css: · 5220 unmodified lines
52215221 return ERR_PTR(err);
52225222 }
52235223
5224+/*
5225+ * The returned cgroup is fully initialized including its control mask, but
5226+ * it isn't associated with its kernfs_node and doesn't have the control
5227+ * mask applied.
5228+ */
52245229 static struct cgroup *cgroup_create(struct cgroup *parent)
52255230 {
52265231 struct cgroup_root *root = parent->root;
@@ -5288,11 +5293,6 @@ static struct cgroup *cgroup_create(struct cgroup *parent) · 61 unmodified lines
52885293
52895294 cgroup_propagate_control(cgrp);
52905295
5291− /* @cgrp doesn't have dir yet so the following will only create csses */
5292− ret = cgroup_apply_control_enable(cgrp);
5293− if (ret)
5294− goto out_destroy;
5295−
52965296 return cgrp;
52975297
52985298 out_cancel_ref:
@@ -5300,9 +5300,6 @@ out_cancel_ref: · 1 unmodified line
53005300 out_free_cgrp:
53015301 kfree(cgrp);
53025302 return ERR_PTR(ret);
5303−out_destroy:
5304− cgroup_destroy_locked(cgrp);
5305− return ERR_PTR(ret);
53065303 }
53075304
53085305 static int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name,
kernel/events/core.c+46−23
@@ -1469,7 +1469,6 @@ ctx_group_list(struct perf_event *event, struct perf_event_context *ctx) · 1468 unmodified lines
14691469 static void
14701470 list_add_event(struct perf_event *event, struct perf_event_context *ctx)
14711471 {
1472−
14731472 lockdep_assert_held(&ctx->lock);
14741473
14751474 WARN_ON_ONCE(event->attach_state & PERF_ATTACH_CONTEXT);
@@ -1624,6 +1623,8 @@ static void perf_group_attach(struct perf_event *event) · 148 unmodified lines
16241623 {
16251624 struct perf_event *group_leader = event->group_leader, *pos;
16261625
1626+ lockdep_assert_held(&event->ctx->lock);
1627+
16271628 /*
16281629 * We can have double attach due to group movement in perf_event_open.
16291630 */
@@ -1697,6 +1698,8 @@ static void perf_group_detach(struct perf_event *event) · 67 unmodified lines
16971698 struct perf_event *sibling, *tmp;
16981699 struct list_head *list = NULL;
16991700
1701+ lockdep_assert_held(&event->ctx->lock);
1702+
17001703 /*
17011704 * We can have double detach due to exit/hot-unplug + close.
17021705 */
@@ -1895,9 +1898,29 @@ __perf_remove_from_context(struct perf_event *event, · 192 unmodified lines
18951898 */
18961899 static void perf_remove_from_context(struct perf_event *event, unsigned long flags)
18971900 {
1898− lockdep_assert_held(&event->ctx->mutex);
1901+ struct perf_event_context *ctx = event->ctx;
1902+
1903+ lockdep_assert_held(&ctx->mutex);
18991904
19001905 event_function_call(event, __perf_remove_from_context, (void *)flags);
1906+
1907+ /*
1908+ * The above event_function_call() can NO-OP when it hits
1909+ * TASK_TOMBSTONE. In that case we must already have been detached
1910+ * from the context (by perf_event_exit_event()) but the grouping
1911+ * might still be in-tact.
1912+ */
1913+ WARN_ON_ONCE(event->attach_state & PERF_ATTACH_CONTEXT);
1914+ if ((flags & DETACH_GROUP) &&
1915+ (event->attach_state & PERF_ATTACH_GROUP)) {
1916+ /*
1917+ * Since in that case we cannot possibly be scheduled, simply
1918+ * detach now.
1919+ */
1920+ raw_spin_lock_irq(&ctx->lock);
1921+ perf_group_detach(event);
1922+ raw_spin_unlock_irq(&ctx->lock);
1923+ }
19011924 }
19021925
19031926 /*
@@ -6609,6 +6632,27 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) · 4705 unmodified lines
66096632 char *buf = NULL;
66106633 char *name;
66116634
6635+ if (vma->vm_flags & VM_READ)
6636+ prot |= PROT_READ;
6637+ if (vma->vm_flags & VM_WRITE)
6638+ prot |= PROT_WRITE;
6639+ if (vma->vm_flags & VM_EXEC)
6640+ prot |= PROT_EXEC;
6641+
6642+ if (vma->vm_flags & VM_MAYSHARE)
6643+ flags = MAP_SHARED;
6644+ else
6645+ flags = MAP_PRIVATE;
6646+
6647+ if (vma->vm_flags & VM_DENYWRITE)
6648+ flags |= MAP_DENYWRITE;
6649+ if (vma->vm_flags & VM_MAYEXEC)
6650+ flags |= MAP_EXECUTABLE;
6651+ if (vma->vm_flags & VM_LOCKED)
6652+ flags |= MAP_LOCKED;
6653+ if (vma->vm_flags & VM_HUGETLB)
6654+ flags |= MAP_HUGETLB;
6655+
66126656 if (file) {
66136657 struct inode *inode;
66146658 dev_t dev;
@@ -6635,27 +6679,6 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) · 20 unmodified lines
66356679 maj = MAJOR(dev);
66366680 min = MINOR(dev);
66376681
6638− if (vma->vm_flags & VM_READ)
6639− prot |= PROT_READ;
6640− if (vma->vm_flags & VM_WRITE)
6641− prot |= PROT_WRITE;
6642− if (vma->vm_flags & VM_EXEC)
6643− prot |= PROT_EXEC;
6644−
6645− if (vma->vm_flags & VM_MAYSHARE)
6646− flags = MAP_SHARED;
6647− else
6648− flags = MAP_PRIVATE;
6649−
6650− if (vma->vm_flags & VM_DENYWRITE)
6651− flags |= MAP_DENYWRITE;
6652− if (vma->vm_flags & VM_MAYEXEC)
6653− flags |= MAP_EXECUTABLE;
6654− if (vma->vm_flags & VM_LOCKED)
6655− flags |= MAP_LOCKED;
6656− if (vma->vm_flags & VM_HUGETLB)
6657− flags |= MAP_HUGETLB;
6658−
66596682 goto got_name;
66606683 } else {
66616684 if (vma->vm_ops && vma->vm_ops->name) {
kernel/irq/irqdomain.c+30−14
@@ -1346,6 +1346,30 @@ void irq_domain_free_irqs_parent(struct irq_domain *domain, · 1345 unmodified lines
13461346 }
13471347 EXPORT_SYMBOL_GPL(irq_domain_free_irqs_parent);
13481348
1349+static void __irq_domain_activate_irq(struct irq_data *irq_data)
1350+{
1351+ if (irq_data && irq_data->domain) {
1352+ struct irq_domain *domain = irq_data->domain;
1353+
1354+ if (irq_data->parent_data)
1355+ __irq_domain_activate_irq(irq_data->parent_data);
1356+ if (domain->ops->activate)
1357+ domain->ops->activate(domain, irq_data);
1358+ }
1359+}
1360+
1361+static void __irq_domain_deactivate_irq(struct irq_data *irq_data)
1362+{
1363+ if (irq_data && irq_data->domain) {
1364+ struct irq_domain *domain = irq_data->domain;
1365+
1366+ if (domain->ops->deactivate)
1367+ domain->ops->deactivate(domain, irq_data);
1368+ if (irq_data->parent_data)
1369+ __irq_domain_deactivate_irq(irq_data->parent_data);
1370+ }
1371+}
1372+
13491373 /**
13501374 * irq_domain_activate_irq - Call domain_ops->activate recursively to activate
13511375 * interrupt
@@ -1356,13 +1380,9 @@ EXPORT_SYMBOL_GPL(irq_domain_free_irqs_parent); · 4 unmodified lines
13561380 */
13571381 void irq_domain_activate_irq(struct irq_data *irq_data)
13581382 {
1359− if (irq_data && irq_data->domain) {
1360− struct irq_domain *domain = irq_data->domain;
1361−
1362− if (irq_data->parent_data)
1363− irq_domain_activate_irq(irq_data->parent_data);
1364− if (domain->ops->activate)
1365− domain->ops->activate(domain, irq_data);
1383+ if (!irqd_is_activated(irq_data)) {
1384+ __irq_domain_activate_irq(irq_data);
1385+ irqd_set_activated(irq_data);
13661386 }
13671387 }
13681388
@@ -1376,13 +1396,9 @@ void irq_domain_activate_irq(struct irq_data *irq_data) · 7 unmodified lines
13761396 */
13771397 void irq_domain_deactivate_irq(struct irq_data *irq_data)
13781398 {
1379− if (irq_data && irq_data->domain) {
1380− struct irq_domain *domain = irq_data->domain;
1381−
1382− if (domain->ops->deactivate)
1383− domain->ops->deactivate(domain, irq_data);
1384− if (irq_data->parent_data)
1385− irq_domain_deactivate_irq(irq_data->parent_data);
1399+ if (irqd_is_activated(irq_data)) {
1400+ __irq_domain_deactivate_irq(irq_data);
1401+ irqd_clr_activated(irq_data);
13861402 }
13871403 }
13881404
kernel/module.c+25−28
@@ -389,16 +389,16 @@ extern const struct kernel_symbol __start___ksymtab_gpl[]; · 388 unmodified lines
389389 extern const struct kernel_symbol __stop___ksymtab_gpl[];
390390 extern const struct kernel_symbol __start___ksymtab_gpl_future[];
391391 extern const struct kernel_symbol __stop___ksymtab_gpl_future[];
392−extern const unsigned long __start___kcrctab[];
393−extern const unsigned long __start___kcrctab_gpl[];
394−extern const unsigned long __start___kcrctab_gpl_future[];
392+extern const s32 __start___kcrctab[];
393+extern const s32 __start___kcrctab_gpl[];
394+extern const s32 __start___kcrctab_gpl_future[];
395395 #ifdef CONFIG_UNUSED_SYMBOLS
396396 extern const struct kernel_symbol __start___ksymtab_unused[];
397397 extern const struct kernel_symbol __stop___ksymtab_unused[];
398398 extern const struct kernel_symbol __start___ksymtab_unused_gpl[];
399399 extern const struct kernel_symbol __stop___ksymtab_unused_gpl[];
400−extern const unsigned long __start___kcrctab_unused[];
401−extern const unsigned long __start___kcrctab_unused_gpl[];
400+extern const s32 __start___kcrctab_unused[];
401+extern const s32 __start___kcrctab_unused_gpl[];
402402 #endif
403403
404404 #ifndef CONFIG_MODVERSIONS
@@ -497,7 +497,7 @@ struct find_symbol_arg { · 92 unmodified lines
497497
498498 /* Output */
499499 struct module *owner;
500− const unsigned long *crc;
500+ const s32 *crc;
501501 const struct kernel_symbol *sym;
502502 };
503503
@@ -563,7 +563,7 @@ static bool find_symbol_in_section(const struct symsearch *syms, · 59 unmodified lines
563563 * (optional) module which owns it. Needs preempt disabled or module_mutex. */
564564 const struct kernel_symbol *find_symbol(const char *name,
565565 struct module **owner,
566− const unsigned long **crc,
566+ const s32 **crc,
567567 bool gplok,
568568 bool warn)
569569 {
@@ -1249,23 +1249,17 @@ static int try_to_force_load(struct module *mod, const char *reason) · 679 unmodified lines
12491249 }
12501250
12511251 #ifdef CONFIG_MODVERSIONS
1252−/* If the arch applies (non-zero) relocations to kernel kcrctab, unapply it. */
1253−static unsigned long maybe_relocated(unsigned long crc,
1254− const struct module *crc_owner)
1252+
1253+static u32 resolve_rel_crc(const s32 *crc)
12551254 {
1256−#ifdef ARCH_RELOCATES_KCRCTAB
1257− if (crc_owner == NULL)
1258− return crc - (unsigned long)reloc_start;
1259−#endif
1260− return crc;
1255+ return *(u32 *)((void *)crc + *crc);
12611256 }
12621257
12631258 static int check_version(Elf_Shdr *sechdrs,
12641259 unsigned int versindex,
12651260 const char *symname,
12661261 struct module *mod,
1267− const unsigned long *crc,
1268− const struct module *crc_owner)
1262+ const s32 *crc)
12691263 {
12701264 unsigned int i, num_versions;
12711265 struct modversion_info *versions;
@@ -1283,13 +1277,19 @@ static int check_version(Elf_Shdr *sechdrs, · 11 unmodified lines
12831277 / sizeof(struct modversion_info);
12841278
12851279 for (i = 0; i < num_versions; i++) {
1280+ u32 crcval;
1281+
12861282 if (strcmp(versions[i].name, symname) != 0)
12871283 continue;
12881284
1289− if (versions[i].crc == maybe_relocated(*crc, crc_owner))
1285+ if (IS_ENABLED(CONFIG_MODULE_REL_CRCS))
1286+ crcval = resolve_rel_crc(crc);
1287+ else
1288+ crcval = *crc;
1289+ if (versions[i].crc == crcval)
12901290 return 1;
1291− pr_debug("Found checksum %lX vs module %lX\n",
1292− maybe_relocated(*crc, crc_owner), versions[i].crc);
1291+ pr_debug("Found checksum %X vs module %lX\n",
1292+ crcval, versions[i].crc);
12931293 goto bad_version;
12941294 }
12951295
@@ -1307,7 +1307,7 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs, · 11 unmodified lines
13071307 unsigned int versindex,
13081308 struct module *mod)
13091309 {
1310− const unsigned long *crc;
1310+ const s32 *crc;
13111311
13121312 /*
13131313 * Since this should be found in kernel (which can't be removed), no
@@ -1321,8 +1321,7 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs, · 7 unmodified lines
13211321 }
13221322 preempt_enable();
13231323 return check_version(sechdrs, versindex,
1324− VMLINUX_SYMBOL_STR(module_layout), mod, crc,
1325− NULL);
1324+ VMLINUX_SYMBOL_STR(module_layout), mod, crc);
13261325 }
13271326
13281327 /* First part is kernel version, which we ignore if module has crcs. */
@@ -1340,8 +1339,7 @@ static inline int check_version(Elf_Shdr *sechdrs, · 11 unmodified lines
13401339 unsigned int versindex,
13411340 const char *symname,
13421341 struct module *mod,
1343− const unsigned long *crc,
1344− const struct module *crc_owner)
1342+ const s32 *crc)
13451343 {
13461344 return 1;
13471345 }
@@ -1368,7 +1366,7 @@ static const struct kernel_symbol *resolve_symbol(struct module *mod, · 20 unmodified lines
13681366 {
13691367 struct module *owner;
13701368 const struct kernel_symbol *sym;
1371− const unsigned long *crc;
1369+ const s32 *crc;
13721370 int err;
13731371
13741372 /*
@@ -1383,8 +1381,7 @@ static const struct kernel_symbol *resolve_symbol(struct module *mod, · 8 unmodified lines
13831381 if (!sym)
13841382 goto unlock;
13851383
1386− if (!check_version(info->sechdrs, info->index.vers, name, mod, crc,
1387− owner)) {
1384+ if (!check_version(info->sechdrs, info->index.vers, name, mod, crc)) {
13881385 sym = ERR_PTR(-EINVAL);
13891386 goto getname;
13901387 }
kernel/trace/trace_hwlat.c+5−3
@@ -266,7 +266,7 @@ out: · 265 unmodified lines
266266 static struct cpumask save_cpumask;
267267 static bool disable_migrate;
268268
269−static void move_to_next_cpu(void)
269+static void move_to_next_cpu(bool initmask)
270270 {
271271 static struct cpumask *current_mask;
272272 int next_cpu;
@@ -275,7 +275,7 @@ static void move_to_next_cpu(void) · 2 unmodified lines
275275 return;
276276
277277 /* Just pick the first CPU on first iteration */
278− if (!current_mask) {
278+ if (initmask) {
279279 current_mask = &save_cpumask;
280280 get_online_cpus();
281281 cpumask_and(current_mask, cpu_online_mask, tracing_buffer_mask);
@@ -330,10 +330,12 @@ static void move_to_next_cpu(void) · 48 unmodified lines
330330 static int kthread_fn(void *data)
331331 {
332332 u64 interval;
333+ bool initmask = true;
333334
334335 while (!kthread_should_stop()) {
335336
336− move_to_next_cpu();
337+ move_to_next_cpu(initmask);
338+ initmask = false;
337339
338340 local_irq_disable();
339341 get_sample();
kernel/trace/trace_kprobe.c+1−1
@@ -1372,7 +1372,7 @@ kprobe_trace_selftest_target(int a1, int a2, int a3, int a4, int a5, int a6) · 1371 unmodified lines
13721372 return a1 + a2 + a3 + a4 + a5 + a6;
13731373 }
13741374
1375−static struct __init trace_event_file *
1375+static __init struct trace_event_file *
13761376 find_trace_probe_file(struct trace_kprobe *tk, struct trace_array *tr)
13771377 {
13781378 struct trace_event_file *file;
mm/filemap.c+5−0
@@ -1791,6 +1791,11 @@ static ssize_t do_generic_file_read(struct file *filp, loff_t *ppos, · 1790 unmodified lines
17911791
17921792 cond_resched();
17931793 find_page:
1794+ if (fatal_signal_pending(current)) {
1795+ error = -EINTR;
1796+ goto out;
1797+ }
1798+
17941799 page = find_get_page(mapping, index);
17951800 if (!page) {
17961801 page_cache_sync_readahead(mapping,
mm/kasan/report.c+3−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 *
1414 */
1515
16+#include <linux/ftrace.h>
1617 #include <linux/kernel.h>
1718 #include <linux/mm.h>
1819 #include <linux/printk.h>
@@ -300,6 +301,8 @@ void kasan_report(unsigned long addr, size_t size, · 281 unmodified lines
300301 if (likely(!kasan_report_enabled()))
301302 return;
302303
304+ disable_trace_on_warning();
305+
303306 info.access_addr = (void *)addr;
304307 info.access_size = size;
305308 info.is_write = is_write;
mm/memory_hotplug.c+21−7
@@ -1483,17 +1483,20 @@ bool is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages) · 1482 unmodified lines
14831483 }
14841484
14851485 /*
1486− * Confirm all pages in a range [start, end) is belongs to the same zone.
1486+ * Confirm all pages in a range [start, end) belong to the same zone.
1487+ * When true, return its valid [start, end).
14871488 */
1488−int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn)
1489+int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn,
1490+ unsigned long *valid_start, unsigned long *valid_end)
14891491 {
14901492 unsigned long pfn, sec_end_pfn;
1493+ unsigned long start, end;
14911494 struct zone *zone = NULL;
14921495 struct page *page;
14931496 int i;
1494− for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn);
1497+ for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn + 1);
14951498 pfn < end_pfn;
1496− pfn = sec_end_pfn + 1, sec_end_pfn += PAGES_PER_SECTION) {
1499+ pfn = sec_end_pfn, sec_end_pfn += PAGES_PER_SECTION) {
14971500 /* Make sure the memory section is present first */
14981501 if (!present_section_nr(pfn_to_section_nr(pfn)))
14991502 continue;
@@ -1509,10 +1512,20 @@ int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn) · 9 unmodified lines
15091512 page = pfn_to_page(pfn + i);
15101513 if (zone && page_zone(page) != zone)
15111514 return 0;
1515+ if (!zone)
1516+ start = pfn + i;
15121517 zone = page_zone(page);
1518+ end = pfn + MAX_ORDER_NR_PAGES;
15131519 }
15141520 }
1515− return 1;
1521+
1522+ if (zone) {
1523+ *valid_start = start;
1524+ *valid_end = end;
1525+ return 1;
1526+ } else {
1527+ return 0;
1528+ }
15161529 }
15171530
15181531 /*
@@ -1839,6 +1852,7 @@ static int __ref __offline_pages(unsigned long start_pfn, · 320 unmodified lines
18391852 long offlined_pages;
18401853 int ret, drain, retry_max, node;
18411854 unsigned long flags;
1855+ unsigned long valid_start, valid_end;
18421856 struct zone *zone;
18431857 struct memory_notify arg;
18441858
@@ -1849,10 +1863,10 @@ static int __ref __offline_pages(unsigned long start_pfn, · 4 unmodified lines
18491863 return -EINVAL;
18501864 /* This makes hotplug much easier...and readable.
18511865 we assume this for now. .*/
1852− if (!test_pages_in_a_zone(start_pfn, end_pfn))
1866+ if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start, &valid_end))
18531867 return -EINVAL;
18541868
1855− zone = page_zone(pfn_to_page(start_pfn));
1869+ zone = page_zone(pfn_to_page(valid_start));
18561870 node = zone_to_nid(zone);
18571871 nr_pages = end_pfn - start_pfn;
18581872
mm/shmem.c+9−2
@@ -415,6 +415,7 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, · 414 unmodified lines
415415 struct shrink_control *sc, unsigned long nr_to_split)
416416 {
417417 LIST_HEAD(list), *pos, *next;
418+ LIST_HEAD(to_remove);
418419 struct inode *inode;
419420 struct shmem_inode_info *info;
420421 struct page *page;
@@ -441,9 +442,8 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo, · 20 unmodified lines
441442 /* Check if there's anything to gain */
442443 if (round_up(inode->i_size, PAGE_SIZE) ==
443444 round_up(inode->i_size, HPAGE_PMD_SIZE)) {
444− list_del_init(&info->shrinklist);
445+ list_move(&info->shrinklist, &to_remove);
445446 removed++;
446− iput(inode);
447447 goto next;
448448 }
449449
@@ -454,6 +454,13 @@ next: · 4 unmodified lines
454454 }
455455 spin_unlock(&sbinfo->shrinklist_lock);
456456
457+ list_for_each_safe(pos, next, &to_remove) {
458+ info = list_entry(pos, struct shmem_inode_info, shrinklist);
459+ inode = &info->vfs_inode;
460+ list_del_init(&info->shrinklist);
461+ iput(inode);
462+ }
463+
457464 list_for_each_safe(pos, next, &list) {
458465 int ret;
459466
mm/zswap.c+29−1
@@ -78,7 +78,13 @@ static u64 zswap_duplicate_entry; · 77 unmodified lines
7878
7979 /* Enable/disable zswap (disabled by default) */
8080 static bool zswap_enabled;
81−module_param_named(enabled, zswap_enabled, bool, 0644);
81+static int zswap_enabled_param_set(const char *,
82+ const struct kernel_param *);
83+static struct kernel_param_ops zswap_enabled_param_ops = {
84+ .set = zswap_enabled_param_set,
85+ .get = param_get_bool,
86+};
87+module_param_cb(enabled, &zswap_enabled_param_ops, &zswap_enabled, 0644);
8288
8389 /* Crypto compressor to use */
8490 #define ZSWAP_COMPRESSOR_DEFAULT "lzo"
@@ -176,6 +182,9 @@ static atomic_t zswap_pools_count = ATOMIC_INIT(0); · 91 unmodified lines
176182 /* used by param callback function */
177183 static bool zswap_init_started;
178184
185+/* fatal error during init */
186+static bool zswap_init_failed;
187+
179188 /*********************************
180189 * helpers and fwd declarations
181190 **********************************/
@@ -624,6 +633,11 @@ static int __zswap_param_set(const char *val, const struct kernel_param *kp, · 442 unmodified lines
624633 char *s = strstrip((char *)val);
625634 int ret;
626635
636+ if (zswap_init_failed) {
637+ pr_err("can't set param, initialization failed\n");
638+ return -ENODEV;
639+ }
640+
627641 /* no change required */
628642 if (!strcmp(s, *(char **)kp->arg))
629643 return 0;
@@ -703,6 +717,17 @@ static int zswap_zpool_param_set(const char *val, · 73 unmodified lines
703717 return __zswap_param_set(val, kp, NULL, zswap_compressor);
704718 }
705719
720+static int zswap_enabled_param_set(const char *val,
721+ const struct kernel_param *kp)
722+{
723+ if (zswap_init_failed) {
724+ pr_err("can't enable, initialization failed\n");
725+ return -ENODEV;
726+ }
727+
728+ return param_set_bool(val, kp);
729+}
730+
706731 /*********************************
707732 * writeback code
708733 **********************************/
@@ -1201,6 +1226,9 @@ hp_fail: · 492 unmodified lines
12011226 dstmem_fail:
12021227 zswap_entry_cache_destroy();
12031228 cache_fail:
1229+ /* if built-in, we aren't unloaded on failure; don't allow use */
1230+ zswap_init_failed = true;
1231+ zswap_enabled = false;
12041232 return -ENOMEM;
12051233 }
12061234 /* must be late so crypto has time to come up */
net/can/af_can.c+10−2
@@ -445,6 +445,7 @@ static struct hlist_head *find_rcv_list(canid_t *can_id, canid_t *mask, · 444 unmodified lines
445445 * @func: callback function on filter match
446446 * @data: returned parameter for callback function
447447 * @ident: string for calling module identification
448+ * @sk: socket pointer (might be NULL)
448449 *
449450 * Description:
450451 * Invokes the callback function with the received sk_buff and the given
@@ -468,7 +469,7 @@ static struct hlist_head *find_rcv_list(canid_t *can_id, canid_t *mask, · 17 unmodified lines
468469 */
469470 int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask,
470471 void (*func)(struct sk_buff *, void *), void *data,
471− char *ident)
472+ char *ident, struct sock *sk)
472473 {
473474 struct receiver *r;
474475 struct hlist_head *rl;
@@ -496,6 +497,7 @@ int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask, · 21 unmodified lines
496497 r->func = func;
497498 r->data = data;
498499 r->ident = ident;
500+ r->sk = sk;
499501
500502 hlist_add_head_rcu(&r->list, rl);
501503 d->entries++;
@@ -520,8 +522,11 @@ EXPORT_SYMBOL(can_rx_register); · 18 unmodified lines
520522 static void can_rx_delete_receiver(struct rcu_head *rp)
521523 {
522524 struct receiver *r = container_of(rp, struct receiver, rcu);
525+ struct sock *sk = r->sk;
523526
524527 kmem_cache_free(rcv_cache, r);
528+ if (sk)
529+ sock_put(sk);
525530 }
526531
527532 /**
@@ -596,8 +601,11 @@ void can_rx_unregister(struct net_device *dev, canid_t can_id, canid_t mask, · 68 unmodified lines
596601 spin_unlock(&can_rcvlists_lock);
597602
598603 /* schedule the receiver item for deletion */
599− if (r)
604+ if (r) {
605+ if (r->sk)
606+ sock_hold(r->sk);
600607 call_rcu(&r->rcu, can_rx_delete_receiver);
608+ }
601609 }
602610 EXPORT_SYMBOL(can_rx_unregister);
603611
net/can/af_can.h+2−1
@@ -50,13 +50,14 @@ · 49 unmodified lines
5050
5151 struct receiver {
5252 struct hlist_node list;
53− struct rcu_head rcu;
5453 canid_t can_id;
5554 canid_t mask;
5655 unsigned long matches;
5756 void (*func)(struct sk_buff *, void *);
5857 void *data;
5958 char *ident;
59+ struct sock *sk;
60+ struct rcu_head rcu;
6061 };
6162
6263 #define CAN_SFF_RCV_ARRAY_SZ (1 << CAN_SFF_ID_BITS)
net/can/bcm.c+18−9
@@ -734,14 +734,23 @@ static struct bcm_op *bcm_find_op(struct list_head *ops, · 733 unmodified lines
734734
735735 static void bcm_remove_op(struct bcm_op *op)
736736 {
737− hrtimer_cancel(&op->timer);
738− hrtimer_cancel(&op->thrtimer);
739−
740− if (op->tsklet.func)
741− tasklet_kill(&op->tsklet);
737+ if (op->tsklet.func) {
738+ while (test_bit(TASKLET_STATE_SCHED, &op->tsklet.state) ||
739+ test_bit(TASKLET_STATE_RUN, &op->tsklet.state) ||
740+ hrtimer_active(&op->timer)) {
741+ hrtimer_cancel(&op->timer);
742+ tasklet_kill(&op->tsklet);
743+ }
744+ }
742745
743− if (op->thrtsklet.func)
744− tasklet_kill(&op->thrtsklet);
746+ if (op->thrtsklet.func) {
747+ while (test_bit(TASKLET_STATE_SCHED, &op->thrtsklet.state) ||
748+ test_bit(TASKLET_STATE_RUN, &op->thrtsklet.state) ||
749+ hrtimer_active(&op->thrtimer)) {
750+ hrtimer_cancel(&op->thrtimer);
751+ tasklet_kill(&op->thrtsklet);
752+ }
753+ }
745754
746755 if ((op->frames) && (op->frames != &op->sframe))
747756 kfree(op->frames);
@@ -1216,7 +1225,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, · 468 unmodified lines
12161225 err = can_rx_register(dev, op->can_id,
12171226 REGMASK(op->can_id),
12181227 bcm_rx_handler, op,
1219− "bcm");
1228+ "bcm", sk);
12201229
12211230 op->rx_reg_dev = dev;
12221231 dev_put(dev);
@@ -1225,7 +1234,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, · 2 unmodified lines
12251234 } else
12261235 err = can_rx_register(NULL, op->can_id,
12271236 REGMASK(op->can_id),
1228− bcm_rx_handler, op, "bcm");
1237+ bcm_rx_handler, op, "bcm", sk);
12291238 if (err) {
12301239 /* this bcm rx op is broken -> remove it */
12311240 list_del(&op->list);
net/can/gw.c+1−1
@@ -442,7 +442,7 @@ static inline int cgw_register_filter(struct cgw_job *gwj) · 441 unmodified lines
442442 {
443443 return can_rx_register(gwj->src.dev, gwj->ccgw.filter.can_id,
444444 gwj->ccgw.filter.can_mask, can_can_gw_rcv,
445− gwj, "gw");
445+ gwj, "gw", NULL);
446446 }
447447
448448 static inline void cgw_unregister_filter(struct cgw_job *gwj)
net/can/raw.c+2−2
@@ -190,7 +190,7 @@ static int raw_enable_filters(struct net_device *dev, struct sock *sk, · 189 unmodified lines
190190 for (i = 0; i < count; i++) {
191191 err = can_rx_register(dev, filter[i].can_id,
192192 filter[i].can_mask,
193− raw_rcv, sk, "raw");
193+ raw_rcv, sk, "raw", sk);
194194 if (err) {
195195 /* clean up successfully registered filters */
196196 while (--i >= 0)
@@ -211,7 +211,7 @@ static int raw_enable_errfilter(struct net_device *dev, struct sock *sk, · 14 unmodified lines
211211
212212 if (err_mask)
213213 err = can_rx_register(dev, 0, err_mask | CAN_ERR_FLAG,
214− raw_rcv, sk, "raw");
214+ raw_rcv, sk, "raw", sk);
215215
216216 return err;
217217 }
net/ipv4/tcp_output.c+4−2
@@ -2518,9 +2518,11 @@ u32 __tcp_select_window(struct sock *sk) · 2517 unmodified lines
25182518 int full_space = min_t(int, tp->window_clamp, allowed_space);
25192519 int window;
25202520
2521− if (mss > full_space)
2521+ if (unlikely(mss > full_space)) {
25222522 mss = full_space;
2523−
2523+ if (mss <= 0)
2524+ return 0;
2525+ }
25242526 if (free_space < (full_space >> 1)) {
25252527 icsk->icsk_ack.quick = 0;
25262528
net/ipv6/ip6_output.c+1−1
@@ -1344,7 +1344,7 @@ emsgsize: · 1343 unmodified lines
13441344 */
13451345 if (transhdrlen && sk->sk_protocol == IPPROTO_UDP &&
13461346 headersize == sizeof(struct ipv6hdr) &&
1347− length < mtu - headersize &&
1347+ length <= mtu - headersize &&
13481348 !(flags & MSG_MORE) &&
13491349 rt->dst.dev->features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM))
13501350 csummode = CHECKSUM_PARTIAL;
net/ipv6/ip6_tunnel.c+1−1
@@ -441,7 +441,7 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw) · 440 unmodified lines
441441 if (i + sizeof(*tel) > optlen)
442442 break;
443443
444− tel = (struct ipv6_tlv_tnl_enc_lim *) skb->data + off + i;
444+ tel = (struct ipv6_tlv_tnl_enc_lim *)(skb->data + off + i);
445445 /* return index of option if found and valid */
446446 if (tel->type == IPV6_TLV_TNL_ENCAP_LIMIT &&
447447 tel->length == 1)
net/sched/cls_flower.c+2−2
@@ -568,9 +568,9 @@ static int fl_set_key(struct net *net, struct nlattr **tb, · 567 unmodified lines
568568 &mask->icmp.type,
569569 TCA_FLOWER_KEY_ICMPV6_TYPE_MASK,
570570 sizeof(key->icmp.type));
571− fl_set_key_val(tb, &key->icmp.code, TCA_FLOWER_KEY_ICMPV4_CODE,
571+ fl_set_key_val(tb, &key->icmp.code, TCA_FLOWER_KEY_ICMPV6_CODE,
572572 &mask->icmp.code,
573− TCA_FLOWER_KEY_ICMPV4_CODE_MASK,
573+ TCA_FLOWER_KEY_ICMPV6_CODE_MASK,
574574 sizeof(key->icmp.code));
575575 }
576576
net/sched/cls_matchall.c+45−82
@@ -16,16 +16,11 @@ · 15 unmodified lines
1616 #include <net/sch_generic.h>
1717 #include <net/pkt_cls.h>
1818
19−struct cls_mall_filter {
19+struct cls_mall_head {
2020 struct tcf_exts exts;
2121 struct tcf_result res;
2222 u32 handle;
23− struct rcu_head rcu;
2423 u32 flags;
25−};
26−
27−struct cls_mall_head {
28− struct cls_mall_filter *filter;
2924 struct rcu_head rcu;
3025 };
3126
@@ -33,38 +28,29 @@ static int mall_classify(struct sk_buff *skb, const struct tcf_proto *tp, · 1 unmodified line
3328 struct tcf_result *res)
3429 {
3530 struct cls_mall_head *head = rcu_dereference_bh(tp->root);
36− struct cls_mall_filter *f = head->filter;
3731
38− if (tc_skip_sw(f->flags))
32+ if (tc_skip_sw(head->flags))
3933 return -1;
4034
41− return tcf_exts_exec(skb, &f->exts, res);
35+ return tcf_exts_exec(skb, &head->exts, res);
4236 }
4337
4438 static int mall_init(struct tcf_proto *tp)
4539 {
46− struct cls_mall_head *head;
47−
48− head = kzalloc(sizeof(*head), GFP_KERNEL);
49− if (!head)
50− return -ENOBUFS;
51−
52− rcu_assign_pointer(tp->root, head);
53−
5440 return 0;
5541 }
5642
57−static void mall_destroy_filter(struct rcu_head *head)
43+static void mall_destroy_rcu(struct rcu_head *rcu)
5844 {
59− struct cls_mall_filter *f = container_of(head, struct cls_mall_filter, rcu);
45+ struct cls_mall_head *head = container_of(rcu, struct cls_mall_head,
46+ rcu);
6047
61− tcf_exts_destroy(&f->exts);
62−
63− kfree(f);
48+ tcf_exts_destroy(&head->exts);
49+ kfree(head);
6450 }
6551
6652 static int mall_replace_hw_filter(struct tcf_proto *tp,
67− struct cls_mall_filter *f,
53+ struct cls_mall_head *head,
6854 unsigned long cookie)
6955 {
7056 struct net_device *dev = tp->q->dev_queue->dev;
@@ -74,7 +60,7 @@ static int mall_replace_hw_filter(struct tcf_proto *tp, · 3 unmodified lines
7460 offload.type = TC_SETUP_MATCHALL;
7561 offload.cls_mall = &mall_offload;
7662 offload.cls_mall->command = TC_CLSMATCHALL_REPLACE;
77− offload.cls_mall->exts = &f->exts;
63+ offload.cls_mall->exts = &head->exts;
7864 offload.cls_mall->cookie = cookie;
7965
8066 return dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, tp->protocol,
@@ -82,7 +68,7 @@ static int mall_replace_hw_filter(struct tcf_proto *tp, · 1 unmodified line
8268 }
8369
8470 static void mall_destroy_hw_filter(struct tcf_proto *tp,
85− struct cls_mall_filter *f,
71+ struct cls_mall_head *head,
8672 unsigned long cookie)
8773 {
8874 struct net_device *dev = tp->q->dev_queue->dev;
@@ -103,29 +89,20 @@ static bool mall_destroy(struct tcf_proto *tp, bool force) · 14 unmodified lines
10389 {
10490 struct cls_mall_head *head = rtnl_dereference(tp->root);
10591 struct net_device *dev = tp->q->dev_queue->dev;
106− struct cls_mall_filter *f = head->filter;
10792
108− if (!force && f)
109− return false;
93+ if (!head)
94+ return true;
11095
111− if (f) {
112− if (tc_should_offload(dev, tp, f->flags))
113− mall_destroy_hw_filter(tp, f, (unsigned long) f);
96+ if (tc_should_offload(dev, tp, head->flags))
97+ mall_destroy_hw_filter(tp, head, (unsigned long) head);
11498
115− call_rcu(&f->rcu, mall_destroy_filter);
116− }
117− kfree_rcu(head, rcu);
99+ call_rcu(&head->rcu, mall_destroy_rcu);
118100 return true;
119101 }
120102
121103 static unsigned long mall_get(struct tcf_proto *tp, u32 handle)
122104 {
123− struct cls_mall_head *head = rtnl_dereference(tp->root);
124− struct cls_mall_filter *f = head->filter;
125−
126− if (f && f->handle == handle)
127− return (unsigned long) f;
128− return 0;
105+ return 0UL;
129106 }
130107
131108 static const struct nla_policy mall_policy[TCA_MATCHALL_MAX + 1] = {
@@ -134,7 +111,7 @@ static const struct nla_policy mall_policy[TCA_MATCHALL_MAX + 1] = { · 2 unmodified lines
134111 };
135112
136113 static int mall_set_parms(struct net *net, struct tcf_proto *tp,
137− struct cls_mall_filter *f,
114+ struct cls_mall_head *head,
138115 unsigned long base, struct nlattr **tb,
139116 struct nlattr *est, bool ovr)
140117 {
@@ -147,11 +124,11 @@ static int mall_set_parms(struct net *net, struct tcf_proto *tp, · 6 unmodified lines
147124 return err;
148125
149126 if (tb[TCA_MATCHALL_CLASSID]) {
150− f->res.classid = nla_get_u32(tb[TCA_MATCHALL_CLASSID]);
151− tcf_bind_filter(tp, &f->res, base);
127+ head->res.classid = nla_get_u32(tb[TCA_MATCHALL_CLASSID]);
128+ tcf_bind_filter(tp, &head->res, base);
152129 }
153130
154− tcf_exts_change(tp, &f->exts, &e);
131+ tcf_exts_change(tp, &head->exts, &e);
155132
156133 return 0;
157134 }
@@ -162,21 +139,17 @@ static int mall_change(struct net *net, struct sk_buff *in_skb, · 4 unmodified lines
162139 unsigned long *arg, bool ovr)
163140 {
164141 struct cls_mall_head *head = rtnl_dereference(tp->root);
165− struct cls_mall_filter *fold = (struct cls_mall_filter *) *arg;
166142 struct net_device *dev = tp->q->dev_queue->dev;
167− struct cls_mall_filter *f;
168143 struct nlattr *tb[TCA_MATCHALL_MAX + 1];
144+ struct cls_mall_head *new;
169145 u32 flags = 0;
170146 int err;
171147
172148 if (!tca[TCA_OPTIONS])
173149 return -EINVAL;
174150
175− if (head->filter)
176− return -EBUSY;
177−
178− if (fold)
179− return -EINVAL;
151+ if (head)
152+ return -EEXIST;
180153
181154 err = nla_parse_nested(tb, TCA_MATCHALL_MAX,
182155 tca[TCA_OPTIONS], mall_policy);
@@ -189,23 +162,23 @@ static int mall_change(struct net *net, struct sk_buff *in_skb, · 6 unmodified lines
189162 return -EINVAL;
190163 }
191164
192− f = kzalloc(sizeof(*f), GFP_KERNEL);
193− if (!f)
165+ new = kzalloc(sizeof(*new), GFP_KERNEL);
166+ if (!new)
194167 return -ENOBUFS;
195168
196− tcf_exts_init(&f->exts, TCA_MATCHALL_ACT, 0);
169+ tcf_exts_init(&new->exts, TCA_MATCHALL_ACT, 0);
197170
198171 if (!handle)
199172 handle = 1;
200− f->handle = handle;
201− f->flags = flags;
173+ new->handle = handle;
174+ new->flags = flags;
202175
203− err = mall_set_parms(net, tp, f, base, tb, tca[TCA_RATE], ovr);
176+ err = mall_set_parms(net, tp, new, base, tb, tca[TCA_RATE], ovr);
204177 if (err)
205178 goto errout;
206179
207180 if (tc_should_offload(dev, tp, flags)) {
208− err = mall_replace_hw_filter(tp, f, (unsigned long) f);
181+ err = mall_replace_hw_filter(tp, new, (unsigned long) new);
209182 if (err) {
210183 if (tc_skip_sw(flags))
211184 goto errout;
@@ -214,39 +187,29 @@ static int mall_change(struct net *net, struct sk_buff *in_skb, · 2 unmodified lines
214187 }
215188 }
216189
217− *arg = (unsigned long) f;
218− rcu_assign_pointer(head->filter, f);
219−
190+ *arg = (unsigned long) head;
191+ rcu_assign_pointer(tp->root, new);
192+ if (head)
193+ call_rcu(&head->rcu, mall_destroy_rcu);
220194 return 0;
221195
222196 errout:
223− kfree(f);
197+ kfree(new);
224198 return err;
225199 }
226200
227201 static int mall_delete(struct tcf_proto *tp, unsigned long arg)
228202 {
229− struct cls_mall_head *head = rtnl_dereference(tp->root);
230− struct cls_mall_filter *f = (struct cls_mall_filter *) arg;
231− struct net_device *dev = tp->q->dev_queue->dev;
232−
233− if (tc_should_offload(dev, tp, f->flags))
234− mall_destroy_hw_filter(tp, f, (unsigned long) f);
235−
236− RCU_INIT_POINTER(head->filter, NULL);
237− tcf_unbind_filter(tp, &f->res);
238− call_rcu(&f->rcu, mall_destroy_filter);
239− return 0;
203+ return -EOPNOTSUPP;
240204 }
241205
242206 static void mall_walk(struct tcf_proto *tp, struct tcf_walker *arg)
243207 {
244208 struct cls_mall_head *head = rtnl_dereference(tp->root);
245− struct cls_mall_filter *f = head->filter;
246209
247210 if (arg->count < arg->skip)
248211 goto skip;
249− if (arg->fn(tp, (unsigned long) f, arg) < 0)
212+ if (arg->fn(tp, (unsigned long) head, arg) < 0)
250213 arg->stop = 1;
251214 skip:
252215 arg->count++;
@@ -255,28 +218,28 @@ skip: · 2 unmodified lines
255218 static int mall_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
256219 struct sk_buff *skb, struct tcmsg *t)
257220 {
258− struct cls_mall_filter *f = (struct cls_mall_filter *) fh;
221+ struct cls_mall_head *head = (struct cls_mall_head *) fh;
259222 struct nlattr *nest;
260223
261− if (!f)
224+ if (!head)
262225 return skb->len;
263226
264− t->tcm_handle = f->handle;
227+ t->tcm_handle = head->handle;
265228
266229 nest = nla_nest_start(skb, TCA_OPTIONS);
267230 if (!nest)
268231 goto nla_put_failure;
269232
270− if (f->res.classid &&
271− nla_put_u32(skb, TCA_MATCHALL_CLASSID, f->res.classid))
233+ if (head->res.classid &&
234+ nla_put_u32(skb, TCA_MATCHALL_CLASSID, head->res.classid))
272235 goto nla_put_failure;
273236
274− if (tcf_exts_dump(skb, &f->exts))
237+ if (tcf_exts_dump(skb, &head->exts))
275238 goto nla_put_failure;
276239
277240 nla_nest_end(skb, nest);
278241
279− if (tcf_exts_dump_stats(skb, &f->exts) < 0)
242+ if (tcf_exts_dump_stats(skb, &head->exts) < 0)
280243 goto nla_put_failure;
281244
282245 return skb->len;
scripts/Makefile.build+2−0
@@ -164,6 +164,7 @@ cmd_gensymtypes_c = \ · 163 unmodified lines
164164 $(CPP) -D__GENKSYMS__ $(c_flags) $< | \
165165 $(GENKSYMS) $(if $(1), -T $(2)) \
166166 $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX)) \
167+ $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
167168 $(if $(KBUILD_PRESERVE),-p) \
168169 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
169170
@@ -337,6 +338,7 @@ cmd_gensymtypes_S = \ · 167 unmodified lines
337338 $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \
338339 $(GENKSYMS) $(if $(1), -T $(2)) \
339340 $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX)) \
341+ $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
340342 $(if $(KBUILD_PRESERVE),-p) \
341343 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
342344
scripts/genksyms/genksyms.c+14−5
@@ -44,7 +44,7 @@ char *cur_filename, *source_file; · 43 unmodified lines
4444 int in_source_file;
4545
4646 static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types,
47− flag_preserve, flag_warnings;
47+ flag_preserve, flag_warnings, flag_rel_crcs;
4848 static const char *mod_prefix = "";
4949
5050 static int errors;
@@ -693,7 +693,10 @@ void export_symbol(const char *name) · 642 unmodified lines
693693 fputs(">\n", debugfile);
694694
695695 /* Used as a linker script. */
696− printf("%s__crc_%s = 0x%08lx ;\n", mod_prefix, name, crc);
696+ printf(!flag_rel_crcs ? "%s__crc_%s = 0x%08lx;\n" :
697+ "SECTIONS { .rodata : ALIGN(4) { "
698+ "%s__crc_%s = .; LONG(0x%08lx); } }\n",
699+ mod_prefix, name, crc);
697700 }
698701 }
699702
@@ -730,7 +733,7 @@ void error_with_pos(const char *fmt, ...) · 30 unmodified lines
730733
731734 static void genksyms_usage(void)
732735 {
733− fputs("Usage:\n" "genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver\n" "\n"
736+ fputs("Usage:\n" "genksyms [-adDTwqhVR] > /path/to/.tmp_obj.ver\n" "\n"
734737 #ifdef __GNU_LIBRARY__
735738 " -s, --symbol-prefix Select symbol prefix\n"
736739 " -d, --debug Increment the debug level (repeatable)\n"
@@ -742,6 +745,7 @@ static void genksyms_usage(void) · 5 unmodified lines
742745 " -q, --quiet Disable warnings (default)\n"
743746 " -h, --help Print this message\n"
744747 " -V, --version Print the release version\n"
748+ " -R, --relative-crc Emit section relative symbol CRCs\n"
745749 #else /* __GNU_LIBRARY__ */
746750 " -s Select symbol prefix\n"
747751 " -d Increment the debug level (repeatable)\n"
@@ -753,6 +757,7 @@ static void genksyms_usage(void) · 5 unmodified lines
753757 " -q Disable warnings (default)\n"
754758 " -h Print this message\n"
755759 " -V Print the release version\n"
760+ " -R Emit section relative symbol CRCs\n"
756761 #endif /* __GNU_LIBRARY__ */
757762 , stderr);
758763 }
@@ -774,13 +779,14 @@ int main(int argc, char **argv) · 15 unmodified lines
774779 {"preserve", 0, 0, 'p'},
775780 {"version", 0, 0, 'V'},
776781 {"help", 0, 0, 'h'},
782+ {"relative-crc", 0, 0, 'R'},
777783 {0, 0, 0, 0}
778784 };
779785
780− while ((o = getopt_long(argc, argv, "s:dwqVDr:T:ph",
786+ while ((o = getopt_long(argc, argv, "s:dwqVDr:T:phR",
781787 &long_opts[0], NULL)) != EOF)
782788 #else /* __GNU_LIBRARY__ */
783− while ((o = getopt(argc, argv, "s:dwqVDr:T:ph")) != EOF)
789+ while ((o = getopt(argc, argv, "s:dwqVDr:T:phR")) != EOF)
784790 #endif /* __GNU_LIBRARY__ */
785791 switch (o) {
786792 case 's':
@@ -823,6 +829,9 @@ int main(int argc, char **argv) · 36 unmodified lines
823829 case 'h':
824830 genksyms_usage();
825831 return 0;
832+ case 'R':
833+ flag_rel_crcs = 1;
834+ break;
826835 default:
827836 genksyms_usage();
828837 return 1;
scripts/kallsyms.c+12−0
@@ -219,6 +219,10 @@ static int symbol_valid(struct sym_entry *s) · 218 unmodified lines
219219 "_SDA2_BASE_", /* ppc */
220220 NULL };
221221
222+ static char *special_prefixes[] = {
223+ "__crc_", /* modversions */
224+ NULL };
225+
222226 static char *special_suffixes[] = {
223227 "_veneer", /* arm */
224228 "_from_arm", /* arm */
@@ -259,6 +263,14 @@ static int symbol_valid(struct sym_entry *s) · 34 unmodified lines
259263 if (strcmp(sym_name, special_symbols[i]) == 0)
260264 return 0;
261265
266+ for (i = 0; special_prefixes[i]; i++) {
267+ int l = strlen(special_prefixes[i]);
268+
269+ if (l <= strlen(sym_name) &&
270+ strncmp(sym_name, special_prefixes[i], l) == 0)
271+ return 0;
272+ }
273+
262274 for (i = 0; special_suffixes[i]; i++) {
263275 int l = strlen(sym_name) - strlen(special_suffixes[i]);
264276
scripts/mod/modpost.c+10−0
@@ -621,6 +621,16 @@ static void handle_modversions(struct module *mod, struct elf_info *info, · 620 unmodified lines
621621 if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
622622 is_crc = true;
623623 crc = (unsigned int) sym->st_value;
624+ if (sym->st_shndx != SHN_UNDEF && sym->st_shndx != SHN_ABS) {
625+ unsigned int *crcp;
626+
627+ /* symbol points to the CRC in the ELF object */
628+ crcp = (void *)info->hdr + sym->st_value +
629+ info->sechdrs[sym->st_shndx].sh_offset -
630+ (info->hdr->e_type != ET_REL ?
631+ info->sechdrs[sym->st_shndx].sh_addr : 0);
632+ crc = *crcp;
633+ }
624634 sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
625635 export);
626636 }
tools/objtool/arch/x86/decode.c+1−1
@@ -150,9 +150,9 @@ int arch_decode_instruction(struct elf *elf, struct section *sec, · 149 unmodified lines
150150 *type = INSN_RETURN;
151151 break;
152152
153− case 0xc5: /* iret */
154153 case 0xca: /* retf */
155154 case 0xcb: /* retf */
155+ case 0xcf: /* iret */
156156 *type = INSN_CONTEXT_SWITCH;
157157 break;
158158