History

Backmerge tag 'v4.12-rc7' into drm-next

Linux 4.12-rc7 Needed at least rc6 for drm-misc-next-fixes, may as well go to rc7

Dave Airlie committed 9 years ago

Commit 6d61e702 parents 338ffbf c0bc126461 files · +4152 −2758Browse files

Unified · Split

461 files
  1. Documentation/admin-guide/kernel-parameters.txt +7 −0
  2. Documentation/devicetree/bindings/clock/sunxi-ccu.txt +4 −3
  3. Documentation/devicetree/bindings/gpio/gpio-mvebu.txt +3 −3
  4. Documentation/devicetree/bindings/mfd/stm32-timers.txt +1 −1
  5. Documentation/devicetree/bindings/net/dsa/b53.txt +1 −1
  6. Documentation/devicetree/bindings/net/smsc911x.txt +1 −0
  7. Documentation/networking/scaling.txt +1 −1
  8. Makefile +2 −2
  9. arch/arc/mm/mmap.c +1 −1
  10. arch/arm/boot/dts/am335x-sl50.dts +2 −6
  11. arch/arm/boot/dts/sunxi-h3-h5.dtsi +4 −3
  12. arch/arm/mm/mmap.c +2 −2
  13. arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +3 −2
  14. arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi +1 −1
  15. arch/arm64/boot/dts/allwinner/sunxi-h3-h5.dtsi +0 −1
  16. arch/arm64/kernel/vdso.c +3 −2
  17. arch/arm64/kernel/vdso/gettimeofday.S +0 −1
  18. arch/arm64/net/bpf_jit_comp.c +5 −2
  19. arch/frv/mm/elf-fdpic.c +1 −1
  20. arch/mips/boot/Makefile +5 −5
  21. arch/mips/include/asm/highmem.h +5 −0
  22. arch/mips/include/asm/kprobes.h +2 −1
  23. arch/mips/include/asm/pgtable-32.h +6 −1
  24. arch/mips/kernel/branch.c +3 −1
  25. arch/mips/kernel/ftrace.c +5 −19
  26. arch/mips/kernel/perf_event_mipsxx.c +5 −1
  27. arch/mips/kvm/tlb.c +5 −1
  28. arch/mips/mm/mmap.c +1 −1
  29. arch/mips/mm/pgtable-32.c +3 −3
  30. arch/parisc/kernel/sys_parisc.c +9 −6
  31. arch/powerpc/include/asm/bug.h +1 −1
  32. arch/powerpc/include/asm/kprobes.h +1 −0
  33. arch/powerpc/include/asm/xive.h +7 −5
  34. arch/powerpc/kernel/exceptions-64s.S +7 −4
  35. arch/powerpc/kernel/kprobes.c +17 −0
  36. arch/powerpc/kernel/setup_64.c +28 −3
  37. arch/powerpc/kernel/trace/ftrace_64_mprofile.S +46 −13
  38. arch/powerpc/kvm/book3s_hv.c +51 −0
  39. arch/powerpc/kvm/book3s_hv_interrupts.S +11 −1
  40. arch/powerpc/kvm/book3s_hv_rmhandlers.S +56 −19
  41. arch/powerpc/kvm/book3s_xive_template.c +2 −2
  42. arch/powerpc/mm/hugetlbpage-radix.c +1 −1
  43. arch/powerpc/mm/mmap.c +2 −2
  44. arch/powerpc/mm/slice.c +1 −1
  45. arch/powerpc/perf/perf_regs.c +2 −1
  46. arch/powerpc/platforms/powernv/npu-dma.c +67 −30
  47. arch/powerpc/sysdev/xive/common.c +1 −1
  48. arch/s390/configs/default_defconfig +33 −6
  49. arch/s390/configs/gcov_defconfig +24 −4
  50. arch/s390/configs/performance_defconfig +23 −4
  51. arch/s390/configs/zfcpdump_defconfig +4 −2
  52. arch/s390/defconfig +3 −5
  53. arch/s390/kernel/entry.S +13 −6
  54. arch/s390/kvm/gaccess.c +6 −9
  55. arch/s390/mm/mmap.c +2 −2
  56. arch/sh/mm/mmap.c +2 −2
  57. arch/sparc/kernel/sys_sparc_64.c +2 −2
  58. arch/sparc/mm/hugetlbpage.c +1 −1
  59. arch/tile/mm/hugetlbpage.c +1 −1
  60. arch/x86/events/intel/core.c +2 −2
  61. arch/x86/include/asm/extable.h +1 −0
  62. arch/x86/include/asm/kvm_emulate.h +1 −0
  63. arch/x86/include/asm/mshyperv.h +1 −2
  64. arch/x86/kernel/sys_x86_64.c +2 −2
  65. arch/x86/kernel/traps.c +1 −1
  66. arch/x86/kvm/emulate.c +1 −0
  67. arch/x86/kvm/x86.c +32 −30
  68. arch/x86/mm/extable.c +3 −0
  69. arch/x86/mm/hugetlbpage.c +1 −1
  70. arch/x86/mm/init.c +3 −3
  71. arch/xtensa/include/asm/irq.h +2 −1
  72. arch/xtensa/kernel/irq.c +0 −5
  73. arch/xtensa/kernel/setup.c +1 −2
  74. arch/xtensa/kernel/syscall.c +1 −1
  75. arch/xtensa/kernel/vmlinux.lds.S +3 −3
  76. arch/xtensa/platforms/iss/simdisk.c +1 −2
  77. arch/xtensa/platforms/xtfpga/include/platform/hardware.h +4 −2
  78. arch/xtensa/platforms/xtfpga/setup.c +5 −5
  79. block/blk-mq-sched.c +46 −12
  80. block/blk-mq-sched.h +0 −9
  81. block/blk-mq.c +13 −3
  82. block/blk-sysfs.c +22 −12
  83. drivers/acpi/acpica/tbutils.c +25 −9
  84. drivers/acpi/acpica/utresrc.c +0 −9
  85. drivers/acpi/scan.c +37 −30
  86. drivers/block/xen-blkback/blkback.c +12 −14
  87. drivers/block/xen-blkback/common.h +6 −20
  88. drivers/block/xen-blkback/xenbus.c +8 −7
  89. drivers/char/random.c +6 −6
  90. drivers/clk/meson/Kconfig +1 −0
  91. drivers/clk/sunxi-ng/Kconfig +1 −0
  92. drivers/clk/sunxi-ng/ccu-sun50i-a64.h +3 −1
  93. drivers/clk/sunxi-ng/ccu-sun5i.c +1 −1
  94. drivers/clk/sunxi-ng/ccu-sun6i-a31.c +1 −1
  95. drivers/clk/sunxi-ng/ccu-sun8i-h3.h +3 −1
  96. drivers/clk/sunxi-ng/ccu-sun8i-v3s.c +1 −1
  97. drivers/clocksource/arm_arch_timer.c +2 −2
  98. drivers/clocksource/cadence_ttc_timer.c +1 −0
  99. drivers/clocksource/timer-sun5i.c +1 −0
  100. drivers/cpufreq/cpufreq_conservative.c +2 −2
  101. drivers/cpuidle/dt_idle_states.c +3 −1
  102. drivers/devfreq/event/exynos-nocp.c +5 −1
  103. drivers/devfreq/event/exynos-ppmu.c +6 −2
  104. drivers/firmware/dmi-id.c +2 −2
  105. drivers/firmware/dmi_scan.c +37 −12
  106. drivers/gpio/gpio-mvebu.c +3 −3
  107. drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +4 −0
  108. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 −0
  109. drivers/gpu/drm/amd/amdgpu/atombios_crtc.c +2 −2
  110. drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +5 −2
  111. drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +5 −2
  112. drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +5 −2
  113. drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +5 −2
  114. drivers/gpu/drm/bridge/synopsys/Kconfig +1 −0
  115. drivers/gpu/drm/drm_connector.c +20 −18
  116. drivers/gpu/drm/mgag200/mgag200_mode.c +8 −1
  117. drivers/gpu/drm/radeon/cik.c +5 −2
  118. drivers/gpu/drm/radeon/evergreen.c +5 −2
  119. drivers/gpu/drm/radeon/radeon_combios.c +7 −0
  120. drivers/gpu/drm/radeon/radeon_device.c +4 −0
  121. drivers/gpu/drm/radeon/radeon_uvd.c +1 −1
  122. drivers/gpu/drm/radeon/si.c +5 −2
  123. drivers/gpu/drm/tegra/drm.c +5 −17
  124. drivers/gpu/host1x/dev.c +1 −1
  125. drivers/hid/hid-core.c +221 −61
  126. drivers/hid/hid-ids.h +3 −0
  127. drivers/hid/hid-magicmouse.c +7 −8
  128. drivers/hid/usbhid/hid-quirks.c +1 −0
  129. drivers/hsi/clients/ssi_protocol.c +1 −1
  130. drivers/i2c/busses/i2c-imx.c +4 −4
  131. drivers/i2c/busses/i2c-ismt.c +1 −1
  132. drivers/i2c/busses/i2c-rcar.c +1 −1
  133. drivers/iio/adc/meson_saradc.c +2 −2
  134. drivers/iio/adc/mxs-lradc-adc.c +5 −2
  135. drivers/iio/buffer/industrialio-buffer-dma.c +1 −0
  136. drivers/iio/buffer/industrialio-buffer-dmaengine.c +1 −0
  137. drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +36 −3
  138. drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h +3 −0
  139. drivers/infiniband/core/addr.c +1 −9
  140. drivers/infiniband/hw/bnxt_re/bnxt_re.h +4 −0
  141. drivers/infiniband/hw/bnxt_re/ib_verbs.c +347 −124
  142. drivers/infiniband/hw/bnxt_re/ib_verbs.h +16 −6
  143. drivers/infiniband/hw/bnxt_re/main.c +0 −4
  144. drivers/infiniband/hw/bnxt_re/qplib_fp.c +199 −185
  145. drivers/infiniband/hw/bnxt_re/qplib_fp.h +17 −1
  146. drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +164 −150
  147. drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +20 −41
  148. drivers/infiniband/hw/bnxt_re/qplib_res.h +4 −0
  149. drivers/infiniband/hw/bnxt_re/qplib_sp.c +83 −250
  150. drivers/infiniband/hw/bnxt_re/qplib_sp.h +2 −0
  151. drivers/infiniband/hw/cxgb4/device.c +7 −3
  152. drivers/infiniband/hw/mlx5/main.c +4 −2
  153. drivers/infiniband/hw/qedr/qedr.h +4 −1
  154. drivers/infiniband/hw/qedr/verbs.c +41 −27
  155. drivers/infiniband/sw/rxe/rxe.h +4 −1
  156. drivers/infiniband/sw/rxe/rxe_verbs.c +2 −7
  157. drivers/infiniband/ulp/ipoib/ipoib_ib.c +0 −1
  158. drivers/infiniband/ulp/ipoib/ipoib_main.c +13 −2
  159. drivers/infiniband/ulp/ipoib/ipoib_vlan.c +7 −4
  160. drivers/input/misc/soc_button_array.c +14 −6
  161. drivers/input/rmi4/rmi_f54.c +7 −10
  162. drivers/input/serio/i8042-x86ia64io.h +7 −0
  163. drivers/irqchip/irq-mips-gic.c +3 −3
  164. drivers/irqchip/irq-xtensa-mx.c +1 −1
  165. drivers/irqchip/irq-xtensa-pic.c +1 −1
  166. drivers/leds/leds-bcm6328.c +2 −2
  167. drivers/leds/trigger/ledtrig-heartbeat.c +0 −31
  168. drivers/md/dm-integrity.c +10 −2
  169. drivers/md/dm-io.c +2 −2
  170. drivers/md/dm-raid1.c +19 −2
  171. drivers/media/cec/Kconfig +1 −0
  172. drivers/media/cec/cec-api.c +1 −7
  173. drivers/media/i2c/tc358743.c +1 −1
  174. drivers/media/rc/sir_ir.c +6 −0
  175. drivers/media/usb/rainshadow-cec/rainshadow-cec.c +1 −0
  176. drivers/media/v4l2-core/videobuf2-core.c +1 −1
  177. drivers/mfd/arizona-core.c +1 −2
  178. drivers/mmc/host/meson-gx-mmc.c +9 −0
  179. drivers/net/bonding/bond_3ad.c +27 −0
  180. drivers/net/bonding/bond_main.c +3 −3
  181. drivers/net/caif/caif_hsi.c +1 −1
  182. drivers/net/caif/caif_serial.c +1 −1
  183. drivers/net/caif/caif_spi.c +1 −1
  184. drivers/net/caif/caif_virtio.c +1 −1
  185. drivers/net/can/dev.c +3 −0
  186. drivers/net/can/peak_canfd/peak_canfd.c +1 −1
  187. drivers/net/can/slcan.c +3 −4
  188. drivers/net/can/usb/gs_usb.c +2 −0
  189. drivers/net/can/usb/peak_usb/pcan_usb_core.c +1 −3
  190. drivers/net/can/vcan.c +2 −2
  191. drivers/net/can/vxcan.c +2 −2
  192. drivers/net/dummy.c +2 −2
  193. drivers/net/ethernet/amazon/ena/ena_com.c +21 −14
  194. drivers/net/ethernet/amazon/ena/ena_ethtool.c +1 −1
  195. drivers/net/ethernet/amazon/ena/ena_netdev.c +132 −47
  196. drivers/net/ethernet/amazon/ena/ena_netdev.h +15 −3
  197. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h +0 −3
  198. drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +15 −4
  199. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +13 −2
  200. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h +1 −0
  201. drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +7 −5
  202. drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +1 −1
  203. drivers/net/ethernet/freescale/fman/mac.c +2 −0
  204. drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +14 −2
  205. drivers/net/ethernet/ibm/emac/core.c +40 −27
  206. drivers/net/ethernet/ibm/ibmvnic.c +6 −0
  207. drivers/net/ethernet/intel/i40e/i40e.h +1 −0
  208. drivers/net/ethernet/intel/i40e/i40e_ethtool.c +2 −2
  209. drivers/net/ethernet/intel/i40e/i40e_main.c +4 −3
  210. drivers/net/ethernet/intel/i40e/i40e_txrx.c +2 −2
  211. drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2 −0
  212. drivers/net/ethernet/marvell/mvpp2.c +33 −43
  213. drivers/net/ethernet/mellanox/mlx5/core/en.h +5 −3
  214. drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +4 −4
  215. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 −1
  216. drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +2 −0
  217. drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c +26 −19
  218. drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +2 −9
  219. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +0 −1
  220. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +40 −37
  221. drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +1 −1
  222. drivers/net/ethernet/mellanox/mlx5/core/health.c +5 −6
  223. drivers/net/ethernet/mellanox/mlx5/core/main.c +16 −4
  224. drivers/net/ethernet/qlogic/qed/qed_debug.c +1 −1
  225. drivers/net/ethernet/sfc/ef10_sriov.c +0 −2
  226. drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +7 −4
  227. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +33 −12
  228. drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h +2 −1
  229. drivers/net/geneve.c +1 −1
  230. drivers/net/gtp.c +1 −1
  231. drivers/net/hamradio/6pack.c +1 −1
  232. drivers/net/hamradio/bpqether.c +1 −1
  233. drivers/net/hyperv/hyperv_net.h +3 −2
  234. drivers/net/hyperv/netvsc_drv.c +18 −36
  235. drivers/net/hyperv/rndis_filter.c +29 −1
  236. drivers/net/ifb.c +2 −2
  237. drivers/net/ipvlan/ipvlan_main.c +1 −1
  238. drivers/net/loopback.c +2 −2
  239. drivers/net/macsec.c +2 −2
  240. drivers/net/macvlan.c +1 −1
  241. drivers/net/netconsole.c +1 −1
  242. drivers/net/nlmon.c +1 −1
  243. drivers/net/phy/Kconfig +1 −0
  244. drivers/net/phy/phy.c +2 −0
  245. drivers/net/slip/slip.c +3 −4
  246. drivers/net/team/team.c +2 −2
  247. drivers/net/tun.c +2 −2
  248. drivers/net/usb/cdc-phonet.c +1 −1
  249. drivers/net/usb/qmi_wwan.c +5 −1
  250. drivers/net/usb/r8152.c +2 −0
  251. drivers/net/veth.c +2 −2
  252. drivers/net/vrf.c +33 −5
  253. drivers/net/vsockmon.c +1 −1
  254. drivers/net/vxlan.c +1 −1
  255. drivers/net/wan/dlci.c +1 −1
  256. drivers/net/wan/hdlc_fr.c +1 −1
  257. drivers/net/wan/lapbether.c +1 −1
  258. drivers/net/wireless/ath/ath6kl/main.c +1 −1
  259. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +0 −1
  260. drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +2 −1
  261. drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +17 −18
  262. drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h +2 −2
  263. drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +1 −1
  264. drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +12 −5
  265. drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +12 −6
  266. drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +5 −4
  267. drivers/net/wireless/intersil/hostap/hostap_main.c +1 −1
  268. drivers/net/wireless/mac80211_hwsim.c +1 −1
  269. drivers/net/wireless/marvell/mwifiex/main.c +1 −1
  270. drivers/ntb/hw/intel/ntb_hw_intel.c +1 −1
  271. drivers/ntb/ntb_transport.c +11 −47
  272. drivers/ntb/test/ntb_perf.c +2 −2
  273. drivers/pci/access.c +6 −6
  274. drivers/pci/endpoint/functions/Kconfig +1 −0
  275. drivers/pinctrl/pinctrl-amd.c +41 −50
  276. drivers/pinctrl/stm32/pinctrl-stm32.c +1 −1
  277. drivers/platform/x86/intel_telemetry_debugfs.c +7 −9
  278. drivers/s390/cio/vfio_ccw_ops.c +6 −6
  279. drivers/s390/crypto/ap_bus.c +24 −14
  280. drivers/s390/crypto/ap_card.c +8 −1
  281. drivers/s390/crypto/ap_queue.c +8 −1
  282. drivers/s390/net/netiucv.c +2 −2
  283. drivers/scsi/qedi/qedi_fw.c +0 −1
  284. drivers/scsi/qedi/qedi_main.c +1 −3
  285. drivers/staging/iio/cdc/ad7152.c +1 −5
  286. drivers/staging/rtl8188eu/os_dep/mon.c +1 −1
  287. drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +2 −1
  288. drivers/staging/rtl8723bs/os_dep/os_intfs.c +0 −2
  289. drivers/staging/rtl8723bs/os_dep/osdep_service.c +1 −1
  290. drivers/target/iscsi/iscsi_target.c +20 −2
  291. drivers/target/target_core_internal.h +1 −1
  292. drivers/target/target_core_tmr.c +8 −8
  293. drivers/target/target_core_transport.c +6 −3
  294. drivers/usb/gadget/composite.c +5 −6
  295. drivers/usb/gadget/function/f_phonet.c +1 −1
  296. drivers/usb/gadget/legacy/inode.c +6 −3
  297. drivers/usb/gadget/udc/dummy_hcd.c +4 −9
  298. drivers/usb/gadget/udc/net2280.c +1 −8
  299. drivers/usb/host/xhci-mem.c +5 −2
  300. drivers/usb/host/xhci-pci.c +3 −0
  301. drivers/video/fbdev/core/fbmon.c +1 −1
  302. drivers/video/fbdev/smscufx.c +3 −2
  303. drivers/video/fbdev/udlfb.c +5 −4
  304. drivers/video/fbdev/via/viafbdev.c +3 −5
  305. drivers/virtio/virtio_balloon.c +7 −0
  306. fs/autofs4/dev-ioctl.c +1 −1
  307. fs/btrfs/hash.c +4 −1
  308. fs/ceph/acl.c +1 −0
  309. fs/ceph/export.c +4 −0
  310. fs/ceph/inode.c +2 −3
  311. fs/ceph/mds_client.c +1 −3
  312. fs/cifs/file.c +1 −1
  313. fs/cifs/misc.c +1 −1
  314. fs/cifs/smb1ops.c +7 −2
  315. fs/cifs/smb2ops.c +5 −3
  316. fs/cifs/xattr.c +0 −2
  317. fs/configfs/item.c +8 −0
  318. fs/configfs/symlink.c +1 −2
  319. fs/dax.c +1 −0
  320. fs/dcache.c +4 −6
  321. fs/exec.c +24 −4
  322. fs/f2fs/f2fs.h +4 −1
  323. fs/hugetlbfs/inode.c +1 −1
  324. fs/namespace.c +2 −0
  325. fs/ocfs2/dlmglue.c +4 −0
  326. fs/ocfs2/xattr.c +13 −10
  327. fs/proc/task_mmu.c +0 −4
  328. fs/read_write.c +1 −1
  329. fs/ufs/balloc.c +19 −25
  330. fs/ufs/inode.c +43 −31
  331. fs/ufs/super.c +49 −24
  332. fs/ufs/ufs_fs.h +5 −4
  333. fs/ufs/util.c +8 −9
  334. fs/ufs/util.h +2 −7
  335. fs/userfaultfd.c +21 −8
  336. fs/xfs/xfs_aops.c +5 −2
  337. fs/xfs/xfs_buf.c +1 −1
  338. fs/xfs/xfs_icache.c +2 −3
  339. include/acpi/acpi_bus.h +2 −1
  340. include/acpi/actbl.h +14 −0
  341. include/dt-bindings/clock/sun50i-a64-ccu.h +2 −0
  342. include/dt-bindings/clock/sun8i-h3-ccu.h +2 −0
  343. include/linux/blkdev.h +4 −0
  344. include/linux/configfs.h +2 −1
  345. include/linux/dmi.h +1 −1
  346. include/linux/mm.h +25 −28
  347. include/linux/netdevice.h +10 −5
  348. include/linux/slub_def.h +1 −0
  349. include/linux/timekeeper_internal.h +2 −3
  350. include/media/cec-notifier.h +10 −0
  351. include/media/cec.h +1 −1
  352. include/net/wext.h +2 −2
  353. include/uapi/linux/ethtool.h +4 −2
  354. include/uapi/linux/openvswitch.h +1 −0
  355. kernel/events/ring_buffer.c +1 −1
  356. kernel/irq/manage.c +3 −1
  357. kernel/livepatch/patch.c +6 −2
  358. kernel/livepatch/transition.c +31 −5
  359. kernel/sched/core.c +1 −1
  360. kernel/sched/cpufreq_schedutil.c +0 −3
  361. kernel/sched/fair.c +1 −1
  362. kernel/signal.c +14 −6
  363. kernel/time/alarmtimer.c +11 −3
  364. kernel/time/tick-broadcast.c +3 −1
  365. kernel/time/tick-internal.h +0 −2
  366. kernel/time/timekeeping.c +46 −25
  367. lib/cmdline.c +3 −3
  368. lib/libcrc32c.c +4 −2
  369. mm/gup.c +0 −5
  370. mm/huge_memory.c +7 −1
  371. mm/khugepaged.c +0 −1
  372. mm/memory-failure.c +4 −1
  373. mm/memory.c +0 −38
  374. mm/mmap.c +97 −63
  375. mm/slub.c +26 −14
  376. mm/swap_cgroup.c +3 −0
  377. mm/vmalloc.c +13 −2
  378. mm/vmpressure.c +3 −3
  379. net/8021q/vlan.c +2 −1
  380. net/8021q/vlan_dev.c +2 −2
  381. net/batman-adv/distributed-arp-table.c +3 −2
  382. net/batman-adv/routing.c +1 −1
  383. net/batman-adv/soft-interface.c +2 −3
  384. net/bluetooth/6lowpan.c +1 −1
  385. net/bridge/br_device.c +1 −1
  386. net/caif/caif_socket.c +4 −0
  387. net/caif/cfpkt_skbuff.c +1 −5
  388. net/caif/chnl_net.c +2 −2
  389. net/can/af_can.c +1 −2
  390. net/core/dev.c +30 −14
  391. net/core/dev_ioctl.c +16 −3
  392. net/core/dst.c +14 −0
  393. net/core/fib_rules.c +14 −7
  394. net/core/rtnetlink.c +4 −1
  395. net/decnet/dn_route.c +4 −10
  396. net/decnet/netfilter/dn_rtmsg.c +3 −1
  397. net/hsr/hsr_device.c +2 −2
  398. net/hsr/hsr_forward.c +1 −2
  399. net/hsr/hsr_framereg.c +7 −2
  400. net/hsr/hsr_framereg.h +1 −1
  401. net/ieee802154/6lowpan/core.c +1 −1
  402. net/ipv4/icmp.c +6 −2
  403. net/ipv4/igmp.c +14 −8
  404. net/ipv4/ip_tunnel.c +4 −2
  405. net/ipv4/ipmr.c +16 −18
  406. net/ipv6/addrconf.c +3 −3
  407. net/ipv6/fib6_rules.c +6 −16
  408. net/ipv6/icmp.c +1 −1
  409. net/ipv6/ila/ila_xlat.c +1 −0
  410. net/ipv6/ip6_fib.c +1 −2
  411. net/ipv6/ip6_gre.c +5 −4
  412. net/ipv6/ip6_tunnel.c +8 −6
  413. net/ipv6/ip6_vti.c +4 −4
  414. net/ipv6/ip6mr.c +1 −1
  415. net/ipv6/proc.c +1 −1
  416. net/ipv6/route.c +1 −0
  417. net/ipv6/sit.c +3 −3
  418. net/irda/irlan/irlan_eth.c +1 −1
  419. net/l2tp/l2tp_eth.c +8 −7
  420. net/mac80211/cfg.c +2 −0
  421. net/mac80211/ieee80211_i.h +1 −1
  422. net/mac80211/iface.c +4 −3
  423. net/mac80211/mlme.c +31 −31
  424. net/mac80211/rx.c +5 −1
  425. net/mac80211/wpa.c +5 −4
  426. net/mac802154/iface.c +3 −4
  427. net/openvswitch/vport-internal_dev.c +2 −2
  428. net/phonet/pep-gprs.c +1 −1
  429. net/rxrpc/key.c +34 −30
  430. net/sched/act_pedit.c +3 −1
  431. net/sched/act_police.c +3 −5
  432. net/sctp/endpointola.c +1 −0
  433. net/sctp/sctp_diag.c +3 −2
  434. net/sctp/socket.c +4 −5
  435. net/tipc/msg.c +1 −1
  436. net/unix/af_unix.c +6 −1
  437. net/wireless/wext-core.c +9 −13
  438. scripts/Makefile.headersinst +9 −1
  439. scripts/genksyms/genksyms.h +1 −1
  440. scripts/kconfig/Makefile +1 −1
  441. scripts/kconfig/nconf.c +6 −6
  442. scripts/kconfig/nconf.gui.c +2 −2
  443. scripts/tags.sh +1 −0
  444. security/selinux/hooks.c +2 −3
  445. sound/core/pcm_lib.c +2 −2
  446. sound/firewire/amdtp-stream.c +6 −2
  447. sound/firewire/amdtp-stream.h +1 −1
  448. sound/pci/hda/hda_intel.c +8 −3
  449. tools/objtool/builtin-check.c +2 −1
  450. tools/perf/Makefile.config +19 −19
  451. tools/perf/Makefile.perf +1 −1
  452. tools/perf/arch/Build +1 −1
  453. tools/perf/pmu-events/Build +2 −2
  454. tools/perf/tests/Build +1 −1
  455. tools/perf/tests/task-exit.c +1 −1
  456. tools/perf/util/evsel.c +12 −0
  457. tools/perf/util/header.c +1 −1
  458. tools/perf/util/probe-event.c +1 −1
  459. tools/perf/util/unwind-libdw.c +8 −0
  460. tools/testing/selftests/bpf/bpf_endian.h +30 −11
  461. tools/testing/selftests/ntb/ntb_test.sh +1 −1
Documentation/admin-guide/kernel-parameters.txt+7−0
@@ -3811,6 +3811,13 @@ · 3810 unmodified lines
38113811 expediting. Set to zero to disable automatic
38123812 expediting.
38133813
3814+ stack_guard_gap= [MM]
3815+ override the default stack gap protection. The value
3816+ is in page units and it defines how many pages prior
3817+ to (for stacks growing down) resp. after (for stacks
3818+ growing up) the main stack are reserved for no other
3819+ mapping. Default value is 256 pages.
3820+
38143821 stacktrace [FTRACE]
38153822 Enabled the stack tracer on boot up.
38163823
Documentation/devicetree/bindings/clock/sunxi-ccu.txt+4−3
@@ -22,7 +22,8 @@ Required properties : · 21 unmodified lines
2222 - #clock-cells : must contain 1
2323 - #reset-cells : must contain 1
2424
25−For the PRCM CCUs on H3/A64, one more clock is needed:
25+For the PRCM CCUs on H3/A64, two more clocks are needed:
26+- "pll-periph": the SoC's peripheral PLL from the main CCU
2627 - "iosc": the SoC's internal frequency oscillator
2728
2829 Example for generic CCU:
@@ -39,8 +40,8 @@ Example for PRCM CCU: · 10 unmodified lines
3940 r_ccu: clock@01f01400 {
4041 compatible = "allwinner,sun50i-a64-r-ccu";
4142 reg = <0x01f01400 0x100>;
42− clocks = <&osc24M>, <&osc32k>, <&iosc>;
43− clock-names = "hosc", "losc", "iosc";
43+ clocks = <&osc24M>, <&osc32k>, <&iosc>, <&ccu CLK_PLL_PERIPH0>;
44+ clock-names = "hosc", "losc", "iosc", "pll-periph";
4445 #clock-cells = <1>;
4546 #reset-cells = <1>;
4647 };
Documentation/devicetree/bindings/gpio/gpio-mvebu.txt+3−3
@@ -41,9 +41,9 @@ Required properties: · 40 unmodified lines
4141 Optional properties:
4242
4343 In order to use the GPIO lines in PWM mode, some additional optional
44−properties are required. Only Armada 370 and XP support these properties.
44+properties are required.
4545
46−- compatible: Must contain "marvell,armada-370-xp-gpio"
46+- compatible: Must contain "marvell,armada-370-gpio"
4747
4848 - reg: an additional register set is needed, for the GPIO Blink
4949 Counter on/off registers.
@@ -71,7 +71,7 @@ Example: · 21 unmodified lines
7171 };
7272
7373 gpio1: gpio@18140 {
74− compatible = "marvell,armada-370-xp-gpio";
74+ compatible = "marvell,armada-370-gpio";
7575 reg = <0x18140 0x40>, <0x181c8 0x08>;
7676 reg-names = "gpio", "pwm";
7777 ngpios = <17>;
Documentation/devicetree/bindings/mfd/stm32-timers.txt+1−1
@@ -31,7 +31,7 @@ Example: · 30 unmodified lines
3131 compatible = "st,stm32-timers";
3232 reg = <0x40010000 0x400>;
3333 clocks = <&rcc 0 160>;
34− clock-names = "clk_int";
34+ clock-names = "int";
3535
3636 pwm {
3737 compatible = "st,stm32-pwm";
Documentation/devicetree/bindings/net/dsa/b53.txt+1−1
@@ -34,7 +34,7 @@ Required properties: · 33 unmodified lines
3434 "brcm,bcm6328-switch"
3535 "brcm,bcm6368-switch" and the mandatory "brcm,bcm63xx-switch"
3636
37−See Documentation/devicetree/bindings/dsa/dsa.txt for a list of additional
37+See Documentation/devicetree/bindings/net/dsa/dsa.txt for a list of additional
3838 required and optional properties.
3939
4040 Examples:
Documentation/devicetree/bindings/net/smsc911x.txt+1−0
@@ -27,6 +27,7 @@ Optional properties: · 26 unmodified lines
2727 of the device. On many systems this is wired high so the device goes
2828 out of reset at power-on, but if it is under program control, this
2929 optional GPIO can wake up in response to it.
30+- vdd33a-supply, vddvario-supply : 3.3V analog and IO logic power supplies
3031
3132 Examples:
3233
Documentation/networking/scaling.txt+1−1
@@ -122,7 +122,7 @@ associated flow of the packet. The hash is either provided by hardware · 121 unmodified lines
122122 or will be computed in the stack. Capable hardware can pass the hash in
123123 the receive descriptor for the packet; this would usually be the same
124124 hash used for RSS (e.g. computed Toeplitz hash). The hash is saved in
125−skb->rx_hash and can be used elsewhere in the stack as a hash of the
125+skb->hash and can be used elsewhere in the stack as a hash of the
126126 packet’s flow.
127127
128128 Each receive hardware queue has an associated list of CPUs to which
Makefile+2−2
@@ -1,7 +1,7 @@
11 VERSION = 4
22 PATCHLEVEL = 12
33 SUBLEVEL = 0
4−EXTRAVERSION = -rc5
4+EXTRAVERSION = -rc7
55 NAME = Fearless Coyote
66
77 # *DOCUMENTATION*
@@ -1437,7 +1437,7 @@ help: · 1429 unmodified lines
14371437 @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
14381438 @echo ' make V=2 [targets] 2 => give reason for rebuild of target'
14391439 @echo ' make O=dir [targets] Locate all output files in "dir", including .config'
1440− @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)'
1440+ @echo ' make C=1 [targets] Check re-compiled c source with $$CHECK (sparse by default)'
14411441 @echo ' make C=2 [targets] Force check of all c source with $$CHECK'
14421442 @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
14431443 @echo ' make W=n [targets] Enable extra gcc checks, n=1,2,3 where'
arch/arc/mm/mmap.c+1−1
@@ -65,7 +65,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, · 64 unmodified lines
6565
6666 vma = find_vma(mm, addr);
6767 if (TASK_SIZE - len >= addr &&
68− (!vma || addr + len <= vma->vm_start))
68+ (!vma || addr + len <= vm_start_gap(vma)))
6969 return addr;
7070 }
7171
arch/arm/boot/dts/am335x-sl50.dts+2−6
@@ -220,7 +220,7 @@ · 219 unmodified lines
220220
221221 mmc1_pins: pinmux_mmc1_pins {
222222 pinctrl-single,pins = <
223− AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE7) /* spi0_cs1.gpio0_6 */
223+ AM33XX_IOPAD(0x96c, PIN_INPUT | MUX_MODE7) /* uart0_rtsn.gpio1_9 */
224224 >;
225225 };
226226
@@ -280,10 +280,6 @@ · 53 unmodified lines
280280 AM33XX_IOPAD(0x834, PIN_INPUT_PULLUP | MUX_MODE7) /* nKbdReset - gpmc_ad13.gpio1_13 */
281281 AM33XX_IOPAD(0x838, PIN_INPUT_PULLUP | MUX_MODE7) /* nDispReset - gpmc_ad14.gpio1_14 */
282282 AM33XX_IOPAD(0x844, PIN_INPUT_PULLUP | MUX_MODE7) /* USB1_enPower - gpmc_a1.gpio1_17 */
283− /* AVR Programming - SPI Bus (bit bang) - Screen and Keyboard */
284− AM33XX_IOPAD(0x954, PIN_INPUT_PULLUP | MUX_MODE7) /* Kbd/Disp/BattMOSI spi0_d0.gpio0_3 */
285− AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE7) /* Kbd/Disp/BattMISO spi0_d1.gpio0_4 */
286− AM33XX_IOPAD(0x950, PIN_INPUT_PULLUP | MUX_MODE7) /* Kbd/Disp/BattSCLK spi0_clk.gpio0_2 */
287283 /* PDI Bus - Battery system */
288284 AM33XX_IOPAD(0x840, PIN_INPUT_PULLUP | MUX_MODE7) /* nBattReset gpmc_a0.gpio1_16 */
289285 AM33XX_IOPAD(0x83c, PIN_INPUT_PULLUP | MUX_MODE7) /* BattPDIData gpmc_ad15.gpio1_15 */
@@ -384,7 +380,7 @@ · 94 unmodified lines
384380 pinctrl-names = "default";
385381 pinctrl-0 = <&mmc1_pins>;
386382 bus-width = <4>;
387− cd-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
383+ cd-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
388384 vmmc-supply = <&vmmcsd_fixed>;
389385 };
390386
arch/arm/boot/dts/sunxi-h3-h5.dtsi+4−3
@@ -558,10 +558,11 @@ · 557 unmodified lines
558558 };
559559
560560 r_ccu: clock@1f01400 {
561− compatible = "allwinner,sun50i-a64-r-ccu";
561+ compatible = "allwinner,sun8i-h3-r-ccu";
562562 reg = <0x01f01400 0x100>;
563− clocks = <&osc24M>, <&osc32k>, <&iosc>;
564− clock-names = "hosc", "losc", "iosc";
563+ clocks = <&osc24M>, <&osc32k>, <&iosc>,
564+ <&ccu 9>;
565+ clock-names = "hosc", "losc", "iosc", "pll-periph";
565566 #clock-cells = <1>;
566567 #reset-cells = <1>;
567568 };
arch/arm/mm/mmap.c+2−2
@@ -90,7 +90,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, · 89 unmodified lines
9090
9191 vma = find_vma(mm, addr);
9292 if (TASK_SIZE - len >= addr &&
93− (!vma || addr + len <= vma->vm_start))
93+ (!vma || addr + len <= vm_start_gap(vma)))
9494 return addr;
9595 }
9696
@@ -141,7 +141,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 44 unmodified lines
141141 addr = PAGE_ALIGN(addr);
142142 vma = find_vma(mm, addr);
143143 if (TASK_SIZE - len >= addr &&
144− (!vma || addr + len <= vma->vm_start))
144+ (!vma || addr + len <= vm_start_gap(vma)))
145145 return addr;
146146 }
147147
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi+3−2
@@ -406,8 +406,9 @@ · 405 unmodified lines
406406 r_ccu: clock@1f01400 {
407407 compatible = "allwinner,sun50i-a64-r-ccu";
408408 reg = <0x01f01400 0x100>;
409− clocks = <&osc24M>, <&osc32k>, <&iosc>;
410− clock-names = "hosc", "losc", "iosc";
409+ clocks = <&osc24M>, <&osc32k>, <&iosc>,
410+ <&ccu 11>;
411+ clock-names = "hosc", "losc", "iosc", "pll-periph";
411412 #clock-cells = <1>;
412413 #reset-cells = <1>;
413414 };
arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi+1−1
@@ -40,7 +40,7 @@ · 39 unmodified lines
4040 * OTHER DEALINGS IN THE SOFTWARE.
4141 */
4242
43−#include "sunxi-h3-h5.dtsi"
43+#include <arm/sunxi-h3-h5.dtsi>
4444
4545 / {
4646 cpus {
arch/arm64/boot/dts/allwinner/sunxi-h3-h5.dtsi+0−1
@@ -1 +0,0 @@
1−../../../../arm/boot/dts/sunxi-h3-h5.dtsi
arch/arm64/kernel/vdso.c+3−2
@@ -221,10 +221,11 @@ void update_vsyscall(struct timekeeper *tk) · 220 unmodified lines
221221 /* tkr_mono.cycle_last == tkr_raw.cycle_last */
222222 vdso_data->cs_cycle_last = tk->tkr_mono.cycle_last;
223223 vdso_data->raw_time_sec = tk->raw_time.tv_sec;
224− vdso_data->raw_time_nsec = tk->raw_time.tv_nsec;
224+ vdso_data->raw_time_nsec = (tk->raw_time.tv_nsec <<
225+ tk->tkr_raw.shift) +
226+ tk->tkr_raw.xtime_nsec;
225227 vdso_data->xtime_clock_sec = tk->xtime_sec;
226228 vdso_data->xtime_clock_nsec = tk->tkr_mono.xtime_nsec;
227− /* tkr_raw.xtime_nsec == 0 */
228229 vdso_data->cs_mono_mult = tk->tkr_mono.mult;
229230 vdso_data->cs_raw_mult = tk->tkr_raw.mult;
230231 /* tkr_mono.shift == tkr_raw.shift */
arch/arm64/kernel/vdso/gettimeofday.S+0−1
@@ -256,7 +256,6 @@ monotonic_raw: · 255 unmodified lines
256256 seqcnt_check fail=monotonic_raw
257257
258258 /* All computations are done with left-shifted nsecs. */
259− lsl x14, x14, x12
260259 get_nsec_per_sec res=x9
261260 lsl x9, x9, x12
262261
arch/arm64/net/bpf_jit_comp.c+5−2
@@ -36,6 +36,7 @@ int bpf_jit_enable __read_mostly; · 35 unmodified lines
3636 #define TMP_REG_1 (MAX_BPF_JIT_REG + 0)
3737 #define TMP_REG_2 (MAX_BPF_JIT_REG + 1)
3838 #define TCALL_CNT (MAX_BPF_JIT_REG + 2)
39+#define TMP_REG_3 (MAX_BPF_JIT_REG + 3)
3940
4041 /* Map BPF registers to A64 registers */
4142 static const int bpf2a64[] = {
@@ -57,6 +58,7 @@ static const int bpf2a64[] = { · 15 unmodified lines
5758 /* temporary registers for internal BPF JIT */
5859 [TMP_REG_1] = A64_R(10),
5960 [TMP_REG_2] = A64_R(11),
61+ [TMP_REG_3] = A64_R(12),
6062 /* tail_call_cnt */
6163 [TCALL_CNT] = A64_R(26),
6264 /* temporary register for blinding constants */
@@ -319,6 +321,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx) · 256 unmodified lines
319321 const u8 src = bpf2a64[insn->src_reg];
320322 const u8 tmp = bpf2a64[TMP_REG_1];
321323 const u8 tmp2 = bpf2a64[TMP_REG_2];
324+ const u8 tmp3 = bpf2a64[TMP_REG_3];
322325 const s16 off = insn->off;
323326 const s32 imm = insn->imm;
324327 const int i = insn - ctx->prog->insnsi;
@@ -689,10 +692,10 @@ emit_cond_jmp: · 364 unmodified lines
689692 emit(A64_PRFM(tmp, PST, L1, STRM), ctx);
690693 emit(A64_LDXR(isdw, tmp2, tmp), ctx);
691694 emit(A64_ADD(isdw, tmp2, tmp2, src), ctx);
692− emit(A64_STXR(isdw, tmp2, tmp, tmp2), ctx);
695+ emit(A64_STXR(isdw, tmp2, tmp, tmp3), ctx);
693696 jmp_offset = -3;
694697 check_imm19(jmp_offset);
695− emit(A64_CBNZ(0, tmp2, jmp_offset), ctx);
698+ emit(A64_CBNZ(0, tmp3, jmp_offset), ctx);
696699 break;
697700
698701 /* R0 = ntohx(*(size *)(((struct sk_buff *)R6)->data + imm)) */
arch/frv/mm/elf-fdpic.c+1−1
@@ -75,7 +75,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi · 74 unmodified lines
7575 addr = PAGE_ALIGN(addr);
7676 vma = find_vma(current->mm, addr);
7777 if (TASK_SIZE - len >= addr &&
78− (!vma || addr + len <= vma->vm_start))
78+ (!vma || addr + len <= vm_start_gap(vma)))
7979 goto success;
8080 }
8181
arch/mips/boot/Makefile+5−5
@@ -128,19 +128,19 @@ quiet_cmd_cpp_its_S = ITS $@ · 127 unmodified lines
128128 -DADDR_BITS=$(ADDR_BITS) \
129129 -DADDR_CELLS=$(itb_addr_cells)
130130
131−$(obj)/vmlinux.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE
131+$(obj)/vmlinux.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE
132132 $(call if_changed_dep,cpp_its_S,none,vmlinux.bin)
133133
134−$(obj)/vmlinux.gz.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE
134+$(obj)/vmlinux.gz.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE
135135 $(call if_changed_dep,cpp_its_S,gzip,vmlinux.bin.gz)
136136
137−$(obj)/vmlinux.bz2.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE
137+$(obj)/vmlinux.bz2.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE
138138 $(call if_changed_dep,cpp_its_S,bzip2,vmlinux.bin.bz2)
139139
140−$(obj)/vmlinux.lzma.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE
140+$(obj)/vmlinux.lzma.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE
141141 $(call if_changed_dep,cpp_its_S,lzma,vmlinux.bin.lzma)
142142
143−$(obj)/vmlinux.lzo.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE
143+$(obj)/vmlinux.lzo.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE
144144 $(call if_changed_dep,cpp_its_S,lzo,vmlinux.bin.lzo)
145145
146146 quiet_cmd_itb-image = ITB $@
arch/mips/include/asm/highmem.h+5−0
@@ -35,7 +35,12 @@ extern pte_t *pkmap_page_table; · 34 unmodified lines
3535 * easily, subsequent pte tables have to be allocated in one physical
3636 * chunk of RAM.
3737 */
38+#ifdef CONFIG_PHYS_ADDR_T_64BIT
39+#define LAST_PKMAP 512
40+#else
3841 #define LAST_PKMAP 1024
42+#endif
43+
3944 #define LAST_PKMAP_MASK (LAST_PKMAP-1)
4045 #define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT)
4146 #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
arch/mips/include/asm/kprobes.h+2−1
@@ -43,7 +43,8 @@ typedef union mips_instruction kprobe_opcode_t; · 42 unmodified lines
4343
4444 #define flush_insn_slot(p) \
4545 do { \
46− flush_icache_range((unsigned long)p->addr, \
46+ if (p->addr) \
47+ flush_icache_range((unsigned long)p->addr, \
4748 (unsigned long)p->addr + \
4849 (MAX_INSN_SIZE * sizeof(kprobe_opcode_t))); \
4950 } while (0)
arch/mips/include/asm/pgtable-32.h+6−1
@@ -19,6 +19,10 @@ · 18 unmodified lines
1919 #define __ARCH_USE_5LEVEL_HACK
2020 #include <asm-generic/pgtable-nopmd.h>
2121
22+#ifdef CONFIG_HIGHMEM
23+#include <asm/highmem.h>
24+#endif
25+
2226 extern int temp_tlb_entry;
2327
2428 /*
@@ -62,7 +66,8 @@ extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1, · 37 unmodified lines
6266
6367 #define VMALLOC_START MAP_BASE
6468
65−#define PKMAP_BASE (0xfe000000UL)
69+#define PKMAP_END ((FIXADDR_START) & ~((LAST_PKMAP << PAGE_SHIFT)-1))
70+#define PKMAP_BASE (PKMAP_END - PAGE_SIZE * LAST_PKMAP)
6671
6772 #ifdef CONFIG_HIGHMEM
6873 # define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE)
arch/mips/kernel/branch.c+3−1
@@ -804,8 +804,10 @@ int __compute_return_epc_for_insn(struct pt_regs *regs, · 803 unmodified lines
804804 break;
805805 }
806806 /* Compact branch: BNEZC || JIALC */
807− if (insn.i_format.rs)
807+ if (!insn.i_format.rs) {
808+ /* JIALC: set $31/ra */
808809 regs->regs[31] = epc + 4;
810+ }
809811 regs->cp0_epc += 8;
810812 break;
811813 #endif
arch/mips/kernel/ftrace.c+5−19
@@ -38,20 +38,6 @@ void arch_ftrace_update_code(int command) · 37 unmodified lines
3838
3939 #endif
4040
41−/*
42− * Check if the address is in kernel space
43− *
44− * Clone core_kernel_text() from kernel/extable.c, but doesn't call
45− * init_kernel_text() for Ftrace doesn't trace functions in init sections.
46− */
47−static inline int in_kernel_space(unsigned long ip)
48−{
49− if (ip >= (unsigned long)_stext &&
50− ip <= (unsigned long)_etext)
51− return 1;
52− return 0;
53−}
54−
5541 #ifdef CONFIG_DYNAMIC_FTRACE
5642
5743 #define JAL 0x0c000000 /* jump & link: ip --> ra, jump to target */
@@ -198,7 +184,7 @@ int ftrace_make_nop(struct module *mod, · 140 unmodified lines
198184 * If ip is in kernel space, no long call, otherwise, long call is
199185 * needed.
200186 */
201− new = in_kernel_space(ip) ? INSN_NOP : INSN_B_1F;
187+ new = core_kernel_text(ip) ? INSN_NOP : INSN_B_1F;
202188 #ifdef CONFIG_64BIT
203189 return ftrace_modify_code(ip, new);
204190 #else
@@ -218,12 +204,12 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) · 13 unmodified lines
218204 unsigned int new;
219205 unsigned long ip = rec->ip;
220206
221− new = in_kernel_space(ip) ? insn_jal_ftrace_caller : insn_la_mcount[0];
207+ new = core_kernel_text(ip) ? insn_jal_ftrace_caller : insn_la_mcount[0];
222208
223209 #ifdef CONFIG_64BIT
224210 return ftrace_modify_code(ip, new);
225211 #else
226− return ftrace_modify_code_2r(ip, new, in_kernel_space(ip) ?
212+ return ftrace_modify_code_2r(ip, new, core_kernel_text(ip) ?
227213 INSN_NOP : insn_la_mcount[1]);
228214 #endif
229215 }
@@ -289,7 +275,7 @@ unsigned long ftrace_get_parent_ra_addr(unsigned long self_ra, unsigned long · 59 unmodified lines
289275 * instruction "lui v1, hi_16bit_of_mcount"(offset is 24), but for
290276 * kernel, move after the instruction "move ra, at"(offset is 16)
291277 */
292− ip = self_ra - (in_kernel_space(self_ra) ? 16 : 24);
278+ ip = self_ra - (core_kernel_text(self_ra) ? 16 : 24);
293279
294280 /*
295281 * search the text until finding the non-store instruction or "s{d,w}
@@ -394,7 +380,7 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra, · 98 unmodified lines
394380 * entries configured through the tracing/set_graph_function interface.
395381 */
396382
397− insns = in_kernel_space(self_ra) ? 2 : MCOUNT_OFFSET_INSNS + 1;
383+ insns = core_kernel_text(self_ra) ? 2 : MCOUNT_OFFSET_INSNS + 1;
398384 trace.func = self_ra - (MCOUNT_INSN_SIZE * insns);
399385
400386 /* Only trace if the calling function expects to */
arch/mips/kernel/perf_event_mipsxx.c+5−1
@@ -1597,7 +1597,6 @@ static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config) · 1596 unmodified lines
15971597 break;
15981598 case CPU_P5600:
15991599 case CPU_P6600:
1600− case CPU_I6400:
16011600 /* 8-bit event numbers */
16021601 raw_id = config & 0x1ff;
16031602 base_id = raw_id & 0xff;
@@ -1610,6 +1609,11 @@ static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config) · 6 unmodified lines
16101609 raw_event.range = P;
16111610 #endif
16121611 break;
1612+ case CPU_I6400:
1613+ /* 8-bit event numbers */
1614+ base_id = config & 0xff;
1615+ raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD;
1616+ break;
16131617 case CPU_1004K:
16141618 if (IS_BOTH_COUNTERS_1004K_EVENT(base_id))
16151619 raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD;
arch/mips/kvm/tlb.c+5−1
@@ -166,7 +166,11 @@ static int _kvm_mips_host_tlb_inv(unsigned long entryhi) · 165 unmodified lines
166166 int kvm_mips_host_tlb_inv(struct kvm_vcpu *vcpu, unsigned long va,
167167 bool user, bool kernel)
168168 {
169− int idx_user, idx_kernel;
169+ /*
170+ * Initialize idx_user and idx_kernel to workaround bogus
171+ * maybe-initialized warning when using GCC 6.
172+ */
173+ int idx_user = 0, idx_kernel = 0;
170174 unsigned long flags, old_entryhi;
171175
172176 local_irq_save(flags);
arch/mips/mm/mmap.c+1−1
@@ -93,7 +93,7 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp, · 92 unmodified lines
9393
9494 vma = find_vma(mm, addr);
9595 if (TASK_SIZE - len >= addr &&
96− (!vma || addr + len <= vma->vm_start))
96+ (!vma || addr + len <= vm_start_gap(vma)))
9797 return addr;
9898 }
9999
arch/mips/mm/pgtable-32.c+3−3
@@ -51,15 +51,15 @@ void __init pagetable_init(void) · 50 unmodified lines
5151 /*
5252 * Fixed mappings:
5353 */
54− vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
55− fixrange_init(vaddr, vaddr + FIXADDR_SIZE, pgd_base);
54+ vaddr = __fix_to_virt(__end_of_fixed_addresses - 1);
55+ fixrange_init(vaddr & PMD_MASK, vaddr + FIXADDR_SIZE, pgd_base);
5656
5757 #ifdef CONFIG_HIGHMEM
5858 /*
5959 * Permanent kmaps:
6060 */
6161 vaddr = PKMAP_BASE;
62− fixrange_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base);
62+ fixrange_init(vaddr & PMD_MASK, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base);
6363
6464 pgd = swapper_pg_dir + __pgd_offset(vaddr);
6565 pud = pud_offset(pgd, vaddr);
arch/parisc/kernel/sys_parisc.c+9−6
@@ -90,7 +90,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, · 89 unmodified lines
9090 unsigned long len, unsigned long pgoff, unsigned long flags)
9191 {
9292 struct mm_struct *mm = current->mm;
93− struct vm_area_struct *vma;
93+ struct vm_area_struct *vma, *prev;
9494 unsigned long task_size = TASK_SIZE;
9595 int do_color_align, last_mmap;
9696 struct vm_unmapped_area_info info;
@@ -117,9 +117,10 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, · 20 unmodified lines
117117 else
118118 addr = PAGE_ALIGN(addr);
119119
120− vma = find_vma(mm, addr);
120+ vma = find_vma_prev(mm, addr, &prev);
121121 if (task_size - len >= addr &&
122− (!vma || addr + len <= vma->vm_start))
122+ (!vma || addr + len <= vm_start_gap(vma)) &&
123+ (!prev || addr >= vm_end_gap(prev)))
123124 goto found_addr;
124125 }
125126
@@ -143,7 +144,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 17 unmodified lines
143144 const unsigned long len, const unsigned long pgoff,
144145 const unsigned long flags)
145146 {
146− struct vm_area_struct *vma;
147+ struct vm_area_struct *vma, *prev;
147148 struct mm_struct *mm = current->mm;
148149 unsigned long addr = addr0;
149150 int do_color_align, last_mmap;
@@ -177,9 +178,11 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 27 unmodified lines
177178 addr = COLOR_ALIGN(addr, last_mmap, pgoff);
178179 else
179180 addr = PAGE_ALIGN(addr);
180− vma = find_vma(mm, addr);
181+
182+ vma = find_vma_prev(mm, addr, &prev);
181183 if (TASK_SIZE - len >= addr &&
182− (!vma || addr + len <= vma->vm_start))
184+ (!vma || addr + len <= vm_start_gap(vma)) &&
185+ (!prev || addr >= vm_end_gap(prev)))
183186 goto found_addr;
184187 }
185188
arch/powerpc/include/asm/bug.h+1−1
@@ -104,7 +104,7 @@ · 103 unmodified lines
104104 "1: "PPC_TLNEI" %4,0\n" \
105105 _EMIT_BUG_ENTRY \
106106 : : "i" (__FILE__), "i" (__LINE__), \
107− "i" (BUGFLAG_TAINT(TAINT_WARN)), \
107+ "i" (BUGFLAG_WARNING|BUGFLAG_TAINT(TAINT_WARN)),\
108108 "i" (sizeof(struct bug_entry)), \
109109 "r" (__ret_warn_on)); \
110110 } \
arch/powerpc/include/asm/kprobes.h+1−0
@@ -103,6 +103,7 @@ extern int kprobe_exceptions_notify(struct notifier_block *self, · 102 unmodified lines
103103 extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
104104 extern int kprobe_handler(struct pt_regs *regs);
105105 extern int kprobe_post_handler(struct pt_regs *regs);
106+extern int is_current_kprobe_addr(unsigned long addr);
106107 #ifdef CONFIG_KPROBES_ON_FTRACE
107108 extern int skip_singlestep(struct kprobe *p, struct pt_regs *regs,
108109 struct kprobe_ctlblk *kcb);
arch/powerpc/include/asm/xive.h+7−5
@@ -94,11 +94,13 @@ struct xive_q { · 93 unmodified lines
9494 * store at 0 and some ESBs support doing a trigger via a
9595 * separate trigger page.
9696 */
97−#define XIVE_ESB_GET 0x800
98−#define XIVE_ESB_SET_PQ_00 0xc00
99−#define XIVE_ESB_SET_PQ_01 0xd00
100−#define XIVE_ESB_SET_PQ_10 0xe00
101−#define XIVE_ESB_SET_PQ_11 0xf00
97+#define XIVE_ESB_STORE_EOI 0x400 /* Store */
98+#define XIVE_ESB_LOAD_EOI 0x000 /* Load */
99+#define XIVE_ESB_GET 0x800 /* Load */
100+#define XIVE_ESB_SET_PQ_00 0xc00 /* Load */
101+#define XIVE_ESB_SET_PQ_01 0xd00 /* Load */
102+#define XIVE_ESB_SET_PQ_10 0xe00 /* Load */
103+#define XIVE_ESB_SET_PQ_11 0xf00 /* Load */
102104
103105 #define XIVE_ESB_VAL_P 0x2
104106 #define XIVE_ESB_VAL_Q 0x1
arch/powerpc/kernel/exceptions-64s.S+7−4
@@ -1411,10 +1411,8 @@ USE_TEXT_SECTION() · 1410 unmodified lines
14111411 .balign IFETCH_ALIGN_BYTES
14121412 do_hash_page:
14131413 #ifdef CONFIG_PPC_STD_MMU_64
1414− andis. r0,r4,0xa410 /* weird error? */
1414+ andis. r0,r4,0xa450 /* weird error? */
14151415 bne- handle_page_fault /* if not, try to insert a HPTE */
1416− andis. r0,r4,DSISR_DABRMATCH@h
1417− bne- handle_dabr_fault
14181416 CURRENT_THREAD_INFO(r11, r1)
14191417 lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */
14201418 andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */
@@ -1438,11 +1436,16 @@ do_hash_page: · 17 unmodified lines
14381436
14391437 /* Error */
14401438 blt- 13f
1439+
1440+ /* Reload DSISR into r4 for the DABR check below */
1441+ ld r4,_DSISR(r1)
14411442 #endif /* CONFIG_PPC_STD_MMU_64 */
14421443
14431444 /* Here we have a page fault that hash_page can't handle. */
14441445 handle_page_fault:
1445−11: ld r4,_DAR(r1)
1446+11: andis. r0,r4,DSISR_DABRMATCH@h
1447+ bne- handle_dabr_fault
1448+ ld r4,_DAR(r1)
14461449 ld r5,_DSISR(r1)
14471450 addi r3,r1,STACK_FRAME_OVERHEAD
14481451 bl do_page_fault
arch/powerpc/kernel/kprobes.c+17−0
@@ -43,6 +43,12 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); · 42 unmodified lines
4343
4444 struct kretprobe_blackpoint kretprobe_blacklist[] = {{NULL, NULL}};
4545
46+int is_current_kprobe_addr(unsigned long addr)
47+{
48+ struct kprobe *p = kprobe_running();
49+ return (p && (unsigned long)p->addr == addr) ? 1 : 0;
50+}
51+
4652 bool arch_within_kprobe_blacklist(unsigned long addr)
4753 {
4854 return (addr >= (unsigned long)__kprobes_text_start &&
@@ -617,6 +623,15 @@ int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) · 568 unmodified lines
617623 regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc);
618624 #endif
619625
626+ /*
627+ * jprobes use jprobe_return() which skips the normal return
628+ * path of the function, and this messes up the accounting of the
629+ * function graph tracer.
630+ *
631+ * Pause function graph tracing while performing the jprobe function.
632+ */
633+ pause_graph_tracing();
634+
620635 return 1;
621636 }
622637 NOKPROBE_SYMBOL(setjmp_pre_handler);
@@ -642,6 +657,8 @@ int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) · 19 unmodified lines
642657 * saved regs...
643658 */
644659 memcpy(regs, &kcb->jprobe_saved_regs, sizeof(struct pt_regs));
660+ /* It's OK to start function graph tracing again */
661+ unpause_graph_tracing();
645662 preempt_enable_no_resched();
646663 return 1;
647664 }
arch/powerpc/kernel/setup_64.c+28−3
@@ -615,6 +615,24 @@ void __init exc_lvl_early_init(void) · 614 unmodified lines
615615 }
616616 #endif
617617
618+/*
619+ * Emergency stacks are used for a range of things, from asynchronous
620+ * NMIs (system reset, machine check) to synchronous, process context.
621+ * We set preempt_count to zero, even though that isn't necessarily correct. To
622+ * get the right value we'd need to copy it from the previous thread_info, but
623+ * doing that might fault causing more problems.
624+ * TODO: what to do with accounting?
625+ */
626+static void emerg_stack_init_thread_info(struct thread_info *ti, int cpu)
627+{
628+ ti->task = NULL;
629+ ti->cpu = cpu;
630+ ti->preempt_count = 0;
631+ ti->local_flags = 0;
632+ ti->flags = 0;
633+ klp_init_thread_info(ti);
634+}
635+
618636 /*
619637 * Stack space used when we detect a bad kernel stack pointer, and
620638 * early in SMP boots before relocation is enabled. Exclusive emergency
@@ -633,24 +651,31 @@ void __init emergency_stack_init(void) · 12 unmodified lines
633651 * Since we use these as temporary stacks during secondary CPU
634652 * bringup, we need to get at them in real mode. This means they
635653 * must also be within the RMO region.
654+ *
655+ * The IRQ stacks allocated elsewhere in this file are zeroed and
656+ * initialized in kernel/irq.c. These are initialized here in order
657+ * to have emergency stacks available as early as possible.
636658 */
637659 limit = min(safe_stack_limit(), ppc64_rma_size);
638660
639661 for_each_possible_cpu(i) {
640662 struct thread_info *ti;
641663 ti = __va(memblock_alloc_base(THREAD_SIZE, THREAD_SIZE, limit));
642− klp_init_thread_info(ti);
664+ memset(ti, 0, THREAD_SIZE);
665+ emerg_stack_init_thread_info(ti, i);
643666 paca[i].emergency_sp = (void *)ti + THREAD_SIZE;
644667
645668 #ifdef CONFIG_PPC_BOOK3S_64
646669 /* emergency stack for NMI exception handling. */
647670 ti = __va(memblock_alloc_base(THREAD_SIZE, THREAD_SIZE, limit));
648− klp_init_thread_info(ti);
671+ memset(ti, 0, THREAD_SIZE);
672+ emerg_stack_init_thread_info(ti, i);
649673 paca[i].nmi_emergency_sp = (void *)ti + THREAD_SIZE;
650674
651675 /* emergency stack for machine check exception handling. */
652676 ti = __va(memblock_alloc_base(THREAD_SIZE, THREAD_SIZE, limit));
653− klp_init_thread_info(ti);
677+ memset(ti, 0, THREAD_SIZE);
678+ emerg_stack_init_thread_info(ti, i);
654679 paca[i].mc_emergency_sp = (void *)ti + THREAD_SIZE;
655680 #endif
656681 }
arch/powerpc/kernel/trace/ftrace_64_mprofile.S+46−13
@@ -45,10 +45,14 @@ _GLOBAL(ftrace_caller) · 44 unmodified lines
4545 stdu r1,-SWITCH_FRAME_SIZE(r1)
4646
4747 /* Save all gprs to pt_regs */
48− SAVE_8GPRS(0,r1)
49− SAVE_8GPRS(8,r1)
50− SAVE_8GPRS(16,r1)
51− SAVE_8GPRS(24,r1)
48+ SAVE_GPR(0, r1)
49+ SAVE_10GPRS(2, r1)
50+ SAVE_10GPRS(12, r1)
51+ SAVE_10GPRS(22, r1)
52+
53+ /* Save previous stack pointer (r1) */
54+ addi r8, r1, SWITCH_FRAME_SIZE
55+ std r8, GPR1(r1)
5256
5357 /* Load special regs for save below */
5458 mfmsr r8
@@ -95,18 +99,44 @@ ftrace_call: · 40 unmodified lines
9599 bl ftrace_stub
96100 nop
97101
98− /* Load ctr with the possibly modified NIP */
99− ld r3, _NIP(r1)
100− mtctr r3
102+ /* Load the possibly modified NIP */
103+ ld r15, _NIP(r1)
104+
101105 #ifdef CONFIG_LIVEPATCH
102− cmpd r14,r3 /* has NIP been altered? */
106+ cmpd r14, r15 /* has NIP been altered? */
107+#endif
108+
109+#if defined(CONFIG_LIVEPATCH) && defined(CONFIG_KPROBES_ON_FTRACE)
110+ /* NIP has not been altered, skip over further checks */
111+ beq 1f
112+
113+ /* Check if there is an active kprobe on us */
114+ subi r3, r14, 4
115+ bl is_current_kprobe_addr
116+ nop
117+
118+ /*
119+ * If r3 == 1, then this is a kprobe/jprobe.
120+ * else, this is livepatched function.
121+ *
122+ * The conditional branch for livepatch_handler below will use the
123+ * result of this comparison. For kprobe/jprobe, we just need to branch to
124+ * the new NIP, not call livepatch_handler. The branch below is bne, so we
125+ * want CR0[EQ] to be true if this is a kprobe/jprobe. Which means we want
126+ * CR0[EQ] = (r3 == 1).
127+ */
128+ cmpdi r3, 1
129+1:
103130 #endif
104131
132+ /* Load CTR with the possibly modified NIP */
133+ mtctr r15
134+
105135 /* Restore gprs */
106− REST_8GPRS(0,r1)
107− REST_8GPRS(8,r1)
108− REST_8GPRS(16,r1)
109− REST_8GPRS(24,r1)
136+ REST_GPR(0,r1)
137+ REST_10GPRS(2,r1)
138+ REST_10GPRS(12,r1)
139+ REST_10GPRS(22,r1)
110140
111141 /* Restore possibly modified LR */
112142 ld r0, _LINK(r1)
@@ -119,7 +149,10 @@ ftrace_call: · 6 unmodified lines
119149 addi r1, r1, SWITCH_FRAME_SIZE
120150
121151 #ifdef CONFIG_LIVEPATCH
122− /* Based on the cmpd above, if the NIP was altered handle livepatch */
152+ /*
153+ * Based on the cmpd or cmpdi above, if the NIP was altered and we're
154+ * not on a kprobe/jprobe, then handle livepatch.
155+ */
123156 bne- livepatch_handler
124157 #endif
125158
arch/powerpc/kvm/book3s_hv.c+51−0
@@ -1486,6 +1486,14 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id, · 1485 unmodified lines
14861486 r = set_vpa(vcpu, &vcpu->arch.dtl, addr, len);
14871487 break;
14881488 case KVM_REG_PPC_TB_OFFSET:
1489+ /*
1490+ * POWER9 DD1 has an erratum where writing TBU40 causes
1491+ * the timebase to lose ticks. So we don't let the
1492+ * timebase offset be changed on P9 DD1. (It is
1493+ * initialized to zero.)
1494+ */
1495+ if (cpu_has_feature(CPU_FTR_POWER9_DD1))
1496+ break;
14891497 /* round up to multiple of 2^24 */
14901498 vcpu->arch.vcore->tb_offset =
14911499 ALIGN(set_reg_val(id, *val), 1UL << 24);
@@ -2907,12 +2915,36 @@ static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu) · 1415 unmodified lines
29072915 {
29082916 int r;
29092917 int srcu_idx;
2918+ unsigned long ebb_regs[3] = {}; /* shut up GCC */
2919+ unsigned long user_tar = 0;
2920+ unsigned int user_vrsave;
29102921
29112922 if (!vcpu->arch.sane) {
29122923 run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
29132924 return -EINVAL;
29142925 }
29152926
2927+ /*
2928+ * Don't allow entry with a suspended transaction, because
2929+ * the guest entry/exit code will lose it.
2930+ * If the guest has TM enabled, save away their TM-related SPRs
2931+ * (they will get restored by the TM unavailable interrupt).
2932+ */
2933+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
2934+ if (cpu_has_feature(CPU_FTR_TM) && current->thread.regs &&
2935+ (current->thread.regs->msr & MSR_TM)) {
2936+ if (MSR_TM_ACTIVE(current->thread.regs->msr)) {
2937+ run->exit_reason = KVM_EXIT_FAIL_ENTRY;
2938+ run->fail_entry.hardware_entry_failure_reason = 0;
2939+ return -EINVAL;
2940+ }
2941+ current->thread.tm_tfhar = mfspr(SPRN_TFHAR);
2942+ current->thread.tm_tfiar = mfspr(SPRN_TFIAR);
2943+ current->thread.tm_texasr = mfspr(SPRN_TEXASR);
2944+ current->thread.regs->msr &= ~MSR_TM;
2945+ }
2946+#endif
2947+
29162948 kvmppc_core_prepare_to_enter(vcpu);
29172949
29182950 /* No need to go into the guest when all we'll do is come back out */
@@ -2934,6 +2966,15 @@ static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu) · 15 unmodified lines
29342966
29352967 flush_all_to_thread(current);
29362968
2969+ /* Save userspace EBB and other register values */
2970+ if (cpu_has_feature(CPU_FTR_ARCH_207S)) {
2971+ ebb_regs[0] = mfspr(SPRN_EBBHR);
2972+ ebb_regs[1] = mfspr(SPRN_EBBRR);
2973+ ebb_regs[2] = mfspr(SPRN_BESCR);
2974+ user_tar = mfspr(SPRN_TAR);
2975+ }
2976+ user_vrsave = mfspr(SPRN_VRSAVE);
2977+
29372978 vcpu->arch.wqp = &vcpu->arch.vcore->wq;
29382979 vcpu->arch.pgdir = current->mm->pgd;
29392980 vcpu->arch.state = KVMPPC_VCPU_BUSY_IN_HOST;
@@ -2960,6 +3001,16 @@ static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu) · 20 unmodified lines
29603001 }
29613002 } while (is_kvmppc_resume_guest(r));
29623003
3004+ /* Restore userspace EBB and other register values */
3005+ if (cpu_has_feature(CPU_FTR_ARCH_207S)) {
3006+ mtspr(SPRN_EBBHR, ebb_regs[0]);
3007+ mtspr(SPRN_EBBRR, ebb_regs[1]);
3008+ mtspr(SPRN_BESCR, ebb_regs[2]);
3009+ mtspr(SPRN_TAR, user_tar);
3010+ mtspr(SPRN_FSCR, current->thread.fscr);
3011+ }
3012+ mtspr(SPRN_VRSAVE, user_vrsave);
3013+
29633014 out:
29643015 vcpu->arch.state = KVMPPC_VCPU_NOTREADY;
29653016 atomic_dec(&vcpu->kvm->arch.vcpus_running);
arch/powerpc/kvm/book3s_hv_interrupts.S+11−1
@@ -121,10 +121,20 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) · 120 unmodified lines
121121 * Put whatever is in the decrementer into the
122122 * hypervisor decrementer.
123123 */
124+BEGIN_FTR_SECTION
125+ ld r5, HSTATE_KVM_VCORE(r13)
126+ ld r6, VCORE_KVM(r5)
127+ ld r9, KVM_HOST_LPCR(r6)
128+ andis. r9, r9, LPCR_LD@h
129+END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
124130 mfspr r8,SPRN_DEC
125131 mftb r7
126− mtspr SPRN_HDEC,r8
132+BEGIN_FTR_SECTION
133+ /* On POWER9, don't sign-extend if host LPCR[LD] bit is set */
134+ bne 32f
135+END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
127136 extsw r8,r8
137+32: mtspr SPRN_HDEC,r8
128138 add r8,r8,r7
129139 std r8,HSTATE_DECEXP(r13)
130140
arch/powerpc/kvm/book3s_hv_rmhandlers.S+56−19
@@ -32,12 +32,29 @@ · 31 unmodified lines
3232 #include <asm/opal.h>
3333 #include <asm/xive-regs.h>
3434
35+/* Sign-extend HDEC if not on POWER9 */
36+#define EXTEND_HDEC(reg) \
37+BEGIN_FTR_SECTION; \
38+ extsw reg, reg; \
39+END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_300)
40+
3541 #define VCPU_GPRS_TM(reg) (((reg) * ULONG_SIZE) + VCPU_GPR_TM)
3642
3743 /* Values in HSTATE_NAPPING(r13) */
3844 #define NAPPING_CEDE 1
3945 #define NAPPING_NOVCPU 2
4046
47+/* Stack frame offsets for kvmppc_hv_entry */
48+#define SFS 144
49+#define STACK_SLOT_TRAP (SFS-4)
50+#define STACK_SLOT_TID (SFS-16)
51+#define STACK_SLOT_PSSCR (SFS-24)
52+#define STACK_SLOT_PID (SFS-32)
53+#define STACK_SLOT_IAMR (SFS-40)
54+#define STACK_SLOT_CIABR (SFS-48)
55+#define STACK_SLOT_DAWR (SFS-56)
56+#define STACK_SLOT_DAWRX (SFS-64)
57+
4158 /*
4259 * Call kvmppc_hv_entry in real mode.
4360 * Must be called with interrupts hard-disabled.
@@ -214,6 +231,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) · 170 unmodified lines
214231 kvmppc_primary_no_guest:
215232 /* We handle this much like a ceded vcpu */
216233 /* put the HDEC into the DEC, since HDEC interrupts don't wake us */
234+ /* HDEC may be larger than DEC for arch >= v3.00, but since the */
235+ /* HDEC value came from DEC in the first place, it will fit */
217236 mfspr r3, SPRN_HDEC
218237 mtspr SPRN_DEC, r3
219238 /*
@@ -295,8 +314,9 @@ kvm_novcpu_wakeup: · 75 unmodified lines
295314
296315 /* See if our timeslice has expired (HDEC is negative) */
297316 mfspr r0, SPRN_HDEC
317+ EXTEND_HDEC(r0)
298318 li r12, BOOK3S_INTERRUPT_HV_DECREMENTER
299− cmpwi r0, 0
319+ cmpdi r0, 0
300320 blt kvm_novcpu_exit
301321
302322 /* Got an IPI but other vcpus aren't yet exiting, must be a latecomer */
@@ -319,10 +339,10 @@ kvm_novcpu_exit: · 16 unmodified lines
319339 bl kvmhv_accumulate_time
320340 #endif
321341 13: mr r3, r12
322− stw r12, 112-4(r1)
342+ stw r12, STACK_SLOT_TRAP(r1)
323343 bl kvmhv_commence_exit
324344 nop
325− lwz r12, 112-4(r1)
345+ lwz r12, STACK_SLOT_TRAP(r1)
326346 b kvmhv_switch_to_host
327347
328348 /*
@@ -390,8 +410,8 @@ kvm_secondary_got_guest: · 61 unmodified lines
390410 lbz r4, HSTATE_PTID(r13)
391411 cmpwi r4, 0
392412 bne 63f
393− lis r6, 0x7fff
394− ori r6, r6, 0xffff
413+ LOAD_REG_ADDR(r6, decrementer_max)
414+ ld r6, 0(r6)
395415 mtspr SPRN_HDEC, r6
396416 /* and set per-LPAR registers, if doing dynamic micro-threading */
397417 ld r6, HSTATE_SPLIT_MODE(r13)
@@ -545,11 +565,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) · 147 unmodified lines
545565 * *
546566 *****************************************************************************/
547567
548−/* Stack frame offsets */
549−#define STACK_SLOT_TID (112-16)
550−#define STACK_SLOT_PSSCR (112-24)
551−#define STACK_SLOT_PID (112-32)
552−
553568 .global kvmppc_hv_entry
554569 kvmppc_hv_entry:
555570
@@ -565,7 +580,7 @@ kvmppc_hv_entry: · 9 unmodified lines
565580 */
566581 mflr r0
567582 std r0, PPC_LR_STKOFF(r1)
568− stdu r1, -112(r1)
583+ stdu r1, -SFS(r1)
569584
570585 /* Save R1 in the PACA */
571586 std r1, HSTATE_HOST_R1(r13)
@@ -749,10 +764,20 @@ BEGIN_FTR_SECTION · 177 unmodified lines
749764 mfspr r5, SPRN_TIDR
750765 mfspr r6, SPRN_PSSCR
751766 mfspr r7, SPRN_PID
767+ mfspr r8, SPRN_IAMR
752768 std r5, STACK_SLOT_TID(r1)
753769 std r6, STACK_SLOT_PSSCR(r1)
754770 std r7, STACK_SLOT_PID(r1)
771+ std r8, STACK_SLOT_IAMR(r1)
755772 END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
773+BEGIN_FTR_SECTION
774+ mfspr r5, SPRN_CIABR
775+ mfspr r6, SPRN_DAWR
776+ mfspr r7, SPRN_DAWRX
777+ std r5, STACK_SLOT_CIABR(r1)
778+ std r6, STACK_SLOT_DAWR(r1)
779+ std r7, STACK_SLOT_DAWRX(r1)
780+END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
756781
757782 BEGIN_FTR_SECTION
758783 /* Set partition DABR */
@@ -968,7 +993,8 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_300) · 209 unmodified lines
968993
969994 /* Check if HDEC expires soon */
970995 mfspr r3, SPRN_HDEC
971− cmpwi r3, 512 /* 1 microsecond */
996+ EXTEND_HDEC(r3)
997+ cmpdi r3, 512 /* 1 microsecond */
972998 blt hdec_soon
973999
9741000 #ifdef CONFIG_KVM_XICS
@@ -1505,11 +1531,10 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_300) · 530 unmodified lines
15051531 * set by the guest could disrupt the host.
15061532 */
15071533 li r0, 0
1508− mtspr SPRN_IAMR, r0
1509− mtspr SPRN_CIABR, r0
1510− mtspr SPRN_DAWRX, r0
1534+ mtspr SPRN_PSPB, r0
15111535 mtspr SPRN_WORT, r0
15121536 BEGIN_FTR_SECTION
1537+ mtspr SPRN_IAMR, r0
15131538 mtspr SPRN_TCSCR, r0
15141539 /* Set MMCRS to 1<<31 to freeze and disable the SPMC counters */
15151540 li r0, 1
@@ -1525,6 +1550,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_300) · 9 unmodified lines
15251550 std r6,VCPU_UAMOR(r9)
15261551 li r6,0
15271552 mtspr SPRN_AMR,r6
1553+ mtspr SPRN_UAMOR, r6
15281554
15291555 /* Switch DSCR back to host value */
15301556 mfspr r8, SPRN_DSCR
@@ -1669,13 +1695,23 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) · 138 unmodified lines
16691695 ptesync
16701696
16711697 /* Restore host values of some registers */
1698+BEGIN_FTR_SECTION
1699+ ld r5, STACK_SLOT_CIABR(r1)
1700+ ld r6, STACK_SLOT_DAWR(r1)
1701+ ld r7, STACK_SLOT_DAWRX(r1)
1702+ mtspr SPRN_CIABR, r5
1703+ mtspr SPRN_DAWR, r6
1704+ mtspr SPRN_DAWRX, r7
1705+END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
16721706 BEGIN_FTR_SECTION
16731707 ld r5, STACK_SLOT_TID(r1)
16741708 ld r6, STACK_SLOT_PSSCR(r1)
16751709 ld r7, STACK_SLOT_PID(r1)
1710+ ld r8, STACK_SLOT_IAMR(r1)
16761711 mtspr SPRN_TIDR, r5
16771712 mtspr SPRN_PSSCR, r6
16781713 mtspr SPRN_PID, r7
1714+ mtspr SPRN_IAMR, r8
16791715 END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
16801716 BEGIN_FTR_SECTION
16811717 PPC_INVALIDATE_ERAT
@@ -1819,8 +1855,8 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_RADIX) · 137 unmodified lines
18191855 li r0, KVM_GUEST_MODE_NONE
18201856 stb r0, HSTATE_IN_GUEST(r13)
18211857
1822− ld r0, 112+PPC_LR_STKOFF(r1)
1823− addi r1, r1, 112
1858+ ld r0, SFS+PPC_LR_STKOFF(r1)
1859+ addi r1, r1, SFS
18241860 mtlr r0
18251861 blr
18261862
@@ -2366,12 +2402,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_TM) · 539 unmodified lines
23662402 mfspr r3, SPRN_DEC
23672403 mfspr r4, SPRN_HDEC
23682404 mftb r5
2369− cmpw r3, r4
2405+ extsw r3, r3
2406+ EXTEND_HDEC(r4)
2407+ cmpd r3, r4
23702408 ble 67f
23712409 mtspr SPRN_DEC, r4
23722410 67:
23732411 /* save expiry time of guest decrementer */
2374− extsw r3, r3
23752412 add r3, r3, r5
23762413 ld r4, HSTATE_KVM_VCPU(r13)
23772414 ld r5, HSTATE_KVM_VCORE(r13)
arch/powerpc/kvm/book3s_xive_template.c+2−2
@@ -69,7 +69,7 @@ static void GLUE(X_PFX,source_eoi)(u32 hw_irq, struct xive_irq_data *xd) · 68 unmodified lines
6969 {
7070 /* If the XIVE supports the new "store EOI facility, use it */
7171 if (xd->flags & XIVE_IRQ_FLAG_STORE_EOI)
72− __x_writeq(0, __x_eoi_page(xd));
72+ __x_writeq(0, __x_eoi_page(xd) + XIVE_ESB_STORE_EOI);
7373 else if (hw_irq && xd->flags & XIVE_IRQ_FLAG_EOI_FW) {
7474 opal_int_eoi(hw_irq);
7575 } else {
@@ -89,7 +89,7 @@ static void GLUE(X_PFX,source_eoi)(u32 hw_irq, struct xive_irq_data *xd) · 13 unmodified lines
8989 * properly.
9090 */
9191 if (xd->flags & XIVE_IRQ_FLAG_LSI)
92− __x_readq(__x_eoi_page(xd));
92+ __x_readq(__x_eoi_page(xd) + XIVE_ESB_LOAD_EOI);
9393 else {
9494 eoi_val = GLUE(X_PFX,esb_load)(xd, XIVE_ESB_SET_PQ_00);
9595
arch/powerpc/mm/hugetlbpage-radix.c+1−1
@@ -68,7 +68,7 @@ radix__hugetlb_get_unmapped_area(struct file *file, unsigned long addr, · 67 unmodified lines
6868 addr = ALIGN(addr, huge_page_size(h));
6969 vma = find_vma(mm, addr);
7070 if (mm->task_size - len >= addr &&
71− (!vma || addr + len <= vma->vm_start))
71+ (!vma || addr + len <= vm_start_gap(vma)))
7272 return addr;
7373 }
7474 /*
arch/powerpc/mm/mmap.c+2−2
@@ -112,7 +112,7 @@ radix__arch_get_unmapped_area(struct file *filp, unsigned long addr, · 111 unmodified lines
112112 addr = PAGE_ALIGN(addr);
113113 vma = find_vma(mm, addr);
114114 if (mm->task_size - len >= addr && addr >= mmap_min_addr &&
115− (!vma || addr + len <= vma->vm_start))
115+ (!vma || addr + len <= vm_start_gap(vma)))
116116 return addr;
117117 }
118118
@@ -157,7 +157,7 @@ radix__arch_get_unmapped_area_topdown(struct file *filp, · 38 unmodified lines
157157 addr = PAGE_ALIGN(addr);
158158 vma = find_vma(mm, addr);
159159 if (mm->task_size - len >= addr && addr >= mmap_min_addr &&
160− (!vma || addr + len <= vma->vm_start))
160+ (!vma || addr + len <= vm_start_gap(vma)))
161161 return addr;
162162 }
163163
arch/powerpc/mm/slice.c+1−1
@@ -99,7 +99,7 @@ static int slice_area_is_free(struct mm_struct *mm, unsigned long addr, · 98 unmodified lines
9999 if ((mm->task_size - len) < addr)
100100 return 0;
101101 vma = find_vma(mm, addr);
102− return (!vma || (addr + len) <= vma->vm_start);
102+ return (!vma || (addr + len) <= vm_start_gap(vma));
103103 }
104104
105105 static int slice_low_has_vma(struct mm_struct *mm, unsigned long slice)
arch/powerpc/perf/perf_regs.c+2−1
@@ -101,5 +101,6 @@ void perf_get_regs_user(struct perf_regs *regs_user, · 100 unmodified lines
101101 struct pt_regs *regs_user_copy)
102102 {
103103 regs_user->regs = task_pt_regs(current);
104− regs_user->abi = perf_reg_abi(current);
104+ regs_user->abi = (regs_user->regs) ? perf_reg_abi(current) :
105+ PERF_SAMPLE_REGS_ABI_NONE;
105106 }
arch/powerpc/platforms/powernv/npu-dma.c+67−30
@@ -75,7 +75,8 @@ struct pci_dev *pnv_pci_get_npu_dev(struct pci_dev *gpdev, int index) · 74 unmodified lines
7575 if (WARN_ON(!gpdev))
7676 return NULL;
7777
78− if (WARN_ON(!gpdev->dev.of_node))
78+ /* Not all PCI devices have device-tree nodes */
79+ if (!gpdev->dev.of_node)
7980 return NULL;
8081
8182 /* Get assoicated PCI device */
@@ -448,7 +449,7 @@ static int mmio_launch_invalidate(struct npu *npu, unsigned long launch, · 366 unmodified lines
448449 return mmio_atsd_reg;
449450 }
450451
451−static int mmio_invalidate_pid(struct npu *npu, unsigned long pid)
452+static int mmio_invalidate_pid(struct npu *npu, unsigned long pid, bool flush)
452453 {
453454 unsigned long launch;
454455
@@ -464,12 +465,15 @@ static int mmio_invalidate_pid(struct npu *npu, unsigned long pid) · 9 unmodified lines
464465 /* PID */
465466 launch |= pid << PPC_BITLSHIFT(38);
466467
468+ /* No flush */
469+ launch |= !flush << PPC_BITLSHIFT(39);
470+
467471 /* Invalidating the entire process doesn't use a va */
468472 return mmio_launch_invalidate(npu, launch, 0);
469473 }
470474
471475 static int mmio_invalidate_va(struct npu *npu, unsigned long va,
472− unsigned long pid)
476+ unsigned long pid, bool flush)
473477 {
474478 unsigned long launch;
475479
@@ -485,26 +489,60 @@ static int mmio_invalidate_va(struct npu *npu, unsigned long va, · 9 unmodified lines
485489 /* PID */
486490 launch |= pid << PPC_BITLSHIFT(38);
487491
492+ /* No flush */
493+ launch |= !flush << PPC_BITLSHIFT(39);
494+
488495 return mmio_launch_invalidate(npu, launch, va);
489496 }
490497
491498 #define mn_to_npu_context(x) container_of(x, struct npu_context, mn)
492499
500+struct mmio_atsd_reg {
501+ struct npu *npu;
502+ int reg;
503+};
504+
505+static void mmio_invalidate_wait(
506+ struct mmio_atsd_reg mmio_atsd_reg[NV_MAX_NPUS], bool flush)
507+{
508+ struct npu *npu;
509+ int i, reg;
510+
511+ /* Wait for all invalidations to complete */
512+ for (i = 0; i <= max_npu2_index; i++) {
513+ if (mmio_atsd_reg[i].reg < 0)
514+ continue;
515+
516+ /* Wait for completion */
517+ npu = mmio_atsd_reg[i].npu;
518+ reg = mmio_atsd_reg[i].reg;
519+ while (__raw_readq(npu->mmio_atsd_regs[reg] + XTS_ATSD_STAT))
520+ cpu_relax();
521+
522+ put_mmio_atsd_reg(npu, reg);
523+
524+ /*
525+ * The GPU requires two flush ATSDs to ensure all entries have
526+ * been flushed. We use PID 0 as it will never be used for a
527+ * process on the GPU.
528+ */
529+ if (flush)
530+ mmio_invalidate_pid(npu, 0, true);
531+ }
532+}
533+
493534 /*
494535 * Invalidate either a single address or an entire PID depending on
495536 * the value of va.
496537 */
497538 static void mmio_invalidate(struct npu_context *npu_context, int va,
498− unsigned long address)
539+ unsigned long address, bool flush)
499540 {
500− int i, j, reg;
541+ int i, j;
501542 struct npu *npu;
502543 struct pnv_phb *nphb;
503544 struct pci_dev *npdev;
504− struct {
505− struct npu *npu;
506− int reg;
507− } mmio_atsd_reg[NV_MAX_NPUS];
545+ struct mmio_atsd_reg mmio_atsd_reg[NV_MAX_NPUS];
508546 unsigned long pid = npu_context->mm->context.id;
509547
510548 /*
@@ -524,10 +562,11 @@ static void mmio_invalidate(struct npu_context *npu_context, int va, · 13 unmodified lines
524562
525563 if (va)
526564 mmio_atsd_reg[i].reg =
527− mmio_invalidate_va(npu, address, pid);
565+ mmio_invalidate_va(npu, address, pid,
566+ flush);
528567 else
529568 mmio_atsd_reg[i].reg =
530− mmio_invalidate_pid(npu, pid);
569+ mmio_invalidate_pid(npu, pid, flush);
531570
532571 /*
533572 * The NPU hardware forwards the shootdown to all GPUs
@@ -543,18 +582,10 @@ static void mmio_invalidate(struct npu_context *npu_context, int va, · 9 unmodified lines
543582 */
544583 flush_tlb_mm(npu_context->mm);
545584
546− /* Wait for all invalidations to complete */
547− for (i = 0; i <= max_npu2_index; i++) {
548− if (mmio_atsd_reg[i].reg < 0)
549− continue;
550−
551− /* Wait for completion */
552− npu = mmio_atsd_reg[i].npu;
553− reg = mmio_atsd_reg[i].reg;
554− while (__raw_readq(npu->mmio_atsd_regs[reg] + XTS_ATSD_STAT))
555− cpu_relax();
556− put_mmio_atsd_reg(npu, reg);
557− }
585+ mmio_invalidate_wait(mmio_atsd_reg, flush);
586+ if (flush)
587+ /* Wait for the flush to complete */
588+ mmio_invalidate_wait(mmio_atsd_reg, false);
558589 }
559590
560591 static void pnv_npu2_mn_release(struct mmu_notifier *mn,
@@ -570,7 +601,7 @@ static void pnv_npu2_mn_release(struct mmu_notifier *mn, · 9 unmodified lines
570601 * There should be no more translation requests for this PID, but we
571602 * need to ensure any entries for it are removed from the TLB.
572603 */
573− mmio_invalidate(npu_context, 0, 0);
604+ mmio_invalidate(npu_context, 0, 0, true);
574605 }
575606
576607 static void pnv_npu2_mn_change_pte(struct mmu_notifier *mn,
@@ -580,7 +611,7 @@ static void pnv_npu2_mn_change_pte(struct mmu_notifier *mn, · 3 unmodified lines
580611 {
581612 struct npu_context *npu_context = mn_to_npu_context(mn);
582613
583− mmio_invalidate(npu_context, 1, address);
614+ mmio_invalidate(npu_context, 1, address, true);
584615 }
585616
586617 static void pnv_npu2_mn_invalidate_page(struct mmu_notifier *mn,
@@ -589,7 +620,7 @@ static void pnv_npu2_mn_invalidate_page(struct mmu_notifier *mn, · 2 unmodified lines
589620 {
590621 struct npu_context *npu_context = mn_to_npu_context(mn);
591622
592− mmio_invalidate(npu_context, 1, address);
623+ mmio_invalidate(npu_context, 1, address, true);
593624 }
594625
595626 static void pnv_npu2_mn_invalidate_range(struct mmu_notifier *mn,
@@ -599,8 +630,11 @@ static void pnv_npu2_mn_invalidate_range(struct mmu_notifier *mn, · 3 unmodified lines
599630 struct npu_context *npu_context = mn_to_npu_context(mn);
600631 unsigned long address;
601632
602− for (address = start; address <= end; address += PAGE_SIZE)
603− mmio_invalidate(npu_context, 1, address);
633+ for (address = start; address < end; address += PAGE_SIZE)
634+ mmio_invalidate(npu_context, 1, address, false);
635+
636+ /* Do the flush only on the final addess == end */
637+ mmio_invalidate(npu_context, 1, address, true);
604638 }
605639
606640 static const struct mmu_notifier_ops nv_nmmu_notifier_ops = {
@@ -650,8 +684,11 @@ struct npu_context *pnv_npu2_init_context(struct pci_dev *gpdev, · 43 unmodified lines
650684 /* No nvlink associated with this GPU device */
651685 return ERR_PTR(-ENODEV);
652686
653− if (!mm) {
654− /* kernel thread contexts are not supported */
687+ if (!mm || mm->context.id == 0) {
688+ /*
689+ * Kernel thread contexts are not supported and context id 0 is
690+ * reserved on the GPU.
691+ */
655692 return ERR_PTR(-EINVAL);
656693 }
657694
arch/powerpc/sysdev/xive/common.c+1−1
@@ -297,7 +297,7 @@ void xive_do_source_eoi(u32 hw_irq, struct xive_irq_data *xd) · 296 unmodified lines
297297 {
298298 /* If the XIVE supports the new "store EOI facility, use it */
299299 if (xd->flags & XIVE_IRQ_FLAG_STORE_EOI)
300− out_be64(xd->eoi_mmio, 0);
300+ out_be64(xd->eoi_mmio + XIVE_ESB_STORE_EOI, 0);
301301 else if (hw_irq && xd->flags & XIVE_IRQ_FLAG_EOI_FW) {
302302 /*
303303 * The FW told us to call it. This happens for some
arch/s390/configs/default_defconfig+33−6
@@ -30,6 +30,7 @@ CONFIG_USER_NS=y · 29 unmodified lines
3030 CONFIG_SCHED_AUTOGROUP=y
3131 CONFIG_BLK_DEV_INITRD=y
3232 CONFIG_EXPERT=y
33+# CONFIG_SYSFS_SYSCALL is not set
3334 CONFIG_BPF_SYSCALL=y
3435 CONFIG_USERFAULTFD=y
3536 # CONFIG_COMPAT_BRK is not set
@@ -44,7 +45,10 @@ CONFIG_MODULE_UNLOAD=y · 8 unmodified lines
4445 CONFIG_MODULE_FORCE_UNLOAD=y
4546 CONFIG_MODVERSIONS=y
4647 CONFIG_MODULE_SRCVERSION_ALL=y
48+CONFIG_BLK_DEV_INTEGRITY=y
4749 CONFIG_BLK_DEV_THROTTLING=y
50+CONFIG_BLK_WBT=y
51+CONFIG_BLK_WBT_SQ=y
4852 CONFIG_PARTITION_ADVANCED=y
4953 CONFIG_IBM_PARTITION=y
5054 CONFIG_BSD_DISKLABEL=y
@@ -90,6 +94,8 @@ CONFIG_UNIX=y · 39 unmodified lines
9094 CONFIG_UNIX_DIAG=m
9195 CONFIG_XFRM_USER=m
9296 CONFIG_NET_KEY=m
97+CONFIG_SMC=m
98+CONFIG_SMC_DIAG=m
9399 CONFIG_INET=y
94100 CONFIG_IP_MULTICAST=y
95101 CONFIG_IP_ADVANCED_ROUTER=y
@@ -359,6 +365,7 @@ CONFIG_NET_ACT_SIMP=m · 263 unmodified lines
359365 CONFIG_NET_ACT_SKBEDIT=m
360366 CONFIG_NET_ACT_CSUM=m
361367 CONFIG_DNS_RESOLVER=y
368+CONFIG_NETLINK_DIAG=m
362369 CONFIG_CGROUP_NET_PRIO=y
363370 CONFIG_BPF_JIT=y
364371 CONFIG_NET_PKTGEN=m
@@ -367,16 +374,19 @@ CONFIG_DEVTMPFS=y · 2 unmodified lines
367374 CONFIG_DMA_CMA=y
368375 CONFIG_CMA_SIZE_MBYTES=0
369376 CONFIG_CONNECTOR=y
377+CONFIG_ZRAM=m
370378 CONFIG_BLK_DEV_LOOP=m
371379 CONFIG_BLK_DEV_CRYPTOLOOP=m
380+CONFIG_BLK_DEV_DRBD=m
372381 CONFIG_BLK_DEV_NBD=m
373382 CONFIG_BLK_DEV_OSD=m
374383 CONFIG_BLK_DEV_RAM=y
375384 CONFIG_BLK_DEV_RAM_SIZE=32768
376−CONFIG_CDROM_PKTCDVD=m
377−CONFIG_ATA_OVER_ETH=m
385+CONFIG_BLK_DEV_RAM_DAX=y
378386 CONFIG_VIRTIO_BLK=y
387+CONFIG_BLK_DEV_RBD=m
379388 CONFIG_ENCLOSURE_SERVICES=m
389+CONFIG_GENWQE=m
380390 CONFIG_RAID_ATTRS=m
381391 CONFIG_SCSI=y
382392 CONFIG_BLK_DEV_SD=y
@@ -442,6 +452,8 @@ CONFIG_NLMON=m · 59 unmodified lines
442452 # CONFIG_NET_VENDOR_INTEL is not set
443453 # CONFIG_NET_VENDOR_MARVELL is not set
444454 CONFIG_MLX4_EN=m
455+CONFIG_MLX5_CORE=m
456+CONFIG_MLX5_CORE_EN=y
445457 # CONFIG_NET_VENDOR_NATSEMI is not set
446458 CONFIG_PPP=m
447459 CONFIG_PPP_BSDCOMP=m
@@ -452,7 +464,6 @@ CONFIG_PPTP=m · 4 unmodified lines
452464 CONFIG_PPPOL2TP=m
453465 CONFIG_PPP_ASYNC=m
454466 CONFIG_PPP_SYNC_TTY=m
455−# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
456467 # CONFIG_INPUT_KEYBOARD is not set
457468 # CONFIG_INPUT_MOUSE is not set
458469 # CONFIG_SERIO is not set
@@ -471,6 +482,7 @@ CONFIG_DIAG288_WATCHDOG=m · 12 unmodified lines
471482 CONFIG_INFINIBAND=m
472483 CONFIG_INFINIBAND_USER_ACCESS=m
473484 CONFIG_MLX4_INFINIBAND=m
485+CONFIG_MLX5_INFINIBAND=m
474486 CONFIG_VIRTIO_BALLOON=m
475487 CONFIG_EXT4_FS=y
476488 CONFIG_EXT4_FS_POSIX_ACL=y
@@ -487,12 +499,18 @@ CONFIG_XFS_POSIX_ACL=y · 10 unmodified lines
487499 CONFIG_XFS_RT=y
488500 CONFIG_XFS_DEBUG=y
489501 CONFIG_GFS2_FS=m
502+CONFIG_GFS2_FS_LOCKING_DLM=y
490503 CONFIG_OCFS2_FS=m
491504 CONFIG_BTRFS_FS=y
492505 CONFIG_BTRFS_FS_POSIX_ACL=y
506+CONFIG_BTRFS_DEBUG=y
493507 CONFIG_NILFS2_FS=m
508+CONFIG_FS_DAX=y
509+CONFIG_EXPORTFS_BLOCK_OPS=y
494510 CONFIG_FANOTIFY=y
511+CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
495512 CONFIG_QUOTA_NETLINK_INTERFACE=y
513+CONFIG_QUOTA_DEBUG=y
496514 CONFIG_QFMT_V1=m
497515 CONFIG_QFMT_V2=m
498516 CONFIG_AUTOFS4_FS=m
@@ -558,6 +576,7 @@ CONFIG_HEADERS_CHECK=y · 59 unmodified lines
558576 CONFIG_DEBUG_SECTION_MISMATCH=y
559577 CONFIG_MAGIC_SYSRQ=y
560578 CONFIG_DEBUG_PAGEALLOC=y
579+CONFIG_DEBUG_RODATA_TEST=y
561580 CONFIG_DEBUG_OBJECTS=y
562581 CONFIG_DEBUG_OBJECTS_SELFTEST=y
563582 CONFIG_DEBUG_OBJECTS_FREE=y
@@ -580,7 +599,6 @@ CONFIG_DETECT_HUNG_TASK=y · 16 unmodified lines
580599 CONFIG_WQ_WATCHDOG=y
581600 CONFIG_PANIC_ON_OOPS=y
582601 CONFIG_DEBUG_TIMEKEEPING=y
583−CONFIG_TIMER_STATS=y
584602 CONFIG_DEBUG_RT_MUTEXES=y
585603 CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y
586604 CONFIG_PROVE_LOCKING=y
@@ -595,6 +613,7 @@ CONFIG_RCU_TORTURE_TEST=m · 8 unmodified lines
595613 CONFIG_RCU_CPU_STALL_TIMEOUT=300
596614 CONFIG_NOTIFIER_ERROR_INJECTION=m
597615 CONFIG_PM_NOTIFIER_ERROR_INJECT=m
616+CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m
598617 CONFIG_FAULT_INJECTION=y
599618 CONFIG_FAILSLAB=y
600619 CONFIG_FAIL_PAGE_ALLOC=y
@@ -616,13 +635,12 @@ CONFIG_HIST_TRIGGERS=y · 15 unmodified lines
616635 CONFIG_TRACE_ENUM_MAP_FILE=y
617636 CONFIG_LKDTM=m
618637 CONFIG_TEST_LIST_SORT=y
638+CONFIG_TEST_SORT=y
619639 CONFIG_KPROBES_SANITY_TEST=y
620640 CONFIG_RBTREE_TEST=y
621641 CONFIG_INTERVAL_TREE_TEST=m
622642 CONFIG_PERCPU_TEST=m
623643 CONFIG_ATOMIC64_SELFTEST=y
624−CONFIG_TEST_STRING_HELPERS=y
625−CONFIG_TEST_KSTRTOX=y
626644 CONFIG_DMA_API_DEBUG=y
627645 CONFIG_TEST_BPF=m
628646 CONFIG_BUG_ON_DATA_CORRUPTION=y
@@ -630,6 +648,7 @@ CONFIG_S390_PTDUMP=y · 1 unmodified line
630648 CONFIG_ENCRYPTED_KEYS=m
631649 CONFIG_SECURITY=y
632650 CONFIG_SECURITY_NETWORK=y
651+CONFIG_HARDENED_USERCOPY=y
633652 CONFIG_SECURITY_SELINUX=y
634653 CONFIG_SECURITY_SELINUX_BOOTPARAM=y
635654 CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0
@@ -640,7 +659,9 @@ CONFIG_CRYPTO_RSA=m · 4 unmodified lines
640659 CONFIG_CRYPTO_DH=m
641660 CONFIG_CRYPTO_ECDH=m
642661 CONFIG_CRYPTO_USER=m
662+CONFIG_CRYPTO_PCRYPT=m
643663 CONFIG_CRYPTO_CRYPTD=m
664+CONFIG_CRYPTO_MCRYPTD=m
644665 CONFIG_CRYPTO_TEST=m
645666 CONFIG_CRYPTO_CCM=m
646667 CONFIG_CRYPTO_GCM=m
@@ -648,6 +669,7 @@ CONFIG_CRYPTO_CHACHA20POLY1305=m · 1 unmodified line
648669 CONFIG_CRYPTO_LRW=m
649670 CONFIG_CRYPTO_PCBC=m
650671 CONFIG_CRYPTO_KEYWRAP=m
672+CONFIG_CRYPTO_CMAC=m
651673 CONFIG_CRYPTO_XCBC=m
652674 CONFIG_CRYPTO_VMAC=m
653675 CONFIG_CRYPTO_CRC32=m
@@ -657,8 +679,10 @@ CONFIG_CRYPTO_RMD160=m · 3 unmodified lines
657679 CONFIG_CRYPTO_RMD256=m
658680 CONFIG_CRYPTO_RMD320=m
659681 CONFIG_CRYPTO_SHA512=m
682+CONFIG_CRYPTO_SHA3=m
660683 CONFIG_CRYPTO_TGR192=m
661684 CONFIG_CRYPTO_WP512=m
685+CONFIG_CRYPTO_AES_TI=m
662686 CONFIG_CRYPTO_ANUBIS=m
663687 CONFIG_CRYPTO_BLOWFISH=m
664688 CONFIG_CRYPTO_CAMELLIA=m
@@ -674,6 +698,7 @@ CONFIG_CRYPTO_TWOFISH=m · 9 unmodified lines
674698 CONFIG_CRYPTO_842=m
675699 CONFIG_CRYPTO_LZ4=m
676700 CONFIG_CRYPTO_LZ4HC=m
701+CONFIG_CRYPTO_ANSI_CPRNG=m
677702 CONFIG_CRYPTO_USER_API_HASH=m
678703 CONFIG_CRYPTO_USER_API_SKCIPHER=m
679704 CONFIG_CRYPTO_USER_API_RNG=m
@@ -685,6 +710,7 @@ CONFIG_CRYPTO_SHA256_S390=m · 5 unmodified lines
685710 CONFIG_CRYPTO_SHA512_S390=m
686711 CONFIG_CRYPTO_DES_S390=m
687712 CONFIG_CRYPTO_AES_S390=m
713+CONFIG_CRYPTO_PAES_S390=m
688714 CONFIG_CRYPTO_GHASH_S390=m
689715 CONFIG_CRYPTO_CRC32_S390=y
690716 CONFIG_ASYMMETRIC_KEY_TYPE=y
@@ -692,6 +718,7 @@ CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m · 1 unmodified line
692718 CONFIG_X509_CERTIFICATE_PARSER=m
693719 CONFIG_CRC7=m
694720 CONFIG_CRC8=m
721+CONFIG_RANDOM32_SELFTEST=y
695722 CONFIG_CORDIC=m
696723 CONFIG_CMM=m
697724 CONFIG_APPLDATA_BASE=y
arch/s390/configs/gcov_defconfig+24−4
@@ -31,6 +31,7 @@ CONFIG_USER_NS=y · 30 unmodified lines
3131 CONFIG_SCHED_AUTOGROUP=y
3232 CONFIG_BLK_DEV_INITRD=y
3333 CONFIG_EXPERT=y
34+# CONFIG_SYSFS_SYSCALL is not set
3435 CONFIG_BPF_SYSCALL=y
3536 CONFIG_USERFAULTFD=y
3637 # CONFIG_COMPAT_BRK is not set
@@ -46,7 +47,10 @@ CONFIG_MODULE_UNLOAD=y · 9 unmodified lines
4647 CONFIG_MODULE_FORCE_UNLOAD=y
4748 CONFIG_MODVERSIONS=y
4849 CONFIG_MODULE_SRCVERSION_ALL=y
50+CONFIG_BLK_DEV_INTEGRITY=y
4951 CONFIG_BLK_DEV_THROTTLING=y
52+CONFIG_BLK_WBT=y
53+CONFIG_BLK_WBT_SQ=y
5054 CONFIG_PARTITION_ADVANCED=y
5155 CONFIG_IBM_PARTITION=y
5256 CONFIG_BSD_DISKLABEL=y
@@ -88,6 +92,8 @@ CONFIG_UNIX=y · 35 unmodified lines
8892 CONFIG_UNIX_DIAG=m
8993 CONFIG_XFRM_USER=m
9094 CONFIG_NET_KEY=m
95+CONFIG_SMC=m
96+CONFIG_SMC_DIAG=m
9197 CONFIG_INET=y
9298 CONFIG_IP_MULTICAST=y
9399 CONFIG_IP_ADVANCED_ROUTER=y
@@ -356,6 +362,7 @@ CONFIG_NET_ACT_SIMP=m · 262 unmodified lines
356362 CONFIG_NET_ACT_SKBEDIT=m
357363 CONFIG_NET_ACT_CSUM=m
358364 CONFIG_DNS_RESOLVER=y
365+CONFIG_NETLINK_DIAG=m
359366 CONFIG_CGROUP_NET_PRIO=y
360367 CONFIG_BPF_JIT=y
361368 CONFIG_NET_PKTGEN=m
@@ -364,16 +371,18 @@ CONFIG_DEVTMPFS=y · 2 unmodified lines
364371 CONFIG_DMA_CMA=y
365372 CONFIG_CMA_SIZE_MBYTES=0
366373 CONFIG_CONNECTOR=y
374+CONFIG_ZRAM=m
367375 CONFIG_BLK_DEV_LOOP=m
368376 CONFIG_BLK_DEV_CRYPTOLOOP=m
377+CONFIG_BLK_DEV_DRBD=m
369378 CONFIG_BLK_DEV_NBD=m
370379 CONFIG_BLK_DEV_OSD=m
371380 CONFIG_BLK_DEV_RAM=y
372381 CONFIG_BLK_DEV_RAM_SIZE=32768
373−CONFIG_CDROM_PKTCDVD=m
374−CONFIG_ATA_OVER_ETH=m
382+CONFIG_BLK_DEV_RAM_DAX=y
375383 CONFIG_VIRTIO_BLK=y
376384 CONFIG_ENCLOSURE_SERVICES=m
385+CONFIG_GENWQE=m
377386 CONFIG_RAID_ATTRS=m
378387 CONFIG_SCSI=y
379388 CONFIG_BLK_DEV_SD=y
@@ -439,6 +448,8 @@ CONFIG_NLMON=m · 59 unmodified lines
439448 # CONFIG_NET_VENDOR_INTEL is not set
440449 # CONFIG_NET_VENDOR_MARVELL is not set
441450 CONFIG_MLX4_EN=m
451+CONFIG_MLX5_CORE=m
452+CONFIG_MLX5_CORE_EN=y
442453 # CONFIG_NET_VENDOR_NATSEMI is not set
443454 CONFIG_PPP=m
444455 CONFIG_PPP_BSDCOMP=m
@@ -449,7 +460,6 @@ CONFIG_PPTP=m · 4 unmodified lines
449460 CONFIG_PPPOL2TP=m
450461 CONFIG_PPP_ASYNC=m
451462 CONFIG_PPP_SYNC_TTY=m
452−# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
453463 # CONFIG_INPUT_KEYBOARD is not set
454464 # CONFIG_INPUT_MOUSE is not set
455465 # CONFIG_SERIO is not set
@@ -468,6 +478,7 @@ CONFIG_DIAG288_WATCHDOG=m · 12 unmodified lines
468478 CONFIG_INFINIBAND=m
469479 CONFIG_INFINIBAND_USER_ACCESS=m
470480 CONFIG_MLX4_INFINIBAND=m
481+CONFIG_MLX5_INFINIBAND=m
471482 CONFIG_VIRTIO_BALLOON=m
472483 CONFIG_EXT4_FS=y
473484 CONFIG_EXT4_FS_POSIX_ACL=y
@@ -483,11 +494,15 @@ CONFIG_XFS_QUOTA=y · 9 unmodified lines
483494 CONFIG_XFS_POSIX_ACL=y
484495 CONFIG_XFS_RT=y
485496 CONFIG_GFS2_FS=m
497+CONFIG_GFS2_FS_LOCKING_DLM=y
486498 CONFIG_OCFS2_FS=m
487499 CONFIG_BTRFS_FS=y
488500 CONFIG_BTRFS_FS_POSIX_ACL=y
489501 CONFIG_NILFS2_FS=m
502+CONFIG_FS_DAX=y
503+CONFIG_EXPORTFS_BLOCK_OPS=y
490504 CONFIG_FANOTIFY=y
505+CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
491506 CONFIG_QUOTA_NETLINK_INTERFACE=y
492507 CONFIG_QFMT_V1=m
493508 CONFIG_QFMT_V2=m
@@ -553,7 +568,6 @@ CONFIG_UNUSED_SYMBOLS=y · 59 unmodified lines
553568 CONFIG_MAGIC_SYSRQ=y
554569 CONFIG_DEBUG_MEMORY_INIT=y
555570 CONFIG_PANIC_ON_OOPS=y
556−CONFIG_TIMER_STATS=y
557571 CONFIG_RCU_TORTURE_TEST=m
558572 CONFIG_RCU_CPU_STALL_TIMEOUT=60
559573 CONFIG_LATENCYTOP=y
@@ -576,6 +590,7 @@ CONFIG_BIG_KEYS=y · 16 unmodified lines
576590 CONFIG_ENCRYPTED_KEYS=m
577591 CONFIG_SECURITY=y
578592 CONFIG_SECURITY_NETWORK=y
593+CONFIG_HARDENED_USERCOPY=y
579594 CONFIG_SECURITY_SELINUX=y
580595 CONFIG_SECURITY_SELINUX_BOOTPARAM=y
581596 CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0
@@ -599,6 +614,7 @@ CONFIG_CRYPTO_CHACHA20POLY1305=m · 17 unmodified lines
599614 CONFIG_CRYPTO_LRW=m
600615 CONFIG_CRYPTO_PCBC=m
601616 CONFIG_CRYPTO_KEYWRAP=m
617+CONFIG_CRYPTO_CMAC=m
602618 CONFIG_CRYPTO_XCBC=m
603619 CONFIG_CRYPTO_VMAC=m
604620 CONFIG_CRYPTO_CRC32=m
@@ -611,6 +627,7 @@ CONFIG_CRYPTO_SHA512=m · 6 unmodified lines
611627 CONFIG_CRYPTO_SHA3=m
612628 CONFIG_CRYPTO_TGR192=m
613629 CONFIG_CRYPTO_WP512=m
630+CONFIG_CRYPTO_AES_TI=m
614631 CONFIG_CRYPTO_ANUBIS=m
615632 CONFIG_CRYPTO_BLOWFISH=m
616633 CONFIG_CRYPTO_CAMELLIA=m
@@ -626,16 +643,19 @@ CONFIG_CRYPTO_TWOFISH=m · 9 unmodified lines
626643 CONFIG_CRYPTO_842=m
627644 CONFIG_CRYPTO_LZ4=m
628645 CONFIG_CRYPTO_LZ4HC=m
646+CONFIG_CRYPTO_ANSI_CPRNG=m
629647 CONFIG_CRYPTO_USER_API_HASH=m
630648 CONFIG_CRYPTO_USER_API_SKCIPHER=m
631649 CONFIG_CRYPTO_USER_API_RNG=m
632650 CONFIG_CRYPTO_USER_API_AEAD=m
633651 CONFIG_ZCRYPT=m
652+CONFIG_PKEY=m
634653 CONFIG_CRYPTO_SHA1_S390=m
635654 CONFIG_CRYPTO_SHA256_S390=m
636655 CONFIG_CRYPTO_SHA512_S390=m
637656 CONFIG_CRYPTO_DES_S390=m
638657 CONFIG_CRYPTO_AES_S390=m
658+CONFIG_CRYPTO_PAES_S390=m
639659 CONFIG_CRYPTO_GHASH_S390=m
640660 CONFIG_CRYPTO_CRC32_S390=y
641661 CONFIG_CRC7=m
arch/s390/configs/performance_defconfig+23−4
@@ -31,6 +31,7 @@ CONFIG_USER_NS=y · 30 unmodified lines
3131 CONFIG_SCHED_AUTOGROUP=y
3232 CONFIG_BLK_DEV_INITRD=y
3333 CONFIG_EXPERT=y
34+# CONFIG_SYSFS_SYSCALL is not set
3435 CONFIG_BPF_SYSCALL=y
3536 CONFIG_USERFAULTFD=y
3637 # CONFIG_COMPAT_BRK is not set
@@ -44,7 +45,10 @@ CONFIG_MODULE_UNLOAD=y · 7 unmodified lines
4445 CONFIG_MODULE_FORCE_UNLOAD=y
4546 CONFIG_MODVERSIONS=y
4647 CONFIG_MODULE_SRCVERSION_ALL=y
48+CONFIG_BLK_DEV_INTEGRITY=y
4749 CONFIG_BLK_DEV_THROTTLING=y
50+CONFIG_BLK_WBT=y
51+CONFIG_BLK_WBT_SQ=y
4852 CONFIG_PARTITION_ADVANCED=y
4953 CONFIG_IBM_PARTITION=y
5054 CONFIG_BSD_DISKLABEL=y
@@ -86,6 +90,8 @@ CONFIG_UNIX=y · 35 unmodified lines
8690 CONFIG_UNIX_DIAG=m
8791 CONFIG_XFRM_USER=m
8892 CONFIG_NET_KEY=m
93+CONFIG_SMC=m
94+CONFIG_SMC_DIAG=m
8995 CONFIG_INET=y
9096 CONFIG_IP_MULTICAST=y
9197 CONFIG_IP_ADVANCED_ROUTER=y
@@ -354,6 +360,7 @@ CONFIG_NET_ACT_SIMP=m · 262 unmodified lines
354360 CONFIG_NET_ACT_SKBEDIT=m
355361 CONFIG_NET_ACT_CSUM=m
356362 CONFIG_DNS_RESOLVER=y
363+CONFIG_NETLINK_DIAG=m
357364 CONFIG_CGROUP_NET_PRIO=y
358365 CONFIG_BPF_JIT=y
359366 CONFIG_NET_PKTGEN=m
@@ -362,16 +369,18 @@ CONFIG_DEVTMPFS=y · 2 unmodified lines
362369 CONFIG_DMA_CMA=y
363370 CONFIG_CMA_SIZE_MBYTES=0
364371 CONFIG_CONNECTOR=y
372+CONFIG_ZRAM=m
365373 CONFIG_BLK_DEV_LOOP=m
366374 CONFIG_BLK_DEV_CRYPTOLOOP=m
375+CONFIG_BLK_DEV_DRBD=m
367376 CONFIG_BLK_DEV_NBD=m
368377 CONFIG_BLK_DEV_OSD=m
369378 CONFIG_BLK_DEV_RAM=y
370379 CONFIG_BLK_DEV_RAM_SIZE=32768
371−CONFIG_CDROM_PKTCDVD=m
372−CONFIG_ATA_OVER_ETH=m
380+CONFIG_BLK_DEV_RAM_DAX=y
373381 CONFIG_VIRTIO_BLK=y
374382 CONFIG_ENCLOSURE_SERVICES=m
383+CONFIG_GENWQE=m
375384 CONFIG_RAID_ATTRS=m
376385 CONFIG_SCSI=y
377386 CONFIG_BLK_DEV_SD=y
@@ -437,6 +446,8 @@ CONFIG_NLMON=m · 59 unmodified lines
437446 # CONFIG_NET_VENDOR_INTEL is not set
438447 # CONFIG_NET_VENDOR_MARVELL is not set
439448 CONFIG_MLX4_EN=m
449+CONFIG_MLX5_CORE=m
450+CONFIG_MLX5_CORE_EN=y
440451 # CONFIG_NET_VENDOR_NATSEMI is not set
441452 CONFIG_PPP=m
442453 CONFIG_PPP_BSDCOMP=m
@@ -447,7 +458,6 @@ CONFIG_PPTP=m · 4 unmodified lines
447458 CONFIG_PPPOL2TP=m
448459 CONFIG_PPP_ASYNC=m
449460 CONFIG_PPP_SYNC_TTY=m
450−# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
451461 # CONFIG_INPUT_KEYBOARD is not set
452462 # CONFIG_INPUT_MOUSE is not set
453463 # CONFIG_SERIO is not set
@@ -466,6 +476,7 @@ CONFIG_DIAG288_WATCHDOG=m · 12 unmodified lines
466476 CONFIG_INFINIBAND=m
467477 CONFIG_INFINIBAND_USER_ACCESS=m
468478 CONFIG_MLX4_INFINIBAND=m
479+CONFIG_MLX5_INFINIBAND=m
469480 CONFIG_VIRTIO_BALLOON=m
470481 CONFIG_EXT4_FS=y
471482 CONFIG_EXT4_FS_POSIX_ACL=y
@@ -481,11 +492,15 @@ CONFIG_XFS_QUOTA=y · 9 unmodified lines
481492 CONFIG_XFS_POSIX_ACL=y
482493 CONFIG_XFS_RT=y
483494 CONFIG_GFS2_FS=m
495+CONFIG_GFS2_FS_LOCKING_DLM=y
484496 CONFIG_OCFS2_FS=m
485497 CONFIG_BTRFS_FS=y
486498 CONFIG_BTRFS_FS_POSIX_ACL=y
487499 CONFIG_NILFS2_FS=m
500+CONFIG_FS_DAX=y
501+CONFIG_EXPORTFS_BLOCK_OPS=y
488502 CONFIG_FANOTIFY=y
503+CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
489504 CONFIG_QUOTA_NETLINK_INTERFACE=y
490505 CONFIG_QFMT_V1=m
491506 CONFIG_QFMT_V2=m
@@ -551,7 +566,6 @@ CONFIG_UNUSED_SYMBOLS=y · 59 unmodified lines
551566 CONFIG_MAGIC_SYSRQ=y
552567 CONFIG_DEBUG_MEMORY_INIT=y
553568 CONFIG_PANIC_ON_OOPS=y
554−CONFIG_TIMER_STATS=y
555569 CONFIG_RCU_TORTURE_TEST=m
556570 CONFIG_RCU_CPU_STALL_TIMEOUT=60
557571 CONFIG_LATENCYTOP=y
@@ -574,6 +588,7 @@ CONFIG_BIG_KEYS=y · 16 unmodified lines
574588 CONFIG_ENCRYPTED_KEYS=m
575589 CONFIG_SECURITY=y
576590 CONFIG_SECURITY_NETWORK=y
591+CONFIG_HARDENED_USERCOPY=y
577592 CONFIG_SECURITY_SELINUX=y
578593 CONFIG_SECURITY_SELINUX_BOOTPARAM=y
579594 CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0
@@ -597,6 +612,7 @@ CONFIG_CRYPTO_CHACHA20POLY1305=m · 17 unmodified lines
597612 CONFIG_CRYPTO_LRW=m
598613 CONFIG_CRYPTO_PCBC=m
599614 CONFIG_CRYPTO_KEYWRAP=m
615+CONFIG_CRYPTO_CMAC=m
600616 CONFIG_CRYPTO_XCBC=m
601617 CONFIG_CRYPTO_VMAC=m
602618 CONFIG_CRYPTO_CRC32=m
@@ -609,6 +625,7 @@ CONFIG_CRYPTO_SHA512=m · 6 unmodified lines
609625 CONFIG_CRYPTO_SHA3=m
610626 CONFIG_CRYPTO_TGR192=m
611627 CONFIG_CRYPTO_WP512=m
628+CONFIG_CRYPTO_AES_TI=m
612629 CONFIG_CRYPTO_ANUBIS=m
613630 CONFIG_CRYPTO_BLOWFISH=m
614631 CONFIG_CRYPTO_CAMELLIA=m
@@ -624,6 +641,7 @@ CONFIG_CRYPTO_TWOFISH=m · 9 unmodified lines
624641 CONFIG_CRYPTO_842=m
625642 CONFIG_CRYPTO_LZ4=m
626643 CONFIG_CRYPTO_LZ4HC=m
644+CONFIG_CRYPTO_ANSI_CPRNG=m
627645 CONFIG_CRYPTO_USER_API_HASH=m
628646 CONFIG_CRYPTO_USER_API_SKCIPHER=m
629647 CONFIG_CRYPTO_USER_API_RNG=m
@@ -635,6 +653,7 @@ CONFIG_CRYPTO_SHA256_S390=m · 5 unmodified lines
635653 CONFIG_CRYPTO_SHA512_S390=m
636654 CONFIG_CRYPTO_DES_S390=m
637655 CONFIG_CRYPTO_AES_S390=m
656+CONFIG_CRYPTO_PAES_S390=m
638657 CONFIG_CRYPTO_GHASH_S390=m
639658 CONFIG_CRYPTO_CRC32_S390=y
640659 CONFIG_CRC7=m
arch/s390/configs/zfcpdump_defconfig+4−2
@@ -12,8 +12,10 @@ CONFIG_TUNE_ZEC12=y · 11 unmodified lines
1212 CONFIG_NR_CPUS=2
1313 # CONFIG_HOTPLUG_CPU is not set
1414 CONFIG_HZ_100=y
15+# CONFIG_ARCH_RANDOM is not set
1516 # CONFIG_COMPACTION is not set
1617 # CONFIG_MIGRATION is not set
18+# CONFIG_BOUNCE is not set
1719 # CONFIG_CHECK_STACK is not set
1820 # CONFIG_CHSC_SCH is not set
1921 # CONFIG_SCM_BUS is not set
@@ -36,11 +38,11 @@ CONFIG_SCSI_CONSTANTS=y · 16 unmodified lines
3638 CONFIG_SCSI_LOGGING=y
3739 CONFIG_SCSI_FC_ATTRS=y
3840 CONFIG_ZFCP=y
39−# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
4041 # CONFIG_INPUT_KEYBOARD is not set
4142 # CONFIG_INPUT_MOUSE is not set
4243 # CONFIG_SERIO is not set
4344 # CONFIG_HVC_IUCV is not set
45+# CONFIG_HW_RANDOM_S390 is not set
4446 CONFIG_RAW_DRIVER=y
4547 # CONFIG_SCLP_ASYNC is not set
4648 # CONFIG_HMC_DRV is not set
@@ -54,9 +56,9 @@ CONFIG_RAW_DRIVER=y · 7 unmodified lines
5456 # CONFIG_INOTIFY_USER is not set
5557 CONFIG_CONFIGFS_FS=y
5658 # CONFIG_MISC_FILESYSTEMS is not set
59+# CONFIG_NETWORK_FILESYSTEMS is not set
5760 CONFIG_PRINTK_TIME=y
5861 CONFIG_DEBUG_INFO=y
59−CONFIG_DEBUG_FS=y
6062 CONFIG_DEBUG_KERNEL=y
6163 CONFIG_PANIC_ON_OOPS=y
6264 # CONFIG_SCHED_DEBUG is not set
arch/s390/defconfig+3−5
@@ -28,6 +28,7 @@ CONFIG_NAMESPACES=y · 27 unmodified lines
2828 CONFIG_USER_NS=y
2929 CONFIG_BLK_DEV_INITRD=y
3030 CONFIG_EXPERT=y
31+# CONFIG_SYSFS_SYSCALL is not set
3132 CONFIG_BPF_SYSCALL=y
3233 CONFIG_USERFAULTFD=y
3334 # CONFIG_COMPAT_BRK is not set
@@ -108,7 +109,6 @@ CONFIG_ZFCP=y · 74 unmodified lines
108109 CONFIG_SCSI_VIRTIO=y
109110 CONFIG_MD=y
110111 CONFIG_MD_LINEAR=m
111−CONFIG_MD_RAID0=m
112112 CONFIG_MD_MULTIPATH=m
113113 CONFIG_BLK_DEV_DM=y
114114 CONFIG_DM_CRYPT=m
@@ -131,6 +131,7 @@ CONFIG_TUN=m · 16 unmodified lines
131131 CONFIG_VIRTIO_NET=y
132132 # CONFIG_NET_VENDOR_ALACRITECH is not set
133133 # CONFIG_NET_VENDOR_SOLARFLARE is not set
134+# CONFIG_NET_VENDOR_SYNOPSYS is not set
134135 # CONFIG_INPUT is not set
135136 # CONFIG_SERIO is not set
136137 CONFIG_DEVKMEM=y
@@ -162,7 +163,6 @@ CONFIG_MAGIC_SYSRQ=y · 25 unmodified lines
162163 CONFIG_DEBUG_PAGEALLOC=y
163164 CONFIG_DETECT_HUNG_TASK=y
164165 CONFIG_PANIC_ON_OOPS=y
165−CONFIG_TIMER_STATS=y
166166 CONFIG_DEBUG_RT_MUTEXES=y
167167 CONFIG_PROVE_LOCKING=y
168168 CONFIG_LOCK_STAT=y
@@ -172,14 +172,12 @@ CONFIG_DEBUG_LIST=y · 3 unmodified lines
172172 CONFIG_DEBUG_SG=y
173173 CONFIG_DEBUG_NOTIFIERS=y
174174 CONFIG_RCU_CPU_STALL_TIMEOUT=60
175−CONFIG_RCU_TRACE=y
176175 CONFIG_LATENCYTOP=y
177176 CONFIG_SCHED_TRACER=y
178177 CONFIG_FTRACE_SYSCALLS=y
179178 CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y
180179 CONFIG_STACK_TRACER=y
181180 CONFIG_BLK_DEV_IO_TRACE=y
182−CONFIG_UPROBE_EVENTS=y
183181 CONFIG_FUNCTION_PROFILER=y
184182 CONFIG_TRACE_ENUM_MAP_FILE=y
185183 CONFIG_KPROBES_SANITY_TEST=y
@@ -190,7 +188,6 @@ CONFIG_CRYPTO_CCM=m · 4 unmodified lines
190188 CONFIG_CRYPTO_GCM=m
191189 CONFIG_CRYPTO_CBC=y
192190 CONFIG_CRYPTO_CTS=m
193−CONFIG_CRYPTO_ECB=m
194191 CONFIG_CRYPTO_LRW=m
195192 CONFIG_CRYPTO_PCBC=m
196193 CONFIG_CRYPTO_XTS=m
@@ -230,6 +227,7 @@ CONFIG_CRYPTO_USER_API_SKCIPHER=m · 33 unmodified lines
230227 CONFIG_CRYPTO_USER_API_RNG=m
231228 CONFIG_ZCRYPT=m
232229 CONFIG_PKEY=m
230+CONFIG_CRYPTO_PAES_S390=m
233231 CONFIG_CRYPTO_SHA1_S390=m
234232 CONFIG_CRYPTO_SHA256_S390=m
235233 CONFIG_CRYPTO_SHA512_S390=m
arch/s390/kernel/entry.S+13−6
@@ -231,12 +231,17 @@ ENTRY(sie64a) · 230 unmodified lines
231231 lctlg %c1,%c1,__LC_USER_ASCE # load primary asce
232232 .Lsie_done:
233233 # some program checks are suppressing. C code (e.g. do_protection_exception)
234−# will rewind the PSW by the ILC, which is 4 bytes in case of SIE. Other
235−# instructions between sie64a and .Lsie_done should not cause program
236−# interrupts. So lets use a nop (47 00 00 00) as a landing pad.
234+# will rewind the PSW by the ILC, which is often 4 bytes in case of SIE. There
235+# are some corner cases (e.g. runtime instrumentation) where ILC is unpredictable.
236+# Other instructions between sie64a and .Lsie_done should not cause program
237+# interrupts. So lets use 3 nops as a landing pad for all possible rewinds.
237238 # See also .Lcleanup_sie
238−.Lrewind_pad:
239− nop 0
239+.Lrewind_pad6:
240+ nopr 7
241+.Lrewind_pad4:
242+ nopr 7
243+.Lrewind_pad2:
244+ nopr 7
240245 .globl sie_exit
241246 sie_exit:
242247 lg %r14,__SF_EMPTY+8(%r15) # load guest register save area
@@ -249,7 +254,9 @@ sie_exit: · 6 unmodified lines
249254 stg %r14,__SF_EMPTY+16(%r15) # set exit reason code
250255 j sie_exit
251256
252− EX_TABLE(.Lrewind_pad,.Lsie_fault)
257+ EX_TABLE(.Lrewind_pad6,.Lsie_fault)
258+ EX_TABLE(.Lrewind_pad4,.Lsie_fault)
259+ EX_TABLE(.Lrewind_pad2,.Lsie_fault)
253260 EX_TABLE(sie_exit,.Lsie_fault)
254261 EXPORT_SYMBOL(sie64a)
255262 EXPORT_SYMBOL(sie_exit)
arch/s390/kvm/gaccess.c+6−9
@@ -977,11 +977,12 @@ static int kvm_s390_shadow_tables(struct gmap *sg, unsigned long saddr, · 976 unmodified lines
977977 ptr = asce.origin * 4096;
978978 if (asce.r) {
979979 *fake = 1;
980+ ptr = 0;
980981 asce.dt = ASCE_TYPE_REGION1;
981982 }
982983 switch (asce.dt) {
983984 case ASCE_TYPE_REGION1:
984− if (vaddr.rfx01 > asce.tl && !asce.r)
985+ if (vaddr.rfx01 > asce.tl && !*fake)
985986 return PGM_REGION_FIRST_TRANS;
986987 break;
987988 case ASCE_TYPE_REGION2:
@@ -1009,8 +1010,7 @@ static int kvm_s390_shadow_tables(struct gmap *sg, unsigned long saddr, · 21 unmodified lines
10091010 union region1_table_entry rfte;
10101011
10111012 if (*fake) {
1012− /* offset in 16EB guest memory block */
1013− ptr = ptr + ((unsigned long) vaddr.rsx << 53UL);
1013+ ptr += (unsigned long) vaddr.rfx << 53;
10141014 rfte.val = ptr;
10151015 goto shadow_r2t;
10161016 }
@@ -1036,8 +1036,7 @@ shadow_r2t: · 19 unmodified lines
10361036 union region2_table_entry rste;
10371037
10381038 if (*fake) {
1039− /* offset in 8PB guest memory block */
1040− ptr = ptr + ((unsigned long) vaddr.rtx << 42UL);
1039+ ptr += (unsigned long) vaddr.rsx << 42;
10411040 rste.val = ptr;
10421041 goto shadow_r3t;
10431042 }
@@ -1064,8 +1063,7 @@ shadow_r3t: · 20 unmodified lines
10641063 union region3_table_entry rtte;
10651064
10661065 if (*fake) {
1067− /* offset in 4TB guest memory block */
1068− ptr = ptr + ((unsigned long) vaddr.sx << 31UL);
1066+ ptr += (unsigned long) vaddr.rtx << 31;
10691067 rtte.val = ptr;
10701068 goto shadow_sgt;
10711069 }
@@ -1101,8 +1099,7 @@ shadow_sgt: · 29 unmodified lines
11011099 union segment_table_entry ste;
11021100
11031101 if (*fake) {
1104− /* offset in 2G guest memory block */
1105− ptr = ptr + ((unsigned long) vaddr.sx << 20UL);
1102+ ptr += (unsigned long) vaddr.sx << 20;
11061103 ste.val = ptr;
11071104 goto shadow_pgt;
11081105 }
arch/s390/mm/mmap.c+2−2
@@ -101,7 +101,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, · 100 unmodified lines
101101 addr = PAGE_ALIGN(addr);
102102 vma = find_vma(mm, addr);
103103 if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
104− (!vma || addr + len <= vma->vm_start))
104+ (!vma || addr + len <= vm_start_gap(vma)))
105105 goto check_asce_limit;
106106 }
107107
@@ -151,7 +151,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 43 unmodified lines
151151 addr = PAGE_ALIGN(addr);
152152 vma = find_vma(mm, addr);
153153 if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
154− (!vma || addr + len <= vma->vm_start))
154+ (!vma || addr + len <= vm_start_gap(vma)))
155155 goto check_asce_limit;
156156 }
157157
arch/sh/mm/mmap.c+2−2
@@ -64,7 +64,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, · 63 unmodified lines
6464
6565 vma = find_vma(mm, addr);
6666 if (TASK_SIZE - len >= addr &&
67− (!vma || addr + len <= vma->vm_start))
67+ (!vma || addr + len <= vm_start_gap(vma)))
6868 return addr;
6969 }
7070
@@ -114,7 +114,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 43 unmodified lines
114114
115115 vma = find_vma(mm, addr);
116116 if (TASK_SIZE - len >= addr &&
117− (!vma || addr + len <= vma->vm_start))
117+ (!vma || addr + len <= vm_start_gap(vma)))
118118 return addr;
119119 }
120120
arch/sparc/kernel/sys_sparc_64.c+2−2
@@ -120,7 +120,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi · 119 unmodified lines
120120
121121 vma = find_vma(mm, addr);
122122 if (task_size - len >= addr &&
123− (!vma || addr + len <= vma->vm_start))
123+ (!vma || addr + len <= vm_start_gap(vma)))
124124 return addr;
125125 }
126126
@@ -183,7 +183,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 56 unmodified lines
183183
184184 vma = find_vma(mm, addr);
185185 if (task_size - len >= addr &&
186− (!vma || addr + len <= vma->vm_start))
186+ (!vma || addr + len <= vm_start_gap(vma)))
187187 return addr;
188188 }
189189
arch/sparc/mm/hugetlbpage.c+1−1
@@ -120,7 +120,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, · 119 unmodified lines
120120 addr = ALIGN(addr, huge_page_size(h));
121121 vma = find_vma(mm, addr);
122122 if (task_size - len >= addr &&
123− (!vma || addr + len <= vma->vm_start))
123+ (!vma || addr + len <= vm_start_gap(vma)))
124124 return addr;
125125 }
126126 if (mm->get_unmapped_area == arch_get_unmapped_area)
arch/tile/mm/hugetlbpage.c+1−1
@@ -233,7 +233,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, · 232 unmodified lines
233233 addr = ALIGN(addr, huge_page_size(h));
234234 vma = find_vma(mm, addr);
235235 if (TASK_SIZE - len >= addr &&
236− (!vma || addr + len <= vma->vm_start))
236+ (!vma || addr + len <= vm_start_gap(vma)))
237237 return addr;
238238 }
239239 if (current->mm->get_unmapped_area == arch_get_unmapped_area)
arch/x86/events/intel/core.c+2−2
@@ -431,11 +431,11 @@ static __initconst const u64 skl_hw_cache_event_ids · 430 unmodified lines
431431 [ C(DTLB) ] = {
432432 [ C(OP_READ) ] = {
433433 [ C(RESULT_ACCESS) ] = 0x81d0, /* MEM_INST_RETIRED.ALL_LOADS */
434− [ C(RESULT_MISS) ] = 0x608, /* DTLB_LOAD_MISSES.WALK_COMPLETED */
434+ [ C(RESULT_MISS) ] = 0xe08, /* DTLB_LOAD_MISSES.WALK_COMPLETED */
435435 },
436436 [ C(OP_WRITE) ] = {
437437 [ C(RESULT_ACCESS) ] = 0x82d0, /* MEM_INST_RETIRED.ALL_STORES */
438− [ C(RESULT_MISS) ] = 0x649, /* DTLB_STORE_MISSES.WALK_COMPLETED */
438+ [ C(RESULT_MISS) ] = 0xe49, /* DTLB_STORE_MISSES.WALK_COMPLETED */
439439 },
440440 [ C(OP_PREFETCH) ] = {
441441 [ C(RESULT_ACCESS) ] = 0x0,
arch/x86/include/asm/extable.h+1−0
@@ -29,6 +29,7 @@ struct pt_regs; · 28 unmodified lines
2929 } while (0)
3030
3131 extern int fixup_exception(struct pt_regs *regs, int trapnr);
32+extern int fixup_bug(struct pt_regs *regs, int trapnr);
3233 extern bool ex_has_fault_handler(unsigned long ip);
3334 extern void early_fixup_exception(struct pt_regs *regs, int trapnr);
3435
arch/x86/include/asm/kvm_emulate.h+1−0
@@ -296,6 +296,7 @@ struct x86_emulate_ctxt { · 295 unmodified lines
296296
297297 bool perm_ok; /* do not check permissions if true */
298298 bool ud; /* inject an #UD if host doesn't support insn */
299+ bool tf; /* TF value before instruction (after for syscall/sysret) */
299300
300301 bool have_exception;
301302 struct x86_exception exception;
arch/x86/include/asm/mshyperv.h+1−2
@@ -2,8 +2,7 @@ · 1 unmodified line
22 #define _ASM_X86_MSHYPER_H
33
44 #include <linux/types.h>
5−#include <linux/interrupt.h>
6−#include <linux/clocksource.h>
5+#include <linux/atomic.h>
76 #include <asm/hyperv.h>
87
98 /*
arch/x86/kernel/sys_x86_64.c+2−2
@@ -144,7 +144,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, · 143 unmodified lines
144144 addr = PAGE_ALIGN(addr);
145145 vma = find_vma(mm, addr);
146146 if (end - len >= addr &&
147− (!vma || addr + len <= vma->vm_start))
147+ (!vma || addr + len <= vm_start_gap(vma)))
148148 return addr;
149149 }
150150
@@ -187,7 +187,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 36 unmodified lines
187187 addr = PAGE_ALIGN(addr);
188188 vma = find_vma(mm, addr);
189189 if (TASK_SIZE - len >= addr &&
190− (!vma || addr + len <= vma->vm_start))
190+ (!vma || addr + len <= vm_start_gap(vma)))
191191 return addr;
192192 }
193193
arch/x86/kernel/traps.c+1−1
@@ -182,7 +182,7 @@ int is_valid_bugaddr(unsigned long addr) · 181 unmodified lines
182182 return ud == INSN_UD0 || ud == INSN_UD2;
183183 }
184184
185−static int fixup_bug(struct pt_regs *regs, int trapnr)
185+int fixup_bug(struct pt_regs *regs, int trapnr)
186186 {
187187 if (trapnr != X86_TRAP_UD)
188188 return 0;
arch/x86/kvm/emulate.c+1−0
@@ -2742,6 +2742,7 @@ static int em_syscall(struct x86_emulate_ctxt *ctxt) · 2741 unmodified lines
27422742 ctxt->eflags &= ~(X86_EFLAGS_VM | X86_EFLAGS_IF);
27432743 }
27442744
2745+ ctxt->tf = (ctxt->eflags & X86_EFLAGS_TF) != 0;
27452746 return X86EMUL_CONTINUE;
27462747 }
27472748
arch/x86/kvm/x86.c+32−30
@@ -5313,6 +5313,8 @@ static void init_emulate_ctxt(struct kvm_vcpu *vcpu) · 5312 unmodified lines
53135313 kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l);
53145314
53155315 ctxt->eflags = kvm_get_rflags(vcpu);
5316+ ctxt->tf = (ctxt->eflags & X86_EFLAGS_TF) != 0;
5317+
53165318 ctxt->eip = kvm_rip_read(vcpu);
53175319 ctxt->mode = (!is_protmode(vcpu)) ? X86EMUL_MODE_REAL :
53185320 (ctxt->eflags & X86_EFLAGS_VM) ? X86EMUL_MODE_VM86 :
@@ -5528,36 +5530,25 @@ static int kvm_vcpu_check_hw_bp(unsigned long addr, u32 type, u32 dr7, · 209 unmodified lines
55285530 return dr6;
55295531 }
55305532
5531−static void kvm_vcpu_check_singlestep(struct kvm_vcpu *vcpu, unsigned long rflags, int *r)
5533+static void kvm_vcpu_do_singlestep(struct kvm_vcpu *vcpu, int *r)
55325534 {
55335535 struct kvm_run *kvm_run = vcpu->run;
55345536
5535− /*
5536− * rflags is the old, "raw" value of the flags. The new value has
5537− * not been saved yet.
5538− *
5539− * This is correct even for TF set by the guest, because "the
5540− * processor will not generate this exception after the instruction
5541− * that sets the TF flag".
5542− */
5543− if (unlikely(rflags & X86_EFLAGS_TF)) {
5544− if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) {
5545− kvm_run->debug.arch.dr6 = DR6_BS | DR6_FIXED_1 |
5546− DR6_RTM;
5547− kvm_run->debug.arch.pc = vcpu->arch.singlestep_rip;
5548− kvm_run->debug.arch.exception = DB_VECTOR;
5549− kvm_run->exit_reason = KVM_EXIT_DEBUG;
5550− *r = EMULATE_USER_EXIT;
5551− } else {
5552− /*
5553− * "Certain debug exceptions may clear bit 0-3. The
5554− * remaining contents of the DR6 register are never
5555− * cleared by the processor".
5556− */
5557− vcpu->arch.dr6 &= ~15;
5558− vcpu->arch.dr6 |= DR6_BS | DR6_RTM;
5559− kvm_queue_exception(vcpu, DB_VECTOR);
5560− }
5537+ if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) {
5538+ kvm_run->debug.arch.dr6 = DR6_BS | DR6_FIXED_1 | DR6_RTM;
5539+ kvm_run->debug.arch.pc = vcpu->arch.singlestep_rip;
5540+ kvm_run->debug.arch.exception = DB_VECTOR;
5541+ kvm_run->exit_reason = KVM_EXIT_DEBUG;
5542+ *r = EMULATE_USER_EXIT;
5543+ } else {
5544+ /*
5545+ * "Certain debug exceptions may clear bit 0-3. The
5546+ * remaining contents of the DR6 register are never
5547+ * cleared by the processor".
5548+ */
5549+ vcpu->arch.dr6 &= ~15;
5550+ vcpu->arch.dr6 |= DR6_BS | DR6_RTM;
5551+ kvm_queue_exception(vcpu, DB_VECTOR);
55615552 }
55625553 }
55635554
@@ -5567,7 +5558,17 @@ int kvm_skip_emulated_instruction(struct kvm_vcpu *vcpu) · 3 unmodified lines
55675558 int r = EMULATE_DONE;
55685559
55695560 kvm_x86_ops->skip_emulated_instruction(vcpu);
5570− kvm_vcpu_check_singlestep(vcpu, rflags, &r);
5561+
5562+ /*
5563+ * rflags is the old, "raw" value of the flags. The new value has
5564+ * not been saved yet.
5565+ *
5566+ * This is correct even for TF set by the guest, because "the
5567+ * processor will not generate this exception after the instruction
5568+ * that sets the TF flag".
5569+ */
5570+ if (unlikely(rflags & X86_EFLAGS_TF))
5571+ kvm_vcpu_do_singlestep(vcpu, &r);
55715572 return r == EMULATE_DONE;
55725573 }
55735574 EXPORT_SYMBOL_GPL(kvm_skip_emulated_instruction);
@@ -5726,8 +5727,9 @@ restart: · 152 unmodified lines
57265727 toggle_interruptibility(vcpu, ctxt->interruptibility);
57275728 vcpu->arch.emulate_regs_need_sync_to_vcpu = false;
57285729 kvm_rip_write(vcpu, ctxt->eip);
5729− if (r == EMULATE_DONE)
5730− kvm_vcpu_check_singlestep(vcpu, rflags, &r);
5730+ if (r == EMULATE_DONE &&
5731+ (ctxt->tf || (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP)))
5732+ kvm_vcpu_do_singlestep(vcpu, &r);
57315733 if (!ctxt->have_exception ||
57325734 exception_type(ctxt->exception.vector) == EXCPT_TRAP)
57335735 __kvm_set_rflags(vcpu, ctxt->eflags);
arch/x86/mm/extable.c+3−0
@@ -162,6 +162,9 @@ void __init early_fixup_exception(struct pt_regs *regs, int trapnr) · 161 unmodified lines
162162 if (fixup_exception(regs, trapnr))
163163 return;
164164
165+ if (fixup_bug(regs, trapnr))
166+ return;
167+
165168 fail:
166169 early_printk("PANIC: early exception 0x%02x IP %lx:%lx error %lx cr2 0x%lx\n",
167170 (unsigned)trapnr, (unsigned long)regs->cs, regs->ip,
arch/x86/mm/hugetlbpage.c+1−1
@@ -148,7 +148,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, · 147 unmodified lines
148148 addr = ALIGN(addr, huge_page_size(h));
149149 vma = find_vma(mm, addr);
150150 if (TASK_SIZE - len >= addr &&
151− (!vma || addr + len <= vma->vm_start))
151+ (!vma || addr + len <= vm_start_gap(vma)))
152152 return addr;
153153 }
154154 if (mm->get_unmapped_area == arch_get_unmapped_area)
arch/x86/mm/init.c+3−3
@@ -161,16 +161,16 @@ static int page_size_mask; · 160 unmodified lines
161161
162162 static void __init probe_page_size_mask(void)
163163 {
164−#if !defined(CONFIG_KMEMCHECK)
165164 /*
166165 * For CONFIG_KMEMCHECK or pagealloc debugging, identity mapping will
167166 * use small pages.
168167 * This will simplify cpa(), which otherwise needs to support splitting
169168 * large pages into small in interrupt context, etc.
170169 */
171− if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled())
170+ if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled() && !IS_ENABLED(CONFIG_KMEMCHECK))
172171 page_size_mask |= 1 << PG_LEVEL_2M;
173−#endif
172+ else
173+ direct_gbpages = 0;
174174
175175 /* Enable PSE if available */
176176 if (boot_cpu_has(X86_FEATURE_PSE))
arch/xtensa/include/asm/irq.h+2−1
@@ -29,7 +29,8 @@ static inline void variant_irq_disable(unsigned int irq) { } · 28 unmodified lines
2929 # define PLATFORM_NR_IRQS 0
3030 #endif
3131 #define XTENSA_NR_IRQS XCHAL_NUM_INTERRUPTS
32−#define NR_IRQS (XTENSA_NR_IRQS + VARIANT_NR_IRQS + PLATFORM_NR_IRQS)
32+#define NR_IRQS (XTENSA_NR_IRQS + VARIANT_NR_IRQS + PLATFORM_NR_IRQS + 1)
33+#define XTENSA_PIC_LINUX_IRQ(hwirq) ((hwirq) + 1)
3334
3435 #if VARIANT_NR_IRQS == 0
3536 static inline void variant_init_irq(void) { }
arch/xtensa/kernel/irq.c+0−5
@@ -34,11 +34,6 @@ asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs) · 33 unmodified lines
3434 {
3535 int irq = irq_find_mapping(NULL, hwirq);
3636
37− if (hwirq >= NR_IRQS) {
38− printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
39− __func__, hwirq);
40− }
41−
4237 #ifdef CONFIG_DEBUG_STACKOVERFLOW
4338 /* Debugging check for stack overflow: is there less than 1KB free? */
4439 {
arch/xtensa/kernel/setup.c+1−2
@@ -593,8 +593,7 @@ c_show(struct seq_file *f, void *slot) · 592 unmodified lines
593593 (ccount_freq/10000) % 100,
594594 loops_per_jiffy/(500000/HZ),
595595 (loops_per_jiffy/(5000/HZ)) % 100);
596−
597− seq_printf(f,"flags\t\t: "
596+ seq_puts(f, "flags\t\t: "
598597 #if XCHAL_HAVE_NMI
599598 "nmi "
600599 #endif
arch/xtensa/kernel/syscall.c+1−1
@@ -88,7 +88,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, · 87 unmodified lines
8888 /* At this point: (!vmm || addr < vmm->vm_end). */
8989 if (TASK_SIZE - len < addr)
9090 return -ENOMEM;
91− if (!vmm || addr + len <= vmm->vm_start)
91+ if (!vmm || addr + len <= vm_start_gap(vmm))
9292 return addr;
9393 addr = vmm->vm_end;
9494 if (flags & MAP_SHARED)
arch/xtensa/kernel/vmlinux.lds.S+3−3
@@ -118,7 +118,7 @@ SECTIONS · 117 unmodified lines
118118 SECTION_VECTOR (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR)
119119 SECTION_VECTOR (.UserExceptionVector.literal, USER_VECTOR_VADDR - 4)
120120 SECTION_VECTOR (.UserExceptionVector.text, USER_VECTOR_VADDR)
121− SECTION_VECTOR (.DoubleExceptionVector.literal, DOUBLEEXC_VECTOR_VADDR - 48)
121+ SECTION_VECTOR (.DoubleExceptionVector.literal, DOUBLEEXC_VECTOR_VADDR - 20)
122122 SECTION_VECTOR (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR)
123123 #endif
124124
@@ -306,13 +306,13 @@ SECTIONS · 181 unmodified lines
306306 .UserExceptionVector.literal)
307307 SECTION_VECTOR (_DoubleExceptionVector_literal,
308308 .DoubleExceptionVector.literal,
309− DOUBLEEXC_VECTOR_VADDR - 48,
309+ DOUBLEEXC_VECTOR_VADDR - 20,
310310 SIZEOF(.UserExceptionVector.text),
311311 .UserExceptionVector.text)
312312 SECTION_VECTOR (_DoubleExceptionVector_text,
313313 .DoubleExceptionVector.text,
314314 DOUBLEEXC_VECTOR_VADDR,
315− 48,
315+ 20,
316316 .DoubleExceptionVector.literal)
317317
318318 . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
arch/xtensa/platforms/iss/simdisk.c+1−2
@@ -317,8 +317,7 @@ static int __init simdisk_init(void) · 316 unmodified lines
317317 if (simdisk_count > MAX_SIMDISK_COUNT)
318318 simdisk_count = MAX_SIMDISK_COUNT;
319319
320− sddev = kmalloc(simdisk_count * sizeof(struct simdisk),
321− GFP_KERNEL);
320+ sddev = kmalloc_array(simdisk_count, sizeof(*sddev), GFP_KERNEL);
322321 if (sddev == NULL)
323322 goto out_unregister;
324323
arch/xtensa/platforms/xtfpga/include/platform/hardware.h+4−2
@@ -24,16 +24,18 @@ · 23 unmodified lines
2424
2525 /* Interrupt configuration. */
2626
27−#define PLATFORM_NR_IRQS 10
27+#define PLATFORM_NR_IRQS 0
2828
2929 /* Default assignment of LX60 devices to external interrupts. */
3030
3131 #ifdef CONFIG_XTENSA_MX
3232 #define DUART16552_INTNUM XCHAL_EXTINT3_NUM
3333 #define OETH_IRQ XCHAL_EXTINT4_NUM
34+#define C67X00_IRQ XCHAL_EXTINT8_NUM
3435 #else
3536 #define DUART16552_INTNUM XCHAL_EXTINT0_NUM
3637 #define OETH_IRQ XCHAL_EXTINT1_NUM
38+#define C67X00_IRQ XCHAL_EXTINT5_NUM
3739 #endif
3840
3941 /*
@@ -63,5 +65,5 @@ · 23 unmodified lines
6365
6466 #define C67X00_PADDR (XCHAL_KIO_PADDR + 0x0D0D0000)
6567 #define C67X00_SIZE 0x10
66−#define C67X00_IRQ 5
68+
6769 #endif /* __XTENSA_XTAVNET_HARDWARE_H */
arch/xtensa/platforms/xtfpga/setup.c+5−5
@@ -175,8 +175,8 @@ static struct resource ethoc_res[] = { · 174 unmodified lines
175175 .flags = IORESOURCE_MEM,
176176 },
177177 [2] = { /* IRQ number */
178− .start = OETH_IRQ,
179− .end = OETH_IRQ,
178+ .start = XTENSA_PIC_LINUX_IRQ(OETH_IRQ),
179+ .end = XTENSA_PIC_LINUX_IRQ(OETH_IRQ),
180180 .flags = IORESOURCE_IRQ,
181181 },
182182 };
@@ -213,8 +213,8 @@ static struct resource c67x00_res[] = { · 30 unmodified lines
213213 .flags = IORESOURCE_MEM,
214214 },
215215 [1] = { /* IRQ number */
216− .start = C67X00_IRQ,
217− .end = C67X00_IRQ,
216+ .start = XTENSA_PIC_LINUX_IRQ(C67X00_IRQ),
217+ .end = XTENSA_PIC_LINUX_IRQ(C67X00_IRQ),
218218 .flags = IORESOURCE_IRQ,
219219 },
220220 };
@@ -247,7 +247,7 @@ static struct resource serial_resource = { · 26 unmodified lines
247247 static struct plat_serial8250_port serial_platform_data[] = {
248248 [0] = {
249249 .mapbase = DUART16552_PADDR,
250− .irq = DUART16552_INTNUM,
250+ .irq = XTENSA_PIC_LINUX_IRQ(DUART16552_INTNUM),
251251 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
252252 UPF_IOREMAP,
253253 .iotype = XCHAL_HAVE_BE ? UPIO_MEM32BE : UPIO_MEM32,
block/blk-mq-sched.c+46−12
@@ -68,6 +68,45 @@ static void blk_mq_sched_assign_ioc(struct request_queue *q, · 67 unmodified lines
6868 __blk_mq_sched_assign_ioc(q, rq, bio, ioc);
6969 }
7070
71+/*
72+ * Mark a hardware queue as needing a restart. For shared queues, maintain
73+ * a count of how many hardware queues are marked for restart.
74+ */
75+static void blk_mq_sched_mark_restart_hctx(struct blk_mq_hw_ctx *hctx)
76+{
77+ if (test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state))
78+ return;
79+
80+ if (hctx->flags & BLK_MQ_F_TAG_SHARED) {
81+ struct request_queue *q = hctx->queue;
82+
83+ if (!test_and_set_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state))
84+ atomic_inc(&q->shared_hctx_restart);
85+ } else
86+ set_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state);
87+}
88+
89+static bool blk_mq_sched_restart_hctx(struct blk_mq_hw_ctx *hctx)
90+{
91+ if (!test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state))
92+ return false;
93+
94+ if (hctx->flags & BLK_MQ_F_TAG_SHARED) {
95+ struct request_queue *q = hctx->queue;
96+
97+ if (test_and_clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state))
98+ atomic_dec(&q->shared_hctx_restart);
99+ } else
100+ clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state);
101+
102+ if (blk_mq_hctx_has_pending(hctx)) {
103+ blk_mq_run_hw_queue(hctx, true);
104+ return true;
105+ }
106+
107+ return false;
108+}
109+
71110 struct request *blk_mq_sched_get_request(struct request_queue *q,
72111 struct bio *bio,
73112 unsigned int op,
@@ -266,18 +305,6 @@ static bool blk_mq_sched_bypass_insert(struct blk_mq_hw_ctx *hctx, · 192 unmodified lines
266305 return true;
267306 }
268307
269−static bool blk_mq_sched_restart_hctx(struct blk_mq_hw_ctx *hctx)
270−{
271− if (test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state)) {
272− clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state);
273− if (blk_mq_hctx_has_pending(hctx)) {
274− blk_mq_run_hw_queue(hctx, true);
275− return true;
276− }
277− }
278− return false;
279−}
280−
281308 /**
282309 * list_for_each_entry_rcu_rr - iterate in a round-robin fashion over rcu list
283310 * @pos: loop cursor.
@@ -309,6 +336,13 @@ void blk_mq_sched_restart(struct blk_mq_hw_ctx *const hctx) · 25 unmodified lines
309336 unsigned int i, j;
310337
311338 if (set->flags & BLK_MQ_F_TAG_SHARED) {
339+ /*
340+ * If this is 0, then we know that no hardware queues
341+ * have RESTART marked. We're done.
342+ */
343+ if (!atomic_read(&queue->shared_hctx_restart))
344+ return;
345+
312346 rcu_read_lock();
313347 list_for_each_entry_rcu_rr(q, queue, &set->tag_list,
314348 tag_set_list) {
block/blk-mq-sched.h+0−9
@@ -115,15 +115,6 @@ static inline bool blk_mq_sched_has_work(struct blk_mq_hw_ctx *hctx) · 114 unmodified lines
115115 return false;
116116 }
117117
118−/*
119− * Mark a hardware queue as needing a restart.
120− */
121−static inline void blk_mq_sched_mark_restart_hctx(struct blk_mq_hw_ctx *hctx)
122−{
123− if (!test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state))
124− set_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state);
125−}
126−
127118 static inline bool blk_mq_sched_needs_restart(struct blk_mq_hw_ctx *hctx)
128119 {
129120 return test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state);
block/blk-mq.c+13−3
@@ -2103,20 +2103,30 @@ static void blk_mq_map_swqueue(struct request_queue *q, · 2102 unmodified lines
21032103 }
21042104 }
21052105
2106+/*
2107+ * Caller needs to ensure that we're either frozen/quiesced, or that
2108+ * the queue isn't live yet.
2109+ */
21062110 static void queue_set_hctx_shared(struct request_queue *q, bool shared)
21072111 {
21082112 struct blk_mq_hw_ctx *hctx;
21092113 int i;
21102114
21112115 queue_for_each_hw_ctx(q, hctx, i) {
2112− if (shared)
2116+ if (shared) {
2117+ if (test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state))
2118+ atomic_inc(&q->shared_hctx_restart);
21132119 hctx->flags |= BLK_MQ_F_TAG_SHARED;
2114− else
2120+ } else {
2121+ if (test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state))
2122+ atomic_dec(&q->shared_hctx_restart);
21152123 hctx->flags &= ~BLK_MQ_F_TAG_SHARED;
2124+ }
21162125 }
21172126 }
21182127
2119−static void blk_mq_update_tag_set_depth(struct blk_mq_tag_set *set, bool shared)
2128+static void blk_mq_update_tag_set_depth(struct blk_mq_tag_set *set,
2129+ bool shared)
21202130 {
21212131 struct request_queue *q;
21222132
block/blk-sysfs.c+22−12
@@ -777,24 +777,25 @@ static void blk_free_queue_rcu(struct rcu_head *rcu_head) · 776 unmodified lines
777777 }
778778
779779 /**
780− * blk_release_queue: - release a &struct request_queue when it is no longer needed
781− * @kobj: the kobj belonging to the request queue to be released
780+ * __blk_release_queue - release a request queue when it is no longer needed
781+ * @work: pointer to the release_work member of the request queue to be released
782782 *
783783 * Description:
784− * blk_release_queue is the pair to blk_init_queue() or
785− * blk_queue_make_request(). It should be called when a request queue is
786− * being released; typically when a block device is being de-registered.
787− * Currently, its primary task it to free all the &struct request
788− * structures that were allocated to the queue and the queue itself.
784+ * blk_release_queue is the counterpart of blk_init_queue(). It should be
785+ * called when a request queue is being released; typically when a block
786+ * device is being de-registered. Its primary task it to free the queue
787+ * itself.
789788 *
790− * Note:
789+ * Notes:
791790 * The low level driver must have finished any outstanding requests first
792791 * via blk_cleanup_queue().
793− **/
794−static void blk_release_queue(struct kobject *kobj)
792+ *
793+ * Although blk_release_queue() may be called with preemption disabled,
794+ * __blk_release_queue() may sleep.
795+ */
796+static void __blk_release_queue(struct work_struct *work)
795797 {
796− struct request_queue *q =
797− container_of(kobj, struct request_queue, kobj);
798+ struct request_queue *q = container_of(work, typeof(*q), release_work);
798799
799800 if (test_bit(QUEUE_FLAG_POLL_STATS, &q->queue_flags))
800801 blk_stat_remove_callback(q, q->poll_cb);
@@ -834,6 +835,15 @@ static void blk_release_queue(struct kobject *kobj) · 33 unmodified lines
834835 call_rcu(&q->rcu_head, blk_free_queue_rcu);
835836 }
836837
838+static void blk_release_queue(struct kobject *kobj)
839+{
840+ struct request_queue *q =
841+ container_of(kobj, struct request_queue, kobj);
842+
843+ INIT_WORK(&q->release_work, __blk_release_queue);
844+ schedule_work(&q->release_work);
845+}
846+
837847 static const struct sysfs_ops queue_sysfs_ops = {
838848 .show = queue_attr_show,
839849 .store = queue_attr_store,
drivers/acpi/acpica/tbutils.c+25−9
@@ -416,9 +416,18 @@ acpi_tb_get_table(struct acpi_table_desc *table_desc, · 415 unmodified lines
416416 }
417417 }
418418
419− table_desc->validation_count++;
420− if (table_desc->validation_count == 0) {
421− table_desc->validation_count--;
419+ if (table_desc->validation_count < ACPI_MAX_TABLE_VALIDATIONS) {
420+ table_desc->validation_count++;
421+
422+ /*
423+ * Detect validation_count overflows to ensure that the warning
424+ * message will only be printed once.
425+ */
426+ if (table_desc->validation_count >= ACPI_MAX_TABLE_VALIDATIONS) {
427+ ACPI_WARNING((AE_INFO,
428+ "Table %p, Validation count overflows\n",
429+ table_desc));
430+ }
422431 }
423432
424433 *out_table = table_desc->pointer;
@@ -445,13 +454,20 @@ void acpi_tb_put_table(struct acpi_table_desc *table_desc) · 20 unmodified lines
445454
446455 ACPI_FUNCTION_TRACE(acpi_tb_put_table);
447456
448− if (table_desc->validation_count == 0) {
449− ACPI_WARNING((AE_INFO,
450− "Table %p, Validation count is zero before decrement\n",
451− table_desc));
452− return_VOID;
457+ if (table_desc->validation_count < ACPI_MAX_TABLE_VALIDATIONS) {
458+ table_desc->validation_count--;
459+
460+ /*
461+ * Detect validation_count underflows to ensure that the warning
462+ * message will only be printed once.
463+ */
464+ if (table_desc->validation_count >= ACPI_MAX_TABLE_VALIDATIONS) {
465+ ACPI_WARNING((AE_INFO,
466+ "Table %p, Validation count underflows\n",
467+ table_desc));
468+ return_VOID;
469+ }
453470 }
454− table_desc->validation_count--;
455471
456472 if (table_desc->validation_count == 0) {
457473
drivers/acpi/acpica/utresrc.c+0−9
@@ -474,15 +474,6 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state, · 473 unmodified lines
474474 return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
475475 }
476476
477− /*
478− * The end_tag opcode must be followed by a zero byte.
479− * Although this byte is technically defined to be a checksum,
480− * in practice, all ASL compilers set this byte to zero.
481− */
482− if (*(aml + 1) != 0) {
483− return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
484− }
485−
486477 /* Return the pointer to the end_tag if requested */
487478
488479 if (!user_function) {
drivers/acpi/scan.c+37−30
@@ -1428,6 +1428,37 @@ static void acpi_init_coherency(struct acpi_device *adev) · 1427 unmodified lines
14281428 adev->flags.coherent_dma = cca;
14291429 }
14301430
1431+static int acpi_check_spi_i2c_slave(struct acpi_resource *ares, void *data)
1432+{
1433+ bool *is_spi_i2c_slave_p = data;
1434+
1435+ if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
1436+ return 1;
1437+
1438+ /*
1439+ * devices that are connected to UART still need to be enumerated to
1440+ * platform bus
1441+ */
1442+ if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART)
1443+ *is_spi_i2c_slave_p = true;
1444+
1445+ /* no need to do more checking */
1446+ return -1;
1447+}
1448+
1449+static bool acpi_is_spi_i2c_slave(struct acpi_device *device)
1450+{
1451+ struct list_head resource_list;
1452+ bool is_spi_i2c_slave = false;
1453+
1454+ INIT_LIST_HEAD(&resource_list);
1455+ acpi_dev_get_resources(device, &resource_list, acpi_check_spi_i2c_slave,
1456+ &is_spi_i2c_slave);
1457+ acpi_dev_free_resource_list(&resource_list);
1458+
1459+ return is_spi_i2c_slave;
1460+}
1461+
14311462 void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
14321463 int type, unsigned long long sta)
14331464 {
@@ -1443,6 +1474,7 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, · 9 unmodified lines
14431474 acpi_bus_get_flags(device);
14441475 device->flags.match_driver = false;
14451476 device->flags.initialized = true;
1477+ device->flags.spi_i2c_slave = acpi_is_spi_i2c_slave(device);
14461478 acpi_device_clear_enumerated(device);
14471479 device_initialize(&device->dev);
14481480 dev_set_uevent_suppress(&device->dev, true);
@@ -1727,38 +1759,13 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, · 278 unmodified lines
17271759 return AE_OK;
17281760 }
17291761
1730−static int acpi_check_spi_i2c_slave(struct acpi_resource *ares, void *data)
1731−{
1732− bool *is_spi_i2c_slave_p = data;
1733−
1734− if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
1735− return 1;
1736−
1737− /*
1738− * devices that are connected to UART still need to be enumerated to
1739− * platform bus
1740− */
1741− if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART)
1742− *is_spi_i2c_slave_p = true;
1743−
1744− /* no need to do more checking */
1745− return -1;
1746−}
1747−
17481762 static void acpi_default_enumeration(struct acpi_device *device)
17491763 {
1750− struct list_head resource_list;
1751− bool is_spi_i2c_slave = false;
1752−
17531764 /*
17541765 * Do not enumerate SPI/I2C slaves as they will be enumerated by their
17551766 * respective parents.
17561767 */
1757− INIT_LIST_HEAD(&resource_list);
1758− acpi_dev_get_resources(device, &resource_list, acpi_check_spi_i2c_slave,
1759− &is_spi_i2c_slave);
1760− acpi_dev_free_resource_list(&resource_list);
1761− if (!is_spi_i2c_slave) {
1768+ if (!device->flags.spi_i2c_slave) {
17621769 acpi_create_platform_device(device, NULL);
17631770 acpi_device_set_enumerated(device);
17641771 } else {
@@ -1854,7 +1861,7 @@ static void acpi_bus_attach(struct acpi_device *device) · 89 unmodified lines
18541861 return;
18551862
18561863 device->flags.match_driver = true;
1857− if (ret > 0) {
1864+ if (ret > 0 && !device->flags.spi_i2c_slave) {
18581865 acpi_device_set_enumerated(device);
18591866 goto ok;
18601867 }
@@ -1863,10 +1870,10 @@ static void acpi_bus_attach(struct acpi_device *device) · 2 unmodified lines
18631870 if (ret < 0)
18641871 return;
18651872
1866− if (device->pnp.type.platform_id)
1867− acpi_default_enumeration(device);
1868− else
1873+ if (!device->pnp.type.platform_id && !device->flags.spi_i2c_slave)
18691874 acpi_device_set_enumerated(device);
1875+ else
1876+ acpi_default_enumeration(device);
18701877
18711878 ok:
18721879 list_for_each_entry(child, &device->children, node)
drivers/block/xen-blkback/blkback.c+12−14
@@ -609,8 +609,6 @@ int xen_blkif_schedule(void *arg) · 608 unmodified lines
609609 unsigned long timeout;
610610 int ret;
611611
612− xen_blkif_get(blkif);
613−
614612 set_freezable();
615613 while (!kthread_should_stop()) {
616614 if (try_to_freeze())
@@ -665,7 +663,6 @@ purge_gnt_list: · 48 unmodified lines
665663 print_stats(ring);
666664
667665 ring->xenblkd = NULL;
668− xen_blkif_put(blkif);
669666
670667 return 0;
671668 }
@@ -1436,34 +1433,35 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring, · 764 unmodified lines
14361433 static void make_response(struct xen_blkif_ring *ring, u64 id,
14371434 unsigned short op, int st)
14381435 {
1439− struct blkif_response resp;
1436+ struct blkif_response *resp;
14401437 unsigned long flags;
14411438 union blkif_back_rings *blk_rings;
14421439 int notify;
14431440
1444− resp.id = id;
1445− resp.operation = op;
1446− resp.status = st;
1447−
14481441 spin_lock_irqsave(&ring->blk_ring_lock, flags);
14491442 blk_rings = &ring->blk_rings;
14501443 /* Place on the response ring for the relevant domain. */
14511444 switch (ring->blkif->blk_protocol) {
14521445 case BLKIF_PROTOCOL_NATIVE:
1453− memcpy(RING_GET_RESPONSE(&blk_rings->native, blk_rings->native.rsp_prod_pvt),
1454− &resp, sizeof(resp));
1446+ resp = RING_GET_RESPONSE(&blk_rings->native,
1447+ blk_rings->native.rsp_prod_pvt);
14551448 break;
14561449 case BLKIF_PROTOCOL_X86_32:
1457− memcpy(RING_GET_RESPONSE(&blk_rings->x86_32, blk_rings->x86_32.rsp_prod_pvt),
1458− &resp, sizeof(resp));
1450+ resp = RING_GET_RESPONSE(&blk_rings->x86_32,
1451+ blk_rings->x86_32.rsp_prod_pvt);
14591452 break;
14601453 case BLKIF_PROTOCOL_X86_64:
1461− memcpy(RING_GET_RESPONSE(&blk_rings->x86_64, blk_rings->x86_64.rsp_prod_pvt),
1462− &resp, sizeof(resp));
1454+ resp = RING_GET_RESPONSE(&blk_rings->x86_64,
1455+ blk_rings->x86_64.rsp_prod_pvt);
14631456 break;
14641457 default:
14651458 BUG();
14661459 }
1460+
1461+ resp->id = id;
1462+ resp->operation = op;
1463+ resp->status = st;
1464+
14671465 blk_rings->common.rsp_prod_pvt++;
14681466 RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blk_rings->common, notify);
14691467 spin_unlock_irqrestore(&ring->blk_ring_lock, flags);
drivers/block/xen-blkback/common.h+6−20
@@ -75,9 +75,8 @@ extern unsigned int xenblk_max_queues; · 74 unmodified lines
7575 struct blkif_common_request {
7676 char dummy;
7777 };
78−struct blkif_common_response {
79− char dummy;
80−};
78+
79+/* i386 protocol version */
8180
8281 struct blkif_x86_32_request_rw {
8382 uint8_t nr_segments; /* number of segments */
@@ -129,14 +128,6 @@ struct blkif_x86_32_request { · 45 unmodified lines
129128 } u;
130129 } __attribute__((__packed__));
131130
132−/* i386 protocol version */
133−#pragma pack(push, 4)
134−struct blkif_x86_32_response {
135− uint64_t id; /* copied from request */
136− uint8_t operation; /* copied from request */
137− int16_t status; /* BLKIF_RSP_??? */
138−};
139−#pragma pack(pop)
140131 /* x86_64 protocol version */
141132
142133 struct blkif_x86_64_request_rw {
@@ -193,18 +184,12 @@ struct blkif_x86_64_request { · 50 unmodified lines
193184 } u;
194185 } __attribute__((__packed__));
195186
196−struct blkif_x86_64_response {
197− uint64_t __attribute__((__aligned__(8))) id;
198− uint8_t operation; /* copied from request */
199− int16_t status; /* BLKIF_RSP_??? */
200−};
201−
202187 DEFINE_RING_TYPES(blkif_common, struct blkif_common_request,
203− struct blkif_common_response);
188+ struct blkif_response);
204189 DEFINE_RING_TYPES(blkif_x86_32, struct blkif_x86_32_request,
205− struct blkif_x86_32_response);
190+ struct blkif_response __packed);
206191 DEFINE_RING_TYPES(blkif_x86_64, struct blkif_x86_64_request,
207− struct blkif_x86_64_response);
192+ struct blkif_response);
208193
209194 union blkif_back_rings {
210195 struct blkif_back_ring native;
@@ -281,6 +266,7 @@ struct xen_blkif_ring { · 70 unmodified lines
281266
282267 wait_queue_head_t wq;
283268 atomic_t inflight;
269+ bool active;
284270 /* One thread per blkif ring. */
285271 struct task_struct *xenblkd;
286272 unsigned int waiting_reqs;
drivers/block/xen-blkback/xenbus.c+8−7
@@ -159,7 +159,7 @@ static int xen_blkif_alloc_rings(struct xen_blkif *blkif) · 158 unmodified lines
159159 init_waitqueue_head(&ring->shutdown_wq);
160160 ring->blkif = blkif;
161161 ring->st_print = jiffies;
162− xen_blkif_get(blkif);
162+ ring->active = true;
163163 }
164164
165165 return 0;
@@ -249,10 +249,12 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif) · 83 unmodified lines
249249 struct xen_blkif_ring *ring = &blkif->rings[r];
250250 unsigned int i = 0;
251251
252+ if (!ring->active)
253+ continue;
254+
252255 if (ring->xenblkd) {
253256 kthread_stop(ring->xenblkd);
254257 wake_up(&ring->shutdown_wq);
255− ring->xenblkd = NULL;
256258 }
257259
258260 /* The above kthread_stop() guarantees that at this point we
@@ -296,7 +298,7 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif) · 37 unmodified lines
296298 BUG_ON(ring->free_pages_num != 0);
297299 BUG_ON(ring->persistent_gnt_c != 0);
298300 WARN_ON(i != (XEN_BLKIF_REQS_PER_PAGE * blkif->nr_ring_pages));
299− xen_blkif_put(blkif);
301+ ring->active = false;
300302 }
301303 blkif->nr_ring_pages = 0;
302304 /*
@@ -312,9 +314,10 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif) · 9 unmodified lines
312314
313315 static void xen_blkif_free(struct xen_blkif *blkif)
314316 {
315−
316− xen_blkif_disconnect(blkif);
317+ WARN_ON(xen_blkif_disconnect(blkif));
317318 xen_vbd_free(&blkif->vbd);
319+ kfree(blkif->be->mode);
320+ kfree(blkif->be);
318321
319322 /* Make sure everything is drained before shutting down */
320323 kmem_cache_free(xen_blkif_cachep, blkif);
@@ -511,8 +514,6 @@ static int xen_blkbk_remove(struct xenbus_device *dev) · 190 unmodified lines
511514 xen_blkif_put(be->blkif);
512515 }
513516
514− kfree(be->mode);
515− kfree(be);
516517 return 0;
517518 }
518519
drivers/char/random.c+6−6
@@ -803,13 +803,13 @@ static int crng_fast_load(const char *cp, size_t len) · 802 unmodified lines
803803 p[crng_init_cnt % CHACHA20_KEY_SIZE] ^= *cp;
804804 cp++; crng_init_cnt++; len--;
805805 }
806+ spin_unlock_irqrestore(&primary_crng.lock, flags);
806807 if (crng_init_cnt >= CRNG_INIT_CNT_THRESH) {
807808 invalidate_batched_entropy();
808809 crng_init = 1;
809810 wake_up_interruptible(&crng_init_wait);
810811 pr_notice("random: fast init done\n");
811812 }
812− spin_unlock_irqrestore(&primary_crng.lock, flags);
813813 return 1;
814814 }
815815
@@ -841,6 +841,7 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r) · 25 unmodified lines
841841 }
842842 memzero_explicit(&buf, sizeof(buf));
843843 crng->init_time = jiffies;
844+ spin_unlock_irqrestore(&primary_crng.lock, flags);
844845 if (crng == &primary_crng && crng_init < 2) {
845846 invalidate_batched_entropy();
846847 crng_init = 2;
@@ -848,7 +849,6 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r) · 1 unmodified line
848849 wake_up_interruptible(&crng_init_wait);
849850 pr_notice("random: crng init done\n");
850851 }
851− spin_unlock_irqrestore(&primary_crng.lock, flags);
852852 }
853853
854854 static inline void crng_wait_ready(void)
@@ -2041,8 +2041,8 @@ static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u64); · 1186 unmodified lines
20412041 u64 get_random_u64(void)
20422042 {
20432043 u64 ret;
2044− bool use_lock = crng_init < 2;
2045− unsigned long flags;
2044+ bool use_lock = READ_ONCE(crng_init) < 2;
2045+ unsigned long flags = 0;
20462046 struct batched_entropy *batch;
20472047
20482048 #if BITS_PER_LONG == 64
@@ -2073,8 +2073,8 @@ static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u32); · 24 unmodified lines
20732073 u32 get_random_u32(void)
20742074 {
20752075 u32 ret;
2076− bool use_lock = crng_init < 2;
2077− unsigned long flags;
2076+ bool use_lock = READ_ONCE(crng_init) < 2;
2077+ unsigned long flags = 0;
20782078 struct batched_entropy *batch;
20792079
20802080 if (arch_get_random_int(&ret))
drivers/clk/meson/Kconfig+1−0
@@ -14,6 +14,7 @@ config COMMON_CLK_MESON8B · 13 unmodified lines
1414 config COMMON_CLK_GXBB
1515 bool
1616 depends on COMMON_CLK_AMLOGIC
17+ select RESET_CONTROLLER
1718 help
1819 Support for the clock controller on AmLogic S905 devices, aka gxbb.
1920 Say Y if you want peripherals and CPU frequency scaling to work.
drivers/clk/sunxi-ng/Kconfig+1−0
@@ -156,6 +156,7 @@ config SUN8I_R_CCU · 155 unmodified lines
156156 bool "Support for Allwinner SoCs' PRCM CCUs"
157157 select SUNXI_CCU_DIV
158158 select SUNXI_CCU_GATE
159+ select SUNXI_CCU_MP
159160 default MACH_SUN8I || (ARCH_SUNXI && ARM64)
160161
161162 endif
drivers/clk/sunxi-ng/ccu-sun50i-a64.h+3−1
@@ -31,7 +31,9 @@ · 30 unmodified lines
3131 #define CLK_PLL_VIDEO0_2X 8
3232 #define CLK_PLL_VE 9
3333 #define CLK_PLL_DDR0 10
34−#define CLK_PLL_PERIPH0 11
34+
35+/* PLL_PERIPH0 exported for PRCM */
36+
3537 #define CLK_PLL_PERIPH0_2X 12
3638 #define CLK_PLL_PERIPH1 13
3739 #define CLK_PLL_PERIPH1_2X 14
drivers/clk/sunxi-ng/ccu-sun5i.c+1−1
@@ -243,7 +243,7 @@ static SUNXI_CCU_GATE(ahb_ss_clk, "ahb-ss", "ahb", · 242 unmodified lines
243243 static SUNXI_CCU_GATE(ahb_dma_clk, "ahb-dma", "ahb",
244244 0x060, BIT(6), 0);
245245 static SUNXI_CCU_GATE(ahb_bist_clk, "ahb-bist", "ahb",
246− 0x060, BIT(6), 0);
246+ 0x060, BIT(7), 0);
247247 static SUNXI_CCU_GATE(ahb_mmc0_clk, "ahb-mmc0", "ahb",
248248 0x060, BIT(8), 0);
249249 static SUNXI_CCU_GATE(ahb_mmc1_clk, "ahb-mmc1", "ahb",
drivers/clk/sunxi-ng/ccu-sun6i-a31.c+1−1
@@ -556,7 +556,7 @@ static SUNXI_CCU_M_WITH_MUX_GATE(lcd0_ch1_clk, "lcd0-ch1", lcd_ch1_parents, · 555 unmodified lines
556556 0x12c, 0, 4, 24, 3, BIT(31),
557557 CLK_SET_RATE_PARENT);
558558 static SUNXI_CCU_M_WITH_MUX_GATE(lcd1_ch1_clk, "lcd1-ch1", lcd_ch1_parents,
559− 0x12c, 0, 4, 24, 3, BIT(31),
559+ 0x130, 0, 4, 24, 3, BIT(31),
560560 CLK_SET_RATE_PARENT);
561561
562562 static const char * const csi_sclk_parents[] = { "pll-video0", "pll-video1",
drivers/clk/sunxi-ng/ccu-sun8i-h3.h+3−1
@@ -29,7 +29,9 @@ · 28 unmodified lines
2929 #define CLK_PLL_VIDEO 6
3030 #define CLK_PLL_VE 7
3131 #define CLK_PLL_DDR 8
32−#define CLK_PLL_PERIPH0 9
32+
33+/* PLL_PERIPH0 exported for PRCM */
34+
3335 #define CLK_PLL_PERIPH0_2X 10
3436 #define CLK_PLL_GPU 11
3537 #define CLK_PLL_PERIPH1 12
drivers/clk/sunxi-ng/ccu-sun8i-v3s.c+1−1
@@ -537,7 +537,7 @@ static struct ccu_reset_map sun8i_v3s_ccu_resets[] = { · 536 unmodified lines
537537 [RST_BUS_EMAC] = { 0x2c0, BIT(17) },
538538 [RST_BUS_HSTIMER] = { 0x2c0, BIT(19) },
539539 [RST_BUS_SPI0] = { 0x2c0, BIT(20) },
540− [RST_BUS_OTG] = { 0x2c0, BIT(23) },
540+ [RST_BUS_OTG] = { 0x2c0, BIT(24) },
541541 [RST_BUS_EHCI0] = { 0x2c0, BIT(26) },
542542 [RST_BUS_OHCI0] = { 0x2c0, BIT(29) },
543543
drivers/clocksource/arm_arch_timer.c+2−2
@@ -1209,9 +1209,9 @@ arch_timer_mem_frame_get_cntfrq(struct arch_timer_mem_frame *frame) · 1208 unmodified lines
12091209 return 0;
12101210 }
12111211
1212− rate = readl_relaxed(frame + CNTFRQ);
1212+ rate = readl_relaxed(base + CNTFRQ);
12131213
1214− iounmap(frame);
1214+ iounmap(base);
12151215
12161216 return rate;
12171217 }
drivers/clocksource/cadence_ttc_timer.c+1−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <linux/clk.h>
1919 #include <linux/interrupt.h>
2020 #include <linux/clockchips.h>
21+#include <linux/clocksource.h>
2122 #include <linux/of_address.h>
2223 #include <linux/of_irq.h>
2324 #include <linux/slab.h>
drivers/clocksource/timer-sun5i.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212
1313 #include <linux/clk.h>
1414 #include <linux/clockchips.h>
15+#include <linux/clocksource.h>
1516 #include <linux/delay.h>
1617 #include <linux/interrupt.h>
1718 #include <linux/irq.h>
drivers/cpufreq/cpufreq_conservative.c+2−2
@@ -185,8 +185,8 @@ static ssize_t store_down_threshold(struct gov_attr_set *attr_set, · 184 unmodified lines
185185 int ret;
186186 ret = sscanf(buf, "%u", &input);
187187
188− /* cannot be lower than 11 otherwise freq will not fall */
189− if (ret != 1 || input < 11 || input > 100 ||
188+ /* cannot be lower than 1 otherwise freq will not fall */
189+ if (ret != 1 || input < 1 || input > 100 ||
190190 input >= dbs_data->up_threshold)
191191 return -EINVAL;
192192
drivers/cpuidle/dt_idle_states.c+3−1
@@ -180,8 +180,10 @@ int dt_init_idle_driver(struct cpuidle_driver *drv, · 179 unmodified lines
180180 if (!state_node)
181181 break;
182182
183− if (!of_device_is_available(state_node))
183+ if (!of_device_is_available(state_node)) {
184+ of_node_put(state_node);
184185 continue;
186+ }
185187
186188 if (!idle_state_valid(state_node, i, cpumask)) {
187189 pr_warn("%s idle state not valid, bailing out\n",
drivers/devfreq/event/exynos-nocp.c+5−1
@@ -267,7 +267,11 @@ static int exynos_nocp_probe(struct platform_device *pdev) · 266 unmodified lines
267267 }
268268 platform_set_drvdata(pdev, nocp);
269269
270− clk_prepare_enable(nocp->clk);
270+ ret = clk_prepare_enable(nocp->clk);
271+ if (ret) {
272+ dev_err(&pdev->dev, "failed to prepare ppmu clock\n");
273+ return ret;
274+ }
271275
272276 pr_info("exynos-nocp: new NoC Probe device registered: %s\n",
273277 dev_name(dev));
drivers/devfreq/event/exynos-ppmu.c+6−2
@@ -44,7 +44,7 @@ struct exynos_ppmu { · 43 unmodified lines
4444 { "ppmu-event2-"#name, PPMU_PMNCNT2 }, \
4545 { "ppmu-event3-"#name, PPMU_PMNCNT3 }
4646
47−struct __exynos_ppmu_events {
47+static struct __exynos_ppmu_events {
4848 char *name;
4949 int id;
5050 } ppmu_events[] = {
@@ -648,7 +648,11 @@ static int exynos_ppmu_probe(struct platform_device *pdev) · 597 unmodified lines
648648 dev_name(&pdev->dev), desc[i].name);
649649 }
650650
651− clk_prepare_enable(info->ppmu.clk);
651+ ret = clk_prepare_enable(info->ppmu.clk);
652+ if (ret) {
653+ dev_err(&pdev->dev, "failed to prepare ppmu clock\n");
654+ return ret;
655+ }
652656
653657 return 0;
654658 }
drivers/firmware/dmi-id.c+2−2
@@ -47,7 +47,7 @@ DEFINE_DMI_ATTR_WITH_SHOW(product_name, 0444, DMI_PRODUCT_NAME); · 46 unmodified lines
4747 DEFINE_DMI_ATTR_WITH_SHOW(product_version, 0444, DMI_PRODUCT_VERSION);
4848 DEFINE_DMI_ATTR_WITH_SHOW(product_serial, 0400, DMI_PRODUCT_SERIAL);
4949 DEFINE_DMI_ATTR_WITH_SHOW(product_uuid, 0400, DMI_PRODUCT_UUID);
50−DEFINE_DMI_ATTR_WITH_SHOW(product_family, 0400, DMI_PRODUCT_FAMILY);
50+DEFINE_DMI_ATTR_WITH_SHOW(product_family, 0444, DMI_PRODUCT_FAMILY);
5151 DEFINE_DMI_ATTR_WITH_SHOW(board_vendor, 0444, DMI_BOARD_VENDOR);
5252 DEFINE_DMI_ATTR_WITH_SHOW(board_name, 0444, DMI_BOARD_NAME);
5353 DEFINE_DMI_ATTR_WITH_SHOW(board_version, 0444, DMI_BOARD_VERSION);
@@ -192,7 +192,7 @@ static void __init dmi_id_init_attr_table(void) · 138 unmodified lines
192192 ADD_DMI_ATTR(product_version, DMI_PRODUCT_VERSION);
193193 ADD_DMI_ATTR(product_serial, DMI_PRODUCT_SERIAL);
194194 ADD_DMI_ATTR(product_uuid, DMI_PRODUCT_UUID);
195− ADD_DMI_ATTR(product_family, DMI_PRODUCT_FAMILY);
195+ ADD_DMI_ATTR(product_family, DMI_PRODUCT_FAMILY);
196196 ADD_DMI_ATTR(board_vendor, DMI_BOARD_VENDOR);
197197 ADD_DMI_ATTR(board_name, DMI_BOARD_NAME);
198198 ADD_DMI_ATTR(board_version, DMI_BOARD_VERSION);
drivers/firmware/dmi_scan.c+37−12
@@ -144,7 +144,7 @@ static int __init dmi_walk_early(void (*decode)(const struct dmi_header *, · 143 unmodified lines
144144
145145 buf = dmi_early_remap(dmi_base, orig_dmi_len);
146146 if (buf == NULL)
147− return -1;
147+ return -ENOMEM;
148148
149149 dmi_decode_table(buf, decode, NULL);
150150
@@ -178,7 +178,7 @@ static void __init dmi_save_ident(const struct dmi_header *dm, int slot, · 27 unmodified lines
178178 const char *d = (const char *) dm;
179179 const char *p;
180180
181− if (dmi_ident[slot])
181+ if (dmi_ident[slot] || dm->length <= string)
182182 return;
183183
184184 p = dmi_string(dm, d[string]);
@@ -191,13 +191,14 @@ static void __init dmi_save_ident(const struct dmi_header *dm, int slot, · 6 unmodified lines
191191 static void __init dmi_save_uuid(const struct dmi_header *dm, int slot,
192192 int index)
193193 {
194− const u8 *d = (u8 *) dm + index;
194+ const u8 *d;
195195 char *s;
196196 int is_ff = 1, is_00 = 1, i;
197197
198− if (dmi_ident[slot])
198+ if (dmi_ident[slot] || dm->length <= index + 16)
199199 return;
200200
201+ d = (u8 *) dm + index;
201202 for (i = 0; i < 16 && (is_ff || is_00); i++) {
202203 if (d[i] != 0x00)
203204 is_00 = 0;
@@ -228,16 +229,17 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, · 24 unmodified lines
228229 static void __init dmi_save_type(const struct dmi_header *dm, int slot,
229230 int index)
230231 {
231− const u8 *d = (u8 *) dm + index;
232+ const u8 *d;
232233 char *s;
233234
234− if (dmi_ident[slot])
235+ if (dmi_ident[slot] || dm->length <= index)
235236 return;
236237
237238 s = dmi_alloc(4);
238239 if (!s)
239240 return;
240241
242+ d = (u8 *) dm + index;
241243 sprintf(s, "%u", *d & 0x7F);
242244 dmi_ident[slot] = s;
243245 }
@@ -278,9 +280,13 @@ static void __init dmi_save_devices(const struct dmi_header *dm) · 34 unmodified lines
278280
279281 static void __init dmi_save_oem_strings_devices(const struct dmi_header *dm)
280282 {
281− int i, count = *(u8 *)(dm + 1);
283+ int i, count;
282284 struct dmi_device *dev;
283285
286+ if (dm->length < 0x05)
287+ return;
288+
289+ count = *(u8 *)(dm + 1);
284290 for (i = 1; i <= count; i++) {
285291 const char *devname = dmi_string(dm, i);
286292
@@ -353,6 +359,9 @@ static void __init dmi_save_extended_devices(const struct dmi_header *dm) · 66 unmodified lines
353359 const char *name;
354360 const u8 *d = (u8 *)dm;
355361
362+ if (dm->length < 0x0B)
363+ return;
364+
356365 /* Skip disabled device */
357366 if ((d[0x5] & 0x80) == 0)
358367 return;
@@ -387,7 +396,7 @@ static void __init save_mem_devices(const struct dmi_header *dm, void *v) · 28 unmodified lines
387396 const char *d = (const char *)dm;
388397 static int nr;
389398
390− if (dm->type != DMI_ENTRY_MEM_DEVICE)
399+ if (dm->type != DMI_ENTRY_MEM_DEVICE || dm->length < 0x12)
391400 return;
392401 if (nr >= dmi_memdev_nr) {
393402 pr_warn(FW_BUG "Too many DIMM entries in SMBIOS table\n");
@@ -649,6 +658,21 @@ void __init dmi_scan_machine(void) · 255 unmodified lines
649658 if (p == NULL)
650659 goto error;
651660
661+ /*
662+ * Same logic as above, look for a 64-bit entry point
663+ * first, and if not found, fall back to 32-bit entry point.
664+ */
665+ memcpy_fromio(buf, p, 16);
666+ for (q = p + 16; q < p + 0x10000; q += 16) {
667+ memcpy_fromio(buf + 16, q, 16);
668+ if (!dmi_smbios3_present(buf)) {
669+ dmi_available = 1;
670+ dmi_early_unmap(p, 0x10000);
671+ goto out;
672+ }
673+ memcpy(buf, buf + 16, 16);
674+ }
675+
652676 /*
653677 * Iterate over all possible DMI header addresses q.
654678 * Maintain the 32 bytes around q in buf. On the
@@ -659,7 +683,7 @@ void __init dmi_scan_machine(void) · 4 unmodified lines
659683 memset(buf, 0, 16);
660684 for (q = p; q < p + 0x10000; q += 16) {
661685 memcpy_fromio(buf + 16, q, 16);
662− if (!dmi_smbios3_present(buf) || !dmi_present(buf)) {
686+ if (!dmi_present(buf)) {
663687 dmi_available = 1;
664688 dmi_early_unmap(p, 0x10000);
665689 goto out;
@@ -993,7 +1017,8 @@ EXPORT_SYMBOL(dmi_get_date); · 327 unmodified lines
9931017 * @decode: Callback function
9941018 * @private_data: Private data to be passed to the callback function
9951019 *
996− * Returns -1 when the DMI table can't be reached, 0 on success.
1020+ * Returns 0 on success, -ENXIO if DMI is not selected or not present,
1021+ * or a different negative error code if DMI walking fails.
9971022 */
9981023 int dmi_walk(void (*decode)(const struct dmi_header *, void *),
9991024 void *private_data)
@@ -1001,11 +1026,11 @@ int dmi_walk(void (*decode)(const struct dmi_header *, void *), · 1 unmodified line
10011026 u8 *buf;
10021027
10031028 if (!dmi_available)
1004− return -1;
1029+ return -ENXIO;
10051030
10061031 buf = dmi_remap(dmi_base, dmi_len);
10071032 if (buf == NULL)
1008− return -1;
1033+ return -ENOMEM;
10091034
10101035 dmi_decode_table(buf, decode, private_data);
10111036
drivers/gpio/gpio-mvebu.c+3−3
@@ -721,7 +721,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev, · 720 unmodified lines
721721 u32 set;
722722
723723 if (!of_device_is_compatible(mvchip->chip.of_node,
724− "marvell,armada-370-xp-gpio"))
724+ "marvell,armada-370-gpio"))
725725 return 0;
726726
727727 if (IS_ERR(mvchip->clk))
@@ -852,7 +852,7 @@ static const struct of_device_id mvebu_gpio_of_match[] = { · 124 unmodified lines
852852 .data = (void *) MVEBU_GPIO_SOC_VARIANT_ARMADAXP,
853853 },
854854 {
855− .compatible = "marvell,armada-370-xp-gpio",
855+ .compatible = "marvell,armada-370-gpio",
856856 .data = (void *) MVEBU_GPIO_SOC_VARIANT_ORION,
857857 },
858858 {
@@ -1128,7 +1128,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev) · 269 unmodified lines
11281128 mvchip);
11291129 }
11301130
1131− /* Armada 370/XP has simple PWM support for GPIO lines */
1131+ /* Some MVEBU SoCs have simple PWM support for GPIO lines */
11321132 if (IS_ENABLED(CONFIG_PWM))
11331133 return mvebu_pwm_probe(pdev, mvchip, id);
11341134
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c+4−0
@@ -693,6 +693,10 @@ int amdgpu_atombios_get_clock_info(struct amdgpu_device *adev) · 692 unmodified lines
693693 DRM_INFO("Changing default dispclk from %dMhz to 600Mhz\n",
694694 adev->clock.default_dispclk / 100);
695695 adev->clock.default_dispclk = 60000;
696+ } else if (adev->clock.default_dispclk <= 60000) {
697+ DRM_INFO("Changing default dispclk from %dMhz to 625Mhz\n",
698+ adev->clock.default_dispclk / 100);
699+ adev->clock.default_dispclk = 62500;
696700 }
697701 adev->clock.dp_extclk =
698702 le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq);
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+1−0
@@ -475,6 +475,7 @@ static const struct pci_device_id pciidlist[] = { · 474 unmodified lines
475475 {0x1002, 0x6986, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
476476 {0x1002, 0x6987, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
477477 {0x1002, 0x6995, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
478+ {0x1002, 0x6997, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
478479 {0x1002, 0x699F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
479480 /* Vega 10 */
480481 {0x1002, 0x6860, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10|AMD_EXP_HW_SUPPORT},
drivers/gpu/drm/amd/amdgpu/atombios_crtc.c+2−2
@@ -165,7 +165,7 @@ void amdgpu_atombios_crtc_powergate(struct drm_crtc *crtc, int state) · 164 unmodified lines
165165 struct drm_device *dev = crtc->dev;
166166 struct amdgpu_device *adev = dev->dev_private;
167167 int index = GetIndexIntoMasterTable(COMMAND, EnableDispPowerGating);
168− ENABLE_DISP_POWER_GATING_PARAMETERS_V2_1 args;
168+ ENABLE_DISP_POWER_GATING_PS_ALLOCATION args;
169169
170170 memset(&args, 0, sizeof(args));
171171
@@ -178,7 +178,7 @@ void amdgpu_atombios_crtc_powergate(struct drm_crtc *crtc, int state) · 6 unmodified lines
178178 void amdgpu_atombios_crtc_powergate_init(struct amdgpu_device *adev)
179179 {
180180 int index = GetIndexIntoMasterTable(COMMAND, EnableDispPowerGating);
181− ENABLE_DISP_POWER_GATING_PARAMETERS_V2_1 args;
181+ ENABLE_DISP_POWER_GATING_PS_ALLOCATION args;
182182
183183 memset(&args, 0, sizeof(args));
184184
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c+5−2
@@ -1207,8 +1207,11 @@ static void dce_v10_0_program_watermarks(struct amdgpu_device *adev, · 1206 unmodified lines
12071207 u32 tmp, wm_mask, lb_vblank_lead_lines = 0;
12081208
12091209 if (amdgpu_crtc->base.enabled && num_heads && mode) {
1210− active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock;
1211− line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535);
1210+ active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000,
1211+ (u32)mode->clock);
1212+ line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000,
1213+ (u32)mode->clock);
1214+ line_time = min(line_time, (u32)65535);
12121215
12131216 /* watermark for high clocks */
12141217 if (adev->pm.dpm_enabled) {
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c+5−2
@@ -1176,8 +1176,11 @@ static void dce_v11_0_program_watermarks(struct amdgpu_device *adev, · 1175 unmodified lines
11761176 u32 tmp, wm_mask, lb_vblank_lead_lines = 0;
11771177
11781178 if (amdgpu_crtc->base.enabled && num_heads && mode) {
1179− active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock;
1180− line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535);
1179+ active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000,
1180+ (u32)mode->clock);
1181+ line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000,
1182+ (u32)mode->clock);
1183+ line_time = min(line_time, (u32)65535);
11811184
11821185 /* watermark for high clocks */
11831186 if (adev->pm.dpm_enabled) {
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c+5−2
@@ -991,8 +991,11 @@ static void dce_v6_0_program_watermarks(struct amdgpu_device *adev, · 990 unmodified lines
991991 fixed20_12 a, b, c;
992992
993993 if (amdgpu_crtc->base.enabled && num_heads && mode) {
994− active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock;
995− line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535);
994+ active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000,
995+ (u32)mode->clock);
996+ line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000,
997+ (u32)mode->clock);
998+ line_time = min(line_time, (u32)65535);
996999 priority_a_cnt = 0;
9971000 priority_b_cnt = 0;
9981001
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c+5−2
@@ -1091,8 +1091,11 @@ static void dce_v8_0_program_watermarks(struct amdgpu_device *adev, · 1090 unmodified lines
10911091 u32 tmp, wm_mask, lb_vblank_lead_lines = 0;
10921092
10931093 if (amdgpu_crtc->base.enabled && num_heads && mode) {
1094− active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock;
1095− line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535);
1094+ active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000,
1095+ (u32)mode->clock);
1096+ line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000,
1097+ (u32)mode->clock);
1098+ line_time = min(line_time, (u32)65535);
10961099
10971100 /* watermark for high clocks */
10981101 if (adev->pm.dpm_enabled) {
drivers/gpu/drm/bridge/synopsys/Kconfig+1−0
@@ -1,6 +1,7 @@
11 config DRM_DW_HDMI
22 tristate
33 select DRM_KMS_HELPER
4+ select REGMAP_MMIO
45
56 config DRM_DW_HDMI_AHB_AUDIO
67 tristate "Synopsys Designware AHB Audio interface"
drivers/gpu/drm/drm_connector.c+20−18
@@ -1293,21 +1293,6 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, · 1292 unmodified lines
12931293 if (!connector)
12941294 return -ENOENT;
12951295
1296− drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
1297− encoder = drm_connector_get_encoder(connector);
1298− if (encoder)
1299− out_resp->encoder_id = encoder->base.id;
1300− else
1301− out_resp->encoder_id = 0;
1302−
1303− ret = drm_mode_object_get_properties(&connector->base, file_priv->atomic,
1304− (uint32_t __user *)(unsigned long)(out_resp->props_ptr),
1305− (uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr),
1306− &out_resp->count_props);
1307− drm_modeset_unlock(&dev->mode_config.connection_mutex);
1308− if (ret)
1309− goto out_unref;
1310−
13111296 for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++)
13121297 if (connector->encoder_ids[i] != 0)
13131298 encoders_count++;
@@ -1320,7 +1305,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, · 6 unmodified lines
13201305 if (put_user(connector->encoder_ids[i],
13211306 encoder_ptr + copied)) {
13221307 ret = -EFAULT;
1323− goto out_unref;
1308+ goto out;
13241309 }
13251310 copied++;
13261311 }
@@ -1364,15 +1349,32 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, · 37 unmodified lines
13641349 if (copy_to_user(mode_ptr + copied,
13651350 &u_mode, sizeof(u_mode))) {
13661351 ret = -EFAULT;
1352+ mutex_unlock(&dev->mode_config.mutex);
1353+
13671354 goto out;
13681355 }
13691356 copied++;
13701357 }
13711358 }
13721359 out_resp->count_modes = mode_count;
1373−out:
13741360 mutex_unlock(&dev->mode_config.mutex);
1375−out_unref:
1361+
1362+ drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
1363+ encoder = drm_connector_get_encoder(connector);
1364+ if (encoder)
1365+ out_resp->encoder_id = encoder->base.id;
1366+ else
1367+ out_resp->encoder_id = 0;
1368+
1369+ /* Only grab properties after probing, to make sure EDID and other
1370+ * properties reflect the latest status. */
1371+ ret = drm_mode_object_get_properties(&connector->base, file_priv->atomic,
1372+ (uint32_t __user *)(unsigned long)(out_resp->props_ptr),
1373+ (uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr),
1374+ &out_resp->count_props);
1375+ drm_modeset_unlock(&dev->mode_config.connection_mutex);
1376+
1377+out:
13761378 drm_connector_put(connector);
13771379
13781380 return ret;
drivers/gpu/drm/mgag200/mgag200_mode.c+8−1
@@ -1173,7 +1173,10 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, · 1172 unmodified lines
11731173
11741174
11751175 if (IS_G200_SE(mdev)) {
1176− if (mdev->unique_rev_id >= 0x02) {
1176+ if (mdev->unique_rev_id >= 0x04) {
1177+ WREG8(MGAREG_CRTCEXT_INDEX, 0x06);
1178+ WREG8(MGAREG_CRTCEXT_DATA, 0);
1179+ } else if (mdev->unique_rev_id >= 0x02) {
11771180 u8 hi_pri_lvl;
11781181 u32 bpp;
11791182 u32 mb;
@@ -1639,6 +1642,10 @@ static int mga_vga_mode_valid(struct drm_connector *connector, · 459 unmodified lines
16391642 if (mga_vga_calculate_mode_bandwidth(mode, bpp)
16401643 > (30100 * 1024))
16411644 return MODE_BANDWIDTH;
1645+ } else {
1646+ if (mga_vga_calculate_mode_bandwidth(mode, bpp)
1647+ > (55000 * 1024))
1648+ return MODE_BANDWIDTH;
16421649 }
16431650 } else if (mdev->type == G200_WB) {
16441651 if (mode->hdisplay > 1280)
drivers/gpu/drm/radeon/cik.c+5−2
@@ -9268,8 +9268,11 @@ static void dce8_program_watermarks(struct radeon_device *rdev, · 9267 unmodified lines
92689268 u32 tmp, wm_mask;
92699269
92709270 if (radeon_crtc->base.enabled && num_heads && mode) {
9271− active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock;
9272− line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535);
9271+ active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000,
9272+ (u32)mode->clock);
9273+ line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000,
9274+ (u32)mode->clock);
9275+ line_time = min(line_time, (u32)65535);
92739276
92749277 /* watermark for high clocks */
92759278 if ((rdev->pm.pm_method == PM_METHOD_DPM) &&
drivers/gpu/drm/radeon/evergreen.c+5−2
@@ -2163,8 +2163,11 @@ static void evergreen_program_watermarks(struct radeon_device *rdev, · 2162 unmodified lines
21632163 fixed20_12 a, b, c;
21642164
21652165 if (radeon_crtc->base.enabled && num_heads && mode) {
2166− active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock;
2167− line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535);
2166+ active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000,
2167+ (u32)mode->clock);
2168+ line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000,
2169+ (u32)mode->clock);
2170+ line_time = min(line_time, (u32)65535);
21682171 priority_a_cnt = 0;
21692172 priority_b_cnt = 0;
21702173 dram_channels = evergreen_get_number_of_dram_channels(rdev);
drivers/gpu/drm/radeon/radeon_combios.c+7−0
@@ -3393,6 +3393,13 @@ void radeon_combios_asic_init(struct drm_device *dev) · 3392 unmodified lines
33933393 rdev->pdev->subsystem_vendor == 0x103c &&
33943394 rdev->pdev->subsystem_device == 0x280a)
33953395 return;
3396+ /* quirk for rs4xx Toshiba Sattellite L20-183 latop to make it resume
3397+ * - it hangs on resume inside the dynclk 1 table.
3398+ */
3399+ if (rdev->family == CHIP_RS400 &&
3400+ rdev->pdev->subsystem_vendor == 0x1179 &&
3401+ rdev->pdev->subsystem_device == 0xff31)
3402+ return;
33963403
33973404 /* DYN CLK 1 */
33983405 table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE);
drivers/gpu/drm/radeon/radeon_device.c+4−0
@@ -136,6 +136,10 @@ static struct radeon_px_quirk radeon_px_quirk_list[] = { · 135 unmodified lines
136136 * https://bugzilla.kernel.org/show_bug.cgi?id=51381
137137 */
138138 { PCI_VENDOR_ID_ATI, 0x6840, 0x1043, 0x2122, RADEON_PX_QUIRK_DISABLE_PX },
139+ /* Asus K53TK laptop with AMD A6-3420M APU and Radeon 7670m GPU
140+ * https://bugs.freedesktop.org/show_bug.cgi?id=101491
141+ */
142+ { PCI_VENDOR_ID_ATI, 0x6741, 0x1043, 0x2122, RADEON_PX_QUIRK_DISABLE_PX },
139143 /* macbook pro 8.2 */
140144 { PCI_VENDOR_ID_ATI, 0x6741, PCI_VENDOR_ID_APPLE, 0x00e2, RADEON_PX_QUIRK_LONG_WAKEUP },
141145 { 0, 0, 0, 0, 0 },
drivers/gpu/drm/radeon/radeon_uvd.c+1−1
@@ -621,7 +621,7 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, · 620 unmodified lines
621621 }
622622
623623 /* TODO: is this still necessary on NI+ ? */
624− if ((cmd == 0 || cmd == 1 || cmd == 0x3) &&
624+ if ((cmd == 0 || cmd == 0x3) &&
625625 (start >> 28) != (p->rdev->uvd.gpu_addr >> 28)) {
626626 DRM_ERROR("msg/fb buffer %LX-%LX out of 256MB segment!\n",
627627 start, end);
drivers/gpu/drm/radeon/si.c+5−2
@@ -2308,8 +2308,11 @@ static void dce6_program_watermarks(struct radeon_device *rdev, · 2307 unmodified lines
23082308 fixed20_12 a, b, c;
23092309
23102310 if (radeon_crtc->base.enabled && num_heads && mode) {
2311− active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock;
2312− line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535);
2311+ active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000,
2312+ (u32)mode->clock);
2313+ line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000,
2314+ (u32)mode->clock);
2315+ line_time = min(line_time, (u32)65535);
23132316 priority_a_cnt = 0;
23142317 priority_b_cnt = 0;
23152318
drivers/gpu/drm/tegra/drm.c+5−17
@@ -562,18 +562,6 @@ fail: · 561 unmodified lines
562562
563563
564564 #ifdef CONFIG_DRM_TEGRA_STAGING
565−static struct tegra_drm_context *
566−tegra_drm_file_get_context(struct tegra_drm_file *file, u32 id)
567−{
568− struct tegra_drm_context *context;
569−
570− mutex_lock(&file->lock);
571− context = idr_find(&file->contexts, id);
572− mutex_unlock(&file->lock);
573−
574− return context;
575−}
576−
577565 static int tegra_gem_create(struct drm_device *drm, void *data,
578566 struct drm_file *file)
579567 {
@@ -662,7 +650,7 @@ static int tegra_client_open(struct tegra_drm_file *fpriv, · 82 unmodified lines
662650 if (err < 0)
663651 return err;
664652
665− err = idr_alloc(&fpriv->contexts, context, 0, 0, GFP_KERNEL);
653+ err = idr_alloc(&fpriv->contexts, context, 1, 0, GFP_KERNEL);
666654 if (err < 0) {
667655 client->ops->close_channel(context);
668656 return err;
@@ -717,7 +705,7 @@ static int tegra_close_channel(struct drm_device *drm, void *data, · 48 unmodified lines
717705
718706 mutex_lock(&fpriv->lock);
719707
720− context = tegra_drm_file_get_context(fpriv, args->context);
708+ context = idr_find(&fpriv->contexts, args->context);
721709 if (!context) {
722710 err = -EINVAL;
723711 goto unlock;
@@ -742,7 +730,7 @@ static int tegra_get_syncpt(struct drm_device *drm, void *data, · 18 unmodified lines
742730
743731 mutex_lock(&fpriv->lock);
744732
745− context = tegra_drm_file_get_context(fpriv, args->context);
733+ context = idr_find(&fpriv->contexts, args->context);
746734 if (!context) {
747735 err = -ENODEV;
748736 goto unlock;
@@ -771,7 +759,7 @@ static int tegra_submit(struct drm_device *drm, void *data, · 22 unmodified lines
771759
772760 mutex_lock(&fpriv->lock);
773761
774− context = tegra_drm_file_get_context(fpriv, args->context);
762+ context = idr_find(&fpriv->contexts, args->context);
775763 if (!context) {
776764 err = -ENODEV;
777765 goto unlock;
@@ -796,7 +784,7 @@ static int tegra_get_syncpt_base(struct drm_device *drm, void *data, · 18 unmodified lines
796784
797785 mutex_lock(&fpriv->lock);
798786
799− context = tegra_drm_file_get_context(fpriv, args->context);
787+ context = idr_find(&fpriv->contexts, args->context);
800788 if (!context) {
801789 err = -ENODEV;
802790 goto unlock;
drivers/gpu/host1x/dev.c+1−1
@@ -172,7 +172,7 @@ static int host1x_probe(struct platform_device *pdev) · 171 unmodified lines
172172
173173 host->rst = devm_reset_control_get(&pdev->dev, "host1x");
174174 if (IS_ERR(host->rst)) {
175− err = PTR_ERR(host->clk);
175+ err = PTR_ERR(host->rst);
176176 dev_err(&pdev->dev, "failed to get reset: %d\n", err);
177177 return err;
178178 }
drivers/hid/hid-core.c+221−61
@@ -826,11 +826,35 @@ static int hid_scan_report(struct hid_device *hid) · 825 unmodified lines
826826 * hid-rmi should take care of them,
827827 * not hid-generic
828828 */
829− if (IS_ENABLED(CONFIG_HID_RMI))
830− hid->group = HID_GROUP_RMI;
829+ hid->group = HID_GROUP_RMI;
831830 break;
832831 }
833832
833+ /* fall back to generic driver in case specific driver doesn't exist */
834+ switch (hid->group) {
835+ case HID_GROUP_MULTITOUCH_WIN_8:
836+ /* fall-through */
837+ case HID_GROUP_MULTITOUCH:
838+ if (!IS_ENABLED(CONFIG_HID_MULTITOUCH))
839+ hid->group = HID_GROUP_GENERIC;
840+ break;
841+ case HID_GROUP_SENSOR_HUB:
842+ if (!IS_ENABLED(CONFIG_HID_SENSOR_HUB))
843+ hid->group = HID_GROUP_GENERIC;
844+ break;
845+ case HID_GROUP_RMI:
846+ if (!IS_ENABLED(CONFIG_HID_RMI))
847+ hid->group = HID_GROUP_GENERIC;
848+ break;
849+ case HID_GROUP_WACOM:
850+ if (!IS_ENABLED(CONFIG_HID_WACOM))
851+ hid->group = HID_GROUP_GENERIC;
852+ break;
853+ case HID_GROUP_LOGITECH_DJ_DEVICE:
854+ if (!IS_ENABLED(CONFIG_HID_LOGITECH_DJ))
855+ hid->group = HID_GROUP_GENERIC;
856+ break;
857+ }
834858 vfree(parser);
835859 return 0;
836860 }
@@ -1763,15 +1787,23 @@ EXPORT_SYMBOL_GPL(hid_disconnect); · 926 unmodified lines
17631787 * used as a driver. See hid_scan_report().
17641788 */
17651789 static const struct hid_device_id hid_have_special_driver[] = {
1790+#if IS_ENABLED(CONFIG_HID_A4TECH)
17661791 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
17671792 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) },
17681793 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) },
1794+#endif
1795+#if IS_ENABLED(CONFIG_HID_ACCUTOUCH)
1796+ { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_ACCUTOUCH_2216) },
1797+#endif
1798+#if IS_ENABLED(CONFIG_HID_ACRUX)
17691799 { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) },
17701800 { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0xf705) },
1801+#endif
1802+#if IS_ENABLED(CONFIG_HID_ALPS)
17711803 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1_DUAL) },
1804+#endif
1805+#if IS_ENABLED(CONFIG_HID_APPLE)
17721806 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) },
1773− { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) },
1774− { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) },
17751807 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) },
17761808 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) },
17771809 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) },
@@ -1792,11 +1824,6 @@ static const struct hid_device_id hid_have_special_driver[] = { · 14 unmodified lines
17921824 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) },
17931825 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) },
17941826 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) },
1795− { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) },
1796− { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL2) },
1797− { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL3) },
1798− { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) },
1799− { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL5) },
18001827 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI) },
18011828 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO) },
18021829 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS) },
@@ -1851,62 +1878,100 @@ static const struct hid_device_id hid_have_special_driver[] = { · 48 unmodified lines
18511878 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI) },
18521879 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
18531880 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1881+#endif
1882+#if IS_ENABLED(CONFIG_HID_APPLEIR)
1883+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) },
1884+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL2) },
1885+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL3) },
1886+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) },
1887+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL5) },
1888+#endif
1889+#if IS_ENABLED(CONFIG_HID_ASUS)
18541890 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD) },
18551891 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD) },
18561892 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) },
18571893 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2) },
18581894 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD) },
1895+#endif
1896+#if IS_ENABLED(CONFIG_HID_AUREAL)
18591897 { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
1898+#endif
1899+#if IS_ENABLED(CONFIG_HID_BELKIN)
18601900 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
1901+ { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
1902+#endif
1903+#if IS_ENABLED(CONFIG_HID_BETOP_FF)
18611904 { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
18621905 { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) },
18631906 { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) },
18641907 { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) },
1865− { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
1866− { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
1908+#endif
1909+#if IS_ENABLED(CONFIG_HID_CHERRY)
18671910 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
18681911 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) },
1912+#endif
1913+#if IS_ENABLED(CONFIG_HID_CHICONY)
18691914 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
1870− { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) },
18711915 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) },
18721916 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) },
18731917 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) },
1918+ { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_ZEN_AIO_KBD) },
1919+#endif
1920+#if IS_ENABLED(CONFIG_HID_CMEDIA)
1921+ { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM6533) },
1922+#endif
1923+#if IS_ENABLED(CONFIG_HID_CORSAIR)
18741924 { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90) },
18751925 { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB) },
1876− { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) },
1926+#endif
1927+#if IS_ENABLED(CONFIG_HID_CP2112)
18771928 { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_CP2112) },
1929+#endif
1930+#if IS_ENABLED(CONFIG_HID_CYPRESS)
18781931 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
18791932 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
18801933 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) },
18811934 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_4) },
18821935 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) },
1883− { HID_USB_DEVICE(USB_VENDOR_ID_DELCOM, USB_DEVICE_ID_DELCOM_VISUAL_IND) },
1936+#endif
1937+#if IS_ENABLED(CONFIG_HID_DRAGONRISE)
18841938 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) },
18851939 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0011) },
1886−#if IS_ENABLED(CONFIG_HID_MAYFLASH)
1887− { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3) },
1888− { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR) },
1889− { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE1) },
1890− { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE2) },
18911940 #endif
1892− { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_WN) },
1893− { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_FA) },
1941+#if IS_ENABLED(CONFIG_HID_ELECOM)
18941942 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) },
18951943 { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_DEFT_WIRED) },
18961944 { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_DEFT_WIRELESS) },
1945+#endif
1946+#if IS_ENABLED(CONFIG_HID_ELO)
18971947 { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0009) },
18981948 { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0030) },
1899− { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_ACCUTOUCH_2216) },
1949+#endif
1950+#if IS_ENABLED(CONFIG_HID_EMS_FF)
19001951 { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) },
1952+#endif
1953+#if IS_ENABLED(CONFIG_HID_EZKEY)
19011954 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
1902− { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
1903− { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) },
1955+#endif
1956+#if IS_ENABLED(CONFIG_HID_GEMBIRD)
19041957 { HID_USB_DEVICE(USB_VENDOR_ID_GEMBIRD, USB_DEVICE_ID_GEMBIRD_JPD_DUALFORCE2) },
1905− { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) },
1958+#endif
1959+#if IS_ENABLED(CONFIG_HID_GFRM)
1960+ { HID_BLUETOOTH_DEVICE(0x58, 0x2000) },
1961+ { HID_BLUETOOTH_DEVICE(0x471, 0x2210) },
1962+#endif
1963+#if IS_ENABLED(CONFIG_HID_GREENASIA)
19061964 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) },
1965+#endif
1966+#if IS_ENABLED(CONFIG_HID_GT683R)
1967+ { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) },
1968+#endif
1969+#if IS_ENABLED(CONFIG_HID_GYRATION)
19071970 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
19081971 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) },
19091972 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) },
1973+#endif
1974+#if IS_ENABLED(CONFIG_HID_HOLTEK)
19101975 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP) },
19111976 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) },
19121977 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) },
@@ -1915,12 +1980,17 @@ static const struct hid_device_id hid_have_special_driver[] = { · 2 unmodified lines
19151980 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072) },
19161981 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) },
19171982 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2) },
1918− { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET) },
1919− { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_ZEN_AIO_KBD) },
1920− { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) },
1983+#endif
1984+#if IS_ENABLED(CONFIG_HID_ICADE)
19211985 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) },
1986+#endif
1987+#if IS_ENABLED(CONFIG_HID_KENSINGTON)
19221988 { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
1989+#endif
1990+#if IS_ENABLED(CONFIG_HID_KEYTOUCH)
19231991 { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) },
1992+#endif
1993+#if IS_ENABLED(CONFIG_HID_KYE)
19241994 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) },
19251995 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_MANTICORE) },
19261996 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GX_IMPERATOR) },
@@ -1930,21 +2000,29 @@ static const struct hid_device_id hid_have_special_driver[] = { · 3 unmodified lines
19302000 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_V2) },
19312001 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) },
19322002 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_PENSKETCH_M912) },
1933− { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
2003+#endif
2004+#if IS_ENABLED(CONFIG_HID_LCPOWER)
19342005 { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) },
2006+#endif
2007+#if IS_ENABLED(CONFIG_HID_LED)
2008+ { HID_USB_DEVICE(USB_VENDOR_ID_DELCOM, USB_DEVICE_ID_DELCOM_VISUAL_IND) },
2009+ { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_WN) },
2010+ { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_FA) },
2011+ { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_LUXAFOR) },
2012+ { HID_USB_DEVICE(USB_VENDOR_ID_RISO_KAGAKU, USB_DEVICE_ID_RI_KA_WEBMAIL) },
2013+ { HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) },
2014+#endif
19352015 #if IS_ENABLED(CONFIG_HID_LENOVO)
19362016 { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) },
19372017 { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) },
19382018 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) },
19392019 { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) },
19402020 #endif
1941− { HID_USB_DEVICE(USB_VENDOR_ID_LG, USB_DEVICE_ID_LG_MELFAS_MT) },
2021+#if IS_ENABLED(CONFIG_HID_LOGITECH)
19422022 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) },
19432023 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) },
19442024 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) },
19452025 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER) },
1946− { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) },
1947− { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_T651) },
19482026 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) },
19492027 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) },
19502028 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) },
@@ -1957,7 +2035,6 @@ static const struct hid_device_id hid_have_special_driver[] = { · 6 unmodified lines
19572035 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) },
19582036 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) },
19592037 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29_WHEEL) },
1960− { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL) },
19612038 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) },
19622039 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) },
19632040 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) },
@@ -1969,17 +2046,30 @@ static const struct hid_device_id hid_have_special_driver[] = { · 5 unmodified lines
19692046 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL) },
19702047 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) },
19712048 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL) },
1972−#if IS_ENABLED(CONFIG_HID_LOGITECH_DJ)
1973− { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER) },
1974− { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2) },
1975−#endif
19762049 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL) },
19772050 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) },
19782051 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER) },
19792052 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR) },
1980− { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) },
1981− { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) },
1982− { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_LUXAFOR) },
2053+#endif
2054+#if IS_ENABLED(CONFIG_HID_LOGITECH_HIDPP)
2055+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_T651) },
2056+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL) },
2057+#endif
2058+#if IS_ENABLED(CONFIG_HID_LOGITECH_DJ)
2059+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER) },
2060+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2) },
2061+#endif
2062+#if IS_ENABLED(CONFIG_HID_MAGICMOUSE)
2063+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) },
2064+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) },
2065+#endif
2066+#if IS_ENABLED(CONFIG_HID_MAYFLASH)
2067+ { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3) },
2068+ { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR) },
2069+ { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE1) },
2070+ { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE2) },
2071+#endif
2072+#if IS_ENABLED(CONFIG_HID_MICROSOFT)
19832073 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) },
19842074 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_KEYBOARD) },
19852075 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) },
@@ -1995,9 +2085,22 @@ static const struct hid_device_id hid_have_special_driver[] = { · 9 unmodified lines
19952085 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_600) },
19962086 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3KV1) },
19972087 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER) },
2088+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
2089+#endif
2090+#if IS_ENABLED(CONFIG_HID_MONTEREY)
19982091 { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
1999− { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) },
2092+#endif
2093+#if IS_ENABLED(CONFIG_HID_MULTITOUCH)
2094+ { HID_USB_DEVICE(USB_VENDOR_ID_LG, USB_DEVICE_ID_LG_MELFAS_MT) },
2095+#endif
2096+#if IS_ENABLED(CONFIG_HID_WIIMOTE)
2097+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) },
2098+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE2) },
2099+#endif
2100+#if IS_ENABLED(CONFIG_HID_NTI)
20002101 { HID_USB_DEVICE(USB_VENDOR_ID_NTI, USB_DEVICE_ID_USB_SUN) },
2102+#endif
2103+#if IS_ENABLED(CONFIG_HID_NTRIG)
20012104 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
20022105 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) },
20032106 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2) },
@@ -2017,13 +2120,41 @@ static const struct hid_device_id hid_have_special_driver[] = { · 13 unmodified lines
20172120 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_16) },
20182121 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_17) },
20192122 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) },
2123+#endif
2124+#if IS_ENABLED(CONFIG_HID_ORTEK)
20202125 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) },
20212126 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
2127+ { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
2128+#endif
2129+#if IS_ENABLED(CONFIG_HID_PANTHERLORD)
2130+ { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
2131+ { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) },
2132+ { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) },
2133+ { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) },
2134+#endif
2135+#if IS_ENABLED(CONFIG_HID_PENMOUNT)
20222136 { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) },
2137+#endif
2138+#if IS_ENABLED(CONFIG_HID_PETALYNX)
20232139 { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
2140+#endif
2141+#if IS_ENABLED(CONFIG_HID_PICOLCD)
2142+ { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) },
2143+ { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) },
2144+#endif
2145+#if IS_ENABLED(CONFIG_HID_PLANTRONICS)
20242146 { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
2147+#endif
2148+#if IS_ENABLED(CONFIG_HID_PRIMAX)
20252149 { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) },
2026− { HID_USB_DEVICE(USB_VENDOR_ID_RISO_KAGAKU, USB_DEVICE_ID_RI_KA_WEBMAIL) },
2150+#endif
2151+#if IS_ENABLED(CONFIG_HID_PRODIKEYS)
2152+ { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) },
2153+#endif
2154+#if IS_ENABLED(CONFIG_HID_RMI)
2155+ { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_X1_COVER) },
2156+ { HID_USB_DEVICE(USB_VENDOR_ID_RAZER, USB_DEVICE_ID_RAZER_BLADE_14) },
2157+#endif
20272158 #if IS_ENABLED(CONFIG_HID_ROCCAT)
20282159 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) },
20292160 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) },
@@ -2051,9 +2182,21 @@ static const struct hid_device_id hid_have_special_driver[] = { · 21 unmodified lines
20512182 { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT5) },
20522183 { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) },
20532184 #endif
2185+#if IS_ENABLED(CONFIG_HID_SAMSUNG)
20542186 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
20552187 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) },
2056− { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
2188+#endif
2189+#if IS_ENABLED(CONFIG_HID_SMARTJOYPLUS)
2190+ { HID_USB_DEVICE(USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII) },
2191+ { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) },
2192+ { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SUPER_JOY_BOX_3) },
2193+ { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD) },
2194+ { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) },
2195+ { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) },
2196+ { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) },
2197+#endif
2198+#if IS_ENABLED(CONFIG_HID_SONY)
2199+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) },
20572200 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_PS3_BDREMOTE) },
20582201 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) },
20592202 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) },
@@ -2072,9 +2215,17 @@ static const struct hid_device_id hid_have_special_driver[] = { · 12 unmodified lines
20722215 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
20732216 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE) },
20742217 { HID_USB_DEVICE(USB_VENDOR_ID_SINO_LITE, USB_DEVICE_ID_SINO_LITE_CONTROLLER) },
2218+#endif
2219+#if IS_ENABLED(CONFIG_HID_SPEEDLINK)
2220+ { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE) },
2221+#endif
2222+#if IS_ENABLED(CONFIG_HID_STEELSERIES)
20752223 { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_SRWS1) },
2224+#endif
2225+#if IS_ENABLED(CONFIG_HID_SUNPLUS)
20762226 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
2077− { HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) },
2227+#endif
2228+#if IS_ENABLED(CONFIG_HID_THRUSTMASTER)
20782229 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
20792230 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) },
20802231 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb323) },
@@ -2083,12 +2234,25 @@ static const struct hid_device_id hid_have_special_driver[] = { · 2 unmodified lines
20832234 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb653) },
20842235 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) },
20852236 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) },
2237+#endif
2238+#if IS_ENABLED(CONFIG_HID_TIVO)
20862239 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) },
20872240 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) },
20882241 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) },
2242+#endif
2243+#if IS_ENABLED(CONFIG_HID_TOPSEED)
2244+ { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
2245+ { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
2246+ { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) },
20892247 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
20902248 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) },
2249+#endif
2250+#if IS_ENABLED(CONFIG_HID_TWINHAN)
20912251 { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) },
2252+#endif
2253+#if IS_ENABLED(CONFIG_HID_UCLOGIC)
2254+ { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET) },
2255+ { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_HUION_TABLET) },
20922256 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) },
20932257 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) },
20942258 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) },
@@ -2096,20 +2260,17 @@ static const struct hid_device_id hid_have_special_driver[] = { · 1 unmodified line
20962260 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP1062) },
20972261 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_WIRELESS_TABLET_TWHL850) },
20982262 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWHA60) },
2099− { HID_USB_DEVICE(USB_VENDOR_ID_THQ, USB_DEVICE_ID_THQ_PS3_UDRAW) },
21002263 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_YIYNOVA_TABLET) },
21012264 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UGEE_TABLET_81) },
21022265 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UGEE_TABLET_45) },
21032266 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_DRAWIMAGE_G3) },
2104− { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, USB_DEVICE_ID_UGTIZER_TABLET_GP0610) },
21052267 { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_TABLET_EX07S) },
2106− { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) },
2107− { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SUPER_JOY_BOX_3) },
2108− { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD) },
2109− { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) },
2110− { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) },
2111− { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) },
2112− { HID_USB_DEVICE(USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII) },
2268+ { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, USB_DEVICE_ID_UGTIZER_TABLET_GP0610) },
2269+#endif
2270+#if IS_ENABLED(CONFIG_HID_UDRAW_PS3)
2271+ { HID_USB_DEVICE(USB_VENDOR_ID_THQ, USB_DEVICE_ID_THQ_PS3_UDRAW) },
2272+#endif
2273+#if IS_ENABLED(CONFIG_HID_WALTOP)
21132274 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) },
21142275 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) },
21152276 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_Q_PAD) },
@@ -2117,19 +2278,18 @@ static const struct hid_device_id hid_have_special_driver[] = { · 1 unmodified line
21172278 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) },
21182279 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) },
21192280 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET) },
2120− { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE) },
2281+#endif
2282+#if IS_ENABLED(CONFIG_HID_XINMO)
21212283 { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE) },
21222284 { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_THT_2P_ARCADE) },
2285+#endif
2286+#if IS_ENABLED(CONFIG_HID_ZEROPLUS)
21232287 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
21242288 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
2289+#endif
2290+#if IS_ENABLED(CONFIG_HID_ZYDACRON)
21252291 { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) },
2126−
2127− { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
2128− { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) },
2129− { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE2) },
2130− { HID_USB_DEVICE(USB_VENDOR_ID_RAZER, USB_DEVICE_ID_RAZER_BLADE_14) },
2131− { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM6533) },
2132− { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_X1_COVER) },
2292+#endif
21332293 { }
21342294 };
21352295
drivers/hid/hid-ids.h+3−0
@@ -319,6 +319,9 @@ · 318 unmodified lines
319319 #define USB_VENDOR_ID_DELCOM 0x0fc5
320320 #define USB_DEVICE_ID_DELCOM_VISUAL_IND 0xb080
321321
322+#define USB_VENDOR_ID_DELL 0x413c
323+#define USB_DEVICE_ID_DELL_PIXART_USB_OPTICAL_MOUSE 0x301a
324+
322325 #define USB_VENDOR_ID_DELORME 0x1163
323326 #define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100
324327 #define USB_DEVICE_ID_DELORME_EM_LT20 0x0200
drivers/hid/hid-magicmouse.c+7−8
@@ -349,7 +349,6 @@ static int magicmouse_raw_event(struct hid_device *hdev, · 348 unmodified lines
349349
350350 if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
351351 magicmouse_emit_buttons(msc, clicks & 3);
352− input_mt_report_pointer_emulation(input, true);
353352 input_report_rel(input, REL_X, x);
354353 input_report_rel(input, REL_Y, y);
355354 } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
@@ -389,16 +388,16 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd · 33 unmodified lines
389388 __clear_bit(BTN_RIGHT, input->keybit);
390389 __clear_bit(BTN_MIDDLE, input->keybit);
391390 __set_bit(BTN_MOUSE, input->keybit);
391+ __set_bit(BTN_TOOL_FINGER, input->keybit);
392+ __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
393+ __set_bit(BTN_TOOL_TRIPLETAP, input->keybit);
394+ __set_bit(BTN_TOOL_QUADTAP, input->keybit);
395+ __set_bit(BTN_TOOL_QUINTTAP, input->keybit);
396+ __set_bit(BTN_TOUCH, input->keybit);
397+ __set_bit(INPUT_PROP_POINTER, input->propbit);
392398 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
393399 }
394400
395− __set_bit(BTN_TOOL_FINGER, input->keybit);
396− __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
397− __set_bit(BTN_TOOL_TRIPLETAP, input->keybit);
398− __set_bit(BTN_TOOL_QUADTAP, input->keybit);
399− __set_bit(BTN_TOOL_QUINTTAP, input->keybit);
400− __set_bit(BTN_TOUCH, input->keybit);
401− __set_bit(INPUT_PROP_POINTER, input->propbit);
402401
403402 __set_bit(EV_ABS, input->evbit);
404403
drivers/hid/usbhid/hid-quirks.c+1−0
@@ -85,6 +85,7 @@ static const struct hid_blacklist { · 84 unmodified lines
8585 { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K65RGB_RAPIDFIRE, HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL },
8686 { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB, HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL },
8787 { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51, HID_QUIRK_NOGET },
88+ { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
8889 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
8990 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT },
9091 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3, HID_QUIRK_MULTI_INPUT },
drivers/hsi/clients/ssi_protocol.c+1−1
@@ -1066,7 +1066,7 @@ static void ssip_pn_setup(struct net_device *dev) · 1065 unmodified lines
10661066 dev->addr_len = 1;
10671067 dev->tx_queue_len = SSIP_TXQUEUE_LEN;
10681068
1069− dev->destructor = free_netdev;
1069+ dev->needs_free_netdev = true;
10701070 dev->header_ops = &phonet_header_ops;
10711071 }
10721072
drivers/i2c/busses/i2c-imx.c+4−4
@@ -734,9 +734,9 @@ static int i2c_imx_dma_read(struct imx_i2c_struct *i2c_imx, · 733 unmodified lines
734734 * the first read operation, otherwise the first read cost
735735 * one extra clock cycle.
736736 */
737− temp = readb(i2c_imx->base + IMX_I2C_I2CR);
737+ temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR);
738738 temp |= I2CR_MTX;
739− writeb(temp, i2c_imx->base + IMX_I2C_I2CR);
739+ imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR);
740740 }
741741 msgs->buf[msgs->len-1] = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2DR);
742742
@@ -857,9 +857,9 @@ static int i2c_imx_read(struct imx_i2c_struct *i2c_imx, struct i2c_msg *msgs, bo · 114 unmodified lines
857857 * the first read operation, otherwise the first read cost
858858 * one extra clock cycle.
859859 */
860− temp = readb(i2c_imx->base + IMX_I2C_I2CR);
860+ temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR);
861861 temp |= I2CR_MTX;
862− writeb(temp, i2c_imx->base + IMX_I2C_I2CR);
862+ imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR);
863863 }
864864 } else if (i == (msgs->len - 2)) {
865865 dev_dbg(&i2c_imx->adapter.dev,
drivers/i2c/busses/i2c-ismt.c+1−1
@@ -584,7 +584,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, · 583 unmodified lines
584584
585585 /* unmap the data buffer */
586586 if (dma_size != 0)
587− dma_unmap_single(&adap->dev, dma_addr, dma_size, dma_direction);
587+ dma_unmap_single(dev, dma_addr, dma_size, dma_direction);
588588
589589 if (unlikely(!time_left)) {
590590 dev_err(dev, "completion wait timed out\n");
drivers/i2c/busses/i2c-rcar.c+1−1
@@ -319,7 +319,7 @@ static void rcar_i2c_dma_unmap(struct rcar_i2c_priv *priv) · 318 unmodified lines
319319 rcar_i2c_write(priv, ICFBSCR, TCYC06);
320320
321321 dma_unmap_single(chan->device->dev, sg_dma_address(&priv->sg),
322− priv->msg->len, priv->dma_direction);
322+ sg_dma_len(&priv->sg), priv->dma_direction);
323323
324324 priv->dma_direction = DMA_NONE;
325325 }
drivers/iio/adc/meson_saradc.c+2−2
@@ -468,13 +468,13 @@ static void meson_sar_adc_unlock(struct iio_dev *indio_dev) · 467 unmodified lines
468468 static void meson_sar_adc_clear_fifo(struct iio_dev *indio_dev)
469469 {
470470 struct meson_sar_adc_priv *priv = iio_priv(indio_dev);
471− int count;
471+ unsigned int count, tmp;
472472
473473 for (count = 0; count < MESON_SAR_ADC_MAX_FIFO_SIZE; count++) {
474474 if (!meson_sar_adc_get_fifo_count(indio_dev))
475475 break;
476476
477− regmap_read(priv->regmap, MESON_SAR_ADC_FIFO_RD, 0);
477+ regmap_read(priv->regmap, MESON_SAR_ADC_FIFO_RD, &tmp);
478478 }
479479 }
480480
drivers/iio/adc/mxs-lradc-adc.c+5−2
@@ -718,9 +718,12 @@ static int mxs_lradc_adc_probe(struct platform_device *pdev) · 717 unmodified lines
718718 adc->dev = dev;
719719
720720 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
721+ if (!iores)
722+ return -EINVAL;
723+
721724 adc->base = devm_ioremap(dev, iores->start, resource_size(iores));
722− if (IS_ERR(adc->base))
723− return PTR_ERR(adc->base);
725+ if (!adc->base)
726+ return -ENOMEM;
724727
725728 init_completion(&adc->completion);
726729 spin_lock_init(&adc->lock);
drivers/iio/buffer/industrialio-buffer-dma.c+1−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <linux/sched.h>
1515 #include <linux/poll.h>
1616 #include <linux/iio/buffer.h>
17+#include <linux/iio/buffer_impl.h>
1718 #include <linux/iio/buffer-dma.h>
1819 #include <linux/dma-mapping.h>
1920 #include <linux/sizes.h>
drivers/iio/buffer/industrialio-buffer-dmaengine.c+1−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414
1515 #include <linux/iio/iio.h>
1616 #include <linux/iio/buffer.h>
17+#include <linux/iio/buffer_impl.h>
1718 #include <linux/iio/buffer-dma.h>
1819 #include <linux/iio/buffer-dmaengine.h>
1920
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c+36−3
@@ -41,6 +41,7 @@ static const int accel_scale[] = {598, 1196, 2392, 4785}; · 40 unmodified lines
4141 static const struct inv_mpu6050_reg_map reg_set_6500 = {
4242 .sample_rate_div = INV_MPU6050_REG_SAMPLE_RATE_DIV,
4343 .lpf = INV_MPU6050_REG_CONFIG,
44+ .accel_lpf = INV_MPU6500_REG_ACCEL_CONFIG_2,
4445 .user_ctrl = INV_MPU6050_REG_USER_CTRL,
4546 .fifo_en = INV_MPU6050_REG_FIFO_EN,
4647 .gyro_config = INV_MPU6050_REG_GYRO_CONFIG,
@@ -210,6 +211,37 @@ int inv_mpu6050_set_power_itg(struct inv_mpu6050_state *st, bool power_on) · 163 unmodified lines
210211 }
211212 EXPORT_SYMBOL_GPL(inv_mpu6050_set_power_itg);
212213
214+/**
215+ * inv_mpu6050_set_lpf_regs() - set low pass filter registers, chip dependent
216+ *
217+ * MPU60xx/MPU9150 use only 1 register for accelerometer + gyroscope
218+ * MPU6500 and above have a dedicated register for accelerometer
219+ */
220+static int inv_mpu6050_set_lpf_regs(struct inv_mpu6050_state *st,
221+ enum inv_mpu6050_filter_e val)
222+{
223+ int result;
224+
225+ result = regmap_write(st->map, st->reg->lpf, val);
226+ if (result)
227+ return result;
228+
229+ switch (st->chip_type) {
230+ case INV_MPU6050:
231+ case INV_MPU6000:
232+ case INV_MPU9150:
233+ /* old chips, nothing to do */
234+ result = 0;
235+ break;
236+ default:
237+ /* set accel lpf */
238+ result = regmap_write(st->map, st->reg->accel_lpf, val);
239+ break;
240+ }
241+
242+ return result;
243+}
244+
213245 /**
214246 * inv_mpu6050_init_config() - Initialize hardware, disable FIFO.
215247 *
@@ -233,8 +265,7 @@ static int inv_mpu6050_init_config(struct iio_dev *indio_dev) · 17 unmodified lines
233265 if (result)
234266 return result;
235267
236− d = INV_MPU6050_FILTER_20HZ;
237− result = regmap_write(st->map, st->reg->lpf, d);
268+ result = inv_mpu6050_set_lpf_regs(st, INV_MPU6050_FILTER_20HZ);
238269 if (result)
239270 return result;
240271
@@ -537,6 +568,8 @@ error_write_raw: · 296 unmodified lines
537568 * would be alising. This function basically search for the
538569 * correct low pass parameters based on the fifo rate, e.g,
539570 * sampling frequency.
571+ *
572+ * lpf is set automatically when setting sampling rate to avoid any aliases.
540573 */
541574 static int inv_mpu6050_set_lpf(struct inv_mpu6050_state *st, int rate)
542575 {
@@ -552,7 +585,7 @@ static int inv_mpu6050_set_lpf(struct inv_mpu6050_state *st, int rate) · 9 unmodified lines
552585 while ((h < hz[i]) && (i < ARRAY_SIZE(d) - 1))
553586 i++;
554587 data = d[i];
555− result = regmap_write(st->map, st->reg->lpf, data);
588+ result = inv_mpu6050_set_lpf_regs(st, data);
556589 if (result)
557590 return result;
558591 st->chip_config.lpf = data;
drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h+3−0
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 * struct inv_mpu6050_reg_map - Notable registers.
2929 * @sample_rate_div: Divider applied to gyro output rate.
3030 * @lpf: Configures internal low pass filter.
31+ * @accel_lpf: Configures accelerometer low pass filter.
3132 * @user_ctrl: Enables/resets the FIFO.
3233 * @fifo_en: Determines which data will appear in FIFO.
3334 * @gyro_config: gyro config register.
@@ -47,6 +48,7 @@ · 13 unmodified lines
4748 struct inv_mpu6050_reg_map {
4849 u8 sample_rate_div;
4950 u8 lpf;
51+ u8 accel_lpf;
5052 u8 user_ctrl;
5153 u8 fifo_en;
5254 u8 gyro_config;
@@ -188,6 +190,7 @@ struct inv_mpu6050_state { · 135 unmodified lines
188190 #define INV_MPU6050_FIFO_THRESHOLD 500
189191
190192 /* mpu6500 registers */
193+#define INV_MPU6500_REG_ACCEL_CONFIG_2 0x1D
191194 #define INV_MPU6500_REG_ACCEL_OFFSET 0x77
192195
193196 /* delay time in milliseconds */
drivers/infiniband/core/addr.c+1−9
@@ -449,12 +449,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, · 448 unmodified lines
449449 return ret;
450450
451451 rt = (struct rt6_info *)dst;
452− if (ipv6_addr_any(&fl6.saddr)) {
453− ret = ipv6_dev_get_saddr(addr->net, ip6_dst_idev(dst)->dev,
454− &fl6.daddr, 0, &fl6.saddr);
455− if (ret)
456− goto put;
457−
452+ if (ipv6_addr_any(&src_in->sin6_addr)) {
458453 src_in->sin6_family = AF_INET6;
459454 src_in->sin6_addr = fl6.saddr;
460455 }
@@ -471,9 +466,6 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, · 10 unmodified lines
471466
472467 *pdst = dst;
473468 return 0;
474−put:
475− dst_release(dst);
476− return ret;
477469 }
478470 #else
479471 static int addr6_resolve(struct sockaddr_in6 *src_in,
drivers/infiniband/hw/bnxt_re/bnxt_re.h+4−0
@@ -56,6 +56,10 @@ · 55 unmodified lines
5656 #define BNXT_RE_MAX_SRQC_COUNT (64 * 1024)
5757 #define BNXT_RE_MAX_CQ_COUNT (64 * 1024)
5858
59+#define BNXT_RE_UD_QP_HW_STALL 0x400000
60+
61+#define BNXT_RE_RQ_WQE_THRESHOLD 32
62+
5963 struct bnxt_re_work {
6064 struct work_struct work;
6165 unsigned long event;
drivers/infiniband/hw/bnxt_re/ib_verbs.c+347−124
@@ -61,6 +61,48 @@ · 60 unmodified lines
6161 #include "ib_verbs.h"
6262 #include <rdma/bnxt_re-abi.h>
6363
64+static int __from_ib_access_flags(int iflags)
65+{
66+ int qflags = 0;
67+
68+ if (iflags & IB_ACCESS_LOCAL_WRITE)
69+ qflags |= BNXT_QPLIB_ACCESS_LOCAL_WRITE;
70+ if (iflags & IB_ACCESS_REMOTE_READ)
71+ qflags |= BNXT_QPLIB_ACCESS_REMOTE_READ;
72+ if (iflags & IB_ACCESS_REMOTE_WRITE)
73+ qflags |= BNXT_QPLIB_ACCESS_REMOTE_WRITE;
74+ if (iflags & IB_ACCESS_REMOTE_ATOMIC)
75+ qflags |= BNXT_QPLIB_ACCESS_REMOTE_ATOMIC;
76+ if (iflags & IB_ACCESS_MW_BIND)
77+ qflags |= BNXT_QPLIB_ACCESS_MW_BIND;
78+ if (iflags & IB_ZERO_BASED)
79+ qflags |= BNXT_QPLIB_ACCESS_ZERO_BASED;
80+ if (iflags & IB_ACCESS_ON_DEMAND)
81+ qflags |= BNXT_QPLIB_ACCESS_ON_DEMAND;
82+ return qflags;
83+};
84+
85+static enum ib_access_flags __to_ib_access_flags(int qflags)
86+{
87+ enum ib_access_flags iflags = 0;
88+
89+ if (qflags & BNXT_QPLIB_ACCESS_LOCAL_WRITE)
90+ iflags |= IB_ACCESS_LOCAL_WRITE;
91+ if (qflags & BNXT_QPLIB_ACCESS_REMOTE_WRITE)
92+ iflags |= IB_ACCESS_REMOTE_WRITE;
93+ if (qflags & BNXT_QPLIB_ACCESS_REMOTE_READ)
94+ iflags |= IB_ACCESS_REMOTE_READ;
95+ if (qflags & BNXT_QPLIB_ACCESS_REMOTE_ATOMIC)
96+ iflags |= IB_ACCESS_REMOTE_ATOMIC;
97+ if (qflags & BNXT_QPLIB_ACCESS_MW_BIND)
98+ iflags |= IB_ACCESS_MW_BIND;
99+ if (qflags & BNXT_QPLIB_ACCESS_ZERO_BASED)
100+ iflags |= IB_ZERO_BASED;
101+ if (qflags & BNXT_QPLIB_ACCESS_ON_DEMAND)
102+ iflags |= IB_ACCESS_ON_DEMAND;
103+ return iflags;
104+};
105+
64106 static int bnxt_re_build_sgl(struct ib_sge *ib_sg_list,
65107 struct bnxt_qplib_sge *sg_list, int num)
66108 {
@@ -149,8 +191,8 @@ int bnxt_re_query_device(struct ib_device *ibdev, · 82 unmodified lines
149191 ib_attr->max_total_mcast_qp_attach = 0;
150192 ib_attr->max_ah = dev_attr->max_ah;
151193
152− ib_attr->max_fmr = dev_attr->max_fmr;
153− ib_attr->max_map_per_fmr = 1; /* ? */
194+ ib_attr->max_fmr = 0;
195+ ib_attr->max_map_per_fmr = 0;
154196
155197 ib_attr->max_srq = dev_attr->max_srq;
156198 ib_attr->max_srq_wr = dev_attr->max_srq_wqes;
@@ -410,6 +452,158 @@ enum rdma_link_layer bnxt_re_get_link_layer(struct ib_device *ibdev, · 253 unmodified lines
410452 return IB_LINK_LAYER_ETHERNET;
411453 }
412454
455+#define BNXT_RE_FENCE_PBL_SIZE DIV_ROUND_UP(BNXT_RE_FENCE_BYTES, PAGE_SIZE)
456+
457+static void bnxt_re_create_fence_wqe(struct bnxt_re_pd *pd)
458+{
459+ struct bnxt_re_fence_data *fence = &pd->fence;
460+ struct ib_mr *ib_mr = &fence->mr->ib_mr;
461+ struct bnxt_qplib_swqe *wqe = &fence->bind_wqe;
462+
463+ memset(wqe, 0, sizeof(*wqe));
464+ wqe->type = BNXT_QPLIB_SWQE_TYPE_BIND_MW;
465+ wqe->wr_id = BNXT_QPLIB_FENCE_WRID;
466+ wqe->flags |= BNXT_QPLIB_SWQE_FLAGS_SIGNAL_COMP;
467+ wqe->flags |= BNXT_QPLIB_SWQE_FLAGS_UC_FENCE;
468+ wqe->bind.zero_based = false;
469+ wqe->bind.parent_l_key = ib_mr->lkey;
470+ wqe->bind.va = (u64)(unsigned long)fence->va;
471+ wqe->bind.length = fence->size;
472+ wqe->bind.access_cntl = __from_ib_access_flags(IB_ACCESS_REMOTE_READ);
473+ wqe->bind.mw_type = SQ_BIND_MW_TYPE_TYPE1;
474+
475+ /* Save the initial rkey in fence structure for now;
476+ * wqe->bind.r_key will be set at (re)bind time.
477+ */
478+ fence->bind_rkey = ib_inc_rkey(fence->mw->rkey);
479+}
480+
481+static int bnxt_re_bind_fence_mw(struct bnxt_qplib_qp *qplib_qp)
482+{
483+ struct bnxt_re_qp *qp = container_of(qplib_qp, struct bnxt_re_qp,
484+ qplib_qp);
485+ struct ib_pd *ib_pd = qp->ib_qp.pd;
486+ struct bnxt_re_pd *pd = container_of(ib_pd, struct bnxt_re_pd, ib_pd);
487+ struct bnxt_re_fence_data *fence = &pd->fence;
488+ struct bnxt_qplib_swqe *fence_wqe = &fence->bind_wqe;
489+ struct bnxt_qplib_swqe wqe;
490+ int rc;
491+
492+ memcpy(&wqe, fence_wqe, sizeof(wqe));
493+ wqe.bind.r_key = fence->bind_rkey;
494+ fence->bind_rkey = ib_inc_rkey(fence->bind_rkey);
495+
496+ dev_dbg(rdev_to_dev(qp->rdev),
497+ "Posting bind fence-WQE: rkey: %#x QP: %d PD: %p\n",
498+ wqe.bind.r_key, qp->qplib_qp.id, pd);
499+ rc = bnxt_qplib_post_send(&qp->qplib_qp, &wqe);
500+ if (rc) {
501+ dev_err(rdev_to_dev(qp->rdev), "Failed to bind fence-WQE\n");
502+ return rc;
503+ }
504+ bnxt_qplib_post_send_db(&qp->qplib_qp);
505+
506+ return rc;
507+}
508+
509+static void bnxt_re_destroy_fence_mr(struct bnxt_re_pd *pd)
510+{
511+ struct bnxt_re_fence_data *fence = &pd->fence;
512+ struct bnxt_re_dev *rdev = pd->rdev;
513+ struct device *dev = &rdev->en_dev->pdev->dev;
514+ struct bnxt_re_mr *mr = fence->mr;
515+
516+ if (fence->mw) {
517+ bnxt_re_dealloc_mw(fence->mw);
518+ fence->mw = NULL;
519+ }
520+ if (mr) {
521+ if (mr->ib_mr.rkey)
522+ bnxt_qplib_dereg_mrw(&rdev->qplib_res, &mr->qplib_mr,
523+ true);
524+ if (mr->ib_mr.lkey)
525+ bnxt_qplib_free_mrw(&rdev->qplib_res, &mr->qplib_mr);
526+ kfree(mr);
527+ fence->mr = NULL;
528+ }
529+ if (fence->dma_addr) {
530+ dma_unmap_single(dev, fence->dma_addr, BNXT_RE_FENCE_BYTES,
531+ DMA_BIDIRECTIONAL);
532+ fence->dma_addr = 0;
533+ }
534+}
535+
536+static int bnxt_re_create_fence_mr(struct bnxt_re_pd *pd)
537+{
538+ int mr_access_flags = IB_ACCESS_LOCAL_WRITE | IB_ACCESS_MW_BIND;
539+ struct bnxt_re_fence_data *fence = &pd->fence;
540+ struct bnxt_re_dev *rdev = pd->rdev;
541+ struct device *dev = &rdev->en_dev->pdev->dev;
542+ struct bnxt_re_mr *mr = NULL;
543+ dma_addr_t dma_addr = 0;
544+ struct ib_mw *mw;
545+ u64 pbl_tbl;
546+ int rc;
547+
548+ dma_addr = dma_map_single(dev, fence->va, BNXT_RE_FENCE_BYTES,
549+ DMA_BIDIRECTIONAL);
550+ rc = dma_mapping_error(dev, dma_addr);
551+ if (rc) {
552+ dev_err(rdev_to_dev(rdev), "Failed to dma-map fence-MR-mem\n");
553+ rc = -EIO;
554+ fence->dma_addr = 0;
555+ goto fail;
556+ }
557+ fence->dma_addr = dma_addr;
558+
559+ /* Allocate a MR */
560+ mr = kzalloc(sizeof(*mr), GFP_KERNEL);
561+ if (!mr) {
562+ rc = -ENOMEM;
563+ goto fail;
564+ }
565+ fence->mr = mr;
566+ mr->rdev = rdev;
567+ mr->qplib_mr.pd = &pd->qplib_pd;
568+ mr->qplib_mr.type = CMDQ_ALLOCATE_MRW_MRW_FLAGS_PMR;
569+ mr->qplib_mr.flags = __from_ib_access_flags(mr_access_flags);
570+ rc = bnxt_qplib_alloc_mrw(&rdev->qplib_res, &mr->qplib_mr);
571+ if (rc) {
572+ dev_err(rdev_to_dev(rdev), "Failed to alloc fence-HW-MR\n");
573+ goto fail;
574+ }
575+
576+ /* Register MR */
577+ mr->ib_mr.lkey = mr->qplib_mr.lkey;
578+ mr->qplib_mr.va = (u64)(unsigned long)fence->va;
579+ mr->qplib_mr.total_size = BNXT_RE_FENCE_BYTES;
580+ pbl_tbl = dma_addr;
581+ rc = bnxt_qplib_reg_mr(&rdev->qplib_res, &mr->qplib_mr, &pbl_tbl,
582+ BNXT_RE_FENCE_PBL_SIZE, false);
583+ if (rc) {
584+ dev_err(rdev_to_dev(rdev), "Failed to register fence-MR\n");
585+ goto fail;
586+ }
587+ mr->ib_mr.rkey = mr->qplib_mr.rkey;
588+
589+ /* Create a fence MW only for kernel consumers */
590+ mw = bnxt_re_alloc_mw(&pd->ib_pd, IB_MW_TYPE_1, NULL);
591+ if (!mw) {
592+ dev_err(rdev_to_dev(rdev),
593+ "Failed to create fence-MW for PD: %p\n", pd);
594+ rc = -EINVAL;
595+ goto fail;
596+ }
597+ fence->mw = mw;
598+
599+ bnxt_re_create_fence_wqe(pd);
600+ return 0;
601+
602+fail:
603+ bnxt_re_destroy_fence_mr(pd);
604+ return rc;
605+}
606+
413607 /* Protection Domains */
414608 int bnxt_re_dealloc_pd(struct ib_pd *ib_pd)
415609 {
@@ -417,6 +611,7 @@ int bnxt_re_dealloc_pd(struct ib_pd *ib_pd) · 1 unmodified line
417611 struct bnxt_re_dev *rdev = pd->rdev;
418612 int rc;
419613
614+ bnxt_re_destroy_fence_mr(pd);
420615 if (ib_pd->uobject && pd->dpi.dbr) {
421616 struct ib_ucontext *ib_uctx = ib_pd->uobject->context;
422617 struct bnxt_re_ucontext *ucntx;
@@ -498,6 +693,10 @@ struct ib_pd *bnxt_re_alloc_pd(struct ib_device *ibdev, · 75 unmodified lines
498693 }
499694 }
500695
696+ if (!udata)
697+ if (bnxt_re_create_fence_mr(pd))
698+ dev_warn(rdev_to_dev(rdev),
699+ "Failed to create Fence-MR\n");
501700 return &pd->ib_pd;
502701 dbfail:
503702 (void)bnxt_qplib_dealloc_pd(&rdev->qplib_res, &rdev->qplib_res.pd_tbl,
@@ -849,12 +1048,16 @@ static struct bnxt_re_qp *bnxt_re_create_shadow_qp · 345 unmodified lines
8491048 /* Shadow QP SQ depth should be same as QP1 RQ depth */
8501049 qp->qplib_qp.sq.max_wqe = qp1_qp->rq.max_wqe;
8511050 qp->qplib_qp.sq.max_sge = 2;
1051+ /* Q full delta can be 1 since it is internal QP */
1052+ qp->qplib_qp.sq.q_full_delta = 1;
8521053
8531054 qp->qplib_qp.scq = qp1_qp->scq;
8541055 qp->qplib_qp.rcq = qp1_qp->rcq;
8551056
8561057 qp->qplib_qp.rq.max_wqe = qp1_qp->rq.max_wqe;
8571058 qp->qplib_qp.rq.max_sge = qp1_qp->rq.max_sge;
1059+ /* Q full delta can be 1 since it is internal QP */
1060+ qp->qplib_qp.rq.q_full_delta = 1;
8581061
8591062 qp->qplib_qp.mtu = qp1_qp->mtu;
8601063
@@ -917,10 +1120,6 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, · 56 unmodified lines
9171120 qp->qplib_qp.sig_type = ((qp_init_attr->sq_sig_type ==
9181121 IB_SIGNAL_ALL_WR) ? true : false);
9191122
920− entries = roundup_pow_of_two(qp_init_attr->cap.max_send_wr + 1);
921− qp->qplib_qp.sq.max_wqe = min_t(u32, entries,
922− dev_attr->max_qp_wqes + 1);
923−
9241123 qp->qplib_qp.sq.max_sge = qp_init_attr->cap.max_send_sge;
9251124 if (qp->qplib_qp.sq.max_sge > dev_attr->max_qp_sges)
9261125 qp->qplib_qp.sq.max_sge = dev_attr->max_qp_sges;
@@ -959,6 +1158,9 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, · 32 unmodified lines
9591158 qp->qplib_qp.rq.max_wqe = min_t(u32, entries,
9601159 dev_attr->max_qp_wqes + 1);
9611160
1161+ qp->qplib_qp.rq.q_full_delta = qp->qplib_qp.rq.max_wqe -
1162+ qp_init_attr->cap.max_recv_wr;
1163+
9621164 qp->qplib_qp.rq.max_sge = qp_init_attr->cap.max_recv_sge;
9631165 if (qp->qplib_qp.rq.max_sge > dev_attr->max_qp_sges)
9641166 qp->qplib_qp.rq.max_sge = dev_attr->max_qp_sges;
@@ -967,6 +1169,12 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, · 2 unmodified lines
9671169 qp->qplib_qp.mtu = ib_mtu_enum_to_int(iboe_get_mtu(rdev->netdev->mtu));
9681170
9691171 if (qp_init_attr->qp_type == IB_QPT_GSI) {
1172+ /* Allocate 1 more than what's provided */
1173+ entries = roundup_pow_of_two(qp_init_attr->cap.max_send_wr + 1);
1174+ qp->qplib_qp.sq.max_wqe = min_t(u32, entries,
1175+ dev_attr->max_qp_wqes + 1);
1176+ qp->qplib_qp.sq.q_full_delta = qp->qplib_qp.sq.max_wqe -
1177+ qp_init_attr->cap.max_send_wr;
9701178 qp->qplib_qp.rq.max_sge = dev_attr->max_qp_sges;
9711179 if (qp->qplib_qp.rq.max_sge > dev_attr->max_qp_sges)
9721180 qp->qplib_qp.rq.max_sge = dev_attr->max_qp_sges;
@@ -1006,6 +1214,22 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, · 33 unmodified lines
10061214 }
10071215
10081216 } else {
1217+ /* Allocate 128 + 1 more than what's provided */
1218+ entries = roundup_pow_of_two(qp_init_attr->cap.max_send_wr +
1219+ BNXT_QPLIB_RESERVED_QP_WRS + 1);
1220+ qp->qplib_qp.sq.max_wqe = min_t(u32, entries,
1221+ dev_attr->max_qp_wqes +
1222+ BNXT_QPLIB_RESERVED_QP_WRS + 1);
1223+ qp->qplib_qp.sq.q_full_delta = BNXT_QPLIB_RESERVED_QP_WRS + 1;
1224+
1225+ /*
1226+ * Reserving one slot for Phantom WQE. Application can
1227+ * post one extra entry in this case. But allowing this to avoid
1228+ * unexpected Queue full condition
1229+ */
1230+
1231+ qp->qplib_qp.sq.q_full_delta -= 1;
1232+
10091233 qp->qplib_qp.max_rd_atomic = dev_attr->max_qp_rd_atom;
10101234 qp->qplib_qp.max_dest_rd_atomic = dev_attr->max_qp_init_rd_atom;
10111235 if (udata) {
@@ -1025,6 +1249,7 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, · 13 unmodified lines
10251249
10261250 qp->ib_qp.qp_num = qp->qplib_qp.id;
10271251 spin_lock_init(&qp->sq_lock);
1252+ spin_lock_init(&qp->rq_lock);
10281253
10291254 if (udata) {
10301255 struct bnxt_re_qp_resp resp;
@@ -1129,48 +1354,6 @@ static enum ib_mtu __to_ib_mtu(u32 mtu) · 98 unmodified lines
11291354 }
11301355 }
11311356
1132−static int __from_ib_access_flags(int iflags)
1133−{
1134− int qflags = 0;
1135−
1136− if (iflags & IB_ACCESS_LOCAL_WRITE)
1137− qflags |= BNXT_QPLIB_ACCESS_LOCAL_WRITE;
1138− if (iflags & IB_ACCESS_REMOTE_READ)
1139− qflags |= BNXT_QPLIB_ACCESS_REMOTE_READ;
1140− if (iflags & IB_ACCESS_REMOTE_WRITE)
1141− qflags |= BNXT_QPLIB_ACCESS_REMOTE_WRITE;
1142− if (iflags & IB_ACCESS_REMOTE_ATOMIC)
1143− qflags |= BNXT_QPLIB_ACCESS_REMOTE_ATOMIC;
1144− if (iflags & IB_ACCESS_MW_BIND)
1145− qflags |= BNXT_QPLIB_ACCESS_MW_BIND;
1146− if (iflags & IB_ZERO_BASED)
1147− qflags |= BNXT_QPLIB_ACCESS_ZERO_BASED;
1148− if (iflags & IB_ACCESS_ON_DEMAND)
1149− qflags |= BNXT_QPLIB_ACCESS_ON_DEMAND;
1150− return qflags;
1151−};
1152−
1153−static enum ib_access_flags __to_ib_access_flags(int qflags)
1154−{
1155− enum ib_access_flags iflags = 0;
1156−
1157− if (qflags & BNXT_QPLIB_ACCESS_LOCAL_WRITE)
1158− iflags |= IB_ACCESS_LOCAL_WRITE;
1159− if (qflags & BNXT_QPLIB_ACCESS_REMOTE_WRITE)
1160− iflags |= IB_ACCESS_REMOTE_WRITE;
1161− if (qflags & BNXT_QPLIB_ACCESS_REMOTE_READ)
1162− iflags |= IB_ACCESS_REMOTE_READ;
1163− if (qflags & BNXT_QPLIB_ACCESS_REMOTE_ATOMIC)
1164− iflags |= IB_ACCESS_REMOTE_ATOMIC;
1165− if (qflags & BNXT_QPLIB_ACCESS_MW_BIND)
1166− iflags |= IB_ACCESS_MW_BIND;
1167− if (qflags & BNXT_QPLIB_ACCESS_ZERO_BASED)
1168− iflags |= IB_ZERO_BASED;
1169− if (qflags & BNXT_QPLIB_ACCESS_ON_DEMAND)
1170− iflags |= IB_ACCESS_ON_DEMAND;
1171− return iflags;
1172−};
1173−
11741357 static int bnxt_re_modify_shadow_qp(struct bnxt_re_dev *rdev,
11751358 struct bnxt_re_qp *qp1_qp,
11761359 int qp_attr_mask)
@@ -1378,11 +1561,21 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr, · 201 unmodified lines
13781561 entries = roundup_pow_of_two(qp_attr->cap.max_send_wr);
13791562 qp->qplib_qp.sq.max_wqe = min_t(u32, entries,
13801563 dev_attr->max_qp_wqes + 1);
1564+ qp->qplib_qp.sq.q_full_delta = qp->qplib_qp.sq.max_wqe -
1565+ qp_attr->cap.max_send_wr;
1566+ /*
1567+ * Reserving one slot for Phantom WQE. Some application can
1568+ * post one extra entry in this case. Allowing this to avoid
1569+ * unexpected Queue full condition
1570+ */
1571+ qp->qplib_qp.sq.q_full_delta -= 1;
13811572 qp->qplib_qp.sq.max_sge = qp_attr->cap.max_send_sge;
13821573 if (qp->qplib_qp.rq.max_wqe) {
13831574 entries = roundup_pow_of_two(qp_attr->cap.max_recv_wr);
13841575 qp->qplib_qp.rq.max_wqe =
13851576 min_t(u32, entries, dev_attr->max_qp_wqes + 1);
1577+ qp->qplib_qp.rq.q_full_delta = qp->qplib_qp.rq.max_wqe -
1578+ qp_attr->cap.max_recv_wr;
13861579 qp->qplib_qp.rq.max_sge = qp_attr->cap.max_recv_sge;
13871580 } else {
13881581 /* SRQ was used prior, just ignore the RQ caps */
@@ -1883,6 +2076,22 @@ static int bnxt_re_copy_wr_payload(struct bnxt_re_dev *rdev, · 494 unmodified lines
18832076 return payload_sz;
18842077 }
18852078
2079+static void bnxt_ud_qp_hw_stall_workaround(struct bnxt_re_qp *qp)
2080+{
2081+ if ((qp->ib_qp.qp_type == IB_QPT_UD ||
2082+ qp->ib_qp.qp_type == IB_QPT_GSI ||
2083+ qp->ib_qp.qp_type == IB_QPT_RAW_ETHERTYPE) &&
2084+ qp->qplib_qp.wqe_cnt == BNXT_RE_UD_QP_HW_STALL) {
2085+ int qp_attr_mask;
2086+ struct ib_qp_attr qp_attr;
2087+
2088+ qp_attr_mask = IB_QP_STATE;
2089+ qp_attr.qp_state = IB_QPS_RTS;
2090+ bnxt_re_modify_qp(&qp->ib_qp, &qp_attr, qp_attr_mask, NULL);
2091+ qp->qplib_qp.wqe_cnt = 0;
2092+ }
2093+}
2094+
18862095 static int bnxt_re_post_send_shadow_qp(struct bnxt_re_dev *rdev,
18872096 struct bnxt_re_qp *qp,
18882097 struct ib_send_wr *wr)
@@ -1928,6 +2137,7 @@ bad: · 39 unmodified lines
19282137 wr = wr->next;
19292138 }
19302139 bnxt_qplib_post_send_db(&qp->qplib_qp);
2140+ bnxt_ud_qp_hw_stall_workaround(qp);
19312141 spin_unlock_irqrestore(&qp->sq_lock, flags);
19322142 return rc;
19332143 }
@@ -2024,6 +2234,7 @@ bad: · 90 unmodified lines
20242234 wr = wr->next;
20252235 }
20262236 bnxt_qplib_post_send_db(&qp->qplib_qp);
2237+ bnxt_ud_qp_hw_stall_workaround(qp);
20272238 spin_unlock_irqrestore(&qp->sq_lock, flags);
20282239
20292240 return rc;
@@ -2071,7 +2282,10 @@ int bnxt_re_post_recv(struct ib_qp *ib_qp, struct ib_recv_wr *wr, · 41 unmodified lines
20712282 struct bnxt_re_qp *qp = container_of(ib_qp, struct bnxt_re_qp, ib_qp);
20722283 struct bnxt_qplib_swqe wqe;
20732284 int rc = 0, payload_sz = 0;
2285+ unsigned long flags;
2286+ u32 count = 0;
20742287
2288+ spin_lock_irqsave(&qp->rq_lock, flags);
20752289 while (wr) {
20762290 /* House keeping */
20772291 memset(&wqe, 0, sizeof(wqe));
@@ -2100,9 +2314,21 @@ int bnxt_re_post_recv(struct ib_qp *ib_qp, struct ib_recv_wr *wr, · 22 unmodified lines
21002314 *bad_wr = wr;
21012315 break;
21022316 }
2317+
2318+ /* Ring DB if the RQEs posted reaches a threshold value */
2319+ if (++count >= BNXT_RE_RQ_WQE_THRESHOLD) {
2320+ bnxt_qplib_post_recv_db(&qp->qplib_qp);
2321+ count = 0;
2322+ }
2323+
21032324 wr = wr->next;
21042325 }
2105− bnxt_qplib_post_recv_db(&qp->qplib_qp);
2326+
2327+ if (count)
2328+ bnxt_qplib_post_recv_db(&qp->qplib_qp);
2329+
2330+ spin_unlock_irqrestore(&qp->rq_lock, flags);
2331+
21062332 return rc;
21072333 }
21082334
@@ -2643,12 +2869,36 @@ static void bnxt_re_process_res_ud_wc(struct ib_wc *wc, · 534 unmodified lines
26432869 wc->opcode = IB_WC_RECV_RDMA_WITH_IMM;
26442870 }
26452871
2872+static int send_phantom_wqe(struct bnxt_re_qp *qp)
2873+{
2874+ struct bnxt_qplib_qp *lib_qp = &qp->qplib_qp;
2875+ unsigned long flags;
2876+ int rc = 0;
2877+
2878+ spin_lock_irqsave(&qp->sq_lock, flags);
2879+
2880+ rc = bnxt_re_bind_fence_mw(lib_qp);
2881+ if (!rc) {
2882+ lib_qp->sq.phantom_wqe_cnt++;
2883+ dev_dbg(&lib_qp->sq.hwq.pdev->dev,
2884+ "qp %#x sq->prod %#x sw_prod %#x phantom_wqe_cnt %d\n",
2885+ lib_qp->id, lib_qp->sq.hwq.prod,
2886+ HWQ_CMP(lib_qp->sq.hwq.prod, &lib_qp->sq.hwq),
2887+ lib_qp->sq.phantom_wqe_cnt);
2888+ }
2889+
2890+ spin_unlock_irqrestore(&qp->sq_lock, flags);
2891+ return rc;
2892+}
2893+
26462894 int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc)
26472895 {
26482896 struct bnxt_re_cq *cq = container_of(ib_cq, struct bnxt_re_cq, ib_cq);
26492897 struct bnxt_re_qp *qp;
26502898 struct bnxt_qplib_cqe *cqe;
26512899 int i, ncqe, budget;
2900+ struct bnxt_qplib_q *sq;
2901+ struct bnxt_qplib_qp *lib_qp;
26522902 u32 tbl_idx;
26532903 struct bnxt_re_sqp_entries *sqp_entry = NULL;
26542904 unsigned long flags;
@@ -2661,7 +2911,21 @@ int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc) · 6 unmodified lines
26612911 }
26622912 cqe = &cq->cql[0];
26632913 while (budget) {
2664− ncqe = bnxt_qplib_poll_cq(&cq->qplib_cq, cqe, budget);
2914+ lib_qp = NULL;
2915+ ncqe = bnxt_qplib_poll_cq(&cq->qplib_cq, cqe, budget, &lib_qp);
2916+ if (lib_qp) {
2917+ sq = &lib_qp->sq;
2918+ if (sq->send_phantom) {
2919+ qp = container_of(lib_qp,
2920+ struct bnxt_re_qp, qplib_qp);
2921+ if (send_phantom_wqe(qp) == -ENOMEM)
2922+ dev_err(rdev_to_dev(cq->rdev),
2923+ "Phantom failed! Scheduled to send again\n");
2924+ else
2925+ sq->send_phantom = false;
2926+ }
2927+ }
2928+
26652929 if (!ncqe)
26662930 break;
26672931
@@ -2822,6 +3086,12 @@ int bnxt_re_dereg_mr(struct ib_mr *ib_mr) · 154 unmodified lines
28223086 struct bnxt_re_dev *rdev = mr->rdev;
28233087 int rc;
28243088
3089+ rc = bnxt_qplib_free_mrw(&rdev->qplib_res, &mr->qplib_mr);
3090+ if (rc) {
3091+ dev_err(rdev_to_dev(rdev), "Dereg MR failed: %#x\n", rc);
3092+ return rc;
3093+ }
3094+
28253095 if (mr->npages && mr->pages) {
28263096 rc = bnxt_qplib_free_fast_reg_page_list(&rdev->qplib_res,
28273097 &mr->qplib_frpl);
@@ -2829,8 +3099,6 @@ int bnxt_re_dereg_mr(struct ib_mr *ib_mr) · 1 unmodified line
28293099 mr->npages = 0;
28303100 mr->pages = NULL;
28313101 }
2832− rc = bnxt_qplib_free_mrw(&rdev->qplib_res, &mr->qplib_mr);
2833−
28343102 if (!IS_ERR_OR_NULL(mr->ib_umem))
28353103 ib_umem_release(mr->ib_umem);
28363104
@@ -2914,97 +3182,52 @@ fail: · 77 unmodified lines
29143182 return ERR_PTR(rc);
29153183 }
29163184
2917−/* Fast Memory Regions */
2918−struct ib_fmr *bnxt_re_alloc_fmr(struct ib_pd *ib_pd, int mr_access_flags,
2919− struct ib_fmr_attr *fmr_attr)
3185+struct ib_mw *bnxt_re_alloc_mw(struct ib_pd *ib_pd, enum ib_mw_type type,
3186+ struct ib_udata *udata)
29203187 {
29213188 struct bnxt_re_pd *pd = container_of(ib_pd, struct bnxt_re_pd, ib_pd);
29223189 struct bnxt_re_dev *rdev = pd->rdev;
2923− struct bnxt_re_fmr *fmr;
3190+ struct bnxt_re_mw *mw;
29243191 int rc;
29253192
2926− if (fmr_attr->max_pages > MAX_PBL_LVL_2_PGS ||
2927− fmr_attr->max_maps > rdev->dev_attr.max_map_per_fmr) {
2928− dev_err(rdev_to_dev(rdev), "Allocate FMR exceeded Max limit");
3193+ mw = kzalloc(sizeof(*mw), GFP_KERNEL);
3194+ if (!mw)
29293195 return ERR_PTR(-ENOMEM);
2930− }
2931− fmr = kzalloc(sizeof(*fmr), GFP_KERNEL);
2932− if (!fmr)
2933− return ERR_PTR(-ENOMEM);
2934−
2935− fmr->rdev = rdev;
2936− fmr->qplib_fmr.pd = &pd->qplib_pd;
2937− fmr->qplib_fmr.type = CMDQ_ALLOCATE_MRW_MRW_FLAGS_PMR;
3196+ mw->rdev = rdev;
3197+ mw->qplib_mw.pd = &pd->qplib_pd;
29383198
2939− rc = bnxt_qplib_alloc_mrw(&rdev->qplib_res, &fmr->qplib_fmr);
2940− if (rc)
3199+ mw->qplib_mw.type = (type == IB_MW_TYPE_1 ?
3200+ CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE1 :
3201+ CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2B);
3202+ rc = bnxt_qplib_alloc_mrw(&rdev->qplib_res, &mw->qplib_mw);
3203+ if (rc) {
3204+ dev_err(rdev_to_dev(rdev), "Allocate MW failed!");
29413205 goto fail;
3206+ }
3207+ mw->ib_mw.rkey = mw->qplib_mw.rkey;
29423208
2943− fmr->qplib_fmr.flags = __from_ib_access_flags(mr_access_flags);
2944− fmr->ib_fmr.lkey = fmr->qplib_fmr.lkey;
2945− fmr->ib_fmr.rkey = fmr->ib_fmr.lkey;
3209+ atomic_inc(&rdev->mw_count);
3210+ return &mw->ib_mw;
29463211
2947− atomic_inc(&rdev->mr_count);
2948− return &fmr->ib_fmr;
29493212 fail:
2950− kfree(fmr);
3213+ kfree(mw);
29513214 return ERR_PTR(rc);
29523215 }
29533216
2954−int bnxt_re_map_phys_fmr(struct ib_fmr *ib_fmr, u64 *page_list, int list_len,
2955− u64 iova)
3217+int bnxt_re_dealloc_mw(struct ib_mw *ib_mw)
29563218 {
2957− struct bnxt_re_fmr *fmr = container_of(ib_fmr, struct bnxt_re_fmr,
2958− ib_fmr);
2959− struct bnxt_re_dev *rdev = fmr->rdev;
3219+ struct bnxt_re_mw *mw = container_of(ib_mw, struct bnxt_re_mw, ib_mw);
3220+ struct bnxt_re_dev *rdev = mw->rdev;
29603221 int rc;
29613222
2962− fmr->qplib_fmr.va = iova;
2963− fmr->qplib_fmr.total_size = list_len * PAGE_SIZE;
2964−
2965− rc = bnxt_qplib_reg_mr(&rdev->qplib_res, &fmr->qplib_fmr, page_list,
2966− list_len, true);
2967− if (rc)
2968− dev_err(rdev_to_dev(rdev), "Failed to map FMR for lkey = 0x%x!",
2969− fmr->ib_fmr.lkey);
2970− return rc;
2971−}
2972−
2973−int bnxt_re_unmap_fmr(struct list_head *fmr_list)
2974−{
2975− struct bnxt_re_dev *rdev;
2976− struct bnxt_re_fmr *fmr;
2977− struct ib_fmr *ib_fmr;
2978− int rc = 0;
2979−
2980− /* Validate each FMRs inside the fmr_list */
2981− list_for_each_entry(ib_fmr, fmr_list, list) {
2982− fmr = container_of(ib_fmr, struct bnxt_re_fmr, ib_fmr);
2983− rdev = fmr->rdev;
2984−
2985− if (rdev) {
2986− rc = bnxt_qplib_dereg_mrw(&rdev->qplib_res,
2987− &fmr->qplib_fmr, true);
2988− if (rc)
2989− break;
2990− }
3223+ rc = bnxt_qplib_free_mrw(&rdev->qplib_res, &mw->qplib_mw);
3224+ if (rc) {
3225+ dev_err(rdev_to_dev(rdev), "Free MW failed: %#x\n", rc);
3226+ return rc;
29913227 }
2992− return rc;
2993−}
2994−
2995−int bnxt_re_dealloc_fmr(struct ib_fmr *ib_fmr)
2996−{
2997− struct bnxt_re_fmr *fmr = container_of(ib_fmr, struct bnxt_re_fmr,
2998− ib_fmr);
2999− struct bnxt_re_dev *rdev = fmr->rdev;
3000− int rc;
30013228
3002− rc = bnxt_qplib_free_mrw(&rdev->qplib_res, &fmr->qplib_fmr);
3003− if (rc)
3004− dev_err(rdev_to_dev(rdev), "Failed to free FMR");
3005−
3006− kfree(fmr);
3007− atomic_dec(&rdev->mr_count);
3229+ kfree(mw);
3230+ atomic_dec(&rdev->mw_count);
30083231 return rc;
30093232 }
30103233
drivers/infiniband/hw/bnxt_re/ib_verbs.h+16−6
@@ -44,11 +44,23 @@ struct bnxt_re_gid_ctx { · 43 unmodified lines
4444 u32 refcnt;
4545 };
4646
47+#define BNXT_RE_FENCE_BYTES 64
48+struct bnxt_re_fence_data {
49+ u32 size;
50+ u8 va[BNXT_RE_FENCE_BYTES];
51+ dma_addr_t dma_addr;
52+ struct bnxt_re_mr *mr;
53+ struct ib_mw *mw;
54+ struct bnxt_qplib_swqe bind_wqe;
55+ u32 bind_rkey;
56+};
57+
4758 struct bnxt_re_pd {
4859 struct bnxt_re_dev *rdev;
4960 struct ib_pd ib_pd;
5061 struct bnxt_qplib_pd qplib_pd;
5162 struct bnxt_qplib_dpi dpi;
63+ struct bnxt_re_fence_data fence;
5264 };
5365
5466 struct bnxt_re_ah {
@@ -62,6 +74,7 @@ struct bnxt_re_qp { · 7 unmodified lines
6274 struct bnxt_re_dev *rdev;
6375 struct ib_qp ib_qp;
6476 spinlock_t sq_lock; /* protect sq */
77+ spinlock_t rq_lock; /* protect rq */
6578 struct bnxt_qplib_qp qplib_qp;
6679 struct ib_umem *sumem;
6780 struct ib_umem *rumem;
@@ -181,12 +194,9 @@ int bnxt_re_map_mr_sg(struct ib_mr *ib_mr, struct scatterlist *sg, int sg_nents, · 113 unmodified lines
181194 struct ib_mr *bnxt_re_alloc_mr(struct ib_pd *ib_pd, enum ib_mr_type mr_type,
182195 u32 max_num_sg);
183196 int bnxt_re_dereg_mr(struct ib_mr *mr);
184−struct ib_fmr *bnxt_re_alloc_fmr(struct ib_pd *pd, int mr_access_flags,
185− struct ib_fmr_attr *fmr_attr);
186−int bnxt_re_map_phys_fmr(struct ib_fmr *fmr, u64 *page_list, int list_len,
187− u64 iova);
188−int bnxt_re_unmap_fmr(struct list_head *fmr_list);
189−int bnxt_re_dealloc_fmr(struct ib_fmr *fmr);
197+struct ib_mw *bnxt_re_alloc_mw(struct ib_pd *ib_pd, enum ib_mw_type type,
198+ struct ib_udata *udata);
199+int bnxt_re_dealloc_mw(struct ib_mw *mw);
190200 struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
191201 u64 virt_addr, int mr_access_flags,
192202 struct ib_udata *udata);
drivers/infiniband/hw/bnxt_re/main.c+0−4
@@ -507,10 +507,6 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev) · 506 unmodified lines
507507 ibdev->dereg_mr = bnxt_re_dereg_mr;
508508 ibdev->alloc_mr = bnxt_re_alloc_mr;
509509 ibdev->map_mr_sg = bnxt_re_map_mr_sg;
510− ibdev->alloc_fmr = bnxt_re_alloc_fmr;
511− ibdev->map_phys_fmr = bnxt_re_map_phys_fmr;
512− ibdev->unmap_fmr = bnxt_re_unmap_fmr;
513− ibdev->dealloc_fmr = bnxt_re_dealloc_fmr;
514510
515511 ibdev->reg_user_mr = bnxt_re_reg_user_mr;
516512 ibdev->alloc_ucontext = bnxt_re_alloc_ucontext;
drivers/infiniband/hw/bnxt_re/qplib_fp.c+199−185
@@ -284,7 +284,7 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 283 unmodified lines
284284 {
285285 struct bnxt_qplib_rcfw *rcfw = res->rcfw;
286286 struct cmdq_create_qp1 req;
287− struct creq_create_qp1_resp *resp;
287+ struct creq_create_qp1_resp resp;
288288 struct bnxt_qplib_pbl *pbl;
289289 struct bnxt_qplib_q *sq = &qp->sq;
290290 struct bnxt_qplib_q *rq = &qp->rq;
@@ -394,31 +394,12 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 103 unmodified lines
394394
395395 req.pd_id = cpu_to_le32(qp->pd->id);
396396
397− resp = (struct creq_create_qp1_resp *)
398− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
399− NULL, 0);
400− if (!resp) {
401− dev_err(&res->pdev->dev, "QPLIB: FP: CREATE_QP1 send failed");
402− rc = -EINVAL;
403− goto fail;
404− }
405− if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) {
406− /* Cmd timed out */
407− dev_err(&rcfw->pdev->dev, "QPLIB: FP: CREATE_QP1 timed out");
408− rc = -ETIMEDOUT;
409− goto fail;
410− }
411− if (resp->status ||
412− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
413− dev_err(&rcfw->pdev->dev, "QPLIB: FP: CREATE_QP1 failed ");
414− dev_err(&rcfw->pdev->dev,
415− "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x",
416− resp->status, le16_to_cpu(req.cookie),
417− le16_to_cpu(resp->cookie));
418− rc = -EINVAL;
397+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
398+ (void *)&resp, NULL, 0);
399+ if (rc)
419400 goto fail;
420− }
421− qp->id = le32_to_cpu(resp->xid);
401+
402+ qp->id = le32_to_cpu(resp.xid);
422403 qp->cur_qp_state = CMDQ_MODIFY_QP_NEW_STATE_RESET;
423404 sq->flush_in_progress = false;
424405 rq->flush_in_progress = false;
@@ -442,7 +423,7 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 17 unmodified lines
442423 struct bnxt_qplib_rcfw *rcfw = res->rcfw;
443424 struct sq_send *hw_sq_send_hdr, **hw_sq_send_ptr;
444425 struct cmdq_create_qp req;
445− struct creq_create_qp_resp *resp;
426+ struct creq_create_qp_resp resp;
446427 struct bnxt_qplib_pbl *pbl;
447428 struct sq_psn_search **psn_search_ptr;
448429 unsigned long int psn_search, poff = 0;
@@ -627,31 +608,12 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 178 unmodified lines
627608 }
628609 req.pd_id = cpu_to_le32(qp->pd->id);
629610
630− resp = (struct creq_create_qp_resp *)
631− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
632− NULL, 0);
633− if (!resp) {
634− dev_err(&rcfw->pdev->dev, "QPLIB: FP: CREATE_QP send failed");
635− rc = -EINVAL;
636− goto fail;
637− }
638− if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) {
639− /* Cmd timed out */
640− dev_err(&rcfw->pdev->dev, "QPLIB: FP: CREATE_QP timed out");
641− rc = -ETIMEDOUT;
642− goto fail;
643− }
644− if (resp->status ||
645− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
646− dev_err(&rcfw->pdev->dev, "QPLIB: FP: CREATE_QP failed ");
647− dev_err(&rcfw->pdev->dev,
648− "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x",
649− resp->status, le16_to_cpu(req.cookie),
650− le16_to_cpu(resp->cookie));
651− rc = -EINVAL;
611+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
612+ (void *)&resp, NULL, 0);
613+ if (rc)
652614 goto fail;
653− }
654− qp->id = le32_to_cpu(resp->xid);
615+
616+ qp->id = le32_to_cpu(resp.xid);
655617 qp->cur_qp_state = CMDQ_MODIFY_QP_NEW_STATE_RESET;
656618 sq->flush_in_progress = false;
657619 rq->flush_in_progress = false;
@@ -769,10 +731,11 @@ int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 111 unmodified lines
769731 {
770732 struct bnxt_qplib_rcfw *rcfw = res->rcfw;
771733 struct cmdq_modify_qp req;
772− struct creq_modify_qp_resp *resp;
734+ struct creq_modify_qp_resp resp;
773735 u16 cmd_flags = 0, pkey;
774736 u32 temp32[4];
775737 u32 bmask;
738+ int rc;
776739
777740 RCFW_CMD_PREP(req, MODIFY_QP, cmd_flags);
778741
@@ -862,27 +825,10 @@ int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 83 unmodified lines
862825
863826 req.vlan_pcp_vlan_dei_vlan_id = cpu_to_le16(qp->vlan_id);
864827
865− resp = (struct creq_modify_qp_resp *)
866− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
867− NULL, 0);
868− if (!resp) {
869− dev_err(&rcfw->pdev->dev, "QPLIB: FP: MODIFY_QP send failed");
870− return -EINVAL;
871− }
872− if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) {
873− /* Cmd timed out */
874− dev_err(&rcfw->pdev->dev, "QPLIB: FP: MODIFY_QP timed out");
875− return -ETIMEDOUT;
876− }
877− if (resp->status ||
878− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
879− dev_err(&rcfw->pdev->dev, "QPLIB: FP: MODIFY_QP failed ");
880− dev_err(&rcfw->pdev->dev,
881− "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x",
882− resp->status, le16_to_cpu(req.cookie),
883− le16_to_cpu(resp->cookie));
884− return -EINVAL;
885− }
828+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
829+ (void *)&resp, NULL, 0);
830+ if (rc)
831+ return rc;
886832 qp->cur_qp_state = qp->state;
887833 return 0;
888834 }
@@ -891,37 +837,26 @@ int bnxt_qplib_query_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 2 unmodified lines
891837 {
892838 struct bnxt_qplib_rcfw *rcfw = res->rcfw;
893839 struct cmdq_query_qp req;
894− struct creq_query_qp_resp *resp;
840+ struct creq_query_qp_resp resp;
841+ struct bnxt_qplib_rcfw_sbuf *sbuf;
895842 struct creq_query_qp_resp_sb *sb;
896843 u16 cmd_flags = 0;
897844 u32 temp32[4];
898− int i;
845+ int i, rc = 0;
899846
900847 RCFW_CMD_PREP(req, QUERY_QP, cmd_flags);
901848
849+ sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb));
850+ if (!sbuf)
851+ return -ENOMEM;
852+ sb = sbuf->sb;
853+
902854 req.qp_cid = cpu_to_le32(qp->id);
903855 req.resp_size = sizeof(*sb) / BNXT_QPLIB_CMDQE_UNITS;
904− resp = (struct creq_query_qp_resp *)
905− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
906− (void **)&sb, 0);
907− if (!resp) {
908− dev_err(&rcfw->pdev->dev, "QPLIB: FP: QUERY_QP send failed");
909− return -EINVAL;
910− }
911− if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) {
912− /* Cmd timed out */
913− dev_err(&rcfw->pdev->dev, "QPLIB: FP: QUERY_QP timed out");
914− return -ETIMEDOUT;
915− }
916− if (resp->status ||
917− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
918− dev_err(&rcfw->pdev->dev, "QPLIB: FP: QUERY_QP failed ");
919− dev_err(&rcfw->pdev->dev,
920− "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x",
921− resp->status, le16_to_cpu(req.cookie),
922− le16_to_cpu(resp->cookie));
923− return -EINVAL;
924− }
856+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
857+ (void *)sbuf, 0);
858+ if (rc)
859+ goto bail;
925860 /* Extract the context from the side buffer */
926861 qp->state = sb->en_sqd_async_notify_state &
927862 CREQ_QUERY_QP_RESP_SB_STATE_MASK;
@@ -976,7 +911,9 @@ int bnxt_qplib_query_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 48 unmodified lines
976911 qp->dest_qpn = le32_to_cpu(sb->dest_qp_id);
977912 memcpy(qp->smac, sb->src_mac, 6);
978913 qp->vlan_id = le16_to_cpu(sb->vlan_pcp_vlan_dei_vlan_id);
979− return 0;
914+bail:
915+ bnxt_qplib_rcfw_free_sbuf(rcfw, sbuf);
916+ return rc;
980917 }
981918
982919 static void __clean_cq(struct bnxt_qplib_cq *cq, u64 qp)
@@ -1021,34 +958,18 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res, · 38 unmodified lines
1021958 {
1022959 struct bnxt_qplib_rcfw *rcfw = res->rcfw;
1023960 struct cmdq_destroy_qp req;
1024− struct creq_destroy_qp_resp *resp;
961+ struct creq_destroy_qp_resp resp;
1025962 unsigned long flags;
1026963 u16 cmd_flags = 0;
964+ int rc;
1027965
1028966 RCFW_CMD_PREP(req, DESTROY_QP, cmd_flags);
1029967
1030968 req.qp_cid = cpu_to_le32(qp->id);
1031− resp = (struct creq_destroy_qp_resp *)
1032− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
1033− NULL, 0);
1034− if (!resp) {
1035− dev_err(&rcfw->pdev->dev, "QPLIB: FP: DESTROY_QP send failed");
1036− return -EINVAL;
1037− }
1038− if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) {
1039− /* Cmd timed out */
1040− dev_err(&rcfw->pdev->dev, "QPLIB: FP: DESTROY_QP timed out");
1041− return -ETIMEDOUT;
1042− }
1043− if (resp->status ||
1044− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
1045− dev_err(&rcfw->pdev->dev, "QPLIB: FP: DESTROY_QP failed ");
1046− dev_err(&rcfw->pdev->dev,
1047− "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x",
1048− resp->status, le16_to_cpu(req.cookie),
1049− le16_to_cpu(resp->cookie));
1050− return -EINVAL;
1051− }
969+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
970+ (void *)&resp, NULL, 0);
971+ if (rc)
972+ return rc;
1052973
1053974 /* Must walk the associated CQs to nullified the QP ptr */
1054975 spin_lock_irqsave(&qp->scq->hwq.lock, flags);
@@ -1162,8 +1083,12 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp, · 107 unmodified lines
11621083 rc = -EINVAL;
11631084 goto done;
11641085 }
1165− if (HWQ_CMP((sq->hwq.prod + 1), &sq->hwq) ==
1166− HWQ_CMP(sq->hwq.cons, &sq->hwq)) {
1086+
1087+ if (bnxt_qplib_queue_full(sq)) {
1088+ dev_err(&sq->hwq.pdev->dev,
1089+ "QPLIB: prod = %#x cons = %#x qdepth = %#x delta = %#x",
1090+ sq->hwq.prod, sq->hwq.cons, sq->hwq.max_elements,
1091+ sq->q_full_delta);
11671092 rc = -ENOMEM;
11681093 goto done;
11691094 }
@@ -1373,6 +1298,9 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp, · 203 unmodified lines
13731298 }
13741299
13751300 sq->hwq.prod++;
1301+
1302+ qp->wqe_cnt++;
1303+
13761304 done:
13771305 return rc;
13781306 }
@@ -1411,8 +1339,7 @@ int bnxt_qplib_post_recv(struct bnxt_qplib_qp *qp, · 32 unmodified lines
14111339 rc = -EINVAL;
14121340 goto done;
14131341 }
1414− if (HWQ_CMP((rq->hwq.prod + 1), &rq->hwq) ==
1415− HWQ_CMP(rq->hwq.cons, &rq->hwq)) {
1342+ if (bnxt_qplib_queue_full(rq)) {
14161343 dev_err(&rq->hwq.pdev->dev,
14171344 "QPLIB: FP: QP (0x%x) RQ is full!", qp->id);
14181345 rc = -EINVAL;
@@ -1483,7 +1410,7 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) · 64 unmodified lines
14831410 {
14841411 struct bnxt_qplib_rcfw *rcfw = res->rcfw;
14851412 struct cmdq_create_cq req;
1486− struct creq_create_cq_resp *resp;
1413+ struct creq_create_cq_resp resp;
14871414 struct bnxt_qplib_pbl *pbl;
14881415 u16 cmd_flags = 0;
14891416 int rc;
@@ -1525,30 +1452,12 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) · 35 unmodified lines
15251452 (cq->cnq_hw_ring_id & CMDQ_CREATE_CQ_CNQ_ID_MASK) <<
15261453 CMDQ_CREATE_CQ_CNQ_ID_SFT);
15271454
1528− resp = (struct creq_create_cq_resp *)
1529− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
1530− NULL, 0);
1531− if (!resp) {
1532− dev_err(&rcfw->pdev->dev, "QPLIB: FP: CREATE_CQ send failed");
1533− return -EINVAL;
1534− }
1535− if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) {
1536− /* Cmd timed out */
1537− dev_err(&rcfw->pdev->dev, "QPLIB: FP: CREATE_CQ timed out");
1538− rc = -ETIMEDOUT;
1539− goto fail;
1540− }
1541− if (resp->status ||
1542− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
1543− dev_err(&rcfw->pdev->dev, "QPLIB: FP: CREATE_CQ failed ");
1544− dev_err(&rcfw->pdev->dev,
1545− "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x",
1546− resp->status, le16_to_cpu(req.cookie),
1547− le16_to_cpu(resp->cookie));
1548− rc = -EINVAL;
1455+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
1456+ (void *)&resp, NULL, 0);
1457+ if (rc)
15491458 goto fail;
1550− }
1551− cq->id = le32_to_cpu(resp->xid);
1459+
1460+ cq->id = le32_to_cpu(resp.xid);
15521461 cq->dbr_base = res->dpi_tbl.dbr_bar_reg_iomem;
15531462 cq->period = BNXT_QPLIB_QUEUE_START_PERIOD;
15541463 init_waitqueue_head(&cq->waitq);
@@ -1566,33 +1475,17 @@ int bnxt_qplib_destroy_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) · 11 unmodified lines
15661475 {
15671476 struct bnxt_qplib_rcfw *rcfw = res->rcfw;
15681477 struct cmdq_destroy_cq req;
1569− struct creq_destroy_cq_resp *resp;
1478+ struct creq_destroy_cq_resp resp;
15701479 u16 cmd_flags = 0;
1480+ int rc;
15711481
15721482 RCFW_CMD_PREP(req, DESTROY_CQ, cmd_flags);
15731483
15741484 req.cq_cid = cpu_to_le32(cq->id);
1575− resp = (struct creq_destroy_cq_resp *)
1576− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
1577− NULL, 0);
1578− if (!resp) {
1579− dev_err(&rcfw->pdev->dev, "QPLIB: FP: DESTROY_CQ send failed");
1580− return -EINVAL;
1581− }
1582− if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) {
1583− /* Cmd timed out */
1584− dev_err(&rcfw->pdev->dev, "QPLIB: FP: DESTROY_CQ timed out");
1585− return -ETIMEDOUT;
1586− }
1587− if (resp->status ||
1588− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
1589− dev_err(&rcfw->pdev->dev, "QPLIB: FP: DESTROY_CQ failed ");
1590− dev_err(&rcfw->pdev->dev,
1591− "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x",
1592− resp->status, le16_to_cpu(req.cookie),
1593− le16_to_cpu(resp->cookie));
1594− return -EINVAL;
1595− }
1485+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
1486+ (void *)&resp, NULL, 0);
1487+ if (rc)
1488+ return rc;
15961489 bnxt_qplib_free_hwq(res->pdev, &cq->hwq);
15971490 return 0;
15981491 }
@@ -1664,14 +1557,113 @@ static int __flush_rq(struct bnxt_qplib_q *rq, struct bnxt_qplib_qp *qp, · 65 unmodified lines
16641557 return rc;
16651558 }
16661559
1560+/* Note: SQE is valid from sw_sq_cons up to cqe_sq_cons (exclusive)
1561+ * CQE is track from sw_cq_cons to max_element but valid only if VALID=1
1562+ */
1563+static int do_wa9060(struct bnxt_qplib_qp *qp, struct bnxt_qplib_cq *cq,
1564+ u32 cq_cons, u32 sw_sq_cons, u32 cqe_sq_cons)
1565+{
1566+ struct bnxt_qplib_q *sq = &qp->sq;
1567+ struct bnxt_qplib_swq *swq;
1568+ u32 peek_sw_cq_cons, peek_raw_cq_cons, peek_sq_cons_idx;
1569+ struct cq_base *peek_hwcqe, **peek_hw_cqe_ptr;
1570+ struct cq_req *peek_req_hwcqe;
1571+ struct bnxt_qplib_qp *peek_qp;
1572+ struct bnxt_qplib_q *peek_sq;
1573+ int i, rc = 0;
1574+
1575+ /* Normal mode */
1576+ /* Check for the psn_search marking before completing */
1577+ swq = &sq->swq[sw_sq_cons];
1578+ if (swq->psn_search &&
1579+ le32_to_cpu(swq->psn_search->flags_next_psn) & 0x80000000) {
1580+ /* Unmark */
1581+ swq->psn_search->flags_next_psn = cpu_to_le32
1582+ (le32_to_cpu(swq->psn_search->flags_next_psn)
1583+ & ~0x80000000);
1584+ dev_dbg(&cq->hwq.pdev->dev,
1585+ "FP: Process Req cq_cons=0x%x qp=0x%x sq cons sw=0x%x cqe=0x%x marked!\n",
1586+ cq_cons, qp->id, sw_sq_cons, cqe_sq_cons);
1587+ sq->condition = true;
1588+ sq->send_phantom = true;
1589+
1590+ /* TODO: Only ARM if the previous SQE is ARMALL */
1591+ bnxt_qplib_arm_cq(cq, DBR_DBR_TYPE_CQ_ARMALL);
1592+
1593+ rc = -EAGAIN;
1594+ goto out;
1595+ }
1596+ if (sq->condition) {
1597+ /* Peek at the completions */
1598+ peek_raw_cq_cons = cq->hwq.cons;
1599+ peek_sw_cq_cons = cq_cons;
1600+ i = cq->hwq.max_elements;
1601+ while (i--) {
1602+ peek_sw_cq_cons = HWQ_CMP((peek_sw_cq_cons), &cq->hwq);
1603+ peek_hw_cqe_ptr = (struct cq_base **)cq->hwq.pbl_ptr;
1604+ peek_hwcqe = &peek_hw_cqe_ptr[CQE_PG(peek_sw_cq_cons)]
1605+ [CQE_IDX(peek_sw_cq_cons)];
1606+ /* If the next hwcqe is VALID */
1607+ if (CQE_CMP_VALID(peek_hwcqe, peek_raw_cq_cons,
1608+ cq->hwq.max_elements)) {
1609+ /* If the next hwcqe is a REQ */
1610+ if ((peek_hwcqe->cqe_type_toggle &
1611+ CQ_BASE_CQE_TYPE_MASK) ==
1612+ CQ_BASE_CQE_TYPE_REQ) {
1613+ peek_req_hwcqe = (struct cq_req *)
1614+ peek_hwcqe;
1615+ peek_qp = (struct bnxt_qplib_qp *)
1616+ ((unsigned long)
1617+ le64_to_cpu
1618+ (peek_req_hwcqe->qp_handle));
1619+ peek_sq = &peek_qp->sq;
1620+ peek_sq_cons_idx = HWQ_CMP(le16_to_cpu(
1621+ peek_req_hwcqe->sq_cons_idx) - 1
1622+ , &sq->hwq);
1623+ /* If the hwcqe's sq's wr_id matches */
1624+ if (peek_sq == sq &&
1625+ sq->swq[peek_sq_cons_idx].wr_id ==
1626+ BNXT_QPLIB_FENCE_WRID) {
1627+ /*
1628+ * Unbreak only if the phantom
1629+ * comes back
1630+ */
1631+ dev_dbg(&cq->hwq.pdev->dev,
1632+ "FP:Got Phantom CQE");
1633+ sq->condition = false;
1634+ sq->single = true;
1635+ rc = 0;
1636+ goto out;
1637+ }
1638+ }
1639+ /* Valid but not the phantom, so keep looping */
1640+ } else {
1641+ /* Not valid yet, just exit and wait */
1642+ rc = -EINVAL;
1643+ goto out;
1644+ }
1645+ peek_sw_cq_cons++;
1646+ peek_raw_cq_cons++;
1647+ }
1648+ dev_err(&cq->hwq.pdev->dev,
1649+ "Should not have come here! cq_cons=0x%x qp=0x%x sq cons sw=0x%x hw=0x%x",
1650+ cq_cons, qp->id, sw_sq_cons, cqe_sq_cons);
1651+ rc = -EINVAL;
1652+ }
1653+out:
1654+ return rc;
1655+}
1656+
16671657 static int bnxt_qplib_cq_process_req(struct bnxt_qplib_cq *cq,
16681658 struct cq_req *hwcqe,
1669− struct bnxt_qplib_cqe **pcqe, int *budget)
1659+ struct bnxt_qplib_cqe **pcqe, int *budget,
1660+ u32 cq_cons, struct bnxt_qplib_qp **lib_qp)
16701661 {
16711662 struct bnxt_qplib_qp *qp;
16721663 struct bnxt_qplib_q *sq;
16731664 struct bnxt_qplib_cqe *cqe;
1674− u32 sw_cons, cqe_cons;
1665+ u32 sw_sq_cons, cqe_sq_cons;
1666+ struct bnxt_qplib_swq *swq;
16751667 int rc = 0;
16761668
16771669 qp = (struct bnxt_qplib_qp *)((unsigned long)
@@ -1683,13 +1675,13 @@ static int bnxt_qplib_cq_process_req(struct bnxt_qplib_cq *cq, · 5 unmodified lines
16831675 }
16841676 sq = &qp->sq;
16851677
1686− cqe_cons = HWQ_CMP(le16_to_cpu(hwcqe->sq_cons_idx), &sq->hwq);
1687− if (cqe_cons > sq->hwq.max_elements) {
1678+ cqe_sq_cons = HWQ_CMP(le16_to_cpu(hwcqe->sq_cons_idx), &sq->hwq);
1679+ if (cqe_sq_cons > sq->hwq.max_elements) {
16881680 dev_err(&cq->hwq.pdev->dev,
16891681 "QPLIB: FP: CQ Process req reported ");
16901682 dev_err(&cq->hwq.pdev->dev,
16911683 "QPLIB: sq_cons_idx 0x%x which exceeded max 0x%x",
1692− cqe_cons, sq->hwq.max_elements);
1684+ cqe_sq_cons, sq->hwq.max_elements);
16931685 return -EINVAL;
16941686 }
16951687 /* If we were in the middle of flushing the SQ, continue */
@@ -1698,53 +1690,74 @@ static int bnxt_qplib_cq_process_req(struct bnxt_qplib_cq *cq, · 2 unmodified lines
16981690
16991691 /* Require to walk the sq's swq to fabricate CQEs for all previously
17001692 * signaled SWQEs due to CQE aggregation from the current sq cons
1701− * to the cqe_cons
1693+ * to the cqe_sq_cons
17021694 */
17031695 cqe = *pcqe;
17041696 while (*budget) {
1705− sw_cons = HWQ_CMP(sq->hwq.cons, &sq->hwq);
1706− if (sw_cons == cqe_cons)
1697+ sw_sq_cons = HWQ_CMP(sq->hwq.cons, &sq->hwq);
1698+ if (sw_sq_cons == cqe_sq_cons)
1699+ /* Done */
17071700 break;
1701+
1702+ swq = &sq->swq[sw_sq_cons];
17081703 memset(cqe, 0, sizeof(*cqe));
17091704 cqe->opcode = CQ_BASE_CQE_TYPE_REQ;
17101705 cqe->qp_handle = (u64)(unsigned long)qp;
17111706 cqe->src_qp = qp->id;
1712− cqe->wr_id = sq->swq[sw_cons].wr_id;
1713− cqe->type = sq->swq[sw_cons].type;
1707+ cqe->wr_id = swq->wr_id;
1708+ if (cqe->wr_id == BNXT_QPLIB_FENCE_WRID)
1709+ goto skip;
1710+ cqe->type = swq->type;
17141711
17151712 /* For the last CQE, check for status. For errors, regardless
17161713 * of the request being signaled or not, it must complete with
17171714 * the hwcqe error status
17181715 */
1719− if (HWQ_CMP((sw_cons + 1), &sq->hwq) == cqe_cons &&
1716+ if (HWQ_CMP((sw_sq_cons + 1), &sq->hwq) == cqe_sq_cons &&
17201717 hwcqe->status != CQ_REQ_STATUS_OK) {
17211718 cqe->status = hwcqe->status;
17221719 dev_err(&cq->hwq.pdev->dev,
17231720 "QPLIB: FP: CQ Processed Req ");
17241721 dev_err(&cq->hwq.pdev->dev,
17251722 "QPLIB: wr_id[%d] = 0x%llx with status 0x%x",
1726− sw_cons, cqe->wr_id, cqe->status);
1723+ sw_sq_cons, cqe->wr_id, cqe->status);
17271724 cqe++;
17281725 (*budget)--;
17291726 sq->flush_in_progress = true;
17301727 /* Must block new posting of SQ and RQ */
17311728 qp->state = CMDQ_MODIFY_QP_NEW_STATE_ERR;
1729+ sq->condition = false;
1730+ sq->single = false;
17321731 } else {
1733− if (sq->swq[sw_cons].flags &
1734− SQ_SEND_FLAGS_SIGNAL_COMP) {
1732+ if (swq->flags & SQ_SEND_FLAGS_SIGNAL_COMP) {
1733+ /* Before we complete, do WA 9060 */
1734+ if (do_wa9060(qp, cq, cq_cons, sw_sq_cons,
1735+ cqe_sq_cons)) {
1736+ *lib_qp = qp;
1737+ goto out;
1738+ }
17351739 cqe->status = CQ_REQ_STATUS_OK;
17361740 cqe++;
17371741 (*budget)--;
17381742 }
17391743 }
1744+skip:
17401745 sq->hwq.cons++;
1746+ if (sq->single)
1747+ break;
17411748 }
1749+out:
17421750 *pcqe = cqe;
1743− if (!*budget && HWQ_CMP(sq->hwq.cons, &sq->hwq) != cqe_cons) {
1751+ if (HWQ_CMP(sq->hwq.cons, &sq->hwq) != cqe_sq_cons) {
17441752 /* Out of budget */
17451753 rc = -EAGAIN;
17461754 goto done;
17471755 }
1756+ /*
1757+ * Back to normal completion mode only after it has completed all of
1758+ * the WC for this CQE
1759+ */
1760+ sq->single = false;
17481761 if (!sq->flush_in_progress)
17491762 goto done;
17501763 flush:
@@ -2074,7 +2087,7 @@ static int bnxt_qplib_cq_process_cutoff(struct bnxt_qplib_cq *cq, · 323 unmodified lines
20742087 }
20752088
20762089 int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe,
2077− int num_cqes)
2090+ int num_cqes, struct bnxt_qplib_qp **lib_qp)
20782091 {
20792092 struct cq_base *hw_cqe, **hw_cqe_ptr;
20802093 unsigned long flags;
@@ -2099,7 +2112,8 @@ int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe, · 18 unmodified lines
20992112 case CQ_BASE_CQE_TYPE_REQ:
21002113 rc = bnxt_qplib_cq_process_req(cq,
21012114 (struct cq_req *)hw_cqe,
2102− &cqe, &budget);
2115+ &cqe, &budget,
2116+ sw_cons, lib_qp);
21032117 break;
21042118 case CQ_BASE_CQE_TYPE_RES_RC:
21052119 rc = bnxt_qplib_cq_process_res_rc(cq,
drivers/infiniband/hw/bnxt_re/qplib_fp.h+17−1
@@ -88,6 +88,7 @@ struct bnxt_qplib_swq { · 87 unmodified lines
8888
8989 struct bnxt_qplib_swqe {
9090 /* General */
91+#define BNXT_QPLIB_FENCE_WRID 0x46454E43 /* "FENC" */
9192 u64 wr_id;
9293 u8 reqs_type;
9394 u8 type;
@@ -216,9 +217,16 @@ struct bnxt_qplib_q { · 122 unmodified lines
216217 struct scatterlist *sglist;
217218 u32 nmap;
218219 u32 max_wqe;
220+ u16 q_full_delta;
219221 u16 max_sge;
220222 u32 psn;
221223 bool flush_in_progress;
224+ bool condition;
225+ bool single;
226+ bool send_phantom;
227+ u32 phantom_wqe_cnt;
228+ u32 phantom_cqe_cnt;
229+ u32 next_cq_cons;
222230 };
223231
224232 struct bnxt_qplib_qp {
@@ -242,6 +250,7 @@ struct bnxt_qplib_qp { · 17 unmodified lines
242250 u8 timeout;
243251 u8 retry_cnt;
244252 u8 rnr_retry;
253+ u64 wqe_cnt;
245254 u32 min_rnr_timer;
246255 u32 max_rd_atomic;
247256 u32 max_dest_rd_atomic;
@@ -301,6 +310,13 @@ struct bnxt_qplib_qp { · 53 unmodified lines
301310 (!!((hdr)->cqe_type_toggle & CQ_BASE_TOGGLE) == \
302311 !((raw_cons) & (cp_bit)))
303312
313+static inline bool bnxt_qplib_queue_full(struct bnxt_qplib_q *qplib_q)
314+{
315+ return HWQ_CMP((qplib_q->hwq.prod + qplib_q->q_full_delta),
316+ &qplib_q->hwq) == HWQ_CMP(qplib_q->hwq.cons,
317+ &qplib_q->hwq);
318+}
319+
304320 struct bnxt_qplib_cqe {
305321 u8 status;
306322 u8 type;
@@ -432,7 +448,7 @@ int bnxt_qplib_post_recv(struct bnxt_qplib_qp *qp, · 125 unmodified lines
432448 int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq);
433449 int bnxt_qplib_destroy_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq);
434450 int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe,
435− int num);
451+ int num, struct bnxt_qplib_qp **qp);
436452 void bnxt_qplib_req_notify_cq(struct bnxt_qplib_cq *cq, u32 arm_type);
437453 void bnxt_qplib_free_nq(struct bnxt_qplib_nq *nq);
438454 int bnxt_qplib_alloc_nq(struct pci_dev *pdev, struct bnxt_qplib_nq *nq);
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c+164−150
@@ -39,72 +39,55 @@ · 38 unmodified lines
3939 #include <linux/spinlock.h>
4040 #include <linux/pci.h>
4141 #include <linux/prefetch.h>
42+#include <linux/delay.h>
43+
4244 #include "roce_hsi.h"
4345 #include "qplib_res.h"
4446 #include "qplib_rcfw.h"
4547 static void bnxt_qplib_service_creq(unsigned long data);
4648
4749 /* Hardware communication channel */
48−int bnxt_qplib_rcfw_wait_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie)
50+static int __wait_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie)
4951 {
5052 u16 cbit;
5153 int rc;
5254
53− cookie &= RCFW_MAX_COOKIE_VALUE;
5455 cbit = cookie % RCFW_MAX_OUTSTANDING_CMD;
55− if (!test_bit(cbit, rcfw->cmdq_bitmap))
56− dev_warn(&rcfw->pdev->dev,
57− "QPLIB: CMD bit %d for cookie 0x%x is not set?",
58− cbit, cookie);
59−
6056 rc = wait_event_timeout(rcfw->waitq,
6157 !test_bit(cbit, rcfw->cmdq_bitmap),
6258 msecs_to_jiffies(RCFW_CMD_WAIT_TIME_MS));
63− if (!rc) {
64− dev_warn(&rcfw->pdev->dev,
65− "QPLIB: Bono Error: timeout %d msec, msg {0x%x}\n",
66− RCFW_CMD_WAIT_TIME_MS, cookie);
67− }
68−
69− return rc;
59+ return rc ? 0 : -ETIMEDOUT;
7060 };
7161
72−int bnxt_qplib_rcfw_block_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie)
62+static int __block_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie)
7363 {
74− u32 count = -1;
64+ u32 count = RCFW_BLOCKED_CMD_WAIT_COUNT;
7565 u16 cbit;
7666
77− cookie &= RCFW_MAX_COOKIE_VALUE;
7867 cbit = cookie % RCFW_MAX_OUTSTANDING_CMD;
7968 if (!test_bit(cbit, rcfw->cmdq_bitmap))
8069 goto done;
8170 do {
71+ mdelay(1); /* 1m sec */
8272 bnxt_qplib_service_creq((unsigned long)rcfw);
8373 } while (test_bit(cbit, rcfw->cmdq_bitmap) && --count);
8474 done:
85− return count;
75+ return count ? 0 : -ETIMEDOUT;
8676 };
8777
88−void *bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,
89− struct cmdq_base *req, void **crsbe,
90− u8 is_block)
78+static int __send_message(struct bnxt_qplib_rcfw *rcfw, struct cmdq_base *req,
79+ struct creq_base *resp, void *sb, u8 is_block)
9180 {
92− struct bnxt_qplib_crsq *crsq = &rcfw->crsq;
9381 struct bnxt_qplib_cmdqe *cmdqe, **cmdq_ptr;
9482 struct bnxt_qplib_hwq *cmdq = &rcfw->cmdq;
95− struct bnxt_qplib_hwq *crsb = &rcfw->crsb;
96− struct bnxt_qplib_crsqe *crsqe = NULL;
97− struct bnxt_qplib_crsbe **crsb_ptr;
83+ struct bnxt_qplib_crsq *crsqe;
9884 u32 sw_prod, cmdq_prod;
99− u8 retry_cnt = 0xFF;
100− dma_addr_t dma_addr;
10185 unsigned long flags;
10286 u32 size, opcode;
10387 u16 cookie, cbit;
10488 int pg, idx;
10589 u8 *preq;
10690
107−retry:
10891 opcode = req->opcode;
10992 if (!test_bit(FIRMWARE_INITIALIZED_FLAG, &rcfw->flags) &&
11093 (opcode != CMDQ_BASE_OPCODE_QUERY_FUNC &&
@@ -112,63 +95,50 @@ retry: · 1 unmodified line
11295 dev_err(&rcfw->pdev->dev,
11396 "QPLIB: RCFW not initialized, reject opcode 0x%x",
11497 opcode);
115− return NULL;
98+ return -EINVAL;
11699 }
117100
118101 if (test_bit(FIRMWARE_INITIALIZED_FLAG, &rcfw->flags) &&
119102 opcode == CMDQ_BASE_OPCODE_INITIALIZE_FW) {
120103 dev_err(&rcfw->pdev->dev, "QPLIB: RCFW already initialized!");
121− return NULL;
104+ return -EINVAL;
122105 }
123106
124107 /* Cmdq are in 16-byte units, each request can consume 1 or more
125108 * cmdqe
126109 */
127110 spin_lock_irqsave(&cmdq->lock, flags);
128− if (req->cmd_size > cmdq->max_elements -
129− ((HWQ_CMP(cmdq->prod, cmdq) - HWQ_CMP(cmdq->cons, cmdq)) &
130− (cmdq->max_elements - 1))) {
111+ if (req->cmd_size >= HWQ_FREE_SLOTS(cmdq)) {
131112 dev_err(&rcfw->pdev->dev, "QPLIB: RCFW: CMDQ is full!");
132113 spin_unlock_irqrestore(&cmdq->lock, flags);
133−
134− if (!retry_cnt--)
135− return NULL;
136− goto retry;
114+ return -EAGAIN;
137115 }
138116
139− retry_cnt = 0xFF;
140117
141− cookie = atomic_inc_return(&rcfw->seq_num) & RCFW_MAX_COOKIE_VALUE;
118+ cookie = rcfw->seq_num & RCFW_MAX_COOKIE_VALUE;
142119 cbit = cookie % RCFW_MAX_OUTSTANDING_CMD;
143120 if (is_block)
144121 cookie |= RCFW_CMD_IS_BLOCKING;
122+
123+ set_bit(cbit, rcfw->cmdq_bitmap);
145124 req->cookie = cpu_to_le16(cookie);
146− if (test_and_set_bit(cbit, rcfw->cmdq_bitmap)) {
147− dev_err(&rcfw->pdev->dev,
148− "QPLIB: RCFW MAX outstanding cmd reached!");
149− atomic_dec(&rcfw->seq_num);
125+ crsqe = &rcfw->crsqe_tbl[cbit];
126+ if (crsqe->resp) {
150127 spin_unlock_irqrestore(&cmdq->lock, flags);
151−
152− if (!retry_cnt--)
153− return NULL;
154− goto retry;
128+ return -EBUSY;
155129 }
156− /* Reserve a resp buffer slot if requested */
157− if (req->resp_size && crsbe) {
158− spin_lock(&crsb->lock);
159− sw_prod = HWQ_CMP(crsb->prod, crsb);
160− crsb_ptr = (struct bnxt_qplib_crsbe **)crsb->pbl_ptr;
161− *crsbe = (void *)&crsb_ptr[get_crsb_pg(sw_prod)]
162− [get_crsb_idx(sw_prod)];
163− bnxt_qplib_crsb_dma_next(crsb->pbl_dma_ptr, sw_prod, &dma_addr);
164− req->resp_addr = cpu_to_le64(dma_addr);
165− crsb->prod++;
166− spin_unlock(&crsb->lock);
167−
168− req->resp_size = (sizeof(struct bnxt_qplib_crsbe) +
169− BNXT_QPLIB_CMDQE_UNITS - 1) /
170− BNXT_QPLIB_CMDQE_UNITS;
130+ memset(resp, 0, sizeof(*resp));
131+ crsqe->resp = (struct creq_qp_event *)resp;
132+ crsqe->resp->cookie = req->cookie;
133+ crsqe->req_size = req->cmd_size;
134+ if (req->resp_size && sb) {
135+ struct bnxt_qplib_rcfw_sbuf *sbuf = sb;
136+
137+ req->resp_addr = cpu_to_le64(sbuf->dma_addr);
138+ req->resp_size = (sbuf->size + BNXT_QPLIB_CMDQE_UNITS - 1) /
139+ BNXT_QPLIB_CMDQE_UNITS;
171140 }
141+
172142 cmdq_ptr = (struct bnxt_qplib_cmdqe **)cmdq->pbl_ptr;
173143 preq = (u8 *)req;
174144 size = req->cmd_size * BNXT_QPLIB_CMDQE_UNITS;
@@ -190,23 +160,24 @@ retry: · 15 unmodified lines
190160 preq += min_t(u32, size, sizeof(*cmdqe));
191161 size -= min_t(u32, size, sizeof(*cmdqe));
192162 cmdq->prod++;
163+ rcfw->seq_num++;
193164 } while (size > 0);
194165
166+ rcfw->seq_num++;
167+
195168 cmdq_prod = cmdq->prod;
196169 if (rcfw->flags & FIRMWARE_FIRST_FLAG) {
197− /* The very first doorbell write is required to set this flag
198− * which prompts the FW to reset its internal pointers
170+ /* The very first doorbell write
171+ * is required to set this flag
172+ * which prompts the FW to reset
173+ * its internal pointers
199174 */
200175 cmdq_prod |= FIRMWARE_FIRST_FLAG;
201176 rcfw->flags &= ~FIRMWARE_FIRST_FLAG;
202177 }
203− sw_prod = HWQ_CMP(crsq->prod, crsq);
204− crsqe = &crsq->crsq[sw_prod];
205− memset(crsqe, 0, sizeof(*crsqe));
206− crsq->prod++;
207− crsqe->req_size = req->cmd_size;
208178
209179 /* ring CMDQ DB */
180+ wmb();
210181 writel(cmdq_prod, rcfw->cmdq_bar_reg_iomem +
211182 rcfw->cmdq_bar_reg_prod_off);
212183 writel(RCFW_CMDQ_TRIG_VAL, rcfw->cmdq_bar_reg_iomem +
@@ -214,9 +185,56 @@ retry: · 1 unmodified line
214185 done:
215186 spin_unlock_irqrestore(&cmdq->lock, flags);
216187 /* Return the CREQ response pointer */
217− return crsqe ? &crsqe->qp_event : NULL;
188+ return 0;
218189 }
219190
191+int bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,
192+ struct cmdq_base *req,
193+ struct creq_base *resp,
194+ void *sb, u8 is_block)
195+{
196+ struct creq_qp_event *evnt = (struct creq_qp_event *)resp;
197+ u16 cookie;
198+ u8 opcode, retry_cnt = 0xFF;
199+ int rc = 0;
200+
201+ do {
202+ opcode = req->opcode;
203+ rc = __send_message(rcfw, req, resp, sb, is_block);
204+ cookie = le16_to_cpu(req->cookie) & RCFW_MAX_COOKIE_VALUE;
205+ if (!rc)
206+ break;
207+
208+ if (!retry_cnt || (rc != -EAGAIN && rc != -EBUSY)) {
209+ /* send failed */
210+ dev_err(&rcfw->pdev->dev, "QPLIB: cmdq[%#x]=%#x send failed",
211+ cookie, opcode);
212+ return rc;
213+ }
214+ is_block ? mdelay(1) : usleep_range(500, 1000);
215+
216+ } while (retry_cnt--);
217+
218+ if (is_block)
219+ rc = __block_for_resp(rcfw, cookie);
220+ else
221+ rc = __wait_for_resp(rcfw, cookie);
222+ if (rc) {
223+ /* timed out */
224+ dev_err(&rcfw->pdev->dev, "QPLIB: cmdq[%#x]=%#x timedout (%d)msec",
225+ cookie, opcode, RCFW_CMD_WAIT_TIME_MS);
226+ return rc;
227+ }
228+
229+ if (evnt->status) {
230+ /* failed with status */
231+ dev_err(&rcfw->pdev->dev, "QPLIB: cmdq[%#x]=%#x status %#x",
232+ cookie, opcode, evnt->status);
233+ rc = -EFAULT;
234+ }
235+
236+ return rc;
237+}
220238 /* Completions */
221239 static int bnxt_qplib_process_func_event(struct bnxt_qplib_rcfw *rcfw,
222240 struct creq_func_event *func_event)
@@ -260,12 +278,12 @@ static int bnxt_qplib_process_func_event(struct bnxt_qplib_rcfw *rcfw, · 37 unmodified lines
260278 static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
261279 struct creq_qp_event *qp_event)
262280 {
263− struct bnxt_qplib_crsq *crsq = &rcfw->crsq;
264281 struct bnxt_qplib_hwq *cmdq = &rcfw->cmdq;
265− struct bnxt_qplib_crsqe *crsqe;
266− u16 cbit, cookie, blocked = 0;
282+ struct bnxt_qplib_crsq *crsqe;
267283 unsigned long flags;
268− u32 sw_cons;
284+ u16 cbit, blocked = 0;
285+ u16 cookie;
286+ __le16 mcookie;
269287
270288 switch (qp_event->event) {
271289 case CREQ_QP_EVENT_EVENT_QP_ERROR_NOTIFICATION:
@@ -275,24 +293,31 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, · 3 unmodified lines
275293 default:
276294 /* Command Response */
277295 spin_lock_irqsave(&cmdq->lock, flags);
278− sw_cons = HWQ_CMP(crsq->cons, crsq);
279− crsqe = &crsq->crsq[sw_cons];
280− crsq->cons++;
281− memcpy(&crsqe->qp_event, qp_event, sizeof(crsqe->qp_event));
282−
283− cookie = le16_to_cpu(crsqe->qp_event.cookie);
296+ cookie = le16_to_cpu(qp_event->cookie);
297+ mcookie = qp_event->cookie;
284298 blocked = cookie & RCFW_CMD_IS_BLOCKING;
285299 cookie &= RCFW_MAX_COOKIE_VALUE;
286300 cbit = cookie % RCFW_MAX_OUTSTANDING_CMD;
301+ crsqe = &rcfw->crsqe_tbl[cbit];
302+ if (crsqe->resp &&
303+ crsqe->resp->cookie == mcookie) {
304+ memcpy(crsqe->resp, qp_event, sizeof(*qp_event));
305+ crsqe->resp = NULL;
306+ } else {
307+ dev_err(&rcfw->pdev->dev,
308+ "QPLIB: CMD %s resp->cookie = %#x, evnt->cookie = %#x",
309+ crsqe->resp ? "mismatch" : "collision",
310+ crsqe->resp ? crsqe->resp->cookie : 0, mcookie);
311+ }
287312 if (!test_and_clear_bit(cbit, rcfw->cmdq_bitmap))
288313 dev_warn(&rcfw->pdev->dev,
289314 "QPLIB: CMD bit %d was not requested", cbit);
290−
291315 cmdq->cons += crsqe->req_size;
292− spin_unlock_irqrestore(&cmdq->lock, flags);
316+ crsqe->req_size = 0;
317+
293318 if (!blocked)
294319 wake_up(&rcfw->waitq);
295− break;
320+ spin_unlock_irqrestore(&cmdq->lock, flags);
296321 }
297322 return 0;
298323 }
@@ -305,12 +330,12 @@ static void bnxt_qplib_service_creq(unsigned long data) · 6 unmodified lines
305330 struct creq_base *creqe, **creq_ptr;
306331 u32 sw_cons, raw_cons;
307332 unsigned long flags;
308− u32 type;
333+ u32 type, budget = CREQ_ENTRY_POLL_BUDGET;
309334
310− /* Service the CREQ until empty */
335+ /* Service the CREQ until budget is over */
311336 spin_lock_irqsave(&creq->lock, flags);
312337 raw_cons = creq->cons;
313− while (1) {
338+ while (budget > 0) {
314339 sw_cons = HWQ_CMP(raw_cons, creq);
315340 creq_ptr = (struct creq_base **)creq->pbl_ptr;
316341 creqe = &creq_ptr[get_creq_pg(sw_cons)][get_creq_idx(sw_cons)];
@@ -320,15 +345,9 @@ static void bnxt_qplib_service_creq(unsigned long data) · 3 unmodified lines
320345 type = creqe->type & CREQ_BASE_TYPE_MASK;
321346 switch (type) {
322347 case CREQ_BASE_TYPE_QP_EVENT:
323− if (!bnxt_qplib_process_qp_event
324− (rcfw, (struct creq_qp_event *)creqe))
325− rcfw->creq_qp_event_processed++;
326− else {
327− dev_warn(&rcfw->pdev->dev, "QPLIB: crsqe with");
328− dev_warn(&rcfw->pdev->dev,
329− "QPLIB: type = 0x%x not handled",
330− type);
331− }
348+ bnxt_qplib_process_qp_event
349+ (rcfw, (struct creq_qp_event *)creqe);
350+ rcfw->creq_qp_event_processed++;
332351 break;
333352 case CREQ_BASE_TYPE_FUNC_EVENT:
334353 if (!bnxt_qplib_process_func_event
@@ -346,7 +365,9 @@ static void bnxt_qplib_service_creq(unsigned long data) · 11 unmodified lines
346365 break;
347366 }
348367 raw_cons++;
368+ budget--;
349369 }
370+
350371 if (creq->cons != raw_cons) {
351372 creq->cons = raw_cons;
352373 CREQ_DB_REARM(rcfw->creq_bar_reg_iomem, raw_cons,
@@ -375,23 +396,16 @@ static irqreturn_t bnxt_qplib_creq_irq(int irq, void *dev_instance) · 22 unmodified lines
375396 /* RCFW */
376397 int bnxt_qplib_deinit_rcfw(struct bnxt_qplib_rcfw *rcfw)
377398 {
378− struct creq_deinitialize_fw_resp *resp;
379399 struct cmdq_deinitialize_fw req;
400+ struct creq_deinitialize_fw_resp resp;
380401 u16 cmd_flags = 0;
402+ int rc;
381403
382404 RCFW_CMD_PREP(req, DEINITIALIZE_FW, cmd_flags);
383− resp = (struct creq_deinitialize_fw_resp *)
384− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
385− NULL, 0);
386− if (!resp)
387− return -EINVAL;
388−
389− if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie)))
390− return -ETIMEDOUT;
391−
392− if (resp->status ||
393− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie))
394− return -EFAULT;
405+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
406+ NULL, 0);
407+ if (rc)
408+ return rc;
395409
396410 clear_bit(FIRMWARE_INITIALIZED_FLAG, &rcfw->flags);
397411 return 0;
@@ -417,9 +431,10 @@ static int __get_pbl_pg_idx(struct bnxt_qplib_pbl *pbl) · 19 unmodified lines
417431 int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,
418432 struct bnxt_qplib_ctx *ctx, int is_virtfn)
419433 {
420− struct creq_initialize_fw_resp *resp;
421434 struct cmdq_initialize_fw req;
435+ struct creq_initialize_fw_resp resp;
422436 u16 cmd_flags = 0, level;
437+ int rc;
423438
424439 RCFW_CMD_PREP(req, INITIALIZE_FW, cmd_flags);
425440
@@ -482,37 +497,19 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw, · 56 unmodified lines
482497
483498 skip_ctx_setup:
484499 req.stat_ctx_id = cpu_to_le32(ctx->stats.fw_id);
485− resp = (struct creq_initialize_fw_resp *)
486− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
487− NULL, 0);
488− if (!resp) {
489− dev_err(&rcfw->pdev->dev,
490− "QPLIB: RCFW: INITIALIZE_FW send failed");
491− return -EINVAL;
492− }
493− if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) {
494− /* Cmd timed out */
495− dev_err(&rcfw->pdev->dev,
496− "QPLIB: RCFW: INITIALIZE_FW timed out");
497− return -ETIMEDOUT;
498− }
499− if (resp->status ||
500− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
501− dev_err(&rcfw->pdev->dev,
502− "QPLIB: RCFW: INITIALIZE_FW failed");
503− return -EINVAL;
504− }
500+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
501+ NULL, 0);
502+ if (rc)
503+ return rc;
505504 set_bit(FIRMWARE_INITIALIZED_FLAG, &rcfw->flags);
506505 return 0;
507506 }
508507
509508 void bnxt_qplib_free_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)
510509 {
511− bnxt_qplib_free_hwq(rcfw->pdev, &rcfw->crsb);
512− kfree(rcfw->crsq.crsq);
510+ kfree(rcfw->crsqe_tbl);
513511 bnxt_qplib_free_hwq(rcfw->pdev, &rcfw->cmdq);
514512 bnxt_qplib_free_hwq(rcfw->pdev, &rcfw->creq);
515−
516513 rcfw->pdev = NULL;
517514 }
518515
@@ -539,21 +536,11 @@ int bnxt_qplib_alloc_rcfw_channel(struct pci_dev *pdev, · 20 unmodified lines
539536 goto fail;
540537 }
541538
542− rcfw->crsq.max_elements = rcfw->cmdq.max_elements;
543− rcfw->crsq.crsq = kcalloc(rcfw->crsq.max_elements,
544− sizeof(*rcfw->crsq.crsq), GFP_KERNEL);
545− if (!rcfw->crsq.crsq)
539+ rcfw->crsqe_tbl = kcalloc(rcfw->cmdq.max_elements,
540+ sizeof(*rcfw->crsqe_tbl), GFP_KERNEL);
541+ if (!rcfw->crsqe_tbl)
546542 goto fail;
547543
548− rcfw->crsb.max_elements = BNXT_QPLIB_CRSBE_MAX_CNT;
549− if (bnxt_qplib_alloc_init_hwq(rcfw->pdev, &rcfw->crsb, NULL, 0,
550− &rcfw->crsb.max_elements,
551− BNXT_QPLIB_CRSBE_UNITS, 0, PAGE_SIZE,
552− HWQ_TYPE_CTX)) {
553− dev_err(&rcfw->pdev->dev,
554− "QPLIB: HW channel CRSB allocation failed");
555− goto fail;
556− }
557544 return 0;
558545
559546 fail:
@@ -606,7 +593,7 @@ int bnxt_qplib_enable_rcfw_channel(struct pci_dev *pdev, · 46 unmodified lines
606593 int rc;
607594
608595 /* General */
609− atomic_set(&rcfw->seq_num, 0);
596+ rcfw->seq_num = 0;
610597 rcfw->flags = FIRMWARE_FIRST_FLAG;
611598 bmap_size = BITS_TO_LONGS(RCFW_MAX_OUTSTANDING_CMD *
612599 sizeof(unsigned long));
@@ -636,10 +623,6 @@ int bnxt_qplib_enable_rcfw_channel(struct pci_dev *pdev, · 23 unmodified lines
636623
637624 rcfw->cmdq_bar_reg_trig_off = RCFW_COMM_TRIG_OFFSET;
638625
639− /* CRSQ */
640− rcfw->crsq.prod = 0;
641− rcfw->crsq.cons = 0;
642−
643626 /* CREQ */
644627 rcfw->creq_bar_reg = RCFW_COMM_CONS_PCI_BAR_REGION;
645628 res_base = pci_resource_start(pdev, rcfw->creq_bar_reg);
@@ -692,3 +675,34 @@ int bnxt_qplib_enable_rcfw_channel(struct pci_dev *pdev, · 46 unmodified lines
692675 __iowrite32_copy(rcfw->cmdq_bar_reg_iomem, &init, sizeof(init) / 4);
693676 return 0;
694677 }
678+
679+struct bnxt_qplib_rcfw_sbuf *bnxt_qplib_rcfw_alloc_sbuf(
680+ struct bnxt_qplib_rcfw *rcfw,
681+ u32 size)
682+{
683+ struct bnxt_qplib_rcfw_sbuf *sbuf;
684+
685+ sbuf = kzalloc(sizeof(*sbuf), GFP_ATOMIC);
686+ if (!sbuf)
687+ return NULL;
688+
689+ sbuf->size = size;
690+ sbuf->sb = dma_zalloc_coherent(&rcfw->pdev->dev, sbuf->size,
691+ &sbuf->dma_addr, GFP_ATOMIC);
692+ if (!sbuf->sb)
693+ goto bail;
694+
695+ return sbuf;
696+bail:
697+ kfree(sbuf);
698+ return NULL;
699+}
700+
701+void bnxt_qplib_rcfw_free_sbuf(struct bnxt_qplib_rcfw *rcfw,
702+ struct bnxt_qplib_rcfw_sbuf *sbuf)
703+{
704+ if (sbuf->sb)
705+ dma_free_coherent(&rcfw->pdev->dev, sbuf->size,
706+ sbuf->sb, sbuf->dma_addr);
707+ kfree(sbuf);
708+}
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h+20−41
@@ -73,6 +73,7 @@ · 72 unmodified lines
7373 #define RCFW_MAX_OUTSTANDING_CMD BNXT_QPLIB_CMDQE_MAX_CNT
7474 #define RCFW_MAX_COOKIE_VALUE 0x7FFF
7575 #define RCFW_CMD_IS_BLOCKING 0x8000
76+#define RCFW_BLOCKED_CMD_WAIT_COUNT 0x4E20
7677
7778 /* Cmdq contains a fix number of a 16-Byte slots */
7879 struct bnxt_qplib_cmdqe {
@@ -94,32 +95,6 @@ struct bnxt_qplib_crsbe { · 15 unmodified lines
9495 u8 data[1024];
9596 };
9697
97−/* CRSQ SB */
98−#define BNXT_QPLIB_CRSBE_MAX_CNT 4
99−#define BNXT_QPLIB_CRSBE_UNITS sizeof(struct bnxt_qplib_crsbe)
100−#define BNXT_QPLIB_CRSBE_CNT_PER_PG (PAGE_SIZE / BNXT_QPLIB_CRSBE_UNITS)
101−
102−#define MAX_CRSB_IDX (BNXT_QPLIB_CRSBE_MAX_CNT - 1)
103−#define MAX_CRSB_IDX_PER_PG (BNXT_QPLIB_CRSBE_CNT_PER_PG - 1)
104−
105−static inline u32 get_crsb_pg(u32 val)
106−{
107− return (val & ~MAX_CRSB_IDX_PER_PG) / BNXT_QPLIB_CRSBE_CNT_PER_PG;
108−}
109−
110−static inline u32 get_crsb_idx(u32 val)
111−{
112− return val & MAX_CRSB_IDX_PER_PG;
113−}
114−
115−static inline void bnxt_qplib_crsb_dma_next(dma_addr_t *pg_map_arr,
116− u32 prod, dma_addr_t *dma_addr)
117−{
118− *dma_addr = pg_map_arr[(prod) / BNXT_QPLIB_CRSBE_CNT_PER_PG];
119− *dma_addr += ((prod) % BNXT_QPLIB_CRSBE_CNT_PER_PG) *
120− BNXT_QPLIB_CRSBE_UNITS;
121−}
122−
12398 /* CREQ */
12499 /* Allocate 1 per QP for async error notification for now */
125100 #define BNXT_QPLIB_CREQE_MAX_CNT (64 * 1024)
@@ -158,17 +133,19 @@ static inline u32 get_creq_idx(u32 val) · 32 unmodified lines
158133 #define CREQ_DB(db, raw_cons, cp_bit) \
159134 writel(CREQ_DB_CP_FLAGS | ((raw_cons) & ((cp_bit) - 1)), db)
160135
136+#define CREQ_ENTRY_POLL_BUDGET 0x100
137+
161138 /* HWQ */
162−struct bnxt_qplib_crsqe {
163− struct creq_qp_event qp_event;
139+
140+struct bnxt_qplib_crsq {
141+ struct creq_qp_event *resp;
164142 u32 req_size;
165143 };
166144
167−struct bnxt_qplib_crsq {
168− struct bnxt_qplib_crsqe *crsq;
169− u32 prod;
170− u32 cons;
171− u32 max_elements;
145+struct bnxt_qplib_rcfw_sbuf {
146+ void *sb;
147+ dma_addr_t dma_addr;
148+ u32 size;
172149 };
173150
174151 /* RCFW Communication Channels */
@@ -185,7 +162,7 @@ struct bnxt_qplib_rcfw { · 10 unmodified lines
185162 wait_queue_head_t waitq;
186163 int (*aeq_handler)(struct bnxt_qplib_rcfw *,
187164 struct creq_func_event *);
188− atomic_t seq_num;
165+ u32 seq_num;
189166
190167 /* Bar region info */
191168 void __iomem *cmdq_bar_reg_iomem;
@@ -203,8 +180,7 @@ struct bnxt_qplib_rcfw { · 11 unmodified lines
203180
204181 /* Actual Cmd and Resp Queues */
205182 struct bnxt_qplib_hwq cmdq;
206− struct bnxt_qplib_crsq crsq;
207− struct bnxt_qplib_hwq crsb;
183+ struct bnxt_qplib_crsq *crsqe_tbl;
208184 };
209185
210186 void bnxt_qplib_free_rcfw_channel(struct bnxt_qplib_rcfw *rcfw);
@@ -219,11 +195,14 @@ int bnxt_qplib_enable_rcfw_channel(struct pci_dev *pdev, · 8 unmodified lines
219195 (struct bnxt_qplib_rcfw *,
220196 struct creq_func_event *));
221197
222−int bnxt_qplib_rcfw_block_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie);
223−int bnxt_qplib_rcfw_wait_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie);
224−void *bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,
225− struct cmdq_base *req, void **crsbe,
226− u8 is_block);
198+struct bnxt_qplib_rcfw_sbuf *bnxt_qplib_rcfw_alloc_sbuf(
199+ struct bnxt_qplib_rcfw *rcfw,
200+ u32 size);
201+void bnxt_qplib_rcfw_free_sbuf(struct bnxt_qplib_rcfw *rcfw,
202+ struct bnxt_qplib_rcfw_sbuf *sbuf);
203+int bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,
204+ struct cmdq_base *req, struct creq_base *resp,
205+ void *sbuf, u8 is_block);
227206
228207 int bnxt_qplib_deinit_rcfw(struct bnxt_qplib_rcfw *rcfw);
229208 int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,
drivers/infiniband/hw/bnxt_re/qplib_res.h+4−0
@@ -48,6 +48,10 @@ extern const struct bnxt_qplib_gid bnxt_qplib_gid_zero; · 47 unmodified lines
4848
4949 #define HWQ_CMP(idx, hwq) ((idx) & ((hwq)->max_elements - 1))
5050
51+#define HWQ_FREE_SLOTS(hwq) (hwq->max_elements - \
52+ ((HWQ_CMP(hwq->prod, hwq)\
53+ - HWQ_CMP(hwq->cons, hwq))\
54+ & (hwq->max_elements - 1)))
5155 enum bnxt_qplib_hwq_type {
5256 HWQ_TYPE_CTX,
5357 HWQ_TYPE_QUEUE,
drivers/infiniband/hw/bnxt_re/qplib_sp.c+83−250
@@ -55,37 +55,30 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, · 54 unmodified lines
5555 struct bnxt_qplib_dev_attr *attr)
5656 {
5757 struct cmdq_query_func req;
58− struct creq_query_func_resp *resp;
58+ struct creq_query_func_resp resp;
59+ struct bnxt_qplib_rcfw_sbuf *sbuf;
5960 struct creq_query_func_resp_sb *sb;
6061 u16 cmd_flags = 0;
6162 u32 temp;
6263 u8 *tqm_alloc;
63− int i;
64+ int i, rc = 0;
6465
6566 RCFW_CMD_PREP(req, QUERY_FUNC, cmd_flags);
6667
67− req.resp_size = sizeof(*sb) / BNXT_QPLIB_CMDQE_UNITS;
68− resp = (struct creq_query_func_resp *)
69− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void **)&sb,
70− 0);
71− if (!resp) {
72− dev_err(&rcfw->pdev->dev, "QPLIB: SP: QUERY_FUNC send failed");
73− return -EINVAL;
74− }
75− if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) {
76− /* Cmd timed out */
77− dev_err(&rcfw->pdev->dev, "QPLIB: SP: QUERY_FUNC timed out");
78− return -ETIMEDOUT;
79− }
80− if (resp->status ||
81− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
82− dev_err(&rcfw->pdev->dev, "QPLIB: SP: QUERY_FUNC failed ");
68+ sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb));
69+ if (!sbuf) {
8370 dev_err(&rcfw->pdev->dev,
84− "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x",
85− resp->status, le16_to_cpu(req.cookie),
86− le16_to_cpu(resp->cookie));
87− return -EINVAL;
71+ "QPLIB: SP: QUERY_FUNC alloc side buffer failed");
72+ return -ENOMEM;
8873 }
74+
75+ sb = sbuf->sb;
76+ req.resp_size = sizeof(*sb) / BNXT_QPLIB_CMDQE_UNITS;
77+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
78+ (void *)sbuf, 0);
79+ if (rc)
80+ goto bail;
81+
8982 /* Extract the context from the side buffer */
9083 attr->max_qp = le32_to_cpu(sb->max_qp);
9184 attr->max_qp_rd_atom =
@@ -95,6 +88,11 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, · 3 unmodified lines
9588 sb->max_qp_init_rd_atom > BNXT_QPLIB_MAX_OUT_RD_ATOM ?
9689 BNXT_QPLIB_MAX_OUT_RD_ATOM : sb->max_qp_init_rd_atom;
9790 attr->max_qp_wqes = le16_to_cpu(sb->max_qp_wr);
91+ /*
92+ * 128 WQEs needs to be reserved for the HW (8916). Prevent
93+ * reporting the max number
94+ */
95+ attr->max_qp_wqes -= BNXT_QPLIB_RESERVED_QP_WRS;
9896 attr->max_qp_sges = sb->max_sge;
9997 attr->max_cq = le32_to_cpu(sb->max_cq);
10098 attr->max_cq_wqes = le32_to_cpu(sb->max_cqe);
@@ -130,7 +128,10 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, · 29 unmodified lines
130128 attr->tqm_alloc_reqs[i * 4 + 2] = *(++tqm_alloc);
131129 attr->tqm_alloc_reqs[i * 4 + 3] = *(++tqm_alloc);
132130 }
133− return 0;
131+
132+bail:
133+ bnxt_qplib_rcfw_free_sbuf(rcfw, sbuf);
134+ return rc;
134135 }
135136
136137 /* SGID */
@@ -178,8 +179,9 @@ int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, · 41 unmodified lines
178179 /* Remove GID from the SGID table */
179180 if (update) {
180181 struct cmdq_delete_gid req;
181− struct creq_delete_gid_resp *resp;
182+ struct creq_delete_gid_resp resp;
182183 u16 cmd_flags = 0;
184+ int rc;
183185
184186 RCFW_CMD_PREP(req, DELETE_GID, cmd_flags);
185187 if (sgid_tbl->hw_id[index] == 0xFFFF) {
@@ -188,31 +190,10 @@ int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, · 2 unmodified lines
188190 return -EINVAL;
189191 }
190192 req.gid_index = cpu_to_le16(sgid_tbl->hw_id[index]);
191− resp = (struct creq_delete_gid_resp *)
192− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, NULL,
193− 0);
194− if (!resp) {
195− dev_err(&res->pdev->dev,
196− "QPLIB: SP: DELETE_GID send failed");
197− return -EINVAL;
198− }
199− if (!bnxt_qplib_rcfw_wait_for_resp(rcfw,
200− le16_to_cpu(req.cookie))) {
201− /* Cmd timed out */
202− dev_err(&res->pdev->dev,
203− "QPLIB: SP: DELETE_GID timed out");
204− return -ETIMEDOUT;
205− }
206− if (resp->status ||
207− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
208− dev_err(&res->pdev->dev,
209− "QPLIB: SP: DELETE_GID failed ");
210− dev_err(&res->pdev->dev,
211− "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x",
212− resp->status, le16_to_cpu(req.cookie),
213− le16_to_cpu(resp->cookie));
214− return -EINVAL;
215− }
193+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
194+ (void *)&resp, NULL, 0);
195+ if (rc)
196+ return rc;
216197 }
217198 memcpy(&sgid_tbl->tbl[index], &bnxt_qplib_gid_zero,
218199 sizeof(bnxt_qplib_gid_zero));
@@ -234,7 +215,7 @@ int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, · 15 unmodified lines
234215 struct bnxt_qplib_res,
235216 sgid_tbl);
236217 struct bnxt_qplib_rcfw *rcfw = res->rcfw;
237− int i, free_idx, rc = 0;
218+ int i, free_idx;
238219
239220 if (!sgid_tbl) {
240221 dev_err(&res->pdev->dev, "QPLIB: SGID table not allocated");
@@ -266,10 +247,11 @@ int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, · 25 unmodified lines
266247 }
267248 if (update) {
268249 struct cmdq_add_gid req;
269− struct creq_add_gid_resp *resp;
250+ struct creq_add_gid_resp resp;
270251 u16 cmd_flags = 0;
271252 u32 temp32[4];
272253 u16 temp16[3];
254+ int rc;
273255
274256 RCFW_CMD_PREP(req, ADD_GID, cmd_flags);
275257
@@ -290,31 +272,11 @@ int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, · 14 unmodified lines
290272 req.src_mac[1] = cpu_to_be16(temp16[1]);
291273 req.src_mac[2] = cpu_to_be16(temp16[2]);
292274
293− resp = (struct creq_add_gid_resp *)
294− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
295− NULL, 0);
296− if (!resp) {
297− dev_err(&res->pdev->dev,
298− "QPLIB: SP: ADD_GID send failed");
299− return -EINVAL;
300− }
301− if (!bnxt_qplib_rcfw_wait_for_resp(rcfw,
302− le16_to_cpu(req.cookie))) {
303− /* Cmd timed out */
304− dev_err(&res->pdev->dev,
305− "QPIB: SP: ADD_GID timed out");
306− return -ETIMEDOUT;
307− }
308− if (resp->status ||
309− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
310− dev_err(&res->pdev->dev, "QPLIB: SP: ADD_GID failed ");
311− dev_err(&res->pdev->dev,
312− "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x",
313− resp->status, le16_to_cpu(req.cookie),
314− le16_to_cpu(resp->cookie));
315− return -EINVAL;
316− }
317− sgid_tbl->hw_id[free_idx] = le32_to_cpu(resp->xid);
275+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
276+ (void *)&resp, NULL, 0);
277+ if (rc)
278+ return rc;
279+ sgid_tbl->hw_id[free_idx] = le32_to_cpu(resp.xid);
318280 }
319281 /* Add GID to the sgid_tbl */
320282 memcpy(&sgid_tbl->tbl[free_idx], gid, sizeof(*gid));
@@ -325,7 +287,7 @@ int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, · 4 unmodified lines
325287
326288 *index = free_idx;
327289 /* unlock */
328− return rc;
290+ return 0;
329291 }
330292
331293 /* pkeys */
@@ -422,10 +384,11 @@ int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah) · 90 unmodified lines
422384 {
423385 struct bnxt_qplib_rcfw *rcfw = res->rcfw;
424386 struct cmdq_create_ah req;
425− struct creq_create_ah_resp *resp;
387+ struct creq_create_ah_resp resp;
426388 u16 cmd_flags = 0;
427389 u32 temp32[4];
428390 u16 temp16[3];
391+ int rc;
429392
430393 RCFW_CMD_PREP(req, CREATE_AH, cmd_flags);
431394
@@ -450,28 +413,12 @@ int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah) · 18 unmodified lines
450413 req.dest_mac[1] = cpu_to_le16(temp16[1]);
451414 req.dest_mac[2] = cpu_to_le16(temp16[2]);
452415
453− resp = (struct creq_create_ah_resp *)
454− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
455− NULL, 1);
456− if (!resp) {
457− dev_err(&rcfw->pdev->dev, "QPLIB: SP: CREATE_AH send failed");
458− return -EINVAL;
459− }
460− if (!bnxt_qplib_rcfw_block_for_resp(rcfw, le16_to_cpu(req.cookie))) {
461− /* Cmd timed out */
462− dev_err(&rcfw->pdev->dev, "QPLIB: SP: CREATE_AH timed out");
463− return -ETIMEDOUT;
464− }
465− if (resp->status ||
466− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
467− dev_err(&rcfw->pdev->dev, "QPLIB: SP: CREATE_AH failed ");
468− dev_err(&rcfw->pdev->dev,
469− "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x",
470− resp->status, le16_to_cpu(req.cookie),
471− le16_to_cpu(resp->cookie));
472− return -EINVAL;
473− }
474− ah->id = le32_to_cpu(resp->xid);
416+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
417+ NULL, 1);
418+ if (rc)
419+ return rc;
420+
421+ ah->id = le32_to_cpu(resp.xid);
475422 return 0;
476423 }
477424
@@ -479,35 +426,19 @@ int bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah) · 1 unmodified line
479426 {
480427 struct bnxt_qplib_rcfw *rcfw = res->rcfw;
481428 struct cmdq_destroy_ah req;
482− struct creq_destroy_ah_resp *resp;
429+ struct creq_destroy_ah_resp resp;
483430 u16 cmd_flags = 0;
431+ int rc;
484432
485433 /* Clean up the AH table in the device */
486434 RCFW_CMD_PREP(req, DESTROY_AH, cmd_flags);
487435
488436 req.ah_cid = cpu_to_le32(ah->id);
489437
490− resp = (struct creq_destroy_ah_resp *)
491− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
492− NULL, 1);
493− if (!resp) {
494− dev_err(&rcfw->pdev->dev, "QPLIB: SP: DESTROY_AH send failed");
495− return -EINVAL;
496− }
497− if (!bnxt_qplib_rcfw_block_for_resp(rcfw, le16_to_cpu(req.cookie))) {
498− /* Cmd timed out */
499− dev_err(&rcfw->pdev->dev, "QPLIB: SP: DESTROY_AH timed out");
500− return -ETIMEDOUT;
501− }
502− if (resp->status ||
503− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
504− dev_err(&rcfw->pdev->dev, "QPLIB: SP: DESTROY_AH failed ");
505− dev_err(&rcfw->pdev->dev,
506− "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x",
507− resp->status, le16_to_cpu(req.cookie),
508− le16_to_cpu(resp->cookie));
509− return -EINVAL;
510− }
438+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
439+ NULL, 1);
440+ if (rc)
441+ return rc;
511442 return 0;
512443 }
513444
@@ -516,8 +447,9 @@ int bnxt_qplib_free_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw) · 2 unmodified lines
516447 {
517448 struct bnxt_qplib_rcfw *rcfw = res->rcfw;
518449 struct cmdq_deallocate_key req;
519− struct creq_deallocate_key_resp *resp;
450+ struct creq_deallocate_key_resp resp;
520451 u16 cmd_flags = 0;
452+ int rc;
521453
522454 if (mrw->lkey == 0xFFFFFFFF) {
523455 dev_info(&res->pdev->dev,
@@ -536,27 +468,11 @@ int bnxt_qplib_free_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw) · 12 unmodified lines
536468 else
537469 req.key = cpu_to_le32(mrw->lkey);
538470
539− resp = (struct creq_deallocate_key_resp *)
540− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
541− NULL, 0);
542− if (!resp) {
543− dev_err(&res->pdev->dev, "QPLIB: SP: FREE_MR send failed");
544− return -EINVAL;
545− }
546− if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) {
547− /* Cmd timed out */
548− dev_err(&res->pdev->dev, "QPLIB: SP: FREE_MR timed out");
549− return -ETIMEDOUT;
550− }
551− if (resp->status ||
552− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
553− dev_err(&res->pdev->dev, "QPLIB: SP: FREE_MR failed ");
554− dev_err(&res->pdev->dev,
555− "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x",
556− resp->status, le16_to_cpu(req.cookie),
557− le16_to_cpu(resp->cookie));
558− return -EINVAL;
559− }
471+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
472+ NULL, 0);
473+ if (rc)
474+ return rc;
475+
560476 /* Free the qplib's MRW memory */
561477 if (mrw->hwq.max_elements)
562478 bnxt_qplib_free_hwq(res->pdev, &mrw->hwq);
@@ -568,9 +484,10 @@ int bnxt_qplib_alloc_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw) · 5 unmodified lines
568484 {
569485 struct bnxt_qplib_rcfw *rcfw = res->rcfw;
570486 struct cmdq_allocate_mrw req;
571− struct creq_allocate_mrw_resp *resp;
487+ struct creq_allocate_mrw_resp resp;
572488 u16 cmd_flags = 0;
573489 unsigned long tmp;
490+ int rc;
574491
575492 RCFW_CMD_PREP(req, ALLOCATE_MRW, cmd_flags);
576493
@@ -584,33 +501,17 @@ int bnxt_qplib_alloc_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw) · 7 unmodified lines
584501 tmp = (unsigned long)mrw;
585502 req.mrw_handle = cpu_to_le64(tmp);
586503
587− resp = (struct creq_allocate_mrw_resp *)
588− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
589− NULL, 0);
590− if (!resp) {
591− dev_err(&rcfw->pdev->dev, "QPLIB: SP: ALLOC_MRW send failed");
592− return -EINVAL;
593− }
594− if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) {
595− /* Cmd timed out */
596− dev_err(&rcfw->pdev->dev, "QPLIB: SP: ALLOC_MRW timed out");
597− return -ETIMEDOUT;
598− }
599− if (resp->status ||
600− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
601− dev_err(&rcfw->pdev->dev, "QPLIB: SP: ALLOC_MRW failed ");
602− dev_err(&rcfw->pdev->dev,
603− "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x",
604− resp->status, le16_to_cpu(req.cookie),
605− le16_to_cpu(resp->cookie));
606− return -EINVAL;
607− }
504+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
505+ (void *)&resp, NULL, 0);
506+ if (rc)
507+ return rc;
508+
608509 if ((mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE1) ||
609510 (mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2A) ||
610511 (mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2B))
611− mrw->rkey = le32_to_cpu(resp->xid);
512+ mrw->rkey = le32_to_cpu(resp.xid);
612513 else
613− mrw->lkey = le32_to_cpu(resp->xid);
514+ mrw->lkey = le32_to_cpu(resp.xid);
614515 return 0;
615516 }
616517
@@ -619,40 +520,17 @@ int bnxt_qplib_dereg_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw, · 2 unmodified lines
619520 {
620521 struct bnxt_qplib_rcfw *rcfw = res->rcfw;
621522 struct cmdq_deregister_mr req;
622− struct creq_deregister_mr_resp *resp;
523+ struct creq_deregister_mr_resp resp;
623524 u16 cmd_flags = 0;
624525 int rc;
625526
626527 RCFW_CMD_PREP(req, DEREGISTER_MR, cmd_flags);
627528
628529 req.lkey = cpu_to_le32(mrw->lkey);
629− resp = (struct creq_deregister_mr_resp *)
630− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
631− NULL, block);
632− if (!resp) {
633− dev_err(&rcfw->pdev->dev, "QPLIB: SP: DEREG_MR send failed");
634− return -EINVAL;
635− }
636− if (block)
637− rc = bnxt_qplib_rcfw_block_for_resp(rcfw,
638− le16_to_cpu(req.cookie));
639− else
640− rc = bnxt_qplib_rcfw_wait_for_resp(rcfw,
641− le16_to_cpu(req.cookie));
642− if (!rc) {
643− /* Cmd timed out */
644− dev_err(&res->pdev->dev, "QPLIB: SP: DEREG_MR timed out");
645− return -ETIMEDOUT;
646− }
647− if (resp->status ||
648− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
649− dev_err(&rcfw->pdev->dev, "QPLIB: SP: DEREG_MR failed ");
650− dev_err(&rcfw->pdev->dev,
651− "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x",
652− resp->status, le16_to_cpu(req.cookie),
653− le16_to_cpu(resp->cookie));
654− return -EINVAL;
655− }
530+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
531+ (void *)&resp, NULL, block);
532+ if (rc)
533+ return rc;
656534
657535 /* Free the qplib's MR memory */
658536 if (mrw->hwq.max_elements) {
@@ -669,7 +547,7 @@ int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr, · 10 unmodified lines
669547 {
670548 struct bnxt_qplib_rcfw *rcfw = res->rcfw;
671549 struct cmdq_register_mr req;
672− struct creq_register_mr_resp *resp;
550+ struct creq_register_mr_resp resp;
673551 u16 cmd_flags = 0, level;
674552 int pg_ptrs, pages, i, rc;
675553 dma_addr_t **pbl_ptr;
@@ -730,36 +608,11 @@ int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr, · 54 unmodified lines
730608 req.key = cpu_to_le32(mr->lkey);
731609 req.mr_size = cpu_to_le64(mr->total_size);
732610
733− resp = (struct creq_register_mr_resp *)
734− bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
735− NULL, block);
736− if (!resp) {
737− dev_err(&res->pdev->dev, "SP: REG_MR send failed");
738− rc = -EINVAL;
739− goto fail;
740− }
741− if (block)
742− rc = bnxt_qplib_rcfw_block_for_resp(rcfw,
743− le16_to_cpu(req.cookie));
744− else
745− rc = bnxt_qplib_rcfw_wait_for_resp(rcfw,
746− le16_to_cpu(req.cookie));
747− if (!rc) {
748− /* Cmd timed out */
749− dev_err(&res->pdev->dev, "SP: REG_MR timed out");
750− rc = -ETIMEDOUT;
751− goto fail;
752− }
753− if (resp->status ||
754− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
755− dev_err(&res->pdev->dev, "QPLIB: SP: REG_MR failed ");
756− dev_err(&res->pdev->dev,
757− "QPLIB: SP: with status 0x%x cmdq 0x%x resp 0x%x",
758− resp->status, le16_to_cpu(req.cookie),
759− le16_to_cpu(resp->cookie));
760− rc = -EINVAL;
611+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
612+ (void *)&resp, NULL, block);
613+ if (rc)
761614 goto fail;
762− }
615+
763616 return 0;
764617
765618 fail:
@@ -804,35 +657,15 @@ int bnxt_qplib_map_tc2cos(struct bnxt_qplib_res *res, u16 *cids) · 38 unmodified lines
804657 {
805658 struct bnxt_qplib_rcfw *rcfw = res->rcfw;
806659 struct cmdq_map_tc_to_cos req;
807− struct creq_map_tc_to_cos_resp *resp;
660+ struct creq_map_tc_to_cos_resp resp;
808661 u16 cmd_flags = 0;
809− int tleft;
662+ int rc = 0;
810663
811664 RCFW_CMD_PREP(req, MAP_TC_TO_COS, cmd_flags);
812665 req.cos0 = cpu_to_le16(cids[0]);
813666 req.cos1 = cpu_to_le16(cids[1]);
814667
815− resp = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, NULL, 0);
816− if (!resp) {
817− dev_err(&res->pdev->dev, "QPLIB: SP: MAP_TC2COS send failed");
818− return -EINVAL;
819− }
820−
821− tleft = bnxt_qplib_rcfw_block_for_resp(rcfw, le16_to_cpu(req.cookie));
822− if (!tleft) {
823− dev_err(&res->pdev->dev, "QPLIB: SP: MAP_TC2COS timed out");
824− return -ETIMEDOUT;
825− }
826−
827− if (resp->status ||
828− le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) {
829− dev_err(&res->pdev->dev, "QPLIB: SP: MAP_TC2COS failed ");
830− dev_err(&res->pdev->dev,
831− "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x",
832− resp->status, le16_to_cpu(req.cookie),
833− le16_to_cpu(resp->cookie));
834− return -EINVAL;
835− }
836−
668+ rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
669+ (void *)&resp, NULL, 0);
837670 return 0;
838671 }
drivers/infiniband/hw/bnxt_re/qplib_sp.h+2−0
@@ -40,6 +40,8 @@ · 39 unmodified lines
4040 #ifndef __BNXT_QPLIB_SP_H__
4141 #define __BNXT_QPLIB_SP_H__
4242
43+#define BNXT_QPLIB_RESERVED_QP_WRS 128
44+
4345 struct bnxt_qplib_dev_attr {
4446 char fw_ver[32];
4547 u16 max_sgid;
drivers/infiniband/hw/cxgb4/device.c+7−3
@@ -767,7 +767,7 @@ void c4iw_release_dev_ucontext(struct c4iw_rdev *rdev, · 766 unmodified lines
767767 kfree(entry);
768768 }
769769
770− list_for_each_safe(pos, nxt, &uctx->qpids) {
770+ list_for_each_safe(pos, nxt, &uctx->cqids) {
771771 entry = list_entry(pos, struct c4iw_qid_list, entry);
772772 list_del_init(&entry->entry);
773773 kfree(entry);
@@ -880,13 +880,15 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev) · 106 unmodified lines
880880 rdev->free_workq = create_singlethread_workqueue("iw_cxgb4_free");
881881 if (!rdev->free_workq) {
882882 err = -ENOMEM;
883− goto err_free_status_page;
883+ goto err_free_status_page_and_wr_log;
884884 }
885885
886886 rdev->status_page->db_off = 0;
887887
888888 return 0;
889−err_free_status_page:
889+err_free_status_page_and_wr_log:
890+ if (c4iw_wr_log && rdev->wr_log)
891+ kfree(rdev->wr_log);
890892 free_page((unsigned long)rdev->status_page);
891893 destroy_ocqp_pool:
892894 c4iw_ocqp_pool_destroy(rdev);
@@ -903,9 +905,11 @@ static void c4iw_rdev_close(struct c4iw_rdev *rdev) · 10 unmodified lines
903905 {
904906 destroy_workqueue(rdev->free_workq);
905907 kfree(rdev->wr_log);
908+ c4iw_release_dev_ucontext(rdev, &rdev->uctx);
906909 free_page((unsigned long)rdev->status_page);
907910 c4iw_pblpool_destroy(rdev);
908911 c4iw_rqtpool_destroy(rdev);
912+ c4iw_ocqp_pool_destroy(rdev);
909913 c4iw_destroy_resource(&rdev->resource);
910914 }
911915
drivers/infiniband/hw/mlx5/main.c+4−2
@@ -3692,8 +3692,10 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) · 3691 unmodified lines
36923692 dev->ib_dev.check_mr_status = mlx5_ib_check_mr_status;
36933693 dev->ib_dev.get_port_immutable = mlx5_port_immutable;
36943694 dev->ib_dev.get_dev_fw_str = get_dev_fw_str;
3695− dev->ib_dev.alloc_rdma_netdev = mlx5_ib_alloc_rdma_netdev;
3696− dev->ib_dev.free_rdma_netdev = mlx5_ib_free_rdma_netdev;
3695+ if (MLX5_CAP_GEN(mdev, ipoib_enhanced_offloads)) {
3696+ dev->ib_dev.alloc_rdma_netdev = mlx5_ib_alloc_rdma_netdev;
3697+ dev->ib_dev.free_rdma_netdev = mlx5_ib_free_rdma_netdev;
3698+ }
36973699 if (mlx5_core_is_pf(mdev)) {
36983700 dev->ib_dev.get_vf_config = mlx5_ib_get_vf_config;
36993701 dev->ib_dev.set_vf_link_state = mlx5_ib_set_vf_link_state;
drivers/infiniband/hw/qedr/qedr.h+4−1
@@ -58,7 +58,10 @@ · 57 unmodified lines
5858 #define QEDR_MSG_QP " QP"
5959 #define QEDR_MSG_GSI " GSI"
6060
61−#define QEDR_CQ_MAGIC_NUMBER (0x11223344)
61+#define QEDR_CQ_MAGIC_NUMBER (0x11223344)
62+
63+#define FW_PAGE_SIZE (RDMA_RING_PAGE_SIZE)
64+#define FW_PAGE_SHIFT (12)
6265
6366 struct qedr_dev;
6467
drivers/infiniband/hw/qedr/verbs.c+41−27
@@ -653,14 +653,15 @@ static int qedr_prepare_pbl_tbl(struct qedr_dev *dev, · 652 unmodified lines
653653
654654 static void qedr_populate_pbls(struct qedr_dev *dev, struct ib_umem *umem,
655655 struct qedr_pbl *pbl,
656− struct qedr_pbl_info *pbl_info)
656+ struct qedr_pbl_info *pbl_info, u32 pg_shift)
657657 {
658658 int shift, pg_cnt, pages, pbe_cnt, total_num_pbes = 0;
659+ u32 fw_pg_cnt, fw_pg_per_umem_pg;
659660 struct qedr_pbl *pbl_tbl;
660661 struct scatterlist *sg;
661662 struct regpair *pbe;
663+ u64 pg_addr;
662664 int entry;
663− u32 addr;
664665
665666 if (!pbl_info->num_pbes)
666667 return;
@@ -683,29 +684,35 @@ static void qedr_populate_pbls(struct qedr_dev *dev, struct ib_umem *umem, · 16 unmodified lines
683684
684685 shift = umem->page_shift;
685686
687+ fw_pg_per_umem_pg = BIT(umem->page_shift - pg_shift);
688+
686689 for_each_sg(umem->sg_head.sgl, sg, umem->nmap, entry) {
687690 pages = sg_dma_len(sg) >> shift;
691+ pg_addr = sg_dma_address(sg);
688692 for (pg_cnt = 0; pg_cnt < pages; pg_cnt++) {
689− /* store the page address in pbe */
690− pbe->lo = cpu_to_le32(sg_dma_address(sg) +
691− (pg_cnt << shift));
692− addr = upper_32_bits(sg_dma_address(sg) +
693− (pg_cnt << shift));
694− pbe->hi = cpu_to_le32(addr);
695− pbe_cnt++;
696− total_num_pbes++;
697− pbe++;
698−
699− if (total_num_pbes == pbl_info->num_pbes)
700− return;
701−
702− /* If the given pbl is full storing the pbes,
703− * move to next pbl.
704− */
705− if (pbe_cnt == (pbl_info->pbl_size / sizeof(u64))) {
706− pbl_tbl++;
707− pbe = (struct regpair *)pbl_tbl->va;
708− pbe_cnt = 0;
693+ for (fw_pg_cnt = 0; fw_pg_cnt < fw_pg_per_umem_pg;) {
694+ pbe->lo = cpu_to_le32(pg_addr);
695+ pbe->hi = cpu_to_le32(upper_32_bits(pg_addr));
696+
697+ pg_addr += BIT(pg_shift);
698+ pbe_cnt++;
699+ total_num_pbes++;
700+ pbe++;
701+
702+ if (total_num_pbes == pbl_info->num_pbes)
703+ return;
704+
705+ /* If the given pbl is full storing the pbes,
706+ * move to next pbl.
707+ */
708+ if (pbe_cnt ==
709+ (pbl_info->pbl_size / sizeof(u64))) {
710+ pbl_tbl++;
711+ pbe = (struct regpair *)pbl_tbl->va;
712+ pbe_cnt = 0;
713+ }
714+
715+ fw_pg_cnt++;
709716 }
710717 }
711718 }
@@ -754,7 +761,7 @@ static inline int qedr_init_user_queue(struct ib_ucontext *ib_ctx, · 42 unmodified lines
754761 u64 buf_addr, size_t buf_len,
755762 int access, int dmasync)
756763 {
757− int page_cnt;
764+ u32 fw_pages;
758765 int rc;
759766
760767 q->buf_addr = buf_addr;
@@ -766,8 +773,10 @@ static inline int qedr_init_user_queue(struct ib_ucontext *ib_ctx, · 5 unmodified lines
766773 return PTR_ERR(q->umem);
767774 }
768775
769− page_cnt = ib_umem_page_count(q->umem);
770− rc = qedr_prepare_pbl_tbl(dev, &q->pbl_info, page_cnt, 0);
776+ fw_pages = ib_umem_page_count(q->umem) <<
777+ (q->umem->page_shift - FW_PAGE_SHIFT);
778+
779+ rc = qedr_prepare_pbl_tbl(dev, &q->pbl_info, fw_pages, 0);
771780 if (rc)
772781 goto err0;
773782
@@ -777,7 +786,8 @@ static inline int qedr_init_user_queue(struct ib_ucontext *ib_ctx, · 3 unmodified lines
777786 goto err0;
778787 }
779788
780− qedr_populate_pbls(dev, q->umem, q->pbl_tbl, &q->pbl_info);
789+ qedr_populate_pbls(dev, q->umem, q->pbl_tbl, &q->pbl_info,
790+ FW_PAGE_SHIFT);
781791
782792 return 0;
783793
@@ -2226,7 +2236,7 @@ struct ib_mr *qedr_reg_user_mr(struct ib_pd *ibpd, u64 start, u64 len, · 1442 unmodified lines
22262236 goto err1;
22272237
22282238 qedr_populate_pbls(dev, mr->umem, mr->info.pbl_table,
2229− &mr->info.pbl_info);
2239+ &mr->info.pbl_info, mr->umem->page_shift);
22302240
22312241 rc = dev->ops->rdma_alloc_tid(dev->rdma_ctx, &mr->hw_mr.itid);
22322242 if (rc) {
@@ -3209,6 +3219,10 @@ static int process_req(struct qedr_dev *dev, struct qedr_qp *qp, · 976 unmodified lines
32093219 case IB_WC_REG_MR:
32103220 qp->wqe_wr_id[qp->sq.cons].mr->info.completed++;
32113221 break;
3222+ case IB_WC_RDMA_READ:
3223+ case IB_WC_SEND:
3224+ wc->byte_len = qp->wqe_wr_id[qp->sq.cons].bytes_len;
3225+ break;
32123226 default:
32133227 break;
32143228 }
drivers/infiniband/sw/rxe/rxe.h+4−1
@@ -68,6 +68,7 @@ · 67 unmodified lines
6868 static inline u32 rxe_crc32(struct rxe_dev *rxe,
6969 u32 crc, void *next, size_t len)
7070 {
71+ u32 retval;
7172 int err;
7273
7374 SHASH_DESC_ON_STACK(shash, rxe->tfm);
@@ -81,7 +82,9 @@ static inline u32 rxe_crc32(struct rxe_dev *rxe, · 7 unmodified lines
8182 return crc32_le(crc, next, len);
8283 }
8384
84− return *(u32 *)shash_desc_ctx(shash);
85+ retval = *(u32 *)shash_desc_ctx(shash);
86+ barrier_data(shash_desc_ctx(shash));
87+ return retval;
8588 }
8689
8790 int rxe_set_mtu(struct rxe_dev *rxe, unsigned int dev_mtu);
drivers/infiniband/sw/rxe/rxe_verbs.c+2−7
@@ -740,13 +740,8 @@ static int init_send_wqe(struct rxe_qp *qp, struct ib_send_wr *ibwr, · 739 unmodified lines
740740
741741 sge = ibwr->sg_list;
742742 for (i = 0; i < num_sge; i++, sge++) {
743− if (qp->is_user && copy_from_user(p, (__user void *)
744− (uintptr_t)sge->addr, sge->length))
745− return -EFAULT;
746−
747− else if (!qp->is_user)
748− memcpy(p, (void *)(uintptr_t)sge->addr,
749− sge->length);
743+ memcpy(p, (void *)(uintptr_t)sge->addr,
744+ sge->length);
750745
751746 p += sge->length;
752747 }
drivers/infiniband/ulp/ipoib/ipoib_ib.c+0−1
@@ -863,7 +863,6 @@ dev_stop: · 862 unmodified lines
863863 set_bit(IPOIB_STOP_REAPER, &priv->flags);
864864 cancel_delayed_work(&priv->ah_reap_task);
865865 set_bit(IPOIB_FLAG_INITIALIZED, &priv->flags);
866− napi_enable(&priv->napi);
867866 ipoib_ib_dev_stop(dev);
868867 return -1;
869868 }
drivers/infiniband/ulp/ipoib/ipoib_main.c+13−2
@@ -1596,6 +1596,8 @@ static void ipoib_dev_uninit_default(struct net_device *dev) · 1595 unmodified lines
15961596
15971597 ipoib_transport_dev_cleanup(dev);
15981598
1599+ netif_napi_del(&priv->napi);
1600+
15991601 ipoib_cm_dev_cleanup(dev);
16001602
16011603 kfree(priv->rx_ring);
@@ -1649,6 +1651,7 @@ out_rx_ring_cleanup: · 47 unmodified lines
16491651 kfree(priv->rx_ring);
16501652
16511653 out:
1654+ netif_napi_del(&priv->napi);
16521655 return -ENOMEM;
16531656 }
16541657
@@ -2237,6 +2240,7 @@ event_failed: · 582 unmodified lines
22372240
22382241 device_init_failed:
22392242 free_netdev(priv->dev);
2243+ kfree(priv);
22402244
22412245 alloc_mem_failed:
22422246 return ERR_PTR(result);
@@ -2277,7 +2281,7 @@ static void ipoib_add_one(struct ib_device *device) · 34 unmodified lines
22772281
22782282 static void ipoib_remove_one(struct ib_device *device, void *client_data)
22792283 {
2280− struct ipoib_dev_priv *priv, *tmp;
2284+ struct ipoib_dev_priv *priv, *tmp, *cpriv, *tcpriv;
22812285 struct list_head *dev_list = client_data;
22822286
22832287 if (!dev_list)
@@ -2300,7 +2304,14 @@ static void ipoib_remove_one(struct ib_device *device, void *client_data) · 16 unmodified lines
23002304 flush_workqueue(priv->wq);
23012305
23022306 unregister_netdev(priv->dev);
2303− free_netdev(priv->dev);
2307+ if (device->free_rdma_netdev)
2308+ device->free_rdma_netdev(priv->dev);
2309+ else
2310+ free_netdev(priv->dev);
2311+
2312+ list_for_each_entry_safe(cpriv, tcpriv, &priv->child_intfs, list)
2313+ kfree(cpriv);
2314+
23042315 kfree(priv);
23052316 }
23062317
drivers/infiniband/ulp/ipoib/ipoib_vlan.c+7−4
@@ -133,13 +133,13 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) · 132 unmodified lines
133133 snprintf(intf_name, sizeof intf_name, "%s.%04x",
134134 ppriv->dev->name, pkey);
135135
136+ if (!rtnl_trylock())
137+ return restart_syscall();
138+
136139 priv = ipoib_intf_alloc(ppriv->ca, ppriv->port, intf_name);
137140 if (!priv)
138141 return -ENOMEM;
139142
140− if (!rtnl_trylock())
141− return restart_syscall();
142−
143143 down_write(&ppriv->vlan_rwsem);
144144
145145 /*
@@ -167,8 +167,10 @@ out: · 21 unmodified lines
167167
168168 rtnl_unlock();
169169
170− if (result)
170+ if (result) {
171171 free_netdev(priv->dev);
172+ kfree(priv);
173+ }
172174
173175 return result;
174176 }
@@ -209,6 +211,7 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey) · 34 unmodified lines
209211
210212 if (dev) {
211213 free_netdev(dev);
214+ kfree(priv);
212215 return 0;
213216 }
214217
drivers/input/misc/soc_button_array.c+14−6
@@ -248,7 +248,8 @@ static struct soc_button_info *soc_button_get_button_info(struct device *dev) · 247 unmodified lines
248248
249249 if (!btns_desc) {
250250 dev_err(dev, "ACPI Button Descriptors not found\n");
251− return ERR_PTR(-ENODEV);
251+ button_info = ERR_PTR(-ENODEV);
252+ goto out;
252253 }
253254
254255 /* The first package describes the collection */
@@ -264,24 +265,31 @@ static struct soc_button_info *soc_button_get_button_info(struct device *dev) · 9 unmodified lines
264265 }
265266 if (collection_uid == -1) {
266267 dev_err(dev, "Invalid Button Collection Descriptor\n");
267− return ERR_PTR(-ENODEV);
268+ button_info = ERR_PTR(-ENODEV);
269+ goto out;
268270 }
269271
270272 /* There are package.count - 1 buttons + 1 terminating empty entry */
271273 button_info = devm_kcalloc(dev, btns_desc->package.count,
272274 sizeof(*button_info), GFP_KERNEL);
273− if (!button_info)
274− return ERR_PTR(-ENOMEM);
275+ if (!button_info) {
276+ button_info = ERR_PTR(-ENOMEM);
277+ goto out;
278+ }
275279
276280 /* Parse the button descriptors */
277281 for (i = 1, btn = 0; i < btns_desc->package.count; i++, btn++) {
278282 if (soc_button_parse_btn_desc(dev,
279283 &btns_desc->package.elements[i],
280284 collection_uid,
281− &button_info[btn]))
282− return ERR_PTR(-ENODEV);
285+ &button_info[btn])) {
286+ button_info = ERR_PTR(-ENODEV);
287+ goto out;
288+ }
283289 }
284290
291+out:
292+ kfree(buf.pointer);
285293 return button_info;
286294 }
287295
drivers/input/rmi4/rmi_f54.c+7−10
@@ -31,9 +31,6 @@ · 30 unmodified lines
3131 #define F54_GET_REPORT 1
3232 #define F54_FORCE_CAL 2
3333
34−/* Fixed sizes of reports */
35−#define F54_QUERY_LEN 27
36−
3734 /* F54 capabilities */
3835 #define F54_CAP_BASELINE (1 << 2)
3936 #define F54_CAP_IMAGE8 (1 << 3)
@@ -95,7 +92,6 @@ struct rmi_f54_reports { · 55 unmodified lines
9592 struct f54_data {
9693 struct rmi_function *fn;
9794
98− u8 qry[F54_QUERY_LEN];
9995 u8 num_rx_electrodes;
10096 u8 num_tx_electrodes;
10197 u8 capabilities;
@@ -632,22 +628,23 @@ static int rmi_f54_detect(struct rmi_function *fn) · 530 unmodified lines
632628 {
633629 int error;
634630 struct f54_data *f54;
631+ u8 buf[6];
635632
636633 f54 = dev_get_drvdata(&fn->dev);
637634
638635 error = rmi_read_block(fn->rmi_dev, fn->fd.query_base_addr,
639− &f54->qry, sizeof(f54->qry));
636+ buf, sizeof(buf));
640637 if (error) {
641638 dev_err(&fn->dev, "%s: Failed to query F54 properties\n",
642639 __func__);
643640 return error;
644641 }
645642
646− f54->num_rx_electrodes = f54->qry[0];
647− f54->num_tx_electrodes = f54->qry[1];
648− f54->capabilities = f54->qry[2];
649− f54->clock_rate = f54->qry[3] | (f54->qry[4] << 8);
650− f54->family = f54->qry[5];
643+ f54->num_rx_electrodes = buf[0];
644+ f54->num_tx_electrodes = buf[1];
645+ f54->capabilities = buf[2];
646+ f54->clock_rate = buf[3] | (buf[4] << 8);
647+ f54->family = buf[5];
651648
652649 rmi_dbg(RMI_DEBUG_FN, &fn->dev, "F54 num_rx_electrodes: %d\n",
653650 f54->num_rx_electrodes);
drivers/input/serio/i8042-x86ia64io.h+7−0
@@ -723,6 +723,13 @@ static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = { · 722 unmodified lines
723723 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U574"),
724724 },
725725 },
726+ {
727+ /* Fujitsu UH554 laptop */
728+ .matches = {
729+ DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
730+ DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK UH544"),
731+ },
732+ },
726733 { }
727734 };
728735
drivers/irqchip/irq-mips-gic.c+3−3
@@ -140,7 +140,7 @@ static inline void gic_map_to_vpe(unsigned int intr, unsigned int vpe) · 139 unmodified lines
140140 }
141141
142142 #ifdef CONFIG_CLKSRC_MIPS_GIC
143−u64 gic_read_count(void)
143+u64 notrace gic_read_count(void)
144144 {
145145 unsigned int hi, hi2, lo;
146146
@@ -167,7 +167,7 @@ unsigned int gic_get_count_width(void) · 20 unmodified lines
167167 return bits;
168168 }
169169
170−void gic_write_compare(u64 cnt)
170+void notrace gic_write_compare(u64 cnt)
171171 {
172172 if (mips_cm_is64) {
173173 gic_write(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE), cnt);
@@ -179,7 +179,7 @@ void gic_write_compare(u64 cnt) · 5 unmodified lines
179179 }
180180 }
181181
182−void gic_write_cpu_compare(u64 cnt, int cpu)
182+void notrace gic_write_cpu_compare(u64 cnt, int cpu)
183183 {
184184 unsigned long flags;
185185
drivers/irqchip/irq-xtensa-mx.c+1−1
@@ -142,7 +142,7 @@ static struct irq_chip xtensa_mx_irq_chip = { · 141 unmodified lines
142142 int __init xtensa_mx_init_legacy(struct device_node *interrupt_parent)
143143 {
144144 struct irq_domain *root_domain =
145− irq_domain_add_legacy(NULL, NR_IRQS, 0, 0,
145+ irq_domain_add_legacy(NULL, NR_IRQS - 1, 1, 0,
146146 &xtensa_mx_irq_domain_ops,
147147 &xtensa_mx_irq_chip);
148148 irq_set_default_host(root_domain);
drivers/irqchip/irq-xtensa-pic.c+1−1
@@ -89,7 +89,7 @@ static struct irq_chip xtensa_irq_chip = { · 88 unmodified lines
8989 int __init xtensa_pic_init_legacy(struct device_node *interrupt_parent)
9090 {
9191 struct irq_domain *root_domain =
92− irq_domain_add_legacy(NULL, NR_IRQS, 0, 0,
92+ irq_domain_add_legacy(NULL, NR_IRQS - 1, 1, 0,
9393 &xtensa_irq_domain_ops, &xtensa_irq_chip);
9494 irq_set_default_host(root_domain);
9595 return 0;
drivers/leds/leds-bcm6328.c+2−2
@@ -242,7 +242,7 @@ static int bcm6328_hwled(struct device *dev, struct device_node *nc, u32 reg, · 241 unmodified lines
242242
243243 spin_lock_irqsave(lock, flags);
244244 val = bcm6328_led_read(addr);
245− val |= (BIT(reg) << (((sel % 4) * 4) + 16));
245+ val |= (BIT(reg % 4) << (((sel % 4) * 4) + 16));
246246 bcm6328_led_write(addr, val);
247247 spin_unlock_irqrestore(lock, flags);
248248 }
@@ -269,7 +269,7 @@ static int bcm6328_hwled(struct device *dev, struct device_node *nc, u32 reg, · 20 unmodified lines
269269
270270 spin_lock_irqsave(lock, flags);
271271 val = bcm6328_led_read(addr);
272− val |= (BIT(reg) << ((sel % 4) * 4));
272+ val |= (BIT(reg % 4) << ((sel % 4) * 4));
273273 bcm6328_led_write(addr, val);
274274 spin_unlock_irqrestore(lock, flags);
275275 }
drivers/leds/trigger/ledtrig-heartbeat.c+0−31
@@ -20,7 +20,6 @@ · 19 unmodified lines
2020 #include <linux/sched/loadavg.h>
2121 #include <linux/leds.h>
2222 #include <linux/reboot.h>
23−#include <linux/suspend.h>
2423 #include "../leds.h"
2524
2625 static int panic_heartbeats;
@@ -163,30 +162,6 @@ static struct led_trigger heartbeat_led_trigger = { · 136 unmodified lines
163162 .deactivate = heartbeat_trig_deactivate,
164163 };
165164
166−static int heartbeat_pm_notifier(struct notifier_block *nb,
167− unsigned long pm_event, void *unused)
168−{
169− int rc;
170−
171− switch (pm_event) {
172− case PM_SUSPEND_PREPARE:
173− case PM_HIBERNATION_PREPARE:
174− case PM_RESTORE_PREPARE:
175− led_trigger_unregister(&heartbeat_led_trigger);
176− break;
177− case PM_POST_SUSPEND:
178− case PM_POST_HIBERNATION:
179− case PM_POST_RESTORE:
180− rc = led_trigger_register(&heartbeat_led_trigger);
181− if (rc)
182− pr_err("could not re-register heartbeat trigger\n");
183− break;
184− default:
185− break;
186− }
187− return NOTIFY_DONE;
188−}
189−
190165 static int heartbeat_reboot_notifier(struct notifier_block *nb,
191166 unsigned long code, void *unused)
192167 {
@@ -201,10 +176,6 @@ static int heartbeat_panic_notifier(struct notifier_block *nb, · 8 unmodified lines
201176 return NOTIFY_DONE;
202177 }
203178
204−static struct notifier_block heartbeat_pm_nb = {
205− .notifier_call = heartbeat_pm_notifier,
206−};
207−
208179 static struct notifier_block heartbeat_reboot_nb = {
209180 .notifier_call = heartbeat_reboot_notifier,
210181 };
@@ -221,14 +192,12 @@ static int __init heartbeat_trig_init(void) · 10 unmodified lines
221192 atomic_notifier_chain_register(&panic_notifier_list,
222193 &heartbeat_panic_nb);
223194 register_reboot_notifier(&heartbeat_reboot_nb);
224− register_pm_notifier(&heartbeat_pm_nb);
225195 }
226196 return rc;
227197 }
228198
229199 static void __exit heartbeat_trig_exit(void)
230200 {
231− unregister_pm_notifier(&heartbeat_pm_nb);
232201 unregister_reboot_notifier(&heartbeat_reboot_nb);
233202 atomic_notifier_chain_unregister(&panic_notifier_list,
234203 &heartbeat_panic_nb);
drivers/md/dm-integrity.c+10−2
@@ -1105,10 +1105,13 @@ static void schedule_autocommit(struct dm_integrity_c *ic) · 1104 unmodified lines
11051105 static void submit_flush_bio(struct dm_integrity_c *ic, struct dm_integrity_io *dio)
11061106 {
11071107 struct bio *bio;
1108− spin_lock_irq(&ic->endio_wait.lock);
1108+ unsigned long flags;
1109+
1110+ spin_lock_irqsave(&ic->endio_wait.lock, flags);
11091111 bio = dm_bio_from_per_bio_data(dio, sizeof(struct dm_integrity_io));
11101112 bio_list_add(&ic->flush_bio_list, bio);
1111− spin_unlock_irq(&ic->endio_wait.lock);
1113+ spin_unlock_irqrestore(&ic->endio_wait.lock, flags);
1114+
11121115 queue_work(ic->commit_wq, &ic->commit_work);
11131116 }
11141117
@@ -3040,6 +3043,11 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv) · 1925 unmodified lines
30403043 ti->error = "The device is too small";
30413044 goto bad;
30423045 }
3046+ if (ti->len > ic->provided_data_sectors) {
3047+ r = -EINVAL;
3048+ ti->error = "Not enough provided sectors for requested mapping size";
3049+ goto bad;
3050+ }
30433051
30443052 if (!buffer_sectors)
30453053 buffer_sectors = 1;
drivers/md/dm-io.c+2−2
@@ -317,8 +317,8 @@ static void do_region(int op, int op_flags, unsigned region, · 316 unmodified lines
317317 else if (op == REQ_OP_WRITE_SAME)
318318 special_cmd_max_sectors = q->limits.max_write_same_sectors;
319319 if ((op == REQ_OP_DISCARD || op == REQ_OP_WRITE_ZEROES ||
320− op == REQ_OP_WRITE_SAME) &&
321− special_cmd_max_sectors == 0) {
320+ op == REQ_OP_WRITE_SAME) && special_cmd_max_sectors == 0) {
321+ atomic_inc(&io->count);
322322 dec_count(io, region, -EOPNOTSUPP);
323323 return;
324324 }
drivers/md/dm-raid1.c+19−2
@@ -145,6 +145,7 @@ static void dispatch_bios(void *context, struct bio_list *bio_list) · 144 unmodified lines
145145
146146 struct dm_raid1_bio_record {
147147 struct mirror *m;
148+ /* if details->bi_bdev == NULL, details were not saved */
148149 struct dm_bio_details details;
149150 region_t write_region;
150151 };
@@ -1198,6 +1199,8 @@ static int mirror_map(struct dm_target *ti, struct bio *bio) · 1047 unmodified lines
11981199 struct dm_raid1_bio_record *bio_record =
11991200 dm_per_bio_data(bio, sizeof(struct dm_raid1_bio_record));
12001201
1202+ bio_record->details.bi_bdev = NULL;
1203+
12011204 if (rw == WRITE) {
12021205 /* Save region for mirror_end_io() handler */
12031206 bio_record->write_region = dm_rh_bio_to_region(ms->rh, bio);
@@ -1256,12 +1259,22 @@ static int mirror_end_io(struct dm_target *ti, struct bio *bio, int error) · 52 unmodified lines
12561259 }
12571260
12581261 if (error == -EOPNOTSUPP)
1259− return error;
1262+ goto out;
12601263
12611264 if ((error == -EWOULDBLOCK) && (bio->bi_opf & REQ_RAHEAD))
1262− return error;
1265+ goto out;
12631266
12641267 if (unlikely(error)) {
1268+ if (!bio_record->details.bi_bdev) {
1269+ /*
1270+ * There wasn't enough memory to record necessary
1271+ * information for a retry or there was no other
1272+ * mirror in-sync.
1273+ */
1274+ DMERR_LIMIT("Mirror read failed.");
1275+ return -EIO;
1276+ }
1277+
12651278 m = bio_record->m;
12661279
12671280 DMERR("Mirror read failed from %s. Trying alternative device.",
@@ -1277,6 +1290,7 @@ static int mirror_end_io(struct dm_target *ti, struct bio *bio, int error) · 9 unmodified lines
12771290 bd = &bio_record->details;
12781291
12791292 dm_bio_restore(bd, bio);
1293+ bio_record->details.bi_bdev = NULL;
12801294 bio->bi_error = 0;
12811295
12821296 queue_bio(ms, bio, rw);
@@ -1285,6 +1299,9 @@ static int mirror_end_io(struct dm_target *ti, struct bio *bio, int error) · 2 unmodified lines
12851299 DMERR("All replicated volumes dead, failing I/O");
12861300 }
12871301
1302+out:
1303+ bio_record->details.bi_bdev = NULL;
1304+
12881305 return error;
12891306 }
12901307
drivers/media/cec/Kconfig+1−0
@@ -1,5 +1,6 @@
11 config MEDIA_CEC_RC
22 bool "HDMI CEC RC integration"
33 depends on CEC_CORE && RC_CORE
4+ depends on CEC_CORE=m || RC_CORE=y
45 ---help---
56 Pass on CEC remote control messages to the RC framework.
drivers/media/cec/cec-api.c+1−7
@@ -271,16 +271,10 @@ static long cec_receive(struct cec_adapter *adap, struct cec_fh *fh, · 270 unmodified lines
271271 bool block, struct cec_msg __user *parg)
272272 {
273273 struct cec_msg msg = {};
274− long err = 0;
274+ long err;
275275
276276 if (copy_from_user(&msg, parg, sizeof(msg)))
277277 return -EFAULT;
278− mutex_lock(&adap->lock);
279− if (!adap->is_configured && fh->mode_follower < CEC_MODE_MONITOR)
280− err = -ENONET;
281− mutex_unlock(&adap->lock);
282− if (err)
283− return err;
284278
285279 err = cec_receive_msg(fh, &msg, block);
286280 if (err)
drivers/media/i2c/tc358743.c+1−1
@@ -223,7 +223,7 @@ static void i2c_wr8(struct v4l2_subdev *sd, u16 reg, u8 val) · 222 unmodified lines
223223 static void i2c_wr8_and_or(struct v4l2_subdev *sd, u16 reg,
224224 u8 mask, u8 val)
225225 {
226− i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 2) & mask) | val, 2);
226+ i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 1) & mask) | val, 1);
227227 }
228228
229229 static u16 i2c_rd16(struct v4l2_subdev *sd, u16 reg)
drivers/media/rc/sir_ir.c+6−0
@@ -183,9 +183,15 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id) · 182 unmodified lines
183183 static unsigned long delt;
184184 unsigned long deltintr;
185185 unsigned long flags;
186+ int counter = 0;
186187 int iir, lsr;
187188
188189 while ((iir = inb(io + UART_IIR) & UART_IIR_ID)) {
190+ if (++counter > 256) {
191+ dev_err(&sir_ir_dev->dev, "Trapped in interrupt");
192+ break;
193+ }
194+
189195 switch (iir & UART_IIR_ID) { /* FIXME toto treba preriedit */
190196 case UART_IIR_MSI:
191197 (void)inb(io + UART_MSR);
drivers/media/usb/rainshadow-cec/rainshadow-cec.c+1−0
@@ -336,6 +336,7 @@ static int rain_connect(struct serio *serio, struct serio_driver *drv) · 335 unmodified lines
336336 serio_set_drvdata(serio, rain);
337337 INIT_WORK(&rain->work, rain_irq_work_handler);
338338 mutex_init(&rain->write_lock);
339+ spin_lock_init(&rain->buf_lock);
339340
340341 err = serio_open(serio, drv);
341342 if (err)
drivers/media/v4l2-core/videobuf2-core.c+1−1
@@ -868,7 +868,7 @@ EXPORT_SYMBOL_GPL(vb2_core_create_bufs); · 867 unmodified lines
868868
869869 void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no)
870870 {
871− if (plane_no > vb->num_planes || !vb->planes[plane_no].mem_priv)
871+ if (plane_no >= vb->num_planes || !vb->planes[plane_no].mem_priv)
872872 return NULL;
873873
874874 return call_ptr_memop(vb, vaddr, vb->planes[plane_no].mem_priv);
drivers/mfd/arizona-core.c+1−2
@@ -245,8 +245,7 @@ static int arizona_poll_reg(struct arizona *arizona, · 244 unmodified lines
245245 int ret;
246246
247247 ret = regmap_read_poll_timeout(arizona->regmap,
248− ARIZONA_INTERRUPT_RAW_STATUS_5, val,
249− ((val & mask) == target),
248+ reg, val, ((val & mask) == target),
250249 ARIZONA_REG_POLL_DELAY_US,
251250 timeout_ms * 1000);
252251 if (ret)
drivers/mmc/host/meson-gx-mmc.c+9−0
@@ -210,6 +210,15 @@ static void meson_mmc_get_transfer_mode(struct mmc_host *mmc, · 209 unmodified lines
210210 int i;
211211 bool use_desc_chain_mode = true;
212212
213+ /*
214+ * Broken SDIO with AP6255-based WiFi on Khadas VIM Pro has been
215+ * reported. For some strange reason this occurs in descriptor
216+ * chain mode only. So let's fall back to bounce buffer mode
217+ * for command SD_IO_RW_EXTENDED.
218+ */
219+ if (mrq->cmd->opcode == SD_IO_RW_EXTENDED)
220+ return;
221+
213222 for_each_sg(data->sg, sg, data->sg_len, i)
214223 /* check for 8 byte alignment */
215224 if (sg->offset & 7) {
drivers/net/bonding/bond_3ad.c+27−0
@@ -90,10 +90,13 @@ enum ad_link_speed_type { · 89 unmodified lines
9090 AD_LINK_SPEED_100MBPS,
9191 AD_LINK_SPEED_1000MBPS,
9292 AD_LINK_SPEED_2500MBPS,
93+ AD_LINK_SPEED_5000MBPS,
9394 AD_LINK_SPEED_10000MBPS,
95+ AD_LINK_SPEED_14000MBPS,
9496 AD_LINK_SPEED_20000MBPS,
9597 AD_LINK_SPEED_25000MBPS,
9698 AD_LINK_SPEED_40000MBPS,
99+ AD_LINK_SPEED_50000MBPS,
97100 AD_LINK_SPEED_56000MBPS,
98101 AD_LINK_SPEED_100000MBPS,
99102 };
@@ -259,10 +262,13 @@ static inline int __check_agg_selection_timer(struct port *port) · 159 unmodified lines
259262 * %AD_LINK_SPEED_100MBPS,
260263 * %AD_LINK_SPEED_1000MBPS,
261264 * %AD_LINK_SPEED_2500MBPS,
265+ * %AD_LINK_SPEED_5000MBPS,
262266 * %AD_LINK_SPEED_10000MBPS
267+ * %AD_LINK_SPEED_14000MBPS,
263268 * %AD_LINK_SPEED_20000MBPS
264269 * %AD_LINK_SPEED_25000MBPS
265270 * %AD_LINK_SPEED_40000MBPS
271+ * %AD_LINK_SPEED_50000MBPS
266272 * %AD_LINK_SPEED_56000MBPS
267273 * %AD_LINK_SPEED_100000MBPS
268274 */
@@ -296,10 +302,18 @@ static u16 __get_link_speed(struct port *port) · 27 unmodified lines
296302 speed = AD_LINK_SPEED_2500MBPS;
297303 break;
298304
305+ case SPEED_5000:
306+ speed = AD_LINK_SPEED_5000MBPS;
307+ break;
308+
299309 case SPEED_10000:
300310 speed = AD_LINK_SPEED_10000MBPS;
301311 break;
302312
313+ case SPEED_14000:
314+ speed = AD_LINK_SPEED_14000MBPS;
315+ break;
316+
303317 case SPEED_20000:
304318 speed = AD_LINK_SPEED_20000MBPS;
305319 break;
@@ -312,6 +326,10 @@ static u16 __get_link_speed(struct port *port) · 6 unmodified lines
312326 speed = AD_LINK_SPEED_40000MBPS;
313327 break;
314328
329+ case SPEED_50000:
330+ speed = AD_LINK_SPEED_50000MBPS;
331+ break;
332+
315333 case SPEED_56000:
316334 speed = AD_LINK_SPEED_56000MBPS;
317335 break;
@@ -707,9 +725,15 @@ static u32 __get_agg_bandwidth(struct aggregator *aggregator) · 389 unmodified lines
707725 case AD_LINK_SPEED_2500MBPS:
708726 bandwidth = nports * 2500;
709727 break;
728+ case AD_LINK_SPEED_5000MBPS:
729+ bandwidth = nports * 5000;
730+ break;
710731 case AD_LINK_SPEED_10000MBPS:
711732 bandwidth = nports * 10000;
712733 break;
734+ case AD_LINK_SPEED_14000MBPS:
735+ bandwidth = nports * 14000;
736+ break;
713737 case AD_LINK_SPEED_20000MBPS:
714738 bandwidth = nports * 20000;
715739 break;
@@ -719,6 +743,9 @@ static u32 __get_agg_bandwidth(struct aggregator *aggregator) · 3 unmodified lines
719743 case AD_LINK_SPEED_40000MBPS:
720744 bandwidth = nports * 40000;
721745 break;
746+ case AD_LINK_SPEED_50000MBPS:
747+ bandwidth = nports * 50000;
748+ break;
722749 case AD_LINK_SPEED_56000MBPS:
723750 bandwidth = nports * 56000;
724751 break;
drivers/net/bonding/bond_main.c+3−3
@@ -4192,7 +4192,6 @@ static void bond_destructor(struct net_device *bond_dev) · 4191 unmodified lines
41924192 struct bonding *bond = netdev_priv(bond_dev);
41934193 if (bond->wq)
41944194 destroy_workqueue(bond->wq);
4195− free_netdev(bond_dev);
41964195 }
41974196
41984197 void bond_setup(struct net_device *bond_dev)
@@ -4212,7 +4211,8 @@ void bond_setup(struct net_device *bond_dev) · 13 unmodified lines
42124211 bond_dev->netdev_ops = &bond_netdev_ops;
42134212 bond_dev->ethtool_ops = &bond_ethtool_ops;
42144213
4215− bond_dev->destructor = bond_destructor;
4214+ bond_dev->needs_free_netdev = true;
4215+ bond_dev->priv_destructor = bond_destructor;
42164216
42174217 SET_NETDEV_DEVTYPE(bond_dev, &bond_type);
42184218
@@ -4736,7 +4736,7 @@ int bond_create(struct net *net, const char *name) · 517 unmodified lines
47364736
47374737 rtnl_unlock();
47384738 if (res < 0)
4739− bond_destructor(bond_dev);
4739+ free_netdev(bond_dev);
47404740 return res;
47414741 }
47424742
drivers/net/caif/caif_hsi.c+1−1
@@ -1121,7 +1121,7 @@ static void cfhsi_setup(struct net_device *dev) · 1120 unmodified lines
11211121 dev->flags = IFF_POINTOPOINT | IFF_NOARP;
11221122 dev->mtu = CFHSI_MAX_CAIF_FRAME_SZ;
11231123 dev->priv_flags |= IFF_NO_QUEUE;
1124− dev->destructor = free_netdev;
1124+ dev->needs_free_netdev = true;
11251125 dev->netdev_ops = &cfhsi_netdevops;
11261126 for (i = 0; i < CFHSI_PRIO_LAST; ++i)
11271127 skb_queue_head_init(&cfhsi->qhead[i]);
drivers/net/caif/caif_serial.c+1−1
@@ -428,7 +428,7 @@ static void caifdev_setup(struct net_device *dev) · 427 unmodified lines
428428 dev->flags = IFF_POINTOPOINT | IFF_NOARP;
429429 dev->mtu = CAIF_MAX_MTU;
430430 dev->priv_flags |= IFF_NO_QUEUE;
431− dev->destructor = free_netdev;
431+ dev->needs_free_netdev = true;
432432 skb_queue_head_init(&serdev->head);
433433 serdev->common.link_select = CAIF_LINK_LOW_LATENCY;
434434 serdev->common.use_frag = true;
drivers/net/caif/caif_spi.c+1−1
@@ -712,7 +712,7 @@ static void cfspi_setup(struct net_device *dev) · 711 unmodified lines
712712 dev->flags = IFF_NOARP | IFF_POINTOPOINT;
713713 dev->priv_flags |= IFF_NO_QUEUE;
714714 dev->mtu = SPI_MAX_PAYLOAD_SIZE;
715− dev->destructor = free_netdev;
715+ dev->needs_free_netdev = true;
716716 skb_queue_head_init(&cfspi->qhead);
717717 skb_queue_head_init(&cfspi->chead);
718718 cfspi->cfdev.link_select = CAIF_LINK_HIGH_BANDW;
drivers/net/caif/caif_virtio.c+1−1
@@ -617,7 +617,7 @@ static void cfv_netdev_setup(struct net_device *netdev) · 616 unmodified lines
617617 netdev->tx_queue_len = 100;
618618 netdev->flags = IFF_POINTOPOINT | IFF_NOARP;
619619 netdev->mtu = CFV_DEF_MTU_SIZE;
620− netdev->destructor = free_netdev;
620+ netdev->needs_free_netdev = true;
621621 }
622622
623623 /* Create debugfs counters for the device */
drivers/net/can/dev.c+3−0
@@ -391,6 +391,9 @@ void can_change_state(struct net_device *dev, struct can_frame *cf, · 390 unmodified lines
391391 can_update_state_error_stats(dev, new_state);
392392 priv->state = new_state;
393393
394+ if (!cf)
395+ return;
396+
394397 if (unlikely(new_state == CAN_STATE_BUS_OFF)) {
395398 cf->can_id |= CAN_ERR_BUSOFF;
396399 return;
drivers/net/can/peak_canfd/peak_canfd.c+1−1
@@ -489,7 +489,7 @@ int peak_canfd_handle_msgs_list(struct peak_canfd_priv *priv, · 488 unmodified lines
489489 struct pucan_rx_msg *msg_list, int msg_count)
490490 {
491491 void *msg_ptr = msg_list;
492− int i, msg_size;
492+ int i, msg_size = 0;
493493
494494 for (i = 0; i < msg_count; i++) {
495495 msg_size = peak_canfd_handle_msg(priv, msg_ptr);
drivers/net/can/slcan.c+3−4
@@ -417,7 +417,7 @@ static int slc_open(struct net_device *dev) · 416 unmodified lines
417417 static void slc_free_netdev(struct net_device *dev)
418418 {
419419 int i = dev->base_addr;
420− free_netdev(dev);
420+
421421 slcan_devs[i] = NULL;
422422 }
423423
@@ -436,7 +436,8 @@ static const struct net_device_ops slc_netdev_ops = { · 12 unmodified lines
436436 static void slc_setup(struct net_device *dev)
437437 {
438438 dev->netdev_ops = &slc_netdev_ops;
439− dev->destructor = slc_free_netdev;
439+ dev->needs_free_netdev = true;
440+ dev->priv_destructor = slc_free_netdev;
440441
441442 dev->hard_header_len = 0;
442443 dev->addr_len = 0;
@@ -761,8 +762,6 @@ static void __exit slcan_exit(void) · 318 unmodified lines
761762 if (sl->tty) {
762763 printk(KERN_ERR "%s: tty discipline still running\n",
763764 dev->name);
764− /* Intentionally leak the control block. */
765− dev->destructor = NULL;
766765 }
767766
768767 unregister_netdev(dev);
drivers/net/can/usb/gs_usb.c+2−0
@@ -265,6 +265,8 @@ static int gs_cmd_reset(struct gs_usb *gsusb, struct gs_can *gsdev) · 264 unmodified lines
265265 sizeof(*dm),
266266 1000);
267267
268+ kfree(dm);
269+
268270 return rc;
269271 }
270272
drivers/net/can/usb/peak_usb/pcan_usb_core.c+1−3
@@ -908,8 +908,6 @@ static int peak_usb_probe(struct usb_interface *intf, · 907 unmodified lines
908908 const struct peak_usb_adapter *peak_usb_adapter = NULL;
909909 int i, err = -ENOMEM;
910910
911− usb_dev = interface_to_usbdev(intf);
912−
913911 /* get corresponding PCAN-USB adapter */
914912 for (i = 0; i < ARRAY_SIZE(peak_usb_adapters_list); i++)
915913 if (peak_usb_adapters_list[i]->device_id == usb_id_product) {
@@ -920,7 +918,7 @@ static int peak_usb_probe(struct usb_interface *intf, · 4 unmodified lines
920918 if (!peak_usb_adapter) {
921919 /* should never come except device_id bad usage in this file */
922920 pr_err("%s: didn't find device id. 0x%x in devices list\n",
923− PCAN_USB_DRIVER_NAME, usb_dev->descriptor.idProduct);
921+ PCAN_USB_DRIVER_NAME, usb_id_product);
924922 return -ENODEV;
925923 }
926924
drivers/net/can/vcan.c+2−2
@@ -152,7 +152,7 @@ static const struct net_device_ops vcan_netdev_ops = { · 151 unmodified lines
152152 static void vcan_setup(struct net_device *dev)
153153 {
154154 dev->type = ARPHRD_CAN;
155− dev->mtu = CAN_MTU;
155+ dev->mtu = CANFD_MTU;
156156 dev->hard_header_len = 0;
157157 dev->addr_len = 0;
158158 dev->tx_queue_len = 0;
@@ -163,7 +163,7 @@ static void vcan_setup(struct net_device *dev) · 4 unmodified lines
163163 dev->flags |= IFF_ECHO;
164164
165165 dev->netdev_ops = &vcan_netdev_ops;
166− dev->destructor = free_netdev;
166+ dev->needs_free_netdev = true;
167167 }
168168
169169 static struct rtnl_link_ops vcan_link_ops __read_mostly = {
drivers/net/can/vxcan.c+2−2
@@ -150,13 +150,13 @@ static const struct net_device_ops vxcan_netdev_ops = { · 149 unmodified lines
150150 static void vxcan_setup(struct net_device *dev)
151151 {
152152 dev->type = ARPHRD_CAN;
153− dev->mtu = CAN_MTU;
153+ dev->mtu = CANFD_MTU;
154154 dev->hard_header_len = 0;
155155 dev->addr_len = 0;
156156 dev->tx_queue_len = 0;
157157 dev->flags = (IFF_NOARP|IFF_ECHO);
158158 dev->netdev_ops = &vxcan_netdev_ops;
159− dev->destructor = free_netdev;
159+ dev->needs_free_netdev = true;
160160 }
161161
162162 /* forward declaration for rtnl_create_link() */
drivers/net/dummy.c+2−2
@@ -328,7 +328,6 @@ static void dummy_free_netdev(struct net_device *dev) · 327 unmodified lines
328328 struct dummy_priv *priv = netdev_priv(dev);
329329
330330 kfree(priv->vfinfo);
331− free_netdev(dev);
332331 }
333332
334333 static void dummy_setup(struct net_device *dev)
@@ -338,7 +337,8 @@ static void dummy_setup(struct net_device *dev) · 3 unmodified lines
338337 /* Initialize the device structure. */
339338 dev->netdev_ops = &dummy_netdev_ops;
340339 dev->ethtool_ops = &dummy_ethtool_ops;
341− dev->destructor = dummy_free_netdev;
340+ dev->needs_free_netdev = true;
341+ dev->priv_destructor = dummy_free_netdev;
342342
343343 /* Fill in device structure with ethernet-generic values. */
344344 dev->flags |= IFF_NOARP;
drivers/net/ethernet/amazon/ena/ena_com.c+21−14
@@ -61,6 +61,8 @@ · 60 unmodified lines
6161
6262 #define ENA_MMIO_READ_TIMEOUT 0xFFFFFFFF
6363
64+#define ENA_REGS_ADMIN_INTR_MASK 1
65+
6466 /*****************************************************************************/
6567 /*****************************************************************************/
6668 /*****************************************************************************/
@@ -232,11 +234,9 @@ static struct ena_comp_ctx *__ena_com_submit_admin_cmd(struct ena_com_admin_queu · 165 unmodified lines
232234 tail_masked = admin_queue->sq.tail & queue_size_mask;
233235
234236 /* In case of queue FULL */
235− cnt = admin_queue->sq.tail - admin_queue->sq.head;
237+ cnt = atomic_read(&admin_queue->outstanding_cmds);
236238 if (cnt >= admin_queue->q_depth) {
237− pr_debug("admin queue is FULL (tail %d head %d depth: %d)\n",
238− admin_queue->sq.tail, admin_queue->sq.head,
239− admin_queue->q_depth);
239+ pr_debug("admin queue is full.\n");
240240 admin_queue->stats.out_of_space++;
241241 return ERR_PTR(-ENOSPC);
242242 }
@@ -508,15 +508,20 @@ static int ena_com_comp_status_to_errno(u8 comp_status) · 265 unmodified lines
508508 static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_ctx,
509509 struct ena_com_admin_queue *admin_queue)
510510 {
511− unsigned long flags;
512− u32 start_time;
511+ unsigned long flags, timeout;
513512 int ret;
514513
515− start_time = ((u32)jiffies_to_usecs(jiffies));
514+ timeout = jiffies + ADMIN_CMD_TIMEOUT_US;
515+
516+ while (1) {
517+ spin_lock_irqsave(&admin_queue->q_lock, flags);
518+ ena_com_handle_admin_completion(admin_queue);
519+ spin_unlock_irqrestore(&admin_queue->q_lock, flags);
520+
521+ if (comp_ctx->status != ENA_CMD_SUBMITTED)
522+ break;
516523
517− while (comp_ctx->status == ENA_CMD_SUBMITTED) {
518− if ((((u32)jiffies_to_usecs(jiffies)) - start_time) >
519− ADMIN_CMD_TIMEOUT_US) {
524+ if (time_is_before_jiffies(timeout)) {
520525 pr_err("Wait for completion (polling) timeout\n");
521526 /* ENA didn't have any completion */
522527 spin_lock_irqsave(&admin_queue->q_lock, flags);
@@ -528,10 +533,6 @@ static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_c · 5 unmodified lines
528533 goto err;
529534 }
530535
531− spin_lock_irqsave(&admin_queue->q_lock, flags);
532− ena_com_handle_admin_completion(admin_queue);
533− spin_unlock_irqrestore(&admin_queue->q_lock, flags);
534−
535536 msleep(100);
536537 }
537538
@@ -1455,6 +1456,12 @@ void ena_com_admin_destroy(struct ena_com_dev *ena_dev) · 917 unmodified lines
14551456
14561457 void ena_com_set_admin_polling_mode(struct ena_com_dev *ena_dev, bool polling)
14571458 {
1459+ u32 mask_value = 0;
1460+
1461+ if (polling)
1462+ mask_value = ENA_REGS_ADMIN_INTR_MASK;
1463+
1464+ writel(mask_value, ena_dev->reg_bar + ENA_REGS_INTR_MASK_OFF);
14581465 ena_dev->admin_queue.polling = polling;
14591466 }
14601467
drivers/net/ethernet/amazon/ena/ena_ethtool.c+1−1
@@ -80,7 +80,6 @@ static const struct ena_stats ena_stats_tx_strings[] = { · 79 unmodified lines
8080 ENA_STAT_TX_ENTRY(tx_poll),
8181 ENA_STAT_TX_ENTRY(doorbells),
8282 ENA_STAT_TX_ENTRY(prepare_ctx_err),
83− ENA_STAT_TX_ENTRY(missing_tx_comp),
8483 ENA_STAT_TX_ENTRY(bad_req_id),
8584 };
8685
@@ -94,6 +93,7 @@ static const struct ena_stats ena_stats_rx_strings[] = { · 7 unmodified lines
9493 ENA_STAT_RX_ENTRY(dma_mapping_err),
9594 ENA_STAT_RX_ENTRY(bad_desc_num),
9695 ENA_STAT_RX_ENTRY(rx_copybreak_pkt),
96+ ENA_STAT_RX_ENTRY(empty_rx_ring),
9797 };
9898
9999 static const struct ena_stats ena_stats_ena_com_strings[] = {
drivers/net/ethernet/amazon/ena/ena_netdev.c+132−47
@@ -190,6 +190,7 @@ static void ena_init_io_rings(struct ena_adapter *adapter) · 189 unmodified lines
190190 rxr->sgl_size = adapter->max_rx_sgl_size;
191191 rxr->smoothed_interval =
192192 ena_com_get_nonadaptive_moderation_interval_rx(ena_dev);
193+ rxr->empty_rx_queue = 0;
193194 }
194195 }
195196
@@ -1078,6 +1079,26 @@ inline void ena_adjust_intr_moderation(struct ena_ring *rx_ring, · 882 unmodified lines
10781079 rx_ring->per_napi_bytes = 0;
10791080 }
10801081
1082+static inline void ena_unmask_interrupt(struct ena_ring *tx_ring,
1083+ struct ena_ring *rx_ring)
1084+{
1085+ struct ena_eth_io_intr_reg intr_reg;
1086+
1087+ /* Update intr register: rx intr delay,
1088+ * tx intr delay and interrupt unmask
1089+ */
1090+ ena_com_update_intr_reg(&intr_reg,
1091+ rx_ring->smoothed_interval,
1092+ tx_ring->smoothed_interval,
1093+ true);
1094+
1095+ /* It is a shared MSI-X.
1096+ * Tx and Rx CQ have pointer to it.
1097+ * So we use one of them to reach the intr reg
1098+ */
1099+ ena_com_unmask_intr(rx_ring->ena_com_io_cq, &intr_reg);
1100+}
1101+
10811102 static inline void ena_update_ring_numa_node(struct ena_ring *tx_ring,
10821103 struct ena_ring *rx_ring)
10831104 {
@@ -1108,7 +1129,6 @@ static int ena_io_poll(struct napi_struct *napi, int budget) · 24 unmodified lines
11081129 {
11091130 struct ena_napi *ena_napi = container_of(napi, struct ena_napi, napi);
11101131 struct ena_ring *tx_ring, *rx_ring;
1111− struct ena_eth_io_intr_reg intr_reg;
11121132
11131133 u32 tx_work_done;
11141134 u32 rx_work_done;
@@ -1149,22 +1169,9 @@ static int ena_io_poll(struct napi_struct *napi, int budget) · 34 unmodified lines
11491169 if (ena_com_get_adaptive_moderation_enabled(rx_ring->ena_dev))
11501170 ena_adjust_intr_moderation(rx_ring, tx_ring);
11511171
1152− /* Update intr register: rx intr delay,
1153− * tx intr delay and interrupt unmask
1154− */
1155− ena_com_update_intr_reg(&intr_reg,
1156− rx_ring->smoothed_interval,
1157− tx_ring->smoothed_interval,
1158− true);
1159−
1160− /* It is a shared MSI-X.
1161− * Tx and Rx CQ have pointer to it.
1162− * So we use one of them to reach the intr reg
1163− */
1164− ena_com_unmask_intr(rx_ring->ena_com_io_cq, &intr_reg);
1172+ ena_unmask_interrupt(tx_ring, rx_ring);
11651173 }
11661174
1167−
11681175 ena_update_ring_numa_node(tx_ring, rx_ring);
11691176
11701177 ret = rx_work_done;
@@ -1485,6 +1492,11 @@ static int ena_up_complete(struct ena_adapter *adapter) · 314 unmodified lines
14851492
14861493 ena_napi_enable_all(adapter);
14871494
1495+ /* Enable completion queues interrupt */
1496+ for (i = 0; i < adapter->num_queues; i++)
1497+ ena_unmask_interrupt(&adapter->tx_ring[i],
1498+ &adapter->rx_ring[i]);
1499+
14881500 /* schedule napi in case we had pending packets
14891501 * from the last time we disable napi
14901502 */
@@ -1532,6 +1544,7 @@ static int ena_create_io_tx_queue(struct ena_adapter *adapter, int qid) · 41 unmodified lines
15321544 "Failed to get TX queue handlers. TX queue num %d rc: %d\n",
15331545 qid, rc);
15341546 ena_com_destroy_io_queue(ena_dev, ena_qid);
1547+ return rc;
15351548 }
15361549
15371550 ena_com_update_numa_node(tx_ring->ena_com_io_cq, ctx.numa_node);
@@ -1596,6 +1609,7 @@ static int ena_create_io_rx_queue(struct ena_adapter *adapter, int qid) · 58 unmodified lines
15961609 "Failed to get RX queue handlers. RX queue num %d rc: %d\n",
15971610 qid, rc);
15981611 ena_com_destroy_io_queue(ena_dev, ena_qid);
1612+ return rc;
15991613 }
16001614
16011615 ena_com_update_numa_node(rx_ring->ena_com_io_cq, ctx.numa_node);
@@ -1981,6 +1995,7 @@ static netdev_tx_t ena_start_xmit(struct sk_buff *skb, struct net_device *dev) · 379 unmodified lines
19811995
19821996 tx_info->tx_descs = nb_hw_desc;
19831997 tx_info->last_jiffies = jiffies;
1998+ tx_info->print_once = 0;
19841999
19852000 tx_ring->next_to_use = ENA_TX_RING_IDX_NEXT(next_to_use,
19862001 tx_ring->ring_size);
@@ -2550,13 +2565,44 @@ err: · 563 unmodified lines
25502565 "Reset attempt failed. Can not reset the device\n");
25512566 }
25522567
2553−static void check_for_missing_tx_completions(struct ena_adapter *adapter)
2568+static int check_missing_comp_in_queue(struct ena_adapter *adapter,
2569+ struct ena_ring *tx_ring)
25542570 {
25552571 struct ena_tx_buffer *tx_buf;
25562572 unsigned long last_jiffies;
2573+ u32 missed_tx = 0;
2574+ int i;
2575+
2576+ for (i = 0; i < tx_ring->ring_size; i++) {
2577+ tx_buf = &tx_ring->tx_buffer_info[i];
2578+ last_jiffies = tx_buf->last_jiffies;
2579+ if (unlikely(last_jiffies &&
2580+ time_is_before_jiffies(last_jiffies + TX_TIMEOUT))) {
2581+ if (!tx_buf->print_once)
2582+ netif_notice(adapter, tx_err, adapter->netdev,
2583+ "Found a Tx that wasn't completed on time, qid %d, index %d.\n",
2584+ tx_ring->qid, i);
2585+
2586+ tx_buf->print_once = 1;
2587+ missed_tx++;
2588+
2589+ if (unlikely(missed_tx > MAX_NUM_OF_TIMEOUTED_PACKETS)) {
2590+ netif_err(adapter, tx_err, adapter->netdev,
2591+ "The number of lost tx completions is above the threshold (%d > %d). Reset the device\n",
2592+ missed_tx, MAX_NUM_OF_TIMEOUTED_PACKETS);
2593+ set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
2594+ return -EIO;
2595+ }
2596+ }
2597+ }
2598+
2599+ return 0;
2600+}
2601+
2602+static void check_for_missing_tx_completions(struct ena_adapter *adapter)
2603+{
25572604 struct ena_ring *tx_ring;
2558− int i, j, budget;
2559− u32 missed_tx;
2605+ int i, budget, rc;
25602606
25612607 /* Make sure the driver doesn't turn the device in other process */
25622608 smp_rmb();
@@ -2572,31 +2618,9 @@ static void check_for_missing_tx_completions(struct ena_adapter *adapter) · 9 unmodified lines
25722618 for (i = adapter->last_monitored_tx_qid; i < adapter->num_queues; i++) {
25732619 tx_ring = &adapter->tx_ring[i];
25742620
2575− for (j = 0; j < tx_ring->ring_size; j++) {
2576− tx_buf = &tx_ring->tx_buffer_info[j];
2577− last_jiffies = tx_buf->last_jiffies;
2578− if (unlikely(last_jiffies && time_is_before_jiffies(last_jiffies + TX_TIMEOUT))) {
2579− netif_notice(adapter, tx_err, adapter->netdev,
2580− "Found a Tx that wasn't completed on time, qid %d, index %d.\n",
2581− tx_ring->qid, j);
2582−
2583− u64_stats_update_begin(&tx_ring->syncp);
2584− missed_tx = tx_ring->tx_stats.missing_tx_comp++;
2585− u64_stats_update_end(&tx_ring->syncp);
2586−
2587− /* Clear last jiffies so the lost buffer won't
2588− * be counted twice.
2589− */
2590− tx_buf->last_jiffies = 0;
2591−
2592− if (unlikely(missed_tx > MAX_NUM_OF_TIMEOUTED_PACKETS)) {
2593− netif_err(adapter, tx_err, adapter->netdev,
2594− "The number of lost tx completion is above the threshold (%d > %d). Reset the device\n",
2595− missed_tx, MAX_NUM_OF_TIMEOUTED_PACKETS);
2596− set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
2597− }
2598− }
2599− }
2621+ rc = check_missing_comp_in_queue(adapter, tx_ring);
2622+ if (unlikely(rc))
2623+ return;
26002624
26012625 budget--;
26022626 if (!budget)
@@ -2606,6 +2630,58 @@ static void check_for_missing_tx_completions(struct ena_adapter *adapter) · 3 unmodified lines
26062630 adapter->last_monitored_tx_qid = i % adapter->num_queues;
26072631 }
26082632
2633+/* trigger napi schedule after 2 consecutive detections */
2634+#define EMPTY_RX_REFILL 2
2635+/* For the rare case where the device runs out of Rx descriptors and the
2636+ * napi handler failed to refill new Rx descriptors (due to a lack of memory
2637+ * for example).
2638+ * This case will lead to a deadlock:
2639+ * The device won't send interrupts since all the new Rx packets will be dropped
2640+ * The napi handler won't allocate new Rx descriptors so the device will be
2641+ * able to send new packets.
2642+ *
2643+ * This scenario can happen when the kernel's vm.min_free_kbytes is too small.
2644+ * It is recommended to have at least 512MB, with a minimum of 128MB for
2645+ * constrained environment).
2646+ *
2647+ * When such a situation is detected - Reschedule napi
2648+ */
2649+static void check_for_empty_rx_ring(struct ena_adapter *adapter)
2650+{
2651+ struct ena_ring *rx_ring;
2652+ int i, refill_required;
2653+
2654+ if (!test_bit(ENA_FLAG_DEV_UP, &adapter->flags))
2655+ return;
2656+
2657+ if (test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))
2658+ return;
2659+
2660+ for (i = 0; i < adapter->num_queues; i++) {
2661+ rx_ring = &adapter->rx_ring[i];
2662+
2663+ refill_required =
2664+ ena_com_sq_empty_space(rx_ring->ena_com_io_sq);
2665+ if (unlikely(refill_required == (rx_ring->ring_size - 1))) {
2666+ rx_ring->empty_rx_queue++;
2667+
2668+ if (rx_ring->empty_rx_queue >= EMPTY_RX_REFILL) {
2669+ u64_stats_update_begin(&rx_ring->syncp);
2670+ rx_ring->rx_stats.empty_rx_ring++;
2671+ u64_stats_update_end(&rx_ring->syncp);
2672+
2673+ netif_err(adapter, drv, adapter->netdev,
2674+ "trigger refill for ring %d\n", i);
2675+
2676+ napi_schedule(rx_ring->napi);
2677+ rx_ring->empty_rx_queue = 0;
2678+ }
2679+ } else {
2680+ rx_ring->empty_rx_queue = 0;
2681+ }
2682+ }
2683+}
2684+
26092685 /* Check for keep alive expiration */
26102686 static void check_for_missing_keep_alive(struct ena_adapter *adapter)
26112687 {
@@ -2660,6 +2736,8 @@ static void ena_timer_service(unsigned long data) · 48 unmodified lines
26602736
26612737 check_for_missing_tx_completions(adapter);
26622738
2739+ check_for_empty_rx_ring(adapter);
2740+
26632741 if (debug_area)
26642742 ena_dump_stats_to_buf(adapter, debug_area);
26652743
@@ -2840,6 +2918,11 @@ static void ena_release_bars(struct ena_com_dev *ena_dev, struct pci_dev *pdev) · 174 unmodified lines
28402918 {
28412919 int release_bars;
28422920
2921+ if (ena_dev->mem_bar)
2922+ devm_iounmap(&pdev->dev, ena_dev->mem_bar);
2923+
2924+ devm_iounmap(&pdev->dev, ena_dev->reg_bar);
2925+
28432926 release_bars = pci_select_bars(pdev, IORESOURCE_MEM) & ENA_BAR_MASK;
28442927 pci_release_selected_regions(pdev, release_bars);
28452928 }
@@ -2927,8 +3010,9 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 81 unmodified lines
29273010 goto err_free_ena_dev;
29283011 }
29293012
2930− ena_dev->reg_bar = ioremap(pci_resource_start(pdev, ENA_REG_BAR),
2931− pci_resource_len(pdev, ENA_REG_BAR));
3013+ ena_dev->reg_bar = devm_ioremap(&pdev->dev,
3014+ pci_resource_start(pdev, ENA_REG_BAR),
3015+ pci_resource_len(pdev, ENA_REG_BAR));
29323016 if (!ena_dev->reg_bar) {
29333017 dev_err(&pdev->dev, "failed to remap regs bar\n");
29343018 rc = -EFAULT;
@@ -2948,8 +3032,9 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 13 unmodified lines
29483032 ena_set_push_mode(pdev, ena_dev, &get_feat_ctx);
29493033
29503034 if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) {
2951− ena_dev->mem_bar = ioremap_wc(pci_resource_start(pdev, ENA_MEM_BAR),
2952− pci_resource_len(pdev, ENA_MEM_BAR));
3035+ ena_dev->mem_bar = devm_ioremap_wc(&pdev->dev,
3036+ pci_resource_start(pdev, ENA_MEM_BAR),
3037+ pci_resource_len(pdev, ENA_MEM_BAR));
29533038 if (!ena_dev->mem_bar) {
29543039 rc = -EFAULT;
29553040 goto err_device_destroy;
drivers/net/ethernet/amazon/ena/ena_netdev.h+15−3
@@ -45,7 +45,7 @@ · 44 unmodified lines
4545
4646 #define DRV_MODULE_VER_MAJOR 1
4747 #define DRV_MODULE_VER_MINOR 1
48−#define DRV_MODULE_VER_SUBMINOR 2
48+#define DRV_MODULE_VER_SUBMINOR 7
4949
5050 #define DRV_MODULE_NAME "ena"
5151 #ifndef DRV_MODULE_VERSION
@@ -146,7 +146,18 @@ struct ena_tx_buffer { · 94 unmodified lines
146146 u32 tx_descs;
147147 /* num of buffers used by this skb */
148148 u32 num_of_bufs;
149− /* Save the last jiffies to detect missing tx packets */
149+
150+ /* Used for detect missing tx packets to limit the number of prints */
151+ u32 print_once;
152+ /* Save the last jiffies to detect missing tx packets
153+ *
154+ * sets to non zero value on ena_start_xmit and set to zero on
155+ * napi and timer_Service_routine.
156+ *
157+ * while this value is not protected by lock,
158+ * a given packet is not expected to be handled by ena_start_xmit
159+ * and by napi/timer_service at the same time.
160+ */
150161 unsigned long last_jiffies;
151162 struct ena_com_buf bufs[ENA_PKT_MAX_BUFS];
152163 } ____cacheline_aligned;
@@ -170,7 +181,6 @@ struct ena_stats_tx { · 17 unmodified lines
170181 u64 napi_comp;
171182 u64 tx_poll;
172183 u64 doorbells;
173− u64 missing_tx_comp;
174184 u64 bad_req_id;
175185 };
176186
@@ -184,6 +194,7 @@ struct ena_stats_rx { · 7 unmodified lines
184194 u64 dma_mapping_err;
185195 u64 bad_desc_num;
186196 u64 rx_copybreak_pkt;
197+ u64 empty_rx_ring;
187198 };
188199
189200 struct ena_ring {
@@ -231,6 +242,7 @@ struct ena_ring { · 41 unmodified lines
231242 struct ena_stats_tx tx_stats;
232243 struct ena_stats_rx rx_stats;
233244 };
245+ int empty_rx_queue;
234246 } ____cacheline_aligned;
235247
236248 struct ena_stats_dev {
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h+0−3
@@ -193,9 +193,6 @@ int hw_atl_utils_hw_get_regs(struct aq_hw_s *self, · 192 unmodified lines
193193 struct aq_hw_caps_s *aq_hw_caps,
194194 u32 *regs_buff);
195195
196−int hw_atl_utils_hw_get_settings(struct aq_hw_s *self,
197− struct ethtool_cmd *cmd);
198−
199196 int hw_atl_utils_hw_set_power(struct aq_hw_s *self,
200197 unsigned int power_state);
201198
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c+15−4
@@ -3883,15 +3883,26 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) · 3882 unmodified lines
38833883 /* when transmitting in a vf, start bd must hold the ethertype
38843884 * for fw to enforce it
38853885 */
3886+ u16 vlan_tci = 0;
38863887 #ifndef BNX2X_STOP_ON_ERROR
3887− if (IS_VF(bp))
3888+ if (IS_VF(bp)) {
38883889 #endif
3889− tx_start_bd->vlan_or_ethertype =
3890− cpu_to_le16(ntohs(eth->h_proto));
3890+ /* Still need to consider inband vlan for enforced */
3891+ if (__vlan_get_tag(skb, &vlan_tci)) {
3892+ tx_start_bd->vlan_or_ethertype =
3893+ cpu_to_le16(ntohs(eth->h_proto));
3894+ } else {
3895+ tx_start_bd->bd_flags.as_bitfield |=
3896+ (X_ETH_INBAND_VLAN <<
3897+ ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);
3898+ tx_start_bd->vlan_or_ethertype =
3899+ cpu_to_le16(vlan_tci);
3900+ }
38913901 #ifndef BNX2X_STOP_ON_ERROR
3892− else
3902+ } else {
38933903 /* used by FW for packet accounting */
38943904 tx_start_bd->vlan_or_ethertype = cpu_to_le16(pkt_prod);
3905+ }
38953906 #endif
38963907 }
38973908
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c+13−2
@@ -901,6 +901,8 @@ static void bnx2x_vf_flr(struct bnx2x *bp, struct bnx2x_virtf *vf) · 900 unmodified lines
901901 /* release VF resources */
902902 bnx2x_vf_free_resc(bp, vf);
903903
904+ vf->malicious = false;
905+
904906 /* re-open the mailbox */
905907 bnx2x_vf_enable_mbx(bp, vf->abs_vfid);
906908 return;
@@ -1822,9 +1824,11 @@ get_vf: · 915 unmodified lines
18221824 vf->abs_vfid, qidx);
18231825 bnx2x_vf_handle_rss_update_eqe(bp, vf);
18241826 case EVENT_RING_OPCODE_VF_FLR:
1825− case EVENT_RING_OPCODE_MALICIOUS_VF:
18261827 /* Do nothing for now */
18271828 return 0;
1829+ case EVENT_RING_OPCODE_MALICIOUS_VF:
1830+ vf->malicious = true;
1831+ return 0;
18281832 }
18291833
18301834 return 0;
@@ -1905,6 +1909,13 @@ void bnx2x_iov_adjust_stats_req(struct bnx2x *bp) · 74 unmodified lines
19051909 continue;
19061910 }
19071911
1912+ if (vf->malicious) {
1913+ DP_AND((BNX2X_MSG_IOV | BNX2X_MSG_STATS),
1914+ "vf %d malicious so no stats for it\n",
1915+ vf->abs_vfid);
1916+ continue;
1917+ }
1918+
19081919 DP_AND((BNX2X_MSG_IOV | BNX2X_MSG_STATS),
19091920 "add addresses for vf %d\n", vf->abs_vfid);
19101921 for_each_vfq(vf, j) {
@@ -3042,7 +3053,7 @@ void bnx2x_vf_pci_dealloc(struct bnx2x *bp) · 1131 unmodified lines
30423053 {
30433054 BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping,
30443055 sizeof(struct bnx2x_vf_mbx_msg));
3045− BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->pf2vf_bulletin_mapping,
3056+ BNX2X_PCI_FREE(bp->pf2vf_bulletin, bp->pf2vf_bulletin_mapping,
30463057 sizeof(union pf_vf_bulletin));
30473058 }
30483059
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h+1−0
@@ -141,6 +141,7 @@ struct bnx2x_virtf { · 140 unmodified lines
141141 #define VF_RESET 3 /* VF FLR'd, pending cleanup */
142142
143143 bool flr_clnup_stage; /* true during flr cleanup */
144+ bool malicious; /* true if FW indicated so, until FLR */
144145
145146 /* dma */
146147 dma_addr_t fw_stat_map;
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c+7−5
@@ -2171,9 +2171,10 @@ static int cxgb_up(struct adapter *adap) · 2170 unmodified lines
21712171 {
21722172 int err;
21732173
2174+ mutex_lock(&uld_mutex);
21742175 err = setup_sge_queues(adap);
21752176 if (err)
2176− goto out;
2177+ goto rel_lock;
21772178 err = setup_rss(adap);
21782179 if (err)
21792180 goto freeq;
@@ -2197,7 +2198,6 @@ static int cxgb_up(struct adapter *adap) · 17 unmodified lines
21972198 goto irq_err;
21982199 }
21992200
2200− mutex_lock(&uld_mutex);
22012201 enable_rx(adap);
22022202 t4_sge_start(adap);
22032203 t4_intr_enable(adap);
@@ -2210,13 +2210,15 @@ static int cxgb_up(struct adapter *adap) · 6 unmodified lines
22102210 #endif
22112211 /* Initialize hash mac addr list*/
22122212 INIT_LIST_HEAD(&adap->mac_hlist);
2213− out:
22142213 return err;
2214+
22152215 irq_err:
22162216 dev_err(adap->pdev_dev, "request_irq failed, err %d\n", err);
22172217 freeq:
22182218 t4_free_sge_resources(adap);
2219− goto out;
2219+ rel_lock:
2220+ mutex_unlock(&uld_mutex);
2221+ return err;
22202222 }
22212223
22222224 static void cxgb_down(struct adapter *adapter)
@@ -4525,7 +4527,7 @@ static void dummy_setup(struct net_device *dev) · 2302 unmodified lines
45254527 /* Initialize the device structure. */
45264528 dev->netdev_ops = &cxgb4_mgmt_netdev_ops;
45274529 dev->ethtool_ops = &cxgb4_mgmt_ethtool_ops;
4528− dev->destructor = free_netdev;
4530+ dev->needs_free_netdev = true;
45294531 }
45304532
45314533 static int config_mgmt_dev(struct pci_dev *pdev)
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c+1−1
@@ -2647,7 +2647,7 @@ static int dpaa_eth_probe(struct platform_device *pdev) · 2646 unmodified lines
26472647 priv->buf_layout[TX].priv_data_size = DPAA_TX_PRIV_DATA_SIZE; /* Tx */
26482648
26492649 /* device used for DMA mapping */
2650− arch_setup_dma_ops(dev, 0, 0, NULL, false);
2650+ set_dma_ops(dev, get_dma_ops(&pdev->dev));
26512651 err = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(40));
26522652 if (err) {
26532653 dev_err(dev, "dma_coerce_mask_and_coherent() failed\n");
drivers/net/ethernet/freescale/fman/mac.c+2−0
@@ -623,6 +623,8 @@ static struct platform_device *dpaa_eth_add_device(int fman_id, · 622 unmodified lines
623623 goto no_mem;
624624 }
625625
626+ set_dma_ops(&pdev->dev, get_dma_ops(priv->dev));
627+
626628 ret = platform_device_add_data(pdev, &data, sizeof(data));
627629 if (ret)
628630 goto err;
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c+14−2
@@ -288,9 +288,15 @@ static int hns_nic_config_phy_loopback(struct phy_device *phy_dev, u8 en) · 287 unmodified lines
288288
289289 /* Force 1000M Link, Default is 0x0200 */
290290 phy_write(phy_dev, 7, 0x20C);
291− phy_write(phy_dev, HNS_PHY_PAGE_REG, 0);
292291
293− /* Enable PHY loop-back */
292+ /* Powerup Fiber */
293+ phy_write(phy_dev, HNS_PHY_PAGE_REG, 1);
294+ val = phy_read(phy_dev, COPPER_CONTROL_REG);
295+ val &= ~PHY_POWER_DOWN;
296+ phy_write(phy_dev, COPPER_CONTROL_REG, val);
297+
298+ /* Enable Phy Loopback */
299+ phy_write(phy_dev, HNS_PHY_PAGE_REG, 0);
294300 val = phy_read(phy_dev, COPPER_CONTROL_REG);
295301 val |= PHY_LOOP_BACK;
296302 val &= ~PHY_POWER_DOWN;
@@ -299,6 +305,12 @@ static int hns_nic_config_phy_loopback(struct phy_device *phy_dev, u8 en) · 2 unmodified lines
299305 phy_write(phy_dev, HNS_PHY_PAGE_REG, 0xFA);
300306 phy_write(phy_dev, 1, 0x400);
301307 phy_write(phy_dev, 7, 0x200);
308+
309+ phy_write(phy_dev, HNS_PHY_PAGE_REG, 1);
310+ val = phy_read(phy_dev, COPPER_CONTROL_REG);
311+ val |= PHY_POWER_DOWN;
312+ phy_write(phy_dev, COPPER_CONTROL_REG, val);
313+
302314 phy_write(phy_dev, HNS_PHY_PAGE_REG, 0);
303315 phy_write(phy_dev, 9, 0xF00);
304316
drivers/net/ethernet/ibm/emac/core.c+40−27
@@ -343,6 +343,7 @@ static int emac_reset(struct emac_instance *dev) · 342 unmodified lines
343343 {
344344 struct emac_regs __iomem *p = dev->emacp;
345345 int n = 20;
346+ bool __maybe_unused try_internal_clock = false;
346347
347348 DBG(dev, "reset" NL);
348349
@@ -355,6 +356,7 @@ static int emac_reset(struct emac_instance *dev) · 6 unmodified lines
355356 }
356357
357358 #ifdef CONFIG_PPC_DCR_NATIVE
359+do_retry:
358360 /*
359361 * PPC460EX/GT Embedded Processor Advanced User's Manual
360362 * section 28.10.1 Mode Register 0 (EMACx_MR0) states:
@@ -362,10 +364,19 @@ static int emac_reset(struct emac_instance *dev) · 1 unmodified line
362364 * of the EMAC. If none is present, select the internal clock
363365 * (SDR0_ETH_CFG[EMACx_PHY_CLK] = 1).
364366 * After a soft reset, select the external clock.
367+ *
368+ * The AR8035-A PHY Meraki MR24 does not provide a TX Clk if the
369+ * ethernet cable is not attached. This causes the reset to timeout
370+ * and the PHY detection code in emac_init_phy() is unable to
371+ * communicate and detect the AR8035-A PHY. As a result, the emac
372+ * driver bails out early and the user has no ethernet.
373+ * In order to stay compatible with existing configurations, the
374+ * driver will temporarily switch to the internal clock, after
375+ * the first reset fails.
365376 */
366377 if (emac_has_feature(dev, EMAC_FTR_460EX_PHY_CLK_FIX)) {
367− if (dev->phy_address == 0xffffffff &&
368− dev->phy_map == 0xffffffff) {
378+ if (try_internal_clock || (dev->phy_address == 0xffffffff &&
379+ dev->phy_map == 0xffffffff)) {
369380 /* No PHY: select internal loop clock before reset */
370381 dcri_clrset(SDR0, SDR0_ETH_CFG,
371382 0, SDR0_ETH_CFG_ECS << dev->cell_index);
@@ -383,8 +394,15 @@ static int emac_reset(struct emac_instance *dev) · 11 unmodified lines
383394
384395 #ifdef CONFIG_PPC_DCR_NATIVE
385396 if (emac_has_feature(dev, EMAC_FTR_460EX_PHY_CLK_FIX)) {
386− if (dev->phy_address == 0xffffffff &&
387− dev->phy_map == 0xffffffff) {
397+ if (!n && !try_internal_clock) {
398+ /* first attempt has timed out. */
399+ n = 20;
400+ try_internal_clock = true;
401+ goto do_retry;
402+ }
403+
404+ if (try_internal_clock || (dev->phy_address == 0xffffffff &&
405+ dev->phy_map == 0xffffffff)) {
388406 /* No PHY: restore external clock source after reset */
389407 dcri_clrset(SDR0, SDR0_ETH_CFG,
390408 SDR0_ETH_CFG_ECS << dev->cell_index, 0);
@@ -2460,20 +2478,24 @@ static int emac_mii_bus_reset(struct mii_bus *bus) · 2069 unmodified lines
24602478 return emac_reset(dev);
24612479 }
24622480
2481+static int emac_mdio_phy_start_aneg(struct mii_phy *phy,
2482+ struct phy_device *phy_dev)
2483+{
2484+ phy_dev->autoneg = phy->autoneg;
2485+ phy_dev->speed = phy->speed;
2486+ phy_dev->duplex = phy->duplex;
2487+ phy_dev->advertising = phy->advertising;
2488+ return phy_start_aneg(phy_dev);
2489+}
2490+
24632491 static int emac_mdio_setup_aneg(struct mii_phy *phy, u32 advertise)
24642492 {
24652493 struct net_device *ndev = phy->dev;
24662494 struct emac_instance *dev = netdev_priv(ndev);
24672495
2468− dev->phy.autoneg = AUTONEG_ENABLE;
2469− dev->phy.speed = SPEED_1000;
2470− dev->phy.duplex = DUPLEX_FULL;
2471− dev->phy.advertising = advertise;
24722496 phy->autoneg = AUTONEG_ENABLE;
2473− phy->speed = dev->phy.speed;
2474− phy->duplex = dev->phy.duplex;
24752497 phy->advertising = advertise;
2476− return phy_start_aneg(dev->phy_dev);
2498+ return emac_mdio_phy_start_aneg(phy, dev->phy_dev);
24772499 }
24782500
24792501 static int emac_mdio_setup_forced(struct mii_phy *phy, int speed, int fd)
@@ -2481,13 +2503,10 @@ static int emac_mdio_setup_forced(struct mii_phy *phy, int speed, int fd) · 1 unmodified line
24812503 struct net_device *ndev = phy->dev;
24822504 struct emac_instance *dev = netdev_priv(ndev);
24832505
2484− dev->phy.autoneg = AUTONEG_DISABLE;
2485− dev->phy.speed = speed;
2486− dev->phy.duplex = fd;
24872506 phy->autoneg = AUTONEG_DISABLE;
24882507 phy->speed = speed;
24892508 phy->duplex = fd;
2490− return phy_start_aneg(dev->phy_dev);
2509+ return emac_mdio_phy_start_aneg(phy, dev->phy_dev);
24912510 }
24922511
24932512 static int emac_mdio_poll_link(struct mii_phy *phy)
@@ -2509,16 +2528,17 @@ static int emac_mdio_read_link(struct mii_phy *phy) · 15 unmodified lines
25092528 {
25102529 struct net_device *ndev = phy->dev;
25112530 struct emac_instance *dev = netdev_priv(ndev);
2531+ struct phy_device *phy_dev = dev->phy_dev;
25122532 int res;
25132533
2514− res = phy_read_status(dev->phy_dev);
2534+ res = phy_read_status(phy_dev);
25152535 if (res)
25162536 return res;
25172537
2518− dev->phy.speed = phy->speed;
2519− dev->phy.duplex = phy->duplex;
2520− dev->phy.pause = phy->pause;
2521− dev->phy.asym_pause = phy->asym_pause;
2538+ phy->speed = phy_dev->speed;
2539+ phy->duplex = phy_dev->duplex;
2540+ phy->pause = phy_dev->pause;
2541+ phy->asym_pause = phy_dev->asym_pause;
25222542 return 0;
25232543 }
25242544
@@ -2528,13 +2548,6 @@ static int emac_mdio_init_phy(struct mii_phy *phy) · 3 unmodified lines
25282548 struct emac_instance *dev = netdev_priv(ndev);
25292549
25302550 phy_start(dev->phy_dev);
2531− dev->phy.autoneg = phy->autoneg;
2532− dev->phy.speed = phy->speed;
2533− dev->phy.duplex = phy->duplex;
2534− dev->phy.advertising = phy->advertising;
2535− dev->phy.pause = phy->pause;
2536− dev->phy.asym_pause = phy->asym_pause;
2537−
25382551 return phy_init_hw(dev->phy_dev);
25392552 }
25402553
drivers/net/ethernet/ibm/ibmvnic.c+6−0
@@ -1468,6 +1468,11 @@ static void ibmvnic_netpoll_controller(struct net_device *dev) · 1467 unmodified lines
14681468 }
14691469 #endif
14701470
1471+static int ibmvnic_change_mtu(struct net_device *netdev, int new_mtu)
1472+{
1473+ return -EOPNOTSUPP;
1474+}
1475+
14711476 static const struct net_device_ops ibmvnic_netdev_ops = {
14721477 .ndo_open = ibmvnic_open,
14731478 .ndo_stop = ibmvnic_close,
@@ -1479,6 +1484,7 @@ static const struct net_device_ops ibmvnic_netdev_ops = { · 5 unmodified lines
14791484 #ifdef CONFIG_NET_POLL_CONTROLLER
14801485 .ndo_poll_controller = ibmvnic_netpoll_controller,
14811486 #endif
1487+ .ndo_change_mtu = ibmvnic_change_mtu,
14821488 };
14831489
14841490 /* ethtool functions */
drivers/net/ethernet/intel/i40e/i40e.h+1−0
@@ -399,6 +399,7 @@ struct i40e_pf { · 398 unmodified lines
399399 #define I40E_FLAG_RX_CSUM_ENABLED BIT_ULL(1)
400400 #define I40E_FLAG_MSI_ENABLED BIT_ULL(2)
401401 #define I40E_FLAG_MSIX_ENABLED BIT_ULL(3)
402+#define I40E_FLAG_HW_ATR_EVICT_ENABLED BIT_ULL(4)
402403 #define I40E_FLAG_RSS_ENABLED BIT_ULL(6)
403404 #define I40E_FLAG_VMDQ_ENABLED BIT_ULL(7)
404405 #define I40E_FLAG_IWARP_ENABLED BIT_ULL(10)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c+2−2
@@ -224,7 +224,7 @@ static const struct i40e_priv_flags i40e_gstrings_priv_flags[] = { · 223 unmodified lines
224224 I40E_PRIV_FLAG("LinkPolling", I40E_FLAG_LINK_POLLING_ENABLED, 0),
225225 I40E_PRIV_FLAG("flow-director-atr", I40E_FLAG_FD_ATR_ENABLED, 0),
226226 I40E_PRIV_FLAG("veb-stats", I40E_FLAG_VEB_STATS_ENABLED, 0),
227− I40E_PRIV_FLAG("hw-atr-eviction", I40E_FLAG_HW_ATR_EVICT_CAPABLE, 0),
227+ I40E_PRIV_FLAG("hw-atr-eviction", I40E_FLAG_HW_ATR_EVICT_ENABLED, 0),
228228 I40E_PRIV_FLAG("legacy-rx", I40E_FLAG_LEGACY_RX, 0),
229229 };
230230
@@ -4092,7 +4092,7 @@ flags_complete: · 3861 unmodified lines
40924092
40934093 /* Only allow ATR evict on hardware that is capable of handling it */
40944094 if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE)
4095− pf->flags &= ~I40E_FLAG_HW_ATR_EVICT_CAPABLE;
4095+ pf->flags &= ~I40E_FLAG_HW_ATR_EVICT_ENABLED;
40964096
40974097 if (changed_flags & I40E_FLAG_TRUE_PROMISC_SUPPORT) {
40984098 u16 sw_flags = 0, valid_flags = 0;
drivers/net/ethernet/intel/i40e/i40e_main.c+4−3
@@ -8821,11 +8821,12 @@ static int i40e_sw_init(struct i40e_pf *pf) · 8820 unmodified lines
88218821 (pf->hw.aq.api_min_ver > 4))) {
88228822 /* Supported in FW API version higher than 1.4 */
88238823 pf->flags |= I40E_FLAG_GENEVE_OFFLOAD_CAPABLE;
8824− pf->flags = I40E_FLAG_HW_ATR_EVICT_CAPABLE;
8825− } else {
8826− pf->flags = I40E_FLAG_HW_ATR_EVICT_CAPABLE;
88278824 }
88288825
8826+ /* Enable HW ATR eviction if possible */
8827+ if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE)
8828+ pf->flags |= I40E_FLAG_HW_ATR_EVICT_ENABLED;
8829+
88298830 pf->eeprom_version = 0xDEAD;
88308831 pf->lan_veb = I40E_NO_VEB;
88318832 pf->lan_vsi = I40E_NO_VSI;
drivers/net/ethernet/intel/i40e/i40e_txrx.c+2−2
@@ -2341,7 +2341,7 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb, · 2340 unmodified lines
23412341 /* Due to lack of space, no more new filters can be programmed */
23422342 if (th->syn && (pf->flags & I40E_FLAG_FD_ATR_AUTO_DISABLED))
23432343 return;
2344− if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE) {
2344+ if (pf->flags & I40E_FLAG_HW_ATR_EVICT_ENABLED) {
23452345 /* HW ATR eviction will take care of removing filters on FIN
23462346 * and RST packets.
23472347 */
@@ -2403,7 +2403,7 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb, · 55 unmodified lines
24032403 I40E_TXD_FLTR_QW1_CNTINDEX_SHIFT) &
24042404 I40E_TXD_FLTR_QW1_CNTINDEX_MASK;
24052405
2406− if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE)
2406+ if (pf->flags & I40E_FLAG_HW_ATR_EVICT_ENABLED)
24072407 dtype_cmd |= I40E_TXD_FLTR_QW1_ATR_MASK;
24082408
24092409 fdir_desc->qindex_flex_ptype_vsi = cpu_to_le32(flex_ptype);
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c+2−0
@@ -3017,10 +3017,12 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id, · 3016 unmodified lines
30173017 VLAN_VID_MASK));
30183018 }
30193019
3020+ spin_unlock_bh(&vsi->mac_filter_hash_lock);
30203021 if (vlan_id || qos)
30213022 ret = i40e_vsi_add_pvid(vsi, vlanprio);
30223023 else
30233024 i40e_vsi_remove_pvid(vsi);
3025+ spin_lock_bh(&vsi->mac_filter_hash_lock);
30243026
30253027 if (vlan_id) {
30263028 dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n",
drivers/net/ethernet/marvell/mvpp2.c+33−43
@@ -3719,7 +3719,7 @@ static void mvpp2_bm_bufs_get_addrs(struct device *dev, struct mvpp2 *priv, · 3718 unmodified lines
37193719 dma_addr_t *dma_addr,
37203720 phys_addr_t *phys_addr)
37213721 {
3722− int cpu = smp_processor_id();
3722+ int cpu = get_cpu();
37233723
37243724 *dma_addr = mvpp2_percpu_read(priv, cpu,
37253725 MVPP2_BM_PHY_ALLOC_REG(bm_pool->id));
@@ -3740,6 +3740,8 @@ static void mvpp2_bm_bufs_get_addrs(struct device *dev, struct mvpp2 *priv, · 14 unmodified lines
37403740 if (sizeof(phys_addr_t) == 8)
37413741 *phys_addr |= (u64)phys_addr_highbits << 32;
37423742 }
3743+
3744+ put_cpu();
37433745 }
37443746
37453747 /* Free all buffers from the pool */
@@ -3920,18 +3922,12 @@ static inline u32 mvpp2_bm_cookie_pool_set(u32 cookie, int pool) · 174 unmodified lines
39203922 return bm;
39213923 }
39223924
3923−/* Get pool number from a BM cookie */
3924−static inline int mvpp2_bm_cookie_pool_get(unsigned long cookie)
3925−{
3926− return (cookie >> MVPP2_BM_COOKIE_POOL_OFFS) & 0xFF;
3927−}
3928−
39293925 /* Release buffer to BM */
39303926 static inline void mvpp2_bm_pool_put(struct mvpp2_port *port, int pool,
39313927 dma_addr_t buf_dma_addr,
39323928 phys_addr_t buf_phys_addr)
39333929 {
3934− int cpu = smp_processor_id();
3930+ int cpu = get_cpu();
39353931
39363932 if (port->priv->hw_version == MVPP22) {
39373933 u32 val = 0;
@@ -3958,15 +3954,15 @@ static inline void mvpp2_bm_pool_put(struct mvpp2_port *port, int pool, · 20 unmodified lines
39583954 MVPP2_BM_VIRT_RLS_REG, buf_phys_addr);
39593955 mvpp2_percpu_write(port->priv, cpu,
39603956 MVPP2_BM_PHY_RLS_REG(pool), buf_dma_addr);
3957+
3958+ put_cpu();
39613959 }
39623960
39633961 /* Refill BM pool */
3964−static void mvpp2_pool_refill(struct mvpp2_port *port, u32 bm,
3962+static void mvpp2_pool_refill(struct mvpp2_port *port, int pool,
39653963 dma_addr_t dma_addr,
39663964 phys_addr_t phys_addr)
39673965 {
3968− int pool = mvpp2_bm_cookie_pool_get(bm);
3969−
39703966 mvpp2_bm_pool_put(port, pool, dma_addr, phys_addr);
39713967 }
39723968
@@ -4186,8 +4182,6 @@ static void mvpp22_port_mii_set(struct mvpp2_port *port) · 213 unmodified lines
41864182 {
41874183 u32 val;
41884184
4189− return;
4190−
41914185 /* Only GOP port 0 has an XLG MAC */
41924186 if (port->gop_id == 0) {
41934187 val = readl(port->base + MVPP22_XLG_CTRL3_REG);
@@ -4515,21 +4509,6 @@ static void mvpp2_rxq_offset_set(struct mvpp2_port *port, · 321 unmodified lines
45154509 mvpp2_write(port->priv, MVPP2_RXQ_CONFIG_REG(prxq), val);
45164510 }
45174511
4518−/* Obtain BM cookie information from descriptor */
4519−static u32 mvpp2_bm_cookie_build(struct mvpp2_port *port,
4520− struct mvpp2_rx_desc *rx_desc)
4521−{
4522− int cpu = smp_processor_id();
4523− int pool;
4524−
4525− pool = (mvpp2_rxdesc_status_get(port, rx_desc) &
4526− MVPP2_RXD_BM_POOL_ID_MASK) >>
4527− MVPP2_RXD_BM_POOL_ID_OFFS;
4528−
4529− return ((pool & 0xFF) << MVPP2_BM_COOKIE_POOL_OFFS) |
4530− ((cpu & 0xFF) << MVPP2_BM_COOKIE_CPU_OFFS);
4531−}
4532−
45334512 /* Tx descriptors helper methods */
45344513
45354514 /* Get pointer to next Tx descriptor to be processed (send) by HW */
@@ -4757,7 +4736,7 @@ static void mvpp2_txp_max_tx_size_set(struct mvpp2_port *port) · 221 unmodified lines
47574736 static void mvpp2_rx_pkts_coal_set(struct mvpp2_port *port,
47584737 struct mvpp2_rx_queue *rxq)
47594738 {
4760− int cpu = smp_processor_id();
4739+ int cpu = get_cpu();
47614740
47624741 if (rxq->pkts_coal > MVPP2_OCCUPIED_THRESH_MASK)
47634742 rxq->pkts_coal = MVPP2_OCCUPIED_THRESH_MASK;
@@ -4765,6 +4744,8 @@ static void mvpp2_rx_pkts_coal_set(struct mvpp2_port *port, · 1 unmodified line
47654744 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_NUM_REG, rxq->id);
47664745 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_THRESH_REG,
47674746 rxq->pkts_coal);
4747+
4748+ put_cpu();
47684749 }
47694750
47704751 static u32 mvpp2_usec_to_cycles(u32 usec, unsigned long clk_hz)
@@ -4945,7 +4926,7 @@ static int mvpp2_rxq_init(struct mvpp2_port *port, · 174 unmodified lines
49454926 mvpp2_write(port->priv, MVPP2_RXQ_STATUS_REG(rxq->id), 0);
49464927
49474928 /* Set Rx descriptors queue starting address - indirect access */
4948− cpu = smp_processor_id();
4929+ cpu = get_cpu();
49494930 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_NUM_REG, rxq->id);
49504931 if (port->priv->hw_version == MVPP21)
49514932 rxq_dma = rxq->descs_dma;
@@ -4954,6 +4935,7 @@ static int mvpp2_rxq_init(struct mvpp2_port *port, · 2 unmodified lines
49544935 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_ADDR_REG, rxq_dma);
49554936 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_SIZE_REG, rxq->size);
49564937 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_INDEX_REG, 0);
4938+ put_cpu();
49574939
49584940 /* Set Offset */
49594941 mvpp2_rxq_offset_set(port, rxq->id, NET_SKB_PAD);
@@ -4980,9 +4962,13 @@ static void mvpp2_rxq_drop_pkts(struct mvpp2_port *port, · 20 unmodified lines
49804962
49814963 for (i = 0; i < rx_received; i++) {
49824964 struct mvpp2_rx_desc *rx_desc = mvpp2_rxq_next_desc_get(rxq);
4983− u32 bm = mvpp2_bm_cookie_build(port, rx_desc);
4965+ u32 status = mvpp2_rxdesc_status_get(port, rx_desc);
4966+ int pool;
4967+
4968+ pool = (status & MVPP2_RXD_BM_POOL_ID_MASK) >>
4969+ MVPP2_RXD_BM_POOL_ID_OFFS;
49844970
4985− mvpp2_pool_refill(port, bm,
4971+ mvpp2_pool_refill(port, pool,
49864972 mvpp2_rxdesc_dma_addr_get(port, rx_desc),
49874973 mvpp2_rxdesc_cookie_get(port, rx_desc));
49884974 }
@@ -5012,10 +4998,11 @@ static void mvpp2_rxq_deinit(struct mvpp2_port *port, · 23 unmodified lines
50124998 * free descriptor number
50134999 */
50145000 mvpp2_write(port->priv, MVPP2_RXQ_STATUS_REG(rxq->id), 0);
5015− cpu = smp_processor_id();
5001+ cpu = get_cpu();
50165002 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_NUM_REG, rxq->id);
50175003 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_ADDR_REG, 0);
50185004 mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_SIZE_REG, 0);
5005+ put_cpu();
50195006 }
50205007
50215008 /* Create and initialize a Tx queue */
@@ -5038,7 +5025,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port, · 16 unmodified lines
50385025 txq->last_desc = txq->size - 1;
50395026
50405027 /* Set Tx descriptors queue starting address - indirect access */
5041− cpu = smp_processor_id();
5028+ cpu = get_cpu();
50425029 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_NUM_REG, txq->id);
50435030 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_DESC_ADDR_REG,
50445031 txq->descs_dma);
@@ -5063,6 +5050,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port, · 18 unmodified lines
50635050 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_PREF_BUF_REG,
50645051 MVPP2_PREF_BUF_PTR(desc) | MVPP2_PREF_BUF_SIZE_16 |
50655052 MVPP2_PREF_BUF_THRESH(desc_per_txq / 2));
5053+ put_cpu();
50665054
50675055 /* WRR / EJP configuration - indirect access */
50685056 tx_port_num = mvpp2_egress_port(port);
@@ -5133,10 +5121,11 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port, · 64 unmodified lines
51335121 mvpp2_write(port->priv, MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(txq->id), 0);
51345122
51355123 /* Set Tx descriptors queue starting address and size */
5136− cpu = smp_processor_id();
5124+ cpu = get_cpu();
51375125 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_NUM_REG, txq->id);
51385126 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_DESC_ADDR_REG, 0);
51395127 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_DESC_SIZE_REG, 0);
5128+ put_cpu();
51405129 }
51415130
51425131 /* Cleanup Tx ports */
@@ -5146,7 +5135,7 @@ static void mvpp2_txq_clean(struct mvpp2_port *port, struct mvpp2_tx_queue *txq) · 3 unmodified lines
51465135 int delay, pending, cpu;
51475136 u32 val;
51485137
5149− cpu = smp_processor_id();
5138+ cpu = get_cpu();
51505139 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_NUM_REG, txq->id);
51515140 val = mvpp2_percpu_read(port->priv, cpu, MVPP2_TXQ_PREF_BUF_REG);
51525141 val |= MVPP2_TXQ_DRAIN_EN_MASK;
@@ -5173,6 +5162,7 @@ static void mvpp2_txq_clean(struct mvpp2_port *port, struct mvpp2_tx_queue *txq) · 20 unmodified lines
51735162
51745163 val &= ~MVPP2_TXQ_DRAIN_EN_MASK;
51755164 mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_PREF_BUF_REG, val);
5165+ put_cpu();
51765166
51775167 for_each_present_cpu(cpu) {
51785168 txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
@@ -5420,7 +5410,7 @@ static void mvpp2_rx_csum(struct mvpp2_port *port, u32 status, · 241 unmodified lines
54205410
54215411 /* Reuse skb if possible, or allocate a new skb and add it to BM pool */
54225412 static int mvpp2_rx_refill(struct mvpp2_port *port,
5423− struct mvpp2_bm_pool *bm_pool, u32 bm)
5413+ struct mvpp2_bm_pool *bm_pool, int pool)
54245414 {
54255415 dma_addr_t dma_addr;
54265416 phys_addr_t phys_addr;
@@ -5432,7 +5422,7 @@ static int mvpp2_rx_refill(struct mvpp2_port *port, · 5 unmodified lines
54325422 if (!buf)
54335423 return -ENOMEM;
54345424
5435− mvpp2_pool_refill(port, bm, dma_addr, phys_addr);
5425+ mvpp2_pool_refill(port, pool, dma_addr, phys_addr);
54365426
54375427 return 0;
54385428 }
@@ -5490,7 +5480,7 @@ static int mvpp2_rx(struct mvpp2_port *port, int rx_todo, · 51 unmodified lines
54905480 unsigned int frag_size;
54915481 dma_addr_t dma_addr;
54925482 phys_addr_t phys_addr;
5493− u32 bm, rx_status;
5483+ u32 rx_status;
54945484 int pool, rx_bytes, err;
54955485 void *data;
54965486
@@ -5502,8 +5492,8 @@ static int mvpp2_rx(struct mvpp2_port *port, int rx_todo, · 5 unmodified lines
55025492 phys_addr = mvpp2_rxdesc_cookie_get(port, rx_desc);
55035493 data = (void *)phys_to_virt(phys_addr);
55045494
5505− bm = mvpp2_bm_cookie_build(port, rx_desc);
5506− pool = mvpp2_bm_cookie_pool_get(bm);
5495+ pool = (rx_status & MVPP2_RXD_BM_POOL_ID_MASK) >>
5496+ MVPP2_RXD_BM_POOL_ID_OFFS;
55075497 bm_pool = &port->priv->bm_pools[pool];
55085498
55095499 /* In case of an error, release the requested buffer pointer
@@ -5516,7 +5506,7 @@ err_drop_frame: · 6 unmodified lines
55165506 dev->stats.rx_errors++;
55175507 mvpp2_rx_error(port, rx_desc);
55185508 /* Return the buffer to the pool */
5519− mvpp2_pool_refill(port, bm, dma_addr, phys_addr);
5509+ mvpp2_pool_refill(port, pool, dma_addr, phys_addr);
55205510 continue;
55215511 }
55225512
@@ -5531,7 +5521,7 @@ err_drop_frame: · 8 unmodified lines
55315521 goto err_drop_frame;
55325522 }
55335523
5534− err = mvpp2_rx_refill(port, bm_pool, bm);
5524+ err = mvpp2_rx_refill(port, bm_pool, pool);
55355525 if (err) {
55365526 netdev_err(port->dev, "failed to refill BM pools\n");
55375527 goto err_drop_frame;
drivers/net/ethernet/mellanox/mlx5/core/en.h+5−3
@@ -458,13 +458,15 @@ struct mlx5e_mpw_info { · 457 unmodified lines
458458
459459 struct mlx5e_rx_am_stats {
460460 int ppms; /* packets per msec */
461+ int bpms; /* bytes per msec */
461462 int epms; /* events per msec */
462463 };
463464
464465 struct mlx5e_rx_am_sample {
465− ktime_t time;
466− unsigned int pkt_ctr;
467− u16 event_ctr;
466+ ktime_t time;
467+ u32 pkt_ctr;
468+ u32 byte_ctr;
469+ u16 event_ctr;
468470 };
469471
470472 struct mlx5e_rx_am { /* Adaptive Moderation */
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c+4−4
@@ -1242,11 +1242,11 @@ static int mlx5e_get_ts_info(struct net_device *dev, · 1241 unmodified lines
12421242 SOF_TIMESTAMPING_RX_HARDWARE |
12431243 SOF_TIMESTAMPING_RAW_HARDWARE;
12441244
1245− info->tx_types = (BIT(1) << HWTSTAMP_TX_OFF) |
1246− (BIT(1) << HWTSTAMP_TX_ON);
1245+ info->tx_types = BIT(HWTSTAMP_TX_OFF) |
1246+ BIT(HWTSTAMP_TX_ON);
12471247
1248− info->rx_filters = (BIT(1) << HWTSTAMP_FILTER_NONE) |
1249− (BIT(1) << HWTSTAMP_FILTER_ALL);
1248+ info->rx_filters = BIT(HWTSTAMP_FILTER_NONE) |
1249+ BIT(HWTSTAMP_FILTER_ALL);
12501250
12511251 return 0;
12521252 }
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+2−1
@@ -4241,7 +4241,8 @@ struct net_device *mlx5e_create_netdev(struct mlx5_core_dev *mdev, · 4240 unmodified lines
42414241 return netdev;
42424242
42434243 err_cleanup_nic:
4244− profile->cleanup(priv);
4244+ if (profile->cleanup)
4245+ profile->cleanup(priv);
42454246 free_netdev(netdev);
42464247
42474248 return NULL;
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c+2−0
@@ -791,6 +791,8 @@ static void mlx5e_build_rep_params(struct mlx5_core_dev *mdev, · 790 unmodified lines
791791 params->tx_max_inline = mlx5e_get_max_inline_cap(mdev);
792792 params->num_tc = 1;
793793 params->lro_wqe_sz = MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ;
794+
795+ mlx5_query_min_inline(mdev, &params->tx_min_inline_mode);
794796 }
795797
796798 static void mlx5e_build_rep_netdev(struct net_device *netdev)
drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c+26−19
@@ -183,28 +183,27 @@ static void mlx5e_am_exit_parking(struct mlx5e_rx_am *am) · 182 unmodified lines
183183 mlx5e_am_step(am);
184184 }
185185
186+#define IS_SIGNIFICANT_DIFF(val, ref) \
187+ (((100 * abs((val) - (ref))) / (ref)) > 10) /* more than 10% difference */
188+
186189 static int mlx5e_am_stats_compare(struct mlx5e_rx_am_stats *curr,
187190 struct mlx5e_rx_am_stats *prev)
188191 {
189− int diff;
190−
191− if (!prev->ppms)
192− return curr->ppms ? MLX5E_AM_STATS_BETTER :
192+ if (!prev->bpms)
193+ return curr->bpms ? MLX5E_AM_STATS_BETTER :
193194 MLX5E_AM_STATS_SAME;
194195
195− diff = curr->ppms - prev->ppms;
196− if (((100 * abs(diff)) / prev->ppms) > 10) /* more than 10% diff */
197− return (diff > 0) ? MLX5E_AM_STATS_BETTER :
198− MLX5E_AM_STATS_WORSE;
196+ if (IS_SIGNIFICANT_DIFF(curr->bpms, prev->bpms))
197+ return (curr->bpms > prev->bpms) ? MLX5E_AM_STATS_BETTER :
198+ MLX5E_AM_STATS_WORSE;
199199
200− if (!prev->epms)
201− return curr->epms ? MLX5E_AM_STATS_WORSE :
202− MLX5E_AM_STATS_SAME;
200+ if (IS_SIGNIFICANT_DIFF(curr->ppms, prev->ppms))
201+ return (curr->ppms > prev->ppms) ? MLX5E_AM_STATS_BETTER :
202+ MLX5E_AM_STATS_WORSE;
203203
204− diff = curr->epms - prev->epms;
205− if (((100 * abs(diff)) / prev->epms) > 10) /* more than 10% diff */
206− return (diff < 0) ? MLX5E_AM_STATS_BETTER :
207− MLX5E_AM_STATS_WORSE;
204+ if (IS_SIGNIFICANT_DIFF(curr->epms, prev->epms))
205+ return (curr->epms < prev->epms) ? MLX5E_AM_STATS_BETTER :
206+ MLX5E_AM_STATS_WORSE;
208207
209208 return MLX5E_AM_STATS_SAME;
210209 }
@@ -266,10 +265,13 @@ static void mlx5e_am_sample(struct mlx5e_rq *rq, · 55 unmodified lines
266265 {
267266 s->time = ktime_get();
268267 s->pkt_ctr = rq->stats.packets;
268+ s->byte_ctr = rq->stats.bytes;
269269 s->event_ctr = rq->cq.event_ctr;
270270 }
271271
272272 #define MLX5E_AM_NEVENTS 64
273+#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
274+#define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) & (BIT_ULL(bits) - 1))
273275
274276 static void mlx5e_am_calc_stats(struct mlx5e_rx_am_sample *start,
275277 struct mlx5e_rx_am_sample *end,
@@ -277,13 +279,17 @@ static void mlx5e_am_calc_stats(struct mlx5e_rx_am_sample *start, · 1 unmodified line
277279 {
278280 /* u32 holds up to 71 minutes, should be enough */
279281 u32 delta_us = ktime_us_delta(end->time, start->time);
280− unsigned int npkts = end->pkt_ctr - start->pkt_ctr;
282+ u32 npkts = BIT_GAP(BITS_PER_TYPE(u32), end->pkt_ctr, start->pkt_ctr);
283+ u32 nbytes = BIT_GAP(BITS_PER_TYPE(u32), end->byte_ctr,
284+ start->byte_ctr);
281285
282286 if (!delta_us)
283287 return;
284288
285− curr_stats->ppms = (npkts * USEC_PER_MSEC) / delta_us;
286− curr_stats->epms = (MLX5E_AM_NEVENTS * USEC_PER_MSEC) / delta_us;
289+ curr_stats->ppms = DIV_ROUND_UP(npkts * USEC_PER_MSEC, delta_us);
290+ curr_stats->bpms = DIV_ROUND_UP(nbytes * USEC_PER_MSEC, delta_us);
291+ curr_stats->epms = DIV_ROUND_UP(MLX5E_AM_NEVENTS * USEC_PER_MSEC,
292+ delta_us);
287293 }
288294
289295 void mlx5e_rx_am_work(struct work_struct *work)
@@ -308,7 +314,8 @@ void mlx5e_rx_am(struct mlx5e_rq *rq) · 18 unmodified lines
308314
309315 switch (am->state) {
310316 case MLX5E_AM_MEASURE_IN_PROGRESS:
311− nevents = rq->cq.event_ctr - am->start_sample.event_ctr;
317+ nevents = BIT_GAP(BITS_PER_TYPE(u16), rq->cq.event_ctr,
318+ am->start_sample.event_ctr);
312319 if (nevents < MLX5E_AM_NEVENTS)
313320 break;
314321 mlx5e_am_sample(rq, &end_sample);
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h+2−9
@@ -417,20 +417,13 @@ struct mlx5e_stats { · 416 unmodified lines
417417 };
418418
419419 static const struct counter_desc mlx5e_pme_status_desc[] = {
420− { "module_plug", 0 },
421420 { "module_unplug", 8 },
422421 };
423422
424423 static const struct counter_desc mlx5e_pme_error_desc[] = {
425− { "module_pwr_budget_exd", 0 }, /* power budget exceed */
426− { "module_long_range", 8 }, /* long range for non MLNX cable */
427− { "module_bus_stuck", 16 }, /* bus stuck (I2C or data shorted) */
428− { "module_no_eeprom", 24 }, /* no eeprom/retry time out */
429− { "module_enforce_part", 32 }, /* enforce part number list */
430− { "module_unknown_id", 40 }, /* unknown identifier */
431− { "module_high_temp", 48 }, /* high temperature */
424+ { "module_bus_stuck", 16 }, /* bus stuck (I2C or data shorted) */
425+ { "module_high_temp", 48 }, /* high temperature */
432426 { "module_bad_shorted", 56 }, /* bad or shorted cable/module */
433− { "module_unknown_status", 64 },
434427 };
435428
436429 #endif /* __MLX5_EN_STATS_H__ */
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+0−1
@@ -895,7 +895,6 @@ static struct mlx5_fields fields[] = { · 894 unmodified lines
895895 {MLX5_ACTION_IN_FIELD_OUT_SMAC_15_0, 2, offsetof(struct pedit_headers, eth.h_source[4])},
896896 {MLX5_ACTION_IN_FIELD_OUT_ETHERTYPE, 2, offsetof(struct pedit_headers, eth.h_proto)},
897897
898− {MLX5_ACTION_IN_FIELD_OUT_IP_DSCP, 1, offsetof(struct pedit_headers, ip4.tos)},
899898 {MLX5_ACTION_IN_FIELD_OUT_IP_TTL, 1, offsetof(struct pedit_headers, ip4.ttl)},
900899 {MLX5_ACTION_IN_FIELD_OUT_SIPV4, 4, offsetof(struct pedit_headers, ip4.saddr)},
901900 {MLX5_ACTION_IN_FIELD_OUT_DIPV4, 4, offsetof(struct pedit_headers, ip4.daddr)},
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c+40−37
@@ -906,21 +906,34 @@ static int esw_inline_mode_to_devlink(u8 mlx5_mode, u8 *mode) · 905 unmodified lines
906906 return 0;
907907 }
908908
909−int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode)
909+static int mlx5_devlink_eswitch_check(struct devlink *devlink)
910910 {
911− struct mlx5_core_dev *dev;
912− u16 cur_mlx5_mode, mlx5_mode = 0;
911+ struct mlx5_core_dev *dev = devlink_priv(devlink);
913912
914− dev = devlink_priv(devlink);
913+ if (MLX5_CAP_GEN(dev, port_type) != MLX5_CAP_PORT_TYPE_ETH)
914+ return -EOPNOTSUPP;
915915
916916 if (!MLX5_CAP_GEN(dev, vport_group_manager))
917917 return -EOPNOTSUPP;
918918
919− cur_mlx5_mode = dev->priv.eswitch->mode;
920−
921− if (cur_mlx5_mode == SRIOV_NONE)
919+ if (dev->priv.eswitch->mode == SRIOV_NONE)
922920 return -EOPNOTSUPP;
923921
922+ return 0;
923+}
924+
925+int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode)
926+{
927+ struct mlx5_core_dev *dev = devlink_priv(devlink);
928+ u16 cur_mlx5_mode, mlx5_mode = 0;
929+ int err;
930+
931+ err = mlx5_devlink_eswitch_check(devlink);
932+ if (err)
933+ return err;
934+
935+ cur_mlx5_mode = dev->priv.eswitch->mode;
936+
924937 if (esw_mode_from_devlink(mode, &mlx5_mode))
925938 return -EINVAL;
926939
@@ -937,15 +950,12 @@ int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode) · 10 unmodified lines
937950
938951 int mlx5_devlink_eswitch_mode_get(struct devlink *devlink, u16 *mode)
939952 {
940− struct mlx5_core_dev *dev;
941−
942− dev = devlink_priv(devlink);
943−
944− if (!MLX5_CAP_GEN(dev, vport_group_manager))
945− return -EOPNOTSUPP;
953+ struct mlx5_core_dev *dev = devlink_priv(devlink);
954+ int err;
946955
947− if (dev->priv.eswitch->mode == SRIOV_NONE)
948− return -EOPNOTSUPP;
956+ err = mlx5_devlink_eswitch_check(devlink);
957+ if (err)
958+ return err;
949959
950960 return esw_mode_to_devlink(dev->priv.eswitch->mode, mode);
951961 }
@@ -954,15 +964,12 @@ int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode) · 2 unmodified lines
954964 {
955965 struct mlx5_core_dev *dev = devlink_priv(devlink);
956966 struct mlx5_eswitch *esw = dev->priv.eswitch;
957− int num_vports = esw->enabled_vports;
958967 int err, vport;
959968 u8 mlx5_mode;
960969
961− if (!MLX5_CAP_GEN(dev, vport_group_manager))
962− return -EOPNOTSUPP;
963−
964− if (esw->mode == SRIOV_NONE)
965− return -EOPNOTSUPP;
970+ err = mlx5_devlink_eswitch_check(devlink);
971+ if (err)
972+ return err;
966973
967974 switch (MLX5_CAP_ETH(dev, wqe_inline_mode)) {
968975 case MLX5_CAP_INLINE_MODE_NOT_REQUIRED:
@@ -985,7 +992,7 @@ int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode) · 16 unmodified lines
985992 if (err)
986993 goto out;
987994
988− for (vport = 1; vport < num_vports; vport++) {
995+ for (vport = 1; vport < esw->enabled_vports; vport++) {
989996 err = mlx5_modify_nic_vport_min_inline(dev, vport, mlx5_mode);
990997 if (err) {
991998 esw_warn(dev, "Failed to set min inline on vport %d\n",
@@ -1010,12 +1017,11 @@ int mlx5_devlink_eswitch_inline_mode_get(struct devlink *devlink, u8 *mode) · 18 unmodified lines
10101017 {
10111018 struct mlx5_core_dev *dev = devlink_priv(devlink);
10121019 struct mlx5_eswitch *esw = dev->priv.eswitch;
1020+ int err;
10131021
1014− if (!MLX5_CAP_GEN(dev, vport_group_manager))
1015− return -EOPNOTSUPP;
1016−
1017− if (esw->mode == SRIOV_NONE)
1018− return -EOPNOTSUPP;
1022+ err = mlx5_devlink_eswitch_check(devlink);
1023+ if (err)
1024+ return err;
10191025
10201026 return esw_inline_mode_to_devlink(esw->offloads.inline_mode, mode);
10211027 }
@@ -1062,11 +1068,9 @@ int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink, u8 encap) · 40 unmodified lines
10621068 struct mlx5_eswitch *esw = dev->priv.eswitch;
10631069 int err;
10641070
1065− if (!MLX5_CAP_GEN(dev, vport_group_manager))
1066− return -EOPNOTSUPP;
1067−
1068− if (esw->mode == SRIOV_NONE)
1069− return -EOPNOTSUPP;
1071+ err = mlx5_devlink_eswitch_check(devlink);
1072+ if (err)
1073+ return err;
10701074
10711075 if (encap != DEVLINK_ESWITCH_ENCAP_MODE_NONE &&
10721076 (!MLX5_CAP_ESW_FLOWTABLE_FDB(dev, encap) ||
@@ -1105,12 +1109,11 @@ int mlx5_devlink_eswitch_encap_mode_get(struct devlink *devlink, u8 *encap) · 32 unmodified lines
11051109 {
11061110 struct mlx5_core_dev *dev = devlink_priv(devlink);
11071111 struct mlx5_eswitch *esw = dev->priv.eswitch;
1112+ int err;
11081113
1109− if (!MLX5_CAP_GEN(dev, vport_group_manager))
1110− return -EOPNOTSUPP;
1111−
1112− if (esw->mode == SRIOV_NONE)
1113− return -EOPNOTSUPP;
1114+ err = mlx5_devlink_eswitch_check(devlink);
1115+ if (err)
1116+ return err;
11141117
11151118 *encap = esw->offloads.encap;
11161119 return 0;
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c+1−1
@@ -862,7 +862,7 @@ struct mlx5_flow_table *mlx5_create_vport_flow_table(struct mlx5_flow_namespace · 861 unmodified lines
862862 ft_attr.level = level;
863863 ft_attr.prio = prio;
864864
865− return __mlx5_create_flow_table(ns, &ft_attr, FS_FT_OP_MOD_NORMAL, 0);
865+ return __mlx5_create_flow_table(ns, &ft_attr, FS_FT_OP_MOD_NORMAL, vport);
866866 }
867867
868868 struct mlx5_flow_table*
drivers/net/ethernet/mellanox/mlx5/core/health.c+5−6
@@ -275,10 +275,8 @@ static void poll_health(unsigned long data) · 274 unmodified lines
275275 struct mlx5_core_health *health = &dev->priv.health;
276276 u32 count;
277277
278− if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
279− mod_timer(&health->timer, get_next_poll_jiffies());
280− return;
281− }
278+ if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
279+ goto out;
282280
283281 count = ioread32be(health->health_counter);
284282 if (count == health->prev)
@@ -290,8 +288,6 @@ static void poll_health(unsigned long data) · 5 unmodified lines
290288 if (health->miss_counter == MAX_MISSES) {
291289 dev_err(&dev->pdev->dev, "device's health compromised - reached miss count\n");
292290 print_health_info(dev);
293− } else {
294− mod_timer(&health->timer, get_next_poll_jiffies());
295291 }
296292
297293 if (in_fatal(dev) && !health->sick) {
@@ -305,6 +301,9 @@ static void poll_health(unsigned long data) · 7 unmodified lines
305301 "new health works are not permitted at this stage\n");
306302 spin_unlock(&health->wq_lock);
307303 }
304+
305+out:
306+ mod_timer(&health->timer, get_next_poll_jiffies());
308307 }
309308
310309 void mlx5_start_health_poll(struct mlx5_core_dev *dev)
drivers/net/ethernet/mellanox/mlx5/core/main.c+16−4
@@ -175,8 +175,9 @@ static struct mlx5_profile profile[] = { · 174 unmodified lines
175175 },
176176 };
177177
178−#define FW_INIT_TIMEOUT_MILI 2000
179−#define FW_INIT_WAIT_MS 2
178+#define FW_INIT_TIMEOUT_MILI 2000
179+#define FW_INIT_WAIT_MS 2
180+#define FW_PRE_INIT_TIMEOUT_MILI 10000
180181
181182 static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili)
182183 {
@@ -537,8 +538,10 @@ static int handle_hca_cap(struct mlx5_core_dev *dev) · 354 unmodified lines
537538 /* disable cmdif checksum */
538539 MLX5_SET(cmd_hca_cap, set_hca_cap, cmdif_checksum, 0);
539540
540− /* If the HCA supports 4K UARs use it */
541− if (MLX5_CAP_GEN_MAX(dev, uar_4k))
541+ /* Enable 4K UAR only when HCA supports it and page size is bigger
542+ * than 4K.
543+ */
544+ if (MLX5_CAP_GEN_MAX(dev, uar_4k) && PAGE_SIZE > 4096)
542545 MLX5_SET(cmd_hca_cap, set_hca_cap, uar_4k, 1);
543546
544547 MLX5_SET(cmd_hca_cap, set_hca_cap, log_uar_page_sz, PAGE_SHIFT - 12);
@@ -1011,6 +1014,15 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, · 466 unmodified lines
10111014 */
10121015 dev->state = MLX5_DEVICE_STATE_UP;
10131016
1017+ /* wait for firmware to accept initialization segments configurations
1018+ */
1019+ err = wait_fw_init(dev, FW_PRE_INIT_TIMEOUT_MILI);
1020+ if (err) {
1021+ dev_err(&dev->pdev->dev, "Firmware over %d MS in pre-initializing state, aborting\n",
1022+ FW_PRE_INIT_TIMEOUT_MILI);
1023+ goto out;
1024+ }
1025+
10141026 err = mlx5_cmd_init(dev);
10151027 if (err) {
10161028 dev_err(&pdev->dev, "Failed initializing command interface, aborting\n");
drivers/net/ethernet/qlogic/qed/qed_debug.c+1−1
@@ -2956,7 +2956,7 @@ static u32 qed_grc_dump_ctx_data(struct qed_hwfn *p_hwfn, · 2955 unmodified lines
29562956 qed_wr(p_hwfn,
29572957 p_ptt,
29582958 s_storm_defs[storm_id].cm_ctx_wr_addr,
2959− BIT(9) | lid);
2959+ (i << 9) | lid);
29602960 *(dump_buf + offset) = qed_rd(p_hwfn,
29612961 p_ptt,
29622962 rd_reg_addr);
drivers/net/ethernet/sfc/ef10_sriov.c+0−2
@@ -661,8 +661,6 @@ restore_filters: · 660 unmodified lines
661661 up_write(&vf->efx->filter_sem);
662662 mutex_unlock(&vf->efx->mac_lock);
663663
664− up_write(&vf->efx->filter_sem);
665−
666664 rc2 = efx_net_open(vf->efx->net_dev);
667665 if (rc2)
668666 goto reset_nic;
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c+7−4
@@ -214,13 +214,13 @@ static int dwmac4_wrback_get_tx_timestamp_status(struct dma_desc *p) · 213 unmodified lines
214214 {
215215 /* Context type from W/B descriptor must be zero */
216216 if (le32_to_cpu(p->des3) & TDES3_CONTEXT_TYPE)
217− return -EINVAL;
217+ return 0;
218218
219219 /* Tx Timestamp Status is 1 so des0 and des1'll have valid values */
220220 if (le32_to_cpu(p->des3) & TDES3_TIMESTAMP_STATUS)
221− return 0;
221+ return 1;
222222
223− return 1;
223+ return 0;
224224 }
225225
226226 static inline u64 dwmac4_get_timestamp(void *desc, u32 ats)
@@ -282,7 +282,10 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats) · 55 unmodified lines
282282 }
283283 }
284284 exit:
285− return ret;
285+ if (likely(ret == 0))
286+ return 1;
287+
288+ return 0;
286289 }
287290
288291 static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic,
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+33−12
@@ -434,14 +434,14 @@ static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv, · 433 unmodified lines
434434 return;
435435
436436 /* check tx tstamp status */
437− if (!priv->hw->desc->get_tx_timestamp_status(p)) {
437+ if (priv->hw->desc->get_tx_timestamp_status(p)) {
438438 /* get the valid tstamp */
439439 ns = priv->hw->desc->get_timestamp(p, priv->adv_ts);
440440
441441 memset(&shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps));
442442 shhwtstamp.hwtstamp = ns_to_ktime(ns);
443443
444− netdev_info(priv->dev, "get valid TX hw timestamp %llu\n", ns);
444+ netdev_dbg(priv->dev, "get valid TX hw timestamp %llu\n", ns);
445445 /* pass tstamp to stack */
446446 skb_tstamp_tx(skb, &shhwtstamp);
447447 }
@@ -468,19 +468,19 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p, · 20 unmodified lines
468468 return;
469469
470470 /* Check if timestamp is available */
471− if (!priv->hw->desc->get_rx_timestamp_status(p, priv->adv_ts)) {
471+ if (priv->hw->desc->get_rx_timestamp_status(p, priv->adv_ts)) {
472472 /* For GMAC4, the valid timestamp is from CTX next desc. */
473473 if (priv->plat->has_gmac4)
474474 ns = priv->hw->desc->get_timestamp(np, priv->adv_ts);
475475 else
476476 ns = priv->hw->desc->get_timestamp(p, priv->adv_ts);
477477
478− netdev_info(priv->dev, "get valid RX hw timestamp %llu\n", ns);
478+ netdev_dbg(priv->dev, "get valid RX hw timestamp %llu\n", ns);
479479 shhwtstamp = skb_hwtstamps(skb);
480480 memset(shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps));
481481 shhwtstamp->hwtstamp = ns_to_ktime(ns);
482482 } else {
483− netdev_err(priv->dev, "cannot get RX hw timestamp\n");
483+ netdev_dbg(priv->dev, "cannot get RX hw timestamp\n");
484484 }
485485 }
486486
@@ -546,7 +546,10 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) · 59 unmodified lines
546546 /* PTP v1, UDP, any kind of event packet */
547547 config.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
548548 /* take time stamp for all event messages */
549− snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
549+ if (priv->plat->has_gmac4)
550+ snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1;
551+ else
552+ snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
550553
551554 ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA;
552555 ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA;
@@ -578,7 +581,10 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) · 25 unmodified lines
578581 config.rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT;
579582 ptp_v2 = PTP_TCR_TSVER2ENA;
580583 /* take time stamp for all event messages */
581− snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
584+ if (priv->plat->has_gmac4)
585+ snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1;
586+ else
587+ snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
582588
583589 ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA;
584590 ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA;
@@ -612,7 +618,10 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) · 27 unmodified lines
612618 config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
613619 ptp_v2 = PTP_TCR_TSVER2ENA;
614620 /* take time stamp for all event messages */
615− snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
621+ if (priv->plat->has_gmac4)
622+ snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1;
623+ else
624+ snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
616625
617626 ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA;
618627 ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA;
@@ -2822,7 +2831,6 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) · 2203 unmodified lines
28222831
28232832 tx_q->tx_skbuff_dma[first_entry].buf = des;
28242833 tx_q->tx_skbuff_dma[first_entry].len = skb_headlen(skb);
2825− tx_q->tx_skbuff[first_entry] = skb;
28262834
28272835 first->des0 = cpu_to_le32(des);
28282836
@@ -2856,6 +2864,14 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) · 27 unmodified lines
28562864
28572865 tx_q->tx_skbuff_dma[tx_q->cur_tx].last_segment = true;
28582866
2867+ /* Only the last descriptor gets to point to the skb. */
2868+ tx_q->tx_skbuff[tx_q->cur_tx] = skb;
2869+
2870+ /* We've used all descriptors we need for this skb, however,
2871+ * advance cur_tx so that it references a fresh descriptor.
2872+ * ndo_start_xmit will fill this descriptor the next time it's
2873+ * called and stmmac_tx_clean may clean up to this descriptor.
2874+ */
28592875 tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, DMA_TX_SIZE);
28602876
28612877 if (unlikely(stmmac_tx_avail(priv, queue) <= (MAX_SKB_FRAGS + 1))) {
@@ -2989,8 +3005,6 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 127 unmodified lines
29893005
29903006 first = desc;
29913007
2992− tx_q->tx_skbuff[first_entry] = skb;
2993−
29943008 enh_desc = priv->plat->enh_desc;
29953009 /* To program the descriptors according to the size of the frame */
29963010 if (enh_desc)
@@ -3038,8 +3052,15 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 41 unmodified lines
30383052 skb->len);
30393053 }
30403054
3041− entry = STMMAC_GET_ENTRY(entry, DMA_TX_SIZE);
3055+ /* Only the last descriptor gets to point to the skb. */
3056+ tx_q->tx_skbuff[entry] = skb;
30423057
3058+ /* We've used all descriptors we need for this skb, however,
3059+ * advance cur_tx so that it references a fresh descriptor.
3060+ * ndo_start_xmit will fill this descriptor the next time it's
3061+ * called and stmmac_tx_clean may clean up to this descriptor.
3062+ */
3063+ entry = STMMAC_GET_ENTRY(entry, DMA_TX_SIZE);
30433064 tx_q->cur_tx = entry;
30443065
30453066 if (netif_msg_pktdata(priv)) {
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h+2−1
@@ -59,7 +59,8 @@ · 58 unmodified lines
5959 /* Enable Snapshot for Messages Relevant to Master */
6060 #define PTP_TCR_TSMSTRENA BIT(15)
6161 /* Select PTP packets for Taking Snapshots */
62−#define PTP_TCR_SNAPTYPSEL_1 GENMASK(17, 16)
62+#define PTP_TCR_SNAPTYPSEL_1 BIT(16)
63+#define PTP_GMAC4_TCR_SNAPTYPSEL_1 GENMASK(17, 16)
6364 /* Enable MAC address for PTP Frame Filtering */
6465 #define PTP_TCR_TSENMACADDR BIT(18)
6566
drivers/net/geneve.c+1−1
@@ -1007,7 +1007,7 @@ static void geneve_setup(struct net_device *dev) · 1006 unmodified lines
10071007
10081008 dev->netdev_ops = &geneve_netdev_ops;
10091009 dev->ethtool_ops = &geneve_ethtool_ops;
1010− dev->destructor = free_netdev;
1010+ dev->needs_free_netdev = true;
10111011
10121012 SET_NETDEV_DEVTYPE(dev, &geneve_type);
10131013
drivers/net/gtp.c+1−1
@@ -611,7 +611,7 @@ static const struct net_device_ops gtp_netdev_ops = { · 610 unmodified lines
611611 static void gtp_link_setup(struct net_device *dev)
612612 {
613613 dev->netdev_ops = &gtp_netdev_ops;
614− dev->destructor = free_netdev;
614+ dev->needs_free_netdev = true;
615615
616616 dev->hard_header_len = 0;
617617 dev->addr_len = 0;
drivers/net/hamradio/6pack.c+1−1
@@ -311,7 +311,7 @@ static void sp_setup(struct net_device *dev) · 310 unmodified lines
311311 {
312312 /* Finish setting up the DEVICE info. */
313313 dev->netdev_ops = &sp_netdev_ops;
314− dev->destructor = free_netdev;
314+ dev->needs_free_netdev = true;
315315 dev->mtu = SIXP_MTU;
316316 dev->hard_header_len = AX25_MAX_HEADER_LEN;
317317 dev->header_ops = &ax25_header_ops;
drivers/net/hamradio/bpqether.c+1−1
@@ -476,7 +476,7 @@ static const struct net_device_ops bpq_netdev_ops = { · 475 unmodified lines
476476 static void bpq_setup(struct net_device *dev)
477477 {
478478 dev->netdev_ops = &bpq_netdev_ops;
479− dev->destructor = free_netdev;
479+ dev->needs_free_netdev = true;
480480
481481 memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
482482 memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN);
drivers/net/hyperv/hyperv_net.h+3−2
@@ -171,6 +171,8 @@ struct rndis_device { · 170 unmodified lines
171171 spinlock_t request_lock;
172172 struct list_head req_list;
173173
174+ struct work_struct mcast_work;
175+
174176 u8 hw_mac_adr[ETH_ALEN];
175177 u8 rss_key[NETVSC_HASH_KEYLEN];
176178 u16 ind_table[ITAB_NUM];
@@ -201,6 +203,7 @@ int rndis_filter_open(struct netvsc_device *nvdev); · 24 unmodified lines
201203 int rndis_filter_close(struct netvsc_device *nvdev);
202204 int rndis_filter_device_add(struct hv_device *dev,
203205 struct netvsc_device_info *info);
206+void rndis_filter_update(struct netvsc_device *nvdev);
204207 void rndis_filter_device_remove(struct hv_device *dev,
205208 struct netvsc_device *nvdev);
206209 int rndis_filter_set_rss_param(struct rndis_device *rdev,
@@ -211,7 +214,6 @@ int rndis_filter_receive(struct net_device *ndev, · 4 unmodified lines
211214 struct vmbus_channel *channel,
212215 void *data, u32 buflen);
213216
214−int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter);
215217 int rndis_filter_set_device_mac(struct net_device *ndev, char *mac);
216218
217219 void netvsc_switch_datapath(struct net_device *nv_dev, bool vf);
@@ -696,7 +698,6 @@ struct net_device_context { · 478 unmodified lines
696698 /* list protection */
697699 spinlock_t lock;
698700
699− struct work_struct work;
700701 u32 msg_enable; /* debug level */
701702
702703 u32 tx_checksum_mask;
drivers/net/hyperv/netvsc_drv.c+18−36
@@ -56,37 +56,12 @@ static int debug = -1; · 55 unmodified lines
5656 module_param(debug, int, S_IRUGO);
5757 MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
5858
59−static void do_set_multicast(struct work_struct *w)
60−{
61− struct net_device_context *ndevctx =
62− container_of(w, struct net_device_context, work);
63− struct hv_device *device_obj = ndevctx->device_ctx;
64− struct net_device *ndev = hv_get_drvdata(device_obj);
65− struct netvsc_device *nvdev = rcu_dereference(ndevctx->nvdev);
66− struct rndis_device *rdev;
67−
68− if (!nvdev)
69− return;
70−
71− rdev = nvdev->extension;
72− if (rdev == NULL)
73− return;
74−
75− if (ndev->flags & IFF_PROMISC)
76− rndis_filter_set_packet_filter(rdev,
77− NDIS_PACKET_TYPE_PROMISCUOUS);
78− else
79− rndis_filter_set_packet_filter(rdev,
80− NDIS_PACKET_TYPE_BROADCAST |
81− NDIS_PACKET_TYPE_ALL_MULTICAST |
82− NDIS_PACKET_TYPE_DIRECTED);
83−}
84−
8559 static void netvsc_set_multicast_list(struct net_device *net)
8660 {
8761 struct net_device_context *net_device_ctx = netdev_priv(net);
62+ struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev);
8863
89− schedule_work(&net_device_ctx->work);
64+ rndis_filter_update(nvdev);
9065 }
9166
9267 static int netvsc_open(struct net_device *net)
@@ -123,8 +98,6 @@ static int netvsc_close(struct net_device *net) · 30 unmodified lines
12398
12499 netif_tx_disable(net);
125100
126− /* Make sure netvsc_set_multicast_list doesn't re-enable filter! */
127− cancel_work_sync(&net_device_ctx->work);
128101 ret = rndis_filter_close(nvdev);
129102 if (ret != 0) {
130103 netdev_err(net, "unable to close device (ret %d).\n", ret);
@@ -1028,7 +1001,7 @@ static const struct { · 897 unmodified lines
10281001 static int netvsc_get_sset_count(struct net_device *dev, int string_set)
10291002 {
10301003 struct net_device_context *ndc = netdev_priv(dev);
1031− struct netvsc_device *nvdev = rcu_dereference(ndc->nvdev);
1004+ struct netvsc_device *nvdev = rtnl_dereference(ndc->nvdev);
10321005
10331006 if (!nvdev)
10341007 return -ENODEV;
@@ -1158,11 +1131,22 @@ netvsc_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, · 123 unmodified lines
11581131 }
11591132
11601133 #ifdef CONFIG_NET_POLL_CONTROLLER
1161−static void netvsc_poll_controller(struct net_device *net)
1134+static void netvsc_poll_controller(struct net_device *dev)
11621135 {
1163− /* As netvsc_start_xmit() works synchronous we don't have to
1164− * trigger anything here.
1165− */
1136+ struct net_device_context *ndc = netdev_priv(dev);
1137+ struct netvsc_device *ndev;
1138+ int i;
1139+
1140+ rcu_read_lock();
1141+ ndev = rcu_dereference(ndc->nvdev);
1142+ if (ndev) {
1143+ for (i = 0; i < ndev->num_chn; i++) {
1144+ struct netvsc_channel *nvchan = &ndev->chan_table[i];
1145+
1146+ napi_schedule(&nvchan->napi);
1147+ }
1148+ }
1149+ rcu_read_unlock();
11661150 }
11671151 #endif
11681152
@@ -1552,7 +1536,6 @@ static int netvsc_probe(struct hv_device *dev, · 383 unmodified lines
15521536 hv_set_drvdata(dev, net);
15531537
15541538 INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_link_change);
1555− INIT_WORK(&net_device_ctx->work, do_set_multicast);
15561539
15571540 spin_lock_init(&net_device_ctx->lock);
15581541 INIT_LIST_HEAD(&net_device_ctx->reconfig_events);
@@ -1622,7 +1605,6 @@ static int netvsc_remove(struct hv_device *dev) · 63 unmodified lines
16221605 netif_device_detach(net);
16231606
16241607 cancel_delayed_work_sync(&ndev_ctx->dwork);
1625− cancel_work_sync(&ndev_ctx->work);
16261608
16271609 /*
16281610 * Call to the vsc driver to let it know that the device is being
drivers/net/hyperv/rndis_filter.c+29−1
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131
3232 #include "hyperv_net.h"
3333
34+static void rndis_set_multicast(struct work_struct *w);
3435
3536 #define RNDIS_EXT_LEN PAGE_SIZE
3637 struct rndis_request {
@@ -76,6 +77,7 @@ static struct rndis_device *get_rndis_device(void) · 39 unmodified lines
7677 spin_lock_init(&device->request_lock);
7778
7879 INIT_LIST_HEAD(&device->req_list);
80+ INIT_WORK(&device->mcast_work, rndis_set_multicast);
7981
8082 device->state = RNDIS_DEV_UNINITIALIZED;
8183
@@ -815,7 +817,8 @@ static int rndis_filter_query_link_speed(struct rndis_device *dev) · 733 unmodified lines
815817 return ret;
816818 }
817819
818−int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter)
820+static int rndis_filter_set_packet_filter(struct rndis_device *dev,
821+ u32 new_filter)
819822 {
820823 struct rndis_request *request;
821824 struct rndis_set_request *set;
@@ -846,6 +849,28 @@ int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter) · 24 unmodified lines
846849 return ret;
847850 }
848851
852+static void rndis_set_multicast(struct work_struct *w)
853+{
854+ struct rndis_device *rdev
855+ = container_of(w, struct rndis_device, mcast_work);
856+
857+ if (rdev->ndev->flags & IFF_PROMISC)
858+ rndis_filter_set_packet_filter(rdev,
859+ NDIS_PACKET_TYPE_PROMISCUOUS);
860+ else
861+ rndis_filter_set_packet_filter(rdev,
862+ NDIS_PACKET_TYPE_BROADCAST |
863+ NDIS_PACKET_TYPE_ALL_MULTICAST |
864+ NDIS_PACKET_TYPE_DIRECTED);
865+}
866+
867+void rndis_filter_update(struct netvsc_device *nvdev)
868+{
869+ struct rndis_device *rdev = nvdev->extension;
870+
871+ schedule_work(&rdev->mcast_work);
872+}
873+
849874 static int rndis_filter_init_device(struct rndis_device *dev)
850875 {
851876 struct rndis_request *request;
@@ -973,6 +998,9 @@ static int rndis_filter_close_device(struct rndis_device *dev) · 121 unmodified lines
973998 if (dev->state != RNDIS_DEV_DATAINITIALIZED)
974999 return 0;
9751000
1001+ /* Make sure rndis_set_multicast doesn't re-enable filter! */
1002+ cancel_work_sync(&dev->mcast_work);
1003+
9761004 ret = rndis_filter_set_packet_filter(dev, 0);
9771005 if (ret == -ENODEV)
9781006 ret = 0;
drivers/net/ifb.c+2−2
@@ -207,7 +207,6 @@ static void ifb_dev_free(struct net_device *dev) · 206 unmodified lines
207207 __skb_queue_purge(&txp->tq);
208208 }
209209 kfree(dp->tx_private);
210− free_netdev(dev);
211210 }
212211
213212 static void ifb_setup(struct net_device *dev)
@@ -230,7 +229,8 @@ static void ifb_setup(struct net_device *dev) · 16 unmodified lines
230229 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
231230 netif_keep_dst(dev);
232231 eth_hw_addr_random(dev);
233− dev->destructor = ifb_dev_free;
232+ dev->needs_free_netdev = true;
233+ dev->priv_destructor = ifb_dev_free;
234234 }
235235
236236 static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev)
drivers/net/ipvlan/ipvlan_main.c+1−1
@@ -632,7 +632,7 @@ void ipvlan_link_setup(struct net_device *dev) · 631 unmodified lines
632632 dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
633633 dev->priv_flags |= IFF_UNICAST_FLT | IFF_NO_QUEUE;
634634 dev->netdev_ops = &ipvlan_netdev_ops;
635− dev->destructor = free_netdev;
635+ dev->needs_free_netdev = true;
636636 dev->header_ops = &ipvlan_header_ops;
637637 dev->ethtool_ops = &ipvlan_ethtool_ops;
638638 }
drivers/net/loopback.c+2−2
@@ -159,7 +159,6 @@ static void loopback_dev_free(struct net_device *dev) · 158 unmodified lines
159159 {
160160 dev_net(dev)->loopback_dev = NULL;
161161 free_percpu(dev->lstats);
162− free_netdev(dev);
163162 }
164163
165164 static const struct net_device_ops loopback_ops = {
@@ -196,7 +195,8 @@ static void loopback_setup(struct net_device *dev) · 30 unmodified lines
196195 dev->ethtool_ops = &loopback_ethtool_ops;
197196 dev->header_ops = &eth_header_ops;
198197 dev->netdev_ops = &loopback_ops;
199− dev->destructor = loopback_dev_free;
198+ dev->needs_free_netdev = true;
199+ dev->priv_destructor = loopback_dev_free;
200200 }
201201
202202 /* Setup and register the loopback device. */
drivers/net/macsec.c+2−2
@@ -2996,7 +2996,6 @@ static void macsec_free_netdev(struct net_device *dev) · 2995 unmodified lines
29962996 free_percpu(macsec->secy.tx_sc.stats);
29972997
29982998 dev_put(real_dev);
2999− free_netdev(dev);
30002999 }
30013000
30023001 static void macsec_setup(struct net_device *dev)
@@ -3006,7 +3005,8 @@ static void macsec_setup(struct net_device *dev) · 3 unmodified lines
30063005 dev->max_mtu = ETH_MAX_MTU;
30073006 dev->priv_flags |= IFF_NO_QUEUE;
30083007 dev->netdev_ops = &macsec_netdev_ops;
3009− dev->destructor = macsec_free_netdev;
3008+ dev->needs_free_netdev = true;
3009+ dev->priv_destructor = macsec_free_netdev;
30103010 SET_NETDEV_DEVTYPE(dev, &macsec_type);
30113011
30123012 eth_zero_addr(dev->broadcast);
drivers/net/macvlan.c+1−1
@@ -1092,7 +1092,7 @@ void macvlan_common_setup(struct net_device *dev) · 1091 unmodified lines
10921092 netif_keep_dst(dev);
10931093 dev->priv_flags |= IFF_UNICAST_FLT;
10941094 dev->netdev_ops = &macvlan_netdev_ops;
1095− dev->destructor = free_netdev;
1095+ dev->needs_free_netdev = true;
10961096 dev->header_ops = &macvlan_hard_header_ops;
10971097 dev->ethtool_ops = &macvlan_ethtool_ops;
10981098 }
drivers/net/netconsole.c+1−1
@@ -358,7 +358,7 @@ static ssize_t enabled_store(struct config_item *item, · 357 unmodified lines
358358 if (err)
359359 goto out_unlock;
360360
361− pr_info("netconsole: network logging started\n");
361+ pr_info("network logging started\n");
362362 } else { /* false */
363363 /* We need to disable the netconsole before cleaning it up
364364 * otherwise we might end up in write_msg() with
drivers/net/nlmon.c+1−1
@@ -113,7 +113,7 @@ static void nlmon_setup(struct net_device *dev) · 112 unmodified lines
113113
114114 dev->netdev_ops = &nlmon_ops;
115115 dev->ethtool_ops = &nlmon_ethtool_ops;
116− dev->destructor = free_netdev;
116+ dev->needs_free_netdev = true;
117117
118118 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST |
119119 NETIF_F_HIGHDMA | NETIF_F_LLTX;
drivers/net/phy/Kconfig+1−0
@@ -127,6 +127,7 @@ config MDIO_THUNDER · 126 unmodified lines
127127 tristate "ThunderX SOCs MDIO buses"
128128 depends on 64BIT
129129 depends on PCI
130+ depends on !(MDIO_DEVICE=y && PHYLIB=m)
130131 select MDIO_CAVIUM
131132 help
132133 This driver supports the MDIO interfaces found on Cavium
drivers/net/phy/phy.c+2−0
@@ -54,6 +54,8 @@ static const char *phy_speed_to_str(int speed) · 53 unmodified lines
5454 return "5Gbps";
5555 case SPEED_10000:
5656 return "10Gbps";
57+ case SPEED_14000:
58+ return "14Gbps";
5759 case SPEED_20000:
5860 return "20Gbps";
5961 case SPEED_25000:
drivers/net/slip/slip.c+3−4
@@ -629,7 +629,7 @@ static void sl_uninit(struct net_device *dev) · 628 unmodified lines
629629 static void sl_free_netdev(struct net_device *dev)
630630 {
631631 int i = dev->base_addr;
632− free_netdev(dev);
632+
633633 slip_devs[i] = NULL;
634634 }
635635
@@ -651,7 +651,8 @@ static const struct net_device_ops sl_netdev_ops = { · 15 unmodified lines
651651 static void sl_setup(struct net_device *dev)
652652 {
653653 dev->netdev_ops = &sl_netdev_ops;
654− dev->destructor = sl_free_netdev;
654+ dev->needs_free_netdev = true;
655+ dev->priv_destructor = sl_free_netdev;
655656
656657 dev->hard_header_len = 0;
657658 dev->addr_len = 0;
@@ -1369,8 +1370,6 @@ static void __exit slip_exit(void) · 711 unmodified lines
13691370 if (sl->tty) {
13701371 printk(KERN_ERR "%s: tty discipline still running\n",
13711372 dev->name);
1372− /* Intentionally leak the control block. */
1373− dev->destructor = NULL;
13741373 }
13751374
13761375 unregister_netdev(dev);
drivers/net/team/team.c+2−2
@@ -1643,7 +1643,6 @@ static void team_destructor(struct net_device *dev) · 1642 unmodified lines
16431643 struct team *team = netdev_priv(dev);
16441644
16451645 free_percpu(team->pcpu_stats);
1646− free_netdev(dev);
16471646 }
16481647
16491648 static int team_open(struct net_device *dev)
@@ -2079,7 +2078,8 @@ static void team_setup(struct net_device *dev) · 429 unmodified lines
20792078
20802079 dev->netdev_ops = &team_netdev_ops;
20812080 dev->ethtool_ops = &team_ethtool_ops;
2082− dev->destructor = team_destructor;
2081+ dev->needs_free_netdev = true;
2082+ dev->priv_destructor = team_destructor;
20832083 dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
20842084 dev->priv_flags |= IFF_NO_QUEUE;
20852085 dev->priv_flags |= IFF_TEAM;
drivers/net/tun.c+2−2
@@ -1560,7 +1560,6 @@ static void tun_free_netdev(struct net_device *dev) · 1559 unmodified lines
15601560 free_percpu(tun->pcpu_stats);
15611561 tun_flow_uninit(tun);
15621562 security_tun_dev_free_security(tun->security);
1563− free_netdev(dev);
15641563 }
15651564
15661565 static void tun_setup(struct net_device *dev)
@@ -1571,7 +1570,8 @@ static void tun_setup(struct net_device *dev) · 4 unmodified lines
15711570 tun->group = INVALID_GID;
15721571
15731572 dev->ethtool_ops = &tun_ethtool_ops;
1574− dev->destructor = tun_free_netdev;
1573+ dev->needs_free_netdev = true;
1574+ dev->priv_destructor = tun_free_netdev;
15751575 /* We prefer our own queue length */
15761576 dev->tx_queue_len = TUN_READQ_SIZE;
15771577 }
drivers/net/usb/cdc-phonet.c+1−1
@@ -298,7 +298,7 @@ static void usbpn_setup(struct net_device *dev) · 297 unmodified lines
298298 dev->addr_len = 1;
299299 dev->tx_queue_len = 3;
300300
301− dev->destructor = free_netdev;
301+ dev->needs_free_netdev = true;
302302 }
303303
304304 /*
drivers/net/usb/qmi_wwan.c+5−1
@@ -123,7 +123,7 @@ static void qmimux_setup(struct net_device *dev) · 122 unmodified lines
123123 dev->addr_len = 0;
124124 dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
125125 dev->netdev_ops = &qmimux_netdev_ops;
126− dev->destructor = free_netdev;
126+ dev->needs_free_netdev = true;
127127 }
128128
129129 static struct net_device *qmimux_find_dev(struct usbnet *dev, u8 mux_id)
@@ -1192,6 +1192,8 @@ static const struct usb_device_id products[] = { · 1062 unmodified lines
11921192 {QMI_FIXED_INTF(0x1199, 0x9056, 8)}, /* Sierra Wireless Modem */
11931193 {QMI_FIXED_INTF(0x1199, 0x9057, 8)},
11941194 {QMI_FIXED_INTF(0x1199, 0x9061, 8)}, /* Sierra Wireless Modem */
1195+ {QMI_FIXED_INTF(0x1199, 0x9063, 8)}, /* Sierra Wireless EM7305 */
1196+ {QMI_FIXED_INTF(0x1199, 0x9063, 10)}, /* Sierra Wireless EM7305 */
11951197 {QMI_FIXED_INTF(0x1199, 0x9071, 8)}, /* Sierra Wireless MC74xx */
11961198 {QMI_FIXED_INTF(0x1199, 0x9071, 10)}, /* Sierra Wireless MC74xx */
11971199 {QMI_FIXED_INTF(0x1199, 0x9079, 8)}, /* Sierra Wireless EM74xx */
@@ -1206,6 +1208,8 @@ static const struct usb_device_id products[] = { · 8 unmodified lines
12061208 {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */
12071209 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
12081210 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */
1211+ {QMI_FIXED_INTF(0x1c9e, 0x9801, 3)}, /* Telewell TW-3G HSPA+ */
1212+ {QMI_FIXED_INTF(0x1c9e, 0x9803, 4)}, /* Telewell TW-3G HSPA+ */
12091213 {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */
12101214 {QMI_FIXED_INTF(0x0b3c, 0xc000, 4)}, /* Olivetti Olicard 100 */
12111215 {QMI_FIXED_INTF(0x0b3c, 0xc001, 4)}, /* Olivetti Olicard 120 */
drivers/net/usb/r8152.c+2−0
@@ -4368,6 +4368,8 @@ static u8 rtl_get_version(struct usb_interface *intf) · 4367 unmodified lines
43684368 break;
43694369 }
43704370
4371+ dev_dbg(&intf->dev, "Detected version 0x%04x\n", version);
4372+
43714373 return version;
43724374 }
43734375
drivers/net/veth.c+2−2
@@ -222,7 +222,6 @@ static int veth_dev_init(struct net_device *dev) · 221 unmodified lines
222222 static void veth_dev_free(struct net_device *dev)
223223 {
224224 free_percpu(dev->vstats);
225− free_netdev(dev);
226225 }
227226
228227 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -317,7 +316,8 @@ static void veth_setup(struct net_device *dev) · 88 unmodified lines
317316 NETIF_F_HW_VLAN_STAG_TX |
318317 NETIF_F_HW_VLAN_CTAG_RX |
319318 NETIF_F_HW_VLAN_STAG_RX);
320− dev->destructor = veth_dev_free;
319+ dev->needs_free_netdev = true;
320+ dev->priv_destructor = veth_dev_free;
321321 dev->max_mtu = ETH_MAX_MTU;
322322
323323 dev->hw_features = VETH_FEATURES;
drivers/net/vrf.c+33−5
@@ -36,12 +36,14 @@ · 35 unmodified lines
3636 #include <net/addrconf.h>
3737 #include <net/l3mdev.h>
3838 #include <net/fib_rules.h>
39+#include <net/netns/generic.h>
3940
4041 #define DRV_NAME "vrf"
4142 #define DRV_VERSION "1.0"
4243
4344 #define FIB_RULE_PREF 1000 /* default preference for FIB rules */
44−static bool add_fib_rules = true;
45+
46+static unsigned int vrf_net_id;
4547
4648 struct net_vrf {
4749 struct rtable __rcu *rth;
@@ -1348,7 +1350,7 @@ static void vrf_setup(struct net_device *dev) · 1300 unmodified lines
13481350 dev->netdev_ops = &vrf_netdev_ops;
13491351 dev->l3mdev_ops = &vrf_l3mdev_ops;
13501352 dev->ethtool_ops = &vrf_ethtool_ops;
1351− dev->destructor = free_netdev;
1353+ dev->needs_free_netdev = true;
13521354
13531355 /* Fill in device structure with ethernet-generic values. */
13541356 eth_hw_addr_random(dev);
@@ -1394,6 +1396,8 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev, · 39 unmodified lines
13941396 struct nlattr *tb[], struct nlattr *data[])
13951397 {
13961398 struct net_vrf *vrf = netdev_priv(dev);
1399+ bool *add_fib_rules;
1400+ struct net *net;
13971401 int err;
13981402
13991403 if (!data || !data[IFLA_VRF_TABLE])
@@ -1409,13 +1413,15 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev, · 9 unmodified lines
14091413 if (err)
14101414 goto out;
14111415
1412− if (add_fib_rules) {
1416+ net = dev_net(dev);
1417+ add_fib_rules = net_generic(net, vrf_net_id);
1418+ if (*add_fib_rules) {
14131419 err = vrf_add_fib_rules(dev);
14141420 if (err) {
14151421 unregister_netdevice(dev);
14161422 goto out;
14171423 }
1418− add_fib_rules = false;
1424+ *add_fib_rules = false;
14191425 }
14201426
14211427 out:
@@ -1498,16 +1504,38 @@ static struct notifier_block vrf_notifier_block __read_mostly = { · 76 unmodified lines
14981504 .notifier_call = vrf_device_event,
14991505 };
15001506
1507+/* Initialize per network namespace state */
1508+static int __net_init vrf_netns_init(struct net *net)
1509+{
1510+ bool *add_fib_rules = net_generic(net, vrf_net_id);
1511+
1512+ *add_fib_rules = true;
1513+
1514+ return 0;
1515+}
1516+
1517+static struct pernet_operations vrf_net_ops __net_initdata = {
1518+ .init = vrf_netns_init,
1519+ .id = &vrf_net_id,
1520+ .size = sizeof(bool),
1521+};
1522+
15011523 static int __init vrf_init_module(void)
15021524 {
15031525 int rc;
15041526
15051527 register_netdevice_notifier(&vrf_notifier_block);
15061528
1507− rc = rtnl_link_register(&vrf_link_ops);
1529+ rc = register_pernet_subsys(&vrf_net_ops);
15081530 if (rc < 0)
15091531 goto error;
15101532
1533+ rc = rtnl_link_register(&vrf_link_ops);
1534+ if (rc < 0) {
1535+ unregister_pernet_subsys(&vrf_net_ops);
1536+ goto error;
1537+ }
1538+
15111539 return 0;
15121540
15131541 error:
drivers/net/vsockmon.c+1−1
@@ -135,7 +135,7 @@ static void vsockmon_setup(struct net_device *dev) · 134 unmodified lines
135135
136136 dev->netdev_ops = &vsockmon_ops;
137137 dev->ethtool_ops = &vsockmon_ethtool_ops;
138− dev->destructor = free_netdev;
138+ dev->needs_free_netdev = true;
139139
140140 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST |
141141 NETIF_F_HIGHDMA | NETIF_F_LLTX;
drivers/net/vxlan.c+1−1
@@ -2611,7 +2611,7 @@ static void vxlan_setup(struct net_device *dev) · 2610 unmodified lines
26112611 eth_hw_addr_random(dev);
26122612 ether_setup(dev);
26132613
2614− dev->destructor = free_netdev;
2614+ dev->needs_free_netdev = true;
26152615 SET_NETDEV_DEVTYPE(dev, &vxlan_type);
26162616
26172617 dev->features |= NETIF_F_LLTX;
drivers/net/wan/dlci.c+1−1
@@ -475,7 +475,7 @@ static void dlci_setup(struct net_device *dev) · 474 unmodified lines
475475 dev->flags = 0;
476476 dev->header_ops = &dlci_header_ops;
477477 dev->netdev_ops = &dlci_netdev_ops;
478− dev->destructor = free_netdev;
478+ dev->needs_free_netdev = true;
479479
480480 dlp->receive = dlci_receive;
481481
drivers/net/wan/hdlc_fr.c+1−1
@@ -1106,7 +1106,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) · 1105 unmodified lines
11061106 return -EIO;
11071107 }
11081108
1109− dev->destructor = free_netdev;
1109+ dev->needs_free_netdev = true;
11101110 *get_dev_p(pvc, type) = dev;
11111111 if (!used) {
11121112 state(hdlc)->dce_changed = 1;
drivers/net/wan/lapbether.c+1−1
@@ -306,7 +306,7 @@ static const struct net_device_ops lapbeth_netdev_ops = { · 305 unmodified lines
306306 static void lapbeth_setup(struct net_device *dev)
307307 {
308308 dev->netdev_ops = &lapbeth_netdev_ops;
309− dev->destructor = free_netdev;
309+ dev->needs_free_netdev = true;
310310 dev->type = ARPHRD_X25;
311311 dev->hard_header_len = 3;
312312 dev->mtu = 1000;
drivers/net/wireless/ath/ath6kl/main.c+1−1
@@ -1287,7 +1287,7 @@ void init_netdev(struct net_device *dev) · 1286 unmodified lines
12871287 struct ath6kl *ar = ath6kl_priv(dev);
12881288
12891289 dev->netdev_ops = &ath6kl_netdev_ops;
1290− dev->destructor = free_netdev;
1290+ dev->needs_free_netdev = true;
12911291 dev->watchdog_timeo = ATH6KL_TX_TIMEOUT;
12921292
12931293 dev->needed_headroom = ETH_HLEN;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c+0−1
@@ -5225,7 +5225,6 @@ void brcmf_cfg80211_free_netdev(struct net_device *ndev) · 5224 unmodified lines
52255225
52265226 if (vif)
52275227 brcmf_free_vif(vif);
5228− free_netdev(ndev);
52295228 }
52305229
52315230 static bool brcmf_is_linkup(const struct brcmf_event_msg *e)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c+2−1
@@ -624,7 +624,8 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, · 623 unmodified lines
624624 if (!ndev)
625625 return ERR_PTR(-ENOMEM);
626626
627− ndev->destructor = brcmf_cfg80211_free_netdev;
627+ ndev->needs_free_netdev = true;
628+ ndev->priv_destructor = brcmf_cfg80211_free_netdev;
628629 ifp = netdev_priv(ndev);
629630 ifp->ndev = ndev;
630631 /* store mapping ifidx to bsscfgidx */
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c+17−18
@@ -442,7 +442,7 @@ struct brcmf_fw { · 441 unmodified lines
442442 const char *nvram_name;
443443 u16 domain_nr;
444444 u16 bus_nr;
445− void (*done)(struct device *dev, const struct firmware *fw,
445+ void (*done)(struct device *dev, int err, const struct firmware *fw,
446446 void *nvram_image, u32 nvram_len);
447447 };
448448
@@ -477,52 +477,51 @@ static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx) · 28 unmodified lines
477477 if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
478478 goto fail;
479479
480− fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
480+ fwctx->done(fwctx->dev, 0, fwctx->code, nvram, nvram_length);
481481 kfree(fwctx);
482482 return;
483483
484484 fail:
485485 brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
486486 release_firmware(fwctx->code);
487− device_release_driver(fwctx->dev);
487+ fwctx->done(fwctx->dev, -ENOENT, NULL, NULL, 0);
488488 kfree(fwctx);
489489 }
490490
491491 static void brcmf_fw_request_code_done(const struct firmware *fw, void *ctx)
492492 {
493493 struct brcmf_fw *fwctx = ctx;
494− int ret;
494+ int ret = 0;
495495
496496 brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev));
497− if (!fw)
497+ if (!fw) {
498+ ret = -ENOENT;
498499 goto fail;
499−
500− /* only requested code so done here */
501− if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
502− fwctx->done(fwctx->dev, fw, NULL, 0);
503− kfree(fwctx);
504− return;
505500 }
501+ /* only requested code so done here */
502+ if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM))
503+ goto done;
504+
506505 fwctx->code = fw;
507506 ret = request_firmware_nowait(THIS_MODULE, true, fwctx->nvram_name,
508507 fwctx->dev, GFP_KERNEL, fwctx,
509508 brcmf_fw_request_nvram_done);
510509
511− if (!ret)
512− return;
513−
514− brcmf_fw_request_nvram_done(NULL, fwctx);
510+ /* pass NULL to nvram callback for bcm47xx fallback */
511+ if (ret)
512+ brcmf_fw_request_nvram_done(NULL, fwctx);
515513 return;
516514
517515 fail:
518516 brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
519− device_release_driver(fwctx->dev);
517+done:
518+ fwctx->done(fwctx->dev, ret, fw, NULL, 0);
520519 kfree(fwctx);
521520 }
522521
523522 int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags,
524523 const char *code, const char *nvram,
525− void (*fw_cb)(struct device *dev,
524+ void (*fw_cb)(struct device *dev, int err,
526525 const struct firmware *fw,
527526 void *nvram_image, u32 nvram_len),
528527 u16 domain_nr, u16 bus_nr)
@@ -555,7 +554,7 @@ int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags, · 26 unmodified lines
555554
556555 int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
557556 const char *code, const char *nvram,
558− void (*fw_cb)(struct device *dev,
557+ void (*fw_cb)(struct device *dev, int err,
559558 const struct firmware *fw,
560559 void *nvram_image, u32 nvram_len))
561560 {
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h+2−2
@@ -73,13 +73,13 @@ void brcmf_fw_nvram_free(void *nvram); · 72 unmodified lines
7373 */
7474 int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags,
7575 const char *code, const char *nvram,
76− void (*fw_cb)(struct device *dev,
76+ void (*fw_cb)(struct device *dev, int err,
7777 const struct firmware *fw,
7878 void *nvram_image, u32 nvram_len),
7979 u16 domain_nr, u16 bus_nr);
8080 int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
8181 const char *code, const char *nvram,
82− void (*fw_cb)(struct device *dev,
82+ void (*fw_cb)(struct device *dev, int err,
8383 const struct firmware *fw,
8484 void *nvram_image, u32 nvram_len));
8585
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c+1−1
@@ -2145,7 +2145,7 @@ void brcmf_fws_add_interface(struct brcmf_if *ifp) · 2144 unmodified lines
21452145 struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr);
21462146 struct brcmf_fws_mac_descriptor *entry;
21472147
2148− if (!ifp->ndev || fws->fcmode == BRCMF_FWS_FCMODE_NONE)
2148+ if (!ifp->ndev || !brcmf_fws_queue_skbs(fws))
21492149 return;
21502150
21512151 entry = &fws->desc.iface[ifp->ifidx];
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c+12−5
@@ -1650,16 +1650,23 @@ static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = { · 1649 unmodified lines
16501650 .write32 = brcmf_pcie_buscore_write32,
16511651 };
16521652
1653−static void brcmf_pcie_setup(struct device *dev, const struct firmware *fw,
1653+static void brcmf_pcie_setup(struct device *dev, int ret,
1654+ const struct firmware *fw,
16541655 void *nvram, u32 nvram_len)
16551656 {
1656− struct brcmf_bus *bus = dev_get_drvdata(dev);
1657− struct brcmf_pciedev *pcie_bus_dev = bus->bus_priv.pcie;
1658− struct brcmf_pciedev_info *devinfo = pcie_bus_dev->devinfo;
1657+ struct brcmf_bus *bus;
1658+ struct brcmf_pciedev *pcie_bus_dev;
1659+ struct brcmf_pciedev_info *devinfo;
16591660 struct brcmf_commonring **flowrings;
1660− int ret;
16611661 u32 i;
16621662
1663+ /* check firmware loading result */
1664+ if (ret)
1665+ goto fail;
1666+
1667+ bus = dev_get_drvdata(dev);
1668+ pcie_bus_dev = bus->bus_priv.pcie;
1669+ devinfo = pcie_bus_dev->devinfo;
16631670 brcmf_pcie_attach(devinfo);
16641671
16651672 /* Some of the firmwares have the size of the memory of the device
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c+12−6
@@ -3982,21 +3982,26 @@ static const struct brcmf_bus_ops brcmf_sdio_bus_ops = { · 3981 unmodified lines
39823982 .get_memdump = brcmf_sdio_bus_get_memdump,
39833983 };
39843984
3985−static void brcmf_sdio_firmware_callback(struct device *dev,
3985+static void brcmf_sdio_firmware_callback(struct device *dev, int err,
39863986 const struct firmware *code,
39873987 void *nvram, u32 nvram_len)
39883988 {
3989− struct brcmf_bus *bus_if = dev_get_drvdata(dev);
3990− struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
3991− struct brcmf_sdio *bus = sdiodev->bus;
3992− int err = 0;
3989+ struct brcmf_bus *bus_if;
3990+ struct brcmf_sdio_dev *sdiodev;
3991+ struct brcmf_sdio *bus;
39933992 u8 saveclk;
39943993
3995− brcmf_dbg(TRACE, "Enter: dev=%s\n", dev_name(dev));
3994+ brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err);
3995+ bus_if = dev_get_drvdata(dev);
3996+ sdiodev = bus_if->bus_priv.sdio;
3997+ if (err)
3998+ goto fail;
39963999
39974000 if (!bus_if->drvr)
39984001 return;
39994002
4003+ bus = sdiodev->bus;
4004+
40004005 /* try to download image and nvram to the dongle */
40014006 bus->alp_only = true;
40024007 err = brcmf_sdio_download_firmware(bus, code, nvram, nvram_len);
@@ -4083,6 +4088,7 @@ release: · 80 unmodified lines
40834088 fail:
40844089 brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err);
40854090 device_release_driver(dev);
4091+ device_release_driver(&sdiodev->func[2]->dev);
40864092 }
40874093
40884094 struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c+5−4
@@ -1159,17 +1159,18 @@ fail: · 1158 unmodified lines
11591159 return ret;
11601160 }
11611161
1162−static void brcmf_usb_probe_phase2(struct device *dev,
1162+static void brcmf_usb_probe_phase2(struct device *dev, int ret,
11631163 const struct firmware *fw,
11641164 void *nvram, u32 nvlen)
11651165 {
11661166 struct brcmf_bus *bus = dev_get_drvdata(dev);
1167− struct brcmf_usbdev_info *devinfo;
1168− int ret;
1167+ struct brcmf_usbdev_info *devinfo = bus->bus_priv.usb->devinfo;
1168+
1169+ if (ret)
1170+ goto error;
11691171
11701172 brcmf_dbg(USB, "Start fw downloading\n");
11711173
1172− devinfo = bus->bus_priv.usb->devinfo;
11731174 ret = check_file(fw->data);
11741175 if (ret < 0) {
11751176 brcmf_err("invalid firmware\n");
drivers/net/wireless/intersil/hostap/hostap_main.c+1−1
@@ -73,7 +73,7 @@ struct net_device * hostap_add_interface(struct local_info *local, · 72 unmodified lines
7373 dev->mem_end = mdev->mem_end;
7474
7575 hostap_setup_dev(dev, local, type);
76− dev->destructor = free_netdev;
76+ dev->needs_free_netdev = true;
7777
7878 sprintf(dev->name, "%s%s", prefix, name);
7979 if (!rtnl_locked)
drivers/net/wireless/mac80211_hwsim.c+1−1
@@ -2861,7 +2861,7 @@ static const struct net_device_ops hwsim_netdev_ops = { · 2860 unmodified lines
28612861 static void hwsim_mon_setup(struct net_device *dev)
28622862 {
28632863 dev->netdev_ops = &hwsim_netdev_ops;
2864− dev->destructor = free_netdev;
2864+ dev->needs_free_netdev = true;
28652865 ether_setup(dev);
28662866 dev->priv_flags |= IFF_NO_QUEUE;
28672867 dev->type = ARPHRD_IEEE80211_RADIOTAP;
drivers/net/wireless/marvell/mwifiex/main.c+1−1
@@ -1280,7 +1280,7 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv, · 1279 unmodified lines
12801280 struct net_device *dev)
12811281 {
12821282 dev->netdev_ops = &mwifiex_netdev_ops;
1283− dev->destructor = free_netdev;
1283+ dev->needs_free_netdev = true;
12841284 /* Initialize private structure */
12851285 priv->current_key_index = 0;
12861286 priv->media_connected = false;
drivers/ntb/hw/intel/ntb_hw_intel.c+1−1
@@ -2878,7 +2878,7 @@ static const struct intel_ntb_reg skx_reg = { · 2877 unmodified lines
28782878 .link_is_up = xeon_link_is_up,
28792879 .db_ioread = skx_db_ioread,
28802880 .db_iowrite = skx_db_iowrite,
2881− .db_size = sizeof(u64),
2881+ .db_size = sizeof(u32),
28822882 .ntb_ctl = SKX_NTBCNTL_OFFSET,
28832883 .mw_bar = {2, 4},
28842884 };
drivers/ntb/ntb_transport.c+11−47
@@ -177,14 +177,12 @@ struct ntb_transport_qp { · 176 unmodified lines
177177 u64 rx_err_ver;
178178 u64 rx_memcpy;
179179 u64 rx_async;
180− u64 dma_rx_prep_err;
181180 u64 tx_bytes;
182181 u64 tx_pkts;
183182 u64 tx_ring_full;
184183 u64 tx_err_no_buf;
185184 u64 tx_memcpy;
186185 u64 tx_async;
187− u64 dma_tx_prep_err;
188186 };
189187
190188 struct ntb_transport_mw {
@@ -254,8 +252,6 @@ enum { · 63 unmodified lines
254252 #define QP_TO_MW(nt, qp) ((qp) % nt->mw_count)
255253 #define NTB_QP_DEF_NUM_ENTRIES 100
256254 #define NTB_LINK_DOWN_TIMEOUT 10
257−#define DMA_RETRIES 20
258−#define DMA_OUT_RESOURCE_TO msecs_to_jiffies(50)
259255
260256 static void ntb_transport_rxc_db(unsigned long data);
261257 static const struct ntb_ctx_ops ntb_transport_ops;
@@ -516,12 +512,6 @@ static ssize_t debugfs_read(struct file *filp, char __user *ubuf, size_t count, · 254 unmodified lines
516512 out_offset += snprintf(buf + out_offset, out_count - out_offset,
517513 "free tx - \t%u\n",
518514 ntb_transport_tx_free_entry(qp));
519− out_offset += snprintf(buf + out_offset, out_count - out_offset,
520− "DMA tx prep err - \t%llu\n",
521− qp->dma_tx_prep_err);
522− out_offset += snprintf(buf + out_offset, out_count - out_offset,
523− "DMA rx prep err - \t%llu\n",
524− qp->dma_rx_prep_err);
525515
526516 out_offset += snprintf(buf + out_offset, out_count - out_offset,
527517 "\n");
@@ -623,7 +613,7 @@ static int ntb_transport_setup_qp_mw(struct ntb_transport_ctx *nt, · 95 unmodified lines
623613 if (!mw->virt_addr)
624614 return -ENOMEM;
625615
626− if (qp_count % mw_count && mw_num + 1 < qp_count / mw_count)
616+ if (mw_num < qp_count % mw_count)
627617 num_qps_mw = qp_count / mw_count + 1;
628618 else
629619 num_qps_mw = qp_count / mw_count;
@@ -768,8 +758,6 @@ static void ntb_qp_link_down_reset(struct ntb_transport_qp *qp) · 138 unmodified lines
768758 qp->tx_err_no_buf = 0;
769759 qp->tx_memcpy = 0;
770760 qp->tx_async = 0;
771− qp->dma_tx_prep_err = 0;
772− qp->dma_rx_prep_err = 0;
773761 }
774762
775763 static void ntb_qp_link_cleanup(struct ntb_transport_qp *qp)
@@ -1000,7 +988,7 @@ static int ntb_transport_init_queue(struct ntb_transport_ctx *nt, · 224 unmodified lines
1000988 qp->event_handler = NULL;
1001989 ntb_qp_link_down_reset(qp);
1002990
1003− if (qp_count % mw_count && mw_num + 1 < qp_count / mw_count)
991+ if (mw_num < qp_count % mw_count)
1004992 num_qps_mw = qp_count / mw_count + 1;
1005993 else
1006994 num_qps_mw = qp_count / mw_count;
@@ -1128,8 +1116,8 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev) · 121 unmodified lines
11281116 qp_count = ilog2(qp_bitmap);
11291117 if (max_num_clients && max_num_clients < qp_count)
11301118 qp_count = max_num_clients;
1131− else if (mw_count < qp_count)
1132− qp_count = mw_count;
1119+ else if (nt->mw_count < qp_count)
1120+ qp_count = nt->mw_count;
11331121
11341122 qp_bitmap &= BIT_ULL(qp_count) - 1;
11351123
@@ -1317,7 +1305,6 @@ static int ntb_async_rx_submit(struct ntb_queue_entry *entry, void *offset) · 181 unmodified lines
13171305 struct dmaengine_unmap_data *unmap;
13181306 dma_cookie_t cookie;
13191307 void *buf = entry->buf;
1320− int retries = 0;
13211308
13221309 len = entry->len;
13231310 device = chan->device;
@@ -1346,22 +1333,11 @@ static int ntb_async_rx_submit(struct ntb_queue_entry *entry, void *offset) · 22 unmodified lines
13461333
13471334 unmap->from_cnt = 1;
13481335
1349− for (retries = 0; retries < DMA_RETRIES; retries++) {
1350− txd = device->device_prep_dma_memcpy(chan,
1351− unmap->addr[1],
1352− unmap->addr[0], len,
1353− DMA_PREP_INTERRUPT);
1354− if (txd)
1355− break;
1356−
1357− set_current_state(TASK_INTERRUPTIBLE);
1358− schedule_timeout(DMA_OUT_RESOURCE_TO);
1359− }
1360−
1361− if (!txd) {
1362− qp->dma_rx_prep_err++;
1336+ txd = device->device_prep_dma_memcpy(chan, unmap->addr[1],
1337+ unmap->addr[0], len,
1338+ DMA_PREP_INTERRUPT);
1339+ if (!txd)
13631340 goto err_get_unmap;
1364− }
13651341
13661342 txd->callback_result = ntb_rx_copy_callback;
13671343 txd->callback_param = entry;
@@ -1606,7 +1582,6 @@ static int ntb_async_tx_submit(struct ntb_transport_qp *qp, · 238 unmodified lines
16061582 struct dmaengine_unmap_data *unmap;
16071583 dma_addr_t dest;
16081584 dma_cookie_t cookie;
1609− int retries = 0;
16101585
16111586 device = chan->device;
16121587 dest = qp->tx_mw_phys + qp->tx_max_frame * entry->tx_index;
@@ -1628,21 +1603,10 @@ static int ntb_async_tx_submit(struct ntb_transport_qp *qp, · 15 unmodified lines
16281603
16291604 unmap->to_cnt = 1;
16301605
1631− for (retries = 0; retries < DMA_RETRIES; retries++) {
1632− txd = device->device_prep_dma_memcpy(chan, dest,
1633− unmap->addr[0], len,
1634− DMA_PREP_INTERRUPT);
1635− if (txd)
1636− break;
1637−
1638− set_current_state(TASK_INTERRUPTIBLE);
1639− schedule_timeout(DMA_OUT_RESOURCE_TO);
1640− }
1641−
1642− if (!txd) {
1643− qp->dma_tx_prep_err++;
1606+ txd = device->device_prep_dma_memcpy(chan, dest, unmap->addr[0], len,
1607+ DMA_PREP_INTERRUPT);
1608+ if (!txd)
16441609 goto err_get_unmap;
1645− }
16461610
16471611 txd->callback_result = ntb_tx_copy_callback;
16481612 txd->callback_param = entry;
drivers/ntb/test/ntb_perf.c+2−2
@@ -90,11 +90,11 @@ MODULE_PARM_DESC(max_mw_size, "Limit size of large memory windows"); · 89 unmodified lines
9090
9191 static unsigned int seg_order = 19; /* 512K */
9292 module_param(seg_order, uint, 0644);
93−MODULE_PARM_DESC(seg_order, "size order [n^2] of buffer segment for testing");
93+MODULE_PARM_DESC(seg_order, "size order [2^n] of buffer segment for testing");
9494
9595 static unsigned int run_order = 32; /* 4G */
9696 module_param(run_order, uint, 0644);
97−MODULE_PARM_DESC(run_order, "size order [n^2] of total data to transfer");
97+MODULE_PARM_DESC(run_order, "size order [2^n] of total data to transfer");
9898
9999 static bool use_dma; /* default to 0 */
100100 module_param(use_dma, bool, 0644);
drivers/pci/access.c+6−6
@@ -896,7 +896,7 @@ int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val) · 895 unmodified lines
896896 {
897897 if (pci_dev_is_disconnected(dev)) {
898898 *val = ~0;
899− return -ENODEV;
899+ return PCIBIOS_DEVICE_NOT_FOUND;
900900 }
901901 return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val);
902902 }
@@ -906,7 +906,7 @@ int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val) · 3 unmodified lines
906906 {
907907 if (pci_dev_is_disconnected(dev)) {
908908 *val = ~0;
909− return -ENODEV;
909+ return PCIBIOS_DEVICE_NOT_FOUND;
910910 }
911911 return pci_bus_read_config_word(dev->bus, dev->devfn, where, val);
912912 }
@@ -917,7 +917,7 @@ int pci_read_config_dword(const struct pci_dev *dev, int where, · 4 unmodified lines
917917 {
918918 if (pci_dev_is_disconnected(dev)) {
919919 *val = ~0;
920− return -ENODEV;
920+ return PCIBIOS_DEVICE_NOT_FOUND;
921921 }
922922 return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val);
923923 }
@@ -926,7 +926,7 @@ EXPORT_SYMBOL(pci_read_config_dword); · 2 unmodified lines
926926 int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val)
927927 {
928928 if (pci_dev_is_disconnected(dev))
929− return -ENODEV;
929+ return PCIBIOS_DEVICE_NOT_FOUND;
930930 return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val);
931931 }
932932 EXPORT_SYMBOL(pci_write_config_byte);
@@ -934,7 +934,7 @@ EXPORT_SYMBOL(pci_write_config_byte); · 1 unmodified line
934934 int pci_write_config_word(const struct pci_dev *dev, int where, u16 val)
935935 {
936936 if (pci_dev_is_disconnected(dev))
937− return -ENODEV;
937+ return PCIBIOS_DEVICE_NOT_FOUND;
938938 return pci_bus_write_config_word(dev->bus, dev->devfn, where, val);
939939 }
940940 EXPORT_SYMBOL(pci_write_config_word);
@@ -943,7 +943,7 @@ int pci_write_config_dword(const struct pci_dev *dev, int where, · 2 unmodified lines
943943 u32 val)
944944 {
945945 if (pci_dev_is_disconnected(dev))
946− return -ENODEV;
946+ return PCIBIOS_DEVICE_NOT_FOUND;
947947 return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val);
948948 }
949949 EXPORT_SYMBOL(pci_write_config_dword);
drivers/pci/endpoint/functions/Kconfig+1−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 config PCI_EPF_TEST
66 tristate "PCI Endpoint Test driver"
77 depends on PCI_ENDPOINT
8+ select CRC32
89 help
910 Enable this configuration option to enable the test driver
1011 for PCI Endpoint.
drivers/pinctrl/pinctrl-amd.c+41−50
@@ -495,64 +495,54 @@ static struct irq_chip amd_gpio_irqchip = { · 494 unmodified lines
495495 .flags = IRQCHIP_SKIP_SET_WAKE,
496496 };
497497
498−static void amd_gpio_irq_handler(struct irq_desc *desc)
498+#define PIN_IRQ_PENDING (BIT(INTERRUPT_STS_OFF) | BIT(WAKE_STS_OFF))
499+
500+static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id)
499501 {
500− u32 i;
501− u32 off;
502− u32 reg;
503− u32 pin_reg;
504− u64 reg64;
505− int handled = 0;
506− unsigned int irq;
502+ struct amd_gpio *gpio_dev = dev_id;
503+ struct gpio_chip *gc = &gpio_dev->gc;
504+ irqreturn_t ret = IRQ_NONE;
505+ unsigned int i, irqnr;
507506 unsigned long flags;
508− struct irq_chip *chip = irq_desc_get_chip(desc);
509− struct gpio_chip *gc = irq_desc_get_handler_data(desc);
510− struct amd_gpio *gpio_dev = gpiochip_get_data(gc);
507+ u32 *regs, regval;
508+ u64 status, mask;
511509
512− chained_irq_enter(chip, desc);
513− /*enable GPIO interrupt again*/
510+ /* Read the wake status */
514511 raw_spin_lock_irqsave(&gpio_dev->lock, flags);
515− reg = readl(gpio_dev->base + WAKE_INT_STATUS_REG1);
516− reg64 = reg;
517− reg64 = reg64 << 32;
518−
519− reg = readl(gpio_dev->base + WAKE_INT_STATUS_REG0);
520− reg64 |= reg;
512+ status = readl(gpio_dev->base + WAKE_INT_STATUS_REG1);
513+ status <<= 32;
514+ status |= readl(gpio_dev->base + WAKE_INT_STATUS_REG0);
521515 raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
522516
523− /*
524− * first 46 bits indicates interrupt status.
525− * one bit represents four interrupt sources.
526− */
527− for (off = 0; off < 46 ; off++) {
528− if (reg64 & BIT(off)) {
529− for (i = 0; i < 4; i++) {
530− pin_reg = readl(gpio_dev->base +
531− (off * 4 + i) * 4);
532− if ((pin_reg & BIT(INTERRUPT_STS_OFF)) ||
533− (pin_reg & BIT(WAKE_STS_OFF))) {
534− irq = irq_find_mapping(gc->irqdomain,
535− off * 4 + i);
536− generic_handle_irq(irq);
537− writel(pin_reg,
538− gpio_dev->base
539− + (off * 4 + i) * 4);
540− handled++;
541− }
542− }
517+ /* Bit 0-45 contain the relevant status bits */
518+ status &= (1ULL << 46) - 1;
519+ regs = gpio_dev->base;
520+ for (mask = 1, irqnr = 0; status; mask <<= 1, regs += 4, irqnr += 4) {
521+ if (!(status & mask))
522+ continue;
523+ status &= ~mask;
524+
525+ /* Each status bit covers four pins */
526+ for (i = 0; i < 4; i++) {
527+ regval = readl(regs + i);
528+ if (!(regval & PIN_IRQ_PENDING))
529+ continue;
530+ irq = irq_find_mapping(gc->irqdomain, irqnr + i);
531+ generic_handle_irq(irq);
532+ /* Clear interrupt */
533+ writel(regval, regs + i);
534+ ret = IRQ_HANDLED;
543535 }
544536 }
545537
546− if (handled == 0)
547− handle_bad_irq(desc);
548−
538+ /* Signal EOI to the GPIO unit */
549539 raw_spin_lock_irqsave(&gpio_dev->lock, flags);
550− reg = readl(gpio_dev->base + WAKE_INT_MASTER_REG);
551− reg |= EOI_MASK;
552− writel(reg, gpio_dev->base + WAKE_INT_MASTER_REG);
540+ regval = readl(gpio_dev->base + WAKE_INT_MASTER_REG);
541+ regval |= EOI_MASK;
542+ writel(regval, gpio_dev->base + WAKE_INT_MASTER_REG);
553543 raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
554544
555− chained_irq_exit(chip, desc);
545+ return ret;
556546 }
557547
558548 static int amd_get_groups_count(struct pinctrl_dev *pctldev)
@@ -821,10 +811,11 @@ static int amd_gpio_probe(struct platform_device *pdev) · 262 unmodified lines
821811 goto out2;
822812 }
823813
824− gpiochip_set_chained_irqchip(&gpio_dev->gc,
825− &amd_gpio_irqchip,
826− irq_base,
827− amd_gpio_irq_handler);
814+ ret = devm_request_irq(&pdev->dev, irq_base, amd_gpio_irq_handler, 0,
815+ KBUILD_MODNAME, gpio_dev);
816+ if (ret)
817+ goto out2;
818+
828819 platform_set_drvdata(pdev, gpio_dev);
829820
830821 dev_dbg(&pdev->dev, "amd gpio driver loaded\n");
drivers/pinctrl/stm32/pinctrl-stm32.c+1−1
@@ -798,7 +798,7 @@ static int stm32_pconf_parse_conf(struct pinctrl_dev *pctldev, · 797 unmodified lines
798798 break;
799799 case PIN_CONFIG_OUTPUT:
800800 __stm32_gpio_set(bank, offset, arg);
801− ret = stm32_pmx_gpio_set_direction(pctldev, NULL, pin, false);
801+ ret = stm32_pmx_gpio_set_direction(pctldev, range, pin, false);
802802 break;
803803 default:
804804 ret = -EINVAL;
drivers/platform/x86/intel_telemetry_debugfs.c+7−9
@@ -97,11 +97,9 @@ · 96 unmodified lines
9797 } \
9898 }
9999
100−#ifdef CONFIG_PM_SLEEP
101100 static u8 suspend_prep_ok;
102101 static u32 suspend_shlw_ctr_temp, suspend_deep_ctr_temp;
103102 static u64 suspend_shlw_res_temp, suspend_deep_res_temp;
104−#endif
105103
106104 struct telemetry_susp_stats {
107105 u32 shlw_swake_ctr;
@@ -807,7 +805,6 @@ static const struct file_operations telem_ioss_trc_verb_ops = { · 699 unmodified lines
807805 .release = single_release,
808806 };
809807
810−#ifdef CONFIG_PM_SLEEP
811808 static int pm_suspend_prep_cb(void)
812809 {
813810 struct telemetry_evtlog evtlog[TELEM_MAX_OS_ALLOCATED_EVENTS];
@@ -937,7 +934,6 @@ static int pm_notification(struct notifier_block *this, · 123 unmodified lines
937934 static struct notifier_block pm_notifier = {
938935 .notifier_call = pm_notification,
939936 };
940−#endif /* CONFIG_PM_SLEEP */
941937
942938 static int __init telemetry_debugfs_init(void)
943939 {
@@ -960,14 +956,13 @@ static int __init telemetry_debugfs_init(void) · 16 unmodified lines
960956 if (err < 0)
961957 return -EINVAL;
962958
963−
964−#ifdef CONFIG_PM_SLEEP
965959 register_pm_notifier(&pm_notifier);
966−#endif /* CONFIG_PM_SLEEP */
967960
968961 debugfs_conf->telemetry_dbg_dir = debugfs_create_dir("telemetry", NULL);
969− if (!debugfs_conf->telemetry_dbg_dir)
970− return -ENOMEM;
962+ if (!debugfs_conf->telemetry_dbg_dir) {
963+ err = -ENOMEM;
964+ goto out_pm;
965+ }
971966
972967 f = debugfs_create_file("pss_info", S_IFREG | S_IRUGO,
973968 debugfs_conf->telemetry_dbg_dir, NULL,
@@ -1014,6 +1009,8 @@ static int __init telemetry_debugfs_init(void) · 40 unmodified lines
10141009 out:
10151010 debugfs_remove_recursive(debugfs_conf->telemetry_dbg_dir);
10161011 debugfs_conf->telemetry_dbg_dir = NULL;
1012+out_pm:
1013+ unregister_pm_notifier(&pm_notifier);
10171014
10181015 return err;
10191016 }
@@ -1022,6 +1019,7 @@ static void __exit telemetry_debugfs_exit(void) · 2 unmodified lines
10221019 {
10231020 debugfs_remove_recursive(debugfs_conf->telemetry_dbg_dir);
10241021 debugfs_conf->telemetry_dbg_dir = NULL;
1022+ unregister_pm_notifier(&pm_notifier);
10251023 }
10261024
10271025 late_initcall(telemetry_debugfs_init);
drivers/s390/cio/vfio_ccw_ops.c+6−6
@@ -70,14 +70,14 @@ static ssize_t name_show(struct kobject *kobj, struct device *dev, char *buf) · 69 unmodified lines
7070 {
7171 return sprintf(buf, "I/O subchannel (Non-QDIO)\n");
7272 }
73−MDEV_TYPE_ATTR_RO(name);
73+static MDEV_TYPE_ATTR_RO(name);
7474
7575 static ssize_t device_api_show(struct kobject *kobj, struct device *dev,
7676 char *buf)
7777 {
7878 return sprintf(buf, "%s\n", VFIO_DEVICE_API_CCW_STRING);
7979 }
80−MDEV_TYPE_ATTR_RO(device_api);
80+static MDEV_TYPE_ATTR_RO(device_api);
8181
8282 static ssize_t available_instances_show(struct kobject *kobj,
8383 struct device *dev, char *buf)
@@ -86,7 +86,7 @@ static ssize_t available_instances_show(struct kobject *kobj, · 2 unmodified lines
8686
8787 return sprintf(buf, "%d\n", atomic_read(&private->avail));
8888 }
89−MDEV_TYPE_ATTR_RO(available_instances);
89+static MDEV_TYPE_ATTR_RO(available_instances);
9090
9191 static struct attribute *mdev_types_attrs[] = {
9292 &mdev_type_attr_name.attr,
@@ -100,7 +100,7 @@ static struct attribute_group mdev_type_group = { · 7 unmodified lines
100100 .attrs = mdev_types_attrs,
101101 };
102102
103−struct attribute_group *mdev_type_groups[] = {
103+static struct attribute_group *mdev_type_groups[] = {
104104 &mdev_type_group,
105105 NULL,
106106 };
@@ -152,7 +152,7 @@ static int vfio_ccw_mdev_open(struct mdev_device *mdev) · 45 unmodified lines
152152 &events, &private->nb);
153153 }
154154
155−void vfio_ccw_mdev_release(struct mdev_device *mdev)
155+static void vfio_ccw_mdev_release(struct mdev_device *mdev)
156156 {
157157 struct vfio_ccw_private *private =
158158 dev_get_drvdata(mdev_parent_dev(mdev));
@@ -233,7 +233,7 @@ static int vfio_ccw_mdev_get_region_info(struct vfio_region_info *info, · 74 unmodified lines
233233 }
234234 }
235235
236−int vfio_ccw_mdev_get_irq_info(struct vfio_irq_info *info)
236+static int vfio_ccw_mdev_get_irq_info(struct vfio_irq_info *info)
237237 {
238238 if (info->index != VFIO_CCW_IO_IRQ_INDEX)
239239 return -EINVAL;
drivers/s390/crypto/ap_bus.c+24−14
@@ -668,10 +668,28 @@ static int ap_device_probe(struct device *dev) · 667 unmodified lines
668668 struct ap_driver *ap_drv = to_ap_drv(dev->driver);
669669 int rc;
670670
671+ /* Add queue/card to list of active queues/cards */
672+ spin_lock_bh(&ap_list_lock);
673+ if (is_card_dev(dev))
674+ list_add(&to_ap_card(dev)->list, &ap_card_list);
675+ else
676+ list_add(&to_ap_queue(dev)->list,
677+ &to_ap_queue(dev)->card->queues);
678+ spin_unlock_bh(&ap_list_lock);
679+
671680 ap_dev->drv = ap_drv;
672681 rc = ap_drv->probe ? ap_drv->probe(ap_dev) : -ENODEV;
673− if (rc)
682+
683+ if (rc) {
684+ spin_lock_bh(&ap_list_lock);
685+ if (is_card_dev(dev))
686+ list_del_init(&to_ap_card(dev)->list);
687+ else
688+ list_del_init(&to_ap_queue(dev)->list);
689+ spin_unlock_bh(&ap_list_lock);
674690 ap_dev->drv = NULL;
691+ }
692+
675693 return rc;
676694 }
677695
@@ -680,14 +698,17 @@ static int ap_device_remove(struct device *dev) · 2 unmodified lines
680698 struct ap_device *ap_dev = to_ap_dev(dev);
681699 struct ap_driver *ap_drv = ap_dev->drv;
682700
701+ if (ap_drv->remove)
702+ ap_drv->remove(ap_dev);
703+
704+ /* Remove queue/card from list of active queues/cards */
683705 spin_lock_bh(&ap_list_lock);
684706 if (is_card_dev(dev))
685707 list_del_init(&to_ap_card(dev)->list);
686708 else
687709 list_del_init(&to_ap_queue(dev)->list);
688710 spin_unlock_bh(&ap_list_lock);
689− if (ap_drv->remove)
690− ap_drv->remove(ap_dev);
711+
691712 return 0;
692713 }
693714
@@ -1056,10 +1077,6 @@ static void ap_scan_bus(struct work_struct *unused) · 362 unmodified lines
10561077 }
10571078 /* get it and thus adjust reference counter */
10581079 get_device(&ac->ap_dev.device);
1059− /* Add card device to card list */
1060− spin_lock_bh(&ap_list_lock);
1061− list_add(&ac->list, &ap_card_list);
1062− spin_unlock_bh(&ap_list_lock);
10631080 }
10641081 /* now create the new queue device */
10651082 aq = ap_queue_create(qid, type);
@@ -1070,10 +1087,6 @@ static void ap_scan_bus(struct work_struct *unused) · 4 unmodified lines
10701087 aq->ap_dev.device.parent = &ac->ap_dev.device;
10711088 dev_set_name(&aq->ap_dev.device,
10721089 "%02x.%04x", id, dom);
1073− /* Add queue device to card queue list */
1074− spin_lock_bh(&ap_list_lock);
1075− list_add(&aq->list, &ac->queues);
1076− spin_unlock_bh(&ap_list_lock);
10771090 /* Start with a device reset */
10781091 spin_lock_bh(&aq->lock);
10791092 ap_wait(ap_sm_event(aq, AP_EVENT_POLL));
@@ -1081,9 +1094,6 @@ static void ap_scan_bus(struct work_struct *unused) · 1 unmodified line
10811094 /* Register device */
10821095 rc = device_register(&aq->ap_dev.device);
10831096 if (rc) {
1084− spin_lock_bh(&ap_list_lock);
1085− list_del_init(&aq->list);
1086− spin_unlock_bh(&ap_list_lock);
10871097 put_device(&aq->ap_dev.device);
10881098 continue;
10891099 }
drivers/s390/crypto/ap_card.c+8−1
@@ -160,7 +160,14 @@ static struct device_type ap_card_type = { · 159 unmodified lines
160160
161161 static void ap_card_device_release(struct device *dev)
162162 {
163− kfree(to_ap_card(dev));
163+ struct ap_card *ac = to_ap_card(dev);
164+
165+ if (!list_empty(&ac->list)) {
166+ spin_lock_bh(&ap_list_lock);
167+ list_del_init(&ac->list);
168+ spin_unlock_bh(&ap_list_lock);
169+ }
170+ kfree(ac);
164171 }
165172
166173 struct ap_card *ap_card_create(int id, int queue_depth, int device_type,
drivers/s390/crypto/ap_queue.c+8−1
@@ -584,7 +584,14 @@ static struct device_type ap_queue_type = { · 583 unmodified lines
584584
585585 static void ap_queue_device_release(struct device *dev)
586586 {
587− kfree(to_ap_queue(dev));
587+ struct ap_queue *aq = to_ap_queue(dev);
588+
589+ if (!list_empty(&aq->list)) {
590+ spin_lock_bh(&ap_list_lock);
591+ list_del_init(&aq->list);
592+ spin_unlock_bh(&ap_list_lock);
593+ }
594+ kfree(aq);
588595 }
589596
590597 struct ap_queue *ap_queue_create(ap_qid_t qid, int device_type)
drivers/s390/net/netiucv.c+2−2
@@ -1954,7 +1954,6 @@ static void netiucv_free_netdevice(struct net_device *dev) · 1953 unmodified lines
19541954 privptr->conn = NULL; privptr->fsm = NULL;
19551955 /* privptr gets freed by free_netdev() */
19561956 }
1957− free_netdev(dev);
19581957 }
19591958
19601959 /**
@@ -1972,7 +1971,8 @@ static void netiucv_setup_netdevice(struct net_device *dev) · 11 unmodified lines
19721971 dev->mtu = NETIUCV_MTU_DEFAULT;
19731972 dev->min_mtu = 576;
19741973 dev->max_mtu = NETIUCV_MTU_MAX;
1975− dev->destructor = netiucv_free_netdevice;
1974+ dev->needs_free_netdev = true;
1975+ dev->priv_destructor = netiucv_free_netdevice;
19761976 dev->hard_header_len = NETIUCV_HDRLEN;
19771977 dev->addr_len = 0;
19781978 dev->type = ARPHRD_SLIP;
drivers/scsi/qedi/qedi_fw.c+0−1
@@ -870,7 +870,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, · 869 unmodified lines
870870 QEDI_ERR(&qedi->dbg_ctx,
871871 "Delayed or untracked cleanup response, itt=0x%x, tid=0x%x, cid=0x%x, task=%p\n",
872872 protoitt, cqe->itid, qedi_conn->iscsi_conn_id, task);
873− WARN_ON(1);
874873 }
875874 }
876875
drivers/scsi/qedi/qedi_main.c+1−3
@@ -1499,11 +1499,9 @@ err_idx: · 1498 unmodified lines
14991499
15001500 void qedi_clear_task_idx(struct qedi_ctx *qedi, int idx)
15011501 {
1502− if (!test_and_clear_bit(idx, qedi->task_idx_map)) {
1502+ if (!test_and_clear_bit(idx, qedi->task_idx_map))
15031503 QEDI_ERR(&qedi->dbg_ctx,
15041504 "FW task context, already cleared, tid=0x%x\n", idx);
1505− WARN_ON(1);
1506− }
15071505 }
15081506
15091507 void qedi_update_itt_map(struct qedi_ctx *qedi, u32 tid, u32 proto_itt,
drivers/staging/iio/cdc/ad7152.c+1−5
@@ -231,16 +231,12 @@ static int ad7152_write_raw_samp_freq(struct device *dev, int val) · 230 unmodified lines
231231 if (i >= ARRAY_SIZE(ad7152_filter_rate_table))
232232 i = ARRAY_SIZE(ad7152_filter_rate_table) - 1;
233233
234− mutex_lock(&chip->state_lock);
235234 ret = i2c_smbus_write_byte_data(chip->client,
236235 AD7152_REG_CFG2, AD7152_CFG2_OSR(i));
237− if (ret < 0) {
238− mutex_unlock(&chip->state_lock);
236+ if (ret < 0)
239237 return ret;
240− }
241238
242239 chip->filter_rate_setup = i;
243− mutex_unlock(&chip->state_lock);
244240
245241 return ret;
246242 }
drivers/staging/rtl8188eu/os_dep/mon.c+1−1
@@ -152,7 +152,7 @@ static const struct net_device_ops mon_netdev_ops = { · 151 unmodified lines
152152 static void mon_setup(struct net_device *dev)
153153 {
154154 dev->netdev_ops = &mon_netdev_ops;
155− dev->destructor = free_netdev;
155+ dev->needs_free_netdev = true;
156156 ether_setup(dev);
157157 dev->priv_flags |= IFF_NO_QUEUE;
158158 dev->type = ARPHRD_IEEE80211;
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c+2−1
@@ -2667,7 +2667,8 @@ static int rtw_cfg80211_add_monitor_if (struct adapter *padapter, char *name, st · 2666 unmodified lines
26672667 mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP;
26682668 strncpy(mon_ndev->name, name, IFNAMSIZ);
26692669 mon_ndev->name[IFNAMSIZ - 1] = 0;
2670− mon_ndev->destructor = rtw_ndev_destructor;
2670+ mon_ndev->needs_free_netdev = true;
2671+ mon_ndev->priv_destructor = rtw_ndev_destructor;
26712672
26722673 mon_ndev->netdev_ops = &rtw_cfg80211_monitor_if_ops;
26732674
drivers/staging/rtl8723bs/os_dep/os_intfs.c+0−2
@@ -1207,8 +1207,6 @@ void rtw_ndev_destructor(struct net_device *ndev) · 1206 unmodified lines
12071207
12081208 if (ndev->ieee80211_ptr)
12091209 kfree((u8 *)ndev->ieee80211_ptr);
1210−
1211− free_netdev(ndev);
12121210 }
12131211
12141212 void rtw_dev_unload(struct adapter *padapter)
drivers/staging/rtl8723bs/os_dep/osdep_service.c+1−1
@@ -160,7 +160,7 @@ static int isFileReadable(char *path) · 159 unmodified lines
160160 oldfs = get_fs(); set_fs(get_ds());
161161
162162 if (1!=readFile(fp, &buf, 1))
163− ret = PTR_ERR(fp);
163+ ret = -EINVAL;
164164
165165 set_fs(oldfs);
166166 filp_close(fp, NULL);
drivers/target/iscsi/iscsi_target.c+20−2
@@ -1279,6 +1279,18 @@ iscsit_get_immediate_data(struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr, · 1278 unmodified lines
12791279 */
12801280 if (dump_payload)
12811281 goto after_immediate_data;
1282+ /*
1283+ * Check for underflow case where both EDTL and immediate data payload
1284+ * exceeds what is presented by CDB's TRANSFER LENGTH, and what has
1285+ * already been set in target_cmd_size_check() as se_cmd->data_length.
1286+ *
1287+ * For this special case, fail the command and dump the immediate data
1288+ * payload.
1289+ */
1290+ if (cmd->first_burst_len > cmd->se_cmd.data_length) {
1291+ cmd->sense_reason = TCM_INVALID_CDB_FIELD;
1292+ goto after_immediate_data;
1293+ }
12821294
12831295 immed_ret = iscsit_handle_immediate_data(cmd, hdr,
12841296 cmd->first_burst_len);
@@ -4423,8 +4435,11 @@ static void iscsit_logout_post_handler_closesession( · 3138 unmodified lines
44234435 * always sleep waiting for RX/TX thread shutdown to complete
44244436 * within iscsit_close_connection().
44254437 */
4426− if (!conn->conn_transport->rdma_shutdown)
4438+ if (!conn->conn_transport->rdma_shutdown) {
44274439 sleep = cmpxchg(&conn->tx_thread_active, true, false);
4440+ if (!sleep)
4441+ return;
4442+ }
44284443
44294444 atomic_set(&conn->conn_logout_remove, 0);
44304445 complete(&conn->conn_logout_comp);
@@ -4440,8 +4455,11 @@ static void iscsit_logout_post_handler_samecid( · 9 unmodified lines
44404455 {
44414456 int sleep = 1;
44424457
4443− if (!conn->conn_transport->rdma_shutdown)
4458+ if (!conn->conn_transport->rdma_shutdown) {
44444459 sleep = cmpxchg(&conn->tx_thread_active, true, false);
4460+ if (!sleep)
4461+ return;
4462+ }
44454463
44464464 atomic_set(&conn->conn_logout_remove, 0);
44474465 complete(&conn->conn_logout_comp);
drivers/target/target_core_internal.h+1−1
@@ -136,7 +136,7 @@ int init_se_kmem_caches(void); · 135 unmodified lines
136136 void release_se_kmem_caches(void);
137137 u32 scsi_get_new_index(scsi_index_t);
138138 void transport_subsystem_check_init(void);
139−void transport_cmd_finish_abort(struct se_cmd *, int);
139+int transport_cmd_finish_abort(struct se_cmd *, int);
140140 unsigned char *transport_dump_cmd_direction(struct se_cmd *);
141141 void transport_dump_dev_state(struct se_device *, char *, int *);
142142 void transport_dump_dev_info(struct se_device *, struct se_lun *,
drivers/target/target_core_tmr.c+8−8
@@ -75,7 +75,7 @@ void core_tmr_release_req(struct se_tmr_req *tmr) · 74 unmodified lines
7575 kfree(tmr);
7676 }
7777
78−static void core_tmr_handle_tas_abort(struct se_cmd *cmd, int tas)
78+static int core_tmr_handle_tas_abort(struct se_cmd *cmd, int tas)
7979 {
8080 unsigned long flags;
8181 bool remove = true, send_tas;
@@ -91,7 +91,7 @@ static void core_tmr_handle_tas_abort(struct se_cmd *cmd, int tas) · 9 unmodified lines
9191 transport_send_task_abort(cmd);
9292 }
9393
94− transport_cmd_finish_abort(cmd, remove);
94+ return transport_cmd_finish_abort(cmd, remove);
9595 }
9696
9797 static int target_check_cdb_and_preempt(struct list_head *list,
@@ -184,8 +184,8 @@ void core_tmr_abort_task( · 86 unmodified lines
184184 cancel_work_sync(&se_cmd->work);
185185 transport_wait_for_tasks(se_cmd);
186186
187− transport_cmd_finish_abort(se_cmd, true);
188− target_put_sess_cmd(se_cmd);
187+ if (!transport_cmd_finish_abort(se_cmd, true))
188+ target_put_sess_cmd(se_cmd);
189189
190190 printk("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for"
191191 " ref_tag: %llu\n", ref_tag);
@@ -281,8 +281,8 @@ static void core_tmr_drain_tmr_list( · 89 unmodified lines
281281 cancel_work_sync(&cmd->work);
282282 transport_wait_for_tasks(cmd);
283283
284− transport_cmd_finish_abort(cmd, 1);
285− target_put_sess_cmd(cmd);
284+ if (!transport_cmd_finish_abort(cmd, 1))
285+ target_put_sess_cmd(cmd);
286286 }
287287 }
288288
@@ -380,8 +380,8 @@ static void core_tmr_drain_state_list( · 91 unmodified lines
380380 cancel_work_sync(&cmd->work);
381381 transport_wait_for_tasks(cmd);
382382
383− core_tmr_handle_tas_abort(cmd, tas);
384− target_put_sess_cmd(cmd);
383+ if (!core_tmr_handle_tas_abort(cmd, tas))
384+ target_put_sess_cmd(cmd);
385385 }
386386 }
387387
drivers/target/target_core_transport.c+6−3
@@ -651,9 +651,10 @@ static void transport_lun_remove_cmd(struct se_cmd *cmd) · 650 unmodified lines
651651 percpu_ref_put(&lun->lun_ref);
652652 }
653653
654−void transport_cmd_finish_abort(struct se_cmd *cmd, int remove)
654+int transport_cmd_finish_abort(struct se_cmd *cmd, int remove)
655655 {
656656 bool ack_kref = (cmd->se_cmd_flags & SCF_ACK_KREF);
657+ int ret = 0;
657658
658659 if (cmd->se_cmd_flags & SCF_SE_LUN_CMD)
659660 transport_lun_remove_cmd(cmd);
@@ -665,9 +666,11 @@ void transport_cmd_finish_abort(struct se_cmd *cmd, int remove) · 5 unmodified lines
665666 cmd->se_tfo->aborted_task(cmd);
666667
667668 if (transport_cmd_check_stop_to_fabric(cmd))
668− return;
669+ return 1;
669670 if (remove && ack_kref)
670− transport_put_cmd(cmd);
671+ ret = transport_put_cmd(cmd);
672+
673+ return ret;
671674 }
672675
673676 static void target_complete_failure_work(struct work_struct *work)
drivers/usb/gadget/composite.c+5−6
@@ -315,6 +315,9 @@ void usb_remove_function(struct usb_configuration *c, struct usb_function *f) · 314 unmodified lines
315315 list_del(&f->list);
316316 if (f->unbind)
317317 f->unbind(c, f);
318+
319+ if (f->bind_deactivated)
320+ usb_function_activate(f);
318321 }
319322 EXPORT_SYMBOL_GPL(usb_remove_function);
320323
@@ -956,12 +959,8 @@ static void remove_config(struct usb_composite_dev *cdev, · 635 unmodified lines
956959
957960 f = list_first_entry(&config->functions,
958961 struct usb_function, list);
959− list_del(&f->list);
960− if (f->unbind) {
961− DBG(cdev, "unbind function '%s'/%p\n", f->name, f);
962− f->unbind(config, f);
963− /* may free memory for "f" */
964− }
962+
963+ usb_remove_function(config, f);
965964 }
966965 list_del(&config->list);
967966 if (config->unbind) {
drivers/usb/gadget/function/f_phonet.c+1−1
@@ -281,7 +281,7 @@ static void pn_net_setup(struct net_device *dev) · 280 unmodified lines
281281 dev->tx_queue_len = 1;
282282
283283 dev->netdev_ops = &pn_netdev_ops;
284− dev->destructor = free_netdev;
284+ dev->needs_free_netdev = true;
285285 dev->header_ops = &phonet_header_ops;
286286 }
287287
drivers/usb/gadget/legacy/inode.c+6−3
@@ -1183,8 +1183,10 @@ dev_release (struct inode *inode, struct file *fd) · 1182 unmodified lines
11831183
11841184 /* closing ep0 === shutdown all */
11851185
1186− if (dev->gadget_registered)
1186+ if (dev->gadget_registered) {
11871187 usb_gadget_unregister_driver (&gadgetfs_driver);
1188+ dev->gadget_registered = false;
1189+ }
11881190
11891191 /* at this point "good" hardware has disconnected the
11901192 * device from USB; the host won't see it any more.
@@ -1677,9 +1679,10 @@ static void · 486 unmodified lines
16771679 gadgetfs_suspend (struct usb_gadget *gadget)
16781680 {
16791681 struct dev_data *dev = get_gadget_data (gadget);
1682+ unsigned long flags;
16801683
16811684 INFO (dev, "suspended from state %d\n", dev->state);
1682− spin_lock (&dev->lock);
1685+ spin_lock_irqsave(&dev->lock, flags);
16831686 switch (dev->state) {
16841687 case STATE_DEV_SETUP: // VERY odd... host died??
16851688 case STATE_DEV_CONNECTED:
@@ -1690,7 +1693,7 @@ gadgetfs_suspend (struct usb_gadget *gadget) · 4 unmodified lines
16901693 default:
16911694 break;
16921695 }
1693− spin_unlock (&dev->lock);
1696+ spin_unlock_irqrestore(&dev->lock, flags);
16941697 }
16951698
16961699 static struct usb_gadget_driver gadgetfs_driver = {
drivers/usb/gadget/udc/dummy_hcd.c+4−9
@@ -442,23 +442,16 @@ static void set_link_state(struct dummy_hcd *dum_hcd) · 441 unmodified lines
442442 /* Report reset and disconnect events to the driver */
443443 if (dum->driver && (disconnect || reset)) {
444444 stop_activity(dum);
445− spin_unlock(&dum->lock);
446445 if (reset)
447446 usb_gadget_udc_reset(&dum->gadget, dum->driver);
448447 else
449448 dum->driver->disconnect(&dum->gadget);
450− spin_lock(&dum->lock);
451449 }
452450 } else if (dum_hcd->active != dum_hcd->old_active) {
453− if (dum_hcd->old_active && dum->driver->suspend) {
454− spin_unlock(&dum->lock);
451+ if (dum_hcd->old_active && dum->driver->suspend)
455452 dum->driver->suspend(&dum->gadget);
456− spin_lock(&dum->lock);
457− } else if (!dum_hcd->old_active && dum->driver->resume) {
458− spin_unlock(&dum->lock);
453+ else if (!dum_hcd->old_active && dum->driver->resume)
459454 dum->driver->resume(&dum->gadget);
460− spin_lock(&dum->lock);
461− }
462455 }
463456
464457 dum_hcd->old_status = dum_hcd->port_status;
@@ -983,7 +976,9 @@ static int dummy_udc_stop(struct usb_gadget *g) · 518 unmodified lines
983976 struct dummy_hcd *dum_hcd = gadget_to_dummy_hcd(g);
984977 struct dummy *dum = dum_hcd->dum;
985978
979+ spin_lock_irq(&dum->lock);
986980 dum->driver = NULL;
981+ spin_unlock_irq(&dum->lock);
987982
988983 return 0;
989984 }
drivers/usb/gadget/udc/net2280.c+1−8
@@ -2470,11 +2470,8 @@ static void stop_activity(struct net2280 *dev, struct usb_gadget_driver *driver) · 2469 unmodified lines
24702470 nuke(&dev->ep[i]);
24712471
24722472 /* report disconnect; the driver is already quiesced */
2473− if (driver) {
2474− spin_unlock(&dev->lock);
2473+ if (driver)
24752474 driver->disconnect(&dev->gadget);
2476− spin_lock(&dev->lock);
2477− }
24782475
24792476 usb_reinit(dev);
24802477 }
@@ -3348,8 +3345,6 @@ next_endpoints: · 867 unmodified lines
33483345 BIT(PCI_RETRY_ABORT_INTERRUPT))
33493346
33503347 static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
3351−__releases(dev->lock)
3352−__acquires(dev->lock)
33533348 {
33543349 struct net2280_ep *ep;
33553350 u32 tmp, num, mask, scratch;
@@ -3390,14 +3385,12 @@ __acquires(dev->lock) · 34 unmodified lines
33903385 if (disconnect || reset) {
33913386 stop_activity(dev, dev->driver);
33923387 ep0_start(dev);
3393− spin_unlock(&dev->lock);
33943388 if (reset)
33953389 usb_gadget_udc_reset
33963390 (&dev->gadget, dev->driver);
33973391 else
33983392 (dev->driver->disconnect)
33993393 (&dev->gadget);
3400− spin_lock(&dev->lock);
34013394 return;
34023395 }
34033396 }
drivers/usb/host/xhci-mem.c+5−2
@@ -2119,11 +2119,12 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, · 2118 unmodified lines
21192119 {
21202120 u32 temp, port_offset, port_count;
21212121 int i;
2122− u8 major_revision;
2122+ u8 major_revision, minor_revision;
21232123 struct xhci_hub *rhub;
21242124
21252125 temp = readl(addr);
21262126 major_revision = XHCI_EXT_PORT_MAJOR(temp);
2127+ minor_revision = XHCI_EXT_PORT_MINOR(temp);
21272128
21282129 if (major_revision == 0x03) {
21292130 rhub = &xhci->usb3_rhub;
@@ -2137,7 +2138,9 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, · 7 unmodified lines
21372138 return;
21382139 }
21392140 rhub->maj_rev = XHCI_EXT_PORT_MAJOR(temp);
2140− rhub->min_rev = XHCI_EXT_PORT_MINOR(temp);
2141+
2142+ if (rhub->min_rev < minor_revision)
2143+ rhub->min_rev = minor_revision;
21412144
21422145 /* Port offset and count in the third dword, see section 7.2 */
21432146 temp = readl(addr + 2);
drivers/usb/host/xhci-pci.c+3−0
@@ -201,6 +201,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 200 unmodified lines
201201 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
202202 pdev->device == 0x1042)
203203 xhci->quirks |= XHCI_BROKEN_STREAMS;
204+ if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
205+ pdev->device == 0x1142)
206+ xhci->quirks |= XHCI_TRUST_TX_LENGTH;
204207
205208 if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241)
206209 xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7;
drivers/video/fbdev/core/fbmon.c+1−1
@@ -1048,7 +1048,7 @@ void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs) · 1047 unmodified lines
10481048
10491049 for (i = 0; i < (128 - edid[2]) / DETAILED_TIMING_DESCRIPTION_SIZE;
10501050 i++, block += DETAILED_TIMING_DESCRIPTION_SIZE)
1051− if (PIXEL_CLOCK)
1051+ if (PIXEL_CLOCK != 0)
10521052 edt[num++] = block - edid;
10531053
10541054 /* Yikes, EDID data is totally useless */
drivers/video/fbdev/smscufx.c+3−2
@@ -1646,8 +1646,9 @@ static int ufx_usb_probe(struct usb_interface *interface, · 1645 unmodified lines
16461646 dev_dbg(dev->gdev, "%s %s - serial #%s\n",
16471647 usbdev->manufacturer, usbdev->product, usbdev->serial);
16481648 dev_dbg(dev->gdev, "vid_%04x&pid_%04x&rev_%04x driver's ufx_data struct at %p\n",
1649− usbdev->descriptor.idVendor, usbdev->descriptor.idProduct,
1650− usbdev->descriptor.bcdDevice, dev);
1649+ le16_to_cpu(usbdev->descriptor.idVendor),
1650+ le16_to_cpu(usbdev->descriptor.idProduct),
1651+ le16_to_cpu(usbdev->descriptor.bcdDevice), dev);
16511652 dev_dbg(dev->gdev, "console enable=%d\n", console);
16521653 dev_dbg(dev->gdev, "fb_defio enable=%d\n", fb_defio);
16531654
drivers/video/fbdev/udlfb.c+5−4
@@ -1105,8 +1105,8 @@ static int dlfb_ops_blank(int blank_mode, struct fb_info *info) · 1104 unmodified lines
11051105 char *bufptr;
11061106 struct urb *urb;
11071107
1108− pr_info("/dev/fb%d FB_BLANK mode %d --> %d\n",
1109− info->node, dev->blank_mode, blank_mode);
1108+ pr_debug("/dev/fb%d FB_BLANK mode %d --> %d\n",
1109+ info->node, dev->blank_mode, blank_mode);
11101110
11111111 if ((dev->blank_mode == FB_BLANK_POWERDOWN) &&
11121112 (blank_mode != FB_BLANK_POWERDOWN)) {
@@ -1613,8 +1613,9 @@ static int dlfb_usb_probe(struct usb_interface *interface, · 500 unmodified lines
16131613 pr_info("%s %s - serial #%s\n",
16141614 usbdev->manufacturer, usbdev->product, usbdev->serial);
16151615 pr_info("vid_%04x&pid_%04x&rev_%04x driver's dlfb_data struct at %p\n",
1616− usbdev->descriptor.idVendor, usbdev->descriptor.idProduct,
1617− usbdev->descriptor.bcdDevice, dev);
1616+ le16_to_cpu(usbdev->descriptor.idVendor),
1617+ le16_to_cpu(usbdev->descriptor.idProduct),
1618+ le16_to_cpu(usbdev->descriptor.bcdDevice), dev);
16181619 pr_info("console enable=%d\n", console);
16191620 pr_info("fb_defio enable=%d\n", fb_defio);
16201621 pr_info("shadow enable=%d\n", shadow);
drivers/video/fbdev/via/viafbdev.c+3−5
@@ -1630,16 +1630,14 @@ static void viafb_init_proc(struct viafb_shared *shared) · 1629 unmodified lines
16301630 }
16311631 static void viafb_remove_proc(struct viafb_shared *shared)
16321632 {
1633− struct proc_dir_entry *viafb_entry = shared->proc_entry,
1634− *iga1_entry = shared->iga1_proc_entry,
1635− *iga2_entry = shared->iga2_proc_entry;
1633+ struct proc_dir_entry *viafb_entry = shared->proc_entry;
16361634
16371635 if (!viafb_entry)
16381636 return;
16391637
1640− remove_proc_entry("output_devices", iga2_entry);
1638+ remove_proc_entry("output_devices", shared->iga2_proc_entry);
16411639 remove_proc_entry("iga2", viafb_entry);
1642− remove_proc_entry("output_devices", iga1_entry);
1640+ remove_proc_entry("output_devices", shared->iga1_proc_entry);
16431641 remove_proc_entry("iga1", viafb_entry);
16441642 remove_proc_entry("supported_output_devices", viafb_entry);
16451643
drivers/virtio/virtio_balloon.c+7−0
@@ -663,6 +663,12 @@ static int virtballoon_restore(struct virtio_device *vdev) · 662 unmodified lines
663663 }
664664 #endif
665665
666+static int virtballoon_validate(struct virtio_device *vdev)
667+{
668+ __virtio_clear_bit(vdev, VIRTIO_F_IOMMU_PLATFORM);
669+ return 0;
670+}
671+
666672 static unsigned int features[] = {
667673 VIRTIO_BALLOON_F_MUST_TELL_HOST,
668674 VIRTIO_BALLOON_F_STATS_VQ,
@@ -675,6 +681,7 @@ static struct virtio_driver virtio_balloon_driver = { · 6 unmodified lines
675681 .driver.name = KBUILD_MODNAME,
676682 .driver.owner = THIS_MODULE,
677683 .id_table = id_table,
684+ .validate = virtballoon_validate,
678685 .probe = virtballoon_probe,
679686 .remove = virtballoon_remove,
680687 .config_changed = virtballoon_changed,
fs/autofs4/dev-ioctl.c+1−1
@@ -344,7 +344,7 @@ static int autofs_dev_ioctl_fail(struct file *fp, · 343 unmodified lines
344344 int status;
345345
346346 token = (autofs_wqt_t) param->fail.token;
347− status = param->fail.status ? param->fail.status : -ENOENT;
347+ status = param->fail.status < 0 ? param->fail.status : -ENOENT;
348348 return autofs4_wait_release(sbi, token, status);
349349 }
350350
fs/btrfs/hash.c+4−1
@@ -38,6 +38,7 @@ u32 btrfs_crc32c(u32 crc, const void *address, unsigned int length) · 37 unmodified lines
3838 {
3939 SHASH_DESC_ON_STACK(shash, tfm);
4040 u32 *ctx = (u32 *)shash_desc_ctx(shash);
41+ u32 retval;
4142 int err;
4243
4344 shash->tfm = tfm;
@@ -47,5 +48,7 @@ u32 btrfs_crc32c(u32 crc, const void *address, unsigned int length) · 3 unmodified lines
4748 err = crypto_shash_update(shash, address, length);
4849 BUG_ON(err);
4950
50− return *ctx;
51+ retval = *ctx;
52+ barrier_data(ctx);
53+ return retval;
5154 }
fs/ceph/acl.c+1−0
@@ -131,6 +131,7 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) · 130 unmodified lines
131131 }
132132
133133 if (new_mode != old_mode) {
134+ newattrs.ia_ctime = current_time(inode);
134135 newattrs.ia_mode = new_mode;
135136 newattrs.ia_valid = ATTR_MODE;
136137 ret = __ceph_setattr(inode, &newattrs);
fs/ceph/export.c+4−0
@@ -91,6 +91,10 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) · 90 unmodified lines
9191 ceph_mdsc_put_request(req);
9292 if (!inode)
9393 return ERR_PTR(-ESTALE);
94+ if (inode->i_nlink == 0) {
95+ iput(inode);
96+ return ERR_PTR(-ESTALE);
97+ }
9498 }
9599
96100 return d_obtain_alias(inode);
fs/ceph/inode.c+2−3
@@ -2022,7 +2022,6 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) · 2021 unmodified lines
20222022 attr->ia_size > inode->i_size) {
20232023 i_size_write(inode, attr->ia_size);
20242024 inode->i_blocks = calc_inode_blocks(attr->ia_size);
2025− inode->i_ctime = attr->ia_ctime;
20262025 ci->i_reported_size = attr->ia_size;
20272026 dirtied |= CEPH_CAP_FILE_EXCL;
20282027 } else if ((issued & CEPH_CAP_FILE_SHARED) == 0 ||
@@ -2044,7 +2043,6 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) · 15 unmodified lines
20442043 inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec,
20452044 attr->ia_ctime.tv_sec, attr->ia_ctime.tv_nsec,
20462045 only ? "ctime only" : "ignored");
2047− inode->i_ctime = attr->ia_ctime;
20482046 if (only) {
20492047 /*
20502048 * if kernel wants to dirty ctime but nothing else,
@@ -2067,7 +2065,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) · 16 unmodified lines
20672065 if (dirtied) {
20682066 inode_dirty_flags = __ceph_mark_dirty_caps(ci, dirtied,
20692067 &prealloc_cf);
2070− inode->i_ctime = current_time(inode);
2068+ inode->i_ctime = attr->ia_ctime;
20712069 }
20722070
20732071 release &= issued;
@@ -2085,6 +2083,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) · 11 unmodified lines
20852083 req->r_inode_drop = release;
20862084 req->r_args.setattr.mask = cpu_to_le32(mask);
20872085 req->r_num_caps = 1;
2086+ req->r_stamp = attr->ia_ctime;
20882087 err = ceph_mdsc_do_request(mdsc, NULL, req);
20892088 }
20902089 dout("setattr %p result=%d (%s locally, %d remote)\n", inode, err,
fs/ceph/mds_client.c+1−3
@@ -1687,7 +1687,6 @@ struct ceph_mds_request * · 1686 unmodified lines
16871687 ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode)
16881688 {
16891689 struct ceph_mds_request *req = kzalloc(sizeof(*req), GFP_NOFS);
1690− struct timespec ts;
16911690
16921691 if (!req)
16931692 return ERR_PTR(-ENOMEM);
@@ -1706,8 +1705,7 @@ ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode) · 12 unmodified lines
17061705 init_completion(&req->r_safe_completion);
17071706 INIT_LIST_HEAD(&req->r_unsafe_item);
17081707
1709− ktime_get_real_ts(&ts);
1710− req->r_stamp = timespec_trunc(ts, mdsc->fsc->sb->s_time_gran);
1708+ req->r_stamp = timespec_trunc(current_kernel_time(), mdsc->fsc->sb->s_time_gran);
17111709
17121710 req->r_op = op;
17131711 req->r_direct_mode = mode;
fs/cifs/file.c+1−1
@@ -3271,7 +3271,7 @@ ssize_t cifs_user_readv(struct kiocb *iocb, struct iov_iter *to) · 3270 unmodified lines
32713271 if (!is_sync_kiocb(iocb))
32723272 ctx->iocb = iocb;
32733273
3274− if (to->type & ITER_IOVEC)
3274+ if (to->type == ITER_IOVEC)
32753275 ctx->should_dirty = true;
32763276
32773277 rc = setup_aio_ctx_iter(ctx, to, READ);
fs/cifs/misc.c+1−1
@@ -810,7 +810,7 @@ setup_aio_ctx_iter(struct cifs_aio_ctx *ctx, struct iov_iter *iter, int rw) · 809 unmodified lines
810810
811811 if (!pages) {
812812 pages = vmalloc(max_pages * sizeof(struct page *));
813− if (!bv) {
813+ if (!pages) {
814814 kvfree(bv);
815815 return -ENOMEM;
816816 }
fs/cifs/smb1ops.c+7−2
@@ -849,8 +849,13 @@ cifs_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, · 848 unmodified lines
849849 struct cifs_fid *fid, __u16 search_flags,
850850 struct cifs_search_info *srch_inf)
851851 {
852− return CIFSFindFirst(xid, tcon, path, cifs_sb,
853− &fid->netfid, search_flags, srch_inf, true);
852+ int rc;
853+
854+ rc = CIFSFindFirst(xid, tcon, path, cifs_sb,
855+ &fid->netfid, search_flags, srch_inf, true);
856+ if (rc)
857+ cifs_dbg(FYI, "find first failed=%d\n", rc);
858+ return rc;
854859 }
855860
856861 static int
fs/cifs/smb2ops.c+5−3
@@ -982,7 +982,7 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, · 981 unmodified lines
982982 rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL);
983983 kfree(utf16_path);
984984 if (rc) {
985− cifs_dbg(VFS, "open dir failed\n");
985+ cifs_dbg(FYI, "open dir failed rc=%d\n", rc);
986986 return rc;
987987 }
988988
@@ -992,7 +992,7 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, · 3 unmodified lines
992992 rc = SMB2_query_directory(xid, tcon, fid->persistent_fid,
993993 fid->volatile_fid, 0, srch_inf);
994994 if (rc) {
995− cifs_dbg(VFS, "query directory failed\n");
995+ cifs_dbg(FYI, "query directory failed rc=%d\n", rc);
996996 SMB2_close(xid, tcon, fid->persistent_fid, fid->volatile_fid);
997997 }
998998 return rc;
@@ -1809,7 +1809,8 @@ crypt_message(struct TCP_Server_Info *server, struct smb_rqst *rqst, int enc) · 810 unmodified lines
18091809
18101810 sg = init_sg(rqst, sign);
18111811 if (!sg) {
1812− cifs_dbg(VFS, "%s: Failed to init sg %d", __func__, rc);
1812+ cifs_dbg(VFS, "%s: Failed to init sg", __func__);
1813+ rc = -ENOMEM;
18131814 goto free_req;
18141815 }
18151816
@@ -1817,6 +1818,7 @@ crypt_message(struct TCP_Server_Info *server, struct smb_rqst *rqst, int enc) · 1 unmodified line
18171818 iv = kzalloc(iv_len, GFP_KERNEL);
18181819 if (!iv) {
18191820 cifs_dbg(VFS, "%s: Failed to alloc IV", __func__);
1821+ rc = -ENOMEM;
18201822 goto free_sg;
18211823 }
18221824 iv[0] = 3;
fs/cifs/xattr.c+0−2
@@ -188,8 +188,6 @@ static int cifs_creation_time_get(struct dentry *dentry, struct inode *inode, · 187 unmodified lines
188188 pcreatetime = (__u64 *)value;
189189 *pcreatetime = CIFS_I(inode)->createtime;
190190 return sizeof(__u64);
191−
192− return rc;
193191 }
194192
195193
fs/configfs/item.c+8−0
@@ -138,6 +138,14 @@ struct config_item *config_item_get(struct config_item *item) · 137 unmodified lines
138138 }
139139 EXPORT_SYMBOL(config_item_get);
140140
141+struct config_item *config_item_get_unless_zero(struct config_item *item)
142+{
143+ if (item && kref_get_unless_zero(&item->ci_kref))
144+ return item;
145+ return NULL;
146+}
147+EXPORT_SYMBOL(config_item_get_unless_zero);
148+
141149 static void config_item_cleanup(struct config_item *item)
142150 {
143151 struct config_item_type *t = item->ci_type;
fs/configfs/symlink.c+1−2
@@ -83,14 +83,13 @@ static int create_link(struct config_item *parent_item, · 82 unmodified lines
8383 ret = -ENOMEM;
8484 sl = kmalloc(sizeof(struct configfs_symlink), GFP_KERNEL);
8585 if (sl) {
86− sl->sl_target = config_item_get(item);
8786 spin_lock(&configfs_dirent_lock);
8887 if (target_sd->s_type & CONFIGFS_USET_DROPPING) {
8988 spin_unlock(&configfs_dirent_lock);
90− config_item_put(item);
9189 kfree(sl);
9290 return -ENOENT;
9391 }
92+ sl->sl_target = config_item_get(item);
9493 list_add(&sl->sl_list, &target_sd->s_links);
9594 spin_unlock(&configfs_dirent_lock);
9695 ret = configfs_create_link(sl, parent_item->ci_dentry,
fs/dax.c+1−0
@@ -859,6 +859,7 @@ int dax_writeback_mapping_range(struct address_space *mapping, · 858 unmodified lines
859859 if (ret < 0)
860860 goto out;
861861 }
862+ start_index = indices[pvec.nr - 1] + 1;
862863 }
863864 out:
864865 put_dax(dax_dev);
fs/dcache.c+4−6
@@ -1494,7 +1494,7 @@ static void check_and_drop(void *_data) · 1493 unmodified lines
14941494 {
14951495 struct detach_data *data = _data;
14961496
1497− if (!data->mountpoint && !data->select.found)
1497+ if (!data->mountpoint && list_empty(&data->select.dispose))
14981498 __d_drop(data->select.start);
14991499 }
15001500
@@ -1536,17 +1536,15 @@ void d_invalidate(struct dentry *dentry) · 35 unmodified lines
15361536
15371537 d_walk(dentry, &data, detach_and_collect, check_and_drop);
15381538
1539− if (data.select.found)
1539+ if (!list_empty(&data.select.dispose))
15401540 shrink_dentry_list(&data.select.dispose);
1541+ else if (!data.mountpoint)
1542+ return;
15411543
15421544 if (data.mountpoint) {
15431545 detach_mounts(data.mountpoint);
15441546 dput(data.mountpoint);
15451547 }
1546−
1547− if (!data.mountpoint && !data.select.found)
1548− break;
1549−
15501548 cond_resched();
15511549 }
15521550 }
fs/exec.c+24−4
@@ -220,8 +220,26 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, · 219 unmodified lines
220220
221221 if (write) {
222222 unsigned long size = bprm->vma->vm_end - bprm->vma->vm_start;
223+ unsigned long ptr_size;
223224 struct rlimit *rlim;
224225
226+ /*
227+ * Since the stack will hold pointers to the strings, we
228+ * must account for them as well.
229+ *
230+ * The size calculation is the entire vma while each arg page is
231+ * built, so each time we get here it's calculating how far it
232+ * is currently (rather than each call being just the newly
233+ * added size from the arg page). As a result, we need to
234+ * always add the entire size of the pointers, so that on the
235+ * last call to get_arg_page() we'll actually have the entire
236+ * correct size.
237+ */
238+ ptr_size = (bprm->argc + bprm->envc) * sizeof(void *);
239+ if (ptr_size > ULONG_MAX - size)
240+ goto fail;
241+ size += ptr_size;
242+
225243 acct_arg_size(bprm, size / PAGE_SIZE);
226244
227245 /*
@@ -239,13 +257,15 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, · 11 unmodified lines
239257 * to work from.
240258 */
241259 rlim = current->signal->rlim;
242− if (size > ACCESS_ONCE(rlim[RLIMIT_STACK].rlim_cur) / 4) {
243− put_page(page);
244− return NULL;
245− }
260+ if (size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur) / 4)
261+ goto fail;
246262 }
247263
248264 return page;
265+
266+fail:
267+ put_page(page);
268+ return NULL;
249269 }
250270
251271 static void put_arg_page(struct page *page)
fs/f2fs/f2fs.h+4−1
@@ -1078,6 +1078,7 @@ static inline u32 f2fs_crc32(struct f2fs_sb_info *sbi, const void *address, · 1077 unmodified lines
10781078 {
10791079 SHASH_DESC_ON_STACK(shash, sbi->s_chksum_driver);
10801080 u32 *ctx = (u32 *)shash_desc_ctx(shash);
1081+ u32 retval;
10811082 int err;
10821083
10831084 shash->tfm = sbi->s_chksum_driver;
@@ -1087,7 +1088,9 @@ static inline u32 f2fs_crc32(struct f2fs_sb_info *sbi, const void *address, · 3 unmodified lines
10871088 err = crypto_shash_update(shash, address, length);
10881089 BUG_ON(err);
10891090
1090− return *ctx;
1091+ retval = *ctx;
1092+ barrier_data(ctx);
1093+ return retval;
10911094 }
10921095
10931096 static inline bool f2fs_crc_valid(struct f2fs_sb_info *sbi, __u32 blk_crc,
fs/hugetlbfs/inode.c+1−1
@@ -200,7 +200,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, · 199 unmodified lines
200200 addr = ALIGN(addr, huge_page_size(h));
201201 vma = find_vma(mm, addr);
202202 if (TASK_SIZE - len >= addr &&
203− (!vma || addr + len <= vma->vm_start))
203+ (!vma || addr + len <= vm_start_gap(vma)))
204204 return addr;
205205 }
206206
fs/namespace.c+2−0
@@ -3488,6 +3488,8 @@ static int mntns_install(struct nsproxy *nsproxy, struct ns_common *ns) · 3487 unmodified lines
34883488 return err;
34893489 }
34903490
3491+ put_mnt_ns(old_mnt_ns);
3492+
34913493 /* Update the pwd and root */
34923494 set_fs_pwd(fs, &root);
34933495 set_fs_root(fs, &root);
fs/ocfs2/dlmglue.c+4−0
@@ -2591,6 +2591,10 @@ void ocfs2_inode_unlock_tracker(struct inode *inode, · 2590 unmodified lines
25912591 struct ocfs2_lock_res *lockres;
25922592
25932593 lockres = &OCFS2_I(inode)->ip_inode_lockres;
2594+ /* had_lock means that the currect process already takes the cluster
2595+ * lock previously. If had_lock is 1, we have nothing to do here, and
2596+ * it will get unlocked where we got the lock.
2597+ */
25942598 if (!had_lock) {
25952599 ocfs2_remove_holder(lockres, oh);
25962600 ocfs2_inode_unlock(inode, ex);
fs/ocfs2/xattr.c+13−10
@@ -1328,20 +1328,21 @@ static int ocfs2_xattr_get(struct inode *inode, · 1327 unmodified lines
13281328 void *buffer,
13291329 size_t buffer_size)
13301330 {
1331− int ret;
1331+ int ret, had_lock;
13321332 struct buffer_head *di_bh = NULL;
1333+ struct ocfs2_lock_holder oh;
13331334
1334− ret = ocfs2_inode_lock(inode, &di_bh, 0);
1335− if (ret < 0) {
1336− mlog_errno(ret);
1337− return ret;
1335+ had_lock = ocfs2_inode_lock_tracker(inode, &di_bh, 0, &oh);
1336+ if (had_lock < 0) {
1337+ mlog_errno(had_lock);
1338+ return had_lock;
13381339 }
13391340 down_read(&OCFS2_I(inode)->ip_xattr_sem);
13401341 ret = ocfs2_xattr_get_nolock(inode, di_bh, name_index,
13411342 name, buffer, buffer_size);
13421343 up_read(&OCFS2_I(inode)->ip_xattr_sem);
13431344
1344− ocfs2_inode_unlock(inode, 0);
1345+ ocfs2_inode_unlock_tracker(inode, 0, &oh, had_lock);
13451346
13461347 brelse(di_bh);
13471348
@@ -3537,11 +3538,12 @@ int ocfs2_xattr_set(struct inode *inode, · 2189 unmodified lines
35373538 {
35383539 struct buffer_head *di_bh = NULL;
35393540 struct ocfs2_dinode *di;
3540− int ret, credits, ref_meta = 0, ref_credits = 0;
3541+ int ret, credits, had_lock, ref_meta = 0, ref_credits = 0;
35413542 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
35423543 struct inode *tl_inode = osb->osb_tl_inode;
35433544 struct ocfs2_xattr_set_ctxt ctxt = { NULL, NULL, NULL, };
35443545 struct ocfs2_refcount_tree *ref_tree = NULL;
3546+ struct ocfs2_lock_holder oh;
35453547
35463548 struct ocfs2_xattr_info xi = {
35473549 .xi_name_index = name_index,
@@ -3572,8 +3574,9 @@ int ocfs2_xattr_set(struct inode *inode, · 24 unmodified lines
35723574 return -ENOMEM;
35733575 }
35743576
3575− ret = ocfs2_inode_lock(inode, &di_bh, 1);
3576− if (ret < 0) {
3577+ had_lock = ocfs2_inode_lock_tracker(inode, &di_bh, 1, &oh);
3578+ if (had_lock < 0) {
3579+ ret = had_lock;
35773580 mlog_errno(ret);
35783581 goto cleanup_nolock;
35793582 }
@@ -3670,7 +3673,7 @@ cleanup: · 90 unmodified lines
36703673 if (ret)
36713674 mlog_errno(ret);
36723675 }
3673− ocfs2_inode_unlock(inode, 1);
3676+ ocfs2_inode_unlock_tracker(inode, 1, &oh, had_lock);
36743677 cleanup_nolock:
36753678 brelse(di_bh);
36763679 brelse(xbs.xattr_bh);
fs/proc/task_mmu.c+0−4
@@ -300,11 +300,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid) · 299 unmodified lines
300300
301301 /* We don't show the stack guard page in /proc/maps */
302302 start = vma->vm_start;
303− if (stack_guard_page_start(vma, start))
304− start += PAGE_SIZE;
305303 end = vma->vm_end;
306− if (stack_guard_page_end(vma, end))
307− end -= PAGE_SIZE;
308304
309305 seq_setwidth(m, 25 + sizeof(void *) * 6 - 1);
310306 seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ",
fs/read_write.c+1−1
@@ -1285,7 +1285,7 @@ static size_t compat_writev(struct file *file, · 1284 unmodified lines
12851285 if (!(file->f_mode & FMODE_CAN_WRITE))
12861286 goto out;
12871287
1288− ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos, 0);
1288+ ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos, flags);
12891289
12901290 out:
12911291 if (ret > 0)
fs/ufs/balloc.c+19−25
@@ -400,10 +400,12 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, · 399 unmodified lines
400400 /*
401401 * There is not enough space for user on the device
402402 */
403− if (!capable(CAP_SYS_RESOURCE) && ufs_freespace(uspi, UFS_MINFREE) <= 0) {
404− mutex_unlock(&UFS_SB(sb)->s_lock);
405− UFSD("EXIT (FAILED)\n");
406− return 0;
403+ if (unlikely(ufs_freefrags(uspi) <= uspi->s_root_blocks)) {
404+ if (!capable(CAP_SYS_RESOURCE)) {
405+ mutex_unlock(&UFS_SB(sb)->s_lock);
406+ UFSD("EXIT (FAILED)\n");
407+ return 0;
408+ }
407409 }
408410
409411 if (goal >= uspi->s_size)
@@ -421,12 +423,12 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, · 11 unmodified lines
421423 if (result) {
422424 ufs_clear_frags(inode, result + oldcount,
423425 newcount - oldcount, locked_page != NULL);
426+ *err = 0;
424427 write_seqlock(&UFS_I(inode)->meta_lock);
425428 ufs_cpu_to_data_ptr(sb, p, result);
426− write_sequnlock(&UFS_I(inode)->meta_lock);
427− *err = 0;
428429 UFS_I(inode)->i_lastfrag =
429430 max(UFS_I(inode)->i_lastfrag, fragment + count);
431+ write_sequnlock(&UFS_I(inode)->meta_lock);
430432 }
431433 mutex_unlock(&UFS_SB(sb)->s_lock);
432434 UFSD("EXIT, result %llu\n", (unsigned long long)result);
@@ -439,8 +441,10 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, · 6 unmodified lines
439441 result = ufs_add_fragments(inode, tmp, oldcount, newcount);
440442 if (result) {
441443 *err = 0;
444+ read_seqlock_excl(&UFS_I(inode)->meta_lock);
442445 UFS_I(inode)->i_lastfrag = max(UFS_I(inode)->i_lastfrag,
443446 fragment + count);
447+ read_sequnlock_excl(&UFS_I(inode)->meta_lock);
444448 ufs_clear_frags(inode, result + oldcount, newcount - oldcount,
445449 locked_page != NULL);
446450 mutex_unlock(&UFS_SB(sb)->s_lock);
@@ -451,39 +455,29 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, · 4 unmodified lines
451455 /*
452456 * allocate new block and move data
453457 */
454− switch (fs32_to_cpu(sb, usb1->fs_optim)) {
455− case UFS_OPTSPACE:
458+ if (fs32_to_cpu(sb, usb1->fs_optim) == UFS_OPTSPACE) {
456459 request = newcount;
457− if (uspi->s_minfree < 5 || uspi->cs_total.cs_nffree
458− > uspi->s_dsize * uspi->s_minfree / (2 * 100))
459− break;
460− usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTTIME);
461− break;
462− default:
463− usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTTIME);
464−
465− case UFS_OPTTIME:
460+ if (uspi->cs_total.cs_nffree < uspi->s_space_to_time)
461+ usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTTIME);
462+ } else {
466463 request = uspi->s_fpb;
467− if (uspi->cs_total.cs_nffree < uspi->s_dsize *
468− (uspi->s_minfree - 2) / 100)
469− break;
470− usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTTIME);
471− break;
464+ if (uspi->cs_total.cs_nffree > uspi->s_time_to_space)
465+ usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTSPACE);
472466 }
473467 result = ufs_alloc_fragments (inode, cgno, goal, request, err);
474468 if (result) {
475469 ufs_clear_frags(inode, result + oldcount, newcount - oldcount,
476470 locked_page != NULL);
471+ mutex_unlock(&UFS_SB(sb)->s_lock);
477472 ufs_change_blocknr(inode, fragment - oldcount, oldcount,
478473 uspi->s_sbbase + tmp,
479474 uspi->s_sbbase + result, locked_page);
475+ *err = 0;
480476 write_seqlock(&UFS_I(inode)->meta_lock);
481477 ufs_cpu_to_data_ptr(sb, p, result);
482− write_sequnlock(&UFS_I(inode)->meta_lock);
483− *err = 0;
484478 UFS_I(inode)->i_lastfrag = max(UFS_I(inode)->i_lastfrag,
485479 fragment + count);
486− mutex_unlock(&UFS_SB(sb)->s_lock);
480+ write_sequnlock(&UFS_I(inode)->meta_lock);
487481 if (newcount < request)
488482 ufs_free_fragments (inode, result + newcount, request - newcount);
489483 ufs_free_fragments (inode, tmp, oldcount);
fs/ufs/inode.c+43−31
@@ -401,13 +401,20 @@ static int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buff · 400 unmodified lines
401401 u64 phys64 = 0;
402402 unsigned frag = fragment & uspi->s_fpbmask;
403403
404− if (!create) {
405− phys64 = ufs_frag_map(inode, offsets, depth);
406− if (phys64)
407− map_bh(bh_result, sb, phys64 + frag);
408− return 0;
409− }
404+ phys64 = ufs_frag_map(inode, offsets, depth);
405+ if (!create)
406+ goto done;
410407
408+ if (phys64) {
409+ if (fragment >= UFS_NDIR_FRAGMENT)
410+ goto done;
411+ read_seqlock_excl(&UFS_I(inode)->meta_lock);
412+ if (fragment < UFS_I(inode)->i_lastfrag) {
413+ read_sequnlock_excl(&UFS_I(inode)->meta_lock);
414+ goto done;
415+ }
416+ read_sequnlock_excl(&UFS_I(inode)->meta_lock);
417+ }
411418 /* This code entered only while writing ....? */
412419
413420 mutex_lock(&UFS_I(inode)->truncate_mutex);
@@ -451,6 +458,11 @@ out: · 37 unmodified lines
451458 }
452459 mutex_unlock(&UFS_I(inode)->truncate_mutex);
453460 return err;
461+
462+done:
463+ if (phys64)
464+ map_bh(bh_result, sb, phys64 + frag);
465+ return 0;
454466 }
455467
456468 static int ufs_writepage(struct page *page, struct writeback_control *wbc)
@@ -554,10 +566,8 @@ static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode) · 97 unmodified lines
554566 */
555567 inode->i_mode = mode = fs16_to_cpu(sb, ufs_inode->ui_mode);
556568 set_nlink(inode, fs16_to_cpu(sb, ufs_inode->ui_nlink));
557− if (inode->i_nlink == 0) {
558− ufs_error (sb, "ufs_read_inode", "inode %lu has zero nlink\n", inode->i_ino);
559− return -1;
560− }
569+ if (inode->i_nlink == 0)
570+ return -ESTALE;
561571
562572 /*
563573 * Linux now has 32-bit uid and gid, so we can support EFT.
@@ -566,9 +576,9 @@ static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode) · 2 unmodified lines
566576 i_gid_write(inode, ufs_get_inode_gid(sb, ufs_inode));
567577
568578 inode->i_size = fs64_to_cpu(sb, ufs_inode->ui_size);
569− inode->i_atime.tv_sec = fs32_to_cpu(sb, ufs_inode->ui_atime.tv_sec);
570− inode->i_ctime.tv_sec = fs32_to_cpu(sb, ufs_inode->ui_ctime.tv_sec);
571− inode->i_mtime.tv_sec = fs32_to_cpu(sb, ufs_inode->ui_mtime.tv_sec);
579+ inode->i_atime.tv_sec = (signed)fs32_to_cpu(sb, ufs_inode->ui_atime.tv_sec);
580+ inode->i_ctime.tv_sec = (signed)fs32_to_cpu(sb, ufs_inode->ui_ctime.tv_sec);
581+ inode->i_mtime.tv_sec = (signed)fs32_to_cpu(sb, ufs_inode->ui_mtime.tv_sec);
572582 inode->i_mtime.tv_nsec = 0;
573583 inode->i_atime.tv_nsec = 0;
574584 inode->i_ctime.tv_nsec = 0;
@@ -602,10 +612,8 @@ static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode) · 27 unmodified lines
602612 */
603613 inode->i_mode = mode = fs16_to_cpu(sb, ufs2_inode->ui_mode);
604614 set_nlink(inode, fs16_to_cpu(sb, ufs2_inode->ui_nlink));
605− if (inode->i_nlink == 0) {
606− ufs_error (sb, "ufs_read_inode", "inode %lu has zero nlink\n", inode->i_ino);
607− return -1;
608− }
615+ if (inode->i_nlink == 0)
616+ return -ESTALE;
609617
610618 /*
611619 * Linux now has 32-bit uid and gid, so we can support EFT.
@@ -645,7 +653,7 @@ struct inode *ufs_iget(struct super_block *sb, unsigned long ino) · 33 unmodified lines
645653 struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
646654 struct buffer_head * bh;
647655 struct inode *inode;
648− int err;
656+ int err = -EIO;
649657
650658 UFSD("ENTER, ino %lu\n", ino);
651659
@@ -680,9 +688,10 @@ struct inode *ufs_iget(struct super_block *sb, unsigned long ino) · 28 unmodified lines
680688 err = ufs1_read_inode(inode,
681689 ufs_inode + ufs_inotofsbo(inode->i_ino));
682690 }
683−
691+ brelse(bh);
684692 if (err)
685693 goto bad_inode;
694+
686695 inode->i_version++;
687696 ufsi->i_lastfrag =
688697 (inode->i_size + uspi->s_fsize - 1) >> uspi->s_fshift;
@@ -691,15 +700,13 @@ struct inode *ufs_iget(struct super_block *sb, unsigned long ino) · 2 unmodified lines
691700
692701 ufs_set_inode_ops(inode);
693702
694− brelse(bh);
695−
696703 UFSD("EXIT\n");
697704 unlock_new_inode(inode);
698705 return inode;
699706
700707 bad_inode:
701708 iget_failed(inode);
702− return ERR_PTR(-EIO);
709+ return ERR_PTR(err);
703710 }
704711
705712 static void ufs1_update_inode(struct inode *inode, struct ufs_inode *ufs_inode)
@@ -874,7 +881,6 @@ static inline void free_data(struct to_free *ctx, u64 from, unsigned count) · 168 unmodified lines
874881 ctx->to = from + count;
875882 }
876883
877−#define DIRECT_BLOCK ((inode->i_size + uspi->s_bsize - 1) >> uspi->s_bshift)
878884 #define DIRECT_FRAGMENT ((inode->i_size + uspi->s_fsize - 1) >> uspi->s_fshift)
879885
880886 static void ufs_trunc_direct(struct inode *inode)
@@ -1112,19 +1118,24 @@ static void ufs_truncate_blocks(struct inode *inode) · 231 unmodified lines
11121118 struct super_block *sb = inode->i_sb;
11131119 struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
11141120 unsigned offsets[4];
1115− int depth = ufs_block_to_path(inode, DIRECT_BLOCK, offsets);
1121+ int depth;
11161122 int depth2;
11171123 unsigned i;
11181124 struct ufs_buffer_head *ubh[3];
11191125 void *p;
11201126 u64 block;
11211127
1122− if (!depth)
1123− return;
1128+ if (inode->i_size) {
1129+ sector_t last = (inode->i_size - 1) >> uspi->s_bshift;
1130+ depth = ufs_block_to_path(inode, last, offsets);
1131+ if (!depth)
1132+ return;
1133+ } else {
1134+ depth = 1;
1135+ }
11241136
1125− /* find the last non-zero in offsets[] */
11261137 for (depth2 = depth - 1; depth2; depth2--)
1127− if (offsets[depth2])
1138+ if (offsets[depth2] != uspi->s_apb - 1)
11281139 break;
11291140
11301141 mutex_lock(&ufsi->truncate_mutex);
@@ -1133,9 +1144,8 @@ static void ufs_truncate_blocks(struct inode *inode) · 2 unmodified lines
11331144 offsets[0] = UFS_IND_BLOCK;
11341145 } else {
11351146 /* get the blocks that should be partially emptied */
1136− p = ufs_get_direct_data_ptr(uspi, ufsi, offsets[0]);
1147+ p = ufs_get_direct_data_ptr(uspi, ufsi, offsets[0]++);
11371148 for (i = 0; i < depth2; i++) {
1138− offsets[i]++; /* next branch is fully freed */
11391149 block = ufs_data_ptr_to_cpu(sb, p);
11401150 if (!block)
11411151 break;
@@ -1146,7 +1156,7 @@ static void ufs_truncate_blocks(struct inode *inode) · 4 unmodified lines
11461156 write_sequnlock(&ufsi->meta_lock);
11471157 break;
11481158 }
1149− p = ubh_get_data_ptr(uspi, ubh[i], offsets[i + 1]);
1159+ p = ubh_get_data_ptr(uspi, ubh[i], offsets[i + 1]++);
11501160 }
11511161 while (i--)
11521162 free_branch_tail(inode, offsets[i + 1], ubh[i], depth - i - 1);
@@ -1161,7 +1171,9 @@ static void ufs_truncate_blocks(struct inode *inode) · 8 unmodified lines
11611171 free_full_branch(inode, block, i - UFS_IND_BLOCK + 1);
11621172 }
11631173 }
1174+ read_seqlock_excl(&ufsi->meta_lock);
11641175 ufsi->i_lastfrag = DIRECT_FRAGMENT;
1176+ read_sequnlock_excl(&ufsi->meta_lock);
11651177 mark_inode_dirty(inode);
11661178 mutex_unlock(&ufsi->truncate_mutex);
11671179 }
fs/ufs/super.c+49−24
@@ -480,7 +480,7 @@ static void ufs_setup_cstotal(struct super_block *sb) · 479 unmodified lines
480480 usb3 = ubh_get_usb_third(uspi);
481481
482482 if ((mtype == UFS_MOUNT_UFSTYPE_44BSD &&
483− (usb1->fs_flags & UFS_FLAGS_UPDATED)) ||
483+ (usb2->fs_un.fs_u2.fs_maxbsize == usb1->fs_bsize)) ||
484484 mtype == UFS_MOUNT_UFSTYPE_UFS2) {
485485 /*we have statistic in different place, then usual*/
486486 uspi->cs_total.cs_ndir = fs64_to_cpu(sb, usb2->fs_un.fs_u2.cs_ndir);
@@ -596,9 +596,7 @@ static void ufs_put_cstotal(struct super_block *sb) · 109 unmodified lines
596596 usb2 = ubh_get_usb_second(uspi);
597597 usb3 = ubh_get_usb_third(uspi);
598598
599− if ((mtype == UFS_MOUNT_UFSTYPE_44BSD &&
600− (usb1->fs_flags & UFS_FLAGS_UPDATED)) ||
601− mtype == UFS_MOUNT_UFSTYPE_UFS2) {
599+ if (mtype == UFS_MOUNT_UFSTYPE_UFS2) {
602600 /*we have statistic in different place, then usual*/
603601 usb2->fs_un.fs_u2.cs_ndir =
604602 cpu_to_fs64(sb, uspi->cs_total.cs_ndir);
@@ -608,16 +606,26 @@ static void ufs_put_cstotal(struct super_block *sb) · 3 unmodified lines
608606 cpu_to_fs64(sb, uspi->cs_total.cs_nifree);
609607 usb3->fs_un1.fs_u2.cs_nffree =
610608 cpu_to_fs64(sb, uspi->cs_total.cs_nffree);
611− } else {
612− usb1->fs_cstotal.cs_ndir =
613− cpu_to_fs32(sb, uspi->cs_total.cs_ndir);
614− usb1->fs_cstotal.cs_nbfree =
615− cpu_to_fs32(sb, uspi->cs_total.cs_nbfree);
616− usb1->fs_cstotal.cs_nifree =
617− cpu_to_fs32(sb, uspi->cs_total.cs_nifree);
618− usb1->fs_cstotal.cs_nffree =
619− cpu_to_fs32(sb, uspi->cs_total.cs_nffree);
609+ goto out;
610+ }
611+
612+ if (mtype == UFS_MOUNT_UFSTYPE_44BSD &&
613+ (usb2->fs_un.fs_u2.fs_maxbsize == usb1->fs_bsize)) {
614+ /* store stats in both old and new places */
615+ usb2->fs_un.fs_u2.cs_ndir =
616+ cpu_to_fs64(sb, uspi->cs_total.cs_ndir);
617+ usb2->fs_un.fs_u2.cs_nbfree =
618+ cpu_to_fs64(sb, uspi->cs_total.cs_nbfree);
619+ usb3->fs_un1.fs_u2.cs_nifree =
620+ cpu_to_fs64(sb, uspi->cs_total.cs_nifree);
621+ usb3->fs_un1.fs_u2.cs_nffree =
622+ cpu_to_fs64(sb, uspi->cs_total.cs_nffree);
620623 }
624+ usb1->fs_cstotal.cs_ndir = cpu_to_fs32(sb, uspi->cs_total.cs_ndir);
625+ usb1->fs_cstotal.cs_nbfree = cpu_to_fs32(sb, uspi->cs_total.cs_nbfree);
626+ usb1->fs_cstotal.cs_nifree = cpu_to_fs32(sb, uspi->cs_total.cs_nifree);
627+ usb1->fs_cstotal.cs_nffree = cpu_to_fs32(sb, uspi->cs_total.cs_nffree);
628+out:
621629 ubh_mark_buffer_dirty(USPI_UBH(uspi));
622630 ufs_print_super_stuff(sb, usb1, usb2, usb3);
623631 UFSD("EXIT\n");
@@ -996,6 +1004,13 @@ again: · 372 unmodified lines
9961004 flags |= UFS_ST_SUN;
9971005 }
9981006
1007+ if ((flags & UFS_ST_MASK) == UFS_ST_44BSD &&
1008+ uspi->s_postblformat == UFS_42POSTBLFMT) {
1009+ if (!silent)
1010+ pr_err("this is not a 44bsd filesystem");
1011+ goto failed;
1012+ }
1013+
9991014 /*
10001015 * Check ufs magic number
10011016 */
@@ -1143,8 +1158,8 @@ magic_found: · 141 unmodified lines
11431158 uspi->s_cgmask = fs32_to_cpu(sb, usb1->fs_cgmask);
11441159
11451160 if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) {
1146− uspi->s_u2_size = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_size);
1147− uspi->s_u2_dsize = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_dsize);
1161+ uspi->s_size = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_size);
1162+ uspi->s_dsize = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_dsize);
11481163 } else {
11491164 uspi->s_size = fs32_to_cpu(sb, usb1->fs_size);
11501165 uspi->s_dsize = fs32_to_cpu(sb, usb1->fs_dsize);
@@ -1193,6 +1208,18 @@ magic_found: · 42 unmodified lines
11931208 uspi->s_postbloff = fs32_to_cpu(sb, usb3->fs_postbloff);
11941209 uspi->s_rotbloff = fs32_to_cpu(sb, usb3->fs_rotbloff);
11951210
1211+ uspi->s_root_blocks = mul_u64_u32_div(uspi->s_dsize,
1212+ uspi->s_minfree, 100);
1213+ if (uspi->s_minfree <= 5) {
1214+ uspi->s_time_to_space = ~0ULL;
1215+ uspi->s_space_to_time = 0;
1216+ usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTSPACE);
1217+ } else {
1218+ uspi->s_time_to_space = (uspi->s_root_blocks / 2) + 1;
1219+ uspi->s_space_to_time = mul_u64_u32_div(uspi->s_dsize,
1220+ uspi->s_minfree - 2, 100) - 1;
1221+ }
1222+
11961223 /*
11971224 * Compute another frequently used values
11981225 */
@@ -1382,19 +1409,17 @@ static int ufs_statfs(struct dentry *dentry, struct kstatfs *buf) · 183 unmodified lines
13821409 mutex_lock(&UFS_SB(sb)->s_lock);
13831410 usb3 = ubh_get_usb_third(uspi);
13841411
1385− if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) {
1412+ if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2)
13861413 buf->f_type = UFS2_MAGIC;
1387− buf->f_blocks = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_dsize);
1388− } else {
1414+ else
13891415 buf->f_type = UFS_MAGIC;
1390− buf->f_blocks = uspi->s_dsize;
1391− }
1392− buf->f_bfree = ufs_blkstofrags(uspi->cs_total.cs_nbfree) +
1393− uspi->cs_total.cs_nffree;
1416+
1417+ buf->f_blocks = uspi->s_dsize;
1418+ buf->f_bfree = ufs_freefrags(uspi);
13941419 buf->f_ffree = uspi->cs_total.cs_nifree;
13951420 buf->f_bsize = sb->s_blocksize;
1396− buf->f_bavail = (buf->f_bfree > (((long)buf->f_blocks / 100) * uspi->s_minfree))
1397− ? (buf->f_bfree - (((long)buf->f_blocks / 100) * uspi->s_minfree)) : 0;
1421+ buf->f_bavail = (buf->f_bfree > uspi->s_root_blocks)
1422+ ? (buf->f_bfree - uspi->s_root_blocks) : 0;
13981423 buf->f_files = uspi->s_ncg * uspi->s_ipg;
13991424 buf->f_namelen = UFS_MAXNAMLEN;
14001425 buf->f_fsid.val[0] = (u32)id;
fs/ufs/ufs_fs.h+5−4
@@ -733,10 +733,8 @@ struct ufs_sb_private_info { · 732 unmodified lines
733733 __u32 s_dblkno; /* offset of first data after cg */
734734 __u32 s_cgoffset; /* cylinder group offset in cylinder */
735735 __u32 s_cgmask; /* used to calc mod fs_ntrak */
736− __u32 s_size; /* number of blocks (fragments) in fs */
737− __u32 s_dsize; /* number of data blocks in fs */
738− __u64 s_u2_size; /* ufs2: number of blocks (fragments) in fs */
739− __u64 s_u2_dsize; /*ufs2: number of data blocks in fs */
736+ __u64 s_size; /* number of blocks (fragments) in fs */
737+ __u64 s_dsize; /* number of data blocks in fs */
740738 __u32 s_ncg; /* number of cylinder groups */
741739 __u32 s_bsize; /* size of basic blocks */
742740 __u32 s_fsize; /* size of fragments */
@@ -793,6 +791,9 @@ struct ufs_sb_private_info { · 50 unmodified lines
793791 __u32 s_maxsymlinklen;/* upper limit on fast symlinks' size */
794792 __s32 fs_magic; /* filesystem magic */
795793 unsigned int s_dirblksize;
794+ __u64 s_root_blocks;
795+ __u64 s_time_to_space;
796+ __u64 s_space_to_time;
796797 };
797798
798799 /*
fs/ufs/util.c+8−9
@@ -243,9 +243,8 @@ ufs_set_inode_dev(struct super_block *sb, struct ufs_inode_info *ufsi, dev_t dev · 242 unmodified lines
243243 struct page *ufs_get_locked_page(struct address_space *mapping,
244244 pgoff_t index)
245245 {
246− struct page *page;
247−
248− page = find_lock_page(mapping, index);
246+ struct inode *inode = mapping->host;
247+ struct page *page = find_lock_page(mapping, index);
249248 if (!page) {
250249 page = read_mapping_page(mapping, index, NULL);
251250
@@ -253,7 +252,7 @@ struct page *ufs_get_locked_page(struct address_space *mapping, · 1 unmodified line
253252 printk(KERN_ERR "ufs_change_blocknr: "
254253 "read_mapping_page error: ino %lu, index: %lu\n",
255254 mapping->host->i_ino, index);
256− goto out;
255+ return page;
257256 }
258257
259258 lock_page(page);
@@ -262,8 +261,7 @@ struct page *ufs_get_locked_page(struct address_space *mapping, · 2 unmodified lines
262261 /* Truncate got there first */
263262 unlock_page(page);
264263 put_page(page);
265− page = NULL;
266− goto out;
264+ return NULL;
267265 }
268266
269267 if (!PageUptodate(page) || PageError(page)) {
@@ -272,11 +270,12 @@ struct page *ufs_get_locked_page(struct address_space *mapping, · 2 unmodified lines
272270
273271 printk(KERN_ERR "ufs_change_blocknr: "
274272 "can not read page: ino %lu, index: %lu\n",
275− mapping->host->i_ino, index);
273+ inode->i_ino, index);
276274
277− page = ERR_PTR(-EIO);
275+ return ERR_PTR(-EIO);
278276 }
279277 }
280−out:
278+ if (!page_has_buffers(page))
279+ create_empty_buffers(page, 1 << inode->i_blkbits, 0);
281280 return page;
282281 }
fs/ufs/util.h+2−7
@@ -350,16 +350,11 @@ static inline void *ubh_get_data_ptr(struct ufs_sb_private_info *uspi, · 349 unmodified lines
350350 #define ubh_blkmap(ubh,begin,bit) \
351351 ((*ubh_get_addr(ubh, (begin) + ((bit) >> 3)) >> ((bit) & 7)) & (0xff >> (UFS_MAXFRAG - uspi->s_fpb)))
352352
353−/*
354− * Determine the number of available frags given a
355− * percentage to hold in reserve.
356− */
357353 static inline u64
358−ufs_freespace(struct ufs_sb_private_info *uspi, int percentreserved)
354+ufs_freefrags(struct ufs_sb_private_info *uspi)
359355 {
360356 return ufs_blkstofrags(uspi->cs_total.cs_nbfree) +
361− uspi->cs_total.cs_nffree -
362− (uspi->s_dsize * (percentreserved) / 100);
357+ uspi->cs_total.cs_nffree;
363358 }
364359
365360 /*
fs/userfaultfd.c+21−8
@@ -340,9 +340,28 @@ int handle_userfault(struct vm_fault *vmf, unsigned long reason) · 339 unmodified lines
340340 bool must_wait, return_to_userland;
341341 long blocking_state;
342342
343− BUG_ON(!rwsem_is_locked(&mm->mmap_sem));
344−
345343 ret = VM_FAULT_SIGBUS;
344+
345+ /*
346+ * We don't do userfault handling for the final child pid update.
347+ *
348+ * We also don't do userfault handling during
349+ * coredumping. hugetlbfs has the special
350+ * follow_hugetlb_page() to skip missing pages in the
351+ * FOLL_DUMP case, anon memory also checks for FOLL_DUMP with
352+ * the no_page_table() helper in follow_page_mask(), but the
353+ * shmem_vm_ops->fault method is invoked even during
354+ * coredumping without mmap_sem and it ends up here.
355+ */
356+ if (current->flags & (PF_EXITING|PF_DUMPCORE))
357+ goto out;
358+
359+ /*
360+ * Coredumping runs without mmap_sem so we can only check that
361+ * the mmap_sem is held, if PF_DUMPCORE was not set.
362+ */
363+ WARN_ON_ONCE(!rwsem_is_locked(&mm->mmap_sem));
364+
346365 ctx = vmf->vma->vm_userfaultfd_ctx.ctx;
347366 if (!ctx)
348367 goto out;
@@ -360,12 +379,6 @@ int handle_userfault(struct vm_fault *vmf, unsigned long reason) · 11 unmodified lines
360379 if (unlikely(ACCESS_ONCE(ctx->released)))
361380 goto out;
362381
363− /*
364− * We don't do userfault handling for the final child pid update.
365− */
366− if (current->flags & PF_EXITING)
367− goto out;
368−
369382 /*
370383 * Check that we can return VM_FAULT_RETRY.
371384 *
fs/xfs/xfs_aops.c+5−2
@@ -1316,9 +1316,12 @@ xfs_vm_bmap( · 1315 unmodified lines
13161316 * The swap code (ab-)uses ->bmap to get a block mapping and then
13171317 * bypasseѕ the file system for actual I/O. We really can't allow
13181318 * that on reflinks inodes, so we have to skip out here. And yes,
1319− * 0 is the magic code for a bmap error..
1319+ * 0 is the magic code for a bmap error.
1320+ *
1321+ * Since we don't pass back blockdev info, we can't return bmap
1322+ * information for rt files either.
13201323 */
1321− if (xfs_is_reflink_inode(ip))
1324+ if (xfs_is_reflink_inode(ip) || XFS_IS_REALTIME_INODE(ip))
13221325 return 0;
13231326
13241327 filemap_write_and_wait(mapping);
fs/xfs/xfs_buf.c+1−1
@@ -117,7 +117,7 @@ static inline void · 116 unmodified lines
117117 __xfs_buf_ioacct_dec(
118118 struct xfs_buf *bp)
119119 {
120− ASSERT(spin_is_locked(&bp->b_lock));
120+ lockdep_assert_held(&bp->b_lock);
121121
122122 if (bp->b_state & XFS_BSTATE_IN_FLIGHT) {
123123 bp->b_state &= ~XFS_BSTATE_IN_FLIGHT;
fs/xfs/xfs_icache.c+2−3
@@ -66,7 +66,6 @@ xfs_inode_alloc( · 65 unmodified lines
6666
6767 XFS_STATS_INC(mp, vn_active);
6868 ASSERT(atomic_read(&ip->i_pincount) == 0);
69− ASSERT(!spin_is_locked(&ip->i_flags_lock));
7069 ASSERT(!xfs_isiflocked(ip));
7170 ASSERT(ip->i_ino == 0);
7271
@@ -190,7 +189,7 @@ xfs_perag_set_reclaim_tag( · 117 unmodified lines
190189 {
191190 struct xfs_mount *mp = pag->pag_mount;
192191
193− ASSERT(spin_is_locked(&pag->pag_ici_lock));
192+ lockdep_assert_held(&pag->pag_ici_lock);
194193 if (pag->pag_ici_reclaimable++)
195194 return;
196195
@@ -212,7 +211,7 @@ xfs_perag_clear_reclaim_tag( · 15 unmodified lines
212211 {
213212 struct xfs_mount *mp = pag->pag_mount;
214213
215− ASSERT(spin_is_locked(&pag->pag_ici_lock));
214+ lockdep_assert_held(&pag->pag_ici_lock);
216215 if (--pag->pag_ici_reclaimable)
217216 return;
218217
include/acpi/acpi_bus.h+2−1
@@ -210,7 +210,8 @@ struct acpi_device_flags { · 209 unmodified lines
210210 u32 of_compatible_ok:1;
211211 u32 coherent_dma:1;
212212 u32 cca_seen:1;
213− u32 reserved:20;
213+ u32 spi_i2c_slave:1;
214+ u32 reserved:19;
214215 };
215216
216217 /* File System */
include/acpi/actbl.h+14−0
@@ -374,6 +374,20 @@ struct acpi_table_desc { · 373 unmodified lines
374374 u16 validation_count;
375375 };
376376
377+/*
378+ * Maximum value of the validation_count field in struct acpi_table_desc.
379+ * When reached, validation_count cannot be changed any more and the table will
380+ * be permanently regarded as validated.
381+ *
382+ * This is to prevent situations in which unbalanced table get/put operations
383+ * may cause premature table unmapping in the OS to happen.
384+ *
385+ * The maximum validation count can be defined to any value, but should be
386+ * greater than the maximum number of OS early stage mapping slots to avoid
387+ * leaking early stage table mappings to the late stage.
388+ */
389+#define ACPI_MAX_TABLE_VALIDATIONS ACPI_UINT16_MAX
390+
377391 /* Masks for Flags field above */
378392
379393 #define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL (0) /* Virtual address, external maintained */
include/dt-bindings/clock/sun50i-a64-ccu.h+2−0
@@ -43,6 +43,8 @@ · 42 unmodified lines
4343 #ifndef _DT_BINDINGS_CLK_SUN50I_A64_H_
4444 #define _DT_BINDINGS_CLK_SUN50I_A64_H_
4545
46+#define CLK_PLL_PERIPH0 11
47+
4648 #define CLK_BUS_MIPI_DSI 28
4749 #define CLK_BUS_CE 29
4850 #define CLK_BUS_DMA 30
include/dt-bindings/clock/sun8i-h3-ccu.h+2−0
@@ -43,6 +43,8 @@ · 42 unmodified lines
4343 #ifndef _DT_BINDINGS_CLK_SUN8I_H3_H_
4444 #define _DT_BINDINGS_CLK_SUN8I_H3_H_
4545
46+#define CLK_PLL_PERIPH0 9
47+
4648 #define CLK_CPUX 14
4749
4850 #define CLK_BUS_CE 20
include/linux/blkdev.h+4−0
@@ -391,6 +391,8 @@ struct request_queue { · 390 unmodified lines
391391 int nr_rqs[2]; /* # allocated [a]sync rqs */
392392 int nr_rqs_elvpriv; /* # allocated rqs w/ elvpriv */
393393
394+ atomic_t shared_hctx_restart;
395+
394396 struct blk_queue_stats *stats;
395397 struct rq_wb *rq_wb;
396398
@@ -586,6 +588,8 @@ struct request_queue { · 189 unmodified lines
586588
587589 size_t cmd_size;
588590 void *rq_alloc_data;
591+
592+ struct work_struct release_work;
589593 };
590594
591595 #define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
include/linux/configfs.h+2−1
@@ -74,7 +74,8 @@ extern void config_item_init_type_name(struct config_item *item, · 73 unmodified lines
7474 const char *name,
7575 struct config_item_type *type);
7676
77−extern struct config_item * config_item_get(struct config_item *);
77+extern struct config_item *config_item_get(struct config_item *);
78+extern struct config_item *config_item_get_unless_zero(struct config_item *);
7879 extern void config_item_put(struct config_item *);
7980
8081 struct config_item_type {
include/linux/dmi.h+1−1
@@ -136,7 +136,7 @@ static inline int dmi_name_in_vendors(const char *s) { return 0; } · 135 unmodified lines
136136 static inline int dmi_name_in_serial(const char *s) { return 0; }
137137 #define dmi_available 0
138138 static inline int dmi_walk(void (*decode)(const struct dmi_header *, void *),
139− void *private_data) { return -1; }
139+ void *private_data) { return -ENXIO; }
140140 static inline bool dmi_match(enum dmi_field f, const char *str)
141141 { return false; }
142142 static inline void dmi_memdev_name(u16 handle, const char **bank,
include/linux/mm.h+25−28
@@ -1393,12 +1393,6 @@ int clear_page_dirty_for_io(struct page *page); · 1392 unmodified lines
13931393
13941394 int get_cmdline(struct task_struct *task, char *buffer, int buflen);
13951395
1396−/* Is the vma a continuation of the stack vma above it? */
1397−static inline int vma_growsdown(struct vm_area_struct *vma, unsigned long addr)
1398−{
1399− return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN);
1400−}
1401−
14021396 static inline bool vma_is_anonymous(struct vm_area_struct *vma)
14031397 {
14041398 return !vma->vm_ops;
@@ -1414,28 +1408,6 @@ bool vma_is_shmem(struct vm_area_struct *vma); · 9 unmodified lines
14141408 static inline bool vma_is_shmem(struct vm_area_struct *vma) { return false; }
14151409 #endif
14161410
1417−static inline int stack_guard_page_start(struct vm_area_struct *vma,
1418− unsigned long addr)
1419−{
1420− return (vma->vm_flags & VM_GROWSDOWN) &&
1421− (vma->vm_start == addr) &&
1422− !vma_growsdown(vma->vm_prev, addr);
1423−}
1424−
1425−/* Is the vma a continuation of the stack vma below it? */
1426−static inline int vma_growsup(struct vm_area_struct *vma, unsigned long addr)
1427−{
1428− return vma && (vma->vm_start == addr) && (vma->vm_flags & VM_GROWSUP);
1429−}
1430−
1431−static inline int stack_guard_page_end(struct vm_area_struct *vma,
1432− unsigned long addr)
1433−{
1434− return (vma->vm_flags & VM_GROWSUP) &&
1435− (vma->vm_end == addr) &&
1436− !vma_growsup(vma->vm_next, addr);
1437−}
1438−
14391411 int vma_is_stack_for_current(struct vm_area_struct *vma);
14401412
14411413 extern unsigned long move_page_tables(struct vm_area_struct *vma,
@@ -2222,6 +2194,7 @@ void page_cache_async_readahead(struct address_space *mapping, · 780 unmodified lines
22222194 pgoff_t offset,
22232195 unsigned long size);
22242196
2197+extern unsigned long stack_guard_gap;
22252198 /* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */
22262199 extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
22272200
@@ -2250,6 +2223,30 @@ static inline struct vm_area_struct * find_vma_intersection(struct mm_struct * m · 22 unmodified lines
22502223 return vma;
22512224 }
22522225
2226+static inline unsigned long vm_start_gap(struct vm_area_struct *vma)
2227+{
2228+ unsigned long vm_start = vma->vm_start;
2229+
2230+ if (vma->vm_flags & VM_GROWSDOWN) {
2231+ vm_start -= stack_guard_gap;
2232+ if (vm_start > vma->vm_start)
2233+ vm_start = 0;
2234+ }
2235+ return vm_start;
2236+}
2237+
2238+static inline unsigned long vm_end_gap(struct vm_area_struct *vma)
2239+{
2240+ unsigned long vm_end = vma->vm_end;
2241+
2242+ if (vma->vm_flags & VM_GROWSUP) {
2243+ vm_end += stack_guard_gap;
2244+ if (vm_end < vma->vm_end)
2245+ vm_end = -PAGE_SIZE;
2246+ }
2247+ return vm_end;
2248+}
2249+
22532250 static inline unsigned long vma_pages(struct vm_area_struct *vma)
22542251 {
22552252 return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
include/linux/netdevice.h+10−5
@@ -914,8 +914,7 @@ struct xfrmdev_ops { · 913 unmodified lines
914914 *
915915 * int (*ndo_change_mtu)(struct net_device *dev, int new_mtu);
916916 * Called when a user wants to change the Maximum Transfer Unit
917− * of a device. If not defined, any request to change MTU will
918− * will return an error.
917+ * of a device.
919918 *
920919 * void (*ndo_tx_timeout)(struct net_device *dev);
921920 * Callback used when the transmitter has not made any progress
@@ -1596,8 +1595,8 @@ enum netdev_priv_flags { · 674 unmodified lines
15961595 * @rtnl_link_state: This enum represents the phases of creating
15971596 * a new link
15981597 *
1599− * @destructor: Called from unregister,
1600− * can be used to call free_netdev
1598+ * @needs_free_netdev: Should unregister perform free_netdev?
1599+ * @priv_destructor: Called from unregister
16011600 * @npinfo: XXX: need comments on this one
16021601 * @nd_net: Network namespace this network device is inside
16031602 *
@@ -1858,7 +1857,8 @@ struct net_device { · 254 unmodified lines
18581857 RTNL_LINK_INITIALIZING,
18591858 } rtnl_link_state:16;
18601859
1861− void (*destructor)(struct net_device *dev);
1860+ bool needs_free_netdev;
1861+ void (*priv_destructor)(struct net_device *dev);
18621862
18631863 #ifdef CONFIG_NETPOLL
18641864 struct netpoll_info __rcu *npinfo;
@@ -4261,6 +4261,11 @@ static inline const char *netdev_name(const struct net_device *dev) · 2396 unmodified lines
42614261 return dev->name;
42624262 }
42634263
4264+static inline bool netdev_unregistering(const struct net_device *dev)
4265+{
4266+ return dev->reg_state == NETREG_UNREGISTERING;
4267+}
4268+
42644269 static inline const char *netdev_reg_state(const struct net_device *dev)
42654270 {
42664271 switch (dev->reg_state) {
include/linux/slub_def.h+1−0
@@ -84,6 +84,7 @@ struct kmem_cache { · 83 unmodified lines
8484 int red_left_pad; /* Left redzone padding size */
8585 #ifdef CONFIG_SYSFS
8686 struct kobject kobj; /* For sysfs */
87+ struct work_struct kobj_remove_work;
8788 #endif
8889 #ifdef CONFIG_MEMCG
8990 struct memcg_cache_params memcg_params;
include/linux/timekeeper_internal.h+2−3
@@ -29,7 +29,6 @@ · 28 unmodified lines
2929 */
3030 struct tk_read_base {
3131 struct clocksource *clock;
32− u64 (*read)(struct clocksource *cs);
3332 u64 mask;
3433 u64 cycle_last;
3534 u32 mult;
@@ -58,7 +57,7 @@ struct tk_read_base { · 22 unmodified lines
5857 * interval.
5958 * @xtime_remainder: Shifted nano seconds left over when rounding
6059 * @cycle_interval
61− * @raw_interval: Raw nano seconds accumulated per NTP interval.
60+ * @raw_interval: Shifted raw nano seconds accumulated per NTP interval.
6261 * @ntp_error: Difference between accumulated time and NTP time in ntp
6362 * shifted nano seconds.
6463 * @ntp_error_shift: Shift conversion between clock shifted nano seconds and
@@ -100,7 +99,7 @@ struct timekeeper { · 35 unmodified lines
10099 u64 cycle_interval;
101100 u64 xtime_interval;
102101 s64 xtime_remainder;
103− u32 raw_interval;
102+ u64 raw_interval;
104103 /* The ntp_tick_length() value currently being used.
105104 * This cached copy ensures we consistently apply the tick
106105 * length for an entire tick, as ntp_tick_length may change
include/media/cec-notifier.h+10−0
@@ -106,6 +106,16 @@ static inline void cec_notifier_set_phys_addr_from_edid(struct cec_notifier *n, · 105 unmodified lines
106106 {
107107 }
108108
109+static inline void cec_notifier_register(struct cec_notifier *n,
110+ struct cec_adapter *adap,
111+ void (*callback)(struct cec_adapter *adap, u16 pa))
112+{
113+}
114+
115+static inline void cec_notifier_unregister(struct cec_notifier *n)
116+{
117+}
118+
109119 #endif
110120
111121 #endif
include/media/cec.h+1−1
@@ -206,7 +206,7 @@ static inline bool cec_is_sink(const struct cec_adapter *adap) · 205 unmodified lines
206206 #define cec_phys_addr_exp(pa) \
207207 ((pa) >> 12), ((pa) >> 8) & 0xf, ((pa) >> 4) & 0xf, (pa) & 0xf
208208
209−#if IS_ENABLED(CONFIG_CEC_CORE)
209+#if IS_REACHABLE(CONFIG_CEC_CORE)
210210 struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
211211 void *priv, const char *name, u32 caps, u8 available_las);
212212 int cec_register_adapter(struct cec_adapter *adap, struct device *parent);
include/net/wext.h+2−2
@@ -6,7 +6,7 @@ · 5 unmodified lines
66 struct net;
77
88 #ifdef CONFIG_WEXT_CORE
9−int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
9+int wext_handle_ioctl(struct net *net, struct iwreq *iwr, unsigned int cmd,
1010 void __user *arg);
1111 int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
1212 unsigned long arg);
@@ -14,7 +14,7 @@ int compat_wext_handle_ioctl(struct net *net, unsigned int cmd, · 1 unmodified line
1414 struct iw_statistics *get_wireless_stats(struct net_device *dev);
1515 int call_commit_handler(struct net_device *dev);
1616 #else
17−static inline int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
17+static inline int wext_handle_ioctl(struct net *net, struct iwreq *iwr, unsigned int cmd,
1818 void __user *arg)
1919 {
2020 return -EINVAL;
include/uapi/linux/ethtool.h+4−2
@@ -1486,8 +1486,10 @@ enum ethtool_link_mode_bit_indices { · 1485 unmodified lines
14861486 * it was forced up into this mode or autonegotiated.
14871487 */
14881488
1489−/* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. */
1490−/* Update drivers/net/phy/phy.c:phy_speed_to_str() when adding new values */
1489+/* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal.
1490+ * Update drivers/net/phy/phy.c:phy_speed_to_str() and
1491+ * drivers/net/bonding/bond_3ad.c:__get_link_speed() when adding new values.
1492+ */
14911493 #define SPEED_10 10
14921494 #define SPEED_100 100
14931495 #define SPEED_1000 1000
include/uapi/linux/openvswitch.h+1−0
@@ -343,6 +343,7 @@ enum ovs_key_attr { · 342 unmodified lines
343343 #define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
344344
345345 enum ovs_tunnel_key_attr {
346+ /* OVS_TUNNEL_KEY_ATTR_NONE, standard nl API requires this attribute! */
346347 OVS_TUNNEL_KEY_ATTR_ID, /* be64 Tunnel ID */
347348 OVS_TUNNEL_KEY_ATTR_IPV4_SRC, /* be32 src IP address. */
348349 OVS_TUNNEL_KEY_ATTR_IPV4_DST, /* be32 dst IP address. */
kernel/events/ring_buffer.c+1−1
@@ -580,7 +580,7 @@ int rb_alloc_aux(struct ring_buffer *rb, struct perf_event *event, · 579 unmodified lines
580580 int ret = -ENOMEM, max_order = 0;
581581
582582 if (!has_aux(event))
583− return -ENOTSUPP;
583+ return -EOPNOTSUPP;
584584
585585 if (event->pmu->capabilities & PERF_PMU_CAP_AUX_NO_SG) {
586586 /*
kernel/irq/manage.c+3−1
@@ -1312,8 +1312,10 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) · 1311 unmodified lines
13121312 ret = __irq_set_trigger(desc,
13131313 new->flags & IRQF_TRIGGER_MASK);
13141314
1315− if (ret)
1315+ if (ret) {
1316+ irq_release_resources(desc);
13161317 goto out_mask;
1318+ }
13171319 }
13181320
13191321 desc->istate &= ~(IRQS_AUTODETECT | IRQS_SPURIOUS_DISABLED | \
kernel/livepatch/patch.c+6−2
@@ -59,7 +59,11 @@ static void notrace klp_ftrace_handler(unsigned long ip, · 58 unmodified lines
5959
6060 ops = container_of(fops, struct klp_ops, fops);
6161
62− rcu_read_lock();
62+ /*
63+ * A variant of synchronize_sched() is used to allow patching functions
64+ * where RCU is not watching, see klp_synchronize_transition().
65+ */
66+ preempt_disable_notrace();
6367
6468 func = list_first_or_null_rcu(&ops->func_stack, struct klp_func,
6569 stack_node);
@@ -115,7 +119,7 @@ static void notrace klp_ftrace_handler(unsigned long ip, · 49 unmodified lines
115119
116120 klp_arch_set_pc(regs, (unsigned long)func->new_func);
117121 unlock:
118− rcu_read_unlock();
122+ preempt_enable_notrace();
119123 }
120124
121125 /*
kernel/livepatch/transition.c+31−5
@@ -48,6 +48,28 @@ static void klp_transition_work_fn(struct work_struct *work) · 47 unmodified lines
4848 }
4949 static DECLARE_DELAYED_WORK(klp_transition_work, klp_transition_work_fn);
5050
51+/*
52+ * This function is just a stub to implement a hard force
53+ * of synchronize_sched(). This requires synchronizing
54+ * tasks even in userspace and idle.
55+ */
56+static void klp_sync(struct work_struct *work)
57+{
58+}
59+
60+/*
61+ * We allow to patch also functions where RCU is not watching,
62+ * e.g. before user_exit(). We can not rely on the RCU infrastructure
63+ * to do the synchronization. Instead hard force the sched synchronization.
64+ *
65+ * This approach allows to use RCU functions for manipulating func_stack
66+ * safely.
67+ */
68+static void klp_synchronize_transition(void)
69+{
70+ schedule_on_each_cpu(klp_sync);
71+}
72+
5173 /*
5274 * The transition to the target patch state is complete. Clean up the data
5375 * structures.
@@ -73,7 +95,7 @@ static void klp_complete_transition(void) · 19 unmodified lines
7395 * func->transition gets cleared, the handler may choose a
7496 * removed function.
7597 */
76− synchronize_rcu();
98+ klp_synchronize_transition();
7799 }
78100
79101 if (klp_transition_patch->immediate)
@@ -92,7 +114,7 @@ static void klp_complete_transition(void) · 12 unmodified lines
92114
93115 /* Prevent klp_ftrace_handler() from seeing KLP_UNDEFINED state */
94116 if (klp_target_state == KLP_PATCHED)
95− synchronize_rcu();
117+ klp_synchronize_transition();
96118
97119 read_lock(&tasklist_lock);
98120 for_each_process_thread(g, task) {
@@ -136,7 +158,11 @@ void klp_cancel_transition(void) · 37 unmodified lines
136158 */
137159 void klp_update_patch_state(struct task_struct *task)
138160 {
139− rcu_read_lock();
161+ /*
162+ * A variant of synchronize_sched() is used to allow patching functions
163+ * where RCU is not watching, see klp_synchronize_transition().
164+ */
165+ preempt_disable_notrace();
140166
141167 /*
142168 * This test_and_clear_tsk_thread_flag() call also serves as a read
@@ -153,7 +179,7 @@ void klp_update_patch_state(struct task_struct *task) · 10 unmodified lines
153179 if (test_and_clear_tsk_thread_flag(task, TIF_PATCH_PENDING))
154180 task->patch_state = READ_ONCE(klp_target_state);
155181
156− rcu_read_unlock();
182+ preempt_enable_notrace();
157183 }
158184
159185 /*
@@ -539,7 +565,7 @@ void klp_reverse_transition(void) · 379 unmodified lines
539565 clear_tsk_thread_flag(idle_task(cpu), TIF_PATCH_PENDING);
540566
541567 /* Let any remaining calls to klp_update_patch_state() complete */
542− synchronize_rcu();
568+ klp_synchronize_transition();
543569
544570 klp_start_transition();
545571 }
kernel/sched/core.c+1−1
@@ -5605,7 +5605,7 @@ void idle_task_exit(void) · 5604 unmodified lines
56055605 BUG_ON(cpu_online(smp_processor_id()));
56065606
56075607 if (mm != &init_mm) {
5608− switch_mm_irqs_off(mm, &init_mm, current);
5608+ switch_mm(mm, &init_mm, current);
56095609 finish_arch_post_lock_switch();
56105610 }
56115611 mmdrop(mm);
kernel/sched/cpufreq_schedutil.c+0−3
@@ -101,9 +101,6 @@ static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, · 100 unmodified lines
101101 if (sg_policy->next_freq == next_freq)
102102 return;
103103
104− if (sg_policy->next_freq > next_freq)
105− next_freq = (sg_policy->next_freq + next_freq) >> 1;
106−
107104 sg_policy->next_freq = next_freq;
108105 sg_policy->last_freq_update_time = time;
109106
kernel/sched/fair.c+1−1
@@ -3563,7 +3563,7 @@ static inline void check_schedstat_required(void) · 3562 unmodified lines
35633563 trace_sched_stat_runtime_enabled()) {
35643564 printk_deferred_once("Scheduler tracepoints stat_sleep, stat_iowait, "
35653565 "stat_blocked and stat_runtime require the "
3566− "kernel parameter schedstats=enabled or "
3566+ "kernel parameter schedstats=enable or "
35673567 "kernel.sched_schedstats=1\n");
35683568 }
35693569 #endif
kernel/signal.c+14−6
@@ -510,7 +510,8 @@ int unhandled_signal(struct task_struct *tsk, int sig) · 509 unmodified lines
510510 return !tsk->ptrace;
511511 }
512512
513−static void collect_signal(int sig, struct sigpending *list, siginfo_t *info)
513+static void collect_signal(int sig, struct sigpending *list, siginfo_t *info,
514+ bool *resched_timer)
514515 {
515516 struct sigqueue *q, *first = NULL;
516517
@@ -532,6 +533,12 @@ static void collect_signal(int sig, struct sigpending *list, siginfo_t *info) · 15 unmodified lines
532533 still_pending:
533534 list_del_init(&first->list);
534535 copy_siginfo(info, &first->info);
536+
537+ *resched_timer =
538+ (first->flags & SIGQUEUE_PREALLOC) &&
539+ (info->si_code == SI_TIMER) &&
540+ (info->si_sys_private);
541+
535542 __sigqueue_free(first);
536543 } else {
537544 /*
@@ -548,12 +555,12 @@ still_pending: · 10 unmodified lines
548555 }
549556
550557 static int __dequeue_signal(struct sigpending *pending, sigset_t *mask,
551− siginfo_t *info)
558+ siginfo_t *info, bool *resched_timer)
552559 {
553560 int sig = next_signal(pending, mask);
554561
555562 if (sig)
556− collect_signal(sig, pending, info);
563+ collect_signal(sig, pending, info, resched_timer);
557564 return sig;
558565 }
559566
@@ -565,15 +572,16 @@ static int __dequeue_signal(struct sigpending *pending, sigset_t *mask, · 5 unmodified lines
565572 */
566573 int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
567574 {
575+ bool resched_timer = false;
568576 int signr;
569577
570578 /* We only dequeue private signals from ourselves, we don't let
571579 * signalfd steal them
572580 */
573− signr = __dequeue_signal(&tsk->pending, mask, info);
581+ signr = __dequeue_signal(&tsk->pending, mask, info, &resched_timer);
574582 if (!signr) {
575583 signr = __dequeue_signal(&tsk->signal->shared_pending,
576− mask, info);
584+ mask, info, &resched_timer);
577585 #ifdef CONFIG_POSIX_TIMERS
578586 /*
579587 * itimer signal ?
@@ -621,7 +629,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) · 41 unmodified lines
621629 current->jobctl |= JOBCTL_STOP_DEQUEUED;
622630 }
623631 #ifdef CONFIG_POSIX_TIMERS
624− if ((info->si_code & __SI_MASK) == __SI_TIMER && info->si_sys_private) {
632+ if (resched_timer) {
625633 /*
626634 * Release the siglock to ensure proper locking order
627635 * of timer locks outside of siglocks. Note, we leave
kernel/time/alarmtimer.c+11−3
@@ -387,7 +387,7 @@ void alarm_start_relative(struct alarm *alarm, ktime_t start) · 386 unmodified lines
387387 {
388388 struct alarm_base *base = &alarm_bases[alarm->type];
389389
390− start = ktime_add(start, base->gettime());
390+ start = ktime_add_safe(start, base->gettime());
391391 alarm_start(alarm, start);
392392 }
393393 EXPORT_SYMBOL_GPL(alarm_start_relative);
@@ -475,7 +475,7 @@ u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval) · 81 unmodified lines
475475 overrun++;
476476 }
477477
478− alarm->node.expires = ktime_add(alarm->node.expires, interval);
478+ alarm->node.expires = ktime_add_safe(alarm->node.expires, interval);
479479 return overrun;
480480 }
481481 EXPORT_SYMBOL_GPL(alarm_forward);
@@ -660,13 +660,21 @@ static int alarm_timer_set(struct k_itimer *timr, int flags, · 178 unmodified lines
660660
661661 /* start the timer */
662662 timr->it.alarm.interval = timespec64_to_ktime(new_setting->it_interval);
663+
664+ /*
665+ * Rate limit to the tick as a hot fix to prevent DOS. Will be
666+ * mopped up later.
667+ */
668+ if (timr->it.alarm.interval < TICK_NSEC)
669+ timr->it.alarm.interval = TICK_NSEC;
670+
663671 exp = timespec64_to_ktime(new_setting->it_value);
664672 /* Convert (if necessary) to absolute time */
665673 if (flags != TIMER_ABSTIME) {
666674 ktime_t now;
667675
668676 now = alarm_bases[timr->it.alarm.alarmtimer.type].gettime();
669− exp = ktime_add(now, exp);
677+ exp = ktime_add_safe(now, exp);
670678 }
671679
672680 alarm_start(&timr->it.alarm.alarmtimer, exp);
kernel/time/tick-broadcast.c+3−1
@@ -37,9 +37,11 @@ static int tick_broadcast_forced; · 36 unmodified lines
3737 static __cacheline_aligned_in_smp DEFINE_RAW_SPINLOCK(tick_broadcast_lock);
3838
3939 #ifdef CONFIG_TICK_ONESHOT
40+static void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
4041 static void tick_broadcast_clear_oneshot(int cpu);
4142 static void tick_resume_broadcast_oneshot(struct clock_event_device *bc);
4243 #else
44+static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { BUG(); }
4345 static inline void tick_broadcast_clear_oneshot(int cpu) { }
4446 static inline void tick_resume_broadcast_oneshot(struct clock_event_device *bc) { }
4547 #endif
@@ -867,7 +869,7 @@ static void tick_broadcast_init_next_event(struct cpumask *mask, · 821 unmodified lines
867869 /**
868870 * tick_broadcast_setup_oneshot - setup the broadcast device
869871 */
870−void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
872+static void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
871873 {
872874 int cpu = smp_processor_id();
873875
kernel/time/tick-internal.h+0−2
@@ -126,7 +126,6 @@ static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } · 125 unmodified lines
126126
127127 /* Functions related to oneshot broadcasting */
128128 #if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT)
129−extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
130129 extern void tick_broadcast_switch_to_oneshot(void);
131130 extern void tick_shutdown_broadcast_oneshot(unsigned int cpu);
132131 extern int tick_broadcast_oneshot_active(void);
@@ -134,7 +133,6 @@ extern void tick_check_oneshot_broadcast_this_cpu(void); · 1 unmodified line
134133 bool tick_broadcast_oneshot_available(void);
135134 extern struct cpumask *tick_get_broadcast_oneshot_mask(void);
136135 #else /* !(BROADCAST && ONESHOT): */
137−static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { BUG(); }
138136 static inline void tick_broadcast_switch_to_oneshot(void) { }
139137 static inline void tick_shutdown_broadcast_oneshot(unsigned int cpu) { }
140138 static inline int tick_broadcast_oneshot_active(void) { return 0; }
kernel/time/timekeeping.c+46−25
@@ -118,6 +118,26 @@ static inline void tk_update_sleep_time(struct timekeeper *tk, ktime_t delta) · 117 unmodified lines
118118 tk->offs_boot = ktime_add(tk->offs_boot, delta);
119119 }
120120
121+/*
122+ * tk_clock_read - atomic clocksource read() helper
123+ *
124+ * This helper is necessary to use in the read paths because, while the
125+ * seqlock ensures we don't return a bad value while structures are updated,
126+ * it doesn't protect from potential crashes. There is the possibility that
127+ * the tkr's clocksource may change between the read reference, and the
128+ * clock reference passed to the read function. This can cause crashes if
129+ * the wrong clocksource is passed to the wrong read function.
130+ * This isn't necessary to use when holding the timekeeper_lock or doing
131+ * a read of the fast-timekeeper tkrs (which is protected by its own locking
132+ * and update logic).
133+ */
134+static inline u64 tk_clock_read(struct tk_read_base *tkr)
135+{
136+ struct clocksource *clock = READ_ONCE(tkr->clock);
137+
138+ return clock->read(clock);
139+}
140+
121141 #ifdef CONFIG_DEBUG_TIMEKEEPING
122142 #define WARNING_FREQ (HZ*300) /* 5 minute rate-limiting */
123143
@@ -175,7 +195,7 @@ static inline u64 timekeeping_get_delta(struct tk_read_base *tkr) · 51 unmodified lines
175195 */
176196 do {
177197 seq = read_seqcount_begin(&tk_core.seq);
178− now = tkr->read(tkr->clock);
198+ now = tk_clock_read(tkr);
179199 last = tkr->cycle_last;
180200 mask = tkr->mask;
181201 max = tkr->clock->max_cycles;
@@ -209,7 +229,7 @@ static inline u64 timekeeping_get_delta(struct tk_read_base *tkr) · 27 unmodified lines
209229 u64 cycle_now, delta;
210230
211231 /* read clocksource */
212− cycle_now = tkr->read(tkr->clock);
232+ cycle_now = tk_clock_read(tkr);
213233
214234 /* calculate the delta since the last update_wall_time */
215235 delta = clocksource_delta(cycle_now, tkr->cycle_last, tkr->mask);
@@ -238,12 +258,10 @@ static void tk_setup_internals(struct timekeeper *tk, struct clocksource *clock) · 22 unmodified lines
238258 ++tk->cs_was_changed_seq;
239259 old_clock = tk->tkr_mono.clock;
240260 tk->tkr_mono.clock = clock;
241− tk->tkr_mono.read = clock->read;
242261 tk->tkr_mono.mask = clock->mask;
243− tk->tkr_mono.cycle_last = tk->tkr_mono.read(clock);
262+ tk->tkr_mono.cycle_last = tk_clock_read(&tk->tkr_mono);
244263
245264 tk->tkr_raw.clock = clock;
246− tk->tkr_raw.read = clock->read;
247265 tk->tkr_raw.mask = clock->mask;
248266 tk->tkr_raw.cycle_last = tk->tkr_mono.cycle_last;
249267
@@ -262,7 +280,7 @@ static void tk_setup_internals(struct timekeeper *tk, struct clocksource *clock) · 12 unmodified lines
262280 /* Go back from cycles -> shifted ns */
263281 tk->xtime_interval = interval * clock->mult;
264282 tk->xtime_remainder = ntpinterval - tk->xtime_interval;
265− tk->raw_interval = (interval * clock->mult) >> clock->shift;
283+ tk->raw_interval = interval * clock->mult;
266284
267285 /* if changing clocks, convert xtime_nsec shift units */
268286 if (old_clock) {
@@ -404,7 +422,7 @@ static __always_inline u64 __ktime_get_fast_ns(struct tk_fast *tkf) · 135 unmodified lines
404422
405423 now += timekeeping_delta_to_ns(tkr,
406424 clocksource_delta(
407− tkr->read(tkr->clock),
425+ tk_clock_read(tkr),
408426 tkr->cycle_last,
409427 tkr->mask));
410428 } while (read_seqcount_retry(&tkf->seq, seq));
@@ -461,6 +479,10 @@ static u64 dummy_clock_read(struct clocksource *cs) · 50 unmodified lines
461479 return cycles_at_suspend;
462480 }
463481
482+static struct clocksource dummy_clock = {
483+ .read = dummy_clock_read,
484+};
485+
464486 /**
465487 * halt_fast_timekeeper - Prevent fast timekeeper from accessing clocksource.
466488 * @tk: Timekeeper to snapshot.
@@ -477,13 +499,13 @@ static void halt_fast_timekeeper(struct timekeeper *tk) · 10 unmodified lines
477499 struct tk_read_base *tkr = &tk->tkr_mono;
478500
479501 memcpy(&tkr_dummy, tkr, sizeof(tkr_dummy));
480− cycles_at_suspend = tkr->read(tkr->clock);
481− tkr_dummy.read = dummy_clock_read;
502+ cycles_at_suspend = tk_clock_read(tkr);
503+ tkr_dummy.clock = &dummy_clock;
482504 update_fast_timekeeper(&tkr_dummy, &tk_fast_mono);
483505
484506 tkr = &tk->tkr_raw;
485507 memcpy(&tkr_dummy, tkr, sizeof(tkr_dummy));
486− tkr_dummy.read = dummy_clock_read;
508+ tkr_dummy.clock = &dummy_clock;
487509 update_fast_timekeeper(&tkr_dummy, &tk_fast_raw);
488510 }
489511
@@ -649,11 +671,10 @@ static void timekeeping_update(struct timekeeper *tk, unsigned int action) · 159 unmodified lines
649671 */
650672 static void timekeeping_forward_now(struct timekeeper *tk)
651673 {
652− struct clocksource *clock = tk->tkr_mono.clock;
653674 u64 cycle_now, delta;
654675 u64 nsec;
655676
656− cycle_now = tk->tkr_mono.read(clock);
677+ cycle_now = tk_clock_read(&tk->tkr_mono);
657678 delta = clocksource_delta(cycle_now, tk->tkr_mono.cycle_last, tk->tkr_mono.mask);
658679 tk->tkr_mono.cycle_last = cycle_now;
659680 tk->tkr_raw.cycle_last = cycle_now;
@@ -929,8 +950,7 @@ void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot) · 269 unmodified lines
929950
930951 do {
931952 seq = read_seqcount_begin(&tk_core.seq);
932−
933− now = tk->tkr_mono.read(tk->tkr_mono.clock);
953+ now = tk_clock_read(&tk->tkr_mono);
934954 systime_snapshot->cs_was_changed_seq = tk->cs_was_changed_seq;
935955 systime_snapshot->clock_was_set_seq = tk->clock_was_set_seq;
936956 base_real = ktime_add(tk->tkr_mono.base,
@@ -1108,7 +1128,7 @@ int get_device_system_crosststamp(int (*get_time_fn) · 171 unmodified lines
11081128 * Check whether the system counter value provided by the
11091129 * device driver is on the current timekeeping interval.
11101130 */
1111− now = tk->tkr_mono.read(tk->tkr_mono.clock);
1131+ now = tk_clock_read(&tk->tkr_mono);
11121132 interval_start = tk->tkr_mono.cycle_last;
11131133 if (!cycle_between(interval_start, cycles, now)) {
11141134 clock_was_set_seq = tk->clock_was_set_seq;
@@ -1629,7 +1649,7 @@ void timekeeping_resume(void) · 514 unmodified lines
16291649 * The less preferred source will only be tried if there is no better
16301650 * usable source. The rtc part is handled separately in rtc core code.
16311651 */
1632− cycle_now = tk->tkr_mono.read(clock);
1652+ cycle_now = tk_clock_read(&tk->tkr_mono);
16331653 if ((clock->flags & CLOCK_SOURCE_SUSPEND_NONSTOP) &&
16341654 cycle_now > tk->tkr_mono.cycle_last) {
16351655 u64 nsec, cyc_delta;
@@ -1976,7 +1996,7 @@ static u64 logarithmic_accumulation(struct timekeeper *tk, u64 offset, · 340 unmodified lines
19761996 u32 shift, unsigned int *clock_set)
19771997 {
19781998 u64 interval = tk->cycle_interval << shift;
1979− u64 raw_nsecs;
1999+ u64 snsec_per_sec;
19802000
19812001 /* If the offset is smaller than a shifted interval, do nothing */
19822002 if (offset < interval)
@@ -1991,14 +2011,15 @@ static u64 logarithmic_accumulation(struct timekeeper *tk, u64 offset, · 8 unmodified lines
19912011 *clock_set |= accumulate_nsecs_to_secs(tk);
19922012
19932013 /* Accumulate raw time */
1994− raw_nsecs = (u64)tk->raw_interval << shift;
1995− raw_nsecs += tk->raw_time.tv_nsec;
1996− if (raw_nsecs >= NSEC_PER_SEC) {
1997− u64 raw_secs = raw_nsecs;
1998− raw_nsecs = do_div(raw_secs, NSEC_PER_SEC);
1999− tk->raw_time.tv_sec += raw_secs;
2014+ tk->tkr_raw.xtime_nsec += (u64)tk->raw_time.tv_nsec << tk->tkr_raw.shift;
2015+ tk->tkr_raw.xtime_nsec += tk->raw_interval << shift;
2016+ snsec_per_sec = (u64)NSEC_PER_SEC << tk->tkr_raw.shift;
2017+ while (tk->tkr_raw.xtime_nsec >= snsec_per_sec) {
2018+ tk->tkr_raw.xtime_nsec -= snsec_per_sec;
2019+ tk->raw_time.tv_sec++;
20002020 }
2001− tk->raw_time.tv_nsec = raw_nsecs;
2021+ tk->raw_time.tv_nsec = tk->tkr_raw.xtime_nsec >> tk->tkr_raw.shift;
2022+ tk->tkr_raw.xtime_nsec -= (u64)tk->raw_time.tv_nsec << tk->tkr_raw.shift;
20022023
20032024 /* Accumulate error between NTP and clock interval */
20042025 tk->ntp_error += tk->ntp_tick << shift;
@@ -2030,7 +2051,7 @@ void update_wall_time(void) · 25 unmodified lines
20302051 #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
20312052 offset = real_tk->cycle_interval;
20322053 #else
2033− offset = clocksource_delta(tk->tkr_mono.read(tk->tkr_mono.clock),
2054+ offset = clocksource_delta(tk_clock_read(&tk->tkr_mono),
20342055 tk->tkr_mono.cycle_last, tk->tkr_mono.mask);
20352056 #endif
20362057
lib/cmdline.c+3−3
@@ -23,14 +23,14 @@ · 22 unmodified lines
2323 * the values[M, M+1, ..., N] into the ints array in get_options.
2424 */
2525
26−static int get_range(char **str, int *pint)
26+static int get_range(char **str, int *pint, int n)
2727 {
2828 int x, inc_counter, upper_range;
2929
3030 (*str)++;
3131 upper_range = simple_strtol((*str), NULL, 0);
3232 inc_counter = upper_range - *pint;
33− for (x = *pint; x < upper_range; x++)
33+ for (x = *pint; n && x < upper_range; x++, n--)
3434 *pint++ = x;
3535 return inc_counter;
3636 }
@@ -97,7 +97,7 @@ char *get_options(const char *str, int nints, int *ints) · 60 unmodified lines
9797 break;
9898 if (res == 3) {
9999 int range_nums;
100− range_nums = get_range((char **)&str, ints + i);
100+ range_nums = get_range((char **)&str, ints + i, nints - i);
101101 if (range_nums < 0)
102102 break;
103103 /*
lib/libcrc32c.c+4−2
@@ -43,7 +43,7 @@ static struct crypto_shash *tfm; · 42 unmodified lines
4343 u32 crc32c(u32 crc, const void *address, unsigned int length)
4444 {
4545 SHASH_DESC_ON_STACK(shash, tfm);
46− u32 *ctx = (u32 *)shash_desc_ctx(shash);
46+ u32 ret, *ctx = (u32 *)shash_desc_ctx(shash);
4747 int err;
4848
4949 shash->tfm = tfm;
@@ -53,7 +53,9 @@ u32 crc32c(u32 crc, const void *address, unsigned int length) · 3 unmodified lines
5353 err = crypto_shash_update(shash, address, length);
5454 BUG_ON(err);
5555
56− return *ctx;
56+ ret = *ctx;
57+ barrier_data(ctx);
58+ return ret;
5759 }
5860
5961 EXPORT_SYMBOL(crc32c);
mm/gup.c+0−5
@@ -387,11 +387,6 @@ static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma, · 386 unmodified lines
387387 /* mlock all present pages, but do not fault in new pages */
388388 if ((*flags & (FOLL_POPULATE | FOLL_MLOCK)) == FOLL_MLOCK)
389389 return -ENOENT;
390− /* For mm_populate(), just skip the stack guard page. */
391− if ((*flags & FOLL_POPULATE) &&
392− (stack_guard_page_start(vma, address) ||
393− stack_guard_page_end(vma, address + PAGE_SIZE)))
394− return -ENOENT;
395390 if (*flags & FOLL_WRITE)
396391 fault_flags |= FAULT_FLAG_WRITE;
397392 if (*flags & FOLL_REMOTE)
mm/huge_memory.c+7−1
@@ -1426,8 +1426,11 @@ int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd) · 1425 unmodified lines
14261426 */
14271427 if (unlikely(pmd_trans_migrating(*vmf->pmd))) {
14281428 page = pmd_page(*vmf->pmd);
1429+ if (!get_page_unless_zero(page))
1430+ goto out_unlock;
14291431 spin_unlock(vmf->ptl);
14301432 wait_on_page_locked(page);
1433+ put_page(page);
14311434 goto out;
14321435 }
14331436
@@ -1459,9 +1462,12 @@ int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd) · 25 unmodified lines
14591462
14601463 /* Migration could have started since the pmd_trans_migrating check */
14611464 if (!page_locked) {
1465+ page_nid = -1;
1466+ if (!get_page_unless_zero(page))
1467+ goto out_unlock;
14621468 spin_unlock(vmf->ptl);
14631469 wait_on_page_locked(page);
1464− page_nid = -1;
1470+ put_page(page);
14651471 goto out;
14661472 }
14671473
mm/khugepaged.c+0−1
@@ -652,7 +652,6 @@ static void __collapse_huge_page_copy(pte_t *pte, struct page *page, · 651 unmodified lines
652652 spin_unlock(ptl);
653653 free_page_and_swap_cache(src_page);
654654 }
655− cond_resched();
656655 }
657656 }
658657
mm/memory-failure.c+4−1
@@ -1184,7 +1184,10 @@ int memory_failure(unsigned long pfn, int trapno, int flags) · 1183 unmodified lines
11841184 * page_remove_rmap() in try_to_unmap_one(). So to determine page status
11851185 * correctly, we save a copy of the page flags at this time.
11861186 */
1187− page_flags = p->flags;
1187+ if (PageHuge(p))
1188+ page_flags = hpage->flags;
1189+ else
1190+ page_flags = p->flags;
11881191
11891192 /*
11901193 * unpoison always clear PG_hwpoison inside page lock
mm/memory.c+0−38
@@ -2854,40 +2854,6 @@ out_release: · 2853 unmodified lines
28542854 return ret;
28552855 }
28562856
2857−/*
2858− * This is like a special single-page "expand_{down|up}wards()",
2859− * except we must first make sure that 'address{-|+}PAGE_SIZE'
2860− * doesn't hit another vma.
2861− */
2862−static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned long address)
2863−{
2864− address &= PAGE_MASK;
2865− if ((vma->vm_flags & VM_GROWSDOWN) && address == vma->vm_start) {
2866− struct vm_area_struct *prev = vma->vm_prev;
2867−
2868− /*
2869− * Is there a mapping abutting this one below?
2870− *
2871− * That's only ok if it's the same stack mapping
2872− * that has gotten split..
2873− */
2874− if (prev && prev->vm_end == address)
2875− return prev->vm_flags & VM_GROWSDOWN ? 0 : -ENOMEM;
2876−
2877− return expand_downwards(vma, address - PAGE_SIZE);
2878− }
2879− if ((vma->vm_flags & VM_GROWSUP) && address + PAGE_SIZE == vma->vm_end) {
2880− struct vm_area_struct *next = vma->vm_next;
2881−
2882− /* As VM_GROWSDOWN but s/below/above/ */
2883− if (next && next->vm_start == address + PAGE_SIZE)
2884− return next->vm_flags & VM_GROWSUP ? 0 : -ENOMEM;
2885−
2886− return expand_upwards(vma, address + PAGE_SIZE);
2887− }
2888− return 0;
2889−}
2890−
28912857 /*
28922858 * We enter with non-exclusive mmap_sem (to exclude vma changes,
28932859 * but allow concurrent faults), and pte mapped but not yet locked.
@@ -2904,10 +2870,6 @@ static int do_anonymous_page(struct vm_fault *vmf) · 10 unmodified lines
29042870 if (vma->vm_flags & VM_SHARED)
29052871 return VM_FAULT_SIGBUS;
29062872
2907− /* Check if we need to add a guard page to the stack */
2908− if (check_stack_guard_page(vma, vmf->address) < 0)
2909− return VM_FAULT_SIGSEGV;
2910−
29112873 /*
29122874 * Use pte_alloc() instead of pte_alloc_map(). We can't run
29132875 * pte_offset_map() on pmds where a huge pmd might be created
mm/mmap.c+97−63
@@ -183,6 +183,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) · 182 unmodified lines
183183 unsigned long retval;
184184 unsigned long newbrk, oldbrk;
185185 struct mm_struct *mm = current->mm;
186+ struct vm_area_struct *next;
186187 unsigned long min_brk;
187188 bool populate;
188189 LIST_HEAD(uf);
@@ -229,7 +230,8 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) · 40 unmodified lines
229230 }
230231
231232 /* Check against existing mmap mappings. */
232− if (find_vma_intersection(mm, oldbrk, newbrk+PAGE_SIZE))
233+ next = find_vma(mm, oldbrk);
234+ if (next && newbrk + PAGE_SIZE > vm_start_gap(next))
233235 goto out;
234236
235237 /* Ok, looks good - let it rip. */
@@ -253,10 +255,22 @@ out: · 17 unmodified lines
253255
254256 static long vma_compute_subtree_gap(struct vm_area_struct *vma)
255257 {
256− unsigned long max, subtree_gap;
257− max = vma->vm_start;
258− if (vma->vm_prev)
259− max -= vma->vm_prev->vm_end;
258+ unsigned long max, prev_end, subtree_gap;
259+
260+ /*
261+ * Note: in the rare case of a VM_GROWSDOWN above a VM_GROWSUP, we
262+ * allow two stack_guard_gaps between them here, and when choosing
263+ * an unmapped area; whereas when expanding we only require one.
264+ * That's a little inconsistent, but keeps the code here simpler.
265+ */
266+ max = vm_start_gap(vma);
267+ if (vma->vm_prev) {
268+ prev_end = vm_end_gap(vma->vm_prev);
269+ if (max > prev_end)
270+ max -= prev_end;
271+ else
272+ max = 0;
273+ }
260274 if (vma->vm_rb.rb_left) {
261275 subtree_gap = rb_entry(vma->vm_rb.rb_left,
262276 struct vm_area_struct, vm_rb)->rb_subtree_gap;
@@ -352,7 +366,7 @@ static void validate_mm(struct mm_struct *mm) · 89 unmodified lines
352366 anon_vma_unlock_read(anon_vma);
353367 }
354368
355− highest_address = vma->vm_end;
369+ highest_address = vm_end_gap(vma);
356370 vma = vma->vm_next;
357371 i++;
358372 }
@@ -541,7 +555,7 @@ void __vma_link_rb(struct mm_struct *mm, struct vm_area_struct *vma, · 182 unmodified lines
541555 if (vma->vm_next)
542556 vma_gap_update(vma->vm_next);
543557 else
544− mm->highest_vm_end = vma->vm_end;
558+ mm->highest_vm_end = vm_end_gap(vma);
545559
546560 /*
547561 * vma->vm_prev wasn't known when we followed the rbtree to find the
@@ -856,7 +870,7 @@ again: · 308 unmodified lines
856870 vma_gap_update(vma);
857871 if (end_changed) {
858872 if (!next)
859− mm->highest_vm_end = end;
873+ mm->highest_vm_end = vm_end_gap(vma);
860874 else if (!adjust_next)
861875 vma_gap_update(next);
862876 }
@@ -941,7 +955,7 @@ again: · 78 unmodified lines
941955 * mm->highest_vm_end doesn't need any update
942956 * in remove_next == 1 case.
943957 */
944− VM_WARN_ON(mm->highest_vm_end != end);
958+ VM_WARN_ON(mm->highest_vm_end != vm_end_gap(vma));
945959 }
946960 }
947961 if (insert && file)
@@ -1787,7 +1801,7 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info) · 839 unmodified lines
17871801
17881802 while (true) {
17891803 /* Visit left subtree if it looks promising */
1790− gap_end = vma->vm_start;
1804+ gap_end = vm_start_gap(vma);
17911805 if (gap_end >= low_limit && vma->vm_rb.rb_left) {
17921806 struct vm_area_struct *left =
17931807 rb_entry(vma->vm_rb.rb_left,
@@ -1798,12 +1812,13 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info) · 4 unmodified lines
17981812 }
17991813 }
18001814
1801− gap_start = vma->vm_prev ? vma->vm_prev->vm_end : 0;
1815+ gap_start = vma->vm_prev ? vm_end_gap(vma->vm_prev) : 0;
18021816 check_current:
18031817 /* Check if current node has a suitable gap */
18041818 if (gap_start > high_limit)
18051819 return -ENOMEM;
1806− if (gap_end >= low_limit && gap_end - gap_start >= length)
1820+ if (gap_end >= low_limit &&
1821+ gap_end > gap_start && gap_end - gap_start >= length)
18071822 goto found;
18081823
18091824 /* Visit right subtree if it looks promising */
@@ -1825,8 +1840,8 @@ check_current: · 15 unmodified lines
18251840 vma = rb_entry(rb_parent(prev),
18261841 struct vm_area_struct, vm_rb);
18271842 if (prev == vma->vm_rb.rb_left) {
1828− gap_start = vma->vm_prev->vm_end;
1829− gap_end = vma->vm_start;
1843+ gap_start = vm_end_gap(vma->vm_prev);
1844+ gap_end = vm_start_gap(vma);
18301845 goto check_current;
18311846 }
18321847 }
@@ -1890,7 +1905,7 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) · 57 unmodified lines
18901905
18911906 while (true) {
18921907 /* Visit right subtree if it looks promising */
1893− gap_start = vma->vm_prev ? vma->vm_prev->vm_end : 0;
1908+ gap_start = vma->vm_prev ? vm_end_gap(vma->vm_prev) : 0;
18941909 if (gap_start <= high_limit && vma->vm_rb.rb_right) {
18951910 struct vm_area_struct *right =
18961911 rb_entry(vma->vm_rb.rb_right,
@@ -1903,10 +1918,11 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) · 6 unmodified lines
19031918
19041919 check_current:
19051920 /* Check if current node has a suitable gap */
1906− gap_end = vma->vm_start;
1921+ gap_end = vm_start_gap(vma);
19071922 if (gap_end < low_limit)
19081923 return -ENOMEM;
1909− if (gap_start <= high_limit && gap_end - gap_start >= length)
1924+ if (gap_start <= high_limit &&
1925+ gap_end > gap_start && gap_end - gap_start >= length)
19101926 goto found;
19111927
19121928 /* Visit left subtree if it looks promising */
@@ -1929,7 +1945,7 @@ check_current: · 16 unmodified lines
19291945 struct vm_area_struct, vm_rb);
19301946 if (prev == vma->vm_rb.rb_right) {
19311947 gap_start = vma->vm_prev ?
1932− vma->vm_prev->vm_end : 0;
1948+ vm_end_gap(vma->vm_prev) : 0;
19331949 goto check_current;
19341950 }
19351951 }
@@ -1967,7 +1983,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, · 31 unmodified lines
19671983 unsigned long len, unsigned long pgoff, unsigned long flags)
19681984 {
19691985 struct mm_struct *mm = current->mm;
1970− struct vm_area_struct *vma;
1986+ struct vm_area_struct *vma, *prev;
19711987 struct vm_unmapped_area_info info;
19721988
19731989 if (len > TASK_SIZE - mmap_min_addr)
@@ -1978,9 +1994,10 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, · 4 unmodified lines
19781994
19791995 if (addr) {
19801996 addr = PAGE_ALIGN(addr);
1981− vma = find_vma(mm, addr);
1997+ vma = find_vma_prev(mm, addr, &prev);
19821998 if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
1983− (!vma || addr + len <= vma->vm_start))
1999+ (!vma || addr + len <= vm_start_gap(vma)) &&
2000+ (!prev || addr >= vm_end_gap(prev)))
19842001 return addr;
19852002 }
19862003
@@ -2003,7 +2020,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 16 unmodified lines
20032020 const unsigned long len, const unsigned long pgoff,
20042021 const unsigned long flags)
20052022 {
2006− struct vm_area_struct *vma;
2023+ struct vm_area_struct *vma, *prev;
20072024 struct mm_struct *mm = current->mm;
20082025 unsigned long addr = addr0;
20092026 struct vm_unmapped_area_info info;
@@ -2018,9 +2035,10 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 8 unmodified lines
20182035 /* requesting a specific address */
20192036 if (addr) {
20202037 addr = PAGE_ALIGN(addr);
2021− vma = find_vma(mm, addr);
2038+ vma = find_vma_prev(mm, addr, &prev);
20222039 if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
2023− (!vma || addr + len <= vma->vm_start))
2040+ (!vma || addr + len <= vm_start_gap(vma)) &&
2041+ (!prev || addr >= vm_end_gap(prev)))
20242042 return addr;
20252043 }
20262044
@@ -2155,21 +2173,19 @@ find_vma_prev(struct mm_struct *mm, unsigned long addr, · 128 unmodified lines
21552173 * update accounting. This is shared with both the
21562174 * grow-up and grow-down cases.
21572175 */
2158−static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, unsigned long grow)
2176+static int acct_stack_growth(struct vm_area_struct *vma,
2177+ unsigned long size, unsigned long grow)
21592178 {
21602179 struct mm_struct *mm = vma->vm_mm;
21612180 struct rlimit *rlim = current->signal->rlim;
2162− unsigned long new_start, actual_size;
2181+ unsigned long new_start;
21632182
21642183 /* address space limit tests */
21652184 if (!may_expand_vm(mm, vma->vm_flags, grow))
21662185 return -ENOMEM;
21672186
21682187 /* Stack limit test */
2169− actual_size = size;
2170− if (size && (vma->vm_flags & (VM_GROWSUP | VM_GROWSDOWN)))
2171− actual_size -= PAGE_SIZE;
2172− if (actual_size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur))
2188+ if (size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur))
21732189 return -ENOMEM;
21742190
21752191 /* mlock limit tests */
@@ -2207,16 +2223,32 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns · 31 unmodified lines
22072223 int expand_upwards(struct vm_area_struct *vma, unsigned long address)
22082224 {
22092225 struct mm_struct *mm = vma->vm_mm;
2226+ struct vm_area_struct *next;
2227+ unsigned long gap_addr;
22102228 int error = 0;
22112229
22122230 if (!(vma->vm_flags & VM_GROWSUP))
22132231 return -EFAULT;
22142232
2215− /* Guard against wrapping around to address 0. */
2216− if (address < PAGE_ALIGN(address+4))
2217− address = PAGE_ALIGN(address+4);
2218− else
2233+ /* Guard against exceeding limits of the address space. */
2234+ address &= PAGE_MASK;
2235+ if (address >= TASK_SIZE)
22192236 return -ENOMEM;
2237+ address += PAGE_SIZE;
2238+
2239+ /* Enforce stack_guard_gap */
2240+ gap_addr = address + stack_guard_gap;
2241+
2242+ /* Guard against overflow */
2243+ if (gap_addr < address || gap_addr > TASK_SIZE)
2244+ gap_addr = TASK_SIZE;
2245+
2246+ next = vma->vm_next;
2247+ if (next && next->vm_start < gap_addr) {
2248+ if (!(next->vm_flags & VM_GROWSUP))
2249+ return -ENOMEM;
2250+ /* Check that both stack segments have the same anon_vma? */
2251+ }
22202252
22212253 /* We must make sure the anon_vma is allocated. */
22222254 if (unlikely(anon_vma_prepare(vma)))
@@ -2261,7 +2293,7 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) · 38 unmodified lines
22612293 if (vma->vm_next)
22622294 vma_gap_update(vma->vm_next);
22632295 else
2264− mm->highest_vm_end = address;
2296+ mm->highest_vm_end = vm_end_gap(vma);
22652297 spin_unlock(&mm->page_table_lock);
22662298
22672299 perf_event_mmap(vma);
@@ -2282,6 +2314,8 @@ int expand_downwards(struct vm_area_struct *vma, · 14 unmodified lines
22822314 unsigned long address)
22832315 {
22842316 struct mm_struct *mm = vma->vm_mm;
2317+ struct vm_area_struct *prev;
2318+ unsigned long gap_addr;
22852319 int error;
22862320
22872321 address &= PAGE_MASK;
@@ -2289,6 +2323,17 @@ int expand_downwards(struct vm_area_struct *vma, · 1 unmodified line
22892323 if (error)
22902324 return error;
22912325
2326+ /* Enforce stack_guard_gap */
2327+ gap_addr = address - stack_guard_gap;
2328+ if (gap_addr > address)
2329+ return -ENOMEM;
2330+ prev = vma->vm_prev;
2331+ if (prev && prev->vm_end > gap_addr) {
2332+ if (!(prev->vm_flags & VM_GROWSDOWN))
2333+ return -ENOMEM;
2334+ /* Check that both stack segments have the same anon_vma? */
2335+ }
2336+
22922337 /* We must make sure the anon_vma is allocated. */
22932338 if (unlikely(anon_vma_prepare(vma)))
22942339 return -ENOMEM;
@@ -2343,28 +2388,25 @@ int expand_downwards(struct vm_area_struct *vma, · 48 unmodified lines
23432388 return error;
23442389 }
23452390
2346−/*
2347− * Note how expand_stack() refuses to expand the stack all the way to
2348− * abut the next virtual mapping, *unless* that mapping itself is also
2349− * a stack mapping. We want to leave room for a guard page, after all
2350− * (the guard page itself is not added here, that is done by the
2351− * actual page faulting logic)
2352− *
2353− * This matches the behavior of the guard page logic (see mm/memory.c:
2354− * check_stack_guard_page()), which only allows the guard page to be
2355− * removed under these circumstances.
2356− */
2391+/* enforced gap between the expanding stack and other mappings. */
2392+unsigned long stack_guard_gap = 256UL<<PAGE_SHIFT;
2393+
2394+static int __init cmdline_parse_stack_guard_gap(char *p)
2395+{
2396+ unsigned long val;
2397+ char *endptr;
2398+
2399+ val = simple_strtoul(p, &endptr, 10);
2400+ if (!*endptr)
2401+ stack_guard_gap = val << PAGE_SHIFT;
2402+
2403+ return 0;
2404+}
2405+__setup("stack_guard_gap=", cmdline_parse_stack_guard_gap);
2406+
23572407 #ifdef CONFIG_STACK_GROWSUP
23582408 int expand_stack(struct vm_area_struct *vma, unsigned long address)
23592409 {
2360− struct vm_area_struct *next;
2361−
2362− address &= PAGE_MASK;
2363− next = vma->vm_next;
2364− if (next && next->vm_start == address + PAGE_SIZE) {
2365− if (!(next->vm_flags & VM_GROWSUP))
2366− return -ENOMEM;
2367− }
23682410 return expand_upwards(vma, address);
23692411 }
23702412
@@ -2386,14 +2428,6 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr) · 15 unmodified lines
23862428 #else
23872429 int expand_stack(struct vm_area_struct *vma, unsigned long address)
23882430 {
2389− struct vm_area_struct *prev;
2390−
2391− address &= PAGE_MASK;
2392− prev = vma->vm_prev;
2393− if (prev && prev->vm_end == address) {
2394− if (!(prev->vm_flags & VM_GROWSDOWN))
2395− return -ENOMEM;
2396− }
23972431 return expand_downwards(vma, address);
23982432 }
23992433
@@ -2491,7 +2525,7 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma, · 91 unmodified lines
24912525 vma->vm_prev = prev;
24922526 vma_gap_update(vma);
24932527 } else
2494− mm->highest_vm_end = prev ? prev->vm_end : 0;
2528+ mm->highest_vm_end = prev ? vm_end_gap(prev) : 0;
24952529 tail_vma->vm_next = NULL;
24962530
24972531 /* Kill the cache */
mm/slub.c+26−14
@@ -5625,6 +5625,28 @@ static char *create_unique_id(struct kmem_cache *s) · 5624 unmodified lines
56255625 return name;
56265626 }
56275627
5628+static void sysfs_slab_remove_workfn(struct work_struct *work)
5629+{
5630+ struct kmem_cache *s =
5631+ container_of(work, struct kmem_cache, kobj_remove_work);
5632+
5633+ if (!s->kobj.state_in_sysfs)
5634+ /*
5635+ * For a memcg cache, this may be called during
5636+ * deactivation and again on shutdown. Remove only once.
5637+ * A cache is never shut down before deactivation is
5638+ * complete, so no need to worry about synchronization.
5639+ */
5640+ return;
5641+
5642+#ifdef CONFIG_MEMCG
5643+ kset_unregister(s->memcg_kset);
5644+#endif
5645+ kobject_uevent(&s->kobj, KOBJ_REMOVE);
5646+ kobject_del(&s->kobj);
5647+ kobject_put(&s->kobj);
5648+}
5649+
56285650 static int sysfs_slab_add(struct kmem_cache *s)
56295651 {
56305652 int err;
@@ -5632,6 +5654,8 @@ static int sysfs_slab_add(struct kmem_cache *s) · 1 unmodified line
56325654 struct kset *kset = cache_kset(s);
56335655 int unmergeable = slab_unmergeable(s);
56345656
5657+ INIT_WORK(&s->kobj_remove_work, sysfs_slab_remove_workfn);
5658+
56355659 if (!kset) {
56365660 kobject_init(&s->kobj, &slab_ktype);
56375661 return 0;
@@ -5695,20 +5719,8 @@ static void sysfs_slab_remove(struct kmem_cache *s) · 57 unmodified lines
56955719 */
56965720 return;
56975721
5698− if (!s->kobj.state_in_sysfs)
5699− /*
5700− * For a memcg cache, this may be called during
5701− * deactivation and again on shutdown. Remove only once.
5702− * A cache is never shut down before deactivation is
5703− * complete, so no need to worry about synchronization.
5704− */
5705− return;
5706−
5707−#ifdef CONFIG_MEMCG
5708− kset_unregister(s->memcg_kset);
5709−#endif
5710− kobject_uevent(&s->kobj, KOBJ_REMOVE);
5711− kobject_del(&s->kobj);
5722+ kobject_get(&s->kobj);
5723+ schedule_work(&s->kobj_remove_work);
57125724 }
57135725
57145726 void sysfs_slab_release(struct kmem_cache *s)
mm/swap_cgroup.c+3−0
@@ -48,6 +48,9 @@ static int swap_cgroup_prepare(int type) · 47 unmodified lines
4848 if (!page)
4949 goto not_enough_page;
5050 ctrl->map[idx] = page;
51+
52+ if (!(idx % SWAP_CLUSTER_MAX))
53+ cond_resched();
5154 }
5255 return 0;
5356 not_enough_page:
mm/vmalloc.c+13−2
@@ -287,10 +287,21 @@ struct page *vmalloc_to_page(const void *vmalloc_addr) · 286 unmodified lines
287287 if (p4d_none(*p4d))
288288 return NULL;
289289 pud = pud_offset(p4d, addr);
290− if (pud_none(*pud))
290+
291+ /*
292+ * Don't dereference bad PUD or PMD (below) entries. This will also
293+ * identify huge mappings, which we may encounter on architectures
294+ * that define CONFIG_HAVE_ARCH_HUGE_VMAP=y. Such regions will be
295+ * identified as vmalloc addresses by is_vmalloc_addr(), but are
296+ * not [unambiguously] associated with a struct page, so there is
297+ * no correct value to return for them.
298+ */
299+ WARN_ON_ONCE(pud_bad(*pud));
300+ if (pud_none(*pud) || pud_bad(*pud))
291301 return NULL;
292302 pmd = pmd_offset(pud, addr);
293− if (pmd_none(*pmd))
303+ WARN_ON_ONCE(pmd_bad(*pmd));
304+ if (pmd_none(*pmd) || pmd_bad(*pmd))
294305 return NULL;
295306
296307 ptep = pte_offset_map(pmd, addr);
mm/vmpressure.c+3−3
@@ -115,9 +115,9 @@ static enum vmpressure_levels vmpressure_calc_level(unsigned long scanned, · 114 unmodified lines
115115 unsigned long pressure = 0;
116116
117117 /*
118− * reclaimed can be greater than scanned in cases
119− * like THP, where the scanned is 1 and reclaimed
120− * could be 512
118+ * reclaimed can be greater than scanned for things such as reclaimed
119+ * slab pages. shrink_node() just adds reclaimed pages without a
120+ * related increment to scanned pages.
121121 */
122122 if (reclaimed >= scanned)
123123 goto out;
net/8021q/vlan.c+2−1
@@ -277,7 +277,8 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id) · 276 unmodified lines
277277 return 0;
278278
279279 out_free_newdev:
280− free_netdev(new_dev);
280+ if (new_dev->reg_state == NETREG_UNINITIALIZED)
281+ free_netdev(new_dev);
281282 return err;
282283 }
283284
net/8021q/vlan_dev.c+2−2
@@ -813,7 +813,6 @@ static void vlan_dev_free(struct net_device *dev) · 812 unmodified lines
813813
814814 free_percpu(vlan->vlan_pcpu_stats);
815815 vlan->vlan_pcpu_stats = NULL;
816− free_netdev(dev);
817816 }
818817
819818 void vlan_setup(struct net_device *dev)
@@ -826,7 +825,8 @@ void vlan_setup(struct net_device *dev) · 6 unmodified lines
826825 netif_keep_dst(dev);
827826
828827 dev->netdev_ops = &vlan_netdev_ops;
829− dev->destructor = vlan_dev_free;
828+ dev->needs_free_netdev = true;
829+ dev->priv_destructor = vlan_dev_free;
830830 dev->ethtool_ops = &vlan_ethtool_ops;
831831
832832 dev->min_mtu = 0;
net/batman-adv/distributed-arp-table.c+3−2
@@ -1064,8 +1064,9 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv, · 1063 unmodified lines
10641064
10651065 skb_new->protocol = eth_type_trans(skb_new, soft_iface);
10661066
1067− soft_iface->stats.rx_packets++;
1068− soft_iface->stats.rx_bytes += skb->len + ETH_HLEN + hdr_size;
1067+ batadv_inc_counter(bat_priv, BATADV_CNT_RX);
1068+ batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES,
1069+ skb->len + ETH_HLEN + hdr_size);
10691070
10701071 netif_rx(skb_new);
10711072 batadv_dbg(BATADV_DBG_DAT, bat_priv, "ARP request replied locally\n");
net/batman-adv/routing.c+1−1
@@ -987,7 +987,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, · 986 unmodified lines
987987 batadv_dbg(BATADV_DBG_BLA, bat_priv,
988988 "recv_unicast_packet(): Dropped unicast pkt received from another backbone gw %pM.\n",
989989 orig_addr_gw);
990− return NET_RX_DROP;
990+ goto free_skb;
991991 }
992992 }
993993
net/batman-adv/soft-interface.c+2−3
@@ -1034,8 +1034,6 @@ static void batadv_softif_free(struct net_device *dev) · 1033 unmodified lines
10341034 * netdev and its private data (bat_priv)
10351035 */
10361036 rcu_barrier();
1037−
1038− free_netdev(dev);
10391037 }
10401038
10411039 /**
@@ -1047,7 +1045,8 @@ static void batadv_softif_init_early(struct net_device *dev) · 5 unmodified lines
10471045 ether_setup(dev);
10481046
10491047 dev->netdev_ops = &batadv_netdev_ops;
1050− dev->destructor = batadv_softif_free;
1048+ dev->needs_free_netdev = true;
1049+ dev->priv_destructor = batadv_softif_free;
10511050 dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_NETNS_LOCAL;
10521051 dev->priv_flags |= IFF_NO_QUEUE;
10531052
net/bluetooth/6lowpan.c+1−1
@@ -598,7 +598,7 @@ static void netdev_setup(struct net_device *dev) · 597 unmodified lines
598598
599599 dev->netdev_ops = &netdev_ops;
600600 dev->header_ops = &header_ops;
601− dev->destructor = free_netdev;
601+ dev->needs_free_netdev = true;
602602 }
603603
604604 static struct device_type bt_type = {
net/bridge/br_device.c+1−1
@@ -379,7 +379,7 @@ void br_dev_setup(struct net_device *dev) · 378 unmodified lines
379379 ether_setup(dev);
380380
381381 dev->netdev_ops = &br_netdev_ops;
382− dev->destructor = free_netdev;
382+ dev->needs_free_netdev = true;
383383 dev->ethtool_ops = &br_ethtool_ops;
384384 SET_NETDEV_DEVTYPE(dev, &br_type);
385385 dev->priv_flags = IFF_EBRIDGE | IFF_NO_QUEUE;
net/caif/caif_socket.c+4−0
@@ -754,6 +754,10 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr, · 753 unmodified lines
754754
755755 lock_sock(sk);
756756
757+ err = -EINVAL;
758+ if (addr_len < offsetofend(struct sockaddr, sa_family))
759+ goto out;
760+
757761 err = -EAFNOSUPPORT;
758762 if (uaddr->sa_family != AF_CAIF)
759763 goto out;
net/caif/cfpkt_skbuff.c+1−5
@@ -81,11 +81,7 @@ static struct cfpkt *cfpkt_create_pfx(u16 len, u16 pfx) · 80 unmodified lines
8181 {
8282 struct sk_buff *skb;
8383
84− if (likely(in_interrupt()))
85− skb = alloc_skb(len + pfx, GFP_ATOMIC);
86− else
87− skb = alloc_skb(len + pfx, GFP_KERNEL);
88−
84+ skb = alloc_skb(len + pfx, GFP_ATOMIC);
8985 if (unlikely(skb == NULL))
9086 return NULL;
9187
net/caif/chnl_net.c+2−2
@@ -392,14 +392,14 @@ static void chnl_net_destructor(struct net_device *dev) · 391 unmodified lines
392392 {
393393 struct chnl_net *priv = netdev_priv(dev);
394394 caif_free_client(&priv->chnl);
395− free_netdev(dev);
396395 }
397396
398397 static void ipcaif_net_setup(struct net_device *dev)
399398 {
400399 struct chnl_net *priv;
401400 dev->netdev_ops = &netdev_ops;
402− dev->destructor = chnl_net_destructor;
401+ dev->needs_free_netdev = true;
402+ dev->priv_destructor = chnl_net_destructor;
403403 dev->flags |= IFF_NOARP;
404404 dev->flags |= IFF_POINTOPOINT;
405405 dev->mtu = GPRS_PDP_MTU;
net/can/af_can.c+1−2
@@ -872,8 +872,7 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg, · 871 unmodified lines
872872
873873 static int can_pernet_init(struct net *net)
874874 {
875− net->can.can_rcvlists_lock =
876− __SPIN_LOCK_UNLOCKED(net->can.can_rcvlists_lock);
875+ spin_lock_init(&net->can.can_rcvlists_lock);
877876 net->can.can_rx_alldev_list =
878877 kzalloc(sizeof(struct dev_rcv_lists), GFP_KERNEL);
879878
net/core/dev.c+30−14
@@ -1253,8 +1253,9 @@ int dev_set_alias(struct net_device *dev, const char *alias, size_t len) · 1252 unmodified lines
12531253 if (!new_ifalias)
12541254 return -ENOMEM;
12551255 dev->ifalias = new_ifalias;
1256+ memcpy(dev->ifalias, alias, len);
1257+ dev->ifalias[len] = 0;
12561258
1257− strlcpy(dev->ifalias, alias, len+1);
12581259 return len;
12591260 }
12601261
@@ -4948,6 +4949,19 @@ __sum16 __skb_gro_checksum_complete(struct sk_buff *skb) · 3687 unmodified lines
49484949 }
49494950 EXPORT_SYMBOL(__skb_gro_checksum_complete);
49504951
4952+static void net_rps_send_ipi(struct softnet_data *remsd)
4953+{
4954+#ifdef CONFIG_RPS
4955+ while (remsd) {
4956+ struct softnet_data *next = remsd->rps_ipi_next;
4957+
4958+ if (cpu_online(remsd->cpu))
4959+ smp_call_function_single_async(remsd->cpu, &remsd->csd);
4960+ remsd = next;
4961+ }
4962+#endif
4963+}
4964+
49514965 /*
49524966 * net_rps_action_and_irq_enable sends any pending IPI's for rps.
49534967 * Note: called with local irq disabled, but exits with local irq enabled.
@@ -4963,14 +4977,7 @@ static void net_rps_action_and_irq_enable(struct softnet_data *sd) · 9 unmodified lines
49634977 local_irq_enable();
49644978
49654979 /* Send pending IPI's to kick RPS processing on remote cpus. */
4966− while (remsd) {
4967− struct softnet_data *next = remsd->rps_ipi_next;
4968−
4969− if (cpu_online(remsd->cpu))
4970− smp_call_function_single_async(remsd->cpu,
4971− &remsd->csd);
4972− remsd = next;
4973− }
4980+ net_rps_send_ipi(remsd);
49744981 } else
49754982 #endif
49764983 local_irq_enable();
@@ -5199,8 +5206,6 @@ static void busy_poll_stop(struct napi_struct *napi, void *have_poll_lock) · 222 unmodified lines
51995206 if (rc == BUSY_POLL_BUDGET)
52005207 __napi_schedule(napi);
52015208 local_bh_enable();
5202− if (local_softirq_pending())
5203− do_softirq();
52045209 }
52055210
52065211 void napi_busy_loop(unsigned int napi_id,
@@ -7501,6 +7506,8 @@ out: · 2294 unmodified lines
75017506 err_uninit:
75027507 if (dev->netdev_ops->ndo_uninit)
75037508 dev->netdev_ops->ndo_uninit(dev);
7509+ if (dev->priv_destructor)
7510+ dev->priv_destructor(dev);
75047511 goto out;
75057512 }
75067513 EXPORT_SYMBOL(register_netdevice);
@@ -7708,8 +7715,10 @@ void netdev_run_todo(void) · 201 unmodified lines
77087715 WARN_ON(rcu_access_pointer(dev->ip6_ptr));
77097716 WARN_ON(dev->dn_ptr);
77107717
7711− if (dev->destructor)
7712− dev->destructor(dev);
7718+ if (dev->priv_destructor)
7719+ dev->priv_destructor(dev);
7720+ if (dev->needs_free_netdev)
7721+ free_netdev(dev);
77137722
77147723 /* Report a network device has been unregistered */
77157724 rtnl_lock();
@@ -8192,7 +8201,7 @@ static int dev_cpu_dead(unsigned int oldcpu) · 476 unmodified lines
81928201 struct sk_buff **list_skb;
81938202 struct sk_buff *skb;
81948203 unsigned int cpu;
8195− struct softnet_data *sd, *oldsd;
8204+ struct softnet_data *sd, *oldsd, *remsd = NULL;
81968205
81978206 local_irq_disable();
81988207 cpu = smp_processor_id();
@@ -8233,6 +8242,13 @@ static int dev_cpu_dead(unsigned int oldcpu) · 34 unmodified lines
82338242 raise_softirq_irqoff(NET_TX_SOFTIRQ);
82348243 local_irq_enable();
82358244
8245+#ifdef CONFIG_RPS
8246+ remsd = oldsd->rps_ipi_list;
8247+ oldsd->rps_ipi_list = NULL;
8248+#endif
8249+ /* send out pending IPI's on offline CPU */
8250+ net_rps_send_ipi(remsd);
8251+
82368252 /* Process offline CPU's input_pkt_queue */
82378253 while ((skb = __skb_dequeue(&oldsd->process_queue))) {
82388254 netif_rx_ni(skb);
net/core/dev_ioctl.c+16−3
@@ -410,6 +410,22 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg) · 409 unmodified lines
410410 if (cmd == SIOCGIFNAME)
411411 return dev_ifname(net, (struct ifreq __user *)arg);
412412
413+ /*
414+ * Take care of Wireless Extensions. Unfortunately struct iwreq
415+ * isn't a proper subset of struct ifreq (it's 8 byte shorter)
416+ * so we need to treat it specially, otherwise applications may
417+ * fault if the struct they're passing happens to land at the
418+ * end of a mapped page.
419+ */
420+ if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) {
421+ struct iwreq iwr;
422+
423+ if (copy_from_user(&iwr, arg, sizeof(iwr)))
424+ return -EFAULT;
425+
426+ return wext_handle_ioctl(net, &iwr, cmd, arg);
427+ }
428+
413429 if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
414430 return -EFAULT;
415431
@@ -559,9 +575,6 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg) · 143 unmodified lines
559575 ret = -EFAULT;
560576 return ret;
561577 }
562− /* Take care of Wireless Extensions */
563− if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST)
564− return wext_handle_ioctl(net, &ifr, cmd, arg);
565578 return -ENOTTY;
566579 }
567580 }
net/core/dst.c+14−0
@@ -469,6 +469,20 @@ static int dst_dev_event(struct notifier_block *this, unsigned long event, · 468 unmodified lines
469469 spin_lock_bh(&dst_garbage.lock);
470470 dst = dst_garbage.list;
471471 dst_garbage.list = NULL;
472+ /* The code in dst_ifdown places a hold on the loopback device.
473+ * If the gc entry processing is set to expire after a lengthy
474+ * interval, this hold can cause netdev_wait_allrefs() to hang
475+ * out and wait for a long time -- until the the loopback
476+ * interface is released. If we're really unlucky, it'll emit
477+ * pr_emerg messages to console too. Reset the interval here,
478+ * so dst cleanups occur in a more timely fashion.
479+ */
480+ if (dst_garbage.timer_inc > DST_GC_INC) {
481+ dst_garbage.timer_inc = DST_GC_INC;
482+ dst_garbage.timer_expires = DST_GC_MIN;
483+ mod_delayed_work(system_wq, &dst_gc_work,
484+ dst_garbage.timer_expires);
485+ }
472486 spin_unlock_bh(&dst_garbage.lock);
473487
474488 if (last)
net/core/fib_rules.c+14−7
@@ -568,7 +568,7 @@ int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, · 567 unmodified lines
568568 struct net *net = sock_net(skb->sk);
569569 struct fib_rule_hdr *frh = nlmsg_data(nlh);
570570 struct fib_rules_ops *ops = NULL;
571− struct fib_rule *rule, *tmp;
571+ struct fib_rule *rule, *r;
572572 struct nlattr *tb[FRA_MAX+1];
573573 struct fib_kuid_range range;
574574 int err = -EINVAL;
@@ -668,16 +668,23 @@ int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, · 93 unmodified lines
668668
669669 /*
670670 * Check if this rule is a target to any of them. If so,
671+ * adjust to the next one with the same preference or
671672 * disable them. As this operation is eventually very
672− * expensive, it is only performed if goto rules have
673− * actually been added.
673+ * expensive, it is only performed if goto rules, except
674+ * current if it is goto rule, have actually been added.
674675 */
675676 if (ops->nr_goto_rules > 0) {
676− list_for_each_entry(tmp, &ops->rules_list, list) {
677− if (rtnl_dereference(tmp->ctarget) == rule) {
678− RCU_INIT_POINTER(tmp->ctarget, NULL);
677+ struct fib_rule *n;
678+
679+ n = list_next_entry(rule, list);
680+ if (&n->list == &ops->rules_list || n->pref != rule->pref)
681+ n = NULL;
682+ list_for_each_entry(r, &ops->rules_list, list) {
683+ if (rtnl_dereference(r->ctarget) != rule)
684+ continue;
685+ rcu_assign_pointer(r->ctarget, n);
686+ if (!n)
679687 ops->unresolved_rules++;
680− }
681688 }
682689 }
683690
net/core/rtnetlink.c+4−1
@@ -931,6 +931,7 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev, · 930 unmodified lines
931931 + nla_total_size(1) /* IFLA_LINKMODE */
932932 + nla_total_size(4) /* IFLA_CARRIER_CHANGES */
933933 + nla_total_size(4) /* IFLA_LINK_NETNSID */
934+ + nla_total_size(4) /* IFLA_GROUP */
934935 + nla_total_size(ext_filter_mask
935936 & RTEXT_FILTER_VF ? 4 : 0) /* IFLA_NUM_VF */
936937 + rtnl_vfinfo_size(dev, ext_filter_mask) /* IFLA_VFINFO_LIST */
@@ -1124,6 +1125,8 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, · 187 unmodified lines
11241125 struct ifla_vf_mac vf_mac;
11251126 struct ifla_vf_info ivi;
11261127
1128+ memset(&ivi, 0, sizeof(ivi));
1129+
11271130 /* Not all SR-IOV capable drivers support the
11281131 * spoofcheck and "RSS query enable" query. Preset to
11291132 * -1 so the user space tool can detect that the driver
@@ -1132,7 +1135,6 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, · 2 unmodified lines
11321135 ivi.spoofchk = -1;
11331136 ivi.rss_query_en = -1;
11341137 ivi.trusted = -1;
1135− memset(ivi.mac, 0, sizeof(ivi.mac));
11361138 /* The default value for VF link state is "auto"
11371139 * IFLA_VF_LINK_STATE_AUTO which equals zero
11381140 */
@@ -1467,6 +1469,7 @@ static const struct nla_policy ifla_policy[IFLA_MAX+1] = { · 328 unmodified lines
14671469 [IFLA_LINK_NETNSID] = { .type = NLA_S32 },
14681470 [IFLA_PROTO_DOWN] = { .type = NLA_U8 },
14691471 [IFLA_XDP] = { .type = NLA_NESTED },
1472+ [IFLA_GROUP] = { .type = NLA_U32 },
14701473 };
14711474
14721475 static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {
net/decnet/dn_route.c+4−10
@@ -188,12 +188,6 @@ static inline void dnrt_free(struct dn_route *rt) · 187 unmodified lines
188188 call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free);
189189 }
190190
191−static inline void dnrt_drop(struct dn_route *rt)
192−{
193− dst_release(&rt->dst);
194− call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free);
195−}
196−
197191 static void dn_dst_check_expire(unsigned long dummy)
198192 {
199193 int i;
@@ -248,7 +242,7 @@ static int dn_dst_gc(struct dst_ops *ops) · 48 unmodified lines
248242 }
249243 *rtp = rt->dst.dn_next;
250244 rt->dst.dn_next = NULL;
251− dnrt_drop(rt);
245+ dnrt_free(rt);
252246 break;
253247 }
254248 spin_unlock_bh(&dn_rt_hash_table[i].lock);
@@ -350,7 +344,7 @@ static int dn_insert_route(struct dn_route *rt, unsigned int hash, struct dn_rou · 95 unmodified lines
350344 dst_use(&rth->dst, now);
351345 spin_unlock_bh(&dn_rt_hash_table[hash].lock);
352346
353− dnrt_drop(rt);
347+ dst_free(&rt->dst);
354348 *rp = rth;
355349 return 0;
356350 }
@@ -380,7 +374,7 @@ static void dn_run_flush(unsigned long dummy) · 23 unmodified lines
380374 for(; rt; rt = next) {
381375 next = rcu_dereference_raw(rt->dst.dn_next);
382376 RCU_INIT_POINTER(rt->dst.dn_next, NULL);
383− dst_free((struct dst_entry *)rt);
377+ dnrt_free(rt);
384378 }
385379
386380 nothing_to_declare:
@@ -1187,7 +1181,7 @@ make_route: · 800 unmodified lines
11871181 if (dev_out->flags & IFF_LOOPBACK)
11881182 flags |= RTCF_LOCAL;
11891183
1190− rt = dst_alloc(&dn_dst_ops, dev_out, 1, DST_OBSOLETE_NONE, DST_HOST);
1184+ rt = dst_alloc(&dn_dst_ops, dev_out, 0, DST_OBSOLETE_NONE, DST_HOST);
11911185 if (rt == NULL)
11921186 goto e_nobufs;
11931187
net/decnet/netfilter/dn_rtmsg.c+3−1
@@ -102,7 +102,9 @@ static inline void dnrmg_receive_user_skb(struct sk_buff *skb) · 101 unmodified lines
102102 {
103103 struct nlmsghdr *nlh = nlmsg_hdr(skb);
104104
105− if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
105+ if (skb->len < sizeof(*nlh) ||
106+ nlh->nlmsg_len < sizeof(*nlh) ||
107+ skb->len < nlh->nlmsg_len)
106108 return;
107109
108110 if (!netlink_capable(skb, CAP_NET_ADMIN))
net/hsr/hsr_device.c+2−2
@@ -378,7 +378,6 @@ static void hsr_dev_destroy(struct net_device *hsr_dev) · 377 unmodified lines
378378 del_timer_sync(&hsr->announce_timer);
379379
380380 synchronize_rcu();
381− free_netdev(hsr_dev);
382381 }
383382
384383 static const struct net_device_ops hsr_device_ops = {
@@ -404,7 +403,8 @@ void hsr_dev_setup(struct net_device *dev) · 19 unmodified lines
404403 SET_NETDEV_DEVTYPE(dev, &hsr_type);
405404 dev->priv_flags |= IFF_NO_QUEUE;
406405
407− dev->destructor = hsr_dev_destroy;
406+ dev->needs_free_netdev = true;
407+ dev->priv_destructor = hsr_dev_destroy;
408408
409409 dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
410410 NETIF_F_GSO_MASK | NETIF_F_HW_CSUM |
net/hsr/hsr_forward.c+1−2
@@ -324,8 +324,7 @@ static int hsr_fill_frame_info(struct hsr_frame_info *frame, · 323 unmodified lines
324324 unsigned long irqflags;
325325
326326 frame->is_supervision = is_supervision_frame(port->hsr, skb);
327− frame->node_src = hsr_get_node(&port->hsr->node_db, skb,
328− frame->is_supervision);
327+ frame->node_src = hsr_get_node(port, skb, frame->is_supervision);
329328 if (frame->node_src == NULL)
330329 return -1; /* Unknown node and !is_supervision, or no mem */
331330
net/hsr/hsr_framereg.c+7−2
@@ -158,9 +158,10 @@ struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[], · 157 unmodified lines
158158
159159 /* Get the hsr_node from which 'skb' was sent.
160160 */
161−struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb,
161+struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb,
162162 bool is_sup)
163163 {
164+ struct list_head *node_db = &port->hsr->node_db;
164165 struct hsr_node *node;
165166 struct ethhdr *ethhdr;
166167 u16 seq_out;
@@ -186,7 +187,11 @@ struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb, · 19 unmodified lines
186187 */
187188 seq_out = hsr_get_skb_sequence_nr(skb) - 1;
188189 } else {
189− WARN_ONCE(1, "%s: Non-HSR frame\n", __func__);
190+ /* this is called also for frames from master port and
191+ * so warn only for non master ports
192+ */
193+ if (port->type != HSR_PT_MASTER)
194+ WARN_ONCE(1, "%s: Non-HSR frame\n", __func__);
190195 seq_out = HSR_SEQNR_START;
191196 }
192197
net/hsr/hsr_framereg.h+1−1
@@ -18,7 +18,7 @@ struct hsr_node; · 17 unmodified lines
1818
1919 struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[],
2020 u16 seq_out);
21−struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb,
21+struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb,
2222 bool is_sup);
2323 void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr,
2424 struct hsr_port *port);
net/ieee802154/6lowpan/core.c+1−1
@@ -107,7 +107,7 @@ static void lowpan_setup(struct net_device *ldev) · 106 unmodified lines
107107
108108 ldev->netdev_ops = &lowpan_netdev_ops;
109109 ldev->header_ops = &lowpan_header_ops;
110− ldev->destructor = free_netdev;
110+ ldev->needs_free_netdev = true;
111111 ldev->features |= NETIF_F_NETNS_LOCAL;
112112 }
113113
net/ipv4/icmp.c+6−2
@@ -657,8 +657,12 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) · 656 unmodified lines
657657 /* Needed by both icmp_global_allow and icmp_xmit_lock */
658658 local_bh_disable();
659659
660− /* Check global sysctl_icmp_msgs_per_sec ratelimit */
661− if (!icmpv4_global_allow(net, type, code))
660+ /* Check global sysctl_icmp_msgs_per_sec ratelimit, unless
661+ * incoming dev is loopback. If outgoing dev change to not be
662+ * loopback, then peer ratelimit still work (in icmpv4_xrlim_allow)
663+ */
664+ if (!(skb_in->dev && (skb_in->dev->flags&IFF_LOOPBACK)) &&
665+ !icmpv4_global_allow(net, type, code))
662666 goto out_bh_enable;
663667
664668 sk = icmp_xmit_lock(net);
net/ipv4/igmp.c+14−8
@@ -1112,6 +1112,7 @@ static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im) · 1111 unmodified lines
11121112 pmc = kzalloc(sizeof(*pmc), GFP_KERNEL);
11131113 if (!pmc)
11141114 return;
1115+ spin_lock_init(&pmc->lock);
11151116 spin_lock_bh(&im->lock);
11161117 pmc->interface = im->interface;
11171118 in_dev_hold(in_dev);
@@ -2071,21 +2072,26 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, · 953 unmodified lines
20712072
20722073 static void ip_mc_clear_src(struct ip_mc_list *pmc)
20732074 {
2074− struct ip_sf_list *psf, *nextpsf;
2075+ struct ip_sf_list *psf, *nextpsf, *tomb, *sources;
20752076
2076− for (psf = pmc->tomb; psf; psf = nextpsf) {
2077+ spin_lock_bh(&pmc->lock);
2078+ tomb = pmc->tomb;
2079+ pmc->tomb = NULL;
2080+ sources = pmc->sources;
2081+ pmc->sources = NULL;
2082+ pmc->sfmode = MCAST_EXCLUDE;
2083+ pmc->sfcount[MCAST_INCLUDE] = 0;
2084+ pmc->sfcount[MCAST_EXCLUDE] = 1;
2085+ spin_unlock_bh(&pmc->lock);
2086+
2087+ for (psf = tomb; psf; psf = nextpsf) {
20772088 nextpsf = psf->sf_next;
20782089 kfree(psf);
20792090 }
2080− pmc->tomb = NULL;
2081− for (psf = pmc->sources; psf; psf = nextpsf) {
2091+ for (psf = sources; psf; psf = nextpsf) {
20822092 nextpsf = psf->sf_next;
20832093 kfree(psf);
20842094 }
2085− pmc->sources = NULL;
2086− pmc->sfmode = MCAST_EXCLUDE;
2087− pmc->sfcount[MCAST_INCLUDE] = 0;
2088− pmc->sfcount[MCAST_EXCLUDE] = 1;
20892095 }
20902096
20912097 /* Join a multicast group
net/ipv4/ip_tunnel.c+4−2
@@ -446,6 +446,8 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb, · 445 unmodified lines
446446 return 0;
447447
448448 drop:
449+ if (tun_dst)
450+ dst_release((struct dst_entry *)tun_dst);
449451 kfree_skb(skb);
450452 return 0;
451453 }
@@ -967,7 +969,6 @@ static void ip_tunnel_dev_free(struct net_device *dev) · 515 unmodified lines
967969 gro_cells_destroy(&tunnel->gro_cells);
968970 dst_cache_destroy(&tunnel->dst_cache);
969971 free_percpu(dev->tstats);
970− free_netdev(dev);
971972 }
972973
973974 void ip_tunnel_dellink(struct net_device *dev, struct list_head *head)
@@ -1155,7 +1156,8 @@ int ip_tunnel_init(struct net_device *dev) · 181 unmodified lines
11551156 struct iphdr *iph = &tunnel->parms.iph;
11561157 int err;
11571158
1158− dev->destructor = ip_tunnel_dev_free;
1159+ dev->needs_free_netdev = true;
1160+ dev->priv_destructor = ip_tunnel_dev_free;
11591161 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
11601162 if (!dev->tstats)
11611163 return -ENOMEM;
net/ipv4/ipmr.c+16−18
@@ -101,8 +101,8 @@ static struct mr_table *ipmr_new_table(struct net *net, u32 id); · 100 unmodified lines
101101 static void ipmr_free_table(struct mr_table *mrt);
102102
103103 static void ip_mr_forward(struct net *net, struct mr_table *mrt,
104− struct sk_buff *skb, struct mfc_cache *cache,
105− int local);
104+ struct net_device *dev, struct sk_buff *skb,
105+ struct mfc_cache *cache, int local);
106106 static int ipmr_cache_report(struct mr_table *mrt,
107107 struct sk_buff *pkt, vifi_t vifi, int assert);
108108 static int __ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb,
@@ -501,7 +501,7 @@ static void reg_vif_setup(struct net_device *dev) · 392 unmodified lines
501501 dev->mtu = ETH_DATA_LEN - sizeof(struct iphdr) - 8;
502502 dev->flags = IFF_NOARP;
503503 dev->netdev_ops = &reg_vif_netdev_ops;
504− dev->destructor = free_netdev;
504+ dev->needs_free_netdev = true;
505505 dev->features |= NETIF_F_NETNS_LOCAL;
506506 }
507507
@@ -988,7 +988,7 @@ static void ipmr_cache_resolve(struct net *net, struct mr_table *mrt, · 480 unmodified lines
988988
989989 rtnl_unicast(skb, net, NETLINK_CB(skb).portid);
990990 } else {
991− ip_mr_forward(net, mrt, skb, c, 0);
991+ ip_mr_forward(net, mrt, skb->dev, skb, c, 0);
992992 }
993993 }
994994 }
@@ -1073,7 +1073,7 @@ static int ipmr_cache_report(struct mr_table *mrt, · 78 unmodified lines
10731073
10741074 /* Queue a packet for resolution. It gets locked cache entry! */
10751075 static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi,
1076− struct sk_buff *skb)
1076+ struct sk_buff *skb, struct net_device *dev)
10771077 {
10781078 const struct iphdr *iph = ip_hdr(skb);
10791079 struct mfc_cache *c;
@@ -1130,6 +1130,10 @@ static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi, · 50 unmodified lines
11301130 kfree_skb(skb);
11311131 err = -ENOBUFS;
11321132 } else {
1133+ if (dev) {
1134+ skb->dev = dev;
1135+ skb->skb_iif = dev->ifindex;
1136+ }
11331137 skb_queue_tail(&c->mfc_un.unres.unresolved, skb);
11341138 err = 0;
11351139 }
@@ -1828,10 +1832,10 @@ static int ipmr_find_vif(struct mr_table *mrt, struct net_device *dev) · 692 unmodified lines
18281832
18291833 /* "local" means that we should preserve one skb (for local delivery) */
18301834 static void ip_mr_forward(struct net *net, struct mr_table *mrt,
1831− struct sk_buff *skb, struct mfc_cache *cache,
1832− int local)
1835+ struct net_device *dev, struct sk_buff *skb,
1836+ struct mfc_cache *cache, int local)
18331837 {
1834− int true_vifi = ipmr_find_vif(mrt, skb->dev);
1838+ int true_vifi = ipmr_find_vif(mrt, dev);
18351839 int psend = -1;
18361840 int vif, ct;
18371841
@@ -1853,13 +1857,7 @@ static void ip_mr_forward(struct net *net, struct mr_table *mrt, · 15 unmodified lines
18531857 }
18541858
18551859 /* Wrong interface: drop packet and (maybe) send PIM assert. */
1856− if (mrt->vif_table[vif].dev != skb->dev) {
1857− struct net_device *mdev;
1858−
1859− mdev = l3mdev_master_dev_rcu(mrt->vif_table[vif].dev);
1860− if (mdev == skb->dev)
1861− goto forward;
1862−
1860+ if (mrt->vif_table[vif].dev != dev) {
18631861 if (rt_is_output_route(skb_rtable(skb))) {
18641862 /* It is our own packet, looped back.
18651863 * Very complicated situation...
@@ -2053,7 +2051,7 @@ int ip_mr_input(struct sk_buff *skb) · 187 unmodified lines
20532051 read_lock(&mrt_lock);
20542052 vif = ipmr_find_vif(mrt, dev);
20552053 if (vif >= 0) {
2056− int err2 = ipmr_cache_unresolved(mrt, vif, skb);
2054+ int err2 = ipmr_cache_unresolved(mrt, vif, skb, dev);
20572055 read_unlock(&mrt_lock);
20582056
20592057 return err2;
@@ -2064,7 +2062,7 @@ int ip_mr_input(struct sk_buff *skb) · 4 unmodified lines
20642062 }
20652063
20662064 read_lock(&mrt_lock);
2067− ip_mr_forward(net, mrt, skb, cache, local);
2065+ ip_mr_forward(net, mrt, dev, skb, cache, local);
20682066 read_unlock(&mrt_lock);
20692067
20702068 if (local)
@@ -2238,7 +2236,7 @@ int ipmr_get_route(struct net *net, struct sk_buff *skb, · 167 unmodified lines
22382236 iph->saddr = saddr;
22392237 iph->daddr = daddr;
22402238 iph->version = 0;
2241− err = ipmr_cache_unresolved(mrt, vif, skb2);
2239+ err = ipmr_cache_unresolved(mrt, vif, skb2, dev);
22422240 read_unlock(&mrt_lock);
22432241 rcu_read_unlock();
22442242 return err;
net/ipv6/addrconf.c+3−3
@@ -332,9 +332,9 @@ static void addrconf_mod_rs_timer(struct inet6_dev *idev, · 331 unmodified lines
332332 static void addrconf_mod_dad_work(struct inet6_ifaddr *ifp,
333333 unsigned long delay)
334334 {
335− if (!delayed_work_pending(&ifp->dad_work))
336− in6_ifa_hold(ifp);
337− mod_delayed_work(addrconf_wq, &ifp->dad_work, delay);
335+ in6_ifa_hold(ifp);
336+ if (mod_delayed_work(addrconf_wq, &ifp->dad_work, delay))
337+ in6_ifa_put(ifp);
338338 }
339339
340340 static int snmp6_alloc_dev(struct inet6_dev *idev)
net/ipv6/fib6_rules.c+6−16
@@ -32,7 +32,6 @@ struct fib6_rule { · 31 unmodified lines
3232 struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
3333 int flags, pol_lookup_t lookup)
3434 {
35− struct rt6_info *rt;
3635 struct fib_lookup_arg arg = {
3736 .lookup_ptr = lookup,
3837 .flags = FIB_LOOKUP_NOREF,
@@ -44,21 +43,11 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, · 5 unmodified lines
4443 fib_rules_lookup(net->ipv6.fib6_rules_ops,
4544 flowi6_to_flowi(fl6), flags, &arg);
4645
47− rt = arg.result;
46+ if (arg.result)
47+ return arg.result;
4848
49− if (!rt) {
50− dst_hold(&net->ipv6.ip6_null_entry->dst);
51− return &net->ipv6.ip6_null_entry->dst;
52− }
53−
54− if (rt->rt6i_flags & RTF_REJECT &&
55− rt->dst.error == -EAGAIN) {
56− ip6_rt_put(rt);
57− rt = net->ipv6.ip6_null_entry;
58− dst_hold(&rt->dst);
59− }
60−
61− return &rt->dst;
49+ dst_hold(&net->ipv6.ip6_null_entry->dst);
50+ return &net->ipv6.ip6_null_entry->dst;
6251 }
6352
6453 static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,
@@ -121,7 +110,8 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp, · 56 unmodified lines
121110 flp6->saddr = saddr;
122111 }
123112 err = rt->dst.error;
124− goto out;
113+ if (err != -EAGAIN)
114+ goto out;
125115 }
126116 again:
127117 ip6_rt_put(rt);
net/ipv6/icmp.c+1−1
@@ -491,7 +491,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, · 490 unmodified lines
491491 local_bh_disable();
492492
493493 /* Check global sysctl_icmp_msgs_per_sec ratelimit */
494− if (!icmpv6_global_allow(type))
494+ if (!(skb->dev->flags&IFF_LOOPBACK) && !icmpv6_global_allow(type))
495495 goto out_bh_enable;
496496
497497 mip6_addr_swap(skb);
net/ipv6/ila/ila_xlat.c+1−0
@@ -62,6 +62,7 @@ static inline u32 ila_locator_hash(struct ila_locator loc) · 61 unmodified lines
6262 {
6363 u32 *v = (u32 *)loc.v32;
6464
65+ __ila_hash_secret_init();
6566 return jhash_2words(v[0], v[1], hashrnd);
6667 }
6768
net/ipv6/ip6_fib.c+1−2
@@ -289,8 +289,7 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, · 288 unmodified lines
289289 struct rt6_info *rt;
290290
291291 rt = lookup(net, net->ipv6.fib6_main_tbl, fl6, flags);
292− if (rt->rt6i_flags & RTF_REJECT &&
293− rt->dst.error == -EAGAIN) {
292+ if (rt->dst.error == -EAGAIN) {
294293 ip6_rt_put(rt);
295294 rt = net->ipv6.ip6_null_entry;
296295 dst_hold(&rt->dst);
net/ipv6/ip6_gre.c+5−4
@@ -991,13 +991,13 @@ static void ip6gre_dev_free(struct net_device *dev) · 990 unmodified lines
991991
992992 dst_cache_destroy(&t->dst_cache);
993993 free_percpu(dev->tstats);
994− free_netdev(dev);
995994 }
996995
997996 static void ip6gre_tunnel_setup(struct net_device *dev)
998997 {
999998 dev->netdev_ops = &ip6gre_netdev_ops;
1000− dev->destructor = ip6gre_dev_free;
999+ dev->needs_free_netdev = true;
1000+ dev->priv_destructor = ip6gre_dev_free;
10011001
10021002 dev->type = ARPHRD_IP6GRE;
10031003
@@ -1148,7 +1148,7 @@ static int __net_init ip6gre_init_net(struct net *net) · 144 unmodified lines
11481148 return 0;
11491149
11501150 err_reg_dev:
1151− ip6gre_dev_free(ign->fb_tunnel_dev);
1151+ free_netdev(ign->fb_tunnel_dev);
11521152 err_alloc_dev:
11531153 return err;
11541154 }
@@ -1300,7 +1300,8 @@ static void ip6gre_tap_setup(struct net_device *dev) · 145 unmodified lines
13001300 ether_setup(dev);
13011301
13021302 dev->netdev_ops = &ip6gre_tap_netdev_ops;
1303− dev->destructor = ip6gre_dev_free;
1303+ dev->needs_free_netdev = true;
1304+ dev->priv_destructor = ip6gre_dev_free;
13041305
13051306 dev->features |= NETIF_F_NETNS_LOCAL;
13061307 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
net/ipv6/ip6_tunnel.c+8−6
@@ -254,7 +254,6 @@ static void ip6_dev_free(struct net_device *dev) · 253 unmodified lines
254254 gro_cells_destroy(&t->gro_cells);
255255 dst_cache_destroy(&t->dst_cache);
256256 free_percpu(dev->tstats);
257− free_netdev(dev);
258257 }
259258
260259 static int ip6_tnl_create2(struct net_device *dev)
@@ -322,7 +321,7 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p) · 61 unmodified lines
322321 return t;
323322
324323 failed_free:
325− ip6_dev_free(dev);
324+ free_netdev(dev);
326325 failed:
327326 return ERR_PTR(err);
328327 }
@@ -859,6 +858,8 @@ static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb, · 530 unmodified lines
859858 return 0;
860859
861860 drop:
861+ if (tun_dst)
862+ dst_release((struct dst_entry *)tun_dst);
862863 kfree_skb(skb);
863864 return 0;
864865 }
@@ -1247,7 +1248,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) · 382 unmodified lines
12471248 fl6.flowi6_proto = IPPROTO_IPIP;
12481249 fl6.daddr = key->u.ipv6.dst;
12491250 fl6.flowlabel = key->label;
1250− dsfield = ip6_tclass(key->label);
1251+ dsfield = key->tos;
12511252 } else {
12521253 if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
12531254 encap_limit = t->parms.encap_limit;
@@ -1318,7 +1319,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) · 64 unmodified lines
13181319 fl6.flowi6_proto = IPPROTO_IPV6;
13191320 fl6.daddr = key->u.ipv6.dst;
13201321 fl6.flowlabel = key->label;
1321− dsfield = ip6_tclass(key->label);
1322+ dsfield = key->tos;
13221323 } else {
13231324 offset = ip6_tnl_parse_tlv_enc_lim(skb, skb_network_header(skb));
13241325 /* ip6_tnl_parse_tlv_enc_lim() might have reallocated skb->head */
@@ -1777,7 +1778,8 @@ static const struct net_device_ops ip6_tnl_netdev_ops = { · 452 unmodified lines
17771778 static void ip6_tnl_dev_setup(struct net_device *dev)
17781779 {
17791780 dev->netdev_ops = &ip6_tnl_netdev_ops;
1780− dev->destructor = ip6_dev_free;
1781+ dev->needs_free_netdev = true;
1782+ dev->priv_destructor = ip6_dev_free;
17811783
17821784 dev->type = ARPHRD_TUNNEL6;
17831785 dev->flags |= IFF_NOARP;
@@ -2224,7 +2226,7 @@ static int __net_init ip6_tnl_init_net(struct net *net) · 440 unmodified lines
22242226 return 0;
22252227
22262228 err_register:
2227− ip6_dev_free(ip6n->fb_tnl_dev);
2229+ free_netdev(ip6n->fb_tnl_dev);
22282230 err_alloc_dev:
22292231 return err;
22302232 }
net/ipv6/ip6_vti.c+4−4
@@ -180,7 +180,6 @@ vti6_tnl_unlink(struct vti6_net *ip6n, struct ip6_tnl *t) · 179 unmodified lines
180180 static void vti6_dev_free(struct net_device *dev)
181181 {
182182 free_percpu(dev->tstats);
183− free_netdev(dev);
184183 }
185184
186185 static int vti6_tnl_create2(struct net_device *dev)
@@ -235,7 +234,7 @@ static struct ip6_tnl *vti6_tnl_create(struct net *net, struct __ip6_tnl_parm *p · 48 unmodified lines
235234 return t;
236235
237236 failed_free:
238− vti6_dev_free(dev);
237+ free_netdev(dev);
239238 failed:
240239 return NULL;
241240 }
@@ -842,7 +841,8 @@ static const struct net_device_ops vti6_netdev_ops = { · 600 unmodified lines
842841 static void vti6_dev_setup(struct net_device *dev)
843842 {
844843 dev->netdev_ops = &vti6_netdev_ops;
845− dev->destructor = vti6_dev_free;
844+ dev->needs_free_netdev = true;
845+ dev->priv_destructor = vti6_dev_free;
846846
847847 dev->type = ARPHRD_TUNNEL6;
848848 dev->hard_header_len = LL_MAX_HEADER + sizeof(struct ipv6hdr);
@@ -1100,7 +1100,7 @@ static int __net_init vti6_init_net(struct net *net) · 251 unmodified lines
11001100 return 0;
11011101
11021102 err_register:
1103− vti6_dev_free(ip6n->fb_tnl_dev);
1103+ free_netdev(ip6n->fb_tnl_dev);
11041104 err_alloc_dev:
11051105 return err;
11061106 }
net/ipv6/ip6mr.c+1−1
@@ -733,7 +733,7 @@ static void reg_vif_setup(struct net_device *dev) · 732 unmodified lines
733733 dev->mtu = 1500 - sizeof(struct ipv6hdr) - 8;
734734 dev->flags = IFF_NOARP;
735735 dev->netdev_ops = &reg_vif_netdev_ops;
736− dev->destructor = free_netdev;
736+ dev->needs_free_netdev = true;
737737 dev->features |= NETIF_F_NETNS_LOCAL;
738738 }
739739
net/ipv6/proc.c+1−1
@@ -219,7 +219,7 @@ static void snmp6_seq_show_item64(struct seq_file *seq, void __percpu *mib, · 218 unmodified lines
219219 u64 buff64[SNMP_MIB_MAX];
220220 int i;
221221
222− memset(buff64, 0, sizeof(unsigned long) * SNMP_MIB_MAX);
222+ memset(buff64, 0, sizeof(u64) * SNMP_MIB_MAX);
223223
224224 snmp_get_cpu_field64_batch(buff64, itemlist, mib, syncpoff);
225225 for (i = 0; itemlist[i].name; i++)
net/ipv6/route.c+1−0
@@ -2804,6 +2804,7 @@ static int fib6_ifdown(struct rt6_info *rt, void *arg) · 2803 unmodified lines
28042804 if ((rt->dst.dev == dev || !dev) &&
28052805 rt != adn->net->ipv6.ip6_null_entry &&
28062806 (rt->rt6i_nsiblings == 0 ||
2807+ (dev && netdev_unregistering(dev)) ||
28072808 !rt->rt6i_idev->cnf.ignore_routes_with_linkdown))
28082809 return -1;
28092810
net/ipv6/sit.c+3−3
@@ -265,7 +265,7 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net, · 264 unmodified lines
265265 return nt;
266266
267267 failed_free:
268− ipip6_dev_free(dev);
268+ free_netdev(dev);
269269 failed:
270270 return NULL;
271271 }
@@ -1336,7 +1336,6 @@ static void ipip6_dev_free(struct net_device *dev) · 1064 unmodified lines
13361336
13371337 dst_cache_destroy(&tunnel->dst_cache);
13381338 free_percpu(dev->tstats);
1339− free_netdev(dev);
13401339 }
13411340
13421341 #define SIT_FEATURES (NETIF_F_SG | \
@@ -1351,7 +1350,8 @@ static void ipip6_tunnel_setup(struct net_device *dev) · 8 unmodified lines
13511350 int t_hlen = tunnel->hlen + sizeof(struct iphdr);
13521351
13531352 dev->netdev_ops = &ipip6_netdev_ops;
1354− dev->destructor = ipip6_dev_free;
1353+ dev->needs_free_netdev = true;
1354+ dev->priv_destructor = ipip6_dev_free;
13551355
13561356 dev->type = ARPHRD_SIT;
13571357 dev->hard_header_len = LL_MAX_HEADER + t_hlen;
net/irda/irlan/irlan_eth.c+1−1
@@ -65,7 +65,7 @@ static void irlan_eth_setup(struct net_device *dev) · 64 unmodified lines
6565 ether_setup(dev);
6666
6767 dev->netdev_ops = &irlan_eth_netdev_ops;
68− dev->destructor = free_netdev;
68+ dev->needs_free_netdev = true;
6969 dev->min_mtu = 0;
7070 dev->max_mtu = ETH_MAX_MTU;
7171
net/l2tp/l2tp_eth.c+8−7
@@ -114,12 +114,13 @@ static void l2tp_eth_get_stats64(struct net_device *dev, · 113 unmodified lines
114114 {
115115 struct l2tp_eth *priv = netdev_priv(dev);
116116
117− stats->tx_bytes = atomic_long_read(&priv->tx_bytes);
118− stats->tx_packets = atomic_long_read(&priv->tx_packets);
119− stats->tx_dropped = atomic_long_read(&priv->tx_dropped);
120− stats->rx_bytes = atomic_long_read(&priv->rx_bytes);
121− stats->rx_packets = atomic_long_read(&priv->rx_packets);
122− stats->rx_errors = atomic_long_read(&priv->rx_errors);
117+ stats->tx_bytes = (unsigned long) atomic_long_read(&priv->tx_bytes);
118+ stats->tx_packets = (unsigned long) atomic_long_read(&priv->tx_packets);
119+ stats->tx_dropped = (unsigned long) atomic_long_read(&priv->tx_dropped);
120+ stats->rx_bytes = (unsigned long) atomic_long_read(&priv->rx_bytes);
121+ stats->rx_packets = (unsigned long) atomic_long_read(&priv->rx_packets);
122+ stats->rx_errors = (unsigned long) atomic_long_read(&priv->rx_errors);
123+
123124 }
124125
125126 static const struct net_device_ops l2tp_eth_netdev_ops = {
@@ -141,7 +142,7 @@ static void l2tp_eth_dev_setup(struct net_device *dev) · 15 unmodified lines
141142 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
142143 dev->features |= NETIF_F_LLTX;
143144 dev->netdev_ops = &l2tp_eth_netdev_ops;
144− dev->destructor = free_netdev;
145+ dev->needs_free_netdev = true;
145146 }
146147
147148 static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb, int data_len)
net/mac80211/cfg.c+2−0
@@ -902,6 +902,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, · 901 unmodified lines
902902 default:
903903 return -EINVAL;
904904 }
905+ sdata->u.ap.req_smps = sdata->smps_mode;
906+
905907 sdata->needed_rx_chains = sdata->local->rx_chains;
906908
907909 sdata->vif.bss_conf.beacon_int = params->beacon_interval;
net/mac80211/ieee80211_i.h+1−1
@@ -1531,7 +1531,7 @@ ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status) · 1530 unmodified lines
15311531 return true;
15321532 /* can't handle non-legacy preamble yet */
15331533 if (status->flag & RX_FLAG_MACTIME_PLCP_START &&
1534− status->encoding != RX_ENC_LEGACY)
1534+ status->encoding == RX_ENC_LEGACY)
15351535 return true;
15361536 return false;
15371537 }
net/mac80211/iface.c+4−3
@@ -1213,7 +1213,6 @@ static const struct net_device_ops ieee80211_monitorif_ops = { · 1212 unmodified lines
12131213 static void ieee80211_if_free(struct net_device *dev)
12141214 {
12151215 free_percpu(dev->tstats);
1216− free_netdev(dev);
12171216 }
12181217
12191218 static void ieee80211_if_setup(struct net_device *dev)
@@ -1221,7 +1220,8 @@ static void ieee80211_if_setup(struct net_device *dev) · 1 unmodified line
12211220 ether_setup(dev);
12221221 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
12231222 dev->netdev_ops = &ieee80211_dataif_ops;
1224− dev->destructor = ieee80211_if_free;
1223+ dev->needs_free_netdev = true;
1224+ dev->priv_destructor = ieee80211_if_free;
12251225 }
12261226
12271227 static void ieee80211_if_setup_no_queue(struct net_device *dev)
@@ -1816,6 +1816,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, · 588 unmodified lines
18161816 ret = dev_alloc_name(ndev, ndev->name);
18171817 if (ret < 0) {
18181818 ieee80211_if_free(ndev);
1819+ free_netdev(ndev);
18191820 return ret;
18201821 }
18211822
@@ -1905,7 +1906,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, · 83 unmodified lines
19051906
19061907 ret = register_netdevice(ndev);
19071908 if (ret) {
1908− ieee80211_if_free(ndev);
1909+ free_netdev(ndev);
19091910 return ret;
19101911 }
19111912 }
net/mac80211/mlme.c+31−31
@@ -601,7 +601,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 600 unmodified lines
601601 struct ieee80211_supported_band *sband;
602602 struct ieee80211_chanctx_conf *chanctx_conf;
603603 struct ieee80211_channel *chan;
604− u32 rate_flags, rates = 0;
604+ u32 rates = 0;
605605
606606 sdata_assert_lock(sdata);
607607
@@ -612,7 +612,6 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 4 unmodified lines
612612 return;
613613 }
614614 chan = chanctx_conf->def.chan;
615− rate_flags = ieee80211_chandef_rate_flags(&chanctx_conf->def);
616615 rcu_read_unlock();
617616 sband = local->hw.wiphy->bands[chan->band];
618617 shift = ieee80211_vif_get_shift(&sdata->vif);
@@ -636,9 +635,6 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 17 unmodified lines
636635 */
637636 rates_len = 0;
638637 for (i = 0; i < sband->n_bitrates; i++) {
639− if ((rate_flags & sband->bitrates[i].flags)
640− != rate_flags)
641− continue;
642638 rates |= BIT(i);
643639 rates_len++;
644640 }
@@ -2818,7 +2814,7 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband, · 2173 unmodified lines
28182814 u32 *rates, u32 *basic_rates,
28192815 bool *have_higher_than_11mbit,
28202816 int *min_rate, int *min_rate_index,
2821− int shift, u32 rate_flags)
2817+ int shift)
28222818 {
28232819 int i, j;
28242820
@@ -2846,8 +2842,6 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband, · 21 unmodified lines
28462842 int brate;
28472843
28482844 br = &sband->bitrates[j];
2849− if ((rate_flags & br->flags) != rate_flags)
2850− continue;
28512845
28522846 brate = DIV_ROUND_UP(br->bitrate, (1 << shift) * 5);
28532847 if (brate == rate) {
@@ -4398,40 +4392,32 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, · 1544 unmodified lines
43984392 return -ENOMEM;
43994393 }
44004394
4401− if (new_sta || override) {
4402− err = ieee80211_prep_channel(sdata, cbss);
4403− if (err) {
4404− if (new_sta)
4405− sta_info_free(local, new_sta);
4406− return -EINVAL;
4407− }
4408− }
4409−
4395+ /*
4396+ * Set up the information for the new channel before setting the
4397+ * new channel. We can't - completely race-free - change the basic
4398+ * rates bitmap and the channel (sband) that it refers to, but if
4399+ * we set it up before we at least avoid calling into the driver's
4400+ * bss_info_changed() method with invalid information (since we do
4401+ * call that from changing the channel - only for IDLE and perhaps
4402+ * some others, but ...).
4403+ *
4404+ * So to avoid that, just set up all the new information before the
4405+ * channel, but tell the driver to apply it only afterwards, since
4406+ * it might need the new channel for that.
4407+ */
44104408 if (new_sta) {
44114409 u32 rates = 0, basic_rates = 0;
44124410 bool have_higher_than_11mbit;
44134411 int min_rate = INT_MAX, min_rate_index = -1;
4414− struct ieee80211_chanctx_conf *chanctx_conf;
44154412 const struct cfg80211_bss_ies *ies;
44164413 int shift = ieee80211_vif_get_shift(&sdata->vif);
4417− u32 rate_flags;
4418−
4419− rcu_read_lock();
4420− chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
4421− if (WARN_ON(!chanctx_conf)) {
4422− rcu_read_unlock();
4423− sta_info_free(local, new_sta);
4424− return -EINVAL;
4425− }
4426− rate_flags = ieee80211_chandef_rate_flags(&chanctx_conf->def);
4427− rcu_read_unlock();
44284414
44294415 ieee80211_get_rates(sband, bss->supp_rates,
44304416 bss->supp_rates_len,
44314417 &rates, &basic_rates,
44324418 &have_higher_than_11mbit,
44334419 &min_rate, &min_rate_index,
4434− shift, rate_flags);
4420+ shift);
44354421
44364422 /*
44374423 * This used to be a workaround for basic rates missing
@@ -4489,8 +4475,22 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, · 51 unmodified lines
44894475 sdata->vif.bss_conf.sync_dtim_count = 0;
44904476 }
44914477 rcu_read_unlock();
4478+ }
44924479
4493− /* tell driver about BSSID, basic rates and timing */
4480+ if (new_sta || override) {
4481+ err = ieee80211_prep_channel(sdata, cbss);
4482+ if (err) {
4483+ if (new_sta)
4484+ sta_info_free(local, new_sta);
4485+ return -EINVAL;
4486+ }
4487+ }
4488+
4489+ if (new_sta) {
4490+ /*
4491+ * tell driver about BSSID, basic rates and timing
4492+ * this was set up above, before setting the channel
4493+ */
44944494 ieee80211_bss_info_change_notify(sdata,
44954495 BSS_CHANGED_BSSID | BSS_CHANGED_BASIC_RATES |
44964496 BSS_CHANGED_BEACON_INT);
net/mac80211/rx.c+5−1
@@ -1613,12 +1613,16 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) · 1612 unmodified lines
16131613 */
16141614 if (!ieee80211_hw_check(&sta->local->hw, AP_LINK_PS) &&
16151615 !ieee80211_has_morefrags(hdr->frame_control) &&
1616+ !ieee80211_is_back_req(hdr->frame_control) &&
16161617 !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) &&
16171618 (rx->sdata->vif.type == NL80211_IFTYPE_AP ||
16181619 rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN) &&
1619− /* PM bit is only checked in frames where it isn't reserved,
1620+ /*
1621+ * PM bit is only checked in frames where it isn't reserved,
16201622 * in AP mode it's reserved in non-bufferable management frames
16211623 * (cf. IEEE 802.11-2012 8.2.4.1.7 Power Management field)
1624+ * BAR frames should be ignored as specified in
1625+ * IEEE 802.11-2012 10.2.1.2.
16221626 */
16231627 (!ieee80211_is_mgmt(hdr->frame_control) ||
16241628 ieee80211_is_bufferable_mmpdu(hdr->frame_control))) {
net/mac80211/wpa.c+5−4
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <asm/unaligned.h>
1818 #include <net/mac80211.h>
1919 #include <crypto/aes.h>
20+#include <crypto/algapi.h>
2021
2122 #include "ieee80211_i.h"
2223 #include "michael.h"
@@ -153,7 +154,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) · 130 unmodified lines
153154 data_len = skb->len - hdrlen - MICHAEL_MIC_LEN;
154155 key = &rx->key->conf.key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY];
155156 michael_mic(key, hdr, data, data_len, mic);
156− if (memcmp(mic, data + data_len, MICHAEL_MIC_LEN) != 0)
157+ if (crypto_memneq(mic, data + data_len, MICHAEL_MIC_LEN))
157158 goto mic_fail;
158159
159160 /* remove Michael MIC from payload */
@@ -1048,7 +1049,7 @@ ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx) · 888 unmodified lines
10481049 bip_aad(skb, aad);
10491050 ieee80211_aes_cmac(key->u.aes_cmac.tfm, aad,
10501051 skb->data + 24, skb->len - 24, mic);
1051− if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
1052+ if (crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) {
10521053 key->u.aes_cmac.icverrors++;
10531054 return RX_DROP_UNUSABLE;
10541055 }
@@ -1098,7 +1099,7 @@ ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx) · 43 unmodified lines
10981099 bip_aad(skb, aad);
10991100 ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad,
11001101 skb->data + 24, skb->len - 24, mic);
1101− if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
1102+ if (crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) {
11021103 key->u.aes_cmac.icverrors++;
11031104 return RX_DROP_UNUSABLE;
11041105 }
@@ -1202,7 +1203,7 @@ ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx) · 97 unmodified lines
12021203 if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
12031204 skb->data + 24, skb->len - 24,
12041205 mic) < 0 ||
1205− memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
1206+ crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) {
12061207 key->u.aes_gmac.icverrors++;
12071208 return RX_DROP_UNUSABLE;
12081209 }
net/mac802154/iface.c+3−4
@@ -526,8 +526,6 @@ static void mac802154_wpan_free(struct net_device *dev) · 525 unmodified lines
526526 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
527527
528528 mac802154_llsec_destroy(&sdata->sec);
529−
530− free_netdev(dev);
531529 }
532530
533531 static void ieee802154_if_setup(struct net_device *dev)
@@ -593,7 +591,8 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, · 59 unmodified lines
593591 sdata->dev->dev_addr);
594592
595593 sdata->dev->header_ops = &mac802154_header_ops;
596− sdata->dev->destructor = mac802154_wpan_free;
594+ sdata->dev->needs_free_netdev = true;
595+ sdata->dev->priv_destructor = mac802154_wpan_free;
597596 sdata->dev->netdev_ops = &mac802154_wpan_ops;
598597 sdata->dev->ml_priv = &mac802154_mlme_wpan;
599598 wpan_dev->promiscuous_mode = false;
@@ -608,7 +607,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, · 8 unmodified lines
608607
609608 break;
610609 case NL802154_IFTYPE_MONITOR:
611− sdata->dev->destructor = free_netdev;
610+ sdata->dev->needs_free_netdev = true;
612611 sdata->dev->netdev_ops = &mac802154_monitor_ops;
613612 wpan_dev->promiscuous_mode = true;
614613 break;
net/openvswitch/vport-internal_dev.c+2−2
@@ -94,7 +94,6 @@ static void internal_dev_destructor(struct net_device *dev) · 93 unmodified lines
9494 struct vport *vport = ovs_internal_dev_get_vport(dev);
9595
9696 ovs_vport_free(vport);
97− free_netdev(dev);
9897 }
9998
10099 static void
@@ -156,7 +155,8 @@ static void do_setup(struct net_device *netdev) · 55 unmodified lines
156155 netdev->priv_flags &= ~IFF_TX_SKB_SHARING;
157156 netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH |
158157 IFF_PHONY_HEADROOM | IFF_NO_QUEUE;
159− netdev->destructor = internal_dev_destructor;
158+ netdev->needs_free_netdev = true;
159+ netdev->priv_destructor = internal_dev_destructor;
160160 netdev->ethtool_ops = &internal_dev_ethtool_ops;
161161 netdev->rtnl_link_ops = &internal_dev_link_ops;
162162
net/phonet/pep-gprs.c+1−1
@@ -236,7 +236,7 @@ static void gprs_setup(struct net_device *dev) · 235 unmodified lines
236236 dev->tx_queue_len = 10;
237237
238238 dev->netdev_ops = &gprs_netdev_ops;
239− dev->destructor = free_netdev;
239+ dev->needs_free_netdev = true;
240240 }
241241
242242 /*
net/rxrpc/key.c+34−30
@@ -217,7 +217,7 @@ static int rxrpc_krb5_decode_principal(struct krb5_principal *princ, · 216 unmodified lines
217217 unsigned int *_toklen)
218218 {
219219 const __be32 *xdr = *_xdr;
220− unsigned int toklen = *_toklen, n_parts, loop, tmp;
220+ unsigned int toklen = *_toklen, n_parts, loop, tmp, paddedlen;
221221
222222 /* there must be at least one name, and at least #names+1 length
223223 * words */
@@ -247,16 +247,16 @@ static int rxrpc_krb5_decode_principal(struct krb5_principal *princ, · 23 unmodified lines
247247 toklen -= 4;
248248 if (tmp <= 0 || tmp > AFSTOKEN_STRING_MAX)
249249 return -EINVAL;
250− if (tmp > toklen)
250+ paddedlen = (tmp + 3) & ~3;
251+ if (paddedlen > toklen)
251252 return -EINVAL;
252253 princ->name_parts[loop] = kmalloc(tmp + 1, GFP_KERNEL);
253254 if (!princ->name_parts[loop])
254255 return -ENOMEM;
255256 memcpy(princ->name_parts[loop], xdr, tmp);
256257 princ->name_parts[loop][tmp] = 0;
257− tmp = (tmp + 3) & ~3;
258− toklen -= tmp;
259− xdr += tmp >> 2;
258+ toklen -= paddedlen;
259+ xdr += paddedlen >> 2;
260260 }
261261
262262 if (toklen < 4)
@@ -265,16 +265,16 @@ static int rxrpc_krb5_decode_principal(struct krb5_principal *princ, · 2 unmodified lines
265265 toklen -= 4;
266266 if (tmp <= 0 || tmp > AFSTOKEN_K5_REALM_MAX)
267267 return -EINVAL;
268− if (tmp > toklen)
268+ paddedlen = (tmp + 3) & ~3;
269+ if (paddedlen > toklen)
269270 return -EINVAL;
270271 princ->realm = kmalloc(tmp + 1, GFP_KERNEL);
271272 if (!princ->realm)
272273 return -ENOMEM;
273274 memcpy(princ->realm, xdr, tmp);
274275 princ->realm[tmp] = 0;
275− tmp = (tmp + 3) & ~3;
276− toklen -= tmp;
277− xdr += tmp >> 2;
276+ toklen -= paddedlen;
277+ xdr += paddedlen >> 2;
278278
279279 _debug("%s/...@%s", princ->name_parts[0], princ->realm);
280280
@@ -293,7 +293,7 @@ static int rxrpc_krb5_decode_tagged_data(struct krb5_tagged_data *td, · 12 unmodified lines
293293 unsigned int *_toklen)
294294 {
295295 const __be32 *xdr = *_xdr;
296− unsigned int toklen = *_toklen, len;
296+ unsigned int toklen = *_toklen, len, paddedlen;
297297
298298 /* there must be at least one tag and one length word */
299299 if (toklen <= 8)
@@ -307,15 +307,17 @@ static int rxrpc_krb5_decode_tagged_data(struct krb5_tagged_data *td, · 7 unmodified lines
307307 toklen -= 8;
308308 if (len > max_data_size)
309309 return -EINVAL;
310+ paddedlen = (len + 3) & ~3;
311+ if (paddedlen > toklen)
312+ return -EINVAL;
310313 td->data_len = len;
311314
312315 if (len > 0) {
313316 td->data = kmemdup(xdr, len, GFP_KERNEL);
314317 if (!td->data)
315318 return -ENOMEM;
316− len = (len + 3) & ~3;
317− toklen -= len;
318− xdr += len >> 2;
319+ toklen -= paddedlen;
320+ xdr += paddedlen >> 2;
319321 }
320322
321323 _debug("tag %x len %x", td->tag, td->data_len);
@@ -387,7 +389,7 @@ static int rxrpc_krb5_decode_ticket(u8 **_ticket, u16 *_tktlen, · 65 unmodified lines
387389 const __be32 **_xdr, unsigned int *_toklen)
388390 {
389391 const __be32 *xdr = *_xdr;
390− unsigned int toklen = *_toklen, len;
392+ unsigned int toklen = *_toklen, len, paddedlen;
391393
392394 /* there must be at least one length word */
393395 if (toklen <= 4)
@@ -399,6 +401,9 @@ static int rxrpc_krb5_decode_ticket(u8 **_ticket, u16 *_tktlen, · 5 unmodified lines
399401 toklen -= 4;
400402 if (len > AFSTOKEN_K5_TIX_MAX)
401403 return -EINVAL;
404+ paddedlen = (len + 3) & ~3;
405+ if (paddedlen > toklen)
406+ return -EINVAL;
402407 *_tktlen = len;
403408
404409 _debug("ticket len %u", len);
@@ -407,9 +412,8 @@ static int rxrpc_krb5_decode_ticket(u8 **_ticket, u16 *_tktlen, · 2 unmodified lines
407412 *_ticket = kmemdup(xdr, len, GFP_KERNEL);
408413 if (!*_ticket)
409414 return -ENOMEM;
410− len = (len + 3) & ~3;
411− toklen -= len;
412− xdr += len >> 2;
415+ toklen -= paddedlen;
416+ xdr += paddedlen >> 2;
413417 }
414418
415419 *_xdr = xdr;
@@ -552,7 +556,7 @@ static int rxrpc_preparse_xdr(struct key_preparsed_payload *prep) · 136 unmodified lines
552556 {
553557 const __be32 *xdr = prep->data, *token;
554558 const char *cp;
555− unsigned int len, tmp, loop, ntoken, toklen, sec_ix;
559+ unsigned int len, paddedlen, loop, ntoken, toklen, sec_ix;
556560 size_t datalen = prep->datalen;
557561 int ret;
558562
@@ -578,22 +582,21 @@ static int rxrpc_preparse_xdr(struct key_preparsed_payload *prep) · 19 unmodified lines
578582 if (len < 1 || len > AFSTOKEN_CELL_MAX)
579583 goto not_xdr;
580584 datalen -= 4;
581− tmp = (len + 3) & ~3;
582− if (tmp > datalen)
585+ paddedlen = (len + 3) & ~3;
586+ if (paddedlen > datalen)
583587 goto not_xdr;
584588
585589 cp = (const char *) xdr;
586590 for (loop = 0; loop < len; loop++)
587591 if (!isprint(cp[loop]))
588592 goto not_xdr;
589− if (len < tmp)
590− for (; loop < tmp; loop++)
591− if (cp[loop])
592− goto not_xdr;
593+ for (; loop < paddedlen; loop++)
594+ if (cp[loop])
595+ goto not_xdr;
593596 _debug("cellname: [%u/%u] '%*.*s'",
594− len, tmp, len, len, (const char *) xdr);
595− datalen -= tmp;
596− xdr += tmp >> 2;
597+ len, paddedlen, len, len, (const char *) xdr);
598+ datalen -= paddedlen;
599+ xdr += paddedlen >> 2;
597600
598601 /* get the token count */
599602 if (datalen < 12)
@@ -614,10 +617,11 @@ static int rxrpc_preparse_xdr(struct key_preparsed_payload *prep) · 14 unmodified lines
614617 sec_ix = ntohl(*xdr);
615618 datalen -= 4;
616619 _debug("token: [%x/%zx] %x", toklen, datalen, sec_ix);
617− if (toklen < 20 || toklen > datalen)
620+ paddedlen = (toklen + 3) & ~3;
621+ if (toklen < 20 || toklen > datalen || paddedlen > datalen)
618622 goto not_xdr;
619− datalen -= (toklen + 3) & ~3;
620− xdr += (toklen + 3) >> 2;
623+ datalen -= paddedlen;
624+ xdr += paddedlen >> 2;
621625
622626 } while (--loop > 0);
623627
net/sched/act_pedit.c+3−1
@@ -94,8 +94,10 @@ static struct tcf_pedit_key_ex *tcf_pedit_keys_ex_parse(struct nlattr *nla, · 93 unmodified lines
9494 k++;
9595 }
9696
97− if (n)
97+ if (n) {
98+ err = -EINVAL;
9899 goto err_out;
100+ }
99101
100102 return keys_ex;
101103
net/sched/act_police.c+3−5
@@ -132,21 +132,21 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla, · 131 unmodified lines
132132 }
133133 }
134134
135− spin_lock_bh(&police->tcf_lock);
136135 if (est) {
137136 err = gen_replace_estimator(&police->tcf_bstats, NULL,
138137 &police->tcf_rate_est,
139138 &police->tcf_lock,
140139 NULL, est);
141140 if (err)
142− goto failure_unlock;
141+ goto failure;
143142 } else if (tb[TCA_POLICE_AVRATE] &&
144143 (ret == ACT_P_CREATED ||
145144 !gen_estimator_active(&police->tcf_rate_est))) {
146145 err = -EINVAL;
147− goto failure_unlock;
146+ goto failure;
148147 }
149148
149+ spin_lock_bh(&police->tcf_lock);
150150 /* No failure allowed after this point */
151151 police->tcfp_mtu = parm->mtu;
152152 if (police->tcfp_mtu == 0) {
@@ -192,8 +192,6 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla, · 39 unmodified lines
192192
193193 return ret;
194194
195−failure_unlock:
196− spin_unlock_bh(&police->tcf_lock);
197195 failure:
198196 qdisc_put_rtab(P_tab);
199197 qdisc_put_rtab(R_tab);
net/sctp/endpointola.c+1−0
@@ -275,6 +275,7 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep) · 274 unmodified lines
275275 if (sctp_sk(sk)->bind_hash)
276276 sctp_put_port(sk);
277277
278+ sctp_sk(sk)->ep = NULL;
278279 sock_put(sk);
279280 }
280281
net/sctp/sctp_diag.c+3−2
@@ -278,7 +278,6 @@ out: · 277 unmodified lines
278278
279279 static int sctp_sock_dump(struct sock *sk, void *p)
280280 {
281− struct sctp_endpoint *ep = sctp_sk(sk)->ep;
282281 struct sctp_comm_param *commp = p;
283282 struct sk_buff *skb = commp->skb;
284283 struct netlink_callback *cb = commp->cb;
@@ -287,7 +286,9 @@ static int sctp_sock_dump(struct sock *sk, void *p) · 2 unmodified lines
287286 int err = 0;
288287
289288 lock_sock(sk);
290− list_for_each_entry(assoc, &ep->asocs, asocs) {
289+ if (!sctp_sk(sk)->ep)
290+ goto release;
291+ list_for_each_entry(assoc, &sctp_sk(sk)->ep->asocs, asocs) {
291292 if (cb->args[4] < cb->args[1])
292293 goto next;
293294
net/sctp/socket.c+4−5
@@ -4622,13 +4622,13 @@ int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *), · 4621 unmodified lines
46224622
46234623 for (head = sctp_ep_hashtable; hash < sctp_ep_hashsize;
46244624 hash++, head++) {
4625− read_lock(&head->lock);
4625+ read_lock_bh(&head->lock);
46264626 sctp_for_each_hentry(epb, &head->chain) {
46274627 err = cb(sctp_ep(epb), p);
46284628 if (err)
46294629 break;
46304630 }
4631− read_unlock(&head->lock);
4631+ read_unlock_bh(&head->lock);
46324632 }
46334633
46344634 return err;
@@ -4666,9 +4666,8 @@ int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *), · 31 unmodified lines
46664666 if (err)
46674667 return err;
46684668
4669− sctp_transport_get_idx(net, &hti, pos);
4670− obj = sctp_transport_get_next(net, &hti);
4671− for (; obj && !IS_ERR(obj); obj = sctp_transport_get_next(net, &hti)) {
4669+ obj = sctp_transport_get_idx(net, &hti, pos + 1);
4670+ for (; !IS_ERR_OR_NULL(obj); obj = sctp_transport_get_next(net, &hti)) {
46724671 struct sctp_transport *transport = obj;
46734672
46744673 if (!sctp_transport_hold(transport))
net/tipc/msg.c+1−1
@@ -508,7 +508,7 @@ bool tipc_msg_reverse(u32 own_node, struct sk_buff **skb, int err) · 507 unmodified lines
508508 }
509509
510510 if (skb_cloned(_skb) &&
511− pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, GFP_KERNEL))
511+ pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, GFP_ATOMIC))
512512 goto exit;
513513
514514 /* Now reverse the concerned fields */
net/unix/af_unix.c+6−1
@@ -999,7 +999,8 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) · 998 unmodified lines
999999 struct path path = { };
10001000
10011001 err = -EINVAL;
1002− if (sunaddr->sun_family != AF_UNIX)
1002+ if (addr_len < offsetofend(struct sockaddr_un, sun_family) ||
1003+ sunaddr->sun_family != AF_UNIX)
10031004 goto out;
10041005
10051006 if (addr_len == sizeof(short)) {
@@ -1110,6 +1111,10 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, · 104 unmodified lines
11101111 unsigned int hash;
11111112 int err;
11121113
1114+ err = -EINVAL;
1115+ if (alen < offsetofend(struct sockaddr, sa_family))
1116+ goto out;
1117+
11131118 if (addr->sa_family != AF_UNSPEC) {
11141119 err = unix_mkname(sunaddr, alen, &hash);
11151120 if (err < 0)
net/wireless/wext-core.c+9−13
@@ -914,13 +914,12 @@ int call_commit_handler(struct net_device *dev) · 913 unmodified lines
914914 * Main IOCTl dispatcher.
915915 * Check the type of IOCTL and call the appropriate wrapper...
916916 */
917−static int wireless_process_ioctl(struct net *net, struct ifreq *ifr,
917+static int wireless_process_ioctl(struct net *net, struct iwreq *iwr,
918918 unsigned int cmd,
919919 struct iw_request_info *info,
920920 wext_ioctl_func standard,
921921 wext_ioctl_func private)
922922 {
923− struct iwreq *iwr = (struct iwreq *) ifr;
924923 struct net_device *dev;
925924 iw_handler handler;
926925
@@ -928,7 +927,7 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, · 1 unmodified line
928927 * The copy_to/from_user() of ifr is also dealt with in there */
929928
930929 /* Make sure the device exist */
931− if ((dev = __dev_get_by_name(net, ifr->ifr_name)) == NULL)
930+ if ((dev = __dev_get_by_name(net, iwr->ifr_name)) == NULL)
932931 return -ENODEV;
933932
934933 /* A bunch of special cases, then the generic case...
@@ -957,9 +956,6 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, · 22 unmodified lines
957956 else if (private)
958957 return private(dev, iwr, cmd, info, handler);
959958 }
960− /* Old driver API : call driver ioctl handler */
961− if (dev->netdev_ops->ndo_do_ioctl)
962− return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);
963959 return -EOPNOTSUPP;
964960 }
965961
@@ -977,7 +973,7 @@ static int wext_permission_check(unsigned int cmd) · 11 unmodified lines
977973 }
978974
979975 /* entry point from dev ioctl */
980−static int wext_ioctl_dispatch(struct net *net, struct ifreq *ifr,
976+static int wext_ioctl_dispatch(struct net *net, struct iwreq *iwr,
981977 unsigned int cmd, struct iw_request_info *info,
982978 wext_ioctl_func standard,
983979 wext_ioctl_func private)
@@ -987,9 +983,9 @@ static int wext_ioctl_dispatch(struct net *net, struct ifreq *ifr, · 3 unmodified lines
987983 if (ret)
988984 return ret;
989985
990− dev_load(net, ifr->ifr_name);
986+ dev_load(net, iwr->ifr_name);
991987 rtnl_lock();
992− ret = wireless_process_ioctl(net, ifr, cmd, info, standard, private);
988+ ret = wireless_process_ioctl(net, iwr, cmd, info, standard, private);
993989 rtnl_unlock();
994990
995991 return ret;
@@ -1039,18 +1035,18 @@ static int ioctl_standard_call(struct net_device * dev, · 43 unmodified lines
10391035 }
10401036
10411037
1042−int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
1038+int wext_handle_ioctl(struct net *net, struct iwreq *iwr, unsigned int cmd,
10431039 void __user *arg)
10441040 {
10451041 struct iw_request_info info = { .cmd = cmd, .flags = 0 };
10461042 int ret;
10471043
1048− ret = wext_ioctl_dispatch(net, ifr, cmd, &info,
1044+ ret = wext_ioctl_dispatch(net, iwr, cmd, &info,
10491045 ioctl_standard_call,
10501046 ioctl_private_call);
10511047 if (ret >= 0 &&
10521048 IW_IS_GET(cmd) &&
1053− copy_to_user(arg, ifr, sizeof(struct iwreq)))
1049+ copy_to_user(arg, iwr, sizeof(struct iwreq)))
10541050 return -EFAULT;
10551051
10561052 return ret;
@@ -1107,7 +1103,7 @@ int compat_wext_handle_ioctl(struct net *net, unsigned int cmd, · 50 unmodified lines
11071103 info.cmd = cmd;
11081104 info.flags = IW_REQUEST_FLAG_COMPAT;
11091105
1110− ret = wext_ioctl_dispatch(net, (struct ifreq *) &iwr, cmd, &info,
1106+ ret = wext_ioctl_dispatch(net, &iwr, cmd, &info,
11111107 compat_standard_call,
11121108 compat_private_call);
11131109
scripts/Makefile.headersinst+9−1
@@ -14,7 +14,15 @@ __headers: · 13 unmodified lines
1414 include scripts/Kbuild.include
1515
1616 srcdir := $(srctree)/$(obj)
17−subdirs := $(patsubst $(srcdir)/%/.,%,$(wildcard $(srcdir)/*/.))
17+
18+# When make is run under a fakechroot environment, the function
19+# $(wildcard $(srcdir)/*/.) doesn't only return directories, but also regular
20+# files. So, we are using a combination of sort/dir/wildcard which works
21+# with fakechroot.
22+subdirs := $(patsubst $(srcdir)/%/,%,\
23+ $(filter-out $(srcdir)/,\
24+ $(sort $(dir $(wildcard $(srcdir)/*/)))))
25+
1826 # caller may set destination dir (when installing to asm/)
1927 _dst := $(if $(dst),$(dst),$(obj))
2028
scripts/genksyms/genksyms.h+1−1
@@ -75,7 +75,7 @@ struct string_list *copy_list_range(struct string_list *start, · 74 unmodified lines
7575 int yylex(void);
7676 int yyparse(void);
7777
78−void error_with_pos(const char *, ...);
78+void error_with_pos(const char *, ...) __attribute__ ((format(printf, 1, 2)));
7979
8080 /*----------------------------------------------------------------------*/
8181 #define xmalloc(size) ({ void *__ptr = malloc(size); \
scripts/kconfig/Makefile+1−1
@@ -196,7 +196,7 @@ clean-files += config.pot linux.pot · 195 unmodified lines
196196
197197 # Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
198198 PHONY += $(obj)/dochecklxdialog
199−$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog
199+$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/dochecklxdialog
200200 $(obj)/dochecklxdialog:
201201 $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf)
202202
scripts/kconfig/nconf.c+6−6
@@ -271,7 +271,7 @@ static struct mitem k_menu_items[MAX_MENU_ITEMS]; · 270 unmodified lines
271271 static int items_num;
272272 static int global_exit;
273273 /* the currently selected button */
274−const char *current_instructions = menu_instructions;
274+static const char *current_instructions = menu_instructions;
275275
276276 static char *dialog_input_result;
277277 static int dialog_input_result_len;
@@ -305,7 +305,7 @@ struct function_keys { · 27 unmodified lines
305305 };
306306
307307 static const int function_keys_num = 9;
308−struct function_keys function_keys[] = {
308+static struct function_keys function_keys[] = {
309309 {
310310 .key_str = "F1",
311311 .func = "Help",
@@ -508,7 +508,7 @@ static int get_mext_match(const char *match_str, match_f flag) · 196 unmodified lines
508508 index = (index + items_num) % items_num;
509509 while (true) {
510510 char *str = k_menu_items[index].str;
511− if (strcasestr(str, match_str) != 0)
511+ if (strcasestr(str, match_str) != NULL)
512512 return index;
513513 if (flag == FIND_NEXT_MATCH_UP ||
514514 flag == MATCH_TINKER_PATTERN_UP)
@@ -1067,7 +1067,7 @@ static int do_match(int key, struct match_state *state, int *ans) · 552 unmodified lines
10671067
10681068 static void conf(struct menu *menu)
10691069 {
1070− struct menu *submenu = 0;
1070+ struct menu *submenu = NULL;
10711071 const char *prompt = menu_get_prompt(menu);
10721072 struct symbol *sym;
10731073 int res;
@@ -1234,7 +1234,7 @@ static void show_help(struct menu *menu) · 160 unmodified lines
12341234 static void conf_choice(struct menu *menu)
12351235 {
12361236 const char *prompt = _(menu_get_prompt(menu));
1237− struct menu *child = 0;
1237+ struct menu *child = NULL;
12381238 struct symbol *active;
12391239 int selected_index = 0;
12401240 int last_top_row = 0;
@@ -1456,7 +1456,7 @@ static void conf_save(void) · 215 unmodified lines
14561456 }
14571457 }
14581458
1459−void setup_windows(void)
1459+static void setup_windows(void)
14601460 {
14611461 int lines, columns;
14621462
scripts/kconfig/nconf.gui.c+2−2
@@ -129,7 +129,7 @@ static void no_colors_theme(void) · 128 unmodified lines
129129 mkattrn(FUNCTION_TEXT, A_REVERSE);
130130 }
131131
132−void set_colors()
132+void set_colors(void)
133133 {
134134 start_color();
135135 use_default_colors();
@@ -192,7 +192,7 @@ const char *get_line(const char *text, int line_no) · 56 unmodified lines
192192 int lines = 0;
193193
194194 if (!text)
195− return 0;
195+ return NULL;
196196
197197 for (i = 0; text[i] != '\0' && lines < line_no; i++)
198198 if (text[i] == '\n')
scripts/tags.sh+1−0
@@ -106,6 +106,7 @@ all_compiled_sources() · 105 unmodified lines
106106 case "$i" in
107107 *.[cS])
108108 j=${i/\.[cS]/\.o}
109+ j="${j#$tree}"
109110 if [ -e $j ]; then
110111 echo $i
111112 fi
security/selinux/hooks.c+2−3
@@ -1106,10 +1106,8 @@ static int selinux_parse_opts_str(char *options, · 1105 unmodified lines
11061106
11071107 opts->mnt_opts_flags = kcalloc(NUM_SEL_MNT_OPTS, sizeof(int),
11081108 GFP_KERNEL);
1109− if (!opts->mnt_opts_flags) {
1110− kfree(opts->mnt_opts);
1109+ if (!opts->mnt_opts_flags)
11111110 goto out_err;
1112− }
11131111
11141112 if (fscontext) {
11151113 opts->mnt_opts[num_mnt_opts] = fscontext;
@@ -1132,6 +1130,7 @@ static int selinux_parse_opts_str(char *options, · 16 unmodified lines
11321130 return 0;
11331131
11341132 out_err:
1133+ security_free_mnt_opts(opts);
11351134 kfree(context);
11361135 kfree(defcontext);
11371136 kfree(fscontext);
sound/core/pcm_lib.c+2−2
@@ -2492,7 +2492,7 @@ static int pcm_chmap_ctl_get(struct snd_kcontrol *kcontrol, · 2491 unmodified lines
24922492 struct snd_pcm_substream *substream;
24932493 const struct snd_pcm_chmap_elem *map;
24942494
2495− if (snd_BUG_ON(!info->chmap))
2495+ if (!info->chmap)
24962496 return -EINVAL;
24972497 substream = snd_pcm_chmap_substream(info, idx);
24982498 if (!substream)
@@ -2524,7 +2524,7 @@ static int pcm_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, · 25 unmodified lines
25242524 unsigned int __user *dst;
25252525 int c, count = 0;
25262526
2527− if (snd_BUG_ON(!info->chmap))
2527+ if (!info->chmap)
25282528 return -EINVAL;
25292529 if (size < 8)
25302530 return -ENOMEM;
sound/firewire/amdtp-stream.c+6−2
@@ -682,7 +682,9 @@ static void out_stream_callback(struct fw_iso_context *context, u32 tstamp, · 681 unmodified lines
682682 cycle = increment_cycle_count(cycle, 1);
683683 if (s->handle_packet(s, 0, cycle, i) < 0) {
684684 s->packet_index = -1;
685− amdtp_stream_pcm_abort(s);
685+ if (in_interrupt())
686+ amdtp_stream_pcm_abort(s);
687+ WRITE_ONCE(s->pcm_buffer_pointer, SNDRV_PCM_POS_XRUN);
686688 return;
687689 }
688690 }
@@ -734,7 +736,9 @@ static void in_stream_callback(struct fw_iso_context *context, u32 tstamp, · 45 unmodified lines
734736 /* Queueing error or detecting invalid payload. */
735737 if (i < packets) {
736738 s->packet_index = -1;
737− amdtp_stream_pcm_abort(s);
739+ if (in_interrupt())
740+ amdtp_stream_pcm_abort(s);
741+ WRITE_ONCE(s->pcm_buffer_pointer, SNDRV_PCM_POS_XRUN);
738742 return;
739743 }
740744
sound/firewire/amdtp-stream.h+1−1
@@ -135,7 +135,7 @@ struct amdtp_stream { · 134 unmodified lines
135135 /* For a PCM substream processing. */
136136 struct snd_pcm_substream *pcm;
137137 struct tasklet_struct period_tasklet;
138− unsigned int pcm_buffer_pointer;
138+ snd_pcm_uframes_t pcm_buffer_pointer;
139139 unsigned int pcm_period_pointer;
140140
141141 /* To wait for first packet. */
sound/pci/hda/hda_intel.c+8−3
@@ -370,10 +370,12 @@ enum { · 369 unmodified lines
370370 #define IS_KBL_LP(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9d71)
371371 #define IS_KBL_H(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa2f0)
372372 #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
373+#define IS_BXT_T(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x1a98)
373374 #define IS_GLK(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x3198)
374−#define IS_SKL_PLUS(pci) (IS_SKL(pci) || IS_SKL_LP(pci) || IS_BXT(pci)) || \
375− IS_KBL(pci) || IS_KBL_LP(pci) || IS_KBL_H(pci) || \
376− IS_GLK(pci)
375+#define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348)
376+#define IS_SKL_PLUS(pci) (IS_SKL(pci) || IS_SKL_LP(pci) || IS_BXT(pci) || \
377+ IS_BXT_T(pci) || IS_KBL(pci) || IS_KBL_LP(pci) || \
378+ IS_KBL_H(pci) || IS_GLK(pci) || IS_CFL(pci))
377379
378380 static char *driver_short_names[] = {
379381 [AZX_DRIVER_ICH] = "HDA Intel",
@@ -2378,6 +2380,9 @@ static const struct pci_device_id azx_ids[] = { · 1998 unmodified lines
23782380 /* Kabylake-H */
23792381 { PCI_DEVICE(0x8086, 0xa2f0),
23802382 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE },
2383+ /* Coffelake */
2384+ { PCI_DEVICE(0x8086, 0xa348),
2385+ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE},
23812386 /* Broxton-P(Apollolake) */
23822387 { PCI_DEVICE(0x8086, 0x5a98),
23832388 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_BROXTON },
tools/objtool/builtin-check.c+2−1
@@ -192,7 +192,8 @@ static int __dead_end_function(struct objtool_file *file, struct symbol *func, · 191 unmodified lines
192192 "complete_and_exit",
193193 "kvm_spurious_fault",
194194 "__reiserfs_panic",
195− "lbug_with_loc"
195+ "lbug_with_loc",
196+ "fortify_panic",
196197 };
197198
198199 if (func->bind == STB_WEAK)
tools/perf/Makefile.config+19−19
@@ -19,18 +19,18 @@ CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS) · 18 unmodified lines
1919
2020 include $(srctree)/tools/scripts/Makefile.arch
2121
22−$(call detected_var,ARCH)
22+$(call detected_var,SRCARCH)
2323
2424 NO_PERF_REGS := 1
2525
2626 # Additional ARCH settings for ppc
27−ifeq ($(ARCH),powerpc)
27+ifeq ($(SRCARCH),powerpc)
2828 NO_PERF_REGS := 0
2929 LIBUNWIND_LIBS := -lunwind -lunwind-ppc64
3030 endif
3131
3232 # Additional ARCH settings for x86
33−ifeq ($(ARCH),x86)
33+ifeq ($(SRCARCH),x86)
3434 $(call detected,CONFIG_X86)
3535 ifeq (${IS_64_BIT}, 1)
3636 CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -DHAVE_SYSCALL_TABLE -I$(OUTPUT)arch/x86/include/generated
@@ -43,12 +43,12 @@ ifeq ($(ARCH),x86) · 6 unmodified lines
4343 NO_PERF_REGS := 0
4444 endif
4545
46−ifeq ($(ARCH),arm)
46+ifeq ($(SRCARCH),arm)
4747 NO_PERF_REGS := 0
4848 LIBUNWIND_LIBS = -lunwind -lunwind-arm
4949 endif
5050
51−ifeq ($(ARCH),arm64)
51+ifeq ($(SRCARCH),arm64)
5252 NO_PERF_REGS := 0
5353 LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
5454 endif
@@ -61,7 +61,7 @@ endif · 6 unmodified lines
6161 # Disable it on all other architectures in case libdw unwind
6262 # support is detected in system. Add supported architectures
6363 # to the check.
64−ifneq ($(ARCH),$(filter $(ARCH),x86 arm))
64+ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm))
6565 NO_LIBDW_DWARF_UNWIND := 1
6666 endif
6767
@@ -115,9 +115,9 @@ endif · 47 unmodified lines
115115 FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS)
116116 FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf
117117
118−FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi
118+FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi
119119 # include ARCH specific config
120−-include $(src-perf)/arch/$(ARCH)/Makefile
120+-include $(src-perf)/arch/$(SRCARCH)/Makefile
121121
122122 ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
123123 CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
@@ -228,12 +228,12 @@ ifeq ($(DEBUG),0) · 104 unmodified lines
228228 endif
229229
230230 INC_FLAGS += -I$(src-perf)/util/include
231−INC_FLAGS += -I$(src-perf)/arch/$(ARCH)/include
231+INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include
232232 INC_FLAGS += -I$(srctree)/tools/include/uapi
233233 INC_FLAGS += -I$(srctree)/tools/include/
234−INC_FLAGS += -I$(srctree)/tools/arch/$(ARCH)/include/uapi
235−INC_FLAGS += -I$(srctree)/tools/arch/$(ARCH)/include/
236−INC_FLAGS += -I$(srctree)/tools/arch/$(ARCH)/
234+INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi
235+INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/
236+INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/
237237
238238 # $(obj-perf) for generated common-cmds.h
239239 # $(obj-perf)/util for generated bison/flex headers
@@ -355,7 +355,7 @@ ifndef NO_LIBELF · 115 unmodified lines
355355
356356 ifndef NO_DWARF
357357 ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
358− msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
358+ msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled);
359359 NO_DWARF := 1
360360 else
361361 CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
@@ -380,7 +380,7 @@ ifndef NO_LIBELF · 18 unmodified lines
380380 CFLAGS += -DHAVE_BPF_PROLOGUE
381381 $(call detected,CONFIG_BPF_PROLOGUE)
382382 else
383− msg := $(warning BPF prologue is not supported by architecture $(ARCH), missing regs_query_register_offset());
383+ msg := $(warning BPF prologue is not supported by architecture $(SRCARCH), missing regs_query_register_offset());
384384 endif
385385 else
386386 msg := $(warning DWARF support is off, BPF prologue is disabled);
@@ -406,7 +406,7 @@ ifdef PERF_HAVE_JITDUMP · 19 unmodified lines
406406 endif
407407 endif
408408
409−ifeq ($(ARCH),powerpc)
409+ifeq ($(SRCARCH),powerpc)
410410 ifndef NO_DWARF
411411 CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
412412 endif
@@ -487,7 +487,7 @@ else · 74 unmodified lines
487487 endif
488488
489489 ifndef NO_LOCAL_LIBUNWIND
490− ifeq ($(ARCH),$(filter $(ARCH),arm arm64))
490+ ifeq ($(SRCARCH),$(filter $(SRCARCH),arm arm64))
491491 $(call feature_check,libunwind-debug-frame)
492492 ifneq ($(feature-libunwind-debug-frame), 1)
493493 msg := $(warning No debug_frame support found in libunwind);
@@ -740,7 +740,7 @@ ifeq (${IS_64_BIT}, 1) · 246 unmodified lines
740740 NO_PERF_READ_VDSO32 := 1
741741 endif
742742 endif
743− ifneq ($(ARCH), x86)
743+ ifneq ($(SRCARCH), x86)
744744 NO_PERF_READ_VDSOX32 := 1
745745 endif
746746 ifndef NO_PERF_READ_VDSOX32
@@ -769,7 +769,7 @@ ifdef LIBBABELTRACE · 22 unmodified lines
769769 endif
770770
771771 ifndef NO_AUXTRACE
772− ifeq ($(ARCH),x86)
772+ ifeq ($(SRCARCH),x86)
773773 ifeq ($(feature-get_cpuid), 0)
774774 msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc);
775775 NO_AUXTRACE := 1
@@ -872,7 +872,7 @@ sysconfdir = $(prefix)/etc · 96 unmodified lines
872872 ETC_PERFCONFIG = etc/perfconfig
873873 endif
874874 ifndef lib
875−ifeq ($(ARCH)$(IS_64_BIT), x861)
875+ifeq ($(SRCARCH)$(IS_64_BIT), x861)
876876 lib = lib64
877877 else
878878 lib = lib
tools/perf/Makefile.perf+1−1
@@ -226,7 +226,7 @@ endif · 225 unmodified lines
226226
227227 ifeq ($(config),0)
228228 include $(srctree)/tools/scripts/Makefile.arch
229−-include arch/$(ARCH)/Makefile
229+-include arch/$(SRCARCH)/Makefile
230230 endif
231231
232232 # The FEATURE_DUMP_EXPORT holds location of the actual
tools/perf/arch/Build+1−1
@@ -1,2 +1,2 @@
11 libperf-y += common.o
2−libperf-y += $(ARCH)/
2+libperf-y += $(SRCARCH)/
tools/perf/pmu-events/Build+2−2
@@ -2,7 +2,7 @@ hostprogs := jevents · 1 unmodified line
22
33 jevents-y += json.o jsmn.o jevents.o
44 pmu-events-y += pmu-events.o
5−JDIR = pmu-events/arch/$(ARCH)
5+JDIR = pmu-events/arch/$(SRCARCH)
66 JSON = $(shell [ -d $(JDIR) ] && \
77 find $(JDIR) -name '*.json' -o -name 'mapfile.csv')
88 #
@@ -10,4 +10,4 @@ JSON = $(shell [ -d $(JDIR) ] && \ · 1 unmodified line
1010 # directory and create tables in pmu-events.c.
1111 #
1212 $(OUTPUT)pmu-events/pmu-events.c: $(JSON) $(JEVENTS)
13− $(Q)$(call echo-cmd,gen)$(JEVENTS) $(ARCH) pmu-events/arch $(OUTPUT)pmu-events/pmu-events.c $(V)
13+ $(Q)$(call echo-cmd,gen)$(JEVENTS) $(SRCARCH) pmu-events/arch $(OUTPUT)pmu-events/pmu-events.c $(V)
tools/perf/tests/Build+1−1
@@ -75,7 +75,7 @@ $(OUTPUT)tests/llvm-src-relocation.c: tests/bpf-script-test-relocation.c tests/B · 74 unmodified lines
7575 $(Q)sed -e 's/"/\\"/g' -e 's/\(.*\)/"\1\\n"/g' $< >> $@
7676 $(Q)echo ';' >> $@
7777
78−ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64 powerpc))
78+ifeq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc))
7979 perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
8080 endif
8181
tools/perf/tests/task-exit.c+1−1
@@ -83,7 +83,7 @@ int test__task_exit(int subtest __maybe_unused) · 82 unmodified lines
8383
8484 evsel = perf_evlist__first(evlist);
8585 evsel->attr.task = 1;
86− evsel->attr.sample_freq = 0;
86+ evsel->attr.sample_freq = 1;
8787 evsel->attr.inherit = 0;
8888 evsel->attr.watermark = 0;
8989 evsel->attr.wakeup_events = 1;
tools/perf/util/evsel.c+12−0
@@ -273,8 +273,20 @@ struct perf_evsel *perf_evsel__new_cycles(void) · 272 unmodified lines
273273 struct perf_evsel *evsel;
274274
275275 event_attr_init(&attr);
276+ /*
277+ * Unnamed union member, not supported as struct member named
278+ * initializer in older compilers such as gcc 4.4.7
279+ *
280+ * Just for probing the precise_ip:
281+ */
282+ attr.sample_period = 1;
276283
277284 perf_event_attr__set_max_precise_ip(&attr);
285+ /*
286+ * Now let the usual logic to set up the perf_event_attr defaults
287+ * to kick in when we return and before perf_evsel__open() is called.
288+ */
289+ attr.sample_period = 0;
278290
279291 evsel = perf_evsel__new(&attr);
280292 if (evsel == NULL)
tools/perf/util/header.c+1−1
@@ -841,7 +841,7 @@ static int write_group_desc(int fd, struct perf_header *h __maybe_unused, · 840 unmodified lines
841841
842842 /*
843843 * default get_cpuid(): nothing gets recorded
844− * actual implementation must be in arch/$(ARCH)/util/header.c
844+ * actual implementation must be in arch/$(SRCARCH)/util/header.c
845845 */
846846 int __weak get_cpuid(char *buffer __maybe_unused, size_t sz __maybe_unused)
847847 {
tools/perf/util/probe-event.c+1−1
@@ -619,7 +619,7 @@ static int post_process_probe_trace_point(struct probe_trace_point *tp, · 618 unmodified lines
619619 struct map *map, unsigned long offs)
620620 {
621621 struct symbol *sym;
622− u64 addr = tp->address + tp->offset - offs;
622+ u64 addr = tp->address - offs;
623623
624624 sym = map__find_symbol(map, addr);
625625 if (!sym)
tools/perf/util/unwind-libdw.c+8−0
@@ -178,6 +178,14 @@ frame_callback(Dwfl_Frame *state, void *arg) · 177 unmodified lines
178178 Dwarf_Addr pc;
179179 bool isactivation;
180180
181+ if (!dwfl_frame_pc(state, &pc, NULL)) {
182+ pr_err("%s", dwfl_errmsg(-1));
183+ return DWARF_CB_ABORT;
184+ }
185+
186+ // report the module before we query for isactivation
187+ report_module(pc, ui);
188+
181189 if (!dwfl_frame_pc(state, &pc, &isactivation)) {
182190 pr_err("%s", dwfl_errmsg(-1));
183191 return DWARF_CB_ABORT;
tools/testing/selftests/bpf/bpf_endian.h+30−11
@@ -1,23 +1,42 @@
11 #ifndef __BPF_ENDIAN__
22 #define __BPF_ENDIAN__
33
4−#include <asm/byteorder.h>
4+#include <linux/swab.h>
55
6−#if __BYTE_ORDER == __LITTLE_ENDIAN
7−# define __bpf_ntohs(x) __builtin_bswap16(x)
8−# define __bpf_htons(x) __builtin_bswap16(x)
9−#elif __BYTE_ORDER == __BIG_ENDIAN
10−# define __bpf_ntohs(x) (x)
11−# define __bpf_htons(x) (x)
6+/* LLVM's BPF target selects the endianness of the CPU
7+ * it compiles on, or the user specifies (bpfel/bpfeb),
8+ * respectively. The used __BYTE_ORDER__ is defined by
9+ * the compiler, we cannot rely on __BYTE_ORDER from
10+ * libc headers, since it doesn't reflect the actual
11+ * requested byte order.
12+ *
13+ * Note, LLVM's BPF target has different __builtin_bswapX()
14+ * semantics. It does map to BPF_ALU | BPF_END | BPF_TO_BE
15+ * in bpfel and bpfeb case, which means below, that we map
16+ * to cpu_to_be16(). We could use it unconditionally in BPF
17+ * case, but better not rely on it, so that this header here
18+ * can be used from application and BPF program side, which
19+ * use different targets.
20+ */
21+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
22+# define __bpf_ntohs(x) __builtin_bswap16(x)
23+# define __bpf_htons(x) __builtin_bswap16(x)
24+# define __bpf_constant_ntohs(x) ___constant_swab16(x)
25+# define __bpf_constant_htons(x) ___constant_swab16(x)
26+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
27+# define __bpf_ntohs(x) (x)
28+# define __bpf_htons(x) (x)
29+# define __bpf_constant_ntohs(x) (x)
30+# define __bpf_constant_htons(x) (x)
1231 #else
13−# error "Fix your __BYTE_ORDER?!"
32+# error "Fix your compiler's __BYTE_ORDER__?!"
1433 #endif
1534
1635 #define bpf_htons(x) \
1736 (__builtin_constant_p(x) ? \
18− __constant_htons(x) : __bpf_htons(x))
37+ __bpf_constant_htons(x) : __bpf_htons(x))
1938 #define bpf_ntohs(x) \
2039 (__builtin_constant_p(x) ? \
21− __constant_ntohs(x) : __bpf_ntohs(x))
40+ __bpf_constant_ntohs(x) : __bpf_ntohs(x))
2241
23−#endif
42+#endif /* __BPF_ENDIAN__ */
tools/testing/selftests/ntb/ntb_test.sh+1−1
@@ -305,7 +305,7 @@ function perf_test() · 304 unmodified lines
305305 echo "Running remote perf test $WITH DMA"
306306 write_file "" $REMOTE_PERF/run
307307 echo -n " "
308− read_file $LOCAL_PERF/run
308+ read_file $REMOTE_PERF/run
309309 echo " Passed"
310310
311311 _modprobe -r ntb_perf

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t