History

Backmerge tag 'v4.11-rc4' into drm-next

Linux 4.11-rc4 The i915 GVT team need the rc4 code to base some more code on.

Dave Airlie committed 9 years ago

Commit e5c1ff12 parents 65d1086 c02ed2e379 files · +3469 −2577Browse files

Unified · Split

379 files
  1. Documentation/devicetree/bindings/arm/marvell/cp110-system-controller0.txt +3 −3
  2. Documentation/devicetree/bindings/display/exynos/exynos_dsim.txt +0 −1
  3. Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt +0 −1
  4. Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.txt +1 −1
  5. Documentation/devicetree/bindings/phy/brcm,nsp-usb3-phy.txt +0 −39
  6. Documentation/extcon/intel-int3496.txt +5 −0
  7. Documentation/gcc-plugins.txt +2 −2
  8. MAINTAINERS +2 −16
  9. Makefile +1 −1
  10. arch/arm/boot/dts/am335x-pcm-953.dtsi +2 −2
  11. arch/arm/boot/dts/am57xx-idk-common.dtsi +7 −7
  12. arch/arm/boot/dts/bcm5301x.dtsi +2 −2
  13. arch/arm/boot/dts/bcm953012k.dts +2 −3
  14. arch/arm/boot/dts/bcm958522er.dts +1 −0
  15. arch/arm/boot/dts/bcm958525er.dts +1 −0
  16. arch/arm/boot/dts/bcm958525xmc.dts +1 −0
  17. arch/arm/boot/dts/bcm958622hr.dts +1 −0
  18. arch/arm/boot/dts/bcm958623hr.dts +1 −0
  19. arch/arm/boot/dts/bcm958625hr.dts +1 −0
  20. arch/arm/boot/dts/bcm988312hr.dts +1 −0
  21. arch/arm/boot/dts/imx6sx-udoo-neo.dtsi +0 −5
  22. arch/arm/boot/dts/sama5d2.dtsi +1 −1
  23. arch/arm/boot/dts/ste-dbx5x0.dtsi +19 −0
  24. arch/arm/boot/dts/ste-href.dtsi +0 −9
  25. arch/arm/boot/dts/ste-snowball.dts +0 −9
  26. arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts +1 −1
  27. arch/arm/boot/dts/sun8i-a23-a33.dtsi +1 −1
  28. arch/arm/boot/dts/sun8i-reference-design-tablet.dtsi +0 −7
  29. arch/arm/configs/omap2plus_defconfig +1 −0
  30. arch/arm/mach-at91/pm.c +17 −1
  31. arch/arm/mach-omap2/Makefile +0 −3
  32. arch/arm/mach-omap2/gpmc-nand.c +0 −154
  33. arch/arm/mach-omap2/gpmc-onenand.c +6 −4
  34. arch/arm/mach-omap2/omap-headsmp.S +2 −1
  35. arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +37 −8
  36. arch/arm64/boot/dts/broadcom/ns2.dtsi +11 −0
  37. arch/arm64/include/asm/unistd.h +1 −1
  38. arch/arm64/include/asm/unistd32.h +8 −0
  39. arch/arm64/kernel/kaslr.c +7 −3
  40. arch/powerpc/kernel/idle_book3s.S +17 −3
  41. arch/powerpc/mm/init_64.c +1 −2
  42. block/blk-mq.c +1 −10
  43. block/blk-stat.c +2 −2
  44. drivers/acpi/spcr.c +1 −1
  45. drivers/auxdisplay/img-ascii-lcd.c +1 −0
  46. drivers/bluetooth/Kconfig +2 −1
  47. drivers/char/hw_random/amd-rng.c +34 −8
  48. drivers/char/hw_random/geode-rng.c +35 −15
  49. drivers/char/ppdev.c +9 −2
  50. drivers/clk/clk.c +2 −1
  51. drivers/clk/rockchip/clk-rk3036.c +8 −1
  52. drivers/clk/sunxi-ng/Kconfig +1 −0
  53. drivers/clk/sunxi-ng/ccu-sun50i-a64.c +1 −1
  54. drivers/clk/sunxi-ng/ccu-sun6i-a31.c +1 −1
  55. drivers/clk/sunxi-ng/ccu_mp.c +8 −0
  56. drivers/clk/sunxi-ng/ccu_nkmp.c +1 −1
  57. drivers/cpufreq/cpufreq.c +3 −0
  58. drivers/cpufreq/intel_pstate.c +50 −117
  59. drivers/cpuidle/sysfs.c +12 −0
  60. drivers/crypto/ccp/ccp-dev.c +4 −1
  61. drivers/crypto/ccp/ccp-dmaengine.c +1 −0
  62. drivers/extcon/Kconfig +1 −1
  63. drivers/extcon/extcon-intel-int3496.c +28 −11
  64. drivers/gpio/gpio-altera-a10sr.c +1 −1
  65. drivers/gpio/gpio-altera.c +11 −15
  66. drivers/gpio/gpio-mcp23s08.c +60 −5
  67. drivers/gpio/gpio-mockup.c +3 −4
  68. drivers/gpio/gpio-xgene.c +3 −10
  69. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 −2
  70. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 −0
  71. drivers/gpu/drm/amd/amdgpu/si_dpm.c +7 −3
  72. drivers/gpu/drm/drm_fb_helper.c +3 −3
  73. drivers/gpu/drm/exynos/exynos5433_drm_decon.c +82 −5
  74. drivers/gpu/drm/exynos/exynos7_drm_decon.c +1 −0
  75. drivers/gpu/drm/exynos/exynos_drm_crtc.c +16 −13
  76. drivers/gpu/drm/exynos/exynos_drm_crtc.h +2 −0
  77. drivers/gpu/drm/exynos/exynos_drm_dsi.c +7 −17
  78. drivers/gpu/drm/exynos/exynos_drm_fimc.c +1 −1
  79. drivers/gpu/drm/exynos/exynos_drm_fimd.c +5 −17
  80. drivers/gpu/drm/exynos/exynos_drm_gem.c +1 −1
  81. drivers/gpu/drm/exynos/exynos_drm_gsc.c +1 −1
  82. drivers/gpu/drm/exynos/exynos_drm_ipp.c +11 −11
  83. drivers/gpu/drm/exynos/exynos_drm_rotator.c +1 −1
  84. drivers/gpu/drm/exynos/exynos_drm_vidi.c +1 −0
  85. drivers/gpu/drm/exynos/exynos_mixer.c +1 −0
  86. drivers/gpu/drm/i915/gvt/aperture_gm.c +4 −4
  87. drivers/gpu/drm/i915/gvt/cmd_parser.c +76 −41
  88. drivers/gpu/drm/i915/gvt/debug.h +8 −0
  89. drivers/gpu/drm/i915/gvt/edid.c +6 −7
  90. drivers/gpu/drm/i915/gvt/execlist.c +13 −16
  91. drivers/gpu/drm/i915/gvt/gtt.c +36 −38
  92. drivers/gpu/drm/i915/gvt/handlers.c +30 −15
  93. drivers/gpu/drm/i915/gvt/kvmgt.c +23 −14
  94. drivers/gpu/drm/i915/gvt/mmio.c +19 −19
  95. drivers/gpu/drm/i915/gvt/mmio.h +3 −0
  96. drivers/gpu/drm/i915/gvt/opregion.c +5 −5
  97. drivers/gpu/drm/i915/gvt/render.c +1 −1
  98. drivers/gpu/drm/i915/gvt/sched_policy.c +2 −2
  99. drivers/gpu/drm/i915/gvt/scheduler.c +41 −20
  100. drivers/gpu/drm/i915/i915_irq.c +1 −0
  101. drivers/gpu/drm/i915/intel_gvt.c +5 −0
  102. drivers/gpu/drm/radeon/si_dpm.c +7 −3
  103. drivers/hid/Kconfig +3 −2
  104. drivers/hid/hid-chicony.c +1 −0
  105. drivers/hid/hid-core.c +2 −0
  106. drivers/hid/hid-corsair.c +47 −0
  107. drivers/hid/hid-ids.h +4 −0
  108. drivers/hid/hid-sony.c +2 −0
  109. drivers/hid/usbhid/hid-quirks.c +3 −0
  110. drivers/hid/wacom_sys.c +3 −1
  111. drivers/hid/wacom_wac.c +6 −4
  112. drivers/hv/channel.c +12 −13
  113. drivers/hv/channel_mgmt.c +5 −22
  114. drivers/hv/hv_fcopy.c +0 −4
  115. drivers/hv/hv_kvp.c +0 −4
  116. drivers/hv/hv_snapshot.c +0 −4
  117. drivers/hv/hv_util.c +2 −0
  118. drivers/hv/hv_utils_transport.c +8 −4
  119. drivers/hv/hv_utils_transport.h +1 −0
  120. drivers/hv/vmbus_drv.c +5 −1
  121. drivers/hwmon/asus_atk0110.c +3 −0
  122. drivers/hwmon/it87.c +19 −5
  123. drivers/hwmon/max31790.c +1 −1
  124. drivers/hwtracing/intel_th/core.c +3 −1
  125. drivers/hwtracing/intel_th/pci.c +10 −0
  126. drivers/iio/adc/ti_am335x_adc.c +12 −1
  127. drivers/iio/common/hid-sensors/hid-sensor-trigger.c +3 −3
  128. drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +2 −2
  129. drivers/iio/magnetometer/ak8974.c +2 −2
  130. drivers/infiniband/core/cq.c +8 −2
  131. drivers/infiniband/core/device.c +21 −8
  132. drivers/infiniband/hw/i40iw/i40iw_utils.c +8 −0
  133. drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +1 −1
  134. drivers/infiniband/hw/qib/qib_iba7322.c +1 −1
  135. drivers/infiniband/hw/vmw_pvrdma/pvrdma.h +3 −0
  136. drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h +1 −1
  137. drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c +13 −4
  138. drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c +18 −24
  139. drivers/infiniband/sw/rdmavt/mmap.c +2 −2
  140. drivers/infiniband/sw/rxe/Kconfig +1 −1
  141. drivers/infiniband/sw/rxe/rxe_mmap.c +2 −2
  142. drivers/infiniband/sw/rxe/rxe_req.c +1 −1
  143. drivers/infiniband/sw/rxe/rxe_resp.c +4 −5
  144. drivers/infiniband/ulp/iser/iscsi_iser.h +2 −0
  145. drivers/infiniband/ulp/iser/iser_verbs.c +5 −3
  146. drivers/input/joystick/iforce/iforce-usb.c +3 −0
  147. drivers/input/misc/cm109.c +4 −0
  148. drivers/input/misc/ims-pcu.c +4 −0
  149. drivers/input/misc/yealink.c +4 −0
  150. drivers/input/mouse/alps.c +52 −20
  151. drivers/input/mouse/alps.h +11 −0
  152. drivers/input/mouse/elan_i2c_core.c +11 −9
  153. drivers/input/rmi4/rmi_f30.c +4 −0
  154. drivers/input/serio/i8042-x86ia64io.h +14 −0
  155. drivers/input/tablet/hanwang.c +3 −0
  156. drivers/input/tablet/kbtab.c +3 −0
  157. drivers/input/touchscreen/sur40.c +3 −0
  158. drivers/iommu/amd_iommu.c +1 −1
  159. drivers/iommu/arm-smmu-v3.c +1 −1
  160. drivers/iommu/arm-smmu.c +1 −1
  161. drivers/iommu/exynos-iommu.c +7 −1
  162. drivers/iommu/intel-iommu.c +2 −2
  163. drivers/iommu/io-pgtable-arm-v7s.c +5 −1
  164. drivers/iommu/io-pgtable-arm.c +5 −1
  165. drivers/iommu/iommu.c +3 −2
  166. drivers/media/platform/coda/imx-vdoa.c +1 −1
  167. drivers/media/platform/exynos-gsc/gsc-core.c +0 −2
  168. drivers/media/platform/sti/bdisp/bdisp-v4l2.c +1 −1
  169. drivers/media/usb/dvb-usb/dvb-usb-firmware.c +12 −10
  170. drivers/memory/omap-gpmc.c +1 −3
  171. drivers/misc/cxl/pci.c +6 −7
  172. drivers/misc/mei/bus-fixup.c +2 −12
  173. drivers/misc/mei/init.c +6 −2
  174. drivers/misc/vmw_vmci/vmci_guest.c +2 −2
  175. drivers/mmc/core/block.c +3 −4
  176. drivers/mmc/core/mmc.c +1 −1
  177. drivers/mmc/host/mtk-sd.c +2 −2
  178. drivers/mmc/host/sdhci-of-arasan.c +5 −9
  179. drivers/mmc/host/sdhci-of-at91.c +19 −0
  180. drivers/mmc/host/sdhci-pci-core.c +4 −0
  181. drivers/mmc/host/sdhci.c +3 −1
  182. drivers/mmc/host/ushc.c +3 −0
  183. drivers/net/ethernet/amd/xgbe/xgbe-common.h +16 −14
  184. drivers/net/ethernet/amd/xgbe/xgbe-dev.c +11 −9
  185. drivers/net/ethernet/amd/xgbe/xgbe-drv.c +63 −39
  186. drivers/net/ethernet/aquantia/atlantic/aq_main.c +1 −0
  187. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0_internal.h +1 −0
  188. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0_internal.h +1 −0
  189. drivers/net/ethernet/broadcom/genet/bcmgenet.c +4 −2
  190. drivers/net/ethernet/broadcom/genet/bcmmii.c +0 −15
  191. drivers/net/ethernet/brocade/bna/bnad_debugfs.c +1 −1
  192. drivers/net/ethernet/ibm/ibmvnic.c +2 −0
  193. drivers/net/ethernet/mellanox/mlx4/cmd.c +11 −0
  194. drivers/net/ethernet/mellanox/mlx4/main.c +11 −0
  195. drivers/net/ethernet/mellanox/mlx5/core/cmd.c +4 −0
  196. drivers/net/ethernet/mellanox/mlx5/core/en.h +0 −4
  197. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +4 −4
  198. drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +0 −2
  199. drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +4 −0
  200. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +50 −24
  201. drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +3 −2
  202. drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +6 −0
  203. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +22 −0
  204. drivers/net/ethernet/mellanox/mlx5/core/main.c +1 −1
  205. drivers/net/ethernet/sfc/efx.c +1 −1
  206. drivers/net/ethernet/ti/Kconfig +8 −2
  207. drivers/net/ethernet/ti/Makefile +1 −1
  208. drivers/net/fjes/fjes_main.c +72 −6
  209. drivers/net/hyperv/netvsc.c +5 −2
  210. drivers/net/tun.c +2 −0
  211. drivers/net/usb/qmi_wwan.c +6 −0
  212. drivers/net/usb/r8152.c +17 −7
  213. drivers/net/vrf.c +3 −1
  214. drivers/net/wireless/ath/ath10k/hw.c +1 −1
  215. drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +3 −2
  216. drivers/net/wireless/intel/iwlwifi/mvm/sta.c +6 −5
  217. drivers/net/wireless/intel/iwlwifi/mvm/sta.h +1 −1
  218. drivers/net/wireless/intel/iwlwifi/mvm/tx.c +18 −23
  219. drivers/net/wireless/marvell/mwifiex/main.c +7 −4
  220. drivers/net/wireless/marvell/mwifiex/pcie.c +19 −19
  221. drivers/nvme/host/rdma.c +14 −14
  222. drivers/nvme/target/core.c +10 −1
  223. drivers/nvme/target/loop.c +51 −39
  224. drivers/nvme/target/nvmet.h +1 −0
  225. drivers/nvme/target/rdma.c +3 −5
  226. drivers/parport/share.c +4 −2
  227. drivers/phy/Kconfig +1 −8
  228. drivers/phy/Makefile +0 −1
  229. drivers/phy/phy-bcm-nsp-usb3.c +0 −177
  230. drivers/phy/phy-exynos-pcie.c +2 −2
  231. drivers/remoteproc/Kconfig +3 −3
  232. drivers/scsi/Kconfig +0 −14
  233. drivers/scsi/hpsa.c +32 −21
  234. drivers/scsi/hpsa.h +1 −0
  235. drivers/scsi/hpsa_cmd.h +2 −0
  236. drivers/scsi/lpfc/lpfc_attr.c +2 −2
  237. drivers/scsi/lpfc/lpfc_init.c +7 −0
  238. drivers/scsi/lpfc/lpfc_nvme.c +4 −4
  239. drivers/scsi/lpfc/lpfc_nvmet.c +4 −4
  240. drivers/scsi/megaraid/megaraid_sas.h +2 −2
  241. drivers/scsi/megaraid/megaraid_sas_base.c +12 −5
  242. drivers/scsi/megaraid/megaraid_sas_fusion.c +2 −2
  243. drivers/scsi/ufs/ufshcd.c +1 −1
  244. drivers/tty/serial/8250/8250_dw.c +7 −2
  245. drivers/tty/serial/amba-pl011.c +1 −1
  246. drivers/tty/serial/st-asc.c +6 −5
  247. drivers/tty/tty_ldisc.c +21 −71
  248. drivers/usb/class/usbtmc.c +15 −3
  249. drivers/usb/core/config.c +10 −0
  250. drivers/usb/core/hub.c +1 −1
  251. drivers/usb/core/quirks.c +8 −0
  252. drivers/usb/dwc3/gadget.c +17 −4
  253. drivers/usb/gadget/function/f_acm.c +3 −1
  254. drivers/usb/gadget/function/f_hid.c +4 −4
  255. drivers/usb/gadget/function/f_uvc.c +9 −1
  256. drivers/usb/gadget/udc/pch_udc.c +0 −1
  257. drivers/usb/misc/idmouse.c +3 −0
  258. drivers/usb/misc/lvstest.c +4 −0
  259. drivers/usb/misc/uss720.c +5 −0
  260. drivers/usb/musb/musb_core.c +1 −1
  261. drivers/usb/musb/musb_cppi41.c +21 −2
  262. drivers/usb/musb/musb_dsps.c +4 −1
  263. drivers/usb/serial/option.c +16 −1
  264. drivers/usb/serial/qcserial.c +2 −0
  265. drivers/usb/wusbcore/wa-hc.c +3 −0
  266. drivers/uwb/hwa-rc.c +3 −0
  267. drivers/uwb/i1480/dfu/usb.c +3 −0
  268. drivers/vfio/vfio.c +5 −3
  269. drivers/vfio/vfio_iommu_type1.c +3 −4
  270. drivers/vhost/vsock.c +41 −0
  271. drivers/xen/xen-acpi-processor.c +27 −9
  272. fs/btrfs/extent_io.c +2 −1
  273. fs/btrfs/inode.c +14 −0
  274. fs/crypto/crypto.c +1 −9
  275. fs/crypto/fname.c +1 −1
  276. fs/crypto/fscrypt_private.h +0 −4
  277. fs/crypto/keyinfo.c +9 −43
  278. fs/crypto/policy.c +0 −7
  279. fs/ext4/inline.c +2 −3
  280. fs/ext4/inode.c +1 −1
  281. fs/ext4/move_extent.c +1 −1
  282. fs/ext4/super.c +4 −6
  283. fs/ext4/xattr.c +31 −34
  284. fs/f2fs/debug.c +1 −0
  285. fs/f2fs/dir.c +1 −1
  286. fs/f2fs/f2fs.h +2 −0
  287. fs/f2fs/node.c +77 −86
  288. fs/f2fs/segment.c +6 −0
  289. fs/jbd2/journal.c +11 −11
  290. fs/jbd2/revoke.c +1 −0
  291. fs/kernfs/file.c +2 −1
  292. include/linux/ccp.h +1 −1
  293. include/linux/errqueue.h +2 −0
  294. include/linux/fscrypt_common.h +0 −1
  295. include/linux/gpio/consumer.h +0 −16
  296. include/linux/hwmon.h +1 −0
  297. include/linux/hyperv.h +7 −3
  298. include/linux/iio/sw_device.h +1 −1
  299. include/linux/iommu.h +13 −5
  300. include/linux/mlx4/device.h +1 −0
  301. include/linux/omap-gpmc.h +3 −13
  302. include/linux/reset.h +2 −7
  303. include/linux/usb/quirks.h +6 −0
  304. include/linux/virtio_vsock.h +3 −0
  305. include/net/af_vsock.h +3 −0
  306. include/net/netfilter/nf_conntrack.h +1 −1
  307. include/net/netfilter/nf_tables.h +29 −1
  308. include/net/netfilter/nf_tables_ipv6.h +4 −2
  309. include/net/sctp/structs.h +3 −2
  310. include/rdma/ib_verbs.h +17 −13
  311. include/uapi/asm-generic/unistd.h +3 −1
  312. include/uapi/linux/btrfs.h +0 −27
  313. include/uapi/rdma/mlx5-abi.h +2 −1
  314. include/video/exynos5433_decon.h +12 −0
  315. kernel/audit.c +394 −245
  316. kernel/audit.h +2 −7
  317. kernel/auditsc.c +3 −3
  318. kernel/bpf/hashtab.c +71 −73
  319. kernel/sched/cpufreq_schedutil.c +7 −13
  320. mm/swap_slots.c +0 −2
  321. net/batman-adv/bat_iv_ogm.c +11 −0
  322. net/batman-adv/bat_v.c +11 −3
  323. net/batman-adv/fragmentation.c +13 −7
  324. net/batman-adv/gateway_common.c +5 −0
  325. net/batman-adv/soft-interface.c +0 −1
  326. net/batman-adv/types.h +2 −0
  327. net/bridge/br_fdb.c +1 −1
  328. net/bridge/br_netfilter_hooks.c +7 −5
  329. net/bridge/br_private.h +0 −9
  330. net/ceph/messenger.c +6 −0
  331. net/core/netclassid_cgroup.c +16 −16
  332. net/core/skbuff.c +21 −6
  333. net/core/sock.c +11 −5
  334. net/ipv4/fib_frontend.c +2 −1
  335. net/ipv4/ip_fragment.c +17 −8
  336. net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +4 −0
  337. net/ipv4/netfilter/nf_nat_l3proto_ipv4.c +0 −5
  338. net/ipv4/netfilter/nft_masq_ipv4.c +4 −4
  339. net/ipv4/netfilter/nft_redir_ipv4.c +4 −4
  340. net/ipv4/tcp.c +2 −1
  341. net/ipv4/tcp_input.c +1 −1
  342. net/ipv4/tcp_minisocks.c +1 −0
  343. net/ipv6/netfilter/nft_masq_ipv6.c +4 −4
  344. net/ipv6/netfilter/nft_redir_ipv6.c +4 −4
  345. net/ipv6/route.c +2 −0
  346. net/ipv6/udp.c +1 −1
  347. net/mpls/af_mpls.c +10 −3
  348. net/netfilter/nf_conntrack_core.c +5 −1
  349. net/netfilter/nf_nat_proto_sctp.c +12 −1
  350. net/netfilter/nf_tables_api.c +0 −4
  351. net/netfilter/nft_ct.c +12 −9
  352. net/netfilter/nft_meta.c +21 −19
  353. net/netfilter/nft_nat.c +4 −4
  354. net/netfilter/nft_set_bitmap.c +79 −86
  355. net/netlink/af_netlink.c +41 −0
  356. net/netlink/genetlink.c +3 −1
  357. net/openvswitch/flow_netlink.c +3 −1
  358. net/rxrpc/conn_event.c +4 −0
  359. net/sched/sch_dsmark.c +8 −2
  360. net/sctp/associola.c +2 −4
  361. net/sctp/output.c +3 −4
  362. net/sctp/outqueue.c +5 −6
  363. net/socket.c +12 −1
  364. net/tipc/subscr.c +6 −1
  365. net/unix/garbage.c +9 −8
  366. net/vmw_vsock/af_vsock.c +14 −0
  367. net/vmw_vsock/virtio_transport.c +42 −0
  368. net/vmw_vsock/virtio_transport_common.c +7 −0
  369. net/wireless/nl80211.c +56 −71
  370. sound/core/seq/seq_clientmgr.c +1 −0
  371. sound/core/seq/seq_fifo.c +3 −0
  372. sound/core/seq/seq_memory.c +13 −4
  373. sound/core/seq/seq_memory.h +1 −0
  374. sound/pci/ctxfi/cthw20k1.c +1 −1
  375. sound/pci/hda/patch_conexant.c +11 −0
  376. sound/pci/hda/patch_realtek.c +15 −1
  377. sound/x86/Kconfig +2 −1
  378. tools/testing/selftests/bpf/Makefile +10 −9
  379. tools/testing/selftests/bpf/test_maps.c +26 −3
Documentation/devicetree/bindings/arm/marvell/cp110-system-controller0.txt+3−3
@@ -45,7 +45,7 @@ The following clocks are available: · 44 unmodified lines
4545 - 1 15 SATA
4646 - 1 16 SATA USB
4747 - 1 17 Main
48− - 1 18 SD/MMC
48+ - 1 18 SD/MMC/GOP
4949 - 1 21 Slow IO (SPI, NOR, BootROM, I2C, UART)
5050 - 1 22 USB3H0
5151 - 1 23 USB3H1
@@ -65,7 +65,7 @@ Required properties: · 13 unmodified lines
6565 "cpm-audio", "cpm-communit", "cpm-nand", "cpm-ppv2", "cpm-sdio",
6666 "cpm-mg-domain", "cpm-mg-core", "cpm-xor1", "cpm-xor0", "cpm-gop-dp", "none",
6767 "cpm-pcie_x10", "cpm-pcie_x11", "cpm-pcie_x4", "cpm-pcie-xor", "cpm-sata",
68− "cpm-sata-usb", "cpm-main", "cpm-sd-mmc", "none", "none", "cpm-slow-io",
68+ "cpm-sata-usb", "cpm-main", "cpm-sd-mmc-gop", "none", "none", "cpm-slow-io",
6969 "cpm-usb3h0", "cpm-usb3h1", "cpm-usb3dev", "cpm-eip150", "cpm-eip197";
7070
7171 Example:
@@ -78,6 +78,6 @@ Example: · 6 unmodified lines
7878 gate-clock-output-names = "cpm-audio", "cpm-communit", "cpm-nand", "cpm-ppv2", "cpm-sdio",
7979 "cpm-mg-domain", "cpm-mg-core", "cpm-xor1", "cpm-xor0", "cpm-gop-dp", "none",
8080 "cpm-pcie_x10", "cpm-pcie_x11", "cpm-pcie_x4", "cpm-pcie-xor", "cpm-sata",
81− "cpm-sata-usb", "cpm-main", "cpm-sd-mmc", "none", "none", "cpm-slow-io",
81+ "cpm-sata-usb", "cpm-main", "cpm-sd-mmc-gop", "none", "none", "cpm-slow-io",
8282 "cpm-usb3h0", "cpm-usb3h1", "cpm-usb3dev", "cpm-eip150", "cpm-eip197";
8383 };
Documentation/devicetree/bindings/display/exynos/exynos_dsim.txt+0−1
@@ -4,7 +4,6 @@ Required properties: · 3 unmodified lines
44 - compatible: value should be one of the following
55 "samsung,exynos3250-mipi-dsi" /* for Exynos3250/3472 SoCs */
66 "samsung,exynos4210-mipi-dsi" /* for Exynos4 SoCs */
7− "samsung,exynos4415-mipi-dsi" /* for Exynos4415 SoC */
87 "samsung,exynos5410-mipi-dsi" /* for Exynos5410/5420/5440 SoCs */
98 "samsung,exynos5422-mipi-dsi" /* for Exynos5422/5800 SoCs */
109 "samsung,exynos5433-mipi-dsi" /* for Exynos5433 SoCs */
Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt+0−1
@@ -11,7 +11,6 @@ Required properties: · 10 unmodified lines
1111 "samsung,s5pv210-fimd"; /* for S5PV210 SoC */
1212 "samsung,exynos3250-fimd"; /* for Exynos3250/3472 SoCs */
1313 "samsung,exynos4210-fimd"; /* for Exynos4 SoCs */
14− "samsung,exynos4415-fimd"; /* for Exynos4415 SoC */
1514 "samsung,exynos5250-fimd"; /* for Exynos5250 SoCs */
1615 "samsung,exynos5420-fimd"; /* for Exynos5420/5422/5800 SoCs */
1716
Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.txt+1−1
@@ -13,7 +13,7 @@ Required Properties: · 12 unmodified lines
1313 - "rockchip,rk2928-dw-mshc": for Rockchip RK2928 and following,
1414 before RK3288
1515 - "rockchip,rk3288-dw-mshc": for Rockchip RK3288
16− - "rockchip,rk1108-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK1108
16+ - "rockchip,rv1108-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RV1108
1717 - "rockchip,rk3036-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK3036
1818 - "rockchip,rk3368-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK3368
1919 - "rockchip,rk3399-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK3399
Documentation/devicetree/bindings/phy/brcm,nsp-usb3-phy.txt+0−39
@@ -1,39 +0,0 @@
1−Broadcom USB3 phy binding for northstar plus SoC
2−The USB3 phy is internal to the SoC and is accessed using mdio interface.
3−
4−Required mdio bus properties:
5−- reg: Should be 0x0 for SoC internal USB3 phy
6−- #address-cells: must be 1
7−- #size-cells: must be 0
8−
9−Required USB3 PHY properties:
10−- compatible: should be "brcm,nsp-usb3-phy"
11−- reg: USB3 Phy address on SoC internal MDIO bus and it should be 0x10.
12−- usb3-ctrl-syscon: handler of syscon node defining physical address
13− of usb3 control register.
14−- #phy-cells: must be 0
15−
16−Required usb3 control properties:
17−- compatible: should be "brcm,nsp-usb3-ctrl"
18−- reg: offset and length of the control registers
19−
20−Example:
21−
22− mdio@0 {
23− reg = <0x0>;
24− #address-cells = <1>;
25− #size-cells = <0>;
26−
27− usb3_phy: usb-phy@10 {
28− compatible = "brcm,nsp-usb3-phy";
29− reg = <0x10>;
30− usb3-ctrl-syscon = <&usb3_ctrl>;
31− #phy-cells = <0>;
32− status = "disabled";
33− };
34− };
35−
36− usb3_ctrl: syscon@104408 {
37− compatible = "brcm,nsp-usb3-ctrl", "syscon";
38− reg = <0x104408 0x3fc>;
39− };
Documentation/extcon/intel-int3496.txt+5−0
@@ -20,3 +20,8 @@ Index 1: The output gpio for enabling Vbus output from the device to the otg · 19 unmodified lines
2020 Index 2: The output gpio for muxing of the data pins between the USB host and
2121 the USB peripheral controller, write 1 to mux to the peripheral
2222 controller
23+
24+There is a mapping between indices and GPIO connection IDs as follows
25+ id index 0
26+ vbus index 1
27+ mux index 2
Documentation/gcc-plugins.txt+2−2
@@ -18,8 +18,8 @@ because gcc versions 4.5 and 4.6 are compiled by a C compiler, · 17 unmodified lines
1818 gcc-4.7 can be compiled by a C or a C++ compiler,
1919 and versions 4.8+ can only be compiled by a C++ compiler.
2020
21−Currently the GCC plugin infrastructure supports only the x86, arm and arm64
22−architectures.
21+Currently the GCC plugin infrastructure supports only the x86, arm, arm64 and
22+powerpc architectures.
2323
2424 This infrastructure was ported from grsecurity [6] and PaX [7].
2525
MAINTAINERS+2−16
@@ -3216,7 +3216,6 @@ F: drivers/platform/chrome/ · 3215 unmodified lines
32163216
32173217 CISCO VIC ETHERNET NIC DRIVER
32183218 M: Christian Benvenuti <benve@cisco.com>
3219−M: Sujith Sankar <ssujith@cisco.com>
32203219 M: Govindarajulu Varadarajan <_govind@gmx.com>
32213220 M: Neel Patel <neepatel@cisco.com>
32223221 S: Supported
@@ -7780,13 +7779,6 @@ F: include/net/mac80211.h · 4557 unmodified lines
77807779 F: net/mac80211/
77817780 F: drivers/net/wireless/mac80211_hwsim.[ch]
77827781
7783−MACVLAN DRIVER
7784−M: Patrick McHardy <kaber@trash.net>
7785−L: netdev@vger.kernel.org
7786−S: Maintained
7787−F: drivers/net/macvlan.c
7788−F: include/linux/if_macvlan.h
7789−
77907782 MAILBOX API
77917783 M: Jassi Brar <jassisinghbrar@gmail.com>
77927784 L: linux-kernel@vger.kernel.org
@@ -7859,6 +7851,8 @@ F: drivers/net/ethernet/marvell/mvneta.* · 66 unmodified lines
78597851 MARVELL MWIFIEX WIRELESS DRIVER
78607852 M: Amitkumar Karwar <akarwar@marvell.com>
78617853 M: Nishant Sarmukadam <nishants@marvell.com>
7854+M: Ganapathi Bhat <gbhat@marvell.com>
7855+M: Xinming Hu <huxm@marvell.com>
78627856 L: linux-wireless@vger.kernel.org
78637857 S: Maintained
78647858 F: drivers/net/wireless/marvell/mwifiex/
@@ -13397,14 +13391,6 @@ W: https://linuxtv.org · 5532 unmodified lines
1339713391 S: Maintained
1339813392 F: drivers/media/platform/vivid/*
1339913393
13400−VLAN (802.1Q)
13401−M: Patrick McHardy <kaber@trash.net>
13402−L: netdev@vger.kernel.org
13403−S: Maintained
13404−F: drivers/net/macvlan.c
13405−F: include/linux/if_*vlan.h
13406−F: net/8021q/
13407−
1340813394 VLYNQ BUS
1340913395 M: Florian Fainelli <f.fainelli@gmail.com>
1341013396 L: openwrt-devel@lists.openwrt.org (subscribers-only)
Makefile+1−1
@@ -1,7 +1,7 @@
11 VERSION = 4
22 PATCHLEVEL = 11
33 SUBLEVEL = 0
4−EXTRAVERSION = -rc3
4+EXTRAVERSION = -rc4
55 NAME = Fearless Coyote
66
77 # *DOCUMENTATION*
arch/arm/boot/dts/am335x-pcm-953.dtsi+2−2
@@ -63,14 +63,14 @@ · 62 unmodified lines
6363 label = "home";
6464 linux,code = <KEY_HOME>;
6565 gpios = <&gpio3 7 GPIO_ACTIVE_HIGH>;
66− gpio-key,wakeup;
66+ wakeup-source;
6767 };
6868
6969 button@1 {
7070 label = "menu";
7171 linux,code = <KEY_MENU>;
7272 gpios = <&gpio3 8 GPIO_ACTIVE_HIGH>;
73− gpio-key,wakeup;
73+ wakeup-source;
7474 };
7575
7676 };
arch/arm/boot/dts/am57xx-idk-common.dtsi+7−7
@@ -315,6 +315,13 @@ · 314 unmodified lines
315315 /* ID & VBUS GPIOs provided in board dts */
316316 };
317317 };
318+
319+ tpic2810: tpic2810@60 {
320+ compatible = "ti,tpic2810";
321+ reg = <0x60>;
322+ gpio-controller;
323+ #gpio-cells = <2>;
324+ };
318325 };
319326
320327 &mcspi3 {
@@ -330,13 +337,6 @@ · 9 unmodified lines
330337 spi-max-frequency = <1000000>;
331338 spi-cpol;
332339 };
333−
334− tpic2810: tpic2810@60 {
335− compatible = "ti,tpic2810";
336− reg = <0x60>;
337− gpio-controller;
338− #gpio-cells = <2>;
339− };
340340 };
341341
342342 &uart3 {
arch/arm/boot/dts/bcm5301x.dtsi+2−2
@@ -66,14 +66,14 @@ · 65 unmodified lines
6666 timer@20200 {
6767 compatible = "arm,cortex-a9-global-timer";
6868 reg = <0x20200 0x100>;
69− interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>;
69+ interrupts = <GIC_PPI 11 IRQ_TYPE_EDGE_RISING>;
7070 clocks = <&periph_clk>;
7171 };
7272
7373 local-timer@20600 {
7474 compatible = "arm,cortex-a9-twd-timer";
7575 reg = <0x20600 0x100>;
76− interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>;
76+ interrupts = <GIC_PPI 13 IRQ_TYPE_EDGE_RISING>;
7777 clocks = <&periph_clk>;
7878 };
7979
arch/arm/boot/dts/bcm953012k.dts+2−3
@@ -48,15 +48,14 @@ · 47 unmodified lines
4848 };
4949
5050 memory {
51− reg = <0x00000000 0x10000000>;
51+ reg = <0x80000000 0x10000000>;
5252 };
5353 };
5454
5555 &uart0 {
56− clock-frequency = <62499840>;
56+ status = "okay";
5757 };
5858
5959 &uart1 {
60− clock-frequency = <62499840>;
6160 status = "okay";
6261 };
arch/arm/boot/dts/bcm958522er.dts+1−0
@@ -55,6 +55,7 @@ · 54 unmodified lines
5555 gpio-restart {
5656 compatible = "gpio-restart";
5757 gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
58+ open-source;
5859 priority = <200>;
5960 };
6061 };
arch/arm/boot/dts/bcm958525er.dts+1−0
@@ -55,6 +55,7 @@ · 54 unmodified lines
5555 gpio-restart {
5656 compatible = "gpio-restart";
5757 gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
58+ open-source;
5859 priority = <200>;
5960 };
6061 };
arch/arm/boot/dts/bcm958525xmc.dts+1−0
@@ -55,6 +55,7 @@ · 54 unmodified lines
5555 gpio-restart {
5656 compatible = "gpio-restart";
5757 gpios = <&gpioa 31 GPIO_ACTIVE_LOW>;
58+ open-source;
5859 priority = <200>;
5960 };
6061 };
arch/arm/boot/dts/bcm958622hr.dts+1−0
@@ -55,6 +55,7 @@ · 54 unmodified lines
5555 gpio-restart {
5656 compatible = "gpio-restart";
5757 gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
58+ open-source;
5859 priority = <200>;
5960 };
6061 };
arch/arm/boot/dts/bcm958623hr.dts+1−0
@@ -55,6 +55,7 @@ · 54 unmodified lines
5555 gpio-restart {
5656 compatible = "gpio-restart";
5757 gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
58+ open-source;
5859 priority = <200>;
5960 };
6061 };
arch/arm/boot/dts/bcm958625hr.dts+1−0
@@ -55,6 +55,7 @@ · 54 unmodified lines
5555 gpio-restart {
5656 compatible = "gpio-restart";
5757 gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
58+ open-source;
5859 priority = <200>;
5960 };
6061 };
arch/arm/boot/dts/bcm988312hr.dts+1−0
@@ -55,6 +55,7 @@ · 54 unmodified lines
5555 gpio-restart {
5656 compatible = "gpio-restart";
5757 gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
58+ open-source;
5859 priority = <200>;
5960 };
6061 };
arch/arm/boot/dts/imx6sx-udoo-neo.dtsi+0−5
@@ -121,11 +121,6 @@ · 120 unmodified lines
121121 };
122122 };
123123
124−&cpu0 {
125− arm-supply = <&sw1a_reg>;
126− soc-supply = <&sw1c_reg>;
127−};
128−
129124 &fec1 {
130125 pinctrl-names = "default";
131126 pinctrl-0 = <&pinctrl_enet1>;
arch/arm/boot/dts/sama5d2.dtsi+1−1
@@ -266,7 +266,7 @@ · 265 unmodified lines
266266 };
267267
268268 usb1: ohci@00400000 {
269− compatible = "atmel,sama5d2-ohci", "usb-ohci";
269+ compatible = "atmel,at91rm9200-ohci", "usb-ohci";
270270 reg = <0x00400000 0x100000>;
271271 interrupts = <41 IRQ_TYPE_LEVEL_HIGH 2>;
272272 clocks = <&uhphs_clk>, <&uhphs_clk>, <&uhpck>;
arch/arm/boot/dts/ste-dbx5x0.dtsi+19−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <dt-bindings/mfd/dbx500-prcmu.h>
1515 #include <dt-bindings/arm/ux500_pm_domains.h>
1616 #include <dt-bindings/gpio/gpio.h>
17+#include <dt-bindings/clock/ste-ab8500.h>
1718 #include "skeleton.dtsi"
1819
1920 / {
@@ -603,6 +604,11 @@ · 583 unmodified lines
603604 interrupt-controller;
604605 #interrupt-cells = <2>;
605606
607+ ab8500_clock: clock-controller {
608+ compatible = "stericsson,ab8500-clk";
609+ #clock-cells = <1>;
610+ };
611+
606612 ab8500_gpio: ab8500-gpio {
607613 compatible = "stericsson,ab8500-gpio";
608614 gpio-controller;
@@ -686,6 +692,8 @@ · 77 unmodified lines
686692
687693 ab8500-pwm {
688694 compatible = "stericsson,ab8500-pwm";
695+ clocks = <&ab8500_clock AB8500_SYSCLK_INT>;
696+ clock-names = "intclk";
689697 };
690698
691699 ab8500-debugfs {
@@ -700,6 +708,9 @@ · 8 unmodified lines
700708 V-AMIC2-supply = <&ab8500_ldo_anamic2_reg>;
701709 V-DMIC-supply = <&ab8500_ldo_dmic_reg>;
702710
711+ clocks = <&ab8500_clock AB8500_SYSCLK_AUDIO>;
712+ clock-names = "audioclk";
713+
703714 stericsson,earpeice-cmv = <950>; /* Units in mV. */
704715 };
705716
@@ -1095,6 +1106,14 @@ · 389 unmodified lines
10951106 status = "disabled";
10961107 };
10971108
1109+ sound {
1110+ compatible = "stericsson,snd-soc-mop500";
1111+ stericsson,cpu-dai = <&msp1 &msp3>;
1112+ stericsson,audio-codec = <&codec>;
1113+ clocks = <&prcmu_clk PRCMU_SYSCLK>, <&ab8500_clock AB8500_SYSCLK_ULP>, <&ab8500_clock AB8500_SYSCLK_INT>;
1114+ clock-names = "sysclk", "ulpclk", "intclk";
1115+ };
1116+
10981117 msp0: msp@80123000 {
10991118 compatible = "stericsson,ux500-msp-i2s";
11001119 reg = <0x80123000 0x1000>;
arch/arm/boot/dts/ste-href.dtsi+0−9
@@ -186,15 +186,6 @@ · 185 unmodified lines
186186 status = "okay";
187187 };
188188
189− sound {
190− compatible = "stericsson,snd-soc-mop500";
191−
192− stericsson,cpu-dai = <&msp1 &msp3>;
193− stericsson,audio-codec = <&codec>;
194− clocks = <&prcmu_clk PRCMU_SYSCLK>;
195− clock-names = "sysclk";
196− };
197−
198189 msp0: msp@80123000 {
199190 pinctrl-names = "default";
200191 pinctrl-0 = <&msp0_default_mode>;
arch/arm/boot/dts/ste-snowball.dts+0−9
@@ -159,15 +159,6 @@ · 158 unmodified lines
159159 "", "", "", "", "", "", "", "";
160160 };
161161
162− sound {
163− compatible = "stericsson,snd-soc-mop500";
164−
165− stericsson,cpu-dai = <&msp1 &msp3>;
166− stericsson,audio-codec = <&codec>;
167− clocks = <&prcmu_clk PRCMU_SYSCLK>;
168− clock-names = "sysclk";
169− };
170−
171162 msp0: msp@80123000 {
172163 pinctrl-names = "default";
173164 pinctrl-0 = <&msp0_default_mode>;
arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts+1−1
@@ -167,7 +167,7 @@ · 166 unmodified lines
167167 reg = <8>;
168168 label = "cpu";
169169 ethernet = <&gmac>;
170− phy-mode = "rgmii";
170+ phy-mode = "rgmii-txid";
171171 fixed-link {
172172 speed = <1000>;
173173 full-duplex;
arch/arm/boot/dts/sun8i-a23-a33.dtsi+1−1
@@ -495,7 +495,7 @@ · 494 unmodified lines
495495 resets = <&ccu RST_BUS_GPU>;
496496
497497 assigned-clocks = <&ccu CLK_GPU>;
498− assigned-clock-rates = <408000000>;
498+ assigned-clock-rates = <384000000>;
499499 };
500500
501501 gic: interrupt-controller@01c81000 {
arch/arm/boot/dts/sun8i-reference-design-tablet.dtsi+0−7
@@ -50,8 +50,6 @@ · 49 unmodified lines
5050
5151 backlight: backlight {
5252 compatible = "pwm-backlight";
53− pinctrl-names = "default";
54− pinctrl-0 = <&bl_en_pin>;
5553 pwms = <&pwm 0 50000 PWM_POLARITY_INVERTED>;
5654 brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
5755 default-brightness-level = <8>;
@@ -93,11 +91,6 @@ · 35 unmodified lines
9391 };
9492
9593 &pio {
96− bl_en_pin: bl_en_pin@0 {
97− pins = "PH6";
98− function = "gpio_in";
99− };
100−
10194 mmc0_cd_pin: mmc0_cd_pin@0 {
10295 pins = "PB4";
10396 function = "gpio_in";
arch/arm/configs/omap2plus_defconfig+1−0
@@ -188,6 +188,7 @@ CONFIG_WL12XX=m · 187 unmodified lines
188188 CONFIG_WL18XX=m
189189 CONFIG_WLCORE_SPI=m
190190 CONFIG_WLCORE_SDIO=m
191+CONFIG_INPUT_MOUSEDEV=m
191192 CONFIG_INPUT_JOYDEV=m
192193 CONFIG_INPUT_EVDEV=m
193194 CONFIG_KEYBOARD_ATKBD=m
arch/arm/mach-at91/pm.c+17−1
@@ -289,6 +289,22 @@ static void at91_ddr_standby(void) · 288 unmodified lines
289289 at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1);
290290 }
291291
292+static void sama5d3_ddr_standby(void)
293+{
294+ u32 lpr0;
295+ u32 saved_lpr0;
296+
297+ saved_lpr0 = at91_ramc_read(0, AT91_DDRSDRC_LPR);
298+ lpr0 = saved_lpr0 & ~AT91_DDRSDRC_LPCB;
299+ lpr0 |= AT91_DDRSDRC_LPCB_POWER_DOWN;
300+
301+ at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0);
302+
303+ cpu_do_idle();
304+
305+ at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr0);
306+}
307+
292308 /* We manage both DDRAM/SDRAM controllers, we need more than one value to
293309 * remember.
294310 */
@@ -323,7 +339,7 @@ static const struct of_device_id const ramc_ids[] __initconst = { · 28 unmodified lines
323339 { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby },
324340 { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby },
325341 { .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby },
326− { .compatible = "atmel,sama5d3-ddramc", .data = at91_ddr_standby },
342+ { .compatible = "atmel,sama5d3-ddramc", .data = sama5d3_ddr_standby },
327343 { /*sentinel*/ }
328344 };
329345
arch/arm/mach-omap2/Makefile+0−3
@@ -241,6 +241,3 @@ obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o · 240 unmodified lines
241241
242242 onenand-$(CONFIG_MTD_ONENAND_OMAP2) := gpmc-onenand.o
243243 obj-y += $(onenand-m) $(onenand-y)
244−
245−nand-$(CONFIG_MTD_NAND_OMAP2) := gpmc-nand.o
246−obj-y += $(nand-m) $(nand-y)
arch/arm/mach-omap2/gpmc-nand.c+0−154
@@ -1,154 +0,0 @@
1−/*
2− * gpmc-nand.c
3− *
4− * Copyright (C) 2009 Texas Instruments
5− * Vimal Singh <vimalsingh@ti.com>
6− *
7− * This program is free software; you can redistribute it and/or modify
8− * it under the terms of the GNU General Public License version 2 as
9− * published by the Free Software Foundation.
10− */
11−
12−#include <linux/kernel.h>
13−#include <linux/platform_device.h>
14−#include <linux/io.h>
15−#include <linux/omap-gpmc.h>
16−#include <linux/mtd/nand.h>
17−#include <linux/platform_data/mtd-nand-omap2.h>
18−
19−#include <asm/mach/flash.h>
20−
21−#include "soc.h"
22−
23−/* minimum size for IO mapping */
24−#define NAND_IO_SIZE 4
25−
26−static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
27−{
28− /* platforms which support all ECC schemes */
29− if (soc_is_am33xx() || soc_is_am43xx() || cpu_is_omap44xx() ||
30− soc_is_omap54xx() || soc_is_dra7xx())
31− return 1;
32−
33− if (ecc_opt == OMAP_ECC_BCH4_CODE_HW_DETECTION_SW ||
34− ecc_opt == OMAP_ECC_BCH8_CODE_HW_DETECTION_SW) {
35− if (cpu_is_omap24xx())
36− return 0;
37− else if (cpu_is_omap3630() && (GET_OMAP_REVISION() == 0))
38− return 0;
39− else
40− return 1;
41− }
42−
43− /* OMAP3xxx do not have ELM engine, so cannot support ECC schemes
44− * which require H/W based ECC error detection */
45− if ((cpu_is_omap34xx() || cpu_is_omap3630()) &&
46− ((ecc_opt == OMAP_ECC_BCH4_CODE_HW) ||
47− (ecc_opt == OMAP_ECC_BCH8_CODE_HW)))
48− return 0;
49−
50− /* legacy platforms support only HAM1 (1-bit Hamming) ECC scheme */
51− if (ecc_opt == OMAP_ECC_HAM1_CODE_HW ||
52− ecc_opt == OMAP_ECC_HAM1_CODE_SW)
53− return 1;
54− else
55− return 0;
56−}
57−
58−/* This function will go away once the device-tree convertion is complete */
59−static void gpmc_set_legacy(struct omap_nand_platform_data *gpmc_nand_data,
60− struct gpmc_settings *s)
61−{
62− /* Enable RD PIN Monitoring Reg */
63− if (gpmc_nand_data->dev_ready) {
64− s->wait_on_read = true;
65− s->wait_on_write = true;
66− }
67−
68− if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
69− s->device_width = GPMC_DEVWIDTH_16BIT;
70− else
71− s->device_width = GPMC_DEVWIDTH_8BIT;
72−}
73−
74−int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
75− struct gpmc_timings *gpmc_t)
76−{
77− int err = 0;
78− struct gpmc_settings s;
79− struct platform_device *pdev;
80− struct resource gpmc_nand_res[] = {
81− { .flags = IORESOURCE_MEM, },
82− { .flags = IORESOURCE_IRQ, },
83− { .flags = IORESOURCE_IRQ, },
84− };
85−
86− BUG_ON(gpmc_nand_data->cs >= GPMC_CS_NUM);
87−
88− err = gpmc_cs_request(gpmc_nand_data->cs, NAND_IO_SIZE,
89− (unsigned long *)&gpmc_nand_res[0].start);
90− if (err < 0) {
91− pr_err("omap2-gpmc: Cannot request GPMC CS %d, error %d\n",
92− gpmc_nand_data->cs, err);
93− return err;
94− }
95− gpmc_nand_res[0].end = gpmc_nand_res[0].start + NAND_IO_SIZE - 1;
96− gpmc_nand_res[1].start = gpmc_get_client_irq(GPMC_IRQ_FIFOEVENTENABLE);
97− gpmc_nand_res[2].start = gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT);
98−
99− memset(&s, 0, sizeof(struct gpmc_settings));
100− gpmc_set_legacy(gpmc_nand_data, &s);
101−
102− s.device_nand = true;
103−
104− if (gpmc_t) {
105− err = gpmc_cs_set_timings(gpmc_nand_data->cs, gpmc_t, &s);
106− if (err < 0) {
107− pr_err("omap2-gpmc: Unable to set gpmc timings: %d\n",
108− err);
109− return err;
110− }
111− }
112−
113− err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s);
114− if (err < 0)
115− goto out_free_cs;
116−
117− err = gpmc_configure(GPMC_CONFIG_WP, 0);
118− if (err < 0)
119− goto out_free_cs;
120−
121− if (!gpmc_hwecc_bch_capable(gpmc_nand_data->ecc_opt)) {
122− pr_err("omap2-nand: Unsupported NAND ECC scheme selected\n");
123− err = -EINVAL;
124− goto out_free_cs;
125− }
126−
127−
128− pdev = platform_device_alloc("omap2-nand", gpmc_nand_data->cs);
129− if (pdev) {
130− err = platform_device_add_resources(pdev, gpmc_nand_res,
131− ARRAY_SIZE(gpmc_nand_res));
132− if (!err)
133− pdev->dev.platform_data = gpmc_nand_data;
134− } else {
135− err = -ENOMEM;
136− }
137− if (err)
138− goto out_free_pdev;
139−
140− err = platform_device_add(pdev);
141− if (err) {
142− dev_err(&pdev->dev, "Unable to register NAND device\n");
143− goto out_free_pdev;
144− }
145−
146− return 0;
147−
148−out_free_pdev:
149− platform_device_put(pdev);
150−out_free_cs:
151− gpmc_cs_free(gpmc_nand_data->cs);
152−
153− return err;
154−}
arch/arm/mach-omap2/gpmc-onenand.c+6−4
@@ -367,7 +367,7 @@ static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr) · 366 unmodified lines
367367 return ret;
368368 }
369369
370−void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
370+int gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
371371 {
372372 int err;
373373 struct device *dev = &gpmc_onenand_device.dev;
@@ -393,15 +393,17 @@ void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) · 19 unmodified lines
393393 if (err < 0) {
394394 dev_err(dev, "Cannot request GPMC CS %d, error %d\n",
395395 gpmc_onenand_data->cs, err);
396− return;
396+ return err;
397397 }
398398
399399 gpmc_onenand_resource.end = gpmc_onenand_resource.start +
400400 ONENAND_IO_SIZE - 1;
401401
402− if (platform_device_register(&gpmc_onenand_device) < 0) {
402+ err = platform_device_register(&gpmc_onenand_device);
403+ if (err) {
403404 dev_err(dev, "Unable to register OneNAND device\n");
404405 gpmc_cs_free(gpmc_onenand_data->cs);
405− return;
406406 }
407+
408+ return err;
407409 }
arch/arm/mach-omap2/omap-headsmp.S+2−1
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717
1818 #include <linux/linkage.h>
1919 #include <linux/init.h>
20+#include <asm/assembler.h>
2021
2122 #include "omap44xx.h"
2223
@@ -66,7 +67,7 @@ wait_2: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0 · 43 unmodified lines
6667 cmp r0, r4
6768 bne wait_2
6869 ldr r12, =API_HYP_ENTRY
69− adr r0, hyp_boot
70+ badr r0, hyp_boot
7071 smc #0
7172 hyp_boot:
7273 b omap_secondary_startup
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c+37−8
@@ -2112,11 +2112,20 @@ static struct omap_hwmod_ocp_if omap3_l4_core__i2c3 = { · 2111 unmodified lines
21122112 };
21132113
21142114 /* L4 CORE -> SR1 interface */
2115+static struct omap_hwmod_addr_space omap3_sr1_addr_space[] = {
2116+ {
2117+ .pa_start = OMAP34XX_SR1_BASE,
2118+ .pa_end = OMAP34XX_SR1_BASE + SZ_1K - 1,
2119+ .flags = ADDR_TYPE_RT,
2120+ },
2121+ { },
2122+};
21152123
21162124 static struct omap_hwmod_ocp_if omap34xx_l4_core__sr1 = {
21172125 .master = &omap3xxx_l4_core_hwmod,
21182126 .slave = &omap34xx_sr1_hwmod,
21192127 .clk = "sr_l4_ick",
2128+ .addr = omap3_sr1_addr_space,
21202129 .user = OCP_USER_MPU,
21212130 };
21222131
@@ -2124,15 +2133,25 @@ static struct omap_hwmod_ocp_if omap36xx_l4_core__sr1 = { · 1 unmodified line
21242133 .master = &omap3xxx_l4_core_hwmod,
21252134 .slave = &omap36xx_sr1_hwmod,
21262135 .clk = "sr_l4_ick",
2136+ .addr = omap3_sr1_addr_space,
21272137 .user = OCP_USER_MPU,
21282138 };
21292139
21302140 /* L4 CORE -> SR1 interface */
2141+static struct omap_hwmod_addr_space omap3_sr2_addr_space[] = {
2142+ {
2143+ .pa_start = OMAP34XX_SR2_BASE,
2144+ .pa_end = OMAP34XX_SR2_BASE + SZ_1K - 1,
2145+ .flags = ADDR_TYPE_RT,
2146+ },
2147+ { },
2148+};
21312149
21322150 static struct omap_hwmod_ocp_if omap34xx_l4_core__sr2 = {
21332151 .master = &omap3xxx_l4_core_hwmod,
21342152 .slave = &omap34xx_sr2_hwmod,
21352153 .clk = "sr_l4_ick",
2154+ .addr = omap3_sr2_addr_space,
21362155 .user = OCP_USER_MPU,
21372156 };
21382157
@@ -2140,6 +2159,7 @@ static struct omap_hwmod_ocp_if omap36xx_l4_core__sr2 = { · 1 unmodified line
21402159 .master = &omap3xxx_l4_core_hwmod,
21412160 .slave = &omap36xx_sr2_hwmod,
21422161 .clk = "sr_l4_ick",
2162+ .addr = omap3_sr2_addr_space,
21432163 .user = OCP_USER_MPU,
21442164 };
21452165
@@ -3111,16 +3131,20 @@ static struct omap_hwmod_ocp_if *omap3xxx_dss_hwmod_ocp_ifs[] __initdata = { · 965 unmodified lines
31113131 * Return: 0 if device named @dev_name is not likely to be accessible,
31123132 * or 1 if it is likely to be accessible.
31133133 */
3114−static int __init omap3xxx_hwmod_is_hs_ip_block_usable(struct device_node *bus,
3115− const char *dev_name)
3134+static bool __init omap3xxx_hwmod_is_hs_ip_block_usable(struct device_node *bus,
3135+ const char *dev_name)
31163136 {
3137+ struct device_node *node;
3138+ bool available;
3139+
31173140 if (!bus)
3118− return (omap_type() == OMAP2_DEVICE_TYPE_GP) ? 1 : 0;
3141+ return omap_type() == OMAP2_DEVICE_TYPE_GP;
31193142
3120− if (of_device_is_available(of_find_node_by_name(bus, dev_name)))
3121− return 1;
3143+ node = of_get_child_by_name(bus, dev_name);
3144+ available = of_device_is_available(node);
3145+ of_node_put(node);
31223146
3123− return 0;
3147+ return available;
31243148 }
31253149
31263150 int __init omap3xxx_hwmod_init(void)
@@ -3189,15 +3213,20 @@ int __init omap3xxx_hwmod_init(void) · 62 unmodified lines
31893213
31903214 if (h_sham && omap3xxx_hwmod_is_hs_ip_block_usable(bus, "sham")) {
31913215 r = omap_hwmod_register_links(h_sham);
3192− if (r < 0)
3216+ if (r < 0) {
3217+ of_node_put(bus);
31933218 return r;
3219+ }
31943220 }
31953221
31963222 if (h_aes && omap3xxx_hwmod_is_hs_ip_block_usable(bus, "aes")) {
31973223 r = omap_hwmod_register_links(h_aes);
3198− if (r < 0)
3224+ if (r < 0) {
3225+ of_node_put(bus);
31993226 return r;
3227+ }
32003228 }
3229+ of_node_put(bus);
32013230
32023231 /*
32033232 * Register hwmod links specific to certain ES levels of a
arch/arm64/boot/dts/broadcom/ns2.dtsi+11−0
@@ -114,6 +114,7 @@ · 113 unmodified lines
114114 pcie0: pcie@20020000 {
115115 compatible = "brcm,iproc-pcie";
116116 reg = <0 0x20020000 0 0x1000>;
117+ dma-coherent;
117118
118119 #interrupt-cells = <1>;
119120 interrupt-map-mask = <0 0 0 0>;
@@ -144,6 +145,7 @@ · 24 unmodified lines
144145 pcie4: pcie@50020000 {
145146 compatible = "brcm,iproc-pcie";
146147 reg = <0 0x50020000 0 0x1000>;
148+ dma-coherent;
147149
148150 #interrupt-cells = <1>;
149151 interrupt-map-mask = <0 0 0 0>;
@@ -174,6 +176,7 @@ · 24 unmodified lines
174176 pcie8: pcie@60c00000 {
175177 compatible = "brcm,iproc-pcie-paxc";
176178 reg = <0 0x60c00000 0 0x1000>;
179+ dma-coherent;
177180 linux,pci-domain = <8>;
178181
179182 bus-range = <0x0 0x1>;
@@ -203,6 +206,7 @@ · 23 unmodified lines
203206 <0x61030000 0x100>;
204207 reg-names = "amac_base", "idm_base", "nicpm_base";
205208 interrupts = <GIC_SPI 341 IRQ_TYPE_LEVEL_HIGH>;
209+ dma-coherent;
206210 phy-handle = <&gphy0>;
207211 phy-mode = "rgmii";
208212 status = "disabled";
@@ -213,6 +217,7 @@ · 4 unmodified lines
213217 reg = <0x612c0000 0x445>; /* PDC FS0 regs */
214218 interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>;
215219 #mbox-cells = <1>;
220+ dma-coherent;
216221 brcm,rx-status-len = <32>;
217222 brcm,use-bcm-hdr;
218223 };
@@ -222,6 +227,7 @@ · 3 unmodified lines
222227 reg = <0x612e0000 0x445>; /* PDC FS1 regs */
223228 interrupts = <GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH>;
224229 #mbox-cells = <1>;
230+ dma-coherent;
225231 brcm,rx-status-len = <32>;
226232 brcm,use-bcm-hdr;
227233 };
@@ -231,6 +237,7 @@ · 3 unmodified lines
231237 reg = <0x61300000 0x445>; /* PDC FS2 regs */
232238 interrupts = <GIC_SPI 191 IRQ_TYPE_LEVEL_HIGH>;
233239 #mbox-cells = <1>;
240+ dma-coherent;
234241 brcm,rx-status-len = <32>;
235242 brcm,use-bcm-hdr;
236243 };
@@ -240,6 +247,7 @@ · 3 unmodified lines
240247 reg = <0x61320000 0x445>; /* PDC FS3 regs */
241248 interrupts = <GIC_SPI 193 IRQ_TYPE_LEVEL_HIGH>;
242249 #mbox-cells = <1>;
250+ dma-coherent;
243251 brcm,rx-status-len = <32>;
244252 brcm,use-bcm-hdr;
245253 };
@@ -644,6 +652,7 @@ · 398 unmodified lines
644652 sata: ahci@663f2000 {
645653 compatible = "brcm,iproc-ahci", "generic-ahci";
646654 reg = <0x663f2000 0x1000>;
655+ dma-coherent;
647656 reg-names = "ahci";
648657 interrupts = <GIC_SPI 438 IRQ_TYPE_LEVEL_HIGH>;
649658 #address-cells = <1>;
@@ -667,6 +676,7 @@ · 17 unmodified lines
667676 compatible = "brcm,sdhci-iproc-cygnus";
668677 reg = <0x66420000 0x100>;
669678 interrupts = <GIC_SPI 421 IRQ_TYPE_LEVEL_HIGH>;
679+ dma-coherent;
670680 bus-width = <8>;
671681 clocks = <&genpll_sw BCM_NS2_GENPLL_SW_SDIO_CLK>;
672682 status = "disabled";
@@ -676,6 +686,7 @@ · 3 unmodified lines
676686 compatible = "brcm,sdhci-iproc-cygnus";
677687 reg = <0x66430000 0x100>;
678688 interrupts = <GIC_SPI 422 IRQ_TYPE_LEVEL_HIGH>;
689+ dma-coherent;
679690 bus-width = <8>;
680691 clocks = <&genpll_sw BCM_NS2_GENPLL_SW_SDIO_CLK>;
681692 status = "disabled";
arch/arm64/include/asm/unistd.h+1−1
@@ -44,7 +44,7 @@ · 43 unmodified lines
4444 #define __ARM_NR_compat_cacheflush (__ARM_NR_COMPAT_BASE+2)
4545 #define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE+5)
4646
47−#define __NR_compat_syscalls 394
47+#define __NR_compat_syscalls 398
4848 #endif
4949
5050 #define __ARCH_WANT_SYS_CLONE
arch/arm64/include/asm/unistd32.h+8−0
@@ -809,6 +809,14 @@ __SYSCALL(__NR_copy_file_range, sys_copy_file_range) · 808 unmodified lines
809809 __SYSCALL(__NR_preadv2, compat_sys_preadv2)
810810 #define __NR_pwritev2 393
811811 __SYSCALL(__NR_pwritev2, compat_sys_pwritev2)
812+#define __NR_pkey_mprotect 394
813+__SYSCALL(__NR_pkey_mprotect, sys_pkey_mprotect)
814+#define __NR_pkey_alloc 395
815+__SYSCALL(__NR_pkey_alloc, sys_pkey_alloc)
816+#define __NR_pkey_free 396
817+__SYSCALL(__NR_pkey_free, sys_pkey_free)
818+#define __NR_statx 397
819+__SYSCALL(__NR_statx, sys_statx)
812820
813821 /*
814822 * Please add new compat syscalls above this comment and update
arch/arm64/kernel/kaslr.c+7−3
@@ -131,11 +131,15 @@ u64 __init kaslr_early_init(u64 dt_phys, u64 modulo_offset) · 130 unmodified lines
131131 /*
132132 * The kernel Image should not extend across a 1GB/32MB/512MB alignment
133133 * boundary (for 4KB/16KB/64KB granule kernels, respectively). If this
134− * happens, increase the KASLR offset by the size of the kernel image.
134+ * happens, increase the KASLR offset by the size of the kernel image
135+ * rounded up by SWAPPER_BLOCK_SIZE.
135136 */
136137 if ((((u64)_text + offset + modulo_offset) >> SWAPPER_TABLE_SHIFT) !=
137− (((u64)_end + offset + modulo_offset) >> SWAPPER_TABLE_SHIFT))
138− offset = (offset + (u64)(_end - _text)) & mask;
138+ (((u64)_end + offset + modulo_offset) >> SWAPPER_TABLE_SHIFT)) {
139+ u64 kimg_sz = _end - _text;
140+ offset = (offset + round_up(kimg_sz, SWAPPER_BLOCK_SIZE))
141+ & mask;
142+ }
139143
140144 if (IS_ENABLED(CONFIG_KASAN))
141145 /*
arch/powerpc/kernel/idle_book3s.S+17−3
@@ -449,9 +449,23 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) · 448 unmodified lines
449449 _GLOBAL(pnv_wakeup_tb_loss)
450450 ld r1,PACAR1(r13)
451451 /*
452− * Before entering any idle state, the NVGPRs are saved in the stack
453− * and they are restored before switching to the process context. Hence
454− * until they are restored, they are free to be used.
452+ * Before entering any idle state, the NVGPRs are saved in the stack.
453+ * If there was a state loss, or PACA_NAPSTATELOST was set, then the
454+ * NVGPRs are restored. If we are here, it is likely that state is lost,
455+ * but not guaranteed -- neither ISA207 nor ISA300 tests to reach
456+ * here are the same as the test to restore NVGPRS:
457+ * PACA_THREAD_IDLE_STATE test for ISA207, PSSCR test for ISA300,
458+ * and SRR1 test for restoring NVGPRs.
459+ *
460+ * We are about to clobber NVGPRs now, so set NAPSTATELOST to
461+ * guarantee they will always be restored. This might be tightened
462+ * with careful reading of specs (particularly for ISA300) but this
463+ * is already a slow wakeup path and it's simpler to be safe.
464+ */
465+ li r0,1
466+ stb r0,PACA_NAPSTATELOST(r13)
467+
468+ /*
455469 *
456470 * Save SRR1 and LR in NVGPRs as they might be clobbered in
457471 * opal_call() (called in CHECK_HMI_INTERRUPT). SRR1 is required
arch/powerpc/mm/init_64.c+1−2
@@ -397,8 +397,7 @@ static void early_check_vec5(void) · 396 unmodified lines
397397 void __init mmu_early_init_devtree(void)
398398 {
399399 /* Disable radix mode based on kernel command line. */
400− /* We don't yet have the machinery to do radix as a guest. */
401− if (disable_radix || !(mfmsr() & MSR_HV))
400+ if (disable_radix)
402401 cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX;
403402
404403 /*
block/blk-mq.c+1−10
@@ -697,17 +697,8 @@ static void blk_mq_check_expired(struct blk_mq_hw_ctx *hctx, · 696 unmodified lines
697697 {
698698 struct blk_mq_timeout_data *data = priv;
699699
700− if (!test_bit(REQ_ATOM_STARTED, &rq->atomic_flags)) {
701− /*
702− * If a request wasn't started before the queue was
703− * marked dying, kill it here or it'll go unnoticed.
704− */
705− if (unlikely(blk_queue_dying(rq->q))) {
706− rq->errors = -EIO;
707− blk_mq_end_request(rq, rq->errors);
708− }
700+ if (!test_bit(REQ_ATOM_STARTED, &rq->atomic_flags))
709701 return;
710− }
711702
712703 if (time_after_eq(jiffies, rq->deadline)) {
713704 if (!blk_mark_rq_complete(rq))
block/blk-stat.c+2−2
@@ -30,11 +30,11 @@ static void blk_stat_flush_batch(struct blk_rq_stat *stat) · 29 unmodified lines
3030
3131 static void blk_stat_sum(struct blk_rq_stat *dst, struct blk_rq_stat *src)
3232 {
33+ blk_stat_flush_batch(src);
34+
3335 if (!src->nr_samples)
3436 return;
3537
36− blk_stat_flush_batch(src);
37−
3838 dst->min = min(dst->min, src->min);
3939 dst->max = max(dst->max, src->max);
4040
drivers/acpi/spcr.c+1−1
@@ -30,7 +30,7 @@ static bool qdf2400_erratum_44_present(struct acpi_table_header *h) · 29 unmodified lines
3030 return true;
3131
3232 if (!memcmp(h->oem_table_id, "QDF2400 ", ACPI_OEM_TABLE_ID_SIZE) &&
33− h->oem_revision == 0)
33+ h->oem_revision == 1)
3434 return true;
3535
3636 return false;
drivers/auxdisplay/img-ascii-lcd.c+1−0
@@ -218,6 +218,7 @@ static const struct of_device_id img_ascii_lcd_matches[] = { · 217 unmodified lines
218218 { .compatible = "img,boston-lcd", .data = &boston_config },
219219 { .compatible = "mti,malta-lcd", .data = &malta_config },
220220 { .compatible = "mti,sead3-lcd", .data = &sead3_config },
221+ { /* sentinel */ }
221222 };
222223
223224 /**
drivers/bluetooth/Kconfig+2−1
@@ -344,7 +344,8 @@ config BT_WILINK · 343 unmodified lines
344344
345345 config BT_QCOMSMD
346346 tristate "Qualcomm SMD based HCI support"
347− depends on (QCOM_SMD && QCOM_WCNSS_CTRL) || COMPILE_TEST
347+ depends on QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n)
348+ depends on QCOM_WCNSS_CTRL || (COMPILE_TEST && QCOM_WCNSS_CTRL=n)
348349 select BT_QCA
349350 help
350351 Qualcomm SMD based HCI driver.
drivers/char/hw_random/amd-rng.c+34−8
@@ -55,6 +55,7 @@ MODULE_DEVICE_TABLE(pci, pci_tbl); · 54 unmodified lines
5555 struct amd768_priv {
5656 void __iomem *iobase;
5757 struct pci_dev *pcidev;
58+ u32 pmbase;
5859 };
5960
6061 static int amd_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
@@ -148,33 +149,58 @@ found: · 87 unmodified lines
148149 if (pmbase == 0)
149150 return -EIO;
150151
151− priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
152+ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
152153 if (!priv)
153154 return -ENOMEM;
154155
155− if (!devm_request_region(&pdev->dev, pmbase + PMBASE_OFFSET,
156− PMBASE_SIZE, DRV_NAME)) {
156+ if (!request_region(pmbase + PMBASE_OFFSET, PMBASE_SIZE, DRV_NAME)) {
157157 dev_err(&pdev->dev, DRV_NAME " region 0x%x already in use!\n",
158158 pmbase + 0xF0);
159− return -EBUSY;
159+ err = -EBUSY;
160+ goto out;
160161 }
161162
162− priv->iobase = devm_ioport_map(&pdev->dev, pmbase + PMBASE_OFFSET,
163− PMBASE_SIZE);
163+ priv->iobase = ioport_map(pmbase + PMBASE_OFFSET, PMBASE_SIZE);
164164 if (!priv->iobase) {
165165 pr_err(DRV_NAME "Cannot map ioport\n");
166− return -ENOMEM;
166+ err = -EINVAL;
167+ goto err_iomap;
167168 }
168169
169170 amd_rng.priv = (unsigned long)priv;
171+ priv->pmbase = pmbase;
170172 priv->pcidev = pdev;
171173
172174 pr_info(DRV_NAME " detected\n");
173− return devm_hwrng_register(&pdev->dev, &amd_rng);
175+ err = hwrng_register(&amd_rng);
176+ if (err) {
177+ pr_err(DRV_NAME " registering failed (%d)\n", err);
178+ goto err_hwrng;
179+ }
180+ return 0;
181+
182+err_hwrng:
183+ ioport_unmap(priv->iobase);
184+err_iomap:
185+ release_region(pmbase + PMBASE_OFFSET, PMBASE_SIZE);
186+out:
187+ kfree(priv);
188+ return err;
174189 }
175190
176191 static void __exit mod_exit(void)
177192 {
193+ struct amd768_priv *priv;
194+
195+ priv = (struct amd768_priv *)amd_rng.priv;
196+
197+ hwrng_unregister(&amd_rng);
198+
199+ ioport_unmap(priv->iobase);
200+
201+ release_region(priv->pmbase + PMBASE_OFFSET, PMBASE_SIZE);
202+
203+ kfree(priv);
178204 }
179205
180206 module_init(mod_init);
drivers/char/hw_random/geode-rng.c+35−15
@@ -31,6 +31,9 @@ · 30 unmodified lines
3131 #include <linux/module.h>
3232 #include <linux/pci.h>
3333
34+
35+#define PFX KBUILD_MODNAME ": "
36+
3437 #define GEODE_RNG_DATA_REG 0x50
3538 #define GEODE_RNG_STATUS_REG 0x54
3639
@@ -82,6 +85,7 @@ static struct hwrng geode_rng = { · 45 unmodified lines
8285
8386 static int __init mod_init(void)
8487 {
88+ int err = -ENODEV;
8589 struct pci_dev *pdev = NULL;
8690 const struct pci_device_id *ent;
8791 void __iomem *mem;
@@ -89,27 +93,43 @@ static int __init mod_init(void) · 1 unmodified line
8993
9094 for_each_pci_dev(pdev) {
9195 ent = pci_match_id(pci_tbl, pdev);
92− if (ent) {
93− rng_base = pci_resource_start(pdev, 0);
94− if (rng_base == 0)
95− return -ENODEV;
96−
97− mem = devm_ioremap(&pdev->dev, rng_base, 0x58);
98− if (!mem)
99− return -ENOMEM;
100− geode_rng.priv = (unsigned long)mem;
101−
102− pr_info("AMD Geode RNG detected\n");
103− return devm_hwrng_register(&pdev->dev, &geode_rng);
104− }
96+ if (ent)
97+ goto found;
10598 }
106−
10799 /* Device not found. */
108− return -ENODEV;
100+ goto out;
101+
102+found:
103+ rng_base = pci_resource_start(pdev, 0);
104+ if (rng_base == 0)
105+ goto out;
106+ err = -ENOMEM;
107+ mem = ioremap(rng_base, 0x58);
108+ if (!mem)
109+ goto out;
110+ geode_rng.priv = (unsigned long)mem;
111+
112+ pr_info("AMD Geode RNG detected\n");
113+ err = hwrng_register(&geode_rng);
114+ if (err) {
115+ pr_err(PFX "RNG registering failed (%d)\n",
116+ err);
117+ goto err_unmap;
118+ }
119+out:
120+ return err;
121+
122+err_unmap:
123+ iounmap(mem);
124+ goto out;
109125 }
110126
111127 static void __exit mod_exit(void)
112128 {
129+ void __iomem *mem = (void __iomem *)geode_rng.priv;
130+
131+ hwrng_unregister(&geode_rng);
132+ iounmap(mem);
113133 }
114134
115135 module_init(mod_init);
drivers/char/ppdev.c+9−2
@@ -84,11 +84,14 @@ struct pp_struct { · 83 unmodified lines
8484 struct ieee1284_info state;
8585 struct ieee1284_info saved_state;
8686 long default_inactivity;
87+ int index;
8788 };
8889
8990 /* should we use PARDEVICE_MAX here? */
9091 static struct device *devices[PARPORT_MAX];
9192
93+static DEFINE_IDA(ida_index);
94+
9295 /* pp_struct.flags bitfields */
9396 #define PP_CLAIMED (1<<0)
9497 #define PP_EXCL (1<<1)
@@ -290,7 +293,7 @@ static int register_device(int minor, struct pp_struct *pp) · 195 unmodified lines
290293 struct pardevice *pdev = NULL;
291294 char *name;
292295 struct pardev_cb ppdev_cb;
293− int rc = 0;
296+ int rc = 0, index;
294297
295298 name = kasprintf(GFP_KERNEL, CHRDEV "%x", minor);
296299 if (name == NULL)
@@ -303,20 +306,23 @@ static int register_device(int minor, struct pp_struct *pp) · 6 unmodified lines
303306 goto err;
304307 }
305308
309+ index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL);
306310 memset(&ppdev_cb, 0, sizeof(ppdev_cb));
307311 ppdev_cb.irq_func = pp_irq;
308312 ppdev_cb.flags = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0;
309313 ppdev_cb.private = pp;
310− pdev = parport_register_dev_model(port, name, &ppdev_cb, minor);
314+ pdev = parport_register_dev_model(port, name, &ppdev_cb, index);
311315 parport_put_port(port);
312316
313317 if (!pdev) {
314318 pr_warn("%s: failed to register device!\n", name);
315319 rc = -ENXIO;
320+ ida_simple_remove(&ida_index, index);
316321 goto err;
317322 }
318323
319324 pp->pdev = pdev;
325+ pp->index = index;
320326 dev_dbg(&pdev->dev, "registered pardevice\n");
321327 err:
322328 kfree(name);
@@ -755,6 +761,7 @@ static int pp_release(struct inode *inode, struct file *file) · 432 unmodified lines
755761
756762 if (pp->pdev) {
757763 parport_unregister_device(pp->pdev);
764+ ida_simple_remove(&ida_index, pp->index);
758765 pp->pdev = NULL;
759766 pr_debug(CHRDEV "%x: unregistered pardevice\n", minor);
760767 }
drivers/clk/clk.c+2−1
@@ -2502,7 +2502,7 @@ struct clk *__clk_create_clk(struct clk_hw *hw, const char *dev_id, · 2501 unmodified lines
25022502
25032503 clk->core = hw->core;
25042504 clk->dev_id = dev_id;
2505− clk->con_id = con_id;
2505+ clk->con_id = kstrdup_const(con_id, GFP_KERNEL);
25062506 clk->max_rate = ULONG_MAX;
25072507
25082508 clk_prepare_lock();
@@ -2518,6 +2518,7 @@ void __clk_free_clk(struct clk *clk) · 9 unmodified lines
25182518 hlist_del(&clk->clks_node);
25192519 clk_prepare_unlock();
25202520
2521+ kfree_const(clk->con_id);
25212522 kfree(clk);
25222523 }
25232524
drivers/clk/rockchip/clk-rk3036.c+8−1
@@ -127,7 +127,7 @@ PNAME(mux_ddrphy_p) = { "dpll_ddr", "gpll_ddr" }; · 126 unmodified lines
127127 PNAME(mux_pll_src_3plls_p) = { "apll", "dpll", "gpll" };
128128 PNAME(mux_timer_p) = { "xin24m", "pclk_peri_src" };
129129
130−PNAME(mux_pll_src_apll_dpll_gpll_usb480m_p) = { "apll", "dpll", "gpll" "usb480m" };
130+PNAME(mux_pll_src_apll_dpll_gpll_usb480m_p) = { "apll", "dpll", "gpll", "usb480m" };
131131
132132 PNAME(mux_mmc_src_p) = { "apll", "dpll", "gpll", "xin24m" };
133133 PNAME(mux_i2s_pre_p) = { "i2s_src", "i2s_frac", "ext_i2s", "xin12m" };
@@ -450,6 +450,13 @@ static void __init rk3036_clk_init(struct device_node *np) · 316 unmodified lines
450450 return;
451451 }
452452
453+ /*
454+ * Make uart_pll_clk a child of the gpll, as all other sources are
455+ * not that usable / stable.
456+ */
457+ writel_relaxed(HIWORD_UPDATE(0x2, 0x3, 10),
458+ reg_base + RK2928_CLKSEL_CON(13));
459+
453460 ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
454461 if (IS_ERR(ctx)) {
455462 pr_err("%s: rockchip clk init failed\n", __func__);
drivers/clk/sunxi-ng/Kconfig+1−0
@@ -80,6 +80,7 @@ config SUN6I_A31_CCU · 79 unmodified lines
8080 select SUNXI_CCU_DIV
8181 select SUNXI_CCU_NK
8282 select SUNXI_CCU_NKM
83+ select SUNXI_CCU_NKMP
8384 select SUNXI_CCU_NM
8485 select SUNXI_CCU_MP
8586 select SUNXI_CCU_PHASE
drivers/clk/sunxi-ng/ccu-sun50i-a64.c+1−1
@@ -566,7 +566,7 @@ static SUNXI_CCU_M_WITH_GATE(gpu_clk, "gpu", "pll-gpu", · 565 unmodified lines
566566 0x1a0, 0, 3, BIT(31), CLK_SET_RATE_PARENT);
567567
568568 /* Fixed Factor clocks */
569−static CLK_FIXED_FACTOR(osc12M_clk, "osc12M", "osc24M", 1, 2, 0);
569+static CLK_FIXED_FACTOR(osc12M_clk, "osc12M", "osc24M", 2, 1, 0);
570570
571571 /* We hardcode the divider to 4 for now */
572572 static CLK_FIXED_FACTOR(pll_audio_clk, "pll-audio",
drivers/clk/sunxi-ng/ccu-sun6i-a31.c+1−1
@@ -608,7 +608,7 @@ static SUNXI_CCU_M_WITH_MUX_GATE(hdmi_clk, "hdmi", lcd_ch1_parents, · 607 unmodified lines
608608 0x150, 0, 4, 24, 2, BIT(31),
609609 CLK_SET_RATE_PARENT);
610610
611−static SUNXI_CCU_GATE(hdmi_ddc_clk, "hdmi-ddc", "osc24M", 0x150, BIT(31), 0);
611+static SUNXI_CCU_GATE(hdmi_ddc_clk, "hdmi-ddc", "osc24M", 0x150, BIT(30), 0);
612612
613613 static SUNXI_CCU_GATE(ps_clk, "ps", "lcd1-ch1", 0x140, BIT(31), 0);
614614
drivers/clk/sunxi-ng/ccu_mp.c+8−0
@@ -85,6 +85,10 @@ static unsigned long ccu_mp_recalc_rate(struct clk_hw *hw, · 84 unmodified lines
8585 unsigned int m, p;
8686 u32 reg;
8787
88+ /* Adjust parent_rate according to pre-dividers */
89+ ccu_mux_helper_adjust_parent_for_prediv(&cmp->common, &cmp->mux,
90+ -1, &parent_rate);
91+
8892 reg = readl(cmp->common.base + cmp->common.reg);
8993
9094 m = reg >> cmp->m.shift;
@@ -117,6 +121,10 @@ static int ccu_mp_set_rate(struct clk_hw *hw, unsigned long rate, · 26 unmodified lines
117121 unsigned int m, p;
118122 u32 reg;
119123
124+ /* Adjust parent_rate according to pre-dividers */
125+ ccu_mux_helper_adjust_parent_for_prediv(&cmp->common, &cmp->mux,
126+ -1, &parent_rate);
127+
120128 max_m = cmp->m.max ?: 1 << cmp->m.width;
121129 max_p = cmp->p.max ?: 1 << ((1 << cmp->p.width) - 1);
122130
drivers/clk/sunxi-ng/ccu_nkmp.c+1−1
@@ -107,7 +107,7 @@ static unsigned long ccu_nkmp_recalc_rate(struct clk_hw *hw, · 106 unmodified lines
107107 p = reg >> nkmp->p.shift;
108108 p &= (1 << nkmp->p.width) - 1;
109109
110− return parent_rate * n * k >> p / m;
110+ return (parent_rate * n * k >> p) / m;
111111 }
112112
113113 static long ccu_nkmp_round_rate(struct clk_hw *hw, unsigned long rate,
drivers/cpufreq/cpufreq.c+3−0
@@ -1184,6 +1184,9 @@ static int cpufreq_online(unsigned int cpu) · 1183 unmodified lines
11841184 for_each_cpu(j, policy->related_cpus)
11851185 per_cpu(cpufreq_cpu_data, j) = policy;
11861186 write_unlock_irqrestore(&cpufreq_driver_lock, flags);
1187+ } else {
1188+ policy->min = policy->user_policy.min;
1189+ policy->max = policy->user_policy.max;
11871190 }
11881191
11891192 if (cpufreq_driver->get && !cpufreq_driver->setpolicy) {
drivers/cpufreq/intel_pstate.c+50−117
@@ -364,9 +364,7 @@ static bool driver_registered __read_mostly; · 363 unmodified lines
364364 static bool acpi_ppc;
365365 #endif
366366
367−static struct perf_limits performance_limits;
368−static struct perf_limits powersave_limits;
369−static struct perf_limits *limits;
367+static struct perf_limits global;
370368
371369 static void intel_pstate_init_limits(struct perf_limits *limits)
372370 {
@@ -377,14 +375,6 @@ static void intel_pstate_init_limits(struct perf_limits *limits) · 4 unmodified lines
377375 limits->max_sysfs_pct = 100;
378376 }
379377
380−static void intel_pstate_set_performance_limits(struct perf_limits *limits)
381−{
382− intel_pstate_init_limits(limits);
383− limits->min_perf_pct = 100;
384− limits->min_perf = int_ext_tofp(1);
385− limits->min_sysfs_pct = 100;
386−}
387−
388378 static DEFINE_MUTEX(intel_pstate_driver_lock);
389379 static DEFINE_MUTEX(intel_pstate_limits_lock);
390380
@@ -507,7 +497,7 @@ static void intel_pstate_init_acpi_perf_limits(struct cpufreq_policy *policy) · 116 unmodified lines
507497 * correct max turbo frequency based on the turbo state.
508498 * Also need to convert to MHz as _PSS freq is in MHz.
509499 */
510− if (!limits->turbo_disabled)
500+ if (!global.turbo_disabled)
511501 cpu->acpi_perf_data.states[0].core_frequency =
512502 policy->cpuinfo.max_freq / 1000;
513503 cpu->valid_pss_table = true;
@@ -626,7 +616,7 @@ static inline void update_turbo_state(void) · 112 unmodified lines
626616
627617 cpu = all_cpu_data[0];
628618 rdmsrl(MSR_IA32_MISC_ENABLE, misc_en);
629− limits->turbo_disabled =
619+ global.turbo_disabled =
630620 (misc_en & MSR_IA32_MISC_ENABLE_TURBO_DISABLE ||
631621 cpu->pstate.max_pstate == cpu->pstate.turbo_pstate);
632622 }
@@ -851,7 +841,7 @@ static struct freq_attr *hwp_cpufreq_attrs[] = { · 218 unmodified lines
851841 static void intel_pstate_hwp_set(struct cpufreq_policy *policy)
852842 {
853843 int min, hw_min, max, hw_max, cpu;
854− struct perf_limits *perf_limits = limits;
844+ struct perf_limits *perf_limits = &global;
855845 u64 value, cap;
856846
857847 for_each_cpu(cpu, policy->cpus) {
@@ -863,19 +853,22 @@ static void intel_pstate_hwp_set(struct cpufreq_policy *policy) · 5 unmodified lines
863853
864854 rdmsrl_on_cpu(cpu, MSR_HWP_CAPABILITIES, &cap);
865855 hw_min = HWP_LOWEST_PERF(cap);
866− if (limits->no_turbo)
856+ if (global.no_turbo)
867857 hw_max = HWP_GUARANTEED_PERF(cap);
868858 else
869859 hw_max = HWP_HIGHEST_PERF(cap);
870860
871− min = fp_ext_toint(hw_max * perf_limits->min_perf);
861+ max = fp_ext_toint(hw_max * perf_limits->max_perf);
862+ if (cpu_data->policy == CPUFREQ_POLICY_PERFORMANCE)
863+ min = max;
864+ else
865+ min = fp_ext_toint(hw_max * perf_limits->min_perf);
872866
873867 rdmsrl_on_cpu(cpu, MSR_HWP_REQUEST, &value);
874868
875869 value &= ~HWP_MIN_PERF(~0L);
876870 value |= HWP_MIN_PERF(min);
877871
878− max = fp_ext_toint(hw_max * perf_limits->max_perf);
879872 value &= ~HWP_MAX_PERF(~0L);
880873 value |= HWP_MAX_PERF(max);
881874
@@ -968,20 +961,11 @@ static int intel_pstate_resume(struct cpufreq_policy *policy) · 86 unmodified lines
968961 }
969962
970963 static void intel_pstate_update_policies(void)
971− __releases(&intel_pstate_limits_lock)
972− __acquires(&intel_pstate_limits_lock)
973964 {
974− struct perf_limits *saved_limits = limits;
975965 int cpu;
976966
977− mutex_unlock(&intel_pstate_limits_lock);
978−
979967 for_each_possible_cpu(cpu)
980968 cpufreq_update_policy(cpu);
981−
982− mutex_lock(&intel_pstate_limits_lock);
983−
984− limits = saved_limits;
985969 }
986970
987971 /************************** debugfs begin ************************/
@@ -1060,7 +1044,7 @@ static void intel_pstate_debug_hide_params(void) · 72 unmodified lines
10601044 static ssize_t show_##file_name \
10611045 (struct kobject *kobj, struct attribute *attr, char *buf) \
10621046 { \
1063− return sprintf(buf, "%u\n", limits->object); \
1047+ return sprintf(buf, "%u\n", global.object); \
10641048 }
10651049
10661050 static ssize_t intel_pstate_show_status(char *buf);
@@ -1151,10 +1135,10 @@ static ssize_t show_no_turbo(struct kobject *kobj, · 84 unmodified lines
11511135 }
11521136
11531137 update_turbo_state();
1154− if (limits->turbo_disabled)
1155− ret = sprintf(buf, "%u\n", limits->turbo_disabled);
1138+ if (global.turbo_disabled)
1139+ ret = sprintf(buf, "%u\n", global.turbo_disabled);
11561140 else
1157− ret = sprintf(buf, "%u\n", limits->no_turbo);
1141+ ret = sprintf(buf, "%u\n", global.no_turbo);
11581142
11591143 mutex_unlock(&intel_pstate_driver_lock);
11601144
@@ -1181,19 +1165,19 @@ static ssize_t store_no_turbo(struct kobject *a, struct attribute *b, · 20 unmodified lines
11811165 mutex_lock(&intel_pstate_limits_lock);
11821166
11831167 update_turbo_state();
1184− if (limits->turbo_disabled) {
1168+ if (global.turbo_disabled) {
11851169 pr_warn("Turbo disabled by BIOS or unavailable on processor\n");
11861170 mutex_unlock(&intel_pstate_limits_lock);
11871171 mutex_unlock(&intel_pstate_driver_lock);
11881172 return -EPERM;
11891173 }
11901174
1191− limits->no_turbo = clamp_t(int, input, 0, 1);
1192−
1193− intel_pstate_update_policies();
1175+ global.no_turbo = clamp_t(int, input, 0, 1);
11941176
11951177 mutex_unlock(&intel_pstate_limits_lock);
11961178
1179+ intel_pstate_update_policies();
1180+
11971181 mutex_unlock(&intel_pstate_driver_lock);
11981182
11991183 return count;
@@ -1218,19 +1202,16 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b, · 18 unmodified lines
12181202
12191203 mutex_lock(&intel_pstate_limits_lock);
12201204
1221− limits->max_sysfs_pct = clamp_t(int, input, 0 , 100);
1222− limits->max_perf_pct = min(limits->max_policy_pct,
1223− limits->max_sysfs_pct);
1224− limits->max_perf_pct = max(limits->min_policy_pct,
1225− limits->max_perf_pct);
1226− limits->max_perf_pct = max(limits->min_perf_pct,
1227− limits->max_perf_pct);
1228− limits->max_perf = percent_ext_fp(limits->max_perf_pct);
1229−
1230− intel_pstate_update_policies();
1205+ global.max_sysfs_pct = clamp_t(int, input, 0 , 100);
1206+ global.max_perf_pct = min(global.max_policy_pct, global.max_sysfs_pct);
1207+ global.max_perf_pct = max(global.min_policy_pct, global.max_perf_pct);
1208+ global.max_perf_pct = max(global.min_perf_pct, global.max_perf_pct);
1209+ global.max_perf = percent_ext_fp(global.max_perf_pct);
12311210
12321211 mutex_unlock(&intel_pstate_limits_lock);
12331212
1213+ intel_pstate_update_policies();
1214+
12341215 mutex_unlock(&intel_pstate_driver_lock);
12351216
12361217 return count;
@@ -1255,19 +1236,16 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b, · 18 unmodified lines
12551236
12561237 mutex_lock(&intel_pstate_limits_lock);
12571238
1258− limits->min_sysfs_pct = clamp_t(int, input, 0 , 100);
1259− limits->min_perf_pct = max(limits->min_policy_pct,
1260− limits->min_sysfs_pct);
1261− limits->min_perf_pct = min(limits->max_policy_pct,
1262− limits->min_perf_pct);
1263− limits->min_perf_pct = min(limits->max_perf_pct,
1264− limits->min_perf_pct);
1265− limits->min_perf = percent_ext_fp(limits->min_perf_pct);
1266−
1267− intel_pstate_update_policies();
1239+ global.min_sysfs_pct = clamp_t(int, input, 0 , 100);
1240+ global.min_perf_pct = max(global.min_policy_pct, global.min_sysfs_pct);
1241+ global.min_perf_pct = min(global.max_policy_pct, global.min_perf_pct);
1242+ global.min_perf_pct = min(global.max_perf_pct, global.min_perf_pct);
1243+ global.min_perf = percent_ext_fp(global.min_perf_pct);
12681244
12691245 mutex_unlock(&intel_pstate_limits_lock);
12701246
1247+ intel_pstate_update_policies();
1248+
12711249 mutex_unlock(&intel_pstate_driver_lock);
12721250
12731251 return count;
@@ -1387,7 +1365,7 @@ static u64 atom_get_val(struct cpudata *cpudata, int pstate) · 113 unmodified lines
13871365 u32 vid;
13881366
13891367 val = (u64)pstate << 8;
1390− if (limits->no_turbo && !limits->turbo_disabled)
1368+ if (global.no_turbo && !global.turbo_disabled)
13911369 val |= (u64)1 << 32;
13921370
13931371 vid_fp = cpudata->vid.min + mul_fp(
@@ -1557,7 +1535,7 @@ static u64 core_get_val(struct cpudata *cpudata, int pstate) · 163 unmodified lines
15571535 u64 val;
15581536
15591537 val = (u64)pstate << 8;
1560− if (limits->no_turbo && !limits->turbo_disabled)
1538+ if (global.no_turbo && !global.turbo_disabled)
15611539 val |= (u64)1 << 32;
15621540
15631541 return val;
@@ -1683,9 +1661,9 @@ static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max) · 119 unmodified lines
16831661 int max_perf = cpu->pstate.turbo_pstate;
16841662 int max_perf_adj;
16851663 int min_perf;
1686− struct perf_limits *perf_limits = limits;
1664+ struct perf_limits *perf_limits = &global;
16871665
1688− if (limits->no_turbo || limits->turbo_disabled)
1666+ if (global.no_turbo || global.turbo_disabled)
16891667 max_perf = cpu->pstate.max_pstate;
16901668
16911669 if (per_cpu_limits)
@@ -1820,7 +1798,7 @@ static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu) · 128 unmodified lines
18201798
18211799 sample->busy_scaled = busy_frac * 100;
18221800
1823− target = limits->no_turbo || limits->turbo_disabled ?
1801+ target = global.no_turbo || global.turbo_disabled ?
18241802 cpu->pstate.max_pstate : cpu->pstate.turbo_pstate;
18251803 target += target >> 2;
18261804 target = mul_fp(target, busy_frac);
@@ -2116,7 +2094,7 @@ static void intel_pstate_update_perf_limits(struct cpufreq_policy *policy, · 289 unmodified lines
21162094 static int intel_pstate_set_policy(struct cpufreq_policy *policy)
21172095 {
21182096 struct cpudata *cpu;
2119− struct perf_limits *perf_limits = NULL;
2097+ struct perf_limits *perf_limits = &global;
21202098
21212099 if (!policy->cpuinfo.max_freq)
21222100 return -ENODEV;
@@ -2139,21 +2117,6 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) · 16 unmodified lines
21392117
21402118 mutex_lock(&intel_pstate_limits_lock);
21412119
2142− if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) {
2143− pr_debug("set performance\n");
2144− if (!perf_limits) {
2145− limits = &performance_limits;
2146− perf_limits = limits;
2147− }
2148− } else {
2149− pr_debug("set powersave\n");
2150− if (!perf_limits) {
2151− limits = &powersave_limits;
2152− perf_limits = limits;
2153− }
2154−
2155− }
2156−
21572120 intel_pstate_update_perf_limits(policy, perf_limits);
21582121
21592122 if (cpu->policy == CPUFREQ_POLICY_PERFORMANCE) {
@@ -2177,16 +2140,9 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) · 17 unmodified lines
21772140 static int intel_pstate_verify_policy(struct cpufreq_policy *policy)
21782141 {
21792142 struct cpudata *cpu = all_cpu_data[policy->cpu];
2180− struct perf_limits *perf_limits;
2181−
2182− if (policy->policy == CPUFREQ_POLICY_PERFORMANCE)
2183− perf_limits = &performance_limits;
2184− else
2185− perf_limits = &powersave_limits;
21862143
21872144 update_turbo_state();
2188− policy->cpuinfo.max_freq = perf_limits->turbo_disabled ||
2189− perf_limits->no_turbo ?
2145+ policy->cpuinfo.max_freq = global.turbo_disabled || global.no_turbo ?
21902146 cpu->pstate.max_freq :
21912147 cpu->pstate.turbo_freq;
21922148
@@ -2201,9 +2157,9 @@ static int intel_pstate_verify_policy(struct cpufreq_policy *policy) · 8 unmodified lines
22012157 unsigned int max_freq, min_freq;
22022158
22032159 max_freq = policy->cpuinfo.max_freq *
2204− perf_limits->max_sysfs_pct / 100;
2160+ global.max_sysfs_pct / 100;
22052161 min_freq = policy->cpuinfo.max_freq *
2206− perf_limits->min_sysfs_pct / 100;
2162+ global.min_sysfs_pct / 100;
22072163 cpufreq_verify_within_limits(policy, min_freq, max_freq);
22082164 }
22092165
@@ -2255,7 +2211,7 @@ static int __intel_pstate_cpu_init(struct cpufreq_policy *policy) · 45 unmodified lines
22552211 /* cpuinfo and default policy values */
22562212 policy->cpuinfo.min_freq = cpu->pstate.min_pstate * cpu->pstate.scaling;
22572213 update_turbo_state();
2258− policy->cpuinfo.max_freq = limits->turbo_disabled ?
2214+ policy->cpuinfo.max_freq = global.turbo_disabled ?
22592215 cpu->pstate.max_pstate : cpu->pstate.turbo_pstate;
22602216 policy->cpuinfo.max_freq *= cpu->pstate.scaling;
22612217
@@ -2275,7 +2231,7 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy) · 13 unmodified lines
22752231 return ret;
22762232
22772233 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
2278− if (limits->min_perf_pct == 100 && limits->max_perf_pct == 100)
2234+ if (IS_ENABLED(CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE))
22792235 policy->policy = CPUFREQ_POLICY_PERFORMANCE;
22802236 else
22812237 policy->policy = CPUFREQ_POLICY_POWERSAVE;
@@ -2301,7 +2257,7 @@ static int intel_cpufreq_verify_policy(struct cpufreq_policy *policy) · 19 unmodified lines
23012257 struct cpudata *cpu = all_cpu_data[policy->cpu];
23022258
23032259 update_turbo_state();
2304− policy->cpuinfo.max_freq = limits->turbo_disabled ?
2260+ policy->cpuinfo.max_freq = global.no_turbo || global.turbo_disabled ?
23052261 cpu->pstate.max_freq : cpu->pstate.turbo_freq;
23062262
23072263 cpufreq_verify_within_cpu_limits(policy);
@@ -2309,26 +2265,6 @@ static int intel_cpufreq_verify_policy(struct cpufreq_policy *policy) · 1 unmodified line
23092265 return 0;
23102266 }
23112267
2312−static unsigned int intel_cpufreq_turbo_update(struct cpudata *cpu,
2313− struct cpufreq_policy *policy,
2314− unsigned int target_freq)
2315−{
2316− unsigned int max_freq;
2317−
2318− update_turbo_state();
2319−
2320− max_freq = limits->no_turbo || limits->turbo_disabled ?
2321− cpu->pstate.max_freq : cpu->pstate.turbo_freq;
2322− policy->cpuinfo.max_freq = max_freq;
2323− if (policy->max > max_freq)
2324− policy->max = max_freq;
2325−
2326− if (target_freq > max_freq)
2327− target_freq = max_freq;
2328−
2329− return target_freq;
2330−}
2331−
23322268 static int intel_cpufreq_target(struct cpufreq_policy *policy,
23332269 unsigned int target_freq,
23342270 unsigned int relation)
@@ -2337,8 +2273,10 @@ static int intel_cpufreq_target(struct cpufreq_policy *policy, · 2 unmodified lines
23372273 struct cpufreq_freqs freqs;
23382274 int target_pstate;
23392275
2276+ update_turbo_state();
2277+
23402278 freqs.old = policy->cur;
2341− freqs.new = intel_cpufreq_turbo_update(cpu, policy, target_freq);
2279+ freqs.new = target_freq;
23422280
23432281 cpufreq_freq_transition_begin(policy, &freqs);
23442282 switch (relation) {
@@ -2370,7 +2308,8 @@ static unsigned int intel_cpufreq_fast_switch(struct cpufreq_policy *policy, · 25 unmodified lines
23702308 struct cpudata *cpu = all_cpu_data[policy->cpu];
23712309 int target_pstate;
23722310
2373− target_freq = intel_cpufreq_turbo_update(cpu, policy, target_freq);
2311+ update_turbo_state();
2312+
23742313 target_pstate = DIV_ROUND_UP(target_freq, cpu->pstate.scaling);
23752314 target_pstate = intel_pstate_prepare_request(cpu, target_pstate);
23762315 intel_pstate_update_pstate(cpu, target_pstate);
@@ -2425,13 +2364,7 @@ static int intel_pstate_register_driver(void) · 48 unmodified lines
24252364 {
24262365 int ret;
24272366
2428− intel_pstate_init_limits(&powersave_limits);
2429− intel_pstate_set_performance_limits(&performance_limits);
2430− if (IS_ENABLED(CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE) &&
2431− intel_pstate_driver == &intel_pstate)
2432− limits = &performance_limits;
2433− else
2434− limits = &powersave_limits;
2367+ intel_pstate_init_limits(&global);
24352368
24362369 ret = cpufreq_register_driver(intel_pstate_driver);
24372370 if (ret) {
drivers/cpuidle/sysfs.c+12−0
@@ -615,6 +615,18 @@ int cpuidle_add_sysfs(struct cpuidle_device *dev) · 614 unmodified lines
615615 struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu);
616616 int error;
617617
618+ /*
619+ * Return if cpu_device is not setup for this CPU.
620+ *
621+ * This could happen if the arch did not set up cpu_device
622+ * since this CPU is not in cpu_present mask and the
623+ * driver did not send a correct CPU mask during registration.
624+ * Without this check we would end up passing bogus
625+ * value for &cpu_dev->kobj in kobject_init_and_add()
626+ */
627+ if (!cpu_dev)
628+ return -ENODEV;
629+
618630 kdev = kzalloc(sizeof(*kdev), GFP_KERNEL);
619631 if (!kdev)
620632 return -ENOMEM;
drivers/crypto/ccp/ccp-dev.c+4−1
@@ -283,11 +283,14 @@ EXPORT_SYMBOL_GPL(ccp_version); · 282 unmodified lines
283283 */
284284 int ccp_enqueue_cmd(struct ccp_cmd *cmd)
285285 {
286− struct ccp_device *ccp = ccp_get_device();
286+ struct ccp_device *ccp;
287287 unsigned long flags;
288288 unsigned int i;
289289 int ret;
290290
291+ /* Some commands might need to be sent to a specific device */
292+ ccp = cmd->ccp ? cmd->ccp : ccp_get_device();
293+
291294 if (!ccp)
292295 return -ENODEV;
293296
drivers/crypto/ccp/ccp-dmaengine.c+1−0
@@ -390,6 +390,7 @@ static struct ccp_dma_desc *ccp_create_desc(struct dma_chan *dma_chan, · 389 unmodified lines
390390 goto err;
391391
392392 ccp_cmd = &cmd->ccp_cmd;
393+ ccp_cmd->ccp = chan->ccp;
393394 ccp_pt = &ccp_cmd->u.passthru_nomap;
394395 ccp_cmd->flags = CCP_CMD_MAY_BACKLOG;
395396 ccp_cmd->flags |= CCP_CMD_PASSTHRU_NO_DMA_MAP;
drivers/extcon/Kconfig+1−1
@@ -44,7 +44,7 @@ config EXTCON_GPIO · 43 unmodified lines
4444
4545 config EXTCON_INTEL_INT3496
4646 tristate "Intel INT3496 ACPI device extcon driver"
47− depends on GPIOLIB && ACPI
47+ depends on GPIOLIB && ACPI && (X86 || COMPILE_TEST)
4848 help
4949 Say Y here to enable extcon support for USB OTG ports controlled by
5050 an Intel INT3496 ACPI device.
drivers/extcon/extcon-intel-int3496.c+28−11
@@ -45,6 +45,17 @@ static const unsigned int int3496_cable[] = { · 44 unmodified lines
4545 EXTCON_NONE,
4646 };
4747
48+static const struct acpi_gpio_params id_gpios = { INT3496_GPIO_USB_ID, 0, false };
49+static const struct acpi_gpio_params vbus_gpios = { INT3496_GPIO_VBUS_EN, 0, false };
50+static const struct acpi_gpio_params mux_gpios = { INT3496_GPIO_USB_MUX, 0, false };
51+
52+static const struct acpi_gpio_mapping acpi_int3496_default_gpios[] = {
53+ { "id-gpios", &id_gpios, 1 },
54+ { "vbus-gpios", &vbus_gpios, 1 },
55+ { "mux-gpios", &mux_gpios, 1 },
56+ { },
57+};
58+
4859 static void int3496_do_usb_id(struct work_struct *work)
4960 {
5061 struct int3496_data *data =
@@ -83,6 +94,13 @@ static int int3496_probe(struct platform_device *pdev) · 32 unmodified lines
8394 struct int3496_data *data;
8495 int ret;
8596
97+ ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev),
98+ acpi_int3496_default_gpios);
99+ if (ret) {
100+ dev_err(dev, "can't add GPIO ACPI mapping\n");
101+ return ret;
102+ }
103+
86104 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
87105 if (!data)
88106 return -ENOMEM;
@@ -90,30 +108,27 @@ static int int3496_probe(struct platform_device *pdev) · 1 unmodified line
90108 data->dev = dev;
91109 INIT_DELAYED_WORK(&data->work, int3496_do_usb_id);
92110
93− data->gpio_usb_id = devm_gpiod_get_index(dev, "id",
94− INT3496_GPIO_USB_ID,
95− GPIOD_IN);
111+ data->gpio_usb_id = devm_gpiod_get(dev, "id", GPIOD_IN);
96112 if (IS_ERR(data->gpio_usb_id)) {
97113 ret = PTR_ERR(data->gpio_usb_id);
98114 dev_err(dev, "can't request USB ID GPIO: %d\n", ret);
99115 return ret;
116+ } else if (gpiod_get_direction(data->gpio_usb_id) != GPIOF_DIR_IN) {
117+ dev_warn(dev, FW_BUG "USB ID GPIO not in input mode, fixing\n");
118+ gpiod_direction_input(data->gpio_usb_id);
100119 }
101120
102121 data->usb_id_irq = gpiod_to_irq(data->gpio_usb_id);
103− if (data->usb_id_irq <= 0) {
122+ if (data->usb_id_irq < 0) {
104123 dev_err(dev, "can't get USB ID IRQ: %d\n", data->usb_id_irq);
105− return -EINVAL;
124+ return data->usb_id_irq;
106125 }
107126
108− data->gpio_vbus_en = devm_gpiod_get_index(dev, "vbus en",
109− INT3496_GPIO_VBUS_EN,
110− GPIOD_ASIS);
127+ data->gpio_vbus_en = devm_gpiod_get(dev, "vbus", GPIOD_ASIS);
111128 if (IS_ERR(data->gpio_vbus_en))
112129 dev_info(dev, "can't request VBUS EN GPIO\n");
113130
114− data->gpio_usb_mux = devm_gpiod_get_index(dev, "usb mux",
115− INT3496_GPIO_USB_MUX,
116− GPIOD_ASIS);
131+ data->gpio_usb_mux = devm_gpiod_get(dev, "mux", GPIOD_ASIS);
117132 if (IS_ERR(data->gpio_usb_mux))
118133 dev_info(dev, "can't request USB MUX GPIO\n");
119134
@@ -154,6 +169,8 @@ static int int3496_remove(struct platform_device *pdev) · 34 unmodified lines
154169 devm_free_irq(&pdev->dev, data->usb_id_irq, data);
155170 cancel_delayed_work_sync(&data->work);
156171
172+ acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pdev->dev));
173+
157174 return 0;
158175 }
159176
drivers/gpio/gpio-altera-a10sr.c+1−1
@@ -96,7 +96,7 @@ static int altr_a10sr_gpio_probe(struct platform_device *pdev) · 95 unmodified lines
9696 gpio->regmap = a10sr->regmap;
9797
9898 gpio->gp = altr_a10sr_gc;
99−
99+ gpio->gp.parent = pdev->dev.parent;
100100 gpio->gp.of_node = pdev->dev.of_node;
101101
102102 ret = devm_gpiochip_add_data(&pdev->dev, &gpio->gp, gpio);
drivers/gpio/gpio-altera.c+11−15
@@ -90,21 +90,18 @@ static int altera_gpio_irq_set_type(struct irq_data *d, · 89 unmodified lines
9090
9191 altera_gc = gpiochip_get_data(irq_data_get_irq_chip_data(d));
9292
93− if (type == IRQ_TYPE_NONE)
93+ if (type == IRQ_TYPE_NONE) {
94+ irq_set_handler_locked(d, handle_bad_irq);
9495 return 0;
95− if (type == IRQ_TYPE_LEVEL_HIGH &&
96− altera_gc->interrupt_trigger == IRQ_TYPE_LEVEL_HIGH)
97− return 0;
98− if (type == IRQ_TYPE_EDGE_RISING &&
99− altera_gc->interrupt_trigger == IRQ_TYPE_EDGE_RISING)
100− return 0;
101− if (type == IRQ_TYPE_EDGE_FALLING &&
102− altera_gc->interrupt_trigger == IRQ_TYPE_EDGE_FALLING)
103− return 0;
104− if (type == IRQ_TYPE_EDGE_BOTH &&
105− altera_gc->interrupt_trigger == IRQ_TYPE_EDGE_BOTH)
96+ }
97+ if (type == altera_gc->interrupt_trigger) {
98+ if (type == IRQ_TYPE_LEVEL_HIGH)
99+ irq_set_handler_locked(d, handle_level_irq);
100+ else
101+ irq_set_handler_locked(d, handle_simple_irq);
106102 return 0;
107−
103+ }
104+ irq_set_handler_locked(d, handle_bad_irq);
108105 return -EINVAL;
109106 }
110107
@@ -230,7 +227,6 @@ static void altera_gpio_irq_edge_handler(struct irq_desc *desc) · 119 unmodified lines
230227 chained_irq_exit(chip, desc);
231228 }
232229
233−
234230 static void altera_gpio_irq_leveL_high_handler(struct irq_desc *desc)
235231 {
236232 struct altera_gpio_chip *altera_gc;
@@ -310,7 +306,7 @@ static int altera_gpio_probe(struct platform_device *pdev) · 73 unmodified lines
310306 altera_gc->interrupt_trigger = reg;
311307
312308 ret = gpiochip_irqchip_add(&altera_gc->mmchip.gc, &altera_irq_chip, 0,
313− handle_simple_irq, IRQ_TYPE_NONE);
309+ handle_bad_irq, IRQ_TYPE_NONE);
314310
315311 if (ret) {
316312 dev_err(&pdev->dev, "could not add irqchip\n");
drivers/gpio/gpio-mcp23s08.c+60−5
@@ -270,8 +270,10 @@ mcp23s08_direction_output(struct gpio_chip *chip, unsigned offset, int value) · 269 unmodified lines
270270 static irqreturn_t mcp23s08_irq(int irq, void *data)
271271 {
272272 struct mcp23s08 *mcp = data;
273− int intcap, intf, i;
273+ int intcap, intf, i, gpio, gpio_orig, intcap_mask;
274274 unsigned int child_irq;
275+ bool intf_set, intcap_changed, gpio_bit_changed,
276+ defval_changed, gpio_set;
275277
276278 mutex_lock(&mcp->lock);
277279 if (mcp_read(mcp, MCP_INTF, &intf) < 0) {
@@ -287,14 +289,67 @@ static irqreturn_t mcp23s08_irq(int irq, void *data) · 9 unmodified lines
287289 }
288290
289291 mcp->cache[MCP_INTCAP] = intcap;
292+
293+ /* This clears the interrupt(configurable on S18) */
294+ if (mcp_read(mcp, MCP_GPIO, &gpio) < 0) {
295+ mutex_unlock(&mcp->lock);
296+ return IRQ_HANDLED;
297+ }
298+ gpio_orig = mcp->cache[MCP_GPIO];
299+ mcp->cache[MCP_GPIO] = gpio;
290300 mutex_unlock(&mcp->lock);
291301
302+ if (mcp->cache[MCP_INTF] == 0) {
303+ /* There is no interrupt pending */
304+ return IRQ_HANDLED;
305+ }
306+
307+ dev_dbg(mcp->chip.parent,
308+ "intcap 0x%04X intf 0x%04X gpio_orig 0x%04X gpio 0x%04X\n",
309+ intcap, intf, gpio_orig, gpio);
292310
293311 for (i = 0; i < mcp->chip.ngpio; i++) {
294− if ((BIT(i) & mcp->cache[MCP_INTF]) &&
295− ((BIT(i) & intcap & mcp->irq_rise) ||
296− (mcp->irq_fall & ~intcap & BIT(i)) ||
297− (BIT(i) & mcp->cache[MCP_INTCON]))) {
312+ /* We must check all of the inputs on the chip,
313+ * otherwise we may not notice a change on >=2 pins.
314+ *
315+ * On at least the mcp23s17, INTCAP is only updated
316+ * one byte at a time(INTCAPA and INTCAPB are
317+ * not written to at the same time - only on a per-bank
318+ * basis).
319+ *
320+ * INTF only contains the single bit that caused the
321+ * interrupt per-bank. On the mcp23s17, there is
322+ * INTFA and INTFB. If two pins are changed on the A
323+ * side at the same time, INTF will only have one bit
324+ * set. If one pin on the A side and one pin on the B
325+ * side are changed at the same time, INTF will have
326+ * two bits set. Thus, INTF can't be the only check
327+ * to see if the input has changed.
328+ */
329+
330+ intf_set = BIT(i) & mcp->cache[MCP_INTF];
331+ if (i < 8 && intf_set)
332+ intcap_mask = 0x00FF;
333+ else if (i >= 8 && intf_set)
334+ intcap_mask = 0xFF00;
335+ else
336+ intcap_mask = 0x00;
337+
338+ intcap_changed = (intcap_mask &
339+ (BIT(i) & mcp->cache[MCP_INTCAP])) !=
340+ (intcap_mask & (BIT(i) & gpio_orig));
341+ gpio_set = BIT(i) & mcp->cache[MCP_GPIO];
342+ gpio_bit_changed = (BIT(i) & gpio_orig) !=
343+ (BIT(i) & mcp->cache[MCP_GPIO]);
344+ defval_changed = (BIT(i) & mcp->cache[MCP_INTCON]) &&
345+ ((BIT(i) & mcp->cache[MCP_GPIO]) !=
346+ (BIT(i) & mcp->cache[MCP_DEFVAL]));
347+
348+ if (((gpio_bit_changed || intcap_changed) &&
349+ (BIT(i) & mcp->irq_rise) && gpio_set) ||
350+ ((gpio_bit_changed || intcap_changed) &&
351+ (BIT(i) & mcp->irq_fall) && !gpio_set) ||
352+ defval_changed) {
298353 child_irq = irq_find_mapping(mcp->chip.irqdomain, i);
299354 handle_nested_irq(child_irq);
300355 }
drivers/gpio/gpio-mockup.c+3−4
@@ -197,7 +197,7 @@ static ssize_t gpio_mockup_event_write(struct file *file, · 196 unmodified lines
197197 struct seq_file *sfile;
198198 struct gpio_desc *desc;
199199 struct gpio_chip *gc;
200− int status, val;
200+ int val;
201201 char buf;
202202
203203 sfile = file->private_data;
@@ -206,9 +206,8 @@ static ssize_t gpio_mockup_event_write(struct file *file, · 2 unmodified lines
206206 chip = priv->chip;
207207 gc = &chip->gc;
208208
209− status = copy_from_user(&buf, usr_buf, 1);
210− if (status)
211− return status;
209+ if (copy_from_user(&buf, usr_buf, 1))
210+ return -EFAULT;
212211
213212 if (buf == '0')
214213 val = 0;
drivers/gpio/gpio-xgene.c+3−10
@@ -42,9 +42,7 @@ struct xgene_gpio { · 41 unmodified lines
4242 struct gpio_chip chip;
4343 void __iomem *base;
4444 spinlock_t lock;
45−#ifdef CONFIG_PM
4645 u32 set_dr_val[XGENE_MAX_GPIO_BANKS];
47−#endif
4846 };
4947
5048 static int xgene_gpio_get(struct gpio_chip *gc, unsigned int offset)
@@ -138,8 +136,7 @@ static int xgene_gpio_dir_out(struct gpio_chip *gc, · 87 unmodified lines
138136 return 0;
139137 }
140138
141−#ifdef CONFIG_PM
142−static int xgene_gpio_suspend(struct device *dev)
139+static __maybe_unused int xgene_gpio_suspend(struct device *dev)
143140 {
144141 struct xgene_gpio *gpio = dev_get_drvdata(dev);
145142 unsigned long bank_offset;
@@ -152,7 +149,7 @@ static int xgene_gpio_suspend(struct device *dev) · 6 unmodified lines
152149 return 0;
153150 }
154151
155−static int xgene_gpio_resume(struct device *dev)
152+static __maybe_unused int xgene_gpio_resume(struct device *dev)
156153 {
157154 struct xgene_gpio *gpio = dev_get_drvdata(dev);
158155 unsigned long bank_offset;
@@ -166,10 +163,6 @@ static int xgene_gpio_resume(struct device *dev) · 7 unmodified lines
166163 }
167164
168165 static SIMPLE_DEV_PM_OPS(xgene_gpio_pm, xgene_gpio_suspend, xgene_gpio_resume);
169−#define XGENE_GPIO_PM_OPS (&xgene_gpio_pm)
170−#else
171−#define XGENE_GPIO_PM_OPS NULL
172−#endif
173166
174167 static int xgene_gpio_probe(struct platform_device *pdev)
175168 {
@@ -241,7 +234,7 @@ static struct platform_driver xgene_gpio_driver = { · 65 unmodified lines
241234 .name = "xgene-gpio",
242235 .of_match_table = xgene_gpio_of_match,
243236 .acpi_match_table = ACPI_PTR(xgene_gpio_acpi_match),
244− .pm = XGENE_GPIO_PM_OPS,
237+ .pm = &xgene_gpio_pm,
245238 },
246239 .probe = xgene_gpio_probe,
247240 };
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+2−2
@@ -475,7 +475,7 @@ static int amdgpu_wb_init(struct amdgpu_device *adev) · 474 unmodified lines
475475 int r;
476476
477477 if (adev->wb.wb_obj == NULL) {
478− r = amdgpu_bo_create_kernel(adev, AMDGPU_MAX_WB * 4,
478+ r = amdgpu_bo_create_kernel(adev, AMDGPU_MAX_WB * sizeof(uint32_t),
479479 PAGE_SIZE, AMDGPU_GEM_DOMAIN_GTT,
480480 &adev->wb.wb_obj, &adev->wb.gpu_addr,
481481 (void **)&adev->wb.wb);
@@ -488,7 +488,7 @@ static int amdgpu_wb_init(struct amdgpu_device *adev) · 6 unmodified lines
488488 memset(&adev->wb.used, 0, sizeof(adev->wb.used));
489489
490490 /* clear wb memory */
491− memset((char *)adev->wb.wb, 0, AMDGPU_GPU_PAGE_SIZE);
491+ memset((char *)adev->wb.wb, 0, AMDGPU_MAX_WB * sizeof(uint32_t));
492492 }
493493
494494 return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+1−0
@@ -421,6 +421,7 @@ static const struct pci_device_id pciidlist[] = { · 420 unmodified lines
421421 {0x1002, 0x6985, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
422422 {0x1002, 0x6986, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
423423 {0x1002, 0x6987, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
424+ {0x1002, 0x6995, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
424425 {0x1002, 0x699F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12},
425426
426427 {0, 0, 0}
drivers/gpu/drm/amd/amdgpu/si_dpm.c+7−3
@@ -3465,9 +3465,13 @@ static void si_apply_state_adjust_rules(struct amdgpu_device *adev, · 3464 unmodified lines
34653465 max_sclk = 75000;
34663466 }
34673467 } else if (adev->asic_type == CHIP_OLAND) {
3468− if ((adev->pdev->device == 0x6604) &&
3469− (adev->pdev->subsystem_vendor == 0x1028) &&
3470− (adev->pdev->subsystem_device == 0x066F)) {
3468+ if ((adev->pdev->revision == 0xC7) ||
3469+ (adev->pdev->revision == 0x80) ||
3470+ (adev->pdev->revision == 0x81) ||
3471+ (adev->pdev->revision == 0x83) ||
3472+ (adev->pdev->revision == 0x87) ||
3473+ (adev->pdev->device == 0x6604) ||
3474+ (adev->pdev->device == 0x6605)) {
34713475 max_sclk = 75000;
34723476 }
34733477 }
drivers/gpu/drm/drm_fb_helper.c+3−3
@@ -1332,9 +1332,9 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, · 1331 unmodified lines
13321332 * to KMS, hence fail if different settings are requested.
13331333 */
13341334 if (var->bits_per_pixel != fb->format->cpp[0] * 8 ||
1335− var->xres != fb->width || var->yres != fb->height ||
1336− var->xres_virtual != fb->width || var->yres_virtual != fb->height) {
1337− DRM_DEBUG("fb userspace requested width/height/bpp different than current fb "
1335+ var->xres > fb->width || var->yres > fb->height ||
1336+ var->xres_virtual > fb->width || var->yres_virtual > fb->height) {
1337+ DRM_DEBUG("fb requested width/height/bpp can't fit in current fb "
13381338 "request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n",
13391339 var->xres, var->yres, var->bits_per_pixel,
13401340 var->xres_virtual, var->yres_virtual,
drivers/gpu/drm/exynos/exynos5433_drm_decon.c+82−5
@@ -68,6 +68,8 @@ struct decon_context { · 67 unmodified lines
6868 unsigned long flags;
6969 unsigned long out_type;
7070 int first_win;
71+ spinlock_t vblank_lock;
72+ u32 frame_id;
7173 };
7274
7375 static const uint32_t decon_formats[] = {
@@ -103,7 +105,7 @@ static int decon_enable_vblank(struct exynos_drm_crtc *crtc) · 29 unmodified lines
103105 if (ctx->out_type & IFTYPE_I80)
104106 val |= VIDINTCON0_FRAMEDONE;
105107 else
106− val |= VIDINTCON0_INTFRMEN;
108+ val |= VIDINTCON0_INTFRMEN | VIDINTCON0_FRAMESEL_FP;
107109
108110 writel(val, ctx->addr + DECON_VIDINTCON0);
109111 }
@@ -122,14 +124,56 @@ static void decon_disable_vblank(struct exynos_drm_crtc *crtc) · 12 unmodified lines
122124 writel(0, ctx->addr + DECON_VIDINTCON0);
123125 }
124126
127+/* return number of starts/ends of frame transmissions since reset */
128+static u32 decon_get_frame_count(struct decon_context *ctx, bool end)
129+{
130+ u32 frm, pfrm, status, cnt = 2;
131+
132+ /* To get consistent result repeat read until frame id is stable.
133+ * Usually the loop will be executed once, in rare cases when the loop
134+ * is executed at frame change time 2nd pass will be needed.
135+ */
136+ frm = readl(ctx->addr + DECON_CRFMID);
137+ do {
138+ status = readl(ctx->addr + DECON_VIDCON1);
139+ pfrm = frm;
140+ frm = readl(ctx->addr + DECON_CRFMID);
141+ } while (frm != pfrm && --cnt);
142+
143+ /* CRFMID is incremented on BPORCH in case of I80 and on VSYNC in case
144+ * of RGB, it should be taken into account.
145+ */
146+ if (!frm)
147+ return 0;
148+
149+ switch (status & (VIDCON1_VSTATUS_MASK | VIDCON1_I80_ACTIVE)) {
150+ case VIDCON1_VSTATUS_VS:
151+ if (!(ctx->out_type & IFTYPE_I80))
152+ --frm;
153+ break;
154+ case VIDCON1_VSTATUS_BP:
155+ --frm;
156+ break;
157+ case VIDCON1_I80_ACTIVE:
158+ case VIDCON1_VSTATUS_AC:
159+ if (end)
160+ --frm;
161+ break;
162+ default:
163+ break;
164+ }
165+
166+ return frm;
167+}
168+
125169 static void decon_setup_trigger(struct decon_context *ctx)
126170 {
127171 if (!(ctx->out_type & (IFTYPE_I80 | I80_HW_TRG)))
128172 return;
129173
130174 if (!(ctx->out_type & I80_HW_TRG)) {
131− writel(TRIGCON_TE_AUTO_MASK | TRIGCON_SWTRIGEN
132− | TRIGCON_TE_AUTO_MASK | TRIGCON_SWTRIGEN,
175+ writel(TRIGCON_TRIGEN_PER_F | TRIGCON_TRIGEN_F |
176+ TRIGCON_TE_AUTO_MASK | TRIGCON_SWTRIGEN,
133177 ctx->addr + DECON_TRIGCON);
134178 return;
135179 }
@@ -365,11 +409,14 @@ static void decon_disable_plane(struct exynos_drm_crtc *crtc, · 229 unmodified lines
365409 static void decon_atomic_flush(struct exynos_drm_crtc *crtc)
366410 {
367411 struct decon_context *ctx = crtc->ctx;
412+ unsigned long flags;
368413 int i;
369414
370415 if (test_bit(BIT_SUSPENDED, &ctx->flags))
371416 return;
372417
418+ spin_lock_irqsave(&ctx->vblank_lock, flags);
419+
373420 for (i = ctx->first_win; i < WINDOWS_NR; i++)
374421 decon_shadow_protect_win(ctx, i, false);
375422
@@ -378,11 +425,18 @@ static void decon_atomic_flush(struct exynos_drm_crtc *crtc) · 2 unmodified lines
378425
379426 if (ctx->out_type & IFTYPE_I80)
380427 set_bit(BIT_WIN_UPDATED, &ctx->flags);
428+
429+ ctx->frame_id = decon_get_frame_count(ctx, true);
430+
431+ exynos_crtc_handle_event(crtc);
432+
433+ spin_unlock_irqrestore(&ctx->vblank_lock, flags);
381434 }
382435
383436 static void decon_swreset(struct decon_context *ctx)
384437 {
385438 unsigned int tries;
439+ unsigned long flags;
386440
387441 writel(0, ctx->addr + DECON_VIDCON0);
388442 for (tries = 2000; tries; --tries) {
@@ -400,6 +454,10 @@ static void decon_swreset(struct decon_context *ctx) · 11 unmodified lines
400454
401455 WARN(tries == 0, "failed to software reset DECON\n");
402456
457+ spin_lock_irqsave(&ctx->vblank_lock, flags);
458+ ctx->frame_id = 0;
459+ spin_unlock_irqrestore(&ctx->vblank_lock, flags);
460+
403461 if (!(ctx->out_type & IFTYPE_HDMI))
404462 return;
405463
@@ -578,6 +636,24 @@ static const struct component_ops decon_component_ops = { · 172 unmodified lines
578636 .unbind = decon_unbind,
579637 };
580638
639+static void decon_handle_vblank(struct decon_context *ctx)
640+{
641+ u32 frm;
642+
643+ spin_lock(&ctx->vblank_lock);
644+
645+ frm = decon_get_frame_count(ctx, true);
646+
647+ if (frm != ctx->frame_id) {
648+ /* handle only if incremented, take care of wrap-around */
649+ if ((s32)(frm - ctx->frame_id) > 0)
650+ drm_crtc_handle_vblank(&ctx->crtc->base);
651+ ctx->frame_id = frm;
652+ }
653+
654+ spin_unlock(&ctx->vblank_lock);
655+}
656+
581657 static irqreturn_t decon_irq_handler(int irq, void *dev_id)
582658 {
583659 struct decon_context *ctx = dev_id;
@@ -598,7 +674,7 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id) · 14 unmodified lines
598674 (VIDOUT_INTERLACE_EN_F | VIDOUT_INTERLACE_FIELD_F))
599675 return IRQ_HANDLED;
600676 }
601− drm_crtc_handle_vblank(&ctx->crtc->base);
677+ decon_handle_vblank(ctx);
602678 }
603679
604680 out:
@@ -671,6 +747,7 @@ static int exynos5433_decon_probe(struct platform_device *pdev) · 66 unmodified lines
671747 __set_bit(BIT_SUSPENDED, &ctx->flags);
672748 ctx->dev = dev;
673749 ctx->out_type = (unsigned long)of_device_get_match_data(dev);
750+ spin_lock_init(&ctx->vblank_lock);
674751
675752 if (ctx->out_type & IFTYPE_HDMI) {
676753 ctx->first_win = 1;
@@ -678,7 +755,7 @@ static int exynos5433_decon_probe(struct platform_device *pdev) · 1 unmodified line
678755 ctx->out_type |= IFTYPE_I80;
679756 }
680757
681− if (ctx->out_type | I80_HW_TRG) {
758+ if (ctx->out_type & I80_HW_TRG) {
682759 ctx->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node,
683760 "samsung,disp-sysreg");
684761 if (IS_ERR(ctx->sysreg)) {
drivers/gpu/drm/exynos/exynos7_drm_decon.c+1−0
@@ -526,6 +526,7 @@ static void decon_atomic_flush(struct exynos_drm_crtc *crtc) · 525 unmodified lines
526526
527527 for (i = 0; i < WINDOWS_NR; i++)
528528 decon_shadow_protect_win(ctx, i, false);
529+ exynos_crtc_handle_event(crtc);
529530 }
530531
531532 static void decon_init(struct decon_context *ctx)
drivers/gpu/drm/exynos/exynos_drm_crtc.c+16−13
@@ -85,16 +85,28 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc, · 84 unmodified lines
8585 struct drm_crtc_state *old_crtc_state)
8686 {
8787 struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
88− struct drm_pending_vblank_event *event;
89− unsigned long flags;
9088
9189 if (exynos_crtc->ops->atomic_flush)
9290 exynos_crtc->ops->atomic_flush(exynos_crtc);
91+}
92+
93+static const struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
94+ .enable = exynos_drm_crtc_enable,
95+ .disable = exynos_drm_crtc_disable,
96+ .mode_set_nofb = exynos_drm_crtc_mode_set_nofb,
97+ .atomic_check = exynos_crtc_atomic_check,
98+ .atomic_begin = exynos_crtc_atomic_begin,
99+ .atomic_flush = exynos_crtc_atomic_flush,
100+};
101+
102+void exynos_crtc_handle_event(struct exynos_drm_crtc *exynos_crtc)
103+{
104+ struct drm_crtc *crtc = &exynos_crtc->base;
105+ struct drm_pending_vblank_event *event = crtc->state->event;
106+ unsigned long flags;
93107
94− event = crtc->state->event;
95108 if (event) {
96109 crtc->state->event = NULL;
97−
98110 spin_lock_irqsave(&crtc->dev->event_lock, flags);
99111 if (drm_crtc_vblank_get(crtc) == 0)
100112 drm_crtc_arm_vblank_event(crtc, event);
@@ -105,15 +117,6 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc, · 4 unmodified lines
105117
106118 }
107119
108−static const struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
109− .enable = exynos_drm_crtc_enable,
110− .disable = exynos_drm_crtc_disable,
111− .mode_set_nofb = exynos_drm_crtc_mode_set_nofb,
112− .atomic_check = exynos_crtc_atomic_check,
113− .atomic_begin = exynos_crtc_atomic_begin,
114− .atomic_flush = exynos_crtc_atomic_flush,
115−};
116−
117120 static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
118121 {
119122 struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
drivers/gpu/drm/exynos/exynos_drm_crtc.h+2−0
@@ -38,4 +38,6 @@ int exynos_drm_crtc_get_pipe_from_type(struct drm_device *drm_dev, · 37 unmodified lines
3838 */
3939 void exynos_drm_crtc_te_handler(struct drm_crtc *crtc);
4040
41+void exynos_crtc_handle_event(struct exynos_drm_crtc *exynos_crtc);
42+
4143 #endif
drivers/gpu/drm/exynos/exynos_drm_dsi.c+7−17
@@ -86,7 +86,7 @@ · 85 unmodified lines
8686 #define DSIM_SYNC_INFORM (1 << 27)
8787 #define DSIM_EOT_DISABLE (1 << 28)
8888 #define DSIM_MFLUSH_VS (1 << 29)
89−/* This flag is valid only for exynos3250/3472/4415/5260/5430 */
89+/* This flag is valid only for exynos3250/3472/5260/5430 */
9090 #define DSIM_CLKLANE_STOP (1 << 30)
9191
9292 /* DSIM_ESCMODE */
@@ -473,17 +473,6 @@ static const struct exynos_dsi_driver_data exynos4_dsi_driver_data = { · 380 unmodified lines
473473 .reg_values = reg_values,
474474 };
475475
476−static const struct exynos_dsi_driver_data exynos4415_dsi_driver_data = {
477− .reg_ofs = exynos_reg_ofs,
478− .plltmr_reg = 0x58,
479− .has_clklane_stop = 1,
480− .num_clks = 2,
481− .max_freq = 1000,
482− .wait_for_reset = 1,
483− .num_bits_resol = 11,
484− .reg_values = reg_values,
485−};
486−
487476 static const struct exynos_dsi_driver_data exynos5_dsi_driver_data = {
488477 .reg_ofs = exynos_reg_ofs,
489478 .plltmr_reg = 0x58,
@@ -521,8 +510,6 @@ static const struct of_device_id exynos_dsi_of_match[] = { · 31 unmodified lines
521510 .data = &exynos3_dsi_driver_data },
522511 { .compatible = "samsung,exynos4210-mipi-dsi",
523512 .data = &exynos4_dsi_driver_data },
524− { .compatible = "samsung,exynos4415-mipi-dsi",
525− .data = &exynos4415_dsi_driver_data },
526513 { .compatible = "samsung,exynos5410-mipi-dsi",
527514 .data = &exynos5_dsi_driver_data },
528515 { .compatible = "samsung,exynos5422-mipi-dsi",
@@ -979,7 +966,7 @@ static void exynos_dsi_send_to_fifo(struct exynos_dsi *dsi, · 450 unmodified lines
979966 bool first = !xfer->tx_done;
980967 u32 reg;
981968
982− dev_dbg(dev, "< xfer %p: tx len %u, done %u, rx len %u, done %u\n",
969+ dev_dbg(dev, "< xfer %pK: tx len %u, done %u, rx len %u, done %u\n",
983970 xfer, length, xfer->tx_done, xfer->rx_len, xfer->rx_done);
984971
985972 if (length > DSI_TX_FIFO_SIZE)
@@ -1177,7 +1164,7 @@ static bool exynos_dsi_transfer_finish(struct exynos_dsi *dsi) · 191 unmodified lines
11771164 spin_unlock_irqrestore(&dsi->transfer_lock, flags);
11781165
11791166 dev_dbg(dsi->dev,
1180− "> xfer %p, tx_len %zu, tx_done %u, rx_len %u, rx_done %u\n",
1167+ "> xfer %pK, tx_len %zu, tx_done %u, rx_len %u, rx_done %u\n",
11811168 xfer, xfer->packet.payload_length, xfer->tx_done, xfer->rx_len,
11821169 xfer->rx_done);
11831170
@@ -1348,9 +1335,12 @@ static int exynos_dsi_register_te_irq(struct exynos_dsi *dsi) · 164 unmodified lines
13481335 int te_gpio_irq;
13491336
13501337 dsi->te_gpio = of_get_named_gpio(dsi->panel_node, "te-gpios", 0);
1338+ if (dsi->te_gpio == -ENOENT)
1339+ return 0;
1340+
13511341 if (!gpio_is_valid(dsi->te_gpio)) {
1352− dev_err(dsi->dev, "no te-gpios specified\n");
13531342 ret = dsi->te_gpio;
1343+ dev_err(dsi->dev, "cannot get te-gpios, %d\n", ret);
13541344 goto out;
13551345 }
13561346
drivers/gpu/drm/exynos/exynos_drm_fimc.c+1−1
@@ -1695,7 +1695,7 @@ static int fimc_probe(struct platform_device *pdev) · 1694 unmodified lines
16951695 goto err_put_clk;
16961696 }
16971697
1698− DRM_DEBUG_KMS("id[%d]ippdrv[%p]\n", ctx->id, ippdrv);
1698+ DRM_DEBUG_KMS("id[%d]ippdrv[%pK]\n", ctx->id, ippdrv);
16991699
17001700 spin_lock_init(&ctx->lock);
17011701 platform_set_drvdata(pdev, ctx);
drivers/gpu/drm/exynos/exynos_drm_fimd.c+5−17
@@ -71,10 +71,10 @@ · 70 unmodified lines
7171 #define TRIGCON 0x1A4
7272 #define TRGMODE_ENABLE (1 << 0)
7373 #define SWTRGCMD_ENABLE (1 << 1)
74−/* Exynos3250, 3472, 4415, 5260 5410, 5420 and 5422 only supported. */
74+/* Exynos3250, 3472, 5260 5410, 5420 and 5422 only supported. */
7575 #define HWTRGEN_ENABLE (1 << 3)
7676 #define HWTRGMASK_ENABLE (1 << 4)
77−/* Exynos3250, 3472, 4415, 5260, 5420 and 5422 only supported. */
77+/* Exynos3250, 3472, 5260, 5420 and 5422 only supported. */
7878 #define HWTRIGEN_PER_ENABLE (1 << 31)
7979
8080 /* display mode change control register except exynos4 */
@@ -138,18 +138,6 @@ static struct fimd_driver_data exynos4_fimd_driver_data = { · 57 unmodified lines
138138 .has_vtsel = 1,
139139 };
140140
141−static struct fimd_driver_data exynos4415_fimd_driver_data = {
142− .timing_base = 0x20000,
143− .lcdblk_offset = 0x210,
144− .lcdblk_vt_shift = 10,
145− .lcdblk_bypass_shift = 1,
146− .trg_type = I80_HW_TRG,
147− .has_shadowcon = 1,
148− .has_vidoutcon = 1,
149− .has_vtsel = 1,
150− .has_trigger_per_te = 1,
151−};
152−
153141 static struct fimd_driver_data exynos5_fimd_driver_data = {
154142 .timing_base = 0x20000,
155143 .lcdblk_offset = 0x214,
@@ -210,8 +198,6 @@ static const struct of_device_id fimd_driver_dt_match[] = { · 54 unmodified lines
210198 .data = &exynos3_fimd_driver_data },
211199 { .compatible = "samsung,exynos4210-fimd",
212200 .data = &exynos4_fimd_driver_data },
213− { .compatible = "samsung,exynos4415-fimd",
214− .data = &exynos4415_fimd_driver_data },
215201 { .compatible = "samsung,exynos5250-fimd",
216202 .data = &exynos5_fimd_driver_data },
217203 { .compatible = "samsung,exynos5420-fimd",
@@ -257,7 +243,7 @@ static int fimd_enable_vblank(struct exynos_drm_crtc *crtc) · 39 unmodified lines
257243 val |= VIDINTCON0_INT_FRAME;
258244
259245 val &= ~VIDINTCON0_FRAMESEL0_MASK;
260− val |= VIDINTCON0_FRAMESEL0_VSYNC;
246+ val |= VIDINTCON0_FRAMESEL0_FRONTPORCH;
261247 val &= ~VIDINTCON0_FRAMESEL1_MASK;
262248 val |= VIDINTCON0_FRAMESEL1_NONE;
263249 }
@@ -723,6 +709,8 @@ static void fimd_atomic_flush(struct exynos_drm_crtc *crtc) · 459 unmodified lines
723709
724710 for (i = 0; i < WINDOWS_NR; i++)
725711 fimd_shadow_protect_win(ctx, i, false);
712+
713+ exynos_crtc_handle_event(crtc);
726714 }
727715
728716 static void fimd_update_plane(struct exynos_drm_crtc *crtc,
drivers/gpu/drm/exynos/exynos_drm_gem.c+1−1
@@ -218,7 +218,7 @@ static struct exynos_drm_gem *exynos_drm_gem_init(struct drm_device *dev, · 217 unmodified lines
218218 return ERR_PTR(ret);
219219 }
220220
221− DRM_DEBUG_KMS("created file object = %p\n", obj->filp);
221+ DRM_DEBUG_KMS("created file object = %pK\n", obj->filp);
222222
223223 return exynos_gem;
224224 }
drivers/gpu/drm/exynos/exynos_drm_gsc.c+1−1
@@ -1723,7 +1723,7 @@ static int gsc_probe(struct platform_device *pdev) · 1722 unmodified lines
17231723 return ret;
17241724 }
17251725
1726− DRM_DEBUG_KMS("id[%d]ippdrv[%p]\n", ctx->id, ippdrv);
1726+ DRM_DEBUG_KMS("id[%d]ippdrv[%pK]\n", ctx->id, ippdrv);
17271727
17281728 mutex_init(&ctx->lock);
17291729 platform_set_drvdata(pdev, ctx);
drivers/gpu/drm/exynos/exynos_drm_ipp.c+11−11
@@ -208,7 +208,7 @@ static struct exynos_drm_ippdrv *ipp_find_drv_by_handle(u32 prop_id) · 207 unmodified lines
208208 * e.g PAUSE state, queue buf, command control.
209209 */
210210 list_for_each_entry(ippdrv, &exynos_drm_ippdrv_list, drv_list) {
211− DRM_DEBUG_KMS("count[%d]ippdrv[%p]\n", count++, ippdrv);
211+ DRM_DEBUG_KMS("count[%d]ippdrv[%pK]\n", count++, ippdrv);
212212
213213 mutex_lock(&ippdrv->cmd_lock);
214214 list_for_each_entry(c_node, &ippdrv->cmd_list, list) {
@@ -388,7 +388,7 @@ int exynos_drm_ipp_set_property(struct drm_device *drm_dev, void *data, · 173 unmodified lines
388388 }
389389 property->prop_id = ret;
390390
391− DRM_DEBUG_KMS("created prop_id[%d]cmd[%d]ippdrv[%p]\n",
391+ DRM_DEBUG_KMS("created prop_id[%d]cmd[%d]ippdrv[%pK]\n",
392392 property->prop_id, property->cmd, ippdrv);
393393
394394 /* stored property information and ippdrv in private data */
@@ -518,7 +518,7 @@ static int ipp_put_mem_node(struct drm_device *drm_dev, · 123 unmodified lines
518518 {
519519 int i;
520520
521− DRM_DEBUG_KMS("node[%p]\n", m_node);
521+ DRM_DEBUG_KMS("node[%pK]\n", m_node);
522522
523523 if (!m_node) {
524524 DRM_ERROR("invalid dequeue node.\n");
@@ -562,7 +562,7 @@ static struct drm_exynos_ipp_mem_node · 37 unmodified lines
562562 m_node->buf_id = qbuf->buf_id;
563563 INIT_LIST_HEAD(&m_node->list);
564564
565− DRM_DEBUG_KMS("m_node[%p]ops_id[%d]\n", m_node, qbuf->ops_id);
565+ DRM_DEBUG_KMS("m_node[%pK]ops_id[%d]\n", m_node, qbuf->ops_id);
566566 DRM_DEBUG_KMS("prop_id[%d]buf_id[%d]\n", qbuf->prop_id, m_node->buf_id);
567567
568568 for_each_ipp_planar(i) {
@@ -659,7 +659,7 @@ static void ipp_put_event(struct drm_exynos_ipp_cmd_node *c_node, · 90 unmodified lines
659659
660660 mutex_lock(&c_node->event_lock);
661661 list_for_each_entry_safe(e, te, &c_node->event_list, base.link) {
662− DRM_DEBUG_KMS("count[%d]e[%p]\n", count++, e);
662+ DRM_DEBUG_KMS("count[%d]e[%pK]\n", count++, e);
663663
664664 /*
665665 * qbuf == NULL condition means all event deletion.
@@ -750,7 +750,7 @@ static struct drm_exynos_ipp_mem_node · 84 unmodified lines
750750
751751 /* find memory node from memory list */
752752 list_for_each_entry(m_node, head, list) {
753− DRM_DEBUG_KMS("count[%d]m_node[%p]\n", count++, m_node);
753+ DRM_DEBUG_KMS("count[%d]m_node[%pK]\n", count++, m_node);
754754
755755 /* compare buffer id */
756756 if (m_node->buf_id == qbuf->buf_id)
@@ -767,7 +767,7 @@ static int ipp_set_mem_node(struct exynos_drm_ippdrv *ippdrv, · 10 unmodified lines
767767 struct exynos_drm_ipp_ops *ops = NULL;
768768 int ret = 0;
769769
770− DRM_DEBUG_KMS("node[%p]\n", m_node);
770+ DRM_DEBUG_KMS("node[%pK]\n", m_node);
771771
772772 if (!m_node) {
773773 DRM_ERROR("invalid queue node.\n");
@@ -1232,7 +1232,7 @@ static int ipp_start_property(struct exynos_drm_ippdrv *ippdrv, · 458 unmodified lines
12321232 m_node = list_first_entry(head,
12331233 struct drm_exynos_ipp_mem_node, list);
12341234
1235− DRM_DEBUG_KMS("m_node[%p]\n", m_node);
1235+ DRM_DEBUG_KMS("m_node[%pK]\n", m_node);
12361236
12371237 ret = ipp_set_mem_node(ippdrv, c_node, m_node);
12381238 if (ret) {
@@ -1601,7 +1601,7 @@ static int ipp_subdrv_probe(struct drm_device *drm_dev, struct device *dev) · 362 unmodified lines
16011601 }
16021602 ippdrv->prop_list.ipp_id = ret;
16031603
1604− DRM_DEBUG_KMS("count[%d]ippdrv[%p]ipp_id[%d]\n",
1604+ DRM_DEBUG_KMS("count[%d]ippdrv[%pK]ipp_id[%d]\n",
16051605 count++, ippdrv, ret);
16061606
16071607 /* store parent device for node */
@@ -1659,7 +1659,7 @@ static int ipp_subdrv_open(struct drm_device *drm_dev, struct device *dev, · 51 unmodified lines
16591659
16601660 file_priv->ipp_dev = dev;
16611661
1662− DRM_DEBUG_KMS("done priv[%p]\n", dev);
1662+ DRM_DEBUG_KMS("done priv[%pK]\n", dev);
16631663
16641664 return 0;
16651665 }
@@ -1676,7 +1676,7 @@ static void ipp_subdrv_close(struct drm_device *drm_dev, struct device *dev, · 10 unmodified lines
16761676 mutex_lock(&ippdrv->cmd_lock);
16771677 list_for_each_entry_safe(c_node, tc_node,
16781678 &ippdrv->cmd_list, list) {
1679− DRM_DEBUG_KMS("count[%d]ippdrv[%p]\n",
1679+ DRM_DEBUG_KMS("count[%d]ippdrv[%pK]\n",
16801680 count++, ippdrv);
16811681
16821682 if (c_node->filp == file) {
drivers/gpu/drm/exynos/exynos_drm_rotator.c+1−1
@@ -748,7 +748,7 @@ static int rotator_probe(struct platform_device *pdev) · 747 unmodified lines
748748 goto err_ippdrv_register;
749749 }
750750
751− DRM_DEBUG_KMS("ippdrv[%p]\n", ippdrv);
751+ DRM_DEBUG_KMS("ippdrv[%pK]\n", ippdrv);
752752
753753 platform_set_drvdata(pdev, rot);
754754
drivers/gpu/drm/exynos/exynos_drm_vidi.c+1−0
@@ -170,6 +170,7 @@ static const struct exynos_drm_crtc_ops vidi_crtc_ops = { · 169 unmodified lines
170170 .enable_vblank = vidi_enable_vblank,
171171 .disable_vblank = vidi_disable_vblank,
172172 .update_plane = vidi_update_plane,
173+ .atomic_flush = exynos_crtc_handle_event,
173174 };
174175
175176 static void vidi_fake_vblank_timer(unsigned long arg)
drivers/gpu/drm/exynos/exynos_mixer.c+1−0
@@ -1012,6 +1012,7 @@ static void mixer_atomic_flush(struct exynos_drm_crtc *crtc) · 1011 unmodified lines
10121012 return;
10131013
10141014 mixer_vsync_set_update(mixer_ctx, true);
1015+ exynos_crtc_handle_event(crtc);
10151016 }
10161017
10171018 static void mixer_enable(struct exynos_drm_crtc *crtc)
drivers/gpu/drm/i915/gvt/aperture_gm.c+4−4
@@ -242,7 +242,7 @@ static int alloc_resource(struct intel_vgpu *vgpu, · 241 unmodified lines
242242 const char *item;
243243
244244 if (!param->low_gm_sz || !param->high_gm_sz || !param->fence_sz) {
245− gvt_err("Invalid vGPU creation params\n");
245+ gvt_vgpu_err("Invalid vGPU creation params\n");
246246 return -EINVAL;
247247 }
248248
@@ -285,9 +285,9 @@ static int alloc_resource(struct intel_vgpu *vgpu, · 36 unmodified lines
285285 return 0;
286286
287287 no_enough_resource:
288− gvt_err("vgpu%d: fail to allocate resource %s\n", vgpu->id, item);
289− gvt_err("vgpu%d: request %luMB avail %luMB max %luMB taken %luMB\n",
290− vgpu->id, BYTES_TO_MB(request), BYTES_TO_MB(avail),
288+ gvt_vgpu_err("fail to allocate resource %s\n", item);
289+ gvt_vgpu_err("request %luMB avail %luMB max %luMB taken %luMB\n",
290+ BYTES_TO_MB(request), BYTES_TO_MB(avail),
291291 BYTES_TO_MB(max), BYTES_TO_MB(taken));
292292 return -ENOSPC;
293293 }
drivers/gpu/drm/i915/gvt/cmd_parser.c+76−41
@@ -817,6 +817,25 @@ static bool is_shadowed_mmio(unsigned int offset) · 816 unmodified lines
817817 return ret;
818818 }
819819
820+static inline bool is_force_nonpriv_mmio(unsigned int offset)
821+{
822+ return (offset >= 0x24d0 && offset < 0x2500);
823+}
824+
825+static int force_nonpriv_reg_handler(struct parser_exec_state *s,
826+ unsigned int offset, unsigned int index)
827+{
828+ struct intel_gvt *gvt = s->vgpu->gvt;
829+ unsigned int data = cmd_val(s, index + 1);
830+
831+ if (!intel_gvt_in_force_nonpriv_whitelist(gvt, data)) {
832+ gvt_err("Unexpected forcenonpriv 0x%x LRI write, value=0x%x\n",
833+ offset, data);
834+ return -EINVAL;
835+ }
836+ return 0;
837+}
838+
820839 static int cmd_reg_handler(struct parser_exec_state *s,
821840 unsigned int offset, unsigned int index, char *cmd)
822841 {
@@ -824,23 +843,26 @@ static int cmd_reg_handler(struct parser_exec_state *s, · 1 unmodified line
824843 struct intel_gvt *gvt = vgpu->gvt;
825844
826845 if (offset + 4 > gvt->device_info.mmio_size) {
827− gvt_err("%s access to (%x) outside of MMIO range\n",
846+ gvt_vgpu_err("%s access to (%x) outside of MMIO range\n",
828847 cmd, offset);
829848 return -EINVAL;
830849 }
831850
832851 if (!intel_gvt_mmio_is_cmd_access(gvt, offset)) {
833− gvt_err("vgpu%d: %s access to non-render register (%x)\n",
834− s->vgpu->id, cmd, offset);
852+ gvt_vgpu_err("%s access to non-render register (%x)\n",
853+ cmd, offset);
835854 return 0;
836855 }
837856
838857 if (is_shadowed_mmio(offset)) {
839− gvt_err("vgpu%d: found access of shadowed MMIO %x\n",
840− s->vgpu->id, offset);
858+ gvt_vgpu_err("found access of shadowed MMIO %x\n", offset);
841859 return 0;
842860 }
843861
862+ if (is_force_nonpriv_mmio(offset) &&
863+ force_nonpriv_reg_handler(s, offset, index))
864+ return -EINVAL;
865+
844866 if (offset == i915_mmio_reg_offset(DERRMR) ||
845867 offset == i915_mmio_reg_offset(FORCEWAKE_MT)) {
846868 /* Writing to HW VGT_PVINFO_PAGE offset will be discarded */
@@ -1008,7 +1030,7 @@ static int cmd_handler_pipe_control(struct parser_exec_state *s) · 161 unmodified lines
10081030 ret = cmd_reg_handler(s, 0x2358, 1, "pipe_ctrl");
10091031 else if (post_sync == 1) {
10101032 /* check ggtt*/
1011− if ((cmd_val(s, 2) & (1 << 2))) {
1033+ if ((cmd_val(s, 1) & PIPE_CONTROL_GLOBAL_GTT_IVB)) {
10121034 gma = cmd_val(s, 2) & GENMASK(31, 3);
10131035 if (gmadr_bytes == 8)
10141036 gma |= (cmd_gma_hi(s, 3)) << 32;
@@ -1129,6 +1151,7 @@ static int skl_decode_mi_display_flip(struct parser_exec_state *s, · 114 unmodified lines
11291151 struct mi_display_flip_command_info *info)
11301152 {
11311153 struct drm_i915_private *dev_priv = s->vgpu->gvt->dev_priv;
1154+ struct intel_vgpu *vgpu = s->vgpu;
11321155 u32 dword0 = cmd_val(s, 0);
11331156 u32 dword1 = cmd_val(s, 1);
11341157 u32 dword2 = cmd_val(s, 2);
@@ -1167,7 +1190,7 @@ static int skl_decode_mi_display_flip(struct parser_exec_state *s, · 32 unmodified lines
11671190 break;
11681191
11691192 default:
1170− gvt_err("unknown plane code %d\n", plane);
1193+ gvt_vgpu_err("unknown plane code %d\n", plane);
11711194 return -EINVAL;
11721195 }
11731196
@@ -1274,25 +1297,26 @@ static int update_plane_mmio_from_mi_display_flip( · 100 unmodified lines
12741297 static int cmd_handler_mi_display_flip(struct parser_exec_state *s)
12751298 {
12761299 struct mi_display_flip_command_info info;
1300+ struct intel_vgpu *vgpu = s->vgpu;
12771301 int ret;
12781302 int i;
12791303 int len = cmd_length(s);
12801304
12811305 ret = decode_mi_display_flip(s, &info);
12821306 if (ret) {
1283− gvt_err("fail to decode MI display flip command\n");
1307+ gvt_vgpu_err("fail to decode MI display flip command\n");
12841308 return ret;
12851309 }
12861310
12871311 ret = check_mi_display_flip(s, &info);
12881312 if (ret) {
1289− gvt_err("invalid MI display flip command\n");
1313+ gvt_vgpu_err("invalid MI display flip command\n");
12901314 return ret;
12911315 }
12921316
12931317 ret = update_plane_mmio_from_mi_display_flip(s, &info);
12941318 if (ret) {
1295− gvt_err("fail to update plane mmio\n");
1319+ gvt_vgpu_err("fail to update plane mmio\n");
12961320 return ret;
12971321 }
12981322
@@ -1350,7 +1374,8 @@ static inline int cmd_address_audit(struct parser_exec_state *s, · 51 unmodified lines
13501374 int ret;
13511375
13521376 if (op_size > max_surface_size) {
1353− gvt_err("command address audit fail name %s\n", s->info->name);
1377+ gvt_vgpu_err("command address audit fail name %s\n",
1378+ s->info->name);
13541379 return -EINVAL;
13551380 }
13561381
@@ -1367,7 +1392,7 @@ static inline int cmd_address_audit(struct parser_exec_state *s, · 10 unmodified lines
13671392 }
13681393 return 0;
13691394 err:
1370− gvt_err("cmd_parser: Malicious %s detected, addr=0x%lx, len=%d!\n",
1395+ gvt_vgpu_err("cmd_parser: Malicious %s detected, addr=0x%lx, len=%d!\n",
13711396 s->info->name, guest_gma, op_size);
13721397
13731398 pr_err("cmd dump: ");
@@ -1412,8 +1437,10 @@ static int cmd_handler_mi_store_data_imm(struct parser_exec_state *s) · 38 unmodified lines
14121437
14131438 static inline int unexpected_cmd(struct parser_exec_state *s)
14141439 {
1415− gvt_err("vgpu%d: Unexpected %s in command buffer!\n",
1416− s->vgpu->id, s->info->name);
1440+ struct intel_vgpu *vgpu = s->vgpu;
1441+
1442+ gvt_vgpu_err("Unexpected %s in command buffer!\n", s->info->name);
1443+
14171444 return -EINVAL;
14181445 }
14191446
@@ -1516,7 +1543,7 @@ static int copy_gma_to_hva(struct intel_vgpu *vgpu, struct intel_vgpu_mm *mm, · 96 unmodified lines
15161543 while (gma != end_gma) {
15171544 gpa = intel_vgpu_gma_to_gpa(mm, gma);
15181545 if (gpa == INTEL_GVT_INVALID_ADDR) {
1519− gvt_err("invalid gma address: %lx\n", gma);
1546+ gvt_vgpu_err("invalid gma address: %lx\n", gma);
15201547 return -EFAULT;
15211548 }
15221549
@@ -1557,6 +1584,7 @@ static uint32_t find_bb_size(struct parser_exec_state *s) · 34 unmodified lines
15571584 uint32_t bb_size = 0;
15581585 uint32_t cmd_len = 0;
15591586 bool met_bb_end = false;
1587+ struct intel_vgpu *vgpu = s->vgpu;
15601588 u32 cmd;
15611589
15621590 /* get the start gm address of the batch buffer */
@@ -1565,7 +1593,7 @@ static uint32_t find_bb_size(struct parser_exec_state *s) · 2 unmodified lines
15651593
15661594 info = get_cmd_info(s->vgpu->gvt, cmd, s->ring_id);
15671595 if (info == NULL) {
1568− gvt_err("unknown cmd 0x%x, opcode=0x%x\n",
1596+ gvt_vgpu_err("unknown cmd 0x%x, opcode=0x%x\n",
15691597 cmd, get_opcode(cmd, s->ring_id));
15701598 return -EINVAL;
15711599 }
@@ -1574,7 +1602,7 @@ static uint32_t find_bb_size(struct parser_exec_state *s) · 2 unmodified lines
15741602 gma, gma + 4, &cmd);
15751603 info = get_cmd_info(s->vgpu->gvt, cmd, s->ring_id);
15761604 if (info == NULL) {
1577− gvt_err("unknown cmd 0x%x, opcode=0x%x\n",
1605+ gvt_vgpu_err("unknown cmd 0x%x, opcode=0x%x\n",
15781606 cmd, get_opcode(cmd, s->ring_id));
15791607 return -EINVAL;
15801608 }
@@ -1599,6 +1627,7 @@ static uint32_t find_bb_size(struct parser_exec_state *s) · 18 unmodified lines
15991627 static int perform_bb_shadow(struct parser_exec_state *s)
16001628 {
16011629 struct intel_shadow_bb_entry *entry_obj;
1630+ struct intel_vgpu *vgpu = s->vgpu;
16021631 unsigned long gma = 0;
16031632 uint32_t bb_size;
16041633 void *dst = NULL;
@@ -1633,7 +1662,7 @@ static int perform_bb_shadow(struct parser_exec_state *s) · 28 unmodified lines
16331662
16341663 ret = i915_gem_object_set_to_cpu_domain(entry_obj->obj, false);
16351664 if (ret) {
1636− gvt_err("failed to set shadow batch to CPU\n");
1665+ gvt_vgpu_err("failed to set shadow batch to CPU\n");
16371666 goto unmap_src;
16381667 }
16391668
@@ -1644,8 +1673,8 @@ static int perform_bb_shadow(struct parser_exec_state *s) · 4 unmodified lines
16441673 ret = copy_gma_to_hva(s->vgpu, s->vgpu->gtt.ggtt_mm,
16451674 gma, gma + bb_size,
16461675 dst);
1647− if (ret < 0) {
1648− gvt_err("fail to copy guest ring buffer\n");
1676+ if (ret) {
1677+ gvt_vgpu_err("fail to copy guest ring buffer\n");
16491678 goto unmap_src;
16501679 }
16511680
@@ -1676,15 +1705,16 @@ static int cmd_handler_mi_batch_buffer_start(struct parser_exec_state *s) · 24 unmodified lines
16761705 {
16771706 bool second_level;
16781707 int ret = 0;
1708+ struct intel_vgpu *vgpu = s->vgpu;
16791709
16801710 if (s->buf_type == BATCH_BUFFER_2ND_LEVEL) {
1681− gvt_err("Found MI_BATCH_BUFFER_START in 2nd level BB\n");
1711+ gvt_vgpu_err("Found MI_BATCH_BUFFER_START in 2nd level BB\n");
16821712 return -EINVAL;
16831713 }
16841714
16851715 second_level = BATCH_BUFFER_2ND_LEVEL_BIT(cmd_val(s, 0)) == 1;
16861716 if (second_level && (s->buf_type != BATCH_BUFFER_INSTRUCTION)) {
1687− gvt_err("Jumping to 2nd level BB from RB is not allowed\n");
1717+ gvt_vgpu_err("Jumping to 2nd level BB from RB is not allowed\n");
16881718 return -EINVAL;
16891719 }
16901720
@@ -1702,7 +1732,7 @@ static int cmd_handler_mi_batch_buffer_start(struct parser_exec_state *s) · 11 unmodified lines
17021732 if (batch_buffer_needs_scan(s)) {
17031733 ret = perform_bb_shadow(s);
17041734 if (ret < 0)
1705− gvt_err("invalid shadow batch buffer\n");
1735+ gvt_vgpu_err("invalid shadow batch buffer\n");
17061736 } else {
17071737 /* emulate a batch buffer end to do return right */
17081738 ret = cmd_handler_mi_batch_buffer_end(s);
@@ -2429,6 +2459,7 @@ static int cmd_parser_exec(struct parser_exec_state *s) · 720 unmodified lines
24292459 int ret = 0;
24302460 cycles_t t0, t1, t2;
24312461 struct parser_exec_state s_before_advance_custom;
2462+ struct intel_vgpu *vgpu = s->vgpu;
24322463
24332464 t0 = get_cycles();
24342465
@@ -2436,7 +2467,7 @@ static int cmd_parser_exec(struct parser_exec_state *s) · 1 unmodified line
24362467
24372468 info = get_cmd_info(s->vgpu->gvt, cmd, s->ring_id);
24382469 if (info == NULL) {
2439− gvt_err("unknown cmd 0x%x, opcode=0x%x\n",
2470+ gvt_vgpu_err("unknown cmd 0x%x, opcode=0x%x\n",
24402471 cmd, get_opcode(cmd, s->ring_id));
24412472 return -EINVAL;
24422473 }
@@ -2452,7 +2483,7 @@ static int cmd_parser_exec(struct parser_exec_state *s) · 9 unmodified lines
24522483 if (info->handler) {
24532484 ret = info->handler(s);
24542485 if (ret < 0) {
2455− gvt_err("%s handler error\n", info->name);
2486+ gvt_vgpu_err("%s handler error\n", info->name);
24562487 return ret;
24572488 }
24582489 }
@@ -2463,7 +2494,7 @@ static int cmd_parser_exec(struct parser_exec_state *s) · 4 unmodified lines
24632494 if (!(info->flag & F_IP_ADVANCE_CUSTOM)) {
24642495 ret = cmd_advance_default(s);
24652496 if (ret) {
2466− gvt_err("%s IP advance error\n", info->name);
2497+ gvt_vgpu_err("%s IP advance error\n", info->name);
24672498 return ret;
24682499 }
24692500 }
@@ -2486,6 +2517,7 @@ static int command_scan(struct parser_exec_state *s, · 16 unmodified lines
24862517
24872518 unsigned long gma_head, gma_tail, gma_bottom;
24882519 int ret = 0;
2520+ struct intel_vgpu *vgpu = s->vgpu;
24892521
24902522 gma_head = rb_start + rb_head;
24912523 gma_tail = rb_start + rb_tail;
@@ -2497,7 +2529,7 @@ static int command_scan(struct parser_exec_state *s, · 5 unmodified lines
24972529 if (s->buf_type == RING_BUFFER_INSTRUCTION) {
24982530 if (!(s->ip_gma >= rb_start) ||
24992531 !(s->ip_gma < gma_bottom)) {
2500− gvt_err("ip_gma %lx out of ring scope."
2532+ gvt_vgpu_err("ip_gma %lx out of ring scope."
25012533 "(base:0x%lx, bottom: 0x%lx)\n",
25022534 s->ip_gma, rb_start,
25032535 gma_bottom);
@@ -2505,7 +2537,7 @@ static int command_scan(struct parser_exec_state *s, · 1 unmodified line
25052537 return -EINVAL;
25062538 }
25072539 if (gma_out_of_range(s->ip_gma, gma_head, gma_tail)) {
2508− gvt_err("ip_gma %lx out of range."
2540+ gvt_vgpu_err("ip_gma %lx out of range."
25092541 "base 0x%lx head 0x%lx tail 0x%lx\n",
25102542 s->ip_gma, rb_start,
25112543 rb_head, rb_tail);
@@ -2515,7 +2547,7 @@ static int command_scan(struct parser_exec_state *s, · 3 unmodified lines
25152547 }
25162548 ret = cmd_parser_exec(s);
25172549 if (ret) {
2518− gvt_err("cmd parser error\n");
2550+ gvt_vgpu_err("cmd parser error\n");
25192551 parser_exec_state_dump(s);
25202552 break;
25212553 }
@@ -2634,8 +2666,8 @@ static int shadow_workload_ring_buffer(struct intel_vgpu_workload *workload) · 112 unmodified lines
26342666 if (gma_head > gma_tail) {
26352667 ret = copy_gma_to_hva(vgpu, vgpu->gtt.ggtt_mm,
26362668 gma_head, gma_top, cs);
2637− if (ret < 0) {
2638− gvt_err("fail to copy guest ring buffer\n");
2669+ if (ret) {
2670+ gvt_vgpu_err("fail to copy guest ring buffer\n");
26392671 return ret;
26402672 }
26412673 cs += ret / sizeof(u32);
@@ -2644,8 +2676,8 @@ static int shadow_workload_ring_buffer(struct intel_vgpu_workload *workload) · 2 unmodified lines
26442676
26452677 /* copy head or start <-> tail */
26462678 ret = copy_gma_to_hva(vgpu, vgpu->gtt.ggtt_mm, gma_head, gma_tail, cs);
2647− if (ret < 0) {
2648− gvt_err("fail to copy guest ring buffer\n");
2679+ if (ret) {
2680+ gvt_vgpu_err("fail to copy guest ring buffer\n");
26492681 return ret;
26502682 }
26512683 cs += ret / sizeof(u32);
@@ -2656,16 +2688,17 @@ static int shadow_workload_ring_buffer(struct intel_vgpu_workload *workload) · 4 unmodified lines
26562688 int intel_gvt_scan_and_shadow_workload(struct intel_vgpu_workload *workload)
26572689 {
26582690 int ret;
2691+ struct intel_vgpu *vgpu = workload->vgpu;
26592692
26602693 ret = shadow_workload_ring_buffer(workload);
26612694 if (ret) {
2662− gvt_err("fail to shadow workload ring_buffer\n");
2695+ gvt_vgpu_err("fail to shadow workload ring_buffer\n");
26632696 return ret;
26642697 }
26652698
26662699 ret = scan_workload(workload);
26672700 if (ret) {
2668− gvt_err("scan workload error\n");
2701+ gvt_vgpu_err("scan workload error\n");
26692702 return ret;
26702703 }
26712704 return 0;
@@ -2675,6 +2708,7 @@ static int shadow_indirect_ctx(struct intel_shadow_wa_ctx *wa_ctx) · 3 unmodified lines
26752708 {
26762709 int ctx_size = wa_ctx->indirect_ctx.size;
26772710 unsigned long guest_gma = wa_ctx->indirect_ctx.guest_gma;
2711+ struct intel_vgpu *vgpu = wa_ctx->workload->vgpu;
26782712 struct drm_i915_gem_object *obj;
26792713 int ret = 0;
26802714 void *map;
@@ -2688,14 +2722,14 @@ static int shadow_indirect_ctx(struct intel_shadow_wa_ctx *wa_ctx) · 7 unmodified lines
26882722 /* get the va of the shadow batch buffer */
26892723 map = i915_gem_object_pin_map(obj, I915_MAP_WB);
26902724 if (IS_ERR(map)) {
2691− gvt_err("failed to vmap shadow indirect ctx\n");
2725+ gvt_vgpu_err("failed to vmap shadow indirect ctx\n");
26922726 ret = PTR_ERR(map);
26932727 goto put_obj;
26942728 }
26952729
26962730 ret = i915_gem_object_set_to_cpu_domain(obj, false);
26972731 if (ret) {
2698− gvt_err("failed to set shadow indirect ctx to CPU\n");
2732+ gvt_vgpu_err("failed to set shadow indirect ctx to CPU\n");
26992733 goto unmap_src;
27002734 }
27012735
@@ -2703,8 +2737,8 @@ static int shadow_indirect_ctx(struct intel_shadow_wa_ctx *wa_ctx) · 1 unmodified line
27032737 wa_ctx->workload->vgpu->gtt.ggtt_mm,
27042738 guest_gma, guest_gma + ctx_size,
27052739 map);
2706− if (ret < 0) {
2707− gvt_err("fail to copy guest indirect ctx\n");
2740+ if (ret) {
2741+ gvt_vgpu_err("fail to copy guest indirect ctx\n");
27082742 goto unmap_src;
27092743 }
27102744
@@ -2738,13 +2772,14 @@ static int combine_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx) · 27 unmodified lines
27382772 int intel_gvt_scan_and_shadow_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx)
27392773 {
27402774 int ret;
2775+ struct intel_vgpu *vgpu = wa_ctx->workload->vgpu;
27412776
27422777 if (wa_ctx->indirect_ctx.size == 0)
27432778 return 0;
27442779
27452780 ret = shadow_indirect_ctx(wa_ctx);
27462781 if (ret) {
2747− gvt_err("fail to shadow indirect ctx\n");
2782+ gvt_vgpu_err("fail to shadow indirect ctx\n");
27482783 return ret;
27492784 }
27502785
@@ -2752,7 +2787,7 @@ int intel_gvt_scan_and_shadow_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx) · 1 unmodified line
27522787
27532788 ret = scan_wa_ctx(wa_ctx);
27542789 if (ret) {
2755− gvt_err("scan wa ctx error\n");
2790+ gvt_vgpu_err("scan wa ctx error\n");
27562791 return ret;
27572792 }
27582793
drivers/gpu/drm/i915/gvt/debug.h+8−0
@@ -27,6 +27,14 @@ · 26 unmodified lines
2727 #define gvt_err(fmt, args...) \
2828 DRM_ERROR("gvt: "fmt, ##args)
2929
30+#define gvt_vgpu_err(fmt, args...) \
31+do { \
32+ if (IS_ERR_OR_NULL(vgpu)) \
33+ DRM_DEBUG_DRIVER("gvt: "fmt, ##args); \
34+ else \
35+ DRM_DEBUG_DRIVER("gvt: vgpu %d: "fmt, vgpu->id, ##args);\
36+} while (0)
37+
3038 #define gvt_dbg_core(fmt, args...) \
3139 DRM_DEBUG_DRIVER("gvt: core: "fmt, ##args)
3240
drivers/gpu/drm/i915/gvt/edid.c+6−7
@@ -52,16 +52,16 @@ static unsigned char edid_get_byte(struct intel_vgpu *vgpu) · 51 unmodified lines
5252 unsigned char chr = 0;
5353
5454 if (edid->state == I2C_NOT_SPECIFIED || !edid->slave_selected) {
55− gvt_err("Driver tries to read EDID without proper sequence!\n");
55+ gvt_vgpu_err("Driver tries to read EDID without proper sequence!\n");
5656 return 0;
5757 }
5858 if (edid->current_edid_read >= EDID_SIZE) {
59− gvt_err("edid_get_byte() exceeds the size of EDID!\n");
59+ gvt_vgpu_err("edid_get_byte() exceeds the size of EDID!\n");
6060 return 0;
6161 }
6262
6363 if (!edid->edid_available) {
64− gvt_err("Reading EDID but EDID is not available!\n");
64+ gvt_vgpu_err("Reading EDID but EDID is not available!\n");
6565 return 0;
6666 }
6767
@@ -72,7 +72,7 @@ static unsigned char edid_get_byte(struct intel_vgpu *vgpu) · 4 unmodified lines
7272 chr = edid_data->edid_block[edid->current_edid_read];
7373 edid->current_edid_read++;
7474 } else {
75− gvt_err("No EDID available during the reading?\n");
75+ gvt_vgpu_err("No EDID available during the reading?\n");
7676 }
7777 return chr;
7878 }
@@ -223,7 +223,7 @@ static int gmbus1_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, · 144 unmodified lines
223223 vgpu_vreg(vgpu, PCH_GMBUS2) |= GMBUS_ACTIVE;
224224 break;
225225 default:
226− gvt_err("Unknown/reserved GMBUS cycle detected!\n");
226+ gvt_vgpu_err("Unknown/reserved GMBUS cycle detected!\n");
227227 break;
228228 }
229229 /*
@@ -292,8 +292,7 @@ static int gmbus3_mmio_read(struct intel_vgpu *vgpu, unsigned int offset, · 62 unmodified lines
292292 */
293293 } else {
294294 memcpy(p_data, &vgpu_vreg(vgpu, offset), bytes);
295− gvt_err("vgpu%d: warning: gmbus3 read with nothing returned\n",
296− vgpu->id);
295+ gvt_vgpu_err("warning: gmbus3 read with nothing returned\n");
297296 }
298297 return 0;
299298 }
drivers/gpu/drm/i915/gvt/execlist.c+13−16
@@ -172,6 +172,7 @@ static int emulate_execlist_ctx_schedule_out( · 171 unmodified lines
172172 struct intel_vgpu_execlist *execlist,
173173 struct execlist_ctx_descriptor_format *ctx)
174174 {
175+ struct intel_vgpu *vgpu = execlist->vgpu;
175176 struct intel_vgpu_execlist_slot *running = execlist->running_slot;
176177 struct intel_vgpu_execlist_slot *pending = execlist->pending_slot;
177178 struct execlist_ctx_descriptor_format *ctx0 = &running->ctx[0];
@@ -183,7 +184,7 @@ static int emulate_execlist_ctx_schedule_out( · 5 unmodified lines
183184 gvt_dbg_el("schedule out context id %x\n", ctx->context_id);
184185
185186 if (WARN_ON(!same_context(ctx, execlist->running_context))) {
186− gvt_err("schedule out context is not running context,"
187+ gvt_vgpu_err("schedule out context is not running context,"
187188 "ctx id %x running ctx id %x\n",
188189 ctx->context_id,
189190 execlist->running_context->context_id);
@@ -254,7 +255,7 @@ static struct intel_vgpu_execlist_slot *get_next_execlist_slot( · 64 unmodified lines
254255 status.udw = vgpu_vreg(vgpu, status_reg + 4);
255256
256257 if (status.execlist_queue_full) {
257− gvt_err("virtual execlist slots are full\n");
258+ gvt_vgpu_err("virtual execlist slots are full\n");
258259 return NULL;
259260 }
260261
@@ -270,11 +271,12 @@ static int emulate_execlist_schedule_in(struct intel_vgpu_execlist *execlist, · 9 unmodified lines
270271
271272 struct execlist_ctx_descriptor_format *ctx0, *ctx1;
272273 struct execlist_context_status_format status;
274+ struct intel_vgpu *vgpu = execlist->vgpu;
273275
274276 gvt_dbg_el("emulate schedule-in\n");
275277
276278 if (!slot) {
277− gvt_err("no available execlist slot\n");
279+ gvt_vgpu_err("no available execlist slot\n");
278280 return -EINVAL;
279281 }
280282
@@ -375,7 +377,6 @@ static void prepare_shadow_batch_buffer(struct intel_vgpu_workload *workload) · 94 unmodified lines
375377
376378 vma = i915_gem_object_ggtt_pin(entry_obj->obj, NULL, 0, 4, 0);
377379 if (IS_ERR(vma)) {
378− gvt_err("Cannot pin\n");
379380 return;
380381 }
381382
@@ -428,7 +429,6 @@ static void prepare_shadow_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx) · 46 unmodified lines
428429 vma = i915_gem_object_ggtt_pin(wa_ctx->indirect_ctx.obj, NULL,
429430 0, CACHELINE_BYTES, 0);
430431 if (IS_ERR(vma)) {
431− gvt_err("Cannot pin indirect ctx obj\n");
432432 return;
433433 }
434434
@@ -561,6 +561,7 @@ static int prepare_mm(struct intel_vgpu_workload *workload) · 126 unmodified lines
561561 {
562562 struct execlist_ctx_descriptor_format *desc = &workload->ctx_desc;
563563 struct intel_vgpu_mm *mm;
564+ struct intel_vgpu *vgpu = workload->vgpu;
564565 int page_table_level;
565566 u32 pdp[8];
566567
@@ -569,7 +570,7 @@ static int prepare_mm(struct intel_vgpu_workload *workload) · 2 unmodified lines
569570 } else if (desc->addressing_mode == 3) { /* legacy 64 bit */
570571 page_table_level = 4;
571572 } else {
572− gvt_err("Advanced Context mode(SVM) is not supported!\n");
573+ gvt_vgpu_err("Advanced Context mode(SVM) is not supported!\n");
573574 return -EINVAL;
574575 }
575576
@@ -583,7 +584,7 @@ static int prepare_mm(struct intel_vgpu_workload *workload) · 7 unmodified lines
583584 mm = intel_vgpu_create_mm(workload->vgpu, INTEL_GVT_MM_PPGTT,
584585 pdp, page_table_level, 0);
585586 if (IS_ERR(mm)) {
586− gvt_err("fail to create mm object.\n");
587+ gvt_vgpu_err("fail to create mm object.\n");
587588 return PTR_ERR(mm);
588589 }
589590 }
@@ -609,7 +610,7 @@ static int submit_context(struct intel_vgpu *vgpu, int ring_id, · 19 unmodified lines
609610 ring_context_gpa = intel_vgpu_gma_to_gpa(vgpu->gtt.ggtt_mm,
610611 (u32)((desc->lrca + 1) << GTT_PAGE_SHIFT));
611612 if (ring_context_gpa == INTEL_GVT_INVALID_ADDR) {
612− gvt_err("invalid guest context LRCA: %x\n", desc->lrca);
613+ gvt_vgpu_err("invalid guest context LRCA: %x\n", desc->lrca);
613614 return -EINVAL;
614615 }
615616
@@ -724,8 +725,7 @@ int intel_vgpu_submit_execlist(struct intel_vgpu *vgpu, int ring_id) · 108 unmodified lines
724725 continue;
725726
726727 if (!desc[i]->privilege_access) {
727− gvt_err("vgpu%d: unexpected GGTT elsp submission\n",
728− vgpu->id);
728+ gvt_vgpu_err("unexpected GGTT elsp submission\n");
729729 return -EINVAL;
730730 }
731731
@@ -735,15 +735,13 @@ int intel_vgpu_submit_execlist(struct intel_vgpu *vgpu, int ring_id) · 3 unmodified lines
735735 }
736736
737737 if (!valid_desc_bitmap) {
738− gvt_err("vgpu%d: no valid desc in a elsp submission\n",
739− vgpu->id);
738+ gvt_vgpu_err("no valid desc in a elsp submission\n");
740739 return -EINVAL;
741740 }
742741
743742 if (!test_bit(0, (void *)&valid_desc_bitmap) &&
744743 test_bit(1, (void *)&valid_desc_bitmap)) {
745− gvt_err("vgpu%d: weird elsp submission, desc 0 is not valid\n",
746− vgpu->id);
744+ gvt_vgpu_err("weird elsp submission, desc 0 is not valid\n");
747745 return -EINVAL;
748746 }
749747
@@ -752,8 +750,7 @@ int intel_vgpu_submit_execlist(struct intel_vgpu *vgpu, int ring_id) · 2 unmodified lines
752750 ret = submit_context(vgpu, ring_id, &valid_desc[i],
753751 emulate_schedule_in);
754752 if (ret) {
755− gvt_err("vgpu%d: fail to schedule workload\n",
756− vgpu->id);
753+ gvt_vgpu_err("fail to schedule workload\n");
757754 return ret;
758755 }
759756 emulate_schedule_in = false;
drivers/gpu/drm/i915/gvt/gtt.c+36−38
@@ -49,8 +49,8 @@ bool intel_gvt_ggtt_validate_range(struct intel_vgpu *vgpu, u64 addr, u32 size) · 48 unmodified lines
4949 {
5050 if ((!vgpu_gmadr_is_valid(vgpu, addr)) || (size
5151 && !vgpu_gmadr_is_valid(vgpu, addr + size - 1))) {
52− gvt_err("vgpu%d: invalid range gmadr 0x%llx size 0x%x\n",
53− vgpu->id, addr, size);
52+ gvt_vgpu_err("invalid range gmadr 0x%llx size 0x%x\n",
53+ addr, size);
5454 return false;
5555 }
5656 return true;
@@ -430,7 +430,7 @@ static int gtt_entry_p2m(struct intel_vgpu *vgpu, struct intel_gvt_gtt_entry *p, · 373 unmodified lines
430430
431431 mfn = intel_gvt_hypervisor_gfn_to_mfn(vgpu, gfn);
432432 if (mfn == INTEL_GVT_INVALID_ADDR) {
433− gvt_err("fail to translate gfn: 0x%lx\n", gfn);
433+ gvt_vgpu_err("fail to translate gfn: 0x%lx\n", gfn);
434434 return -ENXIO;
435435 }
436436
@@ -611,7 +611,7 @@ static inline int init_shadow_page(struct intel_vgpu *vgpu, · 174 unmodified lines
611611
612612 daddr = dma_map_page(kdev, p->page, 0, 4096, PCI_DMA_BIDIRECTIONAL);
613613 if (dma_mapping_error(kdev, daddr)) {
614− gvt_err("fail to map dma addr\n");
614+ gvt_vgpu_err("fail to map dma addr\n");
615615 return -EINVAL;
616616 }
617617
@@ -735,7 +735,7 @@ retry: · 117 unmodified lines
735735 if (reclaim_one_mm(vgpu->gvt))
736736 goto retry;
737737
738− gvt_err("fail to allocate ppgtt shadow page\n");
738+ gvt_vgpu_err("fail to allocate ppgtt shadow page\n");
739739 return ERR_PTR(-ENOMEM);
740740 }
741741
@@ -750,14 +750,14 @@ retry: · 8 unmodified lines
750750 */
751751 ret = init_shadow_page(vgpu, &spt->shadow_page, type);
752752 if (ret) {
753− gvt_err("fail to initialize shadow page for spt\n");
753+ gvt_vgpu_err("fail to initialize shadow page for spt\n");
754754 goto err;
755755 }
756756
757757 ret = intel_vgpu_init_guest_page(vgpu, &spt->guest_page,
758758 gfn, ppgtt_write_protection_handler, NULL);
759759 if (ret) {
760− gvt_err("fail to initialize guest page for spt\n");
760+ gvt_vgpu_err("fail to initialize guest page for spt\n");
761761 goto err;
762762 }
763763
@@ -776,8 +776,7 @@ static struct intel_vgpu_ppgtt_spt *ppgtt_find_shadow_page( · 12 unmodified lines
776776 if (p)
777777 return shadow_page_to_ppgtt_spt(p);
778778
779− gvt_err("vgpu%d: fail to find ppgtt shadow page: 0x%lx\n",
780− vgpu->id, mfn);
779+ gvt_vgpu_err("fail to find ppgtt shadow page: 0x%lx\n", mfn);
781780 return NULL;
782781 }
783782
@@ -827,8 +826,8 @@ static int ppgtt_invalidate_shadow_page_by_shadow_entry(struct intel_vgpu *vgpu, · 43 unmodified lines
827826 }
828827 s = ppgtt_find_shadow_page(vgpu, ops->get_pfn(e));
829828 if (!s) {
830− gvt_err("vgpu%d: fail to find shadow page: mfn: 0x%lx\n",
831− vgpu->id, ops->get_pfn(e));
829+ gvt_vgpu_err("fail to find shadow page: mfn: 0x%lx\n",
830+ ops->get_pfn(e));
832831 return -ENXIO;
833832 }
834833 return ppgtt_invalidate_shadow_page(s);
@@ -836,6 +835,7 @@ static int ppgtt_invalidate_shadow_page_by_shadow_entry(struct intel_vgpu *vgpu, · 1 unmodified line
836835
837836 static int ppgtt_invalidate_shadow_page(struct intel_vgpu_ppgtt_spt *spt)
838837 {
838+ struct intel_vgpu *vgpu = spt->vgpu;
839839 struct intel_gvt_gtt_entry e;
840840 unsigned long index;
841841 int ret;
@@ -854,7 +854,7 @@ static int ppgtt_invalidate_shadow_page(struct intel_vgpu_ppgtt_spt *spt) · 12 unmodified lines
854854
855855 for_each_present_shadow_entry(spt, &e, index) {
856856 if (!gtt_type_is_pt(get_next_pt_type(e.type))) {
857− gvt_err("GVT doesn't support pse bit for now\n");
857+ gvt_vgpu_err("GVT doesn't support pse bit for now\n");
858858 return -EINVAL;
859859 }
860860 ret = ppgtt_invalidate_shadow_page_by_shadow_entry(
@@ -868,8 +868,8 @@ release: · 7 unmodified lines
868868 ppgtt_free_shadow_page(spt);
869869 return 0;
870870 fail:
871− gvt_err("vgpu%d: fail: shadow page %p shadow entry 0x%llx type %d\n",
872− spt->vgpu->id, spt, e.val64, e.type);
871+ gvt_vgpu_err("fail: shadow page %p shadow entry 0x%llx type %d\n",
872+ spt, e.val64, e.type);
873873 return ret;
874874 }
875875
@@ -914,8 +914,8 @@ static struct intel_vgpu_ppgtt_spt *ppgtt_populate_shadow_page_by_guest_entry( · 38 unmodified lines
914914 }
915915 return s;
916916 fail:
917− gvt_err("vgpu%d: fail: shadow page %p guest entry 0x%llx type %d\n",
918− vgpu->id, s, we->val64, we->type);
917+ gvt_vgpu_err("fail: shadow page %p guest entry 0x%llx type %d\n",
918+ s, we->val64, we->type);
919919 return ERR_PTR(ret);
920920 }
921921
@@ -953,7 +953,7 @@ static int ppgtt_populate_shadow_page(struct intel_vgpu_ppgtt_spt *spt) · 31 unmodified lines
953953
954954 for_each_present_guest_entry(spt, &ge, i) {
955955 if (!gtt_type_is_pt(get_next_pt_type(ge.type))) {
956− gvt_err("GVT doesn't support pse bit now\n");
956+ gvt_vgpu_err("GVT doesn't support pse bit now\n");
957957 ret = -EINVAL;
958958 goto fail;
959959 }
@@ -969,8 +969,8 @@ static int ppgtt_populate_shadow_page(struct intel_vgpu_ppgtt_spt *spt) · 9 unmodified lines
969969 }
970970 return 0;
971971 fail:
972− gvt_err("vgpu%d: fail: shadow page %p guest entry 0x%llx type %d\n",
973− vgpu->id, spt, ge.val64, ge.type);
972+ gvt_vgpu_err("fail: shadow page %p guest entry 0x%llx type %d\n",
973+ spt, ge.val64, ge.type);
974974 return ret;
975975 }
976976
@@ -999,7 +999,7 @@ static int ppgtt_handle_guest_entry_removal(struct intel_vgpu_guest_page *gpt, · 22 unmodified lines
999999 struct intel_vgpu_ppgtt_spt *s =
10001000 ppgtt_find_shadow_page(vgpu, ops->get_pfn(&e));
10011001 if (!s) {
1002− gvt_err("fail to find guest page\n");
1002+ gvt_vgpu_err("fail to find guest page\n");
10031003 ret = -ENXIO;
10041004 goto fail;
10051005 }
@@ -1011,8 +1011,8 @@ static int ppgtt_handle_guest_entry_removal(struct intel_vgpu_guest_page *gpt, · 5 unmodified lines
10111011 ppgtt_set_shadow_entry(spt, &e, index);
10121012 return 0;
10131013 fail:
1014− gvt_err("vgpu%d: fail: shadow page %p guest entry 0x%llx type %d\n",
1015− vgpu->id, spt, e.val64, e.type);
1014+ gvt_vgpu_err("fail: shadow page %p guest entry 0x%llx type %d\n",
1015+ spt, e.val64, e.type);
10161016 return ret;
10171017 }
10181018
@@ -1046,8 +1046,8 @@ static int ppgtt_handle_guest_entry_add(struct intel_vgpu_guest_page *gpt, · 27 unmodified lines
10461046 }
10471047 return 0;
10481048 fail:
1049− gvt_err("vgpu%d: fail: spt %p guest entry 0x%llx type %d\n", vgpu->id,
1050− spt, we->val64, we->type);
1049+ gvt_vgpu_err("fail: spt %p guest entry 0x%llx type %d\n",
1050+ spt, we->val64, we->type);
10511051 return ret;
10521052 }
10531053
@@ -1250,8 +1250,8 @@ static int ppgtt_handle_guest_write_page_table( · 196 unmodified lines
12501250 }
12511251 return 0;
12521252 fail:
1253− gvt_err("vgpu%d: fail: shadow page %p guest entry 0x%llx type %d.\n",
1254− vgpu->id, spt, we->val64, we->type);
1253+ gvt_vgpu_err("fail: shadow page %p guest entry 0x%llx type %d.\n",
1254+ spt, we->val64, we->type);
12551255 return ret;
12561256 }
12571257
@@ -1493,7 +1493,7 @@ static int shadow_mm(struct intel_vgpu_mm *mm) · 235 unmodified lines
14931493
14941494 spt = ppgtt_populate_shadow_page_by_guest_entry(vgpu, &ge);
14951495 if (IS_ERR(spt)) {
1496− gvt_err("fail to populate guest root pointer\n");
1496+ gvt_vgpu_err("fail to populate guest root pointer\n");
14971497 ret = PTR_ERR(spt);
14981498 goto fail;
14991499 }
@@ -1566,7 +1566,7 @@ struct intel_vgpu_mm *intel_vgpu_create_mm(struct intel_vgpu *vgpu, · 66 unmodified lines
15661566
15671567 ret = gtt->mm_alloc_page_table(mm);
15681568 if (ret) {
1569− gvt_err("fail to allocate page table for mm\n");
1569+ gvt_vgpu_err("fail to allocate page table for mm\n");
15701570 goto fail;
15711571 }
15721572
@@ -1584,7 +1584,7 @@ struct intel_vgpu_mm *intel_vgpu_create_mm(struct intel_vgpu *vgpu, · 11 unmodified lines
15841584 }
15851585 return mm;
15861586 fail:
1587− gvt_err("fail to create mm\n");
1587+ gvt_vgpu_err("fail to create mm\n");
15881588 if (mm)
15891589 intel_gvt_mm_unreference(mm);
15901590 return ERR_PTR(ret);
@@ -1760,7 +1760,7 @@ unsigned long intel_vgpu_gma_to_gpa(struct intel_vgpu_mm *mm, unsigned long gma) · 169 unmodified lines
17601760 mm->page_table_level, gma, gpa);
17611761 return gpa;
17621762 err:
1763− gvt_err("invalid mm type: %d gma %lx\n", mm->type, gma);
1763+ gvt_vgpu_err("invalid mm type: %d gma %lx\n", mm->type, gma);
17641764 return INTEL_GVT_INVALID_ADDR;
17651765 }
17661766
@@ -1836,8 +1836,7 @@ static int emulate_gtt_mmio_write(struct intel_vgpu *vgpu, unsigned int off, · 69 unmodified lines
18361836 if (ops->test_present(&e)) {
18371837 ret = gtt_entry_p2m(vgpu, &e, &m);
18381838 if (ret) {
1839− gvt_err("vgpu%d: fail to translate guest gtt entry\n",
1840− vgpu->id);
1839+ gvt_vgpu_err("fail to translate guest gtt entry\n");
18411840 return ret;
18421841 }
18431842 } else {
@@ -1893,14 +1892,14 @@ static int alloc_scratch_pages(struct intel_vgpu *vgpu, · 49 unmodified lines
18931892
18941893 scratch_pt = (void *)get_zeroed_page(GFP_KERNEL);
18951894 if (!scratch_pt) {
1896− gvt_err("fail to allocate scratch page\n");
1895+ gvt_vgpu_err("fail to allocate scratch page\n");
18971896 return -ENOMEM;
18981897 }
18991898
19001899 daddr = dma_map_page(dev, virt_to_page(scratch_pt), 0,
19011900 4096, PCI_DMA_BIDIRECTIONAL);
19021901 if (dma_mapping_error(dev, daddr)) {
1903− gvt_err("fail to dmamap scratch_pt\n");
1902+ gvt_vgpu_err("fail to dmamap scratch_pt\n");
19041903 __free_page(virt_to_page(scratch_pt));
19051904 return -ENOMEM;
19061905 }
@@ -2003,7 +2002,7 @@ int intel_vgpu_init_gtt(struct intel_vgpu *vgpu) · 96 unmodified lines
20032002 ggtt_mm = intel_vgpu_create_mm(vgpu, INTEL_GVT_MM_GGTT,
20042003 NULL, 1, 0);
20052004 if (IS_ERR(ggtt_mm)) {
2006− gvt_err("fail to create mm for ggtt.\n");
2005+ gvt_vgpu_err("fail to create mm for ggtt.\n");
20072006 return PTR_ERR(ggtt_mm);
20082007 }
20092008
@@ -2076,7 +2075,6 @@ static int setup_spt_oos(struct intel_gvt *gvt) · 66 unmodified lines
20762075 for (i = 0; i < preallocated_oos_pages; i++) {
20772076 oos_page = kzalloc(sizeof(*oos_page), GFP_KERNEL);
20782077 if (!oos_page) {
2079− gvt_err("fail to pre-allocate oos page\n");
20802078 ret = -ENOMEM;
20812079 goto fail;
20822080 }
@@ -2166,7 +2164,7 @@ int intel_vgpu_g2v_create_ppgtt_mm(struct intel_vgpu *vgpu, · 83 unmodified lines
21662164 mm = intel_vgpu_create_mm(vgpu, INTEL_GVT_MM_PPGTT,
21672165 pdp, page_table_level, 0);
21682166 if (IS_ERR(mm)) {
2169− gvt_err("fail to create mm\n");
2167+ gvt_vgpu_err("fail to create mm\n");
21702168 return PTR_ERR(mm);
21712169 }
21722170 }
@@ -2196,7 +2194,7 @@ int intel_vgpu_g2v_destroy_ppgtt_mm(struct intel_vgpu *vgpu, · 23 unmodified lines
21962194
21972195 mm = intel_vgpu_find_ppgtt_mm(vgpu, page_table_level, pdp);
21982196 if (!mm) {
2199− gvt_err("fail to find ppgtt instance.\n");
2197+ gvt_vgpu_err("fail to find ppgtt instance.\n");
22002198 return -EINVAL;
22012199 }
22022200 intel_gvt_mm_unreference(mm);
drivers/gpu/drm/i915/gvt/handlers.c+30−15
@@ -181,11 +181,9 @@ static int sanitize_fence_mmio_access(struct intel_vgpu *vgpu, · 180 unmodified lines
181181 GVT_FAILSAFE_UNSUPPORTED_GUEST);
182182
183183 if (!vgpu->mmio.disable_warn_untrack) {
184− gvt_err("vgpu%d: found oob fence register access\n",
185− vgpu->id);
186− gvt_err("vgpu%d: total fence %d, access fence %d\n",
187− vgpu->id, vgpu_fence_sz(vgpu),
188− fence_num);
184+ gvt_vgpu_err("found oob fence register access\n");
185+ gvt_vgpu_err("total fence %d, access fence %d\n",
186+ vgpu_fence_sz(vgpu), fence_num);
189187 }
190188 memset(p_data, 0, bytes);
191189 return -EINVAL;
@@ -249,7 +247,7 @@ static int mul_force_wake_write(struct intel_vgpu *vgpu, · 57 unmodified lines
249247 break;
250248 default:
251249 /*should not hit here*/
252− gvt_err("invalid forcewake offset 0x%x\n", offset);
250+ gvt_vgpu_err("invalid forcewake offset 0x%x\n", offset);
253251 return -EINVAL;
254252 }
255253 } else {
@@ -530,7 +528,7 @@ static int check_fdi_rx_train_status(struct intel_vgpu *vgpu, · 274 unmodified lines
530528 fdi_tx_train_bits = FDI_LINK_TRAIN_PATTERN_2;
531529 fdi_iir_check_bits = FDI_RX_SYMBOL_LOCK;
532530 } else {
533− gvt_err("Invalid train pattern %d\n", train_pattern);
531+ gvt_vgpu_err("Invalid train pattern %d\n", train_pattern);
534532 return -EINVAL;
535533 }
536534
@@ -588,7 +586,7 @@ static int update_fdi_rx_iir_status(struct intel_vgpu *vgpu, · 51 unmodified lines
588586 else if (FDI_RX_IMR_TO_PIPE(offset) != INVALID_INDEX)
589587 index = FDI_RX_IMR_TO_PIPE(offset);
590588 else {
591− gvt_err("Unsupport registers %x\n", offset);
589+ gvt_vgpu_err("Unsupport registers %x\n", offset);
592590 return -EINVAL;
593591 }
594592
@@ -818,7 +816,7 @@ static int dp_aux_ch_ctl_mmio_write(struct intel_vgpu *vgpu, · 223 unmodified lines
818816 u32 data;
819817
820818 if (!dpy_is_valid_port(port_index)) {
821− gvt_err("GVT(%d): Unsupported DP port access!\n", vgpu->id);
819+ gvt_vgpu_err("Unsupported DP port access!\n");
822820 return 0;
823821 }
824822
@@ -1016,8 +1014,7 @@ static void write_virtual_sbi_register(struct intel_vgpu *vgpu, · 191 unmodified lines
10161014
10171015 if (i == num) {
10181016 if (num == SBI_REG_MAX) {
1019− gvt_err("vgpu%d: SBI caching meets maximum limits\n",
1020− vgpu->id);
1017+ gvt_vgpu_err("SBI caching meets maximum limits\n");
10211018 return;
10221019 }
10231020 display->sbi.number++;
@@ -1097,7 +1094,7 @@ static int pvinfo_mmio_read(struct intel_vgpu *vgpu, unsigned int offset, · 73 unmodified lines
10971094 break;
10981095 }
10991096 if (invalid_read)
1100− gvt_err("invalid pvinfo read: [%x:%x] = %x\n",
1097+ gvt_vgpu_err("invalid pvinfo read: [%x:%x] = %x\n",
11011098 offset, bytes, *(u32 *)p_data);
11021099 vgpu->pv_notified = true;
11031100 return 0;
@@ -1125,7 +1122,7 @@ static int handle_g2v_notification(struct intel_vgpu *vgpu, int notification) · 21 unmodified lines
11251122 case 1: /* Remove this in guest driver. */
11261123 break;
11271124 default:
1128− gvt_err("Invalid PV notification %d\n", notification);
1125+ gvt_vgpu_err("Invalid PV notification %d\n", notification);
11291126 }
11301127 return ret;
11311128 }
@@ -1181,7 +1178,7 @@ static int pvinfo_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, · 49 unmodified lines
11811178 enter_failsafe_mode(vgpu, GVT_FAILSAFE_INSUFFICIENT_RESOURCE);
11821179 break;
11831180 default:
1184− gvt_err("invalid pvinfo write offset %x bytes %x data %x\n",
1181+ gvt_vgpu_err("invalid pvinfo write offset %x bytes %x data %x\n",
11851182 offset, bytes, data);
11861183 break;
11871184 }
@@ -1415,7 +1412,8 @@ static int elsp_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, · 227 unmodified lines
14151412 if (execlist->elsp_dwords.index == 3) {
14161413 ret = intel_vgpu_submit_execlist(vgpu, ring_id);
14171414 if(ret)
1418− gvt_err("fail submit workload on ring %d\n", ring_id);
1415+ gvt_vgpu_err("fail submit workload on ring %d\n",
1416+ ring_id);
14191417 }
14201418
14211419 ++execlist->elsp_dwords.index;
@@ -2988,3 +2986,20 @@ int intel_vgpu_default_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, · 1566 unmodified lines
29882986 write_vreg(vgpu, offset, p_data, bytes);
29892987 return 0;
29902988 }
2989+
2990+/**
2991+ * intel_gvt_in_force_nonpriv_whitelist - if a mmio is in whitelist to be
2992+ * force-nopriv register
2993+ *
2994+ * @gvt: a GVT device
2995+ * @offset: register offset
2996+ *
2997+ * Returns:
2998+ * True if the register is in force-nonpriv whitelist;
2999+ * False if outside;
3000+ */
3001+bool intel_gvt_in_force_nonpriv_whitelist(struct intel_gvt *gvt,
3002+ unsigned int offset)
3003+{
3004+ return in_whitelist(offset);
3005+}
drivers/gpu/drm/i915/gvt/kvmgt.c+23−14
@@ -426,7 +426,7 @@ static void kvmgt_protect_table_del(struct kvmgt_guest_info *info, · 425 unmodified lines
426426
427427 static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev)
428428 {
429− struct intel_vgpu *vgpu;
429+ struct intel_vgpu *vgpu = NULL;
430430 struct intel_vgpu_type *type;
431431 struct device *pdev;
432432 void *gvt;
@@ -437,7 +437,7 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev) · 4 unmodified lines
437437
438438 type = intel_gvt_find_vgpu_type(gvt, kobject_name(kobj));
439439 if (!type) {
440− gvt_err("failed to find type %s to create\n",
440+ gvt_vgpu_err("failed to find type %s to create\n",
441441 kobject_name(kobj));
442442 ret = -EINVAL;
443443 goto out;
@@ -446,7 +446,7 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev) · 2 unmodified lines
446446 vgpu = intel_gvt_ops->vgpu_create(gvt, type);
447447 if (IS_ERR_OR_NULL(vgpu)) {
448448 ret = vgpu == NULL ? -EFAULT : PTR_ERR(vgpu);
449− gvt_err("failed to create intel vgpu: %d\n", ret);
449+ gvt_vgpu_err("failed to create intel vgpu: %d\n", ret);
450450 goto out;
451451 }
452452
@@ -526,7 +526,8 @@ static int intel_vgpu_open(struct mdev_device *mdev) · 73 unmodified lines
526526 ret = vfio_register_notifier(mdev_dev(mdev), VFIO_IOMMU_NOTIFY, &events,
527527 &vgpu->vdev.iommu_notifier);
528528 if (ret != 0) {
529− gvt_err("vfio_register_notifier for iommu failed: %d\n", ret);
529+ gvt_vgpu_err("vfio_register_notifier for iommu failed: %d\n",
530+ ret);
530531 goto out;
531532 }
532533
@@ -534,7 +535,8 @@ static int intel_vgpu_open(struct mdev_device *mdev) · 1 unmodified line
534535 ret = vfio_register_notifier(mdev_dev(mdev), VFIO_GROUP_NOTIFY, &events,
535536 &vgpu->vdev.group_notifier);
536537 if (ret != 0) {
537− gvt_err("vfio_register_notifier for group failed: %d\n", ret);
538+ gvt_vgpu_err("vfio_register_notifier for group failed: %d\n",
539+ ret);
538540 goto undo_iommu;
539541 }
540542
@@ -635,7 +637,7 @@ static ssize_t intel_vgpu_rw(struct mdev_device *mdev, char *buf, · 94 unmodified lines
635637
636638
637639 if (index >= VFIO_PCI_NUM_REGIONS) {
638− gvt_err("invalid index: %u\n", index);
640+ gvt_vgpu_err("invalid index: %u\n", index);
639641 return -EINVAL;
640642 }
641643
@@ -669,7 +671,7 @@ static ssize_t intel_vgpu_rw(struct mdev_device *mdev, char *buf, · 27 unmodified lines
669671 case VFIO_PCI_VGA_REGION_INDEX:
670672 case VFIO_PCI_ROM_REGION_INDEX:
671673 default:
672− gvt_err("unsupported region: %u\n", index);
674+ gvt_vgpu_err("unsupported region: %u\n", index);
673675 }
674676
675677 return ret == 0 ? count : ret;
@@ -861,7 +863,7 @@ static int intel_vgpu_set_msi_trigger(struct intel_vgpu *vgpu, · 185 unmodified lines
861863
862864 trigger = eventfd_ctx_fdget(fd);
863865 if (IS_ERR(trigger)) {
864− gvt_err("eventfd_ctx_fdget failed\n");
866+ gvt_vgpu_err("eventfd_ctx_fdget failed\n");
865867 return PTR_ERR(trigger);
866868 }
867869 vgpu->vdev.msi_trigger = trigger;
@@ -1120,7 +1122,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd, · 252 unmodified lines
11201122 ret = vfio_set_irqs_validate_and_prepare(&hdr, max,
11211123 VFIO_PCI_NUM_IRQS, &data_size);
11221124 if (ret) {
1123− gvt_err("intel:vfio_set_irqs_validate_and_prepare failed\n");
1125+ gvt_vgpu_err("intel:vfio_set_irqs_validate_and_prepare failed\n");
11241126 return -EINVAL;
11251127 }
11261128 if (data_size) {
@@ -1310,7 +1312,7 @@ static int kvmgt_guest_init(struct mdev_device *mdev) · 183 unmodified lines
13101312
13111313 kvm = vgpu->vdev.kvm;
13121314 if (!kvm || kvm->mm != current->mm) {
1313− gvt_err("KVM is required to use Intel vGPU\n");
1315+ gvt_vgpu_err("KVM is required to use Intel vGPU\n");
13141316 return -ESRCH;
13151317 }
13161318
@@ -1337,8 +1339,10 @@ static int kvmgt_guest_init(struct mdev_device *mdev) · 20 unmodified lines
13371339
13381340 static bool kvmgt_guest_exit(struct kvmgt_guest_info *info)
13391341 {
1342+ struct intel_vgpu *vgpu = info->vgpu;
1343+
13401344 if (!info) {
1341− gvt_err("kvmgt_guest_info invalid\n");
1345+ gvt_vgpu_err("kvmgt_guest_info invalid\n");
13421346 return false;
13431347 }
13441348
@@ -1383,12 +1387,14 @@ static unsigned long kvmgt_gfn_to_pfn(unsigned long handle, unsigned long gfn) · 38 unmodified lines
13831387 unsigned long iova, pfn;
13841388 struct kvmgt_guest_info *info;
13851389 struct device *dev;
1390+ struct intel_vgpu *vgpu;
13861391 int rc;
13871392
13881393 if (!handle_valid(handle))
13891394 return INTEL_GVT_INVALID_ADDR;
13901395
13911396 info = (struct kvmgt_guest_info *)handle;
1397+ vgpu = info->vgpu;
13921398 iova = gvt_cache_find(info->vgpu, gfn);
13931399 if (iova != INTEL_GVT_INVALID_ADDR)
13941400 return iova;
@@ -1397,13 +1403,14 @@ static unsigned long kvmgt_gfn_to_pfn(unsigned long handle, unsigned long gfn) · 2 unmodified lines
13971403 dev = mdev_dev(info->vgpu->vdev.mdev);
13981404 rc = vfio_pin_pages(dev, &gfn, 1, IOMMU_READ | IOMMU_WRITE, &pfn);
13991405 if (rc != 1) {
1400− gvt_err("vfio_pin_pages failed for gfn 0x%lx: %d\n", gfn, rc);
1406+ gvt_vgpu_err("vfio_pin_pages failed for gfn 0x%lx: %d\n",
1407+ gfn, rc);
14011408 return INTEL_GVT_INVALID_ADDR;
14021409 }
14031410 /* transfer to host iova for GFX to use DMA */
14041411 rc = gvt_dma_map_iova(info->vgpu, pfn, &iova);
14051412 if (rc) {
1406− gvt_err("gvt_dma_map_iova failed for gfn: 0x%lx\n", gfn);
1413+ gvt_vgpu_err("gvt_dma_map_iova failed for gfn: 0x%lx\n", gfn);
14071414 vfio_unpin_pages(dev, &gfn, 1);
14081415 return INTEL_GVT_INVALID_ADDR;
14091416 }
@@ -1417,7 +1424,7 @@ static int kvmgt_rw_gpa(unsigned long handle, unsigned long gpa, · 7 unmodified lines
14171424 {
14181425 struct kvmgt_guest_info *info;
14191426 struct kvm *kvm;
1420− int ret;
1427+ int idx, ret;
14211428 bool kthread = current->mm == NULL;
14221429
14231430 if (!handle_valid(handle))
@@ -1429,8 +1436,10 @@ static int kvmgt_rw_gpa(unsigned long handle, unsigned long gpa, · 5 unmodified lines
14291436 if (kthread)
14301437 use_mm(kvm->mm);
14311438
1439+ idx = srcu_read_lock(&kvm->srcu);
14321440 ret = write ? kvm_write_guest(kvm, gpa, buf, len) :
14331441 kvm_read_guest(kvm, gpa, buf, len);
1442+ srcu_read_unlock(&kvm->srcu, idx);
14341443
14351444 if (kthread)
14361445 unuse_mm(kvm->mm);
drivers/gpu/drm/i915/gvt/mmio.c+19−19
@@ -142,10 +142,10 @@ int intel_vgpu_emulate_mmio_read(struct intel_vgpu *vgpu, uint64_t pa, · 141 unmodified lines
142142 ret = intel_gvt_hypervisor_read_gpa(vgpu, pa,
143143 p_data, bytes);
144144 if (ret) {
145− gvt_err("vgpu%d: guest page read error %d, "
145+ gvt_vgpu_err("guest page read error %d, "
146146 "gfn 0x%lx, pa 0x%llx, var 0x%x, len %d\n",
147− vgpu->id, ret,
148− gp->gfn, pa, *(u32 *)p_data, bytes);
147+ ret, gp->gfn, pa, *(u32 *)p_data,
148+ bytes);
149149 }
150150 mutex_unlock(&gvt->lock);
151151 return ret;
@@ -200,14 +200,13 @@ int intel_vgpu_emulate_mmio_read(struct intel_vgpu *vgpu, uint64_t pa, · 48 unmodified lines
200200 ret = intel_vgpu_default_mmio_read(vgpu, offset, p_data, bytes);
201201
202202 if (!vgpu->mmio.disable_warn_untrack) {
203− gvt_err("vgpu%d: read untracked MMIO %x(%dB) val %x\n",
204− vgpu->id, offset, bytes, *(u32 *)p_data);
203+ gvt_vgpu_err("read untracked MMIO %x(%dB) val %x\n",
204+ offset, bytes, *(u32 *)p_data);
205205
206206 if (offset == 0x206c) {
207− gvt_err("------------------------------------------\n");
208− gvt_err("vgpu%d: likely triggers a gfx reset\n",
209− vgpu->id);
210− gvt_err("------------------------------------------\n");
207+ gvt_vgpu_err("------------------------------------------\n");
208+ gvt_vgpu_err("likely triggers a gfx reset\n");
209+ gvt_vgpu_err("------------------------------------------\n");
211210 vgpu->mmio.disable_warn_untrack = true;
212211 }
213212 }
@@ -220,8 +219,8 @@ int intel_vgpu_emulate_mmio_read(struct intel_vgpu *vgpu, uint64_t pa, · 6 unmodified lines
220219 mutex_unlock(&gvt->lock);
221220 return 0;
222221 err:
223− gvt_err("vgpu%d: fail to emulate MMIO read %08x len %d\n",
224− vgpu->id, offset, bytes);
222+ gvt_vgpu_err("fail to emulate MMIO read %08x len %d\n",
223+ offset, bytes);
225224 mutex_unlock(&gvt->lock);
226225 return ret;
227226 }
@@ -259,10 +258,11 @@ int intel_vgpu_emulate_mmio_write(struct intel_vgpu *vgpu, uint64_t pa, · 31 unmodified lines
259258 if (gp) {
260259 ret = gp->handler(gp, pa, p_data, bytes);
261260 if (ret) {
262− gvt_err("vgpu%d: guest page write error %d, "
263− "gfn 0x%lx, pa 0x%llx, var 0x%x, len %d\n",
264− vgpu->id, ret,
265− gp->gfn, pa, *(u32 *)p_data, bytes);
261+ gvt_err("guest page write error %d, "
262+ "gfn 0x%lx, pa 0x%llx, "
263+ "var 0x%x, len %d\n",
264+ ret, gp->gfn, pa,
265+ *(u32 *)p_data, bytes);
266266 }
267267 mutex_unlock(&gvt->lock);
268268 return ret;
@@ -329,8 +329,8 @@ int intel_vgpu_emulate_mmio_write(struct intel_vgpu *vgpu, uint64_t pa, · 60 unmodified lines
329329
330330 /* all register bits are RO. */
331331 if (ro_mask == ~(u64)0) {
332− gvt_err("vgpu%d: try to write RO reg %x\n",
333− vgpu->id, offset);
332+ gvt_vgpu_err("try to write RO reg %x\n",
333+ offset);
334334 ret = 0;
335335 goto out;
336336 }
@@ -360,8 +360,8 @@ out: · 23 unmodified lines
360360 mutex_unlock(&gvt->lock);
361361 return 0;
362362 err:
363− gvt_err("vgpu%d: fail to emulate MMIO write %08x len %d\n",
364− vgpu->id, offset, bytes);
363+ gvt_vgpu_err("fail to emulate MMIO write %08x len %d\n", offset,
364+ bytes);
365365 mutex_unlock(&gvt->lock);
366366 return ret;
367367 }
drivers/gpu/drm/i915/gvt/mmio.h+3−0
@@ -107,4 +107,7 @@ int intel_vgpu_default_mmio_read(struct intel_vgpu *vgpu, unsigned int offset, · 106 unmodified lines
107107 void *p_data, unsigned int bytes);
108108 int intel_vgpu_default_mmio_write(struct intel_vgpu *vgpu, unsigned int offset,
109109 void *p_data, unsigned int bytes);
110+
111+bool intel_gvt_in_force_nonpriv_whitelist(struct intel_gvt *gvt,
112+ unsigned int offset);
110113 #endif
drivers/gpu/drm/i915/gvt/opregion.c+5−5
@@ -67,14 +67,15 @@ static int map_vgpu_opregion(struct intel_vgpu *vgpu, bool map) · 66 unmodified lines
6767 mfn = intel_gvt_hypervisor_virt_to_mfn(vgpu_opregion(vgpu)->va
6868 + i * PAGE_SIZE);
6969 if (mfn == INTEL_GVT_INVALID_ADDR) {
70− gvt_err("fail to get MFN from VA\n");
70+ gvt_vgpu_err("fail to get MFN from VA\n");
7171 return -EINVAL;
7272 }
7373 ret = intel_gvt_hypervisor_map_gfn_to_mfn(vgpu,
7474 vgpu_opregion(vgpu)->gfn[i],
7575 mfn, 1, map);
7676 if (ret) {
77− gvt_err("fail to map GFN to MFN, errno: %d\n", ret);
77+ gvt_vgpu_err("fail to map GFN to MFN, errno: %d\n",
78+ ret);
7879 return ret;
7980 }
8081 }
@@ -287,7 +288,7 @@ int intel_vgpu_emulate_opregion_request(struct intel_vgpu *vgpu, u32 swsci) · 206 unmodified lines
287288 parm = vgpu_opregion(vgpu)->va + INTEL_GVT_OPREGION_PARM;
288289
289290 if (!(swsci & SWSCI_SCI_SELECT)) {
290− gvt_err("vgpu%d: requesting SMI service\n", vgpu->id);
291+ gvt_vgpu_err("requesting SMI service\n");
291292 return 0;
292293 }
293294 /* ignore non 0->1 trasitions */
@@ -300,9 +301,8 @@ int intel_vgpu_emulate_opregion_request(struct intel_vgpu *vgpu, u32 swsci) · 6 unmodified lines
300301 func = GVT_OPREGION_FUNC(*scic);
301302 subfunc = GVT_OPREGION_SUBFUNC(*scic);
302303 if (!querying_capabilities(*scic)) {
303− gvt_err("vgpu%d: requesting runtime service: func \"%s\","
304+ gvt_vgpu_err("requesting runtime service: func \"%s\","
304305 " subfunc \"%s\"\n",
305− vgpu->id,
306306 opregion_func_name(func),
307307 opregion_subfunc_name(subfunc));
308308 /*
drivers/gpu/drm/i915/gvt/render.c+1−1
@@ -167,7 +167,7 @@ static void handle_tlb_pending_event(struct intel_vgpu *vgpu, int ring_id) · 166 unmodified lines
167167 I915_WRITE_FW(reg, 0x1);
168168
169169 if (wait_for_atomic((I915_READ_FW(reg) == 0), 50))
170− gvt_err("timeout in invalidate ring (%d) tlb\n", ring_id);
170+ gvt_vgpu_err("timeout in invalidate ring (%d) tlb\n", ring_id);
171171 else
172172 vgpu_vreg(vgpu, regs[ring_id]) = 0;
173173
drivers/gpu/drm/i915/gvt/sched_policy.c+2−2
@@ -101,7 +101,7 @@ struct tbs_sched_data { · 100 unmodified lines
101101 struct list_head runq_head;
102102 };
103103
104−#define GVT_DEFAULT_TIME_SLICE (1 * HZ / 1000)
104+#define GVT_DEFAULT_TIME_SLICE (msecs_to_jiffies(1))
105105
106106 static void tbs_sched_func(struct work_struct *work)
107107 {
@@ -223,7 +223,7 @@ static void tbs_sched_start_schedule(struct intel_vgpu *vgpu) · 115 unmodified lines
223223 return;
224224
225225 list_add_tail(&vgpu_data->list, &sched_data->runq_head);
226− schedule_delayed_work(&sched_data->work, sched_data->period);
226+ schedule_delayed_work(&sched_data->work, 0);
227227 }
228228
229229 static void tbs_sched_stop_schedule(struct intel_vgpu *vgpu)
drivers/gpu/drm/i915/gvt/scheduler.c+41−20
@@ -84,7 +84,7 @@ static int populate_shadow_context(struct intel_vgpu_workload *workload) · 83 unmodified lines
8484 (u32)((workload->ctx_desc.lrca + i) <<
8585 GTT_PAGE_SHIFT));
8686 if (context_gpa == INTEL_GVT_INVALID_ADDR) {
87− gvt_err("Invalid guest context descriptor\n");
87+ gvt_vgpu_err("Invalid guest context descriptor\n");
8888 return -EINVAL;
8989 }
9090
@@ -173,7 +173,9 @@ static int dispatch_workload(struct intel_vgpu_workload *workload) · 82 unmodified lines
173173 int ring_id = workload->ring_id;
174174 struct i915_gem_context *shadow_ctx = workload->vgpu->shadow_ctx;
175175 struct drm_i915_private *dev_priv = workload->vgpu->gvt->dev_priv;
176+ struct intel_engine_cs *engine = dev_priv->engine[ring_id];
176177 struct drm_i915_gem_request *rq;
178+ struct intel_vgpu *vgpu = workload->vgpu;
177179 int ret;
178180
179181 gvt_dbg_sched("ring id %d prepare to dispatch workload %p\n",
@@ -185,9 +187,24 @@ static int dispatch_workload(struct intel_vgpu_workload *workload) · 5 unmodified lines
185187
186188 mutex_lock(&dev_priv->drm.struct_mutex);
187189
190+ /* pin shadow context by gvt even the shadow context will be pinned
191+ * when i915 alloc request. That is because gvt will update the guest
192+ * context from shadow context when workload is completed, and at that
193+ * moment, i915 may already unpined the shadow context to make the
194+ * shadow_ctx pages invalid. So gvt need to pin itself. After update
195+ * the guest context, gvt can unpin the shadow_ctx safely.
196+ */
197+ ret = engine->context_pin(engine, shadow_ctx);
198+ if (ret) {
199+ gvt_vgpu_err("fail to pin shadow context\n");
200+ workload->status = ret;
201+ mutex_unlock(&dev_priv->drm.struct_mutex);
202+ return ret;
203+ }
204+
188205 rq = i915_gem_request_alloc(dev_priv->engine[ring_id], shadow_ctx);
189206 if (IS_ERR(rq)) {
190− gvt_err("fail to allocate gem request\n");
207+ gvt_vgpu_err("fail to allocate gem request\n");
191208 ret = PTR_ERR(rq);
192209 goto out;
193210 }
@@ -200,9 +217,12 @@ static int dispatch_workload(struct intel_vgpu_workload *workload) · 6 unmodified lines
200217 if (ret)
201218 goto out;
202219
203− ret = intel_gvt_scan_and_shadow_wa_ctx(&workload->wa_ctx);
204− if (ret)
205− goto out;
220+ if ((workload->ring_id == RCS) &&
221+ (workload->wa_ctx.indirect_ctx.size != 0)) {
222+ ret = intel_gvt_scan_and_shadow_wa_ctx(&workload->wa_ctx);
223+ if (ret)
224+ goto out;
225+ }
206226
207227 ret = populate_shadow_context(workload);
208228 if (ret)
@@ -225,6 +245,9 @@ out: · 16 unmodified lines
225245
226246 if (!IS_ERR_OR_NULL(rq))
227247 i915_add_request(rq);
248+ else
249+ engine->context_unpin(engine, shadow_ctx);
250+
228251 mutex_unlock(&dev_priv->drm.struct_mutex);
229252 return ret;
230253 }
@@ -320,7 +343,7 @@ static void update_guest_context(struct intel_vgpu_workload *workload) · 89 unmodified lines
320343 (u32)((workload->ctx_desc.lrca + i) <<
321344 GTT_PAGE_SHIFT));
322345 if (context_gpa == INTEL_GVT_INVALID_ADDR) {
323− gvt_err("invalid guest context descriptor\n");
346+ gvt_vgpu_err("invalid guest context descriptor\n");
324347 return;
325348 }
326349
@@ -374,6 +397,10 @@ static void complete_current_workload(struct intel_gvt *gvt, int ring_id) · 47 unmodified lines
374397 * For the workload w/o request, directly complete the workload.
375398 */
376399 if (workload->req) {
400+ struct drm_i915_private *dev_priv =
401+ workload->vgpu->gvt->dev_priv;
402+ struct intel_engine_cs *engine =
403+ dev_priv->engine[workload->ring_id];
377404 wait_event(workload->shadow_ctx_status_wq,
378405 !atomic_read(&workload->shadow_ctx_active));
379406
@@ -386,6 +413,10 @@ static void complete_current_workload(struct intel_gvt *gvt, int ring_id) · 6 unmodified lines
386413 INTEL_GVT_EVENT_MAX)
387414 intel_vgpu_trigger_virtual_event(vgpu, event);
388415 }
416+ mutex_lock(&dev_priv->drm.struct_mutex);
417+ /* unpin shadow ctx as the shadow_ctx update is done */
418+ engine->context_unpin(engine, workload->vgpu->shadow_ctx);
419+ mutex_unlock(&dev_priv->drm.struct_mutex);
389420 }
390421
391422 gvt_dbg_sched("ring id %d complete workload %p status %d\n",
@@ -415,6 +446,7 @@ static int workload_thread(void *priv) · 23 unmodified lines
415446 int ring_id = p->ring_id;
416447 struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler;
417448 struct intel_vgpu_workload *workload = NULL;
449+ struct intel_vgpu *vgpu = NULL;
418450 int ret;
419451 bool need_force_wake = IS_SKYLAKE(gvt->dev_priv);
420452 DEFINE_WAIT_FUNC(wait, woken_wake_function);
@@ -457,25 +489,14 @@ static int workload_thread(void *priv) · 36 unmodified lines
457489 mutex_unlock(&gvt->lock);
458490
459491 if (ret) {
460− gvt_err("fail to dispatch workload, skip\n");
492+ vgpu = workload->vgpu;
493+ gvt_vgpu_err("fail to dispatch workload, skip\n");
461494 goto complete;
462495 }
463496
464497 gvt_dbg_sched("ring id %d wait workload %p\n",
465498 workload->ring_id, workload);
466−retry:
467− i915_wait_request(workload->req,
468− 0, MAX_SCHEDULE_TIMEOUT);
469− /* I915 has replay mechanism and a request will be replayed
470− * if there is i915 reset. So the seqno will be updated anyway.
471− * If the seqno is not updated yet after waiting, which means
472− * the replay may still be in progress and we can wait again.
473− */
474− if (!i915_gem_request_completed(workload->req)) {
475− gvt_dbg_sched("workload %p not completed, wait again\n",
476− workload);
477− goto retry;
478− }
499+ i915_wait_request(workload->req, 0, MAX_SCHEDULE_TIMEOUT);
479500
480501 complete:
481502 gvt_dbg_sched("will complete workload %p, status: %d\n",
drivers/gpu/drm/i915/i915_irq.c+1−0
@@ -1104,6 +1104,7 @@ static u32 vlv_wa_c0_ei(struct drm_i915_private *dev_priv, u32 pm_iir) · 1103 unmodified lines
11041104 u32 render, media;
11051105
11061106 time = ktime_us_delta(now.ktime, prev->ktime);
1107+
11071108 time *= dev_priv->czclk_freq;
11081109
11091110 /* Workload can be split between render + media,
drivers/gpu/drm/i915/intel_gvt.c+5−0
@@ -77,6 +77,11 @@ int intel_gvt_init(struct drm_i915_private *dev_priv) · 76 unmodified lines
7777 goto bail;
7878 }
7979
80+ if (!i915.enable_execlists) {
81+ DRM_INFO("GPU guest virtualisation [GVT-g] disabled due to disabled execlist submission [i915.enable_execlists module parameter]\n");
82+ goto bail;
83+ }
84+
8085 /*
8186 * We're not in host or fail to find a MPT module, disable GVT-g
8287 */
drivers/gpu/drm/radeon/si_dpm.c+7−3
@@ -2985,9 +2985,13 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, · 2984 unmodified lines
29852985 max_sclk = 75000;
29862986 }
29872987 } else if (rdev->family == CHIP_OLAND) {
2988− if ((rdev->pdev->device == 0x6604) &&
2989− (rdev->pdev->subsystem_vendor == 0x1028) &&
2990− (rdev->pdev->subsystem_device == 0x066F)) {
2988+ if ((rdev->pdev->revision == 0xC7) ||
2989+ (rdev->pdev->revision == 0x80) ||
2990+ (rdev->pdev->revision == 0x81) ||
2991+ (rdev->pdev->revision == 0x83) ||
2992+ (rdev->pdev->revision == 0x87) ||
2993+ (rdev->pdev->device == 0x6604) ||
2994+ (rdev->pdev->device == 0x6605)) {
29912995 max_sclk = 75000;
29922996 }
29932997 }
drivers/hid/Kconfig+3−2
@@ -175,11 +175,11 @@ config HID_CHERRY · 174 unmodified lines
175175 Support for Cherry Cymotion keyboard.
176176
177177 config HID_CHICONY
178− tristate "Chicony Tactical pad"
178+ tristate "Chicony devices"
179179 depends on HID
180180 default !EXPERT
181181 ---help---
182− Support for Chicony Tactical pad.
182+ Support for Chicony Tactical pad and special keys on Chicony keyboards.
183183
184184 config HID_CORSAIR
185185 tristate "Corsair devices"
@@ -190,6 +190,7 @@ config HID_CORSAIR · 4 unmodified lines
190190
191191 Supported devices:
192192 - Vengeance K90
193+ - Scimitar PRO RGB
193194
194195 config HID_PRODIKEYS
195196 tristate "Prodikeys PC-MIDI Keyboard support"
drivers/hid/hid-chicony.c+1−0
@@ -86,6 +86,7 @@ static const struct hid_device_id ch_devices[] = { · 85 unmodified lines
8686 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) },
8787 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) },
8888 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) },
89+ { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_ZEN_AIO_KBD) },
8990 { }
9091 };
9192 MODULE_DEVICE_TABLE(hid, ch_devices);
drivers/hid/hid-core.c+2−0
@@ -1870,6 +1870,7 @@ static const struct hid_device_id hid_have_special_driver[] = { · 1869 unmodified lines
18701870 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) },
18711871 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) },
18721872 { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90) },
1873+ { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB) },
18731874 { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) },
18741875 { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_CP2112) },
18751876 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
@@ -1910,6 +1911,7 @@ static const struct hid_device_id hid_have_special_driver[] = { · 34 unmodified lines
19101911 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) },
19111912 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2) },
19121913 { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET) },
1914+ { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_ZEN_AIO_KBD) },
19131915 { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) },
19141916 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) },
19151917 { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
drivers/hid/hid-corsair.c+47−0
@@ -3,8 +3,10 @@ · 2 unmodified lines
33 *
44 * Supported devices:
55 * - Vengeance K90 Keyboard
6+ * - Scimitar PRO RGB Gaming Mouse
67 *
78 * Copyright (c) 2015 Clement Vuchener
9+ * Copyright (c) 2017 Oscar Campos
810 */
911
1012 /*
@@ -670,10 +672,51 @@ static int corsair_input_mapping(struct hid_device *dev, · 659 unmodified lines
670672 return 0;
671673 }
672674
675+/*
676+ * The report descriptor of Corsair Scimitar RGB Pro gaming mouse is
677+ * non parseable as they define two consecutive Logical Minimum for
678+ * the Usage Page (Consumer) in rdescs bytes 75 and 77 being 77 0x16
679+ * that should be obviousy 0x26 for Logical Magimum of 16 bits. This
680+ * prevents poper parsing of the report descriptor due Logical
681+ * Minimum being larger than Logical Maximum.
682+ *
683+ * This driver fixes the report descriptor for:
684+ * - USB ID b1c:1b3e, sold as Scimitar RGB Pro Gaming mouse
685+ */
686+
687+static __u8 *corsair_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
688+ unsigned int *rsize)
689+{
690+ struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
691+
692+ if (intf->cur_altsetting->desc.bInterfaceNumber == 1) {
693+ /*
694+ * Corsair Scimitar RGB Pro report descriptor is broken and
695+ * defines two different Logical Minimum for the Consumer
696+ * Application. The byte 77 should be a 0x26 defining a 16
697+ * bits integer for the Logical Maximum but it is a 0x16
698+ * instead (Logical Minimum)
699+ */
700+ switch (hdev->product) {
701+ case USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB:
702+ if (*rsize >= 172 && rdesc[75] == 0x15 && rdesc[77] == 0x16
703+ && rdesc[78] == 0xff && rdesc[79] == 0x0f) {
704+ hid_info(hdev, "Fixing up report descriptor\n");
705+ rdesc[77] = 0x26;
706+ }
707+ break;
708+ }
709+
710+ }
711+ return rdesc;
712+}
713+
673714 static const struct hid_device_id corsair_devices[] = {
674715 { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90),
675716 .driver_data = CORSAIR_USE_K90_MACRO |
676717 CORSAIR_USE_K90_BACKLIGHT },
718+ { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR,
719+ USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB) },
677720 {}
678721 };
679722
@@ -686,10 +729,14 @@ static struct hid_driver corsair_driver = { · 6 unmodified lines
686729 .event = corsair_event,
687730 .remove = corsair_remove,
688731 .input_mapping = corsair_input_mapping,
732+ .report_fixup = corsair_mouse_report_fixup,
689733 };
690734
691735 module_hid_driver(corsair_driver);
692736
693737 MODULE_LICENSE("GPL");
738+/* Original K90 driver author */
694739 MODULE_AUTHOR("Clement Vuchener");
740+/* Scimitar PRO RGB driver author */
741+MODULE_AUTHOR("Oscar Campos");
695742 MODULE_DESCRIPTION("HID driver for Corsair devices");
drivers/hid/hid-ids.h+4−0
@@ -278,6 +278,9 @@ · 277 unmodified lines
278278 #define USB_DEVICE_ID_CORSAIR_K70RGB 0x1b13
279279 #define USB_DEVICE_ID_CORSAIR_STRAFE 0x1b15
280280 #define USB_DEVICE_ID_CORSAIR_K65RGB 0x1b17
281+#define USB_DEVICE_ID_CORSAIR_K70RGB_RAPIDFIRE 0x1b38
282+#define USB_DEVICE_ID_CORSAIR_K65RGB_RAPIDFIRE 0x1b39
283+#define USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB 0x1b3e
281284
282285 #define USB_VENDOR_ID_CREATIVELABS 0x041e
283286 #define USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51 0x322c
@@ -557,6 +560,7 @@ · 273 unmodified lines
557560
558561 #define USB_VENDOR_ID_JESS 0x0c45
559562 #define USB_DEVICE_ID_JESS_YUREX 0x1010
563+#define USB_DEVICE_ID_JESS_ZEN_AIO_KBD 0x5112
560564
561565 #define USB_VENDOR_ID_JESS2 0x0f30
562566 #define USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD 0x0111
drivers/hid/hid-sony.c+2−0
@@ -2632,6 +2632,8 @@ err_stop: · 2631 unmodified lines
26322632 sony_leds_remove(sc);
26332633 if (sc->quirks & SONY_BATTERY_SUPPORT)
26342634 sony_battery_remove(sc);
2635+ if (sc->touchpad)
2636+ sony_unregister_touchpad(sc);
26352637 sony_cancel_work_sync(sc);
26362638 kfree(sc->output_report_dmabuf);
26372639 sony_remove_dev_list(sc);
drivers/hid/usbhid/hid-quirks.c+3−0
@@ -80,6 +80,9 @@ static const struct hid_blacklist { · 79 unmodified lines
8080 { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K70RGB, HID_QUIRK_NO_INIT_REPORTS },
8181 { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K65RGB, HID_QUIRK_NO_INIT_REPORTS },
8282 { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_STRAFE, HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL },
83+ { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K70RGB_RAPIDFIRE, HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL },
84+ { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K65RGB_RAPIDFIRE, HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL },
85+ { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB, HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL },
8386 { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51, HID_QUIRK_NOGET },
8487 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
8588 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT },
drivers/hid/wacom_sys.c+3−1
@@ -2579,7 +2579,9 @@ static void wacom_remove(struct hid_device *hdev) · 2578 unmodified lines
25792579
25802580 /* make sure we don't trigger the LEDs */
25812581 wacom_led_groups_release(wacom);
2582− wacom_release_resources(wacom);
2582+
2583+ if (wacom->wacom_wac.features.type != REMOTE)
2584+ wacom_release_resources(wacom);
25832585
25842586 hid_set_drvdata(hdev, NULL);
25852587 }
drivers/hid/wacom_wac.c+6−4
@@ -1959,8 +1959,10 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev, · 1958 unmodified lines
19591959 input_set_capability(input, EV_KEY, BTN_TOOL_BRUSH);
19601960 input_set_capability(input, EV_KEY, BTN_TOOL_PENCIL);
19611961 input_set_capability(input, EV_KEY, BTN_TOOL_AIRBRUSH);
1962− input_set_capability(input, EV_KEY, BTN_TOOL_MOUSE);
1963− input_set_capability(input, EV_KEY, BTN_TOOL_LENS);
1962+ if (!(features->device_type & WACOM_DEVICETYPE_DIRECT)) {
1963+ input_set_capability(input, EV_KEY, BTN_TOOL_MOUSE);
1964+ input_set_capability(input, EV_KEY, BTN_TOOL_LENS);
1965+ }
19641966 break;
19651967 case WACOM_HID_WD_FINGERWHEEL:
19661968 wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0);
@@ -4197,10 +4199,10 @@ static const struct wacom_features wacom_features_0x343 = · 2230 unmodified lines
41974199 WACOM_DTU_OFFSET, WACOM_DTU_OFFSET };
41984200 static const struct wacom_features wacom_features_0x360 =
41994201 { "Wacom Intuos Pro M", 44800, 29600, 8191, 63,
4200− INTUOSP2_BT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 9, .touch_max = 10 };
4202+ INTUOSP2_BT, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 10 };
42014203 static const struct wacom_features wacom_features_0x361 =
42024204 { "Wacom Intuos Pro L", 62200, 43200, 8191, 63,
4203− INTUOSP2_BT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 9, .touch_max = 10 };
4205+ INTUOSP2_BT, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 10 };
42044206
42054207 static const struct wacom_features wacom_features_HID_ANY_ID =
42064208 { "Wacom HID", .type = HID_GENERIC, .oVid = HID_ANY_ID, .oPid = HID_ANY_ID };
drivers/hv/channel.c+12−13
@@ -502,12 +502,15 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) · 501 unmodified lines
502502
503503 wait_for_completion(&info->waitevent);
504504
505− if (channel->rescind) {
506− ret = -ENODEV;
507− goto post_msg_err;
508− }
509−
510505 post_msg_err:
506+ /*
507+ * If the channel has been rescinded;
508+ * we will be awakened by the rescind
509+ * handler; set the error code to zero so we don't leak memory.
510+ */
511+ if (channel->rescind)
512+ ret = 0;
513+
511514 spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
512515 list_del(&info->msglistentry);
513516 spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
@@ -530,15 +533,13 @@ static int vmbus_close_internal(struct vmbus_channel *channel) · 16 unmodified lines
530533 int ret;
531534
532535 /*
533− * vmbus_on_event(), running in the tasklet, can race
536+ * vmbus_on_event(), running in the per-channel tasklet, can race
534537 * with vmbus_close_internal() in the case of SMP guest, e.g., when
535538 * the former is accessing channel->inbound.ring_buffer, the latter
536− * could be freeing the ring_buffer pages.
537− *
538− * To resolve the race, we can serialize them by disabling the
539− * tasklet when the latter is running here.
539+ * could be freeing the ring_buffer pages, so here we must stop it
540+ * first.
540541 */
541− hv_event_tasklet_disable(channel);
542+ tasklet_disable(&channel->callback_event);
542543
543544 /*
544545 * In case a device driver's probe() fails (e.g.,
@@ -605,8 +606,6 @@ static int vmbus_close_internal(struct vmbus_channel *channel) · 60 unmodified lines
605606 get_order(channel->ringbuffer_pagecount * PAGE_SIZE));
606607
607608 out:
608− hv_event_tasklet_enable(channel);
609−
610609 return ret;
611610 }
612611
drivers/hv/channel_mgmt.c+5−22
@@ -350,7 +350,8 @@ static struct vmbus_channel *alloc_channel(void) · 349 unmodified lines
350350 static void free_channel(struct vmbus_channel *channel)
351351 {
352352 tasklet_kill(&channel->callback_event);
353− kfree(channel);
353+
354+ kfree_rcu(channel, rcu);
354355 }
355356
356357 static void percpu_channel_enq(void *arg)
@@ -359,14 +360,14 @@ static void percpu_channel_enq(void *arg) · 2 unmodified lines
359360 struct hv_per_cpu_context *hv_cpu
360361 = this_cpu_ptr(hv_context.cpu_context);
361362
362− list_add_tail(&channel->percpu_list, &hv_cpu->chan_list);
363+ list_add_tail_rcu(&channel->percpu_list, &hv_cpu->chan_list);
363364 }
364365
365366 static void percpu_channel_deq(void *arg)
366367 {
367368 struct vmbus_channel *channel = arg;
368369
369− list_del(&channel->percpu_list);
370+ list_del_rcu(&channel->percpu_list);
370371 }
371372
372373
@@ -381,19 +382,6 @@ static void vmbus_release_relid(u32 relid) · 8 unmodified lines
381382 true);
382383 }
383384
384−void hv_event_tasklet_disable(struct vmbus_channel *channel)
385−{
386− tasklet_disable(&channel->callback_event);
387−}
388−
389−void hv_event_tasklet_enable(struct vmbus_channel *channel)
390−{
391− tasklet_enable(&channel->callback_event);
392−
393− /* In case there is any pending event */
394− tasklet_schedule(&channel->callback_event);
395−}
396−
397385 void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid)
398386 {
399387 unsigned long flags;
@@ -402,7 +390,6 @@ void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid) · 2 unmodified lines
402390 BUG_ON(!channel->rescind);
403391 BUG_ON(!mutex_is_locked(&vmbus_connection.channel_mutex));
404392
405− hv_event_tasklet_disable(channel);
406393 if (channel->target_cpu != get_cpu()) {
407394 put_cpu();
408395 smp_call_function_single(channel->target_cpu,
@@ -411,7 +398,6 @@ void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid) · 2 unmodified lines
411398 percpu_channel_deq(channel);
412399 put_cpu();
413400 }
414− hv_event_tasklet_enable(channel);
415401
416402 if (channel->primary_channel == NULL) {
417403 list_del(&channel->listentry);
@@ -505,7 +491,6 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel) · 87 unmodified lines
505491
506492 init_vp_index(newchannel, dev_type);
507493
508− hv_event_tasklet_disable(newchannel);
509494 if (newchannel->target_cpu != get_cpu()) {
510495 put_cpu();
511496 smp_call_function_single(newchannel->target_cpu,
@@ -515,7 +500,6 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel) · 3 unmodified lines
515500 percpu_channel_enq(newchannel);
516501 put_cpu();
517502 }
518− hv_event_tasklet_enable(newchannel);
519503
520504 /*
521505 * This state is used to indicate a successful open
@@ -565,7 +549,6 @@ err_deq_chan: · 43 unmodified lines
565549 list_del(&newchannel->listentry);
566550 mutex_unlock(&vmbus_connection.channel_mutex);
567551
568− hv_event_tasklet_disable(newchannel);
569552 if (newchannel->target_cpu != get_cpu()) {
570553 put_cpu();
571554 smp_call_function_single(newchannel->target_cpu,
@@ -574,7 +557,6 @@ err_deq_chan: · 2 unmodified lines
574557 percpu_channel_deq(newchannel);
575558 put_cpu();
576559 }
577− hv_event_tasklet_enable(newchannel);
578560
579561 vmbus_release_relid(newchannel->offermsg.child_relid);
580562
@@ -814,6 +796,7 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr) · 233 unmodified lines
814796 /* Allocate the channel object and save this offer. */
815797 newchannel = alloc_channel();
816798 if (!newchannel) {
799+ vmbus_release_relid(offer->child_relid);
817800 pr_err("Unable to allocate channel object\n");
818801 return;
819802 }
drivers/hv/hv_fcopy.c+0−4
@@ -71,7 +71,6 @@ static DECLARE_WORK(fcopy_send_work, fcopy_send_data); · 70 unmodified lines
7171 static const char fcopy_devname[] = "vmbus/hv_fcopy";
7272 static u8 *recv_buffer;
7373 static struct hvutil_transport *hvt;
74−static struct completion release_event;
7574 /*
7675 * This state maintains the version number registered by the daemon.
7776 */
@@ -331,7 +330,6 @@ static void fcopy_on_reset(void) · 253 unmodified lines
331330
332331 if (cancel_delayed_work_sync(&fcopy_timeout_work))
333332 fcopy_respond_to_host(HV_E_FAIL);
334− complete(&release_event);
335333 }
336334
337335 int hv_fcopy_init(struct hv_util_service *srv)
@@ -339,7 +337,6 @@ int hv_fcopy_init(struct hv_util_service *srv) · 1 unmodified line
339337 recv_buffer = srv->recv_buffer;
340338 fcopy_transaction.recv_channel = srv->channel;
341339
342− init_completion(&release_event);
343340 /*
344341 * When this driver loads, the user level daemon that
345342 * processes the host requests may not yet be running.
@@ -361,5 +358,4 @@ void hv_fcopy_deinit(void) · 15 unmodified lines
361358 fcopy_transaction.state = HVUTIL_DEVICE_DYING;
362359 cancel_delayed_work_sync(&fcopy_timeout_work);
363360 hvutil_transport_destroy(hvt);
364− wait_for_completion(&release_event);
365361 }
drivers/hv/hv_kvp.c+0−4
@@ -101,7 +101,6 @@ static DECLARE_WORK(kvp_sendkey_work, kvp_send_key); · 100 unmodified lines
101101 static const char kvp_devname[] = "vmbus/hv_kvp";
102102 static u8 *recv_buffer;
103103 static struct hvutil_transport *hvt;
104−static struct completion release_event;
105104 /*
106105 * Register the kernel component with the user-level daemon.
107106 * As part of this registration, pass the LIC version number.
@@ -714,7 +713,6 @@ static void kvp_on_reset(void) · 606 unmodified lines
714713 if (cancel_delayed_work_sync(&kvp_timeout_work))
715714 kvp_respond_to_host(NULL, HV_E_FAIL);
716715 kvp_transaction.state = HVUTIL_DEVICE_INIT;
717− complete(&release_event);
718716 }
719717
720718 int
@@ -723,7 +721,6 @@ hv_kvp_init(struct hv_util_service *srv) · 2 unmodified lines
723721 recv_buffer = srv->recv_buffer;
724722 kvp_transaction.recv_channel = srv->channel;
725723
726− init_completion(&release_event);
727724 /*
728725 * When this driver loads, the user level daemon that
729726 * processes the host requests may not yet be running.
@@ -747,5 +744,4 @@ void hv_kvp_deinit(void) · 17 unmodified lines
747744 cancel_delayed_work_sync(&kvp_timeout_work);
748745 cancel_work_sync(&kvp_sendkey_work);
749746 hvutil_transport_destroy(hvt);
750− wait_for_completion(&release_event);
751747 }
drivers/hv/hv_snapshot.c+0−4
@@ -79,7 +79,6 @@ static int dm_reg_value; · 78 unmodified lines
7979 static const char vss_devname[] = "vmbus/hv_vss";
8080 static __u8 *recv_buffer;
8181 static struct hvutil_transport *hvt;
82−static struct completion release_event;
8382
8483 static void vss_timeout_func(struct work_struct *dummy);
8584 static void vss_handle_request(struct work_struct *dummy);
@@ -361,13 +360,11 @@ static void vss_on_reset(void) · 275 unmodified lines
361360 if (cancel_delayed_work_sync(&vss_timeout_work))
362361 vss_respond_to_host(HV_E_FAIL);
363362 vss_transaction.state = HVUTIL_DEVICE_INIT;
364− complete(&release_event);
365363 }
366364
367365 int
368366 hv_vss_init(struct hv_util_service *srv)
369367 {
370− init_completion(&release_event);
371368 if (vmbus_proto_version < VERSION_WIN8_1) {
372369 pr_warn("Integration service 'Backup (volume snapshot)'"
373370 " not supported on this host version.\n");
@@ -400,5 +397,4 @@ void hv_vss_deinit(void) · 26 unmodified lines
400397 cancel_delayed_work_sync(&vss_timeout_work);
401398 cancel_work_sync(&vss_handle_request_work);
402399 hvutil_transport_destroy(hvt);
403− wait_for_completion(&release_event);
404400 }
drivers/hv/hv_util.c+2−0
@@ -590,6 +590,8 @@ static int hv_timesync_init(struct hv_util_service *srv) · 589 unmodified lines
590590 if (!hyperv_cs)
591591 return -ENODEV;
592592
593+ spin_lock_init(&host_ts.lock);
594+
593595 INIT_WORK(&wrk.work, hv_set_host_time);
594596
595597 /*
drivers/hv/hv_utils_transport.c+8−4
@@ -182,10 +182,11 @@ static int hvt_op_release(struct inode *inode, struct file *file) · 181 unmodified lines
182182 * connects back.
183183 */
184184 hvt_reset(hvt);
185− mutex_unlock(&hvt->lock);
186185
187186 if (mode_old == HVUTIL_TRANSPORT_DESTROY)
188− hvt_transport_free(hvt);
187+ complete(&hvt->release);
188+
189+ mutex_unlock(&hvt->lock);
189190
190191 return 0;
191192 }
@@ -304,6 +305,7 @@ struct hvutil_transport *hvutil_transport_init(const char *name, · 112 unmodified lines
304305
305306 init_waitqueue_head(&hvt->outmsg_q);
306307 mutex_init(&hvt->lock);
308+ init_completion(&hvt->release);
307309
308310 spin_lock(&hvt_list_lock);
309311 list_add(&hvt->list, &hvt_list);
@@ -351,6 +353,8 @@ void hvutil_transport_destroy(struct hvutil_transport *hvt) · 41 unmodified lines
351353 if (hvt->cn_id.idx > 0 && hvt->cn_id.val > 0)
352354 cn_del_callback(&hvt->cn_id);
353355
354− if (mode_old != HVUTIL_TRANSPORT_CHARDEV)
355− hvt_transport_free(hvt);
356+ if (mode_old == HVUTIL_TRANSPORT_CHARDEV)
357+ wait_for_completion(&hvt->release);
358+
359+ hvt_transport_free(hvt);
356360 }
drivers/hv/hv_utils_transport.h+1−0
@@ -41,6 +41,7 @@ struct hvutil_transport { · 40 unmodified lines
4141 int outmsg_len; /* its length */
4242 wait_queue_head_t outmsg_q; /* poll/read wait queue */
4343 struct mutex lock; /* protects struct members */
44+ struct completion release; /* synchronize with fd release */
4445 };
4546
4647 struct hvutil_transport *hvutil_transport_init(const char *name,
drivers/hv/vmbus_drv.c+5−1
@@ -939,8 +939,10 @@ static void vmbus_chan_sched(struct hv_per_cpu_context *hv_cpu) · 938 unmodified lines
939939 if (relid == 0)
940940 continue;
941941
942+ rcu_read_lock();
943+
942944 /* Find channel based on relid */
943− list_for_each_entry(channel, &hv_cpu->chan_list, percpu_list) {
945+ list_for_each_entry_rcu(channel, &hv_cpu->chan_list, percpu_list) {
944946 if (channel->offermsg.child_relid != relid)
945947 continue;
946948
@@ -956,6 +958,8 @@ static void vmbus_chan_sched(struct hv_per_cpu_context *hv_cpu) · 9 unmodified lines
956958 tasklet_schedule(&channel->callback_event);
957959 }
958960 }
961+
962+ rcu_read_unlock();
959963 }
960964 }
961965
drivers/hwmon/asus_atk0110.c+3−0
@@ -646,6 +646,9 @@ static int atk_read_value(struct atk_sensor_data *sensor, u64 *value) · 645 unmodified lines
646646 else
647647 err = atk_read_value_new(sensor, value);
648648
649+ if (err)
650+ return err;
651+
649652 sensor->is_valid = true;
650653 sensor->last_updated = jiffies;
651654 sensor->cached_value = *value;
drivers/hwmon/it87.c+19−5
@@ -3198,7 +3198,7 @@ static int __init sm_it87_init(void) · 3197 unmodified lines
31983198 {
31993199 int sioaddr[2] = { REG_2E, REG_4E };
32003200 struct it87_sio_data sio_data;
3201− unsigned short isa_address;
3201+ unsigned short isa_address[2];
32023202 bool found = false;
32033203 int i, err;
32043204
@@ -3208,15 +3208,29 @@ static int __init sm_it87_init(void) · 3 unmodified lines
32083208
32093209 for (i = 0; i < ARRAY_SIZE(sioaddr); i++) {
32103210 memset(&sio_data, 0, sizeof(struct it87_sio_data));
3211− isa_address = 0;
3212− err = it87_find(sioaddr[i], &isa_address, &sio_data);
3213− if (err || isa_address == 0)
3211+ isa_address[i] = 0;
3212+ err = it87_find(sioaddr[i], &isa_address[i], &sio_data);
3213+ if (err || isa_address[i] == 0)
32143214 continue;
3215+ /*
3216+ * Don't register second chip if its ISA address matches
3217+ * the first chip's ISA address.
3218+ */
3219+ if (i && isa_address[i] == isa_address[0])
3220+ break;
32153221
3216− err = it87_device_add(i, isa_address, &sio_data);
3222+ err = it87_device_add(i, isa_address[i], &sio_data);
32173223 if (err)
32183224 goto exit_dev_unregister;
3225+
32193226 found = true;
3227+
3228+ /*
3229+ * IT8705F may respond on both SIO addresses.
3230+ * Stop probing after finding one.
3231+ */
3232+ if (sio_data.type == it87)
3233+ break;
32203234 }
32213235
32223236 if (!found) {
drivers/hwmon/max31790.c+1−1
@@ -311,7 +311,7 @@ static int max31790_write_pwm(struct device *dev, u32 attr, int channel, · 310 unmodified lines
311311 data->pwm[channel] = val << 8;
312312 err = i2c_smbus_write_word_swapped(client,
313313 MAX31790_REG_PWMOUT(channel),
314− val);
314+ data->pwm[channel]);
315315 break;
316316 case hwmon_pwm_enable:
317317 fan_config = data->fan_config[channel];
drivers/hwtracing/intel_th/core.c+3−1
@@ -221,8 +221,10 @@ static int intel_th_output_activate(struct intel_th_device *thdev) · 220 unmodified lines
221221 else
222222 intel_th_trace_enable(thdev);
223223
224− if (ret)
224+ if (ret) {
225225 pm_runtime_put(&thdev->dev);
226+ module_put(thdrv->driver.owner);
227+ }
226228
227229 return ret;
228230 }
drivers/hwtracing/intel_th/pci.c+10−0
@@ -85,6 +85,16 @@ static const struct pci_device_id intel_th_pci_id_table[] = { · 84 unmodified lines
8585 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa2a6),
8686 .driver_data = (kernel_ulong_t)0,
8787 },
88+ {
89+ /* Denverton */
90+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x19e1),
91+ .driver_data = (kernel_ulong_t)0,
92+ },
93+ {
94+ /* Gemini Lake */
95+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x318e),
96+ .driver_data = (kernel_ulong_t)0,
97+ },
8898 { 0 },
8999 };
90100
drivers/iio/adc/ti_am335x_adc.c+12−1
@@ -169,7 +169,9 @@ static irqreturn_t tiadc_irq_h(int irq, void *private) · 168 unmodified lines
169169 {
170170 struct iio_dev *indio_dev = private;
171171 struct tiadc_device *adc_dev = iio_priv(indio_dev);
172− unsigned int status, config;
172+ unsigned int status, config, adc_fsm;
173+ unsigned short count = 0;
174+
173175 status = tiadc_readl(adc_dev, REG_IRQSTATUS);
174176
175177 /*
@@ -183,6 +185,15 @@ static irqreturn_t tiadc_irq_h(int irq, void *private) · 7 unmodified lines
183185 tiadc_writel(adc_dev, REG_CTRL, config);
184186 tiadc_writel(adc_dev, REG_IRQSTATUS, IRQENB_FIFO1OVRRUN
185187 | IRQENB_FIFO1UNDRFLW | IRQENB_FIFO1THRES);
188+
189+ /* wait for idle state.
190+ * ADC needs to finish the current conversion
191+ * before disabling the module
192+ */
193+ do {
194+ adc_fsm = tiadc_readl(adc_dev, REG_ADCFSM);
195+ } while (adc_fsm != 0x10 && count++ < 100);
196+
186197 tiadc_writel(adc_dev, REG_CTRL, (config | CNTRLREG_TSCSSENB));
187198 return IRQ_HANDLED;
188199 } else if (status & IRQENB_FIFO1THRES) {
drivers/iio/common/hid-sensors/hid-sensor-trigger.c+3−3
@@ -51,8 +51,6 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state) · 50 unmodified lines
5151 st->report_state.report_id,
5252 st->report_state.index,
5353 HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM);
54−
55− poll_value = hid_sensor_read_poll_value(st);
5654 } else {
5755 int val;
5856
@@ -89,7 +87,9 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state) · 30 unmodified lines
8987 sensor_hub_get_feature(st->hsdev, st->power_state.report_id,
9088 st->power_state.index,
9189 sizeof(state_val), &state_val);
92− if (state && poll_value)
90+ if (state)
91+ poll_value = hid_sensor_read_poll_value(st);
92+ if (poll_value > 0)
9393 msleep_interruptible(poll_value * 2);
9494
9595 return 0;
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c+2−2
@@ -193,8 +193,8 @@ int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor, u16 watermark) · 192 unmodified lines
193193 if (err < 0)
194194 goto out;
195195
196− fifo_watermark = ((data & ~ST_LSM6DSX_FIFO_TH_MASK) << 8) |
197− (fifo_watermark & ST_LSM6DSX_FIFO_TH_MASK);
196+ fifo_watermark = ((data << 8) & ~ST_LSM6DSX_FIFO_TH_MASK) |
197+ (fifo_watermark & ST_LSM6DSX_FIFO_TH_MASK);
198198
199199 wdata = cpu_to_le16(fifo_watermark);
200200 err = hw->tf->write(hw->dev, ST_LSM6DSX_REG_FIFO_THL_ADDR,
drivers/iio/magnetometer/ak8974.c+2−2
@@ -763,7 +763,7 @@ power_off: · 762 unmodified lines
763763 return ret;
764764 }
765765
766−static int __exit ak8974_remove(struct i2c_client *i2c)
766+static int ak8974_remove(struct i2c_client *i2c)
767767 {
768768 struct iio_dev *indio_dev = i2c_get_clientdata(i2c);
769769 struct ak8974 *ak8974 = iio_priv(indio_dev);
@@ -845,7 +845,7 @@ static struct i2c_driver ak8974_driver = { · 75 unmodified lines
845845 .of_match_table = of_match_ptr(ak8974_of_match),
846846 },
847847 .probe = ak8974_probe,
848− .remove = __exit_p(ak8974_remove),
848+ .remove = ak8974_remove,
849849 .id_table = ak8974_id,
850850 };
851851 module_i2c_driver(ak8974_driver);
drivers/infiniband/core/cq.c+8−2
@@ -29,7 +29,13 @@ static int __ib_process_cq(struct ib_cq *cq, int budget) · 28 unmodified lines
2929 {
3030 int i, n, completed = 0;
3131
32− while ((n = ib_poll_cq(cq, IB_POLL_BATCH, cq->wc)) > 0) {
32+ /*
33+ * budget might be (-1) if the caller does not
34+ * want to bound this call, thus we need unsigned
35+ * minimum here.
36+ */
37+ while ((n = ib_poll_cq(cq, min_t(u32, IB_POLL_BATCH,
38+ budget - completed), cq->wc)) > 0) {
3339 for (i = 0; i < n; i++) {
3440 struct ib_wc *wc = &cq->wc[i];
3541
@@ -196,7 +202,7 @@ void ib_free_cq(struct ib_cq *cq) · 160 unmodified lines
196202 irq_poll_disable(&cq->iop);
197203 break;
198204 case IB_POLL_WORKQUEUE:
199− flush_work(&cq->work);
205+ cancel_work_sync(&cq->work);
200206 break;
201207 default:
202208 WARN_ON_ONCE(1);
drivers/infiniband/core/device.c+21−8
@@ -336,12 +336,26 @@ int ib_register_device(struct ib_device *device, · 335 unmodified lines
336336 struct device *parent = device->dev.parent;
337337
338338 WARN_ON_ONCE(!parent);
339− if (!device->dev.dma_ops)
340− device->dev.dma_ops = parent->dma_ops;
341− if (!device->dev.dma_mask)
342− device->dev.dma_mask = parent->dma_mask;
343− if (!device->dev.coherent_dma_mask)
344− device->dev.coherent_dma_mask = parent->coherent_dma_mask;
339+ WARN_ON_ONCE(device->dma_device);
340+ if (device->dev.dma_ops) {
341+ /*
342+ * The caller provided custom DMA operations. Copy the
343+ * DMA-related fields that are used by e.g. dma_alloc_coherent()
344+ * into device->dev.
345+ */
346+ device->dma_device = &device->dev;
347+ if (!device->dev.dma_mask)
348+ device->dev.dma_mask = parent->dma_mask;
349+ if (!device->dev.coherent_dma_mask)
350+ device->dev.coherent_dma_mask =
351+ parent->coherent_dma_mask;
352+ } else {
353+ /*
354+ * The caller did not provide custom DMA operations. Use the
355+ * DMA mapping operations of the parent device.
356+ */
357+ device->dma_device = parent;
358+ }
345359
346360 mutex_lock(&device_mutex);
347361
@@ -1015,8 +1029,7 @@ static int __init ib_core_init(void) · 667 unmodified lines
10151029 return -ENOMEM;
10161030
10171031 ib_comp_wq = alloc_workqueue("ib-comp-wq",
1018− WQ_UNBOUND | WQ_HIGHPRI | WQ_MEM_RECLAIM,
1019− WQ_UNBOUND_MAX_ACTIVE);
1032+ WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_SYSFS, 0);
10201033 if (!ib_comp_wq) {
10211034 ret = -ENOMEM;
10221035 goto err;
drivers/infiniband/hw/i40iw/i40iw_utils.c+8−0
@@ -160,6 +160,9 @@ int i40iw_inetaddr_event(struct notifier_block *notifier, · 159 unmodified lines
160160 return NOTIFY_DONE;
161161
162162 iwdev = &hdl->device;
163+ if (iwdev->init_state < INET_NOTIFIER)
164+ return NOTIFY_DONE;
165+
163166 netdev = iwdev->ldev->netdev;
164167 upper_dev = netdev_master_upper_dev_get(netdev);
165168 if (netdev != event_netdev)
@@ -214,6 +217,9 @@ int i40iw_inet6addr_event(struct notifier_block *notifier, · 48 unmodified lines
214217 return NOTIFY_DONE;
215218
216219 iwdev = &hdl->device;
220+ if (iwdev->init_state < INET_NOTIFIER)
221+ return NOTIFY_DONE;
222+
217223 netdev = iwdev->ldev->netdev;
218224 if (netdev != event_netdev)
219225 return NOTIFY_DONE;
@@ -260,6 +266,8 @@ int i40iw_net_event(struct notifier_block *notifier, unsigned long event, void * · 40 unmodified lines
260266 if (!iwhdl)
261267 return NOTIFY_DONE;
262268 iwdev = &iwhdl->device;
269+ if (iwdev->init_state < INET_NOTIFIER)
270+ return NOTIFY_DONE;
263271 p = (__be32 *)neigh->primary_key;
264272 i40iw_copy_ip_ntohl(local_ipaddr, p);
265273 if (neigh->nud_state & NUD_VALID) {
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c+1−1
@@ -372,7 +372,7 @@ static int _ocrdma_pd_mgr_put_bitmap(struct ocrdma_dev *dev, u16 pd_id, · 371 unmodified lines
372372 return 0;
373373 }
374374
375−static u8 ocrdma_put_pd_num(struct ocrdma_dev *dev, u16 pd_id,
375+static int ocrdma_put_pd_num(struct ocrdma_dev *dev, u16 pd_id,
376376 bool dpp_pool)
377377 {
378378 int status;
drivers/infiniband/hw/qib/qib_iba7322.c+1−1
@@ -7068,7 +7068,7 @@ static void qib_7322_txchk_change(struct qib_devdata *dd, u32 start, · 7067 unmodified lines
70687068 unsigned long flags;
70697069
70707070 while (wait) {
7071− unsigned long shadow;
7071+ unsigned long shadow = 0;
70727072 int cstart, previ = -1;
70737073
70747074 /*
drivers/infiniband/hw/vmw_pvrdma/pvrdma.h+3−0
@@ -69,6 +69,9 @@ · 68 unmodified lines
6969 */
7070 #define PCI_DEVICE_ID_VMWARE_PVRDMA 0x0820
7171
72+#define PVRDMA_NUM_RING_PAGES 4
73+#define PVRDMA_QP_NUM_HEADER_PAGES 1
74+
7275 struct pvrdma_dev;
7376
7477 struct pvrdma_page_dir {
drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h+1−1
@@ -132,7 +132,7 @@ enum pvrdma_pci_resource { · 131 unmodified lines
132132
133133 enum pvrdma_device_ctl {
134134 PVRDMA_DEVICE_CTL_ACTIVATE, /* Activate device. */
135− PVRDMA_DEVICE_CTL_QUIESCE, /* Quiesce device. */
135+ PVRDMA_DEVICE_CTL_UNQUIESCE, /* Unquiesce device. */
136136 PVRDMA_DEVICE_CTL_RESET, /* Reset device. */
137137 };
138138
drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c+13−4
@@ -56,7 +56,7 @@ · 55 unmodified lines
5656 #include "pvrdma.h"
5757
5858 #define DRV_NAME "vmw_pvrdma"
59−#define DRV_VERSION "1.0.0.0-k"
59+#define DRV_VERSION "1.0.1.0-k"
6060
6161 static DEFINE_MUTEX(pvrdma_device_list_lock);
6262 static LIST_HEAD(pvrdma_device_list);
@@ -660,7 +660,16 @@ static void pvrdma_netdevice_event_handle(struct pvrdma_dev *dev, · 597 unmodified lines
660660 pvrdma_dispatch_event(dev, 1, IB_EVENT_PORT_ERR);
661661 break;
662662 case NETDEV_UP:
663− pvrdma_dispatch_event(dev, 1, IB_EVENT_PORT_ACTIVE);
663+ pvrdma_write_reg(dev, PVRDMA_REG_CTL,
664+ PVRDMA_DEVICE_CTL_UNQUIESCE);
665+
666+ mb();
667+
668+ if (pvrdma_read_reg(dev, PVRDMA_REG_ERR))
669+ dev_err(&dev->pdev->dev,
670+ "failed to activate device during link up\n");
671+ else
672+ pvrdma_dispatch_event(dev, 1, IB_EVENT_PORT_ACTIVE);
664673 break;
665674 default:
666675 dev_dbg(&dev->pdev->dev, "ignore netdevice event %ld on %s\n",
@@ -858,7 +867,7 @@ static int pvrdma_pci_probe(struct pci_dev *pdev, · 191 unmodified lines
858867 dev->dsr->resp_slot_dma = (u64)slot_dma;
859868
860869 /* Async event ring */
861− dev->dsr->async_ring_pages.num_pages = 4;
870+ dev->dsr->async_ring_pages.num_pages = PVRDMA_NUM_RING_PAGES;
862871 ret = pvrdma_page_dir_init(dev, &dev->async_pdir,
863872 dev->dsr->async_ring_pages.num_pages, true);
864873 if (ret)
@@ -867,7 +876,7 @@ static int pvrdma_pci_probe(struct pci_dev *pdev, · 2 unmodified lines
867876 dev->dsr->async_ring_pages.pdir_dma = dev->async_pdir.dir_dma;
868877
869878 /* CQ notification ring */
870− dev->dsr->cq_ring_pages.num_pages = 4;
879+ dev->dsr->cq_ring_pages.num_pages = PVRDMA_NUM_RING_PAGES;
871880 ret = pvrdma_page_dir_init(dev, &dev->cq_pdir,
872881 dev->dsr->cq_ring_pages.num_pages, true);
873882 if (ret)
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c+18−24
@@ -170,8 +170,9 @@ static int pvrdma_set_sq_size(struct pvrdma_dev *dev, struct ib_qp_cap *req_cap, · 169 unmodified lines
170170 sizeof(struct pvrdma_sge) *
171171 qp->sq.max_sg);
172172 /* Note: one extra page for the header. */
173− qp->npages_send = 1 + (qp->sq.wqe_cnt * qp->sq.wqe_size +
174− PAGE_SIZE - 1) / PAGE_SIZE;
173+ qp->npages_send = PVRDMA_QP_NUM_HEADER_PAGES +
174+ (qp->sq.wqe_cnt * qp->sq.wqe_size + PAGE_SIZE - 1) /
175+ PAGE_SIZE;
175176
176177 return 0;
177178 }
@@ -288,7 +289,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd, · 110 unmodified lines
288289 qp->npages = qp->npages_send + qp->npages_recv;
289290
290291 /* Skip header page. */
291− qp->sq.offset = PAGE_SIZE;
292+ qp->sq.offset = PVRDMA_QP_NUM_HEADER_PAGES * PAGE_SIZE;
292293
293294 /* Recv queue pages are after send pages. */
294295 qp->rq.offset = qp->npages_send * PAGE_SIZE;
@@ -341,7 +342,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd, · 46 unmodified lines
341342 cmd->qp_type = ib_qp_type_to_pvrdma(init_attr->qp_type);
342343 cmd->access_flags = IB_ACCESS_LOCAL_WRITE;
343344 cmd->total_chunks = qp->npages;
344− cmd->send_chunks = qp->npages_send - 1;
345+ cmd->send_chunks = qp->npages_send - PVRDMA_QP_NUM_HEADER_PAGES;
345346 cmd->pdir_dma = qp->pdir.dir_dma;
346347
347348 dev_dbg(&dev->pdev->dev, "create queuepair with %d, %d, %d, %d\n",
@@ -554,13 +555,13 @@ out: · 206 unmodified lines
554555 return ret;
555556 }
556557
557−static inline void *get_sq_wqe(struct pvrdma_qp *qp, int n)
558+static inline void *get_sq_wqe(struct pvrdma_qp *qp, unsigned int n)
558559 {
559560 return pvrdma_page_dir_get_ptr(&qp->pdir,
560561 qp->sq.offset + n * qp->sq.wqe_size);
561562 }
562563
563−static inline void *get_rq_wqe(struct pvrdma_qp *qp, int n)
564+static inline void *get_rq_wqe(struct pvrdma_qp *qp, unsigned int n)
564565 {
565566 return pvrdma_page_dir_get_ptr(&qp->pdir,
566567 qp->rq.offset + n * qp->rq.wqe_size);
@@ -598,9 +599,7 @@ int pvrdma_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, · 31 unmodified lines
598599 unsigned long flags;
599600 struct pvrdma_sq_wqe_hdr *wqe_hdr;
600601 struct pvrdma_sge *sge;
601− int i, index;
602− int nreq;
603− int ret;
602+ int i, ret;
604603
605604 /*
606605 * In states lower than RTS, we can fail immediately. In other states,
@@ -613,9 +612,8 @@ int pvrdma_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, · 6 unmodified lines
613612
614613 spin_lock_irqsave(&qp->sq.lock, flags);
615614
616− index = pvrdma_idx(&qp->sq.ring->prod_tail, qp->sq.wqe_cnt);
617− for (nreq = 0; wr; nreq++, wr = wr->next) {
618− unsigned int tail;
615+ while (wr) {
616+ unsigned int tail = 0;
619617
620618 if (unlikely(!pvrdma_idx_ring_has_space(
621619 qp->sq.ring, qp->sq.wqe_cnt, &tail))) {
@@ -680,7 +678,7 @@ int pvrdma_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, · 58 unmodified lines
680678 }
681679 }
682680
683− wqe_hdr = (struct pvrdma_sq_wqe_hdr *)get_sq_wqe(qp, index);
681+ wqe_hdr = (struct pvrdma_sq_wqe_hdr *)get_sq_wqe(qp, tail);
684682 memset(wqe_hdr, 0, sizeof(*wqe_hdr));
685683 wqe_hdr->wr_id = wr->wr_id;
686684 wqe_hdr->num_sge = wr->num_sge;
@@ -771,12 +769,11 @@ int pvrdma_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, · 84 unmodified lines
771769 /* Make sure wqe is written before index update */
772770 smp_wmb();
773771
774− index++;
775− if (unlikely(index >= qp->sq.wqe_cnt))
776− index = 0;
777772 /* Update shared sq ring */
778773 pvrdma_idx_ring_inc(&qp->sq.ring->prod_tail,
779774 qp->sq.wqe_cnt);
775+
776+ wr = wr->next;
780777 }
781778
782779 ret = 0;
@@ -806,7 +803,6 @@ int pvrdma_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, · 23 unmodified lines
806803 struct pvrdma_qp *qp = to_vqp(ibqp);
807804 struct pvrdma_rq_wqe_hdr *wqe_hdr;
808805 struct pvrdma_sge *sge;
809− int index, nreq;
810806 int ret = 0;
811807 int i;
812808
@@ -821,9 +817,8 @@ int pvrdma_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, · 8 unmodified lines
821817
822818 spin_lock_irqsave(&qp->rq.lock, flags);
823819
824− index = pvrdma_idx(&qp->rq.ring->prod_tail, qp->rq.wqe_cnt);
825− for (nreq = 0; wr; nreq++, wr = wr->next) {
826− unsigned int tail;
820+ while (wr) {
821+ unsigned int tail = 0;
827822
828823 if (unlikely(wr->num_sge > qp->rq.max_sg ||
829824 wr->num_sge < 0)) {
@@ -843,7 +838,7 @@ int pvrdma_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, · 13 unmodified lines
843838 goto out;
844839 }
845840
846− wqe_hdr = (struct pvrdma_rq_wqe_hdr *)get_rq_wqe(qp, index);
841+ wqe_hdr = (struct pvrdma_rq_wqe_hdr *)get_rq_wqe(qp, tail);
847842 wqe_hdr->wr_id = wr->wr_id;
848843 wqe_hdr->num_sge = wr->num_sge;
849844 wqe_hdr->total_len = 0;
@@ -859,12 +854,11 @@ int pvrdma_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, · 9 unmodified lines
859854 /* Make sure wqe is written before index update */
860855 smp_wmb();
861856
862− index++;
863− if (unlikely(index >= qp->rq.wqe_cnt))
864− index = 0;
865857 /* Update shared rq ring */
866858 pvrdma_idx_ring_inc(&qp->rq.ring->prod_tail,
867859 qp->rq.wqe_cnt);
860+
861+ wr = wr->next;
868862 }
869863
870864 spin_unlock_irqrestore(&qp->rq.lock, flags);
drivers/infiniband/sw/rdmavt/mmap.c+2−2
@@ -170,9 +170,9 @@ struct rvt_mmap_info *rvt_create_mmap_info(struct rvt_dev_info *rdi, · 169 unmodified lines
170170
171171 spin_lock_irq(&rdi->mmap_offset_lock);
172172 if (rdi->mmap_offset == 0)
173− rdi->mmap_offset = PAGE_SIZE;
173+ rdi->mmap_offset = ALIGN(PAGE_SIZE, SHMLBA);
174174 ip->offset = rdi->mmap_offset;
175− rdi->mmap_offset += size;
175+ rdi->mmap_offset += ALIGN(size, SHMLBA);
176176 spin_unlock_irq(&rdi->mmap_offset_lock);
177177
178178 INIT_LIST_HEAD(&ip->pending_mmaps);
drivers/infiniband/sw/rxe/Kconfig+1−1
@@ -22,4 +22,4 @@ config RDMA_RXE · 21 unmodified lines
2222 To configure and work with soft-RoCE driver please use the
2323 following wiki page under "configure Soft-RoCE (RXE)" section:
2424
25− https://github.com/SoftRoCE/rxe-dev/wiki/rxe-dev:-Home
25+ https://github.com/linux-rdma/rdma-core/blob/master/Documentation/rxe.md
drivers/infiniband/sw/rxe/rxe_mmap.c+2−2
@@ -156,10 +156,10 @@ struct rxe_mmap_info *rxe_create_mmap_info(struct rxe_dev *rxe, · 155 unmodified lines
156156 spin_lock_bh(&rxe->mmap_offset_lock);
157157
158158 if (rxe->mmap_offset == 0)
159− rxe->mmap_offset = PAGE_SIZE;
159+ rxe->mmap_offset = ALIGN(PAGE_SIZE, SHMLBA);
160160
161161 ip->info.offset = rxe->mmap_offset;
162− rxe->mmap_offset += size;
162+ rxe->mmap_offset += ALIGN(size, SHMLBA);
163163
164164 spin_unlock_bh(&rxe->mmap_offset_lock);
165165
drivers/infiniband/sw/rxe/rxe_req.c+1−1
@@ -729,11 +729,11 @@ next_wqe: · 728 unmodified lines
729729 ret = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, &pkt, skb);
730730 if (ret) {
731731 qp->need_req_skb = 1;
732− kfree_skb(skb);
733732
734733 rollback_state(wqe, qp, &rollback_wqe, rollback_psn);
735734
736735 if (ret == -EAGAIN) {
736+ kfree_skb(skb);
737737 rxe_run_task(&qp->req.task, 1);
738738 goto exit;
739739 }
drivers/infiniband/sw/rxe/rxe_resp.c+4−5
@@ -813,18 +813,17 @@ static enum resp_states execute(struct rxe_qp *qp, struct rxe_pkt_info *pkt) · 812 unmodified lines
813813 WARN_ON_ONCE(1);
814814 }
815815
816− /* We successfully processed this new request. */
817− qp->resp.msn++;
818−
819816 /* next expected psn, read handles this separately */
820817 qp->resp.psn = (pkt->psn + 1) & BTH_PSN_MASK;
821818
822819 qp->resp.opcode = pkt->opcode;
823820 qp->resp.status = IB_WC_SUCCESS;
824821
825− if (pkt->mask & RXE_COMP_MASK)
822+ if (pkt->mask & RXE_COMP_MASK) {
823+ /* We successfully processed this new request. */
824+ qp->resp.msn++;
826825 return RESPST_COMPLETE;
827− else if (qp_type(qp) == IB_QPT_RC)
826+ } else if (qp_type(qp) == IB_QPT_RC)
828827 return RESPST_ACKNOWLEDGE;
829828 else
830829 return RESPST_CLEANUP;
drivers/infiniband/ulp/iser/iscsi_iser.h+2−0
@@ -430,6 +430,7 @@ struct iser_fr_desc { · 429 unmodified lines
430430 struct list_head list;
431431 struct iser_reg_resources rsc;
432432 struct iser_pi_context *pi_ctx;
433+ struct list_head all_list;
433434 };
434435
435436 /**
@@ -443,6 +444,7 @@ struct iser_fr_pool { · 7 unmodified lines
443444 struct list_head list;
444445 spinlock_t lock;
445446 int size;
447+ struct list_head all_list;
446448 };
447449
448450 /**
drivers/infiniband/ulp/iser/iser_verbs.c+5−3
@@ -362,6 +362,7 @@ int iser_alloc_fastreg_pool(struct ib_conn *ib_conn, · 361 unmodified lines
362362 int i, ret;
363363
364364 INIT_LIST_HEAD(&fr_pool->list);
365+ INIT_LIST_HEAD(&fr_pool->all_list);
365366 spin_lock_init(&fr_pool->lock);
366367 fr_pool->size = 0;
367368 for (i = 0; i < cmds_max; i++) {
@@ -373,6 +374,7 @@ int iser_alloc_fastreg_pool(struct ib_conn *ib_conn, · 5 unmodified lines
373374 }
374375
375376 list_add_tail(&desc->list, &fr_pool->list);
377+ list_add_tail(&desc->all_list, &fr_pool->all_list);
376378 fr_pool->size++;
377379 }
378380
@@ -392,13 +394,13 @@ void iser_free_fastreg_pool(struct ib_conn *ib_conn) · 13 unmodified lines
392394 struct iser_fr_desc *desc, *tmp;
393395 int i = 0;
394396
395− if (list_empty(&fr_pool->list))
397+ if (list_empty(&fr_pool->all_list))
396398 return;
397399
398400 iser_info("freeing conn %p fr pool\n", ib_conn);
399401
400− list_for_each_entry_safe(desc, tmp, &fr_pool->list, list) {
401− list_del(&desc->list);
402+ list_for_each_entry_safe(desc, tmp, &fr_pool->all_list, all_list) {
403+ list_del(&desc->all_list);
402404 iser_free_reg_res(&desc->rsc);
403405 if (desc->pi_ctx)
404406 iser_free_pi_ctx(desc->pi_ctx);
drivers/input/joystick/iforce/iforce-usb.c+3−0
@@ -141,6 +141,9 @@ static int iforce_usb_probe(struct usb_interface *intf, · 140 unmodified lines
141141
142142 interface = intf->cur_altsetting;
143143
144+ if (interface->desc.bNumEndpoints < 2)
145+ return -ENODEV;
146+
144147 epirq = &interface->endpoint[0].desc;
145148 epout = &interface->endpoint[1].desc;
146149
drivers/input/misc/cm109.c+4−0
@@ -700,6 +700,10 @@ static int cm109_usb_probe(struct usb_interface *intf, · 699 unmodified lines
700700 int error = -ENOMEM;
701701
702702 interface = intf->cur_altsetting;
703+
704+ if (interface->desc.bNumEndpoints < 1)
705+ return -ENODEV;
706+
703707 endpoint = &interface->endpoint[0].desc;
704708
705709 if (!usb_endpoint_is_int_in(endpoint))
drivers/input/misc/ims-pcu.c+4−0
@@ -1667,6 +1667,10 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc · 1666 unmodified lines
16671667 return -EINVAL;
16681668
16691669 alt = pcu->ctrl_intf->cur_altsetting;
1670+
1671+ if (alt->desc.bNumEndpoints < 1)
1672+ return -ENODEV;
1673+
16701674 pcu->ep_ctrl = &alt->endpoint[0].desc;
16711675 pcu->max_ctrl_size = usb_endpoint_maxp(pcu->ep_ctrl);
16721676
drivers/input/misc/yealink.c+4−0
@@ -875,6 +875,10 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id) · 874 unmodified lines
875875 int ret, pipe, i;
876876
877877 interface = intf->cur_altsetting;
878+
879+ if (interface->desc.bNumEndpoints < 1)
880+ return -ENODEV;
881+
878882 endpoint = &interface->endpoint[0].desc;
879883 if (!usb_endpoint_is_int_in(endpoint))
880884 return -ENODEV;
drivers/input/mouse/alps.c+52−20
@@ -1282,10 +1282,8 @@ static int alps_decode_ss4_v2(struct alps_fields *f, · 1281 unmodified lines
12821282 /* handle buttons */
12831283 if (pkt_id == SS4_PACKET_ID_STICK) {
12841284 f->ts_left = !!(SS4_BTN_V2(p) & 0x01);
1285− if (!(priv->flags & ALPS_BUTTONPAD)) {
1286− f->ts_right = !!(SS4_BTN_V2(p) & 0x02);
1287− f->ts_middle = !!(SS4_BTN_V2(p) & 0x04);
1288− }
1285+ f->ts_right = !!(SS4_BTN_V2(p) & 0x02);
1286+ f->ts_middle = !!(SS4_BTN_V2(p) & 0x04);
12891287 } else {
12901288 f->left = !!(SS4_BTN_V2(p) & 0x01);
12911289 if (!(priv->flags & ALPS_BUTTONPAD)) {
@@ -2462,14 +2460,34 @@ static int alps_update_device_area_ss4_v2(unsigned char otp[][4], · 1170 unmodified lines
24622460 int num_y_electrode;
24632461 int x_pitch, y_pitch, x_phys, y_phys;
24642462
2465− num_x_electrode = SS4_NUMSENSOR_XOFFSET + (otp[1][0] & 0x0F);
2466− num_y_electrode = SS4_NUMSENSOR_YOFFSET + ((otp[1][0] >> 4) & 0x0F);
2463+ if (IS_SS4PLUS_DEV(priv->dev_id)) {
2464+ num_x_electrode =
2465+ SS4PLUS_NUMSENSOR_XOFFSET + (otp[0][2] & 0x0F);
2466+ num_y_electrode =
2467+ SS4PLUS_NUMSENSOR_YOFFSET + ((otp[0][2] >> 4) & 0x0F);
2468+
2469+ priv->x_max =
2470+ (num_x_electrode - 1) * SS4PLUS_COUNT_PER_ELECTRODE;
2471+ priv->y_max =
2472+ (num_y_electrode - 1) * SS4PLUS_COUNT_PER_ELECTRODE;
24672473
2468− priv->x_max = (num_x_electrode - 1) * SS4_COUNT_PER_ELECTRODE;
2469− priv->y_max = (num_y_electrode - 1) * SS4_COUNT_PER_ELECTRODE;
2474+ x_pitch = (otp[0][1] & 0x0F) + SS4PLUS_MIN_PITCH_MM;
2475+ y_pitch = ((otp[0][1] >> 4) & 0x0F) + SS4PLUS_MIN_PITCH_MM;
24702476
2471− x_pitch = ((otp[1][2] >> 2) & 0x07) + SS4_MIN_PITCH_MM;
2472− y_pitch = ((otp[1][2] >> 5) & 0x07) + SS4_MIN_PITCH_MM;
2477+ } else {
2478+ num_x_electrode =
2479+ SS4_NUMSENSOR_XOFFSET + (otp[1][0] & 0x0F);
2480+ num_y_electrode =
2481+ SS4_NUMSENSOR_YOFFSET + ((otp[1][0] >> 4) & 0x0F);
2482+
2483+ priv->x_max =
2484+ (num_x_electrode - 1) * SS4_COUNT_PER_ELECTRODE;
2485+ priv->y_max =
2486+ (num_y_electrode - 1) * SS4_COUNT_PER_ELECTRODE;
2487+
2488+ x_pitch = ((otp[1][2] >> 2) & 0x07) + SS4_MIN_PITCH_MM;
2489+ y_pitch = ((otp[1][2] >> 5) & 0x07) + SS4_MIN_PITCH_MM;
2490+ }
24732491
24742492 x_phys = x_pitch * (num_x_electrode - 1); /* In 0.1 mm units */
24752493 y_phys = y_pitch * (num_y_electrode - 1); /* In 0.1 mm units */
@@ -2485,7 +2503,10 @@ static int alps_update_btn_info_ss4_v2(unsigned char otp[][4], · 9 unmodified lines
24852503 {
24862504 unsigned char is_btnless;
24872505
2488− is_btnless = (otp[1][1] >> 3) & 0x01;
2506+ if (IS_SS4PLUS_DEV(priv->dev_id))
2507+ is_btnless = (otp[1][0] >> 1) & 0x01;
2508+ else
2509+ is_btnless = (otp[1][1] >> 3) & 0x01;
24892510
24902511 if (is_btnless)
24912512 priv->flags |= ALPS_BUTTONPAD;
@@ -2493,6 +2514,21 @@ static int alps_update_btn_info_ss4_v2(unsigned char otp[][4], · 1 unmodified line
24932514 return 0;
24942515 }
24952516
2517+static int alps_update_dual_info_ss4_v2(unsigned char otp[][4],
2518+ struct alps_data *priv)
2519+{
2520+ bool is_dual = false;
2521+
2522+ if (IS_SS4PLUS_DEV(priv->dev_id))
2523+ is_dual = (otp[0][0] >> 4) & 0x01;
2524+
2525+ if (is_dual)
2526+ priv->flags |= ALPS_DUALPOINT |
2527+ ALPS_DUALPOINT_WITH_PRESSURE;
2528+
2529+ return 0;
2530+}
2531+
24962532 static int alps_set_defaults_ss4_v2(struct psmouse *psmouse,
24972533 struct alps_data *priv)
24982534 {
@@ -2508,6 +2544,8 @@ static int alps_set_defaults_ss4_v2(struct psmouse *psmouse, · 9 unmodified lines
25082544
25092545 alps_update_btn_info_ss4_v2(otp, priv);
25102546
2547+ alps_update_dual_info_ss4_v2(otp, priv);
2548+
25112549 return 0;
25122550 }
25132551
@@ -2753,10 +2791,6 @@ static int alps_set_protocol(struct psmouse *psmouse, · 239 unmodified lines
27532791 if (alps_set_defaults_ss4_v2(psmouse, priv))
27542792 return -EIO;
27552793
2756− if (priv->fw_ver[1] == 0x1)
2757− priv->flags |= ALPS_DUALPOINT |
2758− ALPS_DUALPOINT_WITH_PRESSURE;
2759−
27602794 break;
27612795 }
27622796
@@ -2827,10 +2861,7 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) · 64 unmodified lines
28272861 ec[2] >= 0x90 && ec[2] <= 0x9d) {
28282862 protocol = &alps_v3_protocol_data;
28292863 } else if (e7[0] == 0x73 && e7[1] == 0x03 &&
2830− e7[2] == 0x14 && ec[1] == 0x02) {
2831− protocol = &alps_v8_protocol_data;
2832− } else if (e7[0] == 0x73 && e7[1] == 0x03 &&
2833− e7[2] == 0x28 && ec[1] == 0x01) {
2864+ (e7[2] == 0x14 || e7[2] == 0x28)) {
28342865 protocol = &alps_v8_protocol_data;
28352866 } else {
28362867 psmouse_dbg(psmouse,
@@ -2840,7 +2871,8 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) · 3 unmodified lines
28402871 }
28412872
28422873 if (priv) {
2843− /* Save the Firmware version */
2874+ /* Save Device ID and Firmware version */
2875+ memcpy(priv->dev_id, e7, 3);
28442876 memcpy(priv->fw_ver, ec, 3);
28452877 error = alps_set_protocol(psmouse, priv, protocol);
28462878 if (error)
drivers/input/mouse/alps.h+11−0
@@ -54,6 +54,16 @@ enum SS4_PACKET_ID { · 53 unmodified lines
5454
5555 #define SS4_MASK_NORMAL_BUTTONS 0x07
5656
57+#define SS4PLUS_COUNT_PER_ELECTRODE 128
58+#define SS4PLUS_NUMSENSOR_XOFFSET 16
59+#define SS4PLUS_NUMSENSOR_YOFFSET 5
60+#define SS4PLUS_MIN_PITCH_MM 37
61+
62+#define IS_SS4PLUS_DEV(_b) (((_b[0]) == 0x73) && \
63+ ((_b[1]) == 0x03) && \
64+ ((_b[2]) == 0x28) \
65+ )
66+
5767 #define SS4_IS_IDLE_V2(_b) (((_b[0]) == 0x18) && \
5868 ((_b[1]) == 0x10) && \
5969 ((_b[2]) == 0x00) && \
@@ -283,6 +293,7 @@ struct alps_data { · 223 unmodified lines
283293 int addr_command;
284294 u16 proto_version;
285295 u8 byte0, mask0;
296+ u8 dev_id[3];
286297 u8 fw_ver[3];
287298 int flags;
288299 int x_max;
drivers/input/mouse/elan_i2c_core.c+11−9
@@ -218,17 +218,19 @@ static int elan_query_product(struct elan_tp_data *data) · 217 unmodified lines
218218
219219 static int elan_check_ASUS_special_fw(struct elan_tp_data *data)
220220 {
221− if (data->ic_type != 0x0E)
222− return false;
223−
224− switch (data->product_id) {
225− case 0x05 ... 0x07:
226− case 0x09:
227− case 0x13:
221+ if (data->ic_type == 0x0E) {
222+ switch (data->product_id) {
223+ case 0x05 ... 0x07:
224+ case 0x09:
225+ case 0x13:
226+ return true;
227+ }
228+ } else if (data->ic_type == 0x08 && data->product_id == 0x26) {
229+ /* ASUS EeeBook X205TA */
228230 return true;
229− default:
230− return false;
231231 }
232+
233+ return false;
232234 }
233235
234236 static int __elan_initialize(struct elan_tp_data *data)
drivers/input/rmi4/rmi_f30.c+4−0
@@ -170,6 +170,10 @@ static int rmi_f30_config(struct rmi_function *fn) · 169 unmodified lines
170170 rmi_get_platform_data(fn->rmi_dev);
171171 int error;
172172
173+ /* can happen if f30_data.disable is set */
174+ if (!f30)
175+ return 0;
176+
173177 if (pdata->f30_data.trackstick_buttons) {
174178 /* Try [re-]establish link to F03. */
175179 f30->f03 = rmi_find_function(fn->rmi_dev, 0x03);
drivers/input/serio/i8042-x86ia64io.h+14−0
@@ -119,6 +119,13 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = { · 118 unmodified lines
119119 DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"),
120120 },
121121 },
122+ {
123+ /* Dell Embedded Box PC 3000 */
124+ .matches = {
125+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
126+ DMI_MATCH(DMI_PRODUCT_NAME, "Embedded Box PC 3000"),
127+ },
128+ },
122129 {
123130 /* OQO Model 01 */
124131 .matches = {
@@ -513,6 +520,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { · 388 unmodified lines
513520 DMI_MATCH(DMI_PRODUCT_NAME, "IC4I"),
514521 },
515522 },
523+ {
524+ /* TUXEDO BU1406 */
525+ .matches = {
526+ DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
527+ DMI_MATCH(DMI_PRODUCT_NAME, "N24_25BU"),
528+ },
529+ },
516530 { }
517531 };
518532
drivers/input/tablet/hanwang.c+3−0
@@ -340,6 +340,9 @@ static int hanwang_probe(struct usb_interface *intf, const struct usb_device_id · 339 unmodified lines
340340 int error;
341341 int i;
342342
343+ if (intf->cur_altsetting->desc.bNumEndpoints < 1)
344+ return -ENODEV;
345+
343346 hanwang = kzalloc(sizeof(struct hanwang), GFP_KERNEL);
344347 input_dev = input_allocate_device();
345348 if (!hanwang || !input_dev) {
drivers/input/tablet/kbtab.c+3−0
@@ -122,6 +122,9 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i · 121 unmodified lines
122122 struct input_dev *input_dev;
123123 int error = -ENOMEM;
124124
125+ if (intf->cur_altsetting->desc.bNumEndpoints < 1)
126+ return -ENODEV;
127+
125128 kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL);
126129 input_dev = input_allocate_device();
127130 if (!kbtab || !input_dev)
drivers/input/touchscreen/sur40.c+3−0
@@ -527,6 +527,9 @@ static int sur40_probe(struct usb_interface *interface, · 526 unmodified lines
527527 if (iface_desc->desc.bInterfaceClass != 0xFF)
528528 return -ENODEV;
529529
530+ if (iface_desc->desc.bNumEndpoints < 5)
531+ return -ENODEV;
532+
530533 /* Use endpoint #4 (0x86). */
531534 endpoint = &iface_desc->endpoint[4].desc;
532535 if (endpoint->bEndpointAddress != TOUCH_ENDPOINT)
drivers/iommu/amd_iommu.c+1−1
@@ -3202,7 +3202,7 @@ static void amd_iommu_get_resv_regions(struct device *dev, · 3201 unmodified lines
32023202
32033203 region = iommu_alloc_resv_region(MSI_RANGE_START,
32043204 MSI_RANGE_END - MSI_RANGE_START + 1,
3205− 0, IOMMU_RESV_RESERVED);
3205+ 0, IOMMU_RESV_MSI);
32063206 if (!region)
32073207 return;
32083208 list_add_tail(&region->list, head);
drivers/iommu/arm-smmu-v3.c+1−1
@@ -1888,7 +1888,7 @@ static void arm_smmu_get_resv_regions(struct device *dev, · 1887 unmodified lines
18881888 int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO;
18891889
18901890 region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH,
1891− prot, IOMMU_RESV_MSI);
1891+ prot, IOMMU_RESV_SW_MSI);
18921892 if (!region)
18931893 return;
18941894
drivers/iommu/arm-smmu.c+1−1
@@ -1608,7 +1608,7 @@ static void arm_smmu_get_resv_regions(struct device *dev, · 1607 unmodified lines
16081608 int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO;
16091609
16101610 region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH,
1611− prot, IOMMU_RESV_MSI);
1611+ prot, IOMMU_RESV_SW_MSI);
16121612 if (!region)
16131613 return;
16141614
drivers/iommu/exynos-iommu.c+7−1
@@ -512,7 +512,13 @@ static void sysmmu_tlb_invalidate_flpdcache(struct sysmmu_drvdata *data, · 511 unmodified lines
512512 spin_lock_irqsave(&data->lock, flags);
513513 if (data->active && data->version >= MAKE_MMU_VER(3, 3)) {
514514 clk_enable(data->clk_master);
515− __sysmmu_tlb_invalidate_entry(data, iova, 1);
515+ if (sysmmu_block(data)) {
516+ if (data->version >= MAKE_MMU_VER(5, 0))
517+ __sysmmu_tlb_invalidate(data);
518+ else
519+ __sysmmu_tlb_invalidate_entry(data, iova, 1);
520+ sysmmu_unblock(data);
521+ }
516522 clk_disable(data->clk_master);
517523 }
518524 spin_unlock_irqrestore(&data->lock, flags);
drivers/iommu/intel-iommu.c+2−2
@@ -916,7 +916,7 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf · 915 unmodified lines
916916 * which we used for the IOMMU lookup. Strictly speaking
917917 * we could do this for all PCI devices; we only need to
918918 * get the BDF# from the scope table for ACPI matches. */
919− if (pdev->is_virtfn)
919+ if (pdev && pdev->is_virtfn)
920920 goto got_pdev;
921921
922922 *bus = drhd->devices[i].bus;
@@ -5249,7 +5249,7 @@ static void intel_iommu_get_resv_regions(struct device *device, · 4326 unmodified lines
52495249
52505250 reg = iommu_alloc_resv_region(IOAPIC_RANGE_START,
52515251 IOAPIC_RANGE_END - IOAPIC_RANGE_START + 1,
5252− 0, IOMMU_RESV_RESERVED);
5252+ 0, IOMMU_RESV_MSI);
52535253 if (!reg)
52545254 return;
52555255 list_add_tail(&reg->list, head);
drivers/iommu/io-pgtable-arm-v7s.c+5−1
@@ -422,8 +422,12 @@ static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova, · 421 unmodified lines
422422 pte |= ARM_V7S_ATTR_NS_TABLE;
423423
424424 __arm_v7s_set_pte(ptep, pte, 1, cfg);
425− } else {
425+ } else if (ARM_V7S_PTE_IS_TABLE(pte, lvl)) {
426426 cptep = iopte_deref(pte, lvl);
427+ } else {
428+ /* We require an unmap first */
429+ WARN_ON(!selftest_running);
430+ return -EEXIST;
427431 }
428432
429433 /* Rinse, repeat */
drivers/iommu/io-pgtable-arm.c+5−1
@@ -335,8 +335,12 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova, · 334 unmodified lines
335335 if (cfg->quirks & IO_PGTABLE_QUIRK_ARM_NS)
336336 pte |= ARM_LPAE_PTE_NSTABLE;
337337 __arm_lpae_set_pte(ptep, pte, cfg);
338− } else {
338+ } else if (!iopte_leaf(pte, lvl)) {
339339 cptep = iopte_deref(pte, data);
340+ } else {
341+ /* We require an unmap first */
342+ WARN_ON(!selftest_running);
343+ return -EEXIST;
340344 }
341345
342346 /* Rinse, repeat */
drivers/iommu/iommu.c+3−2
@@ -72,6 +72,7 @@ static const char * const iommu_group_resv_type_string[] = { · 71 unmodified lines
7272 [IOMMU_RESV_DIRECT] = "direct",
7373 [IOMMU_RESV_RESERVED] = "reserved",
7474 [IOMMU_RESV_MSI] = "msi",
75+ [IOMMU_RESV_SW_MSI] = "msi",
7576 };
7677
7778 #define IOMMU_GROUP_ATTR(_name, _mode, _show, _store) \
@@ -1743,8 +1744,8 @@ void iommu_put_resv_regions(struct device *dev, struct list_head *list) · 1665 unmodified lines
17431744 }
17441745
17451746 struct iommu_resv_region *iommu_alloc_resv_region(phys_addr_t start,
1746− size_t length,
1747− int prot, int type)
1747+ size_t length, int prot,
1748+ enum iommu_resv_type type)
17481749 {
17491750 struct iommu_resv_region *region;
17501751
drivers/media/platform/coda/imx-vdoa.c+1−1
@@ -321,7 +321,7 @@ static const struct of_device_id vdoa_dt_ids[] = { · 320 unmodified lines
321321 };
322322 MODULE_DEVICE_TABLE(of, vdoa_dt_ids);
323323
324−static const struct platform_driver vdoa_driver = {
324+static struct platform_driver vdoa_driver = {
325325 .probe = vdoa_probe,
326326 .remove = vdoa_remove,
327327 .driver = {
drivers/media/platform/exynos-gsc/gsc-core.c+0−2
@@ -861,9 +861,7 @@ int gsc_prepare_addr(struct gsc_ctx *ctx, struct vb2_buffer *vb, · 860 unmodified lines
861861
862862 if ((frame->fmt->pixelformat == V4L2_PIX_FMT_VYUY) ||
863863 (frame->fmt->pixelformat == V4L2_PIX_FMT_YVYU) ||
864− (frame->fmt->pixelformat == V4L2_PIX_FMT_NV61) ||
865864 (frame->fmt->pixelformat == V4L2_PIX_FMT_YVU420) ||
866− (frame->fmt->pixelformat == V4L2_PIX_FMT_NV21) ||
867865 (frame->fmt->pixelformat == V4L2_PIX_FMT_YVU420M))
868866 swap(addr->cb, addr->cr);
869867
drivers/media/platform/sti/bdisp/bdisp-v4l2.c+1−1
@@ -632,8 +632,8 @@ static int bdisp_open(struct file *file) · 631 unmodified lines
632632
633633 error_ctrls:
634634 bdisp_ctrls_delete(ctx);
635−error_fh:
636635 v4l2_fh_del(&ctx->fh);
636+error_fh:
637637 v4l2_fh_exit(&ctx->fh);
638638 bdisp_hw_free_nodes(ctx);
639639 mem_ctx:
drivers/media/usb/dvb-usb/dvb-usb-firmware.c+12−10
@@ -36,16 +36,18 @@ static int usb_cypress_writemem(struct usb_device *udev,u16 addr,u8 *data, u8 le · 35 unmodified lines
3636 int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type)
3737 {
3838 struct hexline *hx;
39− u8 reset;
40− int ret,pos=0;
39+ u8 *buf;
40+ int ret, pos = 0;
41+ u16 cpu_cs_register = cypress[type].cpu_cs_register;
4142
42− hx = kmalloc(sizeof(*hx), GFP_KERNEL);
43− if (!hx)
43+ buf = kmalloc(sizeof(*hx), GFP_KERNEL);
44+ if (!buf)
4445 return -ENOMEM;
46+ hx = (struct hexline *)buf;
4547
4648 /* stop the CPU */
47− reset = 1;
48− if ((ret = usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1)) != 1)
49+ buf[0] = 1;
50+ if (usb_cypress_writemem(udev, cpu_cs_register, buf, 1) != 1)
4951 err("could not stop the USB controller CPU.");
5052
5153 while ((ret = dvb_usb_get_hexline(fw, hx, &pos)) > 0) {
@@ -61,21 +63,21 @@ int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw · 9 unmodified lines
6163 }
6264 if (ret < 0) {
6365 err("firmware download failed at %d with %d",pos,ret);
64− kfree(hx);
66+ kfree(buf);
6567 return ret;
6668 }
6769
6870 if (ret == 0) {
6971 /* restart the CPU */
70− reset = 0;
71− if (ret || usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1) != 1) {
72+ buf[0] = 0;
73+ if (usb_cypress_writemem(udev, cpu_cs_register, buf, 1) != 1) {
7274 err("could not restart the USB controller CPU.");
7375 ret = -EINVAL;
7476 }
7577 } else
7678 ret = -EIO;
7779
78− kfree(hx);
80+ kfree(buf);
7981
8082 return ret;
8183 }
drivers/memory/omap-gpmc.c+1−3
@@ -1947,9 +1947,7 @@ static int gpmc_probe_onenand_child(struct platform_device *pdev, · 1946 unmodified lines
19471947 if (!of_property_read_u32(child, "dma-channel", &val))
19481948 gpmc_onenand_data->dma_channel = val;
19491949
1950− gpmc_onenand_init(gpmc_onenand_data);
1951−
1952− return 0;
1950+ return gpmc_onenand_init(gpmc_onenand_data);
19531951 }
19541952 #else
19551953 static int gpmc_probe_onenand_child(struct platform_device *pdev,
drivers/misc/cxl/pci.c+6−7
@@ -1792,15 +1792,14 @@ static pci_ers_result_t cxl_pci_error_detected(struct pci_dev *pdev, · 1791 unmodified lines
17921792
17931793 /* If we're permanently dead, give up. */
17941794 if (state == pci_channel_io_perm_failure) {
1795− /* Tell the AFU drivers; but we don't care what they
1796− * say, we're going away.
1797− */
17981795 for (i = 0; i < adapter->slices; i++) {
17991796 afu = adapter->afu[i];
1800− /* Only participate in EEH if we are on a virtual PHB */
1801− if (afu->phb == NULL)
1802− return PCI_ERS_RESULT_NONE;
1803− cxl_vphb_error_detected(afu, state);
1797+ /*
1798+ * Tell the AFU drivers; but we don't care what they
1799+ * say, we're going away.
1800+ */
1801+ if (afu->phb != NULL)
1802+ cxl_vphb_error_detected(afu, state);
18041803 }
18051804 return PCI_ERS_RESULT_DISCONNECT;
18061805 }
drivers/misc/mei/bus-fixup.c+2−12
@@ -112,11 +112,9 @@ struct mkhi_msg { · 111 unmodified lines
112112
113113 static int mei_osver(struct mei_cl_device *cldev)
114114 {
115− int ret;
116115 const size_t size = sizeof(struct mkhi_msg_hdr) +
117116 sizeof(struct mkhi_fwcaps) +
118117 sizeof(struct mei_os_ver);
119− size_t length = 8;
120118 char buf[size];
121119 struct mkhi_msg *req;
122120 struct mkhi_fwcaps *fwcaps;
@@ -137,15 +135,7 @@ static int mei_osver(struct mei_cl_device *cldev) · 14 unmodified lines
137135 os_ver = (struct mei_os_ver *)fwcaps->data;
138136 os_ver->os_type = OSTYPE_LINUX;
139137
140− ret = __mei_cl_send(cldev->cl, buf, size, mode);
141− if (ret < 0)
142− return ret;
143−
144− ret = __mei_cl_recv(cldev->cl, buf, length, 0);
145− if (ret < 0)
146− return ret;
147−
148− return 0;
138+ return __mei_cl_send(cldev->cl, buf, size, mode);
149139 }
150140
151141 static void mei_mkhi_fix(struct mei_cl_device *cldev)
@@ -160,7 +150,7 @@ static void mei_mkhi_fix(struct mei_cl_device *cldev) · 8 unmodified lines
160150 return;
161151
162152 ret = mei_osver(cldev);
163− if (ret)
153+ if (ret < 0)
164154 dev_err(&cldev->dev, "OS version command failed %d\n", ret);
165155
166156 mei_cldev_disable(cldev);
drivers/misc/mei/init.c+6−2
@@ -124,8 +124,6 @@ int mei_reset(struct mei_device *dev) · 123 unmodified lines
124124
125125 mei_clear_interrupts(dev);
126126
127− mei_synchronize_irq(dev);
128−
129127 /* we're already in reset, cancel the init timer
130128 * if the reset was called due the hbm protocol error
131129 * we need to call it before hw start
@@ -304,6 +302,9 @@ static void mei_reset_work(struct work_struct *work) · 172 unmodified lines
304302 container_of(work, struct mei_device, reset_work);
305303 int ret;
306304
305+ mei_clear_interrupts(dev);
306+ mei_synchronize_irq(dev);
307+
307308 mutex_lock(&dev->device_lock);
308309
309310 ret = mei_reset(dev);
@@ -328,6 +329,9 @@ void mei_stop(struct mei_device *dev) · 18 unmodified lines
328329
329330 mei_cancel_work(dev);
330331
332+ mei_clear_interrupts(dev);
333+ mei_synchronize_irq(dev);
334+
331335 mutex_lock(&dev->device_lock);
332336
333337 dev->dev_state = MEI_DEV_POWER_DOWN;
drivers/misc/vmw_vmci/vmci_guest.c+2−2
@@ -566,10 +566,10 @@ static int vmci_guest_probe_device(struct pci_dev *pdev, · 565 unmodified lines
566566 */
567567 error = pci_alloc_irq_vectors(pdev, VMCI_MAX_INTRS, VMCI_MAX_INTRS,
568568 PCI_IRQ_MSIX);
569− if (error) {
569+ if (error < 0) {
570570 error = pci_alloc_irq_vectors(pdev, 1, 1,
571571 PCI_IRQ_MSIX | PCI_IRQ_MSI | PCI_IRQ_LEGACY);
572− if (error)
572+ if (error < 0)
573573 goto err_remove_bitmap;
574574 } else {
575575 vmci_dev->exclusive_vectors = true;
drivers/mmc/core/block.c+3−4
@@ -1560,11 +1560,8 @@ static bool mmc_blk_rw_cmd_err(struct mmc_blk_data *md, struct mmc_card *card, · 1559 unmodified lines
15601560 struct mmc_blk_request *brq, struct request *req,
15611561 bool old_req_pending)
15621562 {
1563− struct mmc_queue_req *mq_rq;
15641563 bool req_pending;
15651564
1566− mq_rq = container_of(brq, struct mmc_queue_req, brq);
1567−
15681565 /*
15691566 * If this is an SD card and we're writing, we can first
15701567 * mark the known good sectors as ok.
@@ -1701,7 +1698,8 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *new_req) · 130 unmodified lines
17011698 case MMC_BLK_CMD_ERR:
17021699 req_pending = mmc_blk_rw_cmd_err(md, card, brq, old_req, req_pending);
17031700 if (mmc_blk_reset(md, card->host, type)) {
1704− mmc_blk_rw_cmd_abort(card, old_req);
1701+ if (req_pending)
1702+ mmc_blk_rw_cmd_abort(card, old_req);
17051703 mmc_blk_rw_try_restart(mq, new_req);
17061704 return;
17071705 }
@@ -1817,6 +1815,7 @@ void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) · 109 unmodified lines
18171815 mmc_blk_issue_flush(mq, req);
18181816 } else {
18191817 mmc_blk_issue_rw_rq(mq, req);
1818+ card->host->context_info.is_waiting_last_req = false;
18201819 }
18211820
18221821 out:
drivers/mmc/core/mmc.c+1−1
@@ -1730,7 +1730,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, · 1729 unmodified lines
17301730 err = mmc_select_hs400(card);
17311731 if (err)
17321732 goto free_card;
1733− } else {
1733+ } else if (!mmc_card_hs400es(card)) {
17341734 /* Select the desired bus width optionally */
17351735 err = mmc_select_bus_width(card);
17361736 if (err > 0 && mmc_card_hs(card)) {
drivers/mmc/host/mtk-sd.c+2−2
@@ -580,7 +580,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz) · 579 unmodified lines
580580 }
581581 }
582582 sdr_set_field(host->base + MSDC_CFG, MSDC_CFG_CKMOD | MSDC_CFG_CKDIV,
583− (mode << 8) | (div % 0xff));
583+ (mode << 8) | div);
584584 sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_CKPDN);
585585 while (!(readl(host->base + MSDC_CFG) & MSDC_CFG_CKSTB))
586586 cpu_relax();
@@ -1559,7 +1559,7 @@ static int msdc_drv_probe(struct platform_device *pdev) · 972 unmodified lines
15591559 host->src_clk_freq = clk_get_rate(host->src_clk);
15601560 /* Set host parameters to mmc */
15611561 mmc->ops = &mt_msdc_ops;
1562− mmc->f_min = host->src_clk_freq / (4 * 255);
1562+ mmc->f_min = DIV_ROUND_UP(host->src_clk_freq, 4 * 255);
15631563
15641564 mmc->caps |= MMC_CAP_ERASE | MMC_CAP_CMD23;
15651565 /* MMC core transfer sizes tunable parameters */
drivers/mmc/host/sdhci-of-arasan.c+5−9
@@ -28,13 +28,9 @@ · 27 unmodified lines
2828 #include "sdhci-pltfm.h"
2929 #include <linux/of.h>
3030
31−#define SDHCI_ARASAN_CLK_CTRL_OFFSET 0x2c
3231 #define SDHCI_ARASAN_VENDOR_REGISTER 0x78
3332
3433 #define VENDOR_ENHANCED_STROBE BIT(0)
35−#define CLK_CTRL_TIMEOUT_SHIFT 16
36−#define CLK_CTRL_TIMEOUT_MASK (0xf << CLK_CTRL_TIMEOUT_SHIFT)
37−#define CLK_CTRL_TIMEOUT_MIN_EXP 13
3834
3935 #define PHY_CLK_TOO_SLOW_HZ 400000
4036
@@ -163,15 +159,15 @@ static int sdhci_arasan_syscon_write(struct sdhci_host *host, · 122 unmodified lines
163159
164160 static unsigned int sdhci_arasan_get_timeout_clock(struct sdhci_host *host)
165161 {
166− u32 div;
167162 unsigned long freq;
168163 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
169164
170− div = readl(host->ioaddr + SDHCI_ARASAN_CLK_CTRL_OFFSET);
171− div = (div & CLK_CTRL_TIMEOUT_MASK) >> CLK_CTRL_TIMEOUT_SHIFT;
165+ /* SDHCI timeout clock is in kHz */
166+ freq = DIV_ROUND_UP(clk_get_rate(pltfm_host->clk), 1000);
172167
173− freq = clk_get_rate(pltfm_host->clk);
174− freq /= 1 << (CLK_CTRL_TIMEOUT_MIN_EXP + div);
168+ /* or in MHz */
169+ if (host->caps & SDHCI_TIMEOUT_CLK_UNIT)
170+ freq = DIV_ROUND_UP(freq, 1000);
175171
176172 return freq;
177173 }
drivers/mmc/host/sdhci-of-at91.c+19−0
@@ -85,11 +85,30 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock) · 84 unmodified lines
8585 sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
8686 }
8787
88+/*
89+ * In this specific implementation of the SDHCI controller, the power register
90+ * needs to have a valid voltage set even when the power supply is managed by
91+ * an external regulator.
92+ */
93+static void sdhci_at91_set_power(struct sdhci_host *host, unsigned char mode,
94+ unsigned short vdd)
95+{
96+ if (!IS_ERR(host->mmc->supply.vmmc)) {
97+ struct mmc_host *mmc = host->mmc;
98+
99+ spin_unlock_irq(&host->lock);
100+ mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
101+ spin_lock_irq(&host->lock);
102+ }
103+ sdhci_set_power_noreg(host, mode, vdd);
104+}
105+
88106 static const struct sdhci_ops sdhci_at91_sama5d2_ops = {
89107 .set_clock = sdhci_at91_set_clock,
90108 .set_bus_width = sdhci_set_bus_width,
91109 .reset = sdhci_reset,
92110 .set_uhs_signaling = sdhci_set_uhs_signaling,
111+ .set_power = sdhci_at91_set_power,
93112 };
94113
95114 static const struct sdhci_pltfm_data soc_data_sama5d2 = {
drivers/mmc/host/sdhci-pci-core.c+4−0
@@ -451,6 +451,8 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode, · 450 unmodified lines
451451 if (mode == MMC_POWER_OFF)
452452 return;
453453
454+ spin_unlock_irq(&host->lock);
455+
454456 /*
455457 * Bus power might not enable after D3 -> D0 transition due to the
456458 * present state not yet having propagated. Retry for up to 2ms.
@@ -463,6 +465,8 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode, · 6 unmodified lines
463465 reg |= SDHCI_POWER_ON;
464466 sdhci_writeb(host, reg, SDHCI_POWER_CONTROL);
465467 }
468+
469+ spin_lock_irq(&host->lock);
466470 }
467471
468472 static const struct sdhci_ops sdhci_intel_byt_ops = {
drivers/mmc/host/sdhci.c+3−1
@@ -1362,7 +1362,9 @@ void sdhci_enable_clk(struct sdhci_host *host, u16 clk) · 1361 unmodified lines
13621362 return;
13631363 }
13641364 timeout--;
1365− mdelay(1);
1365+ spin_unlock_irq(&host->lock);
1366+ usleep_range(900, 1100);
1367+ spin_lock_irq(&host->lock);
13661368 }
13671369
13681370 clk |= SDHCI_CLOCK_CARD_EN;
drivers/mmc/host/ushc.c+3−0
@@ -426,6 +426,9 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id · 425 unmodified lines
426426 struct ushc_data *ushc;
427427 int ret;
428428
429+ if (intf->cur_altsetting->desc.bNumEndpoints < 1)
430+ return -ENODEV;
431+
429432 mmc = mmc_alloc_host(sizeof(struct ushc_data), &intf->dev);
430433 if (mmc == NULL)
431434 return -ENOMEM;
drivers/net/ethernet/amd/xgbe/xgbe-common.h+16−14
@@ -984,29 +984,29 @@ · 983 unmodified lines
984984 #define XP_ECC_CNT1_DESC_DED_WIDTH 8
985985 #define XP_ECC_CNT1_DESC_SEC_INDEX 0
986986 #define XP_ECC_CNT1_DESC_SEC_WIDTH 8
987−#define XP_ECC_IER_DESC_DED_INDEX 0
987+#define XP_ECC_IER_DESC_DED_INDEX 5
988988 #define XP_ECC_IER_DESC_DED_WIDTH 1
989−#define XP_ECC_IER_DESC_SEC_INDEX 1
989+#define XP_ECC_IER_DESC_SEC_INDEX 4
990990 #define XP_ECC_IER_DESC_SEC_WIDTH 1
991−#define XP_ECC_IER_RX_DED_INDEX 2
991+#define XP_ECC_IER_RX_DED_INDEX 3
992992 #define XP_ECC_IER_RX_DED_WIDTH 1
993−#define XP_ECC_IER_RX_SEC_INDEX 3
993+#define XP_ECC_IER_RX_SEC_INDEX 2
994994 #define XP_ECC_IER_RX_SEC_WIDTH 1
995−#define XP_ECC_IER_TX_DED_INDEX 4
995+#define XP_ECC_IER_TX_DED_INDEX 1
996996 #define XP_ECC_IER_TX_DED_WIDTH 1
997−#define XP_ECC_IER_TX_SEC_INDEX 5
997+#define XP_ECC_IER_TX_SEC_INDEX 0
998998 #define XP_ECC_IER_TX_SEC_WIDTH 1
999−#define XP_ECC_ISR_DESC_DED_INDEX 0
999+#define XP_ECC_ISR_DESC_DED_INDEX 5
10001000 #define XP_ECC_ISR_DESC_DED_WIDTH 1
1001−#define XP_ECC_ISR_DESC_SEC_INDEX 1
1001+#define XP_ECC_ISR_DESC_SEC_INDEX 4
10021002 #define XP_ECC_ISR_DESC_SEC_WIDTH 1
1003−#define XP_ECC_ISR_RX_DED_INDEX 2
1003+#define XP_ECC_ISR_RX_DED_INDEX 3
10041004 #define XP_ECC_ISR_RX_DED_WIDTH 1
1005−#define XP_ECC_ISR_RX_SEC_INDEX 3
1005+#define XP_ECC_ISR_RX_SEC_INDEX 2
10061006 #define XP_ECC_ISR_RX_SEC_WIDTH 1
1007−#define XP_ECC_ISR_TX_DED_INDEX 4
1007+#define XP_ECC_ISR_TX_DED_INDEX 1
10081008 #define XP_ECC_ISR_TX_DED_WIDTH 1
1009−#define XP_ECC_ISR_TX_SEC_INDEX 5
1009+#define XP_ECC_ISR_TX_SEC_INDEX 0
10101010 #define XP_ECC_ISR_TX_SEC_WIDTH 1
10111011 #define XP_I2C_MUTEX_BUSY_INDEX 31
10121012 #define XP_I2C_MUTEX_BUSY_WIDTH 1
@@ -1148,8 +1148,8 @@ · 135 unmodified lines
11481148 #define RX_PACKET_ATTRIBUTES_CSUM_DONE_WIDTH 1
11491149 #define RX_PACKET_ATTRIBUTES_VLAN_CTAG_INDEX 1
11501150 #define RX_PACKET_ATTRIBUTES_VLAN_CTAG_WIDTH 1
1151−#define RX_PACKET_ATTRIBUTES_INCOMPLETE_INDEX 2
1152−#define RX_PACKET_ATTRIBUTES_INCOMPLETE_WIDTH 1
1151+#define RX_PACKET_ATTRIBUTES_LAST_INDEX 2
1152+#define RX_PACKET_ATTRIBUTES_LAST_WIDTH 1
11531153 #define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_INDEX 3
11541154 #define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_WIDTH 1
11551155 #define RX_PACKET_ATTRIBUTES_CONTEXT_INDEX 4
@@ -1158,6 +1158,8 @@ · 2 unmodified lines
11581158 #define RX_PACKET_ATTRIBUTES_RX_TSTAMP_WIDTH 1
11591159 #define RX_PACKET_ATTRIBUTES_RSS_HASH_INDEX 6
11601160 #define RX_PACKET_ATTRIBUTES_RSS_HASH_WIDTH 1
1161+#define RX_PACKET_ATTRIBUTES_FIRST_INDEX 7
1162+#define RX_PACKET_ATTRIBUTES_FIRST_WIDTH 1
11611163
11621164 #define RX_NORMAL_DESC0_OVT_INDEX 0
11631165 #define RX_NORMAL_DESC0_OVT_WIDTH 16
drivers/net/ethernet/amd/xgbe/xgbe-dev.c+11−9
@@ -1896,10 +1896,15 @@ static int xgbe_dev_read(struct xgbe_channel *channel) · 1895 unmodified lines
18961896
18971897 /* Get the header length */
18981898 if (XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, FD)) {
1899+ XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
1900+ FIRST, 1);
18991901 rdata->rx.hdr_len = XGMAC_GET_BITS_LE(rdesc->desc2,
19001902 RX_NORMAL_DESC2, HL);
19011903 if (rdata->rx.hdr_len)
19021904 pdata->ext_stats.rx_split_header_packets++;
1905+ } else {
1906+ XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
1907+ FIRST, 0);
19031908 }
19041909
19051910 /* Get the RSS hash */
@@ -1922,19 +1927,16 @@ static int xgbe_dev_read(struct xgbe_channel *channel) · 16 unmodified lines
19221927 }
19231928 }
19241929
1925− /* Get the packet length */
1926− rdata->rx.len = XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, PL);
1927−
1928− if (!XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, LD)) {
1929− /* Not all the data has been transferred for this packet */
1930− XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
1931− INCOMPLETE, 1);
1930+ /* Not all the data has been transferred for this packet */
1931+ if (!XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, LD))
19321932 return 0;
1933− }
19341933
19351934 /* This is the last of the data for this packet */
19361935 XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
1937− INCOMPLETE, 0);
1936+ LAST, 1);
1937+
1938+ /* Get the packet length */
1939+ rdata->rx.len = XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, PL);
19381940
19391941 /* Set checksum done indicator as appropriate */
19401942 if (netdev->features & NETIF_F_RXCSUM)
drivers/net/ethernet/amd/xgbe/xgbe-drv.c+63−39
@@ -1971,13 +1971,12 @@ static struct sk_buff *xgbe_create_skb(struct xgbe_prv_data *pdata, · 1970 unmodified lines
19711971 {
19721972 struct sk_buff *skb;
19731973 u8 *packet;
1974− unsigned int copy_len;
19751974
19761975 skb = napi_alloc_skb(napi, rdata->rx.hdr.dma_len);
19771976 if (!skb)
19781977 return NULL;
19791978
1980− /* Start with the header buffer which may contain just the header
1979+ /* Pull in the header buffer which may contain just the header
19811980 * or the header plus data
19821981 */
19831982 dma_sync_single_range_for_cpu(pdata->dev, rdata->rx.hdr.dma_base,
@@ -1986,30 +1985,49 @@ static struct sk_buff *xgbe_create_skb(struct xgbe_prv_data *pdata, · 2 unmodified lines
19861985
19871986 packet = page_address(rdata->rx.hdr.pa.pages) +
19881987 rdata->rx.hdr.pa.pages_offset;
1989− copy_len = (rdata->rx.hdr_len) ? rdata->rx.hdr_len : len;
1990− copy_len = min(rdata->rx.hdr.dma_len, copy_len);
1991− skb_copy_to_linear_data(skb, packet, copy_len);
1992− skb_put(skb, copy_len);
1993−
1994− len -= copy_len;
1995− if (len) {
1996− /* Add the remaining data as a frag */
1997− dma_sync_single_range_for_cpu(pdata->dev,
1998− rdata->rx.buf.dma_base,
1999− rdata->rx.buf.dma_off,
2000− rdata->rx.buf.dma_len,
2001− DMA_FROM_DEVICE);
2002−
2003− skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
2004− rdata->rx.buf.pa.pages,
2005− rdata->rx.buf.pa.pages_offset,
2006− len, rdata->rx.buf.dma_len);
2007− rdata->rx.buf.pa.pages = NULL;
2008− }
1988+ skb_copy_to_linear_data(skb, packet, len);
1989+ skb_put(skb, len);
20091990
20101991 return skb;
20111992 }
20121993
1994+static unsigned int xgbe_rx_buf1_len(struct xgbe_ring_data *rdata,
1995+ struct xgbe_packet_data *packet)
1996+{
1997+ /* Always zero if not the first descriptor */
1998+ if (!XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, FIRST))
1999+ return 0;
2000+
2001+ /* First descriptor with split header, return header length */
2002+ if (rdata->rx.hdr_len)
2003+ return rdata->rx.hdr_len;
2004+
2005+ /* First descriptor but not the last descriptor and no split header,
2006+ * so the full buffer was used
2007+ */
2008+ if (!XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, LAST))
2009+ return rdata->rx.hdr.dma_len;
2010+
2011+ /* First descriptor and last descriptor and no split header, so
2012+ * calculate how much of the buffer was used
2013+ */
2014+ return min_t(unsigned int, rdata->rx.hdr.dma_len, rdata->rx.len);
2015+}
2016+
2017+static unsigned int xgbe_rx_buf2_len(struct xgbe_ring_data *rdata,
2018+ struct xgbe_packet_data *packet,
2019+ unsigned int len)
2020+{
2021+ /* Always the full buffer if not the last descriptor */
2022+ if (!XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, LAST))
2023+ return rdata->rx.buf.dma_len;
2024+
2025+ /* Last descriptor so calculate how much of the buffer was used
2026+ * for the last bit of data
2027+ */
2028+ return rdata->rx.len - len;
2029+}
2030+
20132031 static int xgbe_tx_poll(struct xgbe_channel *channel)
20142032 {
20152033 struct xgbe_prv_data *pdata = channel->pdata;
@@ -2092,8 +2110,8 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget) · 76 unmodified lines
20922110 struct napi_struct *napi;
20932111 struct sk_buff *skb;
20942112 struct skb_shared_hwtstamps *hwtstamps;
2095− unsigned int incomplete, error, context_next, context;
2096− unsigned int len, rdesc_len, max_len;
2113+ unsigned int last, error, context_next, context;
2114+ unsigned int len, buf1_len, buf2_len, max_len;
20972115 unsigned int received = 0;
20982116 int packet_count = 0;
20992117
@@ -2103,7 +2121,7 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget) · 3 unmodified lines
21032121 if (!ring)
21042122 return 0;
21052123
2106− incomplete = 0;
2124+ last = 0;
21072125 context_next = 0;
21082126
21092127 napi = (pdata->per_channel_irq) ? &channel->napi : &pdata->napi;
@@ -2137,9 +2155,8 @@ read_again: · 27 unmodified lines
21372155 received++;
21382156 ring->cur++;
21392157
2140− incomplete = XGMAC_GET_BITS(packet->attributes,
2141− RX_PACKET_ATTRIBUTES,
2142− INCOMPLETE);
2158+ last = XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
2159+ LAST);
21432160 context_next = XGMAC_GET_BITS(packet->attributes,
21442161 RX_PACKET_ATTRIBUTES,
21452162 CONTEXT_NEXT);
@@ -2148,7 +2165,7 @@ read_again: · 2 unmodified lines
21482165 CONTEXT);
21492166
21502167 /* Earlier error, just drain the remaining data */
2151− if ((incomplete || context_next) && error)
2168+ if ((!last || context_next) && error)
21522169 goto read_again;
21532170
21542171 if (error || packet->errors) {
@@ -2160,16 +2177,22 @@ read_again: · 5 unmodified lines
21602177 }
21612178
21622179 if (!context) {
2163− /* Length is cumulative, get this descriptor's length */
2164− rdesc_len = rdata->rx.len - len;
2165− len += rdesc_len;
2180+ /* Get the data length in the descriptor buffers */
2181+ buf1_len = xgbe_rx_buf1_len(rdata, packet);
2182+ len += buf1_len;
2183+ buf2_len = xgbe_rx_buf2_len(rdata, packet, len);
2184+ len += buf2_len;
21662185
2167− if (rdesc_len && !skb) {
2186+ if (!skb) {
21682187 skb = xgbe_create_skb(pdata, napi, rdata,
2169− rdesc_len);
2170− if (!skb)
2188+ buf1_len);
2189+ if (!skb) {
21712190 error = 1;
2172− } else if (rdesc_len) {
2191+ goto skip_data;
2192+ }
2193+ }
2194+
2195+ if (buf2_len) {
21732196 dma_sync_single_range_for_cpu(pdata->dev,
21742197 rdata->rx.buf.dma_base,
21752198 rdata->rx.buf.dma_off,
@@ -2179,13 +2202,14 @@ read_again: · 3 unmodified lines
21792202 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
21802203 rdata->rx.buf.pa.pages,
21812204 rdata->rx.buf.pa.pages_offset,
2182− rdesc_len,
2205+ buf2_len,
21832206 rdata->rx.buf.dma_len);
21842207 rdata->rx.buf.pa.pages = NULL;
21852208 }
21862209 }
21872210
2188− if (incomplete || context_next)
2211+skip_data:
2212+ if (!last || context_next)
21892213 goto read_again;
21902214
21912215 if (!skb)
@@ -2243,7 +2267,7 @@ next_packet: · 51 unmodified lines
22432267 }
22442268
22452269 /* Check if we need to save state before leaving */
2246− if (received && (incomplete || context_next)) {
2270+ if (received && (!last || context_next)) {
22472271 rdata = XGBE_GET_DESC_DATA(ring, ring->cur);
22482272 rdata->state_saved = 1;
22492273 rdata->state.skb = skb;
drivers/net/ethernet/aquantia/atlantic/aq_main.c+1−0
@@ -98,6 +98,7 @@ static int aq_ndev_change_mtu(struct net_device *ndev, int new_mtu) · 97 unmodified lines
9898
9999 if (err < 0)
100100 goto err_exit;
101+ ndev->mtu = new_mtu;
101102
102103 if (netif_running(ndev)) {
103104 aq_ndev_close(ndev);
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0_internal.h+1−0
@@ -137,6 +137,7 @@ static struct aq_hw_caps_s hw_atl_a0_hw_caps_ = { · 136 unmodified lines
137137 .tx_rings = HW_ATL_A0_TX_RINGS,
138138 .rx_rings = HW_ATL_A0_RX_RINGS,
139139 .hw_features = NETIF_F_HW_CSUM |
140+ NETIF_F_RXCSUM |
140141 NETIF_F_RXHASH |
141142 NETIF_F_SG |
142143 NETIF_F_TSO,
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0_internal.h+1−0
@@ -188,6 +188,7 @@ static struct aq_hw_caps_s hw_atl_b0_hw_caps_ = { · 187 unmodified lines
188188 .tx_rings = HW_ATL_B0_TX_RINGS,
189189 .rx_rings = HW_ATL_B0_RX_RINGS,
190190 .hw_features = NETIF_F_HW_CSUM |
191+ NETIF_F_RXCSUM |
191192 NETIF_F_RXHASH |
192193 NETIF_F_SG |
193194 NETIF_F_TSO |
drivers/net/ethernet/broadcom/genet/bcmgenet.c+4−2
@@ -3481,7 +3481,8 @@ static int bcmgenet_suspend(struct device *d) · 3480 unmodified lines
34813481
34823482 bcmgenet_netif_stop(dev);
34833483
3484− phy_suspend(priv->phydev);
3484+ if (!device_may_wakeup(d))
3485+ phy_suspend(priv->phydev);
34853486
34863487 netif_device_detach(dev);
34873488
@@ -3578,7 +3579,8 @@ static int bcmgenet_resume(struct device *d) · 90 unmodified lines
35783579
35793580 netif_device_attach(dev);
35803581
3581− phy_resume(priv->phydev);
3582+ if (!device_may_wakeup(d))
3583+ phy_resume(priv->phydev);
35823584
35833585 if (priv->eee.eee_enabled)
35843586 bcmgenet_eee_enable_set(dev, true);
drivers/net/ethernet/broadcom/genet/bcmmii.c+0−15
@@ -220,20 +220,6 @@ void bcmgenet_phy_power_set(struct net_device *dev, bool enable) · 219 unmodified lines
220220 udelay(60);
221221 }
222222
223−static void bcmgenet_internal_phy_setup(struct net_device *dev)
224−{
225− struct bcmgenet_priv *priv = netdev_priv(dev);
226− u32 reg;
227−
228− /* Power up PHY */
229− bcmgenet_phy_power_set(dev, true);
230− /* enable APD */
231− reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT);
232− reg |= EXT_PWR_DN_EN_LD;
233− bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
234− bcmgenet_mii_reset(dev);
235−}
236−
237223 static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv)
238224 {
239225 u32 reg;
@@ -281,7 +267,6 @@ int bcmgenet_mii_config(struct net_device *dev) · 41 unmodified lines
281267
282268 if (priv->internal_phy) {
283269 phy_name = "internal PHY";
284− bcmgenet_internal_phy_setup(dev);
285270 } else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
286271 phy_name = "MoCA";
287272 bcmgenet_moca_phy_setup(priv);
drivers/net/ethernet/brocade/bna/bnad_debugfs.c+1−1
@@ -325,7 +325,7 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf, · 324 unmodified lines
325325 return PTR_ERR(kern_buf);
326326
327327 rc = sscanf(kern_buf, "%x:%x", &addr, &len);
328− if (rc < 2) {
328+ if (rc < 2 || len > UINT_MAX >> 2) {
329329 netdev_warn(bnad->netdev, "failed to read user buffer\n");
330330 kfree(kern_buf);
331331 return -EINVAL;
drivers/net/ethernet/ibm/ibmvnic.c+2−0
@@ -1257,6 +1257,7 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter) · 1256 unmodified lines
12571257 release_sub_crq_queue(adapter,
12581258 adapter->tx_scrq[i]);
12591259 }
1260+ kfree(adapter->tx_scrq);
12601261 adapter->tx_scrq = NULL;
12611262 }
12621263
@@ -1269,6 +1270,7 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter) · 6 unmodified lines
12691270 release_sub_crq_queue(adapter,
12701271 adapter->rx_scrq[i]);
12711272 }
1273+ kfree(adapter->rx_scrq);
12721274 adapter->rx_scrq = NULL;
12731275 }
12741276 }
drivers/net/ethernet/mellanox/mlx4/cmd.c+11−0
@@ -2305,6 +2305,17 @@ static int sync_toggles(struct mlx4_dev *dev) · 2304 unmodified lines
23052305 rd_toggle = swab32(readl(&priv->mfunc.comm->slave_read));
23062306 if (wr_toggle == 0xffffffff || rd_toggle == 0xffffffff) {
23072307 /* PCI might be offline */
2308+
2309+ /* If device removal has been requested,
2310+ * do not continue retrying.
2311+ */
2312+ if (dev->persist->interface_state &
2313+ MLX4_INTERFACE_STATE_NOWAIT) {
2314+ mlx4_warn(dev,
2315+ "communication channel is offline\n");
2316+ return -EIO;
2317+ }
2318+
23082319 msleep(100);
23092320 wr_toggle = swab32(readl(&priv->mfunc.comm->
23102321 slave_write));
drivers/net/ethernet/mellanox/mlx4/main.c+11−0
@@ -1940,6 +1940,14 @@ static int mlx4_comm_check_offline(struct mlx4_dev *dev) · 1939 unmodified lines
19401940 (u32)(1 << COMM_CHAN_OFFLINE_OFFSET));
19411941 if (!offline_bit)
19421942 return 0;
1943+
1944+ /* If device removal has been requested,
1945+ * do not continue retrying.
1946+ */
1947+ if (dev->persist->interface_state &
1948+ MLX4_INTERFACE_STATE_NOWAIT)
1949+ break;
1950+
19431951 /* There are cases as part of AER/Reset flow that PF needs
19441952 * around 100 msec to load. We therefore sleep for 100 msec
19451953 * to allow other tasks to make use of that CPU during this
@@ -3955,6 +3963,9 @@ static void mlx4_remove_one(struct pci_dev *pdev) · 2009 unmodified lines
39553963 struct devlink *devlink = priv_to_devlink(priv);
39563964 int active_vfs = 0;
39573965
3966+ if (mlx4_is_slave(dev))
3967+ persist->interface_state |= MLX4_INTERFACE_STATE_NOWAIT;
3968+
39583969 mutex_lock(&persist->interface_state_mutex);
39593970 persist->interface_state |= MLX4_INTERFACE_STATE_DELETION;
39603971 mutex_unlock(&persist->interface_state_mutex);
drivers/net/ethernet/mellanox/mlx5/core/cmd.c+4−0
@@ -361,6 +361,8 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op, · 360 unmodified lines
361361 case MLX5_CMD_OP_QUERY_VPORT_COUNTER:
362362 case MLX5_CMD_OP_ALLOC_Q_COUNTER:
363363 case MLX5_CMD_OP_QUERY_Q_COUNTER:
364+ case MLX5_CMD_OP_SET_RATE_LIMIT:
365+ case MLX5_CMD_OP_QUERY_RATE_LIMIT:
364366 case MLX5_CMD_OP_ALLOC_PD:
365367 case MLX5_CMD_OP_ALLOC_UAR:
366368 case MLX5_CMD_OP_CONFIG_INT_MODERATION:
@@ -497,6 +499,8 @@ const char *mlx5_command_str(int command) · 130 unmodified lines
497499 MLX5_COMMAND_STR_CASE(ALLOC_Q_COUNTER);
498500 MLX5_COMMAND_STR_CASE(DEALLOC_Q_COUNTER);
499501 MLX5_COMMAND_STR_CASE(QUERY_Q_COUNTER);
502+ MLX5_COMMAND_STR_CASE(SET_RATE_LIMIT);
503+ MLX5_COMMAND_STR_CASE(QUERY_RATE_LIMIT);
500504 MLX5_COMMAND_STR_CASE(ALLOC_PD);
501505 MLX5_COMMAND_STR_CASE(DEALLOC_PD);
502506 MLX5_COMMAND_STR_CASE(ALLOC_UAR);
drivers/net/ethernet/mellanox/mlx5/core/en.h+0−4
@@ -928,10 +928,6 @@ void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, struct mlx5e_priv *priv); · 927 unmodified lines
928928 int mlx5e_attach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev);
929929 void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev);
930930 u32 mlx5e_choose_lro_timeout(struct mlx5_core_dev *mdev, u32 wanted_timeout);
931−void mlx5e_add_vxlan_port(struct net_device *netdev,
932− struct udp_tunnel_info *ti);
933−void mlx5e_del_vxlan_port(struct net_device *netdev,
934− struct udp_tunnel_info *ti);
935931
936932 int mlx5e_get_offload_stats(int attr_id, const struct net_device *dev,
937933 void *sp);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+4−4
@@ -3100,8 +3100,8 @@ static int mlx5e_get_vf_stats(struct net_device *dev, · 3099 unmodified lines
31003100 vf_stats);
31013101 }
31023102
3103−void mlx5e_add_vxlan_port(struct net_device *netdev,
3104− struct udp_tunnel_info *ti)
3103+static void mlx5e_add_vxlan_port(struct net_device *netdev,
3104+ struct udp_tunnel_info *ti)
31053105 {
31063106 struct mlx5e_priv *priv = netdev_priv(netdev);
31073107
@@ -3114,8 +3114,8 @@ void mlx5e_add_vxlan_port(struct net_device *netdev, · 6 unmodified lines
31143114 mlx5e_vxlan_queue_work(priv, ti->sa_family, be16_to_cpu(ti->port), 1);
31153115 }
31163116
3117−void mlx5e_del_vxlan_port(struct net_device *netdev,
3118− struct udp_tunnel_info *ti)
3117+static void mlx5e_del_vxlan_port(struct net_device *netdev,
3118+ struct udp_tunnel_info *ti)
31193119 {
31203120 struct mlx5e_priv *priv = netdev_priv(netdev);
31213121
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c+0−2
@@ -393,8 +393,6 @@ static const struct net_device_ops mlx5e_netdev_ops_rep = { · 392 unmodified lines
393393 .ndo_get_phys_port_name = mlx5e_rep_get_phys_port_name,
394394 .ndo_setup_tc = mlx5e_rep_ndo_setup_tc,
395395 .ndo_get_stats64 = mlx5e_rep_get_stats,
396− .ndo_udp_tunnel_add = mlx5e_add_vxlan_port,
397− .ndo_udp_tunnel_del = mlx5e_del_vxlan_port,
398396 .ndo_has_offload_stats = mlx5e_has_offload_stats,
399397 .ndo_get_offload_stats = mlx5e_get_offload_stats,
400398 };
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c+4−0
@@ -601,6 +601,10 @@ static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe, · 600 unmodified lines
601601 if (lro_num_seg > 1) {
602602 mlx5e_lro_update_hdr(skb, cqe, cqe_bcnt);
603603 skb_shinfo(skb)->gso_size = DIV_ROUND_UP(cqe_bcnt, lro_num_seg);
604+ /* Subtract one since we already counted this as one
605+ * "regular" packet in mlx5e_complete_rx_cqe()
606+ */
607+ rq->stats.packets += lro_num_seg - 1;
604608 rq->stats.lro_packets++;
605609 rq->stats.lro_bytes += cqe_bcnt;
606610 }
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+50−24
@@ -133,6 +133,23 @@ err_create_ft: · 132 unmodified lines
133133 return rule;
134134 }
135135
136+static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv,
137+ struct mlx5e_tc_flow *flow)
138+{
139+ struct mlx5_fc *counter = NULL;
140+
141+ if (!IS_ERR(flow->rule)) {
142+ counter = mlx5_flow_rule_counter(flow->rule);
143+ mlx5_del_flow_rules(flow->rule);
144+ mlx5_fc_destroy(priv->mdev, counter);
145+ }
146+
147+ if (!mlx5e_tc_num_filters(priv) && (priv->fs.tc.t)) {
148+ mlx5_destroy_flow_table(priv->fs.tc.t);
149+ priv->fs.tc.t = NULL;
150+ }
151+}
152+
136153 static struct mlx5_flow_handle *
137154 mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
138155 struct mlx5_flow_spec *spec,
@@ -149,7 +166,24 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, · 10 unmodified lines
149166 }
150167
151168 static void mlx5e_detach_encap(struct mlx5e_priv *priv,
152− struct mlx5e_tc_flow *flow) {
169+ struct mlx5e_tc_flow *flow);
170+
171+static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
172+ struct mlx5e_tc_flow *flow)
173+{
174+ struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
175+
176+ mlx5_eswitch_del_offloaded_rule(esw, flow->rule, flow->attr);
177+
178+ mlx5_eswitch_del_vlan_action(esw, flow->attr);
179+
180+ if (flow->attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP)
181+ mlx5e_detach_encap(priv, flow);
182+}
183+
184+static void mlx5e_detach_encap(struct mlx5e_priv *priv,
185+ struct mlx5e_tc_flow *flow)
186+{
153187 struct list_head *next = flow->encap.next;
154188
155189 list_del(&flow->encap);
@@ -173,25 +207,10 @@ static void mlx5e_detach_encap(struct mlx5e_priv *priv, · 17 unmodified lines
173207 static void mlx5e_tc_del_flow(struct mlx5e_priv *priv,
174208 struct mlx5e_tc_flow *flow)
175209 {
176− struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
177− struct mlx5_fc *counter = NULL;
178−
179− if (!IS_ERR(flow->rule)) {
180− counter = mlx5_flow_rule_counter(flow->rule);
181− mlx5_del_flow_rules(flow->rule);
182− mlx5_fc_destroy(priv->mdev, counter);
183− }
184−
185− if (flow->flags & MLX5E_TC_FLOW_ESWITCH) {
186− mlx5_eswitch_del_vlan_action(esw, flow->attr);
187− if (flow->attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP)
188− mlx5e_detach_encap(priv, flow);
189− }
190−
191− if (!mlx5e_tc_num_filters(priv) && (priv->fs.tc.t)) {
192− mlx5_destroy_flow_table(priv->fs.tc.t);
193− priv->fs.tc.t = NULL;
194− }
210+ if (flow->flags & MLX5E_TC_FLOW_ESWITCH)
211+ mlx5e_tc_del_fdb_flow(priv, flow);
212+ else
213+ mlx5e_tc_del_nic_flow(priv, flow);
195214 }
196215
197216 static void parse_vxlan_attr(struct mlx5_flow_spec *spec,
@@ -248,12 +267,15 @@ static int parse_tunnel_attr(struct mlx5e_priv *priv, · 50 unmodified lines
248267 skb_flow_dissector_target(f->dissector,
249268 FLOW_DISSECTOR_KEY_ENC_PORTS,
250269 f->mask);
270+ struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
271+ struct net_device *up_dev = mlx5_eswitch_get_uplink_netdev(esw);
272+ struct mlx5e_priv *up_priv = netdev_priv(up_dev);
251273
252274 /* Full udp dst port must be given */
253275 if (memchr_inv(&mask->dst, 0xff, sizeof(mask->dst)))
254276 goto vxlan_match_offload_err;
255277
256− if (mlx5e_vxlan_lookup_port(priv, be16_to_cpu(key->dst)) &&
278+ if (mlx5e_vxlan_lookup_port(up_priv, be16_to_cpu(key->dst)) &&
257279 MLX5_CAP_ESW(priv->mdev, vxlan_encap_decap))
258280 parse_vxlan_attr(spec, f);
259281 else {
@@ -976,6 +998,8 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv, · 716 unmodified lines
976998 struct mlx5_esw_flow_attr *attr)
977999 {
9781000 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
1001+ struct net_device *up_dev = mlx5_eswitch_get_uplink_netdev(esw);
1002+ struct mlx5e_priv *up_priv = netdev_priv(up_dev);
9791003 unsigned short family = ip_tunnel_info_af(tun_info);
9801004 struct ip_tunnel_key *key = &tun_info->key;
9811005 struct mlx5_encap_entry *e;
@@ -996,7 +1020,7 @@ vxlan_encap_offload_err: · 14 unmodified lines
9961020 return -EOPNOTSUPP;
9971021 }
9981022
999− if (mlx5e_vxlan_lookup_port(priv, be16_to_cpu(key->tp_dst)) &&
1023+ if (mlx5e_vxlan_lookup_port(up_priv, be16_to_cpu(key->tp_dst)) &&
10001024 MLX5_CAP_ESW(priv->mdev, vxlan_encap_decap)) {
10011025 tunnel_type = MLX5_HEADER_TYPE_VXLAN;
10021026 } else {
@@ -1112,14 +1136,16 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, · 109 unmodified lines
11121136 }
11131137
11141138 if (is_tcf_vlan(a)) {
1115− if (tcf_vlan_action(a) == VLAN_F_POP) {
1139+ if (tcf_vlan_action(a) == TCA_VLAN_ACT_POP) {
11161140 attr->action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_POP;
1117− } else if (tcf_vlan_action(a) == VLAN_F_PUSH) {
1141+ } else if (tcf_vlan_action(a) == TCA_VLAN_ACT_PUSH) {
11181142 if (tcf_vlan_push_proto(a) != htons(ETH_P_8021Q))
11191143 return -EOPNOTSUPP;
11201144
11211145 attr->action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH;
11221146 attr->vlan = tcf_vlan_push_vid(a);
1147+ } else { /* action is TCA_VLAN_ACT_MODIFY */
1148+ return -EOPNOTSUPP;
11231149 }
11241150 continue;
11251151 }
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c+3−2
@@ -274,15 +274,18 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) · 273 unmodified lines
274274 sq->stats.tso_bytes += skb->len - ihs;
275275 }
276276
277+ sq->stats.packets += skb_shinfo(skb)->gso_segs;
277278 num_bytes = skb->len + (skb_shinfo(skb)->gso_segs - 1) * ihs;
278279 } else {
279280 bf = sq->bf_budget &&
280281 !skb->xmit_more &&
281282 !skb_shinfo(skb)->nr_frags;
282283 ihs = mlx5e_get_inline_hdr_size(sq, skb, bf);
284+ sq->stats.packets++;
283285 num_bytes = max_t(unsigned int, skb->len, ETH_ZLEN);
284286 }
285287
288+ sq->stats.bytes += num_bytes;
286289 wi->num_bytes = num_bytes;
287290
288291 ds_cnt = sizeof(*wqe) / MLX5_SEND_WQE_DS;
@@ -381,8 +384,6 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) · 92 unmodified lines
381384 if (bf)
382385 sq->bf_budget--;
383386
384− sq->stats.packets++;
385− sq->stats.bytes += num_bytes;
386387 return NETDEV_TX_OK;
387388
388389 dma_unmap_wqe_err:
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h+6−0
@@ -209,6 +209,7 @@ struct mlx5_esw_offload { · 208 unmodified lines
209209 struct mlx5_eswitch_rep *vport_reps;
210210 DECLARE_HASHTABLE(encap_tbl, 8);
211211 u8 inline_mode;
212+ u64 num_flows;
212213 };
213214
214215 struct mlx5_eswitch {
@@ -271,6 +272,11 @@ struct mlx5_flow_handle * · 56 unmodified lines
271272 mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
272273 struct mlx5_flow_spec *spec,
273274 struct mlx5_esw_flow_attr *attr);
275+void
276+mlx5_eswitch_del_offloaded_rule(struct mlx5_eswitch *esw,
277+ struct mlx5_flow_handle *rule,
278+ struct mlx5_esw_flow_attr *attr);
279+
274280 struct mlx5_flow_handle *
275281 mlx5_eswitch_create_vport_rx_rule(struct mlx5_eswitch *esw, int vport, u32 tirn);
276282
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c+22−0
@@ -93,10 +93,27 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw, · 92 unmodified lines
9393 spec, &flow_act, dest, i);
9494 if (IS_ERR(rule))
9595 mlx5_fc_destroy(esw->dev, counter);
96+ else
97+ esw->offloads.num_flows++;
9698
9799 return rule;
98100 }
99101
102+void
103+mlx5_eswitch_del_offloaded_rule(struct mlx5_eswitch *esw,
104+ struct mlx5_flow_handle *rule,
105+ struct mlx5_esw_flow_attr *attr)
106+{
107+ struct mlx5_fc *counter = NULL;
108+
109+ if (!IS_ERR(rule)) {
110+ counter = mlx5_flow_rule_counter(rule);
111+ mlx5_del_flow_rules(rule);
112+ mlx5_fc_destroy(esw->dev, counter);
113+ esw->offloads.num_flows--;
114+ }
115+}
116+
100117 static int esw_set_global_vlan_pop(struct mlx5_eswitch *esw, u8 val)
101118 {
102119 struct mlx5_eswitch_rep *rep;
@@ -908,6 +925,11 @@ int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode) · 805 unmodified lines
908925 MLX5_CAP_INLINE_MODE_VPORT_CONTEXT)
909926 return -EOPNOTSUPP;
910927
928+ if (esw->offloads.num_flows > 0) {
929+ esw_warn(dev, "Can't set inline mode when flows are configured\n");
930+ return -EOPNOTSUPP;
931+ }
932+
911933 err = esw_inline_mode_from_devlink(mode, &mlx5_mode);
912934 if (err)
913935 goto out;
drivers/net/ethernet/mellanox/mlx5/core/main.c+1−1
@@ -87,7 +87,7 @@ static struct mlx5_profile profile[] = { · 86 unmodified lines
8787 [2] = {
8888 .mask = MLX5_PROF_MASK_QP_SIZE |
8989 MLX5_PROF_MASK_MR_CACHE,
90− .log_max_qp = 17,
90+ .log_max_qp = 18,
9191 .mr_cache[0] = {
9292 .size = 500,
9393 .limit = 250
drivers/net/ethernet/sfc/efx.c+1−1
@@ -2404,7 +2404,7 @@ static void efx_udp_tunnel_del(struct net_device *dev, struct udp_tunnel_info *t · 2403 unmodified lines
24042404 tnl.type = (u16)efx_tunnel_type;
24052405 tnl.port = ti->port;
24062406
2407− if (efx->type->udp_tnl_add_port)
2407+ if (efx->type->udp_tnl_del_port)
24082408 (void)efx->type->udp_tnl_del_port(efx, tnl);
24092409 }
24102410
drivers/net/ethernet/ti/Kconfig+8−2
@@ -74,15 +74,21 @@ config TI_CPSW · 73 unmodified lines
7474 will be called cpsw.
7575
7676 config TI_CPTS
77− tristate "TI Common Platform Time Sync (CPTS) Support"
77+ bool "TI Common Platform Time Sync (CPTS) Support"
7878 depends on TI_CPSW || TI_KEYSTONE_NETCP
79− imply PTP_1588_CLOCK
79+ depends on PTP_1588_CLOCK
8080 ---help---
8181 This driver supports the Common Platform Time Sync unit of
8282 the CPSW Ethernet Switch and Keystone 2 1g/10g Switch Subsystem.
8383 The unit can time stamp PTP UDP/IPv4 and Layer 2 packets, and the
8484 driver offers a PTP Hardware Clock.
8585
86+config TI_CPTS_MOD
87+ tristate
88+ depends on TI_CPTS
89+ default y if TI_CPSW=y || TI_KEYSTONE_NETCP=y
90+ default m
91+
8692 config TI_KEYSTONE_NETCP
8793 tristate "TI Keystone NETCP Core Support"
8894 select TI_CPSW_ALE
drivers/net/ethernet/ti/Makefile+1−1
@@ -12,7 +12,7 @@ obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o · 11 unmodified lines
1212 obj-$(CONFIG_TI_DAVINCI_CPDMA) += davinci_cpdma.o
1313 obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o
1414 obj-$(CONFIG_TI_CPSW_ALE) += cpsw_ale.o
15−obj-$(CONFIG_TI_CPTS) += cpts.o
15+obj-$(CONFIG_TI_CPTS_MOD) += cpts.o
1616 obj-$(CONFIG_TI_CPSW) += ti_cpsw.o
1717 ti_cpsw-y := cpsw.o
1818
drivers/net/fjes/fjes_main.c+72−6
@@ -45,6 +45,8 @@ MODULE_DESCRIPTION("FUJITSU Extended Socket Network Device Driver"); · 44 unmodified lines
4545 MODULE_LICENSE("GPL");
4646 MODULE_VERSION(DRV_VERSION);
4747
48+#define ACPI_MOTHERBOARD_RESOURCE_HID "PNP0C02"
49+
4850 static int fjes_request_irq(struct fjes_adapter *);
4951 static void fjes_free_irq(struct fjes_adapter *);
5052
@@ -78,7 +80,7 @@ static void fjes_rx_irq(struct fjes_adapter *, int); · 27 unmodified lines
7880 static int fjes_poll(struct napi_struct *, int);
7981
8082 static const struct acpi_device_id fjes_acpi_ids[] = {
81− {"PNP0C02", 0},
83+ {ACPI_MOTHERBOARD_RESOURCE_HID, 0},
8284 {"", 0},
8385 };
8486 MODULE_DEVICE_TABLE(acpi, fjes_acpi_ids);
@@ -115,18 +117,17 @@ static struct resource fjes_resource[] = { · 30 unmodified lines
115117 },
116118 };
117119
118−static int fjes_acpi_add(struct acpi_device *device)
120+static bool is_extended_socket_device(struct acpi_device *device)
119121 {
120122 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL};
121123 char str_buf[sizeof(FJES_ACPI_SYMBOL) + 1];
122− struct platform_device *plat_dev;
123124 union acpi_object *str;
124125 acpi_status status;
125126 int result;
126127
127128 status = acpi_evaluate_object(device->handle, "_STR", NULL, &buffer);
128129 if (ACPI_FAILURE(status))
129− return -ENODEV;
130+ return false;
130131
131132 str = buffer.pointer;
132133 result = utf16s_to_utf8s((wchar_t *)str->string.pointer,
@@ -136,10 +137,42 @@ static int fjes_acpi_add(struct acpi_device *device) · 3 unmodified lines
136137
137138 if (strncmp(FJES_ACPI_SYMBOL, str_buf, strlen(FJES_ACPI_SYMBOL)) != 0) {
138139 kfree(buffer.pointer);
139− return -ENODEV;
140+ return false;
140141 }
141142 kfree(buffer.pointer);
142143
144+ return true;
145+}
146+
147+static int acpi_check_extended_socket_status(struct acpi_device *device)
148+{
149+ unsigned long long sta;
150+ acpi_status status;
151+
152+ status = acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
153+ if (ACPI_FAILURE(status))
154+ return -ENODEV;
155+
156+ if (!((sta & ACPI_STA_DEVICE_PRESENT) &&
157+ (sta & ACPI_STA_DEVICE_ENABLED) &&
158+ (sta & ACPI_STA_DEVICE_UI) &&
159+ (sta & ACPI_STA_DEVICE_FUNCTIONING)))
160+ return -ENODEV;
161+
162+ return 0;
163+}
164+
165+static int fjes_acpi_add(struct acpi_device *device)
166+{
167+ struct platform_device *plat_dev;
168+ acpi_status status;
169+
170+ if (!is_extended_socket_device(device))
171+ return -ENODEV;
172+
173+ if (acpi_check_extended_socket_status(device))
174+ return -ENODEV;
175+
143176 status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
144177 fjes_get_acpi_resource, fjes_resource);
145178 if (ACPI_FAILURE(status))
@@ -1316,7 +1349,7 @@ static void fjes_netdev_setup(struct net_device *netdev) · 1170 unmodified lines
13161349 netdev->min_mtu = fjes_support_mtu[0];
13171350 netdev->max_mtu = fjes_support_mtu[3];
13181351 netdev->flags |= IFF_BROADCAST;
1319− netdev->features |= NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_FILTER;
1352+ netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
13201353 }
13211354
13221355 static void fjes_irq_watch_task(struct work_struct *work)
@@ -1473,11 +1506,44 @@ static void fjes_watch_unshare_task(struct work_struct *work) · 150 unmodified lines
14731506 }
14741507 }
14751508
1509+static acpi_status
1510+acpi_find_extended_socket_device(acpi_handle obj_handle, u32 level,
1511+ void *context, void **return_value)
1512+{
1513+ struct acpi_device *device;
1514+ bool *found = context;
1515+ int result;
1516+
1517+ result = acpi_bus_get_device(obj_handle, &device);
1518+ if (result)
1519+ return AE_OK;
1520+
1521+ if (strcmp(acpi_device_hid(device), ACPI_MOTHERBOARD_RESOURCE_HID))
1522+ return AE_OK;
1523+
1524+ if (!is_extended_socket_device(device))
1525+ return AE_OK;
1526+
1527+ if (acpi_check_extended_socket_status(device))
1528+ return AE_OK;
1529+
1530+ *found = true;
1531+ return AE_CTRL_TERMINATE;
1532+}
1533+
14761534 /* fjes_init_module - Driver Registration Routine */
14771535 static int __init fjes_init_module(void)
14781536 {
1537+ bool found = false;
14791538 int result;
14801539
1540+ acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
1541+ acpi_find_extended_socket_device, NULL, &found,
1542+ NULL);
1543+
1544+ if (!found)
1545+ return -ENODEV;
1546+
14811547 pr_info("%s - version %s - %s\n",
14821548 fjes_driver_string, fjes_driver_version, fjes_copyright);
14831549
drivers/net/hyperv/netvsc.c+5−2
@@ -1231,8 +1231,11 @@ void netvsc_channel_cb(void *context) · 1230 unmodified lines
12311231 return;
12321232
12331233 net_device = net_device_to_netvsc_device(ndev);
1234− if (unlikely(net_device->destroy) &&
1235− netvsc_channel_idle(net_device, q_idx))
1234+ if (unlikely(!net_device))
1235+ return;
1236+
1237+ if (unlikely(net_device->destroy &&
1238+ netvsc_channel_idle(net_device, q_idx)))
12361239 return;
12371240
12381241 /* commit_rd_index() -> hv_signal_on_read() needs this. */
drivers/net/tun.c+2−0
@@ -1931,6 +1931,8 @@ static int set_offload(struct tun_struct *tun, unsigned long arg) · 1930 unmodified lines
19311931 return -EINVAL;
19321932
19331933 tun->set_features = features;
1934+ tun->dev->wanted_features &= ~TUN_USER_FEATURES;
1935+ tun->dev->wanted_features |= features;
19341936 netdev_update_features(tun->dev);
19351937
19361938 return 0;
drivers/net/usb/qmi_wwan.c+6−0
@@ -580,6 +580,10 @@ static const struct usb_device_id products[] = { · 579 unmodified lines
580580 USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 0x01, 0x69),
581581 .driver_info = (unsigned long)&qmi_wwan_info,
582582 },
583+ { /* Motorola Mapphone devices with MDM6600 */
584+ USB_VENDOR_AND_INTERFACE_INFO(0x22b8, USB_CLASS_VENDOR_SPEC, 0xfb, 0xff),
585+ .driver_info = (unsigned long)&qmi_wwan_info,
586+ },
583587
584588 /* 2. Combined interface devices matching on class+protocol */
585589 { /* Huawei E367 and possibly others in "Windows mode" */
@@ -925,6 +929,8 @@ static const struct usb_device_id products[] = { · 339 unmodified lines
925929 {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */
926930 {QMI_FIXED_INTF(0x413c, 0x81b1, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */
927931 {QMI_FIXED_INTF(0x413c, 0x81b3, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */
932+ {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */
933+ {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */
928934 {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
929935 {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
930936 {QMI_FIXED_INTF(0x1e0e, 0x9001, 5)}, /* SIMCom 7230E */
drivers/net/usb/r8152.c+17−7
@@ -32,7 +32,7 @@ · 31 unmodified lines
3232 #define NETNEXT_VERSION "08"
3333
3434 /* Information for net */
35−#define NET_VERSION "8"
35+#define NET_VERSION "9"
3636
3737 #define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION
3838 #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>"
@@ -501,6 +501,8 @@ enum rtl_register_content { · 462 unmodified lines
501501 #define RTL8153_RMS RTL8153_MAX_PACKET
502502 #define RTL8152_TX_TIMEOUT (5 * HZ)
503503 #define RTL8152_NAPI_WEIGHT 64
504+#define rx_reserved_size(x) ((x) + VLAN_ETH_HLEN + CRC_SIZE + \
505+ sizeof(struct rx_desc) + RX_ALIGN)
504506
505507 /* rtl8152 flags */
506508 enum rtl8152_flags {
@@ -1362,6 +1364,7 @@ static int alloc_all_mem(struct r8152 *tp) · 855 unmodified lines
13621364 spin_lock_init(&tp->rx_lock);
13631365 spin_lock_init(&tp->tx_lock);
13641366 INIT_LIST_HEAD(&tp->tx_free);
1367+ INIT_LIST_HEAD(&tp->rx_done);
13651368 skb_queue_head_init(&tp->tx_queue);
13661369 skb_queue_head_init(&tp->rx_queue);
13671370
@@ -2252,8 +2255,7 @@ static void r8153_set_rx_early_timeout(struct r8152 *tp) · 884 unmodified lines
22522255
22532256 static void r8153_set_rx_early_size(struct r8152 *tp)
22542257 {
2255− u32 mtu = tp->netdev->mtu;
2256− u32 ocp_data = (agg_buf_sz - mtu - VLAN_ETH_HLEN - VLAN_HLEN) / 8;
2258+ u32 ocp_data = (agg_buf_sz - rx_reserved_size(tp->netdev->mtu)) / 4;
22572259
22582260 ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, ocp_data);
22592261 }
@@ -2898,7 +2900,8 @@ static void r8153_first_init(struct r8152 *tp) · 638 unmodified lines
28982900
28992901 rtl_rx_vlan_en(tp, tp->netdev->features & NETIF_F_HW_VLAN_CTAG_RX);
29002902
2901− ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, RTL8153_RMS);
2903+ ocp_data = tp->netdev->mtu + VLAN_ETH_HLEN + CRC_SIZE;
2904+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, ocp_data);
29022905 ocp_write_byte(tp, MCU_TYPE_PLA, PLA_MTPS, MTPS_JUMBO);
29032906
29042907 ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_TCR0);
@@ -2950,7 +2953,8 @@ static void r8153_enter_oob(struct r8152 *tp) · 45 unmodified lines
29502953 usleep_range(1000, 2000);
29512954 }
29522955
2953− ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, RTL8153_RMS);
2956+ ocp_data = tp->netdev->mtu + VLAN_ETH_HLEN + CRC_SIZE;
2957+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, ocp_data);
29542958
29552959 ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_TEREDO_CFG);
29562960 ocp_data &= ~TEREDO_WAKE_MASK;
@@ -4200,8 +4204,14 @@ static int rtl8152_change_mtu(struct net_device *dev, int new_mtu) · 1243 unmodified lines
42004204
42014205 dev->mtu = new_mtu;
42024206
4203− if (netif_running(dev) && netif_carrier_ok(dev))
4204− r8153_set_rx_early_size(tp);
4207+ if (netif_running(dev)) {
4208+ u32 rms = new_mtu + VLAN_ETH_HLEN + CRC_SIZE;
4209+
4210+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, rms);
4211+
4212+ if (netif_carrier_ok(dev))
4213+ r8153_set_rx_early_size(tp);
4214+ }
42054215
42064216 mutex_unlock(&tp->control);
42074217
drivers/net/vrf.c+3−1
@@ -462,8 +462,10 @@ static void vrf_rt6_release(struct net_device *dev, struct net_vrf *vrf) · 461 unmodified lines
462462 }
463463
464464 if (rt6_local) {
465− if (rt6_local->rt6i_idev)
465+ if (rt6_local->rt6i_idev) {
466466 in6_dev_put(rt6_local->rt6i_idev);
467+ rt6_local->rt6i_idev = NULL;
468+ }
467469
468470 dst = &rt6_local->dst;
469471 dev_put(dst->dev);
drivers/net/wireless/ath/ath10k/hw.c+1−1
@@ -51,7 +51,7 @@ const struct ath10k_hw_regs qca6174_regs = { · 50 unmodified lines
5151 .rtc_soc_base_address = 0x00000800,
5252 .rtc_wmac_base_address = 0x00001000,
5353 .soc_core_base_address = 0x0003a000,
54− .wlan_mac_base_address = 0x00020000,
54+ .wlan_mac_base_address = 0x00010000,
5555 .ce_wrapper_base_address = 0x00034000,
5656 .ce0_base_address = 0x00034400,
5757 .ce1_base_address = 0x00034800,
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c+3−2
@@ -2319,7 +2319,7 @@ iwl_mvm_mac_release_buffered_frames(struct ieee80211_hw *hw, · 2318 unmodified lines
23192319 {
23202320 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
23212321
2322− /* Called when we need to transmit (a) frame(s) from agg queue */
2322+ /* Called when we need to transmit (a) frame(s) from agg or dqa queue */
23232323
23242324 iwl_mvm_sta_modify_sleep_tx_count(mvm, sta, reason, num_frames,
23252325 tids, more_data, true);
@@ -2338,7 +2338,8 @@ static void __iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw, · 12 unmodified lines
23382338 for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++) {
23392339 struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid];
23402340
2341− if (tid_data->state != IWL_AGG_ON &&
2341+ if (!iwl_mvm_is_dqa_supported(mvm) &&
2342+ tid_data->state != IWL_AGG_ON &&
23422343 tid_data->state != IWL_EMPTYING_HW_QUEUE_DELBA)
23432344 continue;
23442345
drivers/net/wireless/intel/iwlwifi/mvm/sta.c+6−5
@@ -3135,7 +3135,7 @@ void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm, · 3134 unmodified lines
31353135 struct ieee80211_sta *sta,
31363136 enum ieee80211_frame_release_type reason,
31373137 u16 cnt, u16 tids, bool more_data,
3138− bool agg)
3138+ bool single_sta_queue)
31393139 {
31403140 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
31413141 struct iwl_mvm_add_sta_cmd cmd = {
@@ -3155,14 +3155,14 @@ void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm, · 13 unmodified lines
31553155 for_each_set_bit(tid, &_tids, IWL_MAX_TID_COUNT)
31563156 cmd.awake_acs |= BIT(tid_to_ucode_ac[tid]);
31573157
3158− /* If we're releasing frames from aggregation queues then check if the
3159− * all queues combined that we're releasing frames from have
3158+ /* If we're releasing frames from aggregation or dqa queues then check
3159+ * if all the queues that we're releasing frames from, combined, have:
31603160 * - more frames than the service period, in which case more_data
31613161 * needs to be set
31623162 * - fewer than 'cnt' frames, in which case we need to adjust the
31633163 * firmware command (but do that unconditionally)
31643164 */
3165− if (agg) {
3165+ if (single_sta_queue) {
31663166 int remaining = cnt;
31673167 int sleep_tx_count;
31683168
@@ -3172,7 +3172,8 @@ void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm, · 3 unmodified lines
31723172 u16 n_queued;
31733173
31743174 tid_data = &mvmsta->tid_data[tid];
3175− if (WARN(tid_data->state != IWL_AGG_ON &&
3175+ if (WARN(!iwl_mvm_is_dqa_supported(mvm) &&
3176+ tid_data->state != IWL_AGG_ON &&
31763177 tid_data->state != IWL_EMPTYING_HW_QUEUE_DELBA,
31773178 "TID %d state is %d\n",
31783179 tid, tid_data->state)) {
drivers/net/wireless/intel/iwlwifi/mvm/sta.h+1−1
@@ -547,7 +547,7 @@ void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm, · 546 unmodified lines
547547 struct ieee80211_sta *sta,
548548 enum ieee80211_frame_release_type reason,
549549 u16 cnt, u16 tids, bool more_data,
550− bool agg);
550+ bool single_sta_queue);
551551 int iwl_mvm_drain_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta,
552552 bool drain);
553553 void iwl_mvm_sta_modify_disable_tx(struct iwl_mvm *mvm,
drivers/net/wireless/intel/iwlwifi/mvm/tx.c+18−23
@@ -7,7 +7,7 @@ · 6 unmodified lines
77 *
88 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
99 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10− * Copyright(c) 2016 Intel Deutschland GmbH
10+ * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
1111 *
1212 * This program is free software; you can redistribute it and/or modify
1313 * it under the terms of version 2 of the GNU General Public License as
@@ -34,6 +34,7 @@ · 20 unmodified lines
3434 *
3535 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
3636 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
37+ * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
3738 * All rights reserved.
3839 *
3940 * Redistribution and use in source and binary forms, with or without
@@ -628,8 +629,10 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb) · 588 unmodified lines
628629 * values.
629630 * Note that we don't need to make sure it isn't agg'd, since we're
630631 * TXing non-sta
632+ * For DQA mode - we shouldn't increase it though
631633 */
632− atomic_inc(&mvm->pending_frames[sta_id]);
634+ if (!iwl_mvm_is_dqa_supported(mvm))
635+ atomic_inc(&mvm->pending_frames[sta_id]);
633636
634637 return 0;
635638 }
@@ -1005,11 +1008,8 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb, · 369 unmodified lines
10051008
10061009 spin_unlock(&mvmsta->lock);
10071010
1008− /* Increase pending frames count if this isn't AMPDU */
1009− if ((iwl_mvm_is_dqa_supported(mvm) &&
1010− mvmsta->tid_data[tx_cmd->tid_tspec].state != IWL_AGG_ON &&
1011− mvmsta->tid_data[tx_cmd->tid_tspec].state != IWL_AGG_STARTING) ||
1012− (!iwl_mvm_is_dqa_supported(mvm) && !is_ampdu))
1011+ /* Increase pending frames count if this isn't AMPDU or DQA queue */
1012+ if (!iwl_mvm_is_dqa_supported(mvm) && !is_ampdu)
10131013 atomic_inc(&mvm->pending_frames[mvmsta->sta_id]);
10141014
10151015 return 0;
@@ -1079,12 +1079,13 @@ static void iwl_mvm_check_ratid_empty(struct iwl_mvm *mvm, · 63 unmodified lines
10791079 lockdep_assert_held(&mvmsta->lock);
10801080
10811081 if ((tid_data->state == IWL_AGG_ON ||
1082− tid_data->state == IWL_EMPTYING_HW_QUEUE_DELBA) &&
1082+ tid_data->state == IWL_EMPTYING_HW_QUEUE_DELBA ||
1083+ iwl_mvm_is_dqa_supported(mvm)) &&
10831084 iwl_mvm_tid_queued(tid_data) == 0) {
10841085 /*
1085− * Now that this aggregation queue is empty tell mac80211 so it
1086− * knows we no longer have frames buffered for the station on
1087− * this TID (for the TIM bitmap calculation.)
1086+ * Now that this aggregation or DQA queue is empty tell
1087+ * mac80211 so it knows we no longer have frames buffered for
1088+ * the station on this TID (for the TIM bitmap calculation.)
10881089 */
10891090 ieee80211_sta_set_buffered(sta, tid, false);
10901091 }
@@ -1257,7 +1258,6 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, · 166 unmodified lines
12571258 u8 skb_freed = 0;
12581259 u16 next_reclaimed, seq_ctl;
12591260 bool is_ndp = false;
1260− bool txq_agg = false; /* Is this TXQ aggregated */
12611261
12621262 __skb_queue_head_init(&skbs);
12631263
@@ -1283,6 +1283,10 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, · 19 unmodified lines
12831283 info->flags |= IEEE80211_TX_STAT_ACK;
12841284 break;
12851285 case TX_STATUS_FAIL_DEST_PS:
1286+ /* In DQA, the FW should have stopped the queue and not
1287+ * return this status
1288+ */
1289+ WARN_ON(iwl_mvm_is_dqa_supported(mvm));
12861290 info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
12871291 break;
12881292 default:
@@ -1387,15 +1391,6 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, · 98 unmodified lines
13871391 bool send_eosp_ndp = false;
13881392
13891393 spin_lock_bh(&mvmsta->lock);
1390− if (iwl_mvm_is_dqa_supported(mvm)) {
1391− enum iwl_mvm_agg_state state;
1392−
1393− state = mvmsta->tid_data[tid].state;
1394− txq_agg = (state == IWL_AGG_ON ||
1395− state == IWL_EMPTYING_HW_QUEUE_DELBA);
1396− } else {
1397− txq_agg = txq_id >= mvm->first_agg_queue;
1398− }
13991394
14001395 if (!is_ndp) {
14011396 tid_data->next_reclaimed = next_reclaimed;
@@ -1452,11 +1447,11 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, · 50 unmodified lines
14521447 * If the txq is not an AMPDU queue, there is no chance we freed
14531448 * several skbs. Check that out...
14541449 */
1455− if (txq_agg)
1450+ if (iwl_mvm_is_dqa_supported(mvm) || txq_id >= mvm->first_agg_queue)
14561451 goto out;
14571452
14581453 /* We can't free more than one frame at once on a shared queue */
1459− WARN_ON(!iwl_mvm_is_dqa_supported(mvm) && (skb_freed > 1));
1454+ WARN_ON(skb_freed > 1);
14601455
14611456 /* If we have still frames for this STA nothing to do here */
14621457 if (!atomic_sub_and_test(skb_freed, &mvm->pending_frames[sta_id]))
drivers/net/wireless/marvell/mwifiex/main.c+7−4
@@ -57,8 +57,8 @@ MODULE_PARM_DESC(mfg_mode, "manufacturing mode enable:1, disable:0"); · 56 unmodified lines
5757 * In case of any errors during inittialization, this function also ensures
5858 * proper cleanup before exiting.
5959 */
60−static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops,
61− void **padapter)
60+static int mwifiex_register(void *card, struct device *dev,
61+ struct mwifiex_if_ops *if_ops, void **padapter)
6262 {
6363 struct mwifiex_adapter *adapter;
6464 int i;
@@ -68,6 +68,7 @@ static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops, · 3 unmodified lines
6868 return -ENOMEM;
6969
7070 *padapter = adapter;
71+ adapter->dev = dev;
7172 adapter->card = card;
7273
7374 /* Save interface specific operations in adapter */
@@ -1568,12 +1569,11 @@ mwifiex_add_card(void *card, struct completion *fw_done, · 1494 unmodified lines
15681569 {
15691570 struct mwifiex_adapter *adapter;
15701571
1571− if (mwifiex_register(card, if_ops, (void **)&adapter)) {
1572+ if (mwifiex_register(card, dev, if_ops, (void **)&adapter)) {
15721573 pr_err("%s: software init failed\n", __func__);
15731574 goto err_init_sw;
15741575 }
15751576
1576− adapter->dev = dev;
15771577 mwifiex_probe_of(adapter);
15781578
15791579 adapter->iface_type = iface_type;
@@ -1718,6 +1718,9 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter) · 138 unmodified lines
17181718 wiphy_unregister(adapter->wiphy);
17191719 wiphy_free(adapter->wiphy);
17201720
1721+ if (adapter->irq_wakeup >= 0)
1722+ device_init_wakeup(adapter->dev, false);
1723+
17211724 /* Unregister device */
17221725 mwifiex_dbg(adapter, INFO,
17231726 "info: unregister device\n");
drivers/net/wireless/marvell/mwifiex/pcie.c+19−19
@@ -2739,6 +2739,21 @@ static void mwifiex_pcie_device_dump(struct mwifiex_adapter *adapter) · 2738 unmodified lines
27392739 schedule_work(&card->work);
27402740 }
27412741
2742+static void mwifiex_pcie_free_buffers(struct mwifiex_adapter *adapter)
2743+{
2744+ struct pcie_service_card *card = adapter->card;
2745+ const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;
2746+
2747+ if (reg->sleep_cookie)
2748+ mwifiex_pcie_delete_sleep_cookie_buf(adapter);
2749+
2750+ mwifiex_pcie_delete_cmdrsp_buf(adapter);
2751+ mwifiex_pcie_delete_evtbd_ring(adapter);
2752+ mwifiex_pcie_delete_rxbd_ring(adapter);
2753+ mwifiex_pcie_delete_txbd_ring(adapter);
2754+ card->cmdrsp_buf = NULL;
2755+}
2756+
27422757 /*
27432758 * This function initializes the PCI-E host memory space, WCB rings, etc.
27442759 *
@@ -2850,13 +2865,6 @@ err_enable_dev: · 105 unmodified lines
28502865
28512866 /*
28522867 * This function cleans up the allocated card buffers.
2853− *
2854− * The following are freed by this function -
2855− * - TXBD ring buffers
2856− * - RXBD ring buffers
2857− * - Event BD ring buffers
2858− * - Command response ring buffer
2859− * - Sleep cookie buffer
28602868 */
28612869 static void mwifiex_cleanup_pcie(struct mwifiex_adapter *adapter)
28622870 {
@@ -2875,6 +2883,8 @@ static void mwifiex_cleanup_pcie(struct mwifiex_adapter *adapter) · 12 unmodified lines
28752883 "Failed to write driver not-ready signature\n");
28762884 }
28772885
2886+ mwifiex_pcie_free_buffers(adapter);
2887+
28782888 if (pdev) {
28792889 pci_iounmap(pdev, card->pci_mmap);
28802890 pci_iounmap(pdev, card->pci_mmap1);
@@ -3126,10 +3136,7 @@ err_cre_txbd: · 245 unmodified lines
31263136 pci_iounmap(pdev, card->pci_mmap1);
31273137 }
31283138
3129−/* This function cleans up the PCI-E host memory space.
3130− * Some code is extracted from mwifiex_unregister_dev()
3131− *
3132− */
3139+/* This function cleans up the PCI-E host memory space. */
31333140 static void mwifiex_pcie_down_dev(struct mwifiex_adapter *adapter)
31343141 {
31353142 struct pcie_service_card *card = adapter->card;
@@ -3140,14 +3147,7 @@ static void mwifiex_pcie_down_dev(struct mwifiex_adapter *adapter) · 4 unmodified lines
31403147
31413148 adapter->seq_num = 0;
31423149
3143− if (reg->sleep_cookie)
3144− mwifiex_pcie_delete_sleep_cookie_buf(adapter);
3145−
3146− mwifiex_pcie_delete_cmdrsp_buf(adapter);
3147− mwifiex_pcie_delete_evtbd_ring(adapter);
3148− mwifiex_pcie_delete_rxbd_ring(adapter);
3149− mwifiex_pcie_delete_txbd_ring(adapter);
3150− card->cmdrsp_buf = NULL;
3150+ mwifiex_pcie_free_buffers(adapter);
31513151 }
31523152
31533153 static struct mwifiex_if_ops pcie_ops = {
drivers/nvme/host/rdma.c+14−14
@@ -343,8 +343,6 @@ static int __nvme_rdma_init_request(struct nvme_rdma_ctrl *ctrl, · 342 unmodified lines
343343 struct ib_device *ibdev = dev->dev;
344344 int ret;
345345
346− BUG_ON(queue_idx >= ctrl->queue_count);
347−
348346 ret = nvme_rdma_alloc_qe(ibdev, &req->sqe, sizeof(struct nvme_command),
349347 DMA_TO_DEVICE);
350348 if (ret)
@@ -652,8 +650,22 @@ out_free_queues: · 301 unmodified lines
652650
653651 static int nvme_rdma_init_io_queues(struct nvme_rdma_ctrl *ctrl)
654652 {
653+ struct nvmf_ctrl_options *opts = ctrl->ctrl.opts;
654+ unsigned int nr_io_queues;
655655 int i, ret;
656656
657+ nr_io_queues = min(opts->nr_io_queues, num_online_cpus());
658+ ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues);
659+ if (ret)
660+ return ret;
661+
662+ ctrl->queue_count = nr_io_queues + 1;
663+ if (ctrl->queue_count < 2)
664+ return 0;
665+
666+ dev_info(ctrl->ctrl.device,
667+ "creating %d I/O queues.\n", nr_io_queues);
668+
657669 for (i = 1; i < ctrl->queue_count; i++) {
658670 ret = nvme_rdma_init_queue(ctrl, i,
659671 ctrl->ctrl.opts->queue_size);
@@ -1791,20 +1803,8 @@ static const struct nvme_ctrl_ops nvme_rdma_ctrl_ops = { · 1131 unmodified lines
17911803
17921804 static int nvme_rdma_create_io_queues(struct nvme_rdma_ctrl *ctrl)
17931805 {
1794− struct nvmf_ctrl_options *opts = ctrl->ctrl.opts;
17951806 int ret;
17961807
1797− ret = nvme_set_queue_count(&ctrl->ctrl, &opts->nr_io_queues);
1798− if (ret)
1799− return ret;
1800−
1801− ctrl->queue_count = opts->nr_io_queues + 1;
1802− if (ctrl->queue_count < 2)
1803− return 0;
1804−
1805− dev_info(ctrl->ctrl.device,
1806− "creating %d I/O queues.\n", opts->nr_io_queues);
1807−
18081808 ret = nvme_rdma_init_io_queues(ctrl);
18091809 if (ret)
18101810 return ret;
drivers/nvme/target/core.c+10−1
@@ -425,6 +425,13 @@ void nvmet_sq_setup(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq, · 424 unmodified lines
425425 ctrl->sqs[qid] = sq;
426426 }
427427
428+static void nvmet_confirm_sq(struct percpu_ref *ref)
429+{
430+ struct nvmet_sq *sq = container_of(ref, struct nvmet_sq, ref);
431+
432+ complete(&sq->confirm_done);
433+}
434+
428435 void nvmet_sq_destroy(struct nvmet_sq *sq)
429436 {
430437 /*
@@ -433,7 +440,8 @@ void nvmet_sq_destroy(struct nvmet_sq *sq) · 2 unmodified lines
433440 */
434441 if (sq->ctrl && sq->ctrl->sqs && sq->ctrl->sqs[0] == sq)
435442 nvmet_async_events_free(sq->ctrl);
436− percpu_ref_kill(&sq->ref);
443+ percpu_ref_kill_and_confirm(&sq->ref, nvmet_confirm_sq);
444+ wait_for_completion(&sq->confirm_done);
437445 wait_for_completion(&sq->free_done);
438446 percpu_ref_exit(&sq->ref);
439447
@@ -461,6 +469,7 @@ int nvmet_sq_init(struct nvmet_sq *sq) · 21 unmodified lines
461469 return ret;
462470 }
463471 init_completion(&sq->free_done);
472+ init_completion(&sq->confirm_done);
464473
465474 return 0;
466475 }
drivers/nvme/target/loop.c+51−39
@@ -223,8 +223,6 @@ static void nvme_loop_submit_async_event(struct nvme_ctrl *arg, int aer_idx) · 222 unmodified lines
223223 static int nvme_loop_init_iod(struct nvme_loop_ctrl *ctrl,
224224 struct nvme_loop_iod *iod, unsigned int queue_idx)
225225 {
226− BUG_ON(queue_idx >= ctrl->queue_count);
227−
228226 iod->req.cmd = &iod->cmd;
229227 iod->req.rsp = &iod->rsp;
230228 iod->queue = &ctrl->queues[queue_idx];
@@ -288,9 +286,9 @@ static struct blk_mq_ops nvme_loop_admin_mq_ops = { · 57 unmodified lines
288286
289287 static void nvme_loop_destroy_admin_queue(struct nvme_loop_ctrl *ctrl)
290288 {
289+ nvmet_sq_destroy(&ctrl->queues[0].nvme_sq);
291290 blk_cleanup_queue(ctrl->ctrl.admin_q);
292291 blk_mq_free_tag_set(&ctrl->admin_tag_set);
293− nvmet_sq_destroy(&ctrl->queues[0].nvme_sq);
294292 }
295293
296294 static void nvme_loop_free_ctrl(struct nvme_ctrl *nctrl)
@@ -314,6 +312,43 @@ free_ctrl: · 17 unmodified lines
314312 kfree(ctrl);
315313 }
316314
315+static void nvme_loop_destroy_io_queues(struct nvme_loop_ctrl *ctrl)
316+{
317+ int i;
318+
319+ for (i = 1; i < ctrl->queue_count; i++)
320+ nvmet_sq_destroy(&ctrl->queues[i].nvme_sq);
321+}
322+
323+static int nvme_loop_init_io_queues(struct nvme_loop_ctrl *ctrl)
324+{
325+ struct nvmf_ctrl_options *opts = ctrl->ctrl.opts;
326+ unsigned int nr_io_queues;
327+ int ret, i;
328+
329+ nr_io_queues = min(opts->nr_io_queues, num_online_cpus());
330+ ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues);
331+ if (ret || !nr_io_queues)
332+ return ret;
333+
334+ dev_info(ctrl->ctrl.device, "creating %d I/O queues.\n", nr_io_queues);
335+
336+ for (i = 1; i <= nr_io_queues; i++) {
337+ ctrl->queues[i].ctrl = ctrl;
338+ ret = nvmet_sq_init(&ctrl->queues[i].nvme_sq);
339+ if (ret)
340+ goto out_destroy_queues;
341+
342+ ctrl->queue_count++;
343+ }
344+
345+ return 0;
346+
347+out_destroy_queues:
348+ nvme_loop_destroy_io_queues(ctrl);
349+ return ret;
350+}
351+
317352 static int nvme_loop_configure_admin_queue(struct nvme_loop_ctrl *ctrl)
318353 {
319354 int error;
@@ -385,17 +420,13 @@ out_free_sq: · 65 unmodified lines
385420
386421 static void nvme_loop_shutdown_ctrl(struct nvme_loop_ctrl *ctrl)
387422 {
388− int i;
389−
390423 nvme_stop_keep_alive(&ctrl->ctrl);
391424
392425 if (ctrl->queue_count > 1) {
393426 nvme_stop_queues(&ctrl->ctrl);
394427 blk_mq_tagset_busy_iter(&ctrl->tag_set,
395428 nvme_cancel_request, &ctrl->ctrl);
396−
397− for (i = 1; i < ctrl->queue_count; i++)
398− nvmet_sq_destroy(&ctrl->queues[i].nvme_sq);
429+ nvme_loop_destroy_io_queues(ctrl);
399430 }
400431
401432 if (ctrl->ctrl.state == NVME_CTRL_LIVE)
@@ -467,19 +498,14 @@ static void nvme_loop_reset_ctrl_work(struct work_struct *work) · 65 unmodified lines
467498 if (ret)
468499 goto out_disable;
469500
470− for (i = 1; i <= ctrl->ctrl.opts->nr_io_queues; i++) {
471− ctrl->queues[i].ctrl = ctrl;
472− ret = nvmet_sq_init(&ctrl->queues[i].nvme_sq);
473− if (ret)
474− goto out_free_queues;
475−
476− ctrl->queue_count++;
477− }
501+ ret = nvme_loop_init_io_queues(ctrl);
502+ if (ret)
503+ goto out_destroy_admin;
478504
479− for (i = 1; i <= ctrl->ctrl.opts->nr_io_queues; i++) {
505+ for (i = 1; i < ctrl->queue_count; i++) {
480506 ret = nvmf_connect_io_queue(&ctrl->ctrl, i);
481507 if (ret)
482− goto out_free_queues;
508+ goto out_destroy_io;
483509 }
484510
485511 changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
@@ -492,9 +518,9 @@ static void nvme_loop_reset_ctrl_work(struct work_struct *work) · 6 unmodified lines
492518
493519 return;
494520
495−out_free_queues:
496− for (i = 1; i < ctrl->queue_count; i++)
497− nvmet_sq_destroy(&ctrl->queues[i].nvme_sq);
521+out_destroy_io:
522+ nvme_loop_destroy_io_queues(ctrl);
523+out_destroy_admin:
498524 nvme_loop_destroy_admin_queue(ctrl);
499525 out_disable:
500526 dev_warn(ctrl->ctrl.device, "Removing after reset failure\n");
@@ -533,25 +559,12 @@ static const struct nvme_ctrl_ops nvme_loop_ctrl_ops = { · 32 unmodified lines
533559
534560 static int nvme_loop_create_io_queues(struct nvme_loop_ctrl *ctrl)
535561 {
536− struct nvmf_ctrl_options *opts = ctrl->ctrl.opts;
537562 int ret, i;
538563
539− ret = nvme_set_queue_count(&ctrl->ctrl, &opts->nr_io_queues);
540− if (ret || !opts->nr_io_queues)
564+ ret = nvme_loop_init_io_queues(ctrl);
565+ if (ret)
541566 return ret;
542567
543− dev_info(ctrl->ctrl.device, "creating %d I/O queues.\n",
544− opts->nr_io_queues);
545−
546− for (i = 1; i <= opts->nr_io_queues; i++) {
547− ctrl->queues[i].ctrl = ctrl;
548− ret = nvmet_sq_init(&ctrl->queues[i].nvme_sq);
549− if (ret)
550− goto out_destroy_queues;
551−
552− ctrl->queue_count++;
553− }
554−
555568 memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set));
556569 ctrl->tag_set.ops = &nvme_loop_mq_ops;
557570 ctrl->tag_set.queue_depth = ctrl->ctrl.opts->queue_size;
@@ -575,7 +588,7 @@ static int nvme_loop_create_io_queues(struct nvme_loop_ctrl *ctrl) · 17 unmodified lines
575588 goto out_free_tagset;
576589 }
577590
578− for (i = 1; i <= opts->nr_io_queues; i++) {
591+ for (i = 1; i < ctrl->queue_count; i++) {
579592 ret = nvmf_connect_io_queue(&ctrl->ctrl, i);
580593 if (ret)
581594 goto out_cleanup_connect_q;
@@ -588,8 +601,7 @@ out_cleanup_connect_q: · 6 unmodified lines
588601 out_free_tagset:
589602 blk_mq_free_tag_set(&ctrl->tag_set);
590603 out_destroy_queues:
591− for (i = 1; i < ctrl->queue_count; i++)
592− nvmet_sq_destroy(&ctrl->queues[i].nvme_sq);
604+ nvme_loop_destroy_io_queues(ctrl);
593605 return ret;
594606 }
595607
drivers/nvme/target/nvmet.h+1−0
@@ -73,6 +73,7 @@ struct nvmet_sq { · 72 unmodified lines
7373 u16 qid;
7474 u16 size;
7575 struct completion free_done;
76+ struct completion confirm_done;
7677 };
7778
7879 /**
drivers/nvme/target/rdma.c+3−5
@@ -703,11 +703,6 @@ static void nvmet_rdma_handle_command(struct nvmet_rdma_queue *queue, · 702 unmodified lines
703703 {
704704 u16 status;
705705
706− cmd->queue = queue;
707− cmd->n_rdma = 0;
708− cmd->req.port = queue->port;
709−
710−
711706 ib_dma_sync_single_for_cpu(queue->dev->device,
712707 cmd->cmd->sge[0].addr, cmd->cmd->sge[0].length,
713708 DMA_FROM_DEVICE);
@@ -760,9 +755,12 @@ static void nvmet_rdma_recv_done(struct ib_cq *cq, struct ib_wc *wc) · 46 unmodified lines
760755
761756 cmd->queue = queue;
762757 rsp = nvmet_rdma_get_rsp(queue);
758+ rsp->queue = queue;
763759 rsp->cmd = cmd;
764760 rsp->flags = 0;
765761 rsp->req.cmd = cmd->nvme_cmd;
762+ rsp->req.port = queue->port;
763+ rsp->n_rdma = 0;
766764
767765 if (unlikely(queue->state != NVMET_RDMA_Q_LIVE)) {
768766 unsigned long flags;
drivers/parport/share.c+4−2
@@ -939,8 +939,10 @@ parport_register_dev_model(struct parport *port, const char *name, · 938 unmodified lines
939939 * pardevice fields. -arca
940940 */
941941 port->ops->init_state(par_dev, par_dev->state);
942− port->proc_device = par_dev;
943− parport_device_proc_register(par_dev);
942+ if (!test_and_set_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags)) {
943+ port->proc_device = par_dev;
944+ parport_device_proc_register(par_dev);
945+ }
944946
945947 return par_dev;
946948
drivers/phy/Kconfig+1−8
@@ -449,6 +449,7 @@ config PHY_QCOM_UFS · 448 unmodified lines
449449 config PHY_QCOM_USB_HS
450450 tristate "Qualcomm USB HS PHY module"
451451 depends on USB_ULPI_BUS
452+ depends on EXTCON || !EXTCON # if EXTCON=m, this cannot be built-in
452453 select GENERIC_PHY
453454 help
454455 Support for the USB high-speed ULPI compliant phy on Qualcomm
@@ -510,12 +511,4 @@ config PHY_MESON8B_USB2 · 55 unmodified lines
510511 and GXBB SoCs.
511512 If unsure, say N.
512513
513−config PHY_NSP_USB3
514− tristate "Broadcom NorthStar plus USB3 PHY driver"
515− depends on OF && (ARCH_BCM_NSP || COMPILE_TEST)
516− select GENERIC_PHY
517− default ARCH_BCM_NSP
518− help
519− Enable this to support the Broadcom Northstar plus USB3 PHY.
520− If unsure, say N.
521514 endmenu
drivers/phy/Makefile+0−1
@@ -62,4 +62,3 @@ obj-$(CONFIG_PHY_CYGNUS_PCIE) += phy-bcm-cygnus-pcie.o · 61 unmodified lines
6262 obj-$(CONFIG_ARCH_TEGRA) += tegra/
6363 obj-$(CONFIG_PHY_NS2_PCIE) += phy-bcm-ns2-pcie.o
6464 obj-$(CONFIG_PHY_MESON8B_USB2) += phy-meson8b-usb2.o
65−obj-$(CONFIG_PHY_NSP_USB3) += phy-bcm-nsp-usb3.o
drivers/phy/phy-bcm-nsp-usb3.c+0−177
@@ -1,177 +0,0 @@
1−/*
2− * Copyright (C) 2016 Broadcom
3− *
4− * This program is free software; you can redistribute it and/or
5− * modify it under the terms of the GNU General Public License as
6− * published by the Free Software Foundation version 2.
7− *
8− * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9− * kind, whether express or implied; without even the implied warranty
10− * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− */
13−
14−#include <linux/delay.h>
15−#include <linux/io.h>
16−#include <linux/kernel.h>
17−#include <linux/mfd/syscon.h>
18−#include <linux/mdio.h>
19−#include <linux/module.h>
20−#include <linux/of.h>
21−#include <linux/of_address.h>
22−#include <linux/phy/phy.h>
23−#include <linux/regmap.h>
24−
25−#define NSP_USB3_RST_CTRL_OFFSET 0x3f8
26−
27−/* mdio reg access */
28−#define NSP_USB3_PHY_BASE_ADDR_REG 0x1f
29−
30−#define NSP_USB3_PHY_PLL30_BLOCK 0x8000
31−#define NSP_USB3_PLL_CONTROL 0x01
32−#define NSP_USB3_PLLA_CONTROL0 0x0a
33−#define NSP_USB3_PLLA_CONTROL1 0x0b
34−
35−#define NSP_USB3_PHY_TX_PMD_BLOCK 0x8040
36−#define NSP_USB3_TX_PMD_CONTROL1 0x01
37−
38−#define NSP_USB3_PHY_PIPE_BLOCK 0x8060
39−#define NSP_USB3_LFPS_CMP 0x02
40−#define NSP_USB3_LFPS_DEGLITCH 0x03
41−
42−struct nsp_usb3_phy {
43− struct regmap *usb3_ctrl;
44− struct phy *phy;
45− struct mdio_device *mdiodev;
46−};
47−
48−static int nsp_usb3_phy_init(struct phy *phy)
49−{
50− struct nsp_usb3_phy *iphy = phy_get_drvdata(phy);
51− struct mii_bus *bus = iphy->mdiodev->bus;
52− int addr = iphy->mdiodev->addr;
53− u32 data;
54− int rc;
55−
56− rc = regmap_read(iphy->usb3_ctrl, 0, &data);
57− if (rc)
58− return rc;
59− data |= 1;
60− rc = regmap_write(iphy->usb3_ctrl, 0, data);
61− if (rc)
62− return rc;
63−
64− rc = regmap_write(iphy->usb3_ctrl, NSP_USB3_RST_CTRL_OFFSET, 1);
65− if (rc)
66− return rc;
67−
68− rc = mdiobus_write(bus, addr, NSP_USB3_PHY_BASE_ADDR_REG,
69− NSP_USB3_PHY_PLL30_BLOCK);
70− if (rc)
71− return rc;
72−
73− rc = mdiobus_write(bus, addr, NSP_USB3_PLL_CONTROL, 0x1000);
74− if (rc)
75− return rc;
76−
77− rc = mdiobus_write(bus, addr, NSP_USB3_PLLA_CONTROL0, 0x6400);
78− if (rc)
79− return rc;
80−
81− rc = mdiobus_write(bus, addr, NSP_USB3_PLLA_CONTROL1, 0xc000);
82− if (rc)
83− return rc;
84−
85− rc = mdiobus_write(bus, addr, NSP_USB3_PLLA_CONTROL1, 0x8000);
86− if (rc)
87− return rc;
88−
89− rc = regmap_write(iphy->usb3_ctrl, NSP_USB3_RST_CTRL_OFFSET, 0);
90− if (rc)
91− return rc;
92−
93− rc = mdiobus_write(bus, addr, NSP_USB3_PLL_CONTROL, 0x9000);
94− if (rc)
95− return rc;
96−
97− rc = mdiobus_write(bus, addr, NSP_USB3_PHY_BASE_ADDR_REG,
98− NSP_USB3_PHY_PIPE_BLOCK);
99− if (rc)
100− return rc;
101−
102− rc = mdiobus_write(bus, addr, NSP_USB3_LFPS_CMP, 0xf30d);
103− if (rc)
104− return rc;
105−
106− rc = mdiobus_write(bus, addr, NSP_USB3_LFPS_DEGLITCH, 0x6302);
107− if (rc)
108− return rc;
109−
110− rc = mdiobus_write(bus, addr, NSP_USB3_PHY_BASE_ADDR_REG,
111− NSP_USB3_PHY_TX_PMD_BLOCK);
112− if (rc)
113− return rc;
114−
115− rc = mdiobus_write(bus, addr, NSP_USB3_TX_PMD_CONTROL1, 0x1003);
116−
117− return rc;
118−}
119−
120−static struct phy_ops nsp_usb3_phy_ops = {
121− .init = nsp_usb3_phy_init,
122− .owner = THIS_MODULE,
123−};
124−
125−static int nsp_usb3_phy_probe(struct mdio_device *mdiodev)
126−{
127− struct device *dev = &mdiodev->dev;
128− struct phy_provider *provider;
129− struct nsp_usb3_phy *iphy;
130−
131− iphy = devm_kzalloc(dev, sizeof(*iphy), GFP_KERNEL);
132− if (!iphy)
133− return -ENOMEM;
134− iphy->mdiodev = mdiodev;
135−
136− iphy->usb3_ctrl = syscon_regmap_lookup_by_phandle(dev->of_node,
137− "usb3-ctrl-syscon");
138− if (IS_ERR(iphy->usb3_ctrl))
139− return PTR_ERR(iphy->usb3_ctrl);
140−
141− iphy->phy = devm_phy_create(dev, dev->of_node, &nsp_usb3_phy_ops);
142− if (IS_ERR(iphy->phy)) {
143− dev_err(dev, "failed to create PHY\n");
144− return PTR_ERR(iphy->phy);
145− }
146−
147− phy_set_drvdata(iphy->phy, iphy);
148−
149− provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
150− if (IS_ERR(provider)) {
151− dev_err(dev, "could not register PHY provider\n");
152− return PTR_ERR(provider);
153− }
154−
155− return 0;
156−}
157−
158−static const struct of_device_id nsp_usb3_phy_of_match[] = {
159− {.compatible = "brcm,nsp-usb3-phy",},
160− { /* sentinel */ }
161−};
162−
163−static struct mdio_driver nsp_usb3_phy_driver = {
164− .mdiodrv = {
165− .driver = {
166− .name = "nsp-usb3-phy",
167− .of_match_table = nsp_usb3_phy_of_match,
168− },
169− },
170− .probe = nsp_usb3_phy_probe,
171−};
172−
173−mdio_module_driver(nsp_usb3_phy_driver);
174−
175−MODULE_DESCRIPTION("Broadcom NSP USB3 PHY driver");
176−MODULE_LICENSE("GPL v2");
177−MODULE_AUTHOR("Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.com");
drivers/phy/phy-exynos-pcie.c+2−2
@@ -254,8 +254,8 @@ static int exynos_pcie_phy_probe(struct platform_device *pdev) · 253 unmodified lines
254254
255255 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
256256 exynos_phy->blk_base = devm_ioremap_resource(dev, res);
257− if (IS_ERR(exynos_phy->phy_base))
258− return PTR_ERR(exynos_phy->phy_base);
257+ if (IS_ERR(exynos_phy->blk_base))
258+ return PTR_ERR(exynos_phy->blk_base);
259259
260260 exynos_phy->drv_data = drv_data;
261261
drivers/remoteproc/Kconfig+3−3
@@ -76,7 +76,7 @@ config QCOM_ADSP_PIL · 75 unmodified lines
7676 depends on OF && ARCH_QCOM
7777 depends on REMOTEPROC
7878 depends on QCOM_SMEM
79− depends on QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n)
79+ depends on RPMSG_QCOM_SMD || QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n && RPMSG_QCOM_SMD=n)
8080 select MFD_SYSCON
8181 select QCOM_MDT_LOADER
8282 select QCOM_RPROC_COMMON
@@ -93,7 +93,7 @@ config QCOM_Q6V5_PIL · 10 unmodified lines
9393 depends on OF && ARCH_QCOM
9494 depends on QCOM_SMEM
9595 depends on REMOTEPROC
96− depends on QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n)
96+ depends on RPMSG_QCOM_SMD || QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n && RPMSG_QCOM_SMD=n)
9797 select MFD_SYSCON
9898 select QCOM_RPROC_COMMON
9999 select QCOM_SCM
@@ -104,7 +104,7 @@ config QCOM_Q6V5_PIL · 4 unmodified lines
104104 config QCOM_WCNSS_PIL
105105 tristate "Qualcomm WCNSS Peripheral Image Loader"
106106 depends on OF && ARCH_QCOM
107− depends on QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n)
107+ depends on RPMSG_QCOM_SMD || QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n && RPMSG_QCOM_SMD=n)
108108 depends on QCOM_SMEM
109109 depends on REMOTEPROC
110110 select QCOM_MDT_LOADER
drivers/scsi/Kconfig+0−14
@@ -1253,20 +1253,6 @@ config SCSI_LPFC_DEBUG_FS · 1252 unmodified lines
12531253 This makes debugging information from the lpfc driver
12541254 available via the debugfs filesystem.
12551255
1256−config LPFC_NVME_INITIATOR
1257− bool "Emulex LightPulse Fibre Channel NVME Initiator Support"
1258− depends on SCSI_LPFC && NVME_FC
1259− ---help---
1260− This enables NVME Initiator support in the Emulex lpfc driver.
1261−
1262−config LPFC_NVME_TARGET
1263− bool "Emulex LightPulse Fibre Channel NVME Initiator Support"
1264− depends on SCSI_LPFC && NVME_TARGET_FC
1265− ---help---
1266− This enables NVME Target support in the Emulex lpfc driver.
1267− Target enablement must still be enabled on a per adapter
1268− basis by module parameters.
1269−
12701256 config SCSI_SIM710
12711257 tristate "Simple 53c710 SCSI support (Compaq, NCR machines)"
12721258 depends on (EISA || MCA) && SCSI
drivers/scsi/hpsa.c+32−21
@@ -2956,7 +2956,7 @@ static int hpsa_send_reset(struct ctlr_info *h, unsigned char *scsi3addr, · 2955 unmodified lines
29562956 /* fill_cmd can't fail here, no data buffer to map. */
29572957 (void) fill_cmd(c, reset_type, h, NULL, 0, 0,
29582958 scsi3addr, TYPE_MSG);
2959− rc = hpsa_scsi_do_simple_cmd(h, c, reply_queue, DEFAULT_TIMEOUT);
2959+ rc = hpsa_scsi_do_simple_cmd(h, c, reply_queue, NO_TIMEOUT);
29602960 if (rc) {
29612961 dev_warn(&h->pdev->dev, "Failed to send reset command\n");
29622962 goto out;
@@ -3714,7 +3714,7 @@ exit_failed: · 751 unmodified lines
37143714 * # (integer code indicating one of several NOT READY states
37153715 * describing why a volume is to be kept offline)
37163716 */
3717−static int hpsa_volume_offline(struct ctlr_info *h,
3717+static unsigned char hpsa_volume_offline(struct ctlr_info *h,
37183718 unsigned char scsi3addr[])
37193719 {
37203720 struct CommandList *c;
@@ -3735,7 +3735,7 @@ static int hpsa_volume_offline(struct ctlr_info *h, · 14 unmodified lines
37353735 DEFAULT_TIMEOUT);
37363736 if (rc) {
37373737 cmd_free(h, c);
3738− return 0;
3738+ return HPSA_VPD_LV_STATUS_UNSUPPORTED;
37393739 }
37403740 sense = c->err_info->SenseInfo;
37413741 if (c->err_info->SenseLen > sizeof(c->err_info->SenseInfo))
@@ -3746,19 +3746,13 @@ static int hpsa_volume_offline(struct ctlr_info *h, · 4 unmodified lines
37463746 cmd_status = c->err_info->CommandStatus;
37473747 scsi_status = c->err_info->ScsiStatus;
37483748 cmd_free(h, c);
3749− /* Is the volume 'not ready'? */
3750− if (cmd_status != CMD_TARGET_STATUS ||
3751− scsi_status != SAM_STAT_CHECK_CONDITION ||
3752− sense_key != NOT_READY ||
3753− asc != ASC_LUN_NOT_READY) {
3754− return 0;
3755− }
37563749
37573750 /* Determine the reason for not ready state */
37583751 ldstat = hpsa_get_volume_status(h, scsi3addr);
37593752
37603753 /* Keep volume offline in certain cases: */
37613754 switch (ldstat) {
3755+ case HPSA_LV_FAILED:
37623756 case HPSA_LV_UNDERGOING_ERASE:
37633757 case HPSA_LV_NOT_AVAILABLE:
37643758 case HPSA_LV_UNDERGOING_RPI:
@@ -3780,7 +3774,7 @@ static int hpsa_volume_offline(struct ctlr_info *h, · 15 unmodified lines
37803774 default:
37813775 break;
37823776 }
3783− return 0;
3777+ return HPSA_LV_OK;
37843778 }
37853779
37863780 /*
@@ -3853,10 +3847,10 @@ static int hpsa_update_device_info(struct ctlr_info *h, · 66 unmodified lines
38533847 /* Do an inquiry to the device to see what it is. */
38543848 if (hpsa_scsi_do_inquiry(h, scsi3addr, 0, inq_buff,
38553849 (unsigned char) OBDR_TAPE_INQ_SIZE) != 0) {
3856− /* Inquiry failed (msg printed already) */
38573850 dev_err(&h->pdev->dev,
3858− "hpsa_update_device_info: inquiry failed\n");
3859− rc = -EIO;
3851+ "%s: inquiry failed, device will be skipped.\n",
3852+ __func__);
3853+ rc = HPSA_INQUIRY_FAILED;
38603854 goto bail_out;
38613855 }
38623856
@@ -3885,15 +3879,19 @@ static int hpsa_update_device_info(struct ctlr_info *h, · 22 unmodified lines
38853879 if ((this_device->devtype == TYPE_DISK ||
38863880 this_device->devtype == TYPE_ZBC) &&
38873881 is_logical_dev_addr_mode(scsi3addr)) {
3888− int volume_offline;
3882+ unsigned char volume_offline;
38893883
38903884 hpsa_get_raid_level(h, scsi3addr, &this_device->raid_level);
38913885 if (h->fw_support & MISC_FW_RAID_OFFLOAD_BASIC)
38923886 hpsa_get_ioaccel_status(h, scsi3addr, this_device);
38933887 volume_offline = hpsa_volume_offline(h, scsi3addr);
3894− if (volume_offline < 0 || volume_offline > 0xff)
3895− volume_offline = HPSA_VPD_LV_STATUS_UNSUPPORTED;
3896− this_device->volume_offline = volume_offline & 0xff;
3888+ if (volume_offline == HPSA_LV_FAILED) {
3889+ rc = HPSA_LV_FAILED;
3890+ dev_err(&h->pdev->dev,
3891+ "%s: LV failed, device will be skipped.\n",
3892+ __func__);
3893+ goto bail_out;
3894+ }
38973895 } else {
38983896 this_device->raid_level = RAID_UNKNOWN;
38993897 this_device->offload_config = 0;
@@ -4379,8 +4377,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h) · 479 unmodified lines
43794377 goto out;
43804378 }
43814379 if (rc) {
4382− dev_warn(&h->pdev->dev,
4383− "Inquiry failed, skipping device.\n");
4380+ h->drv_req_rescan = 1;
43844381 continue;
43854382 }
43864383
@@ -5558,7 +5555,7 @@ static void hpsa_scan_complete(struct ctlr_info *h) · 1171 unmodified lines
55585555
55595556 spin_lock_irqsave(&h->scan_lock, flags);
55605557 h->scan_finished = 1;
5561− wake_up_all(&h->scan_wait_queue);
5558+ wake_up(&h->scan_wait_queue);
55625559 spin_unlock_irqrestore(&h->scan_lock, flags);
55635560 }
55645561
@@ -5576,11 +5573,23 @@ static void hpsa_scan_start(struct Scsi_Host *sh) · 11 unmodified lines
55765573 if (unlikely(lockup_detected(h)))
55775574 return hpsa_scan_complete(h);
55785575
5576+ /*
5577+ * If a scan is already waiting to run, no need to add another
5578+ */
5579+ spin_lock_irqsave(&h->scan_lock, flags);
5580+ if (h->scan_waiting) {
5581+ spin_unlock_irqrestore(&h->scan_lock, flags);
5582+ return;
5583+ }
5584+
5585+ spin_unlock_irqrestore(&h->scan_lock, flags);
5586+
55795587 /* wait until any scan already in progress is finished. */
55805588 while (1) {
55815589 spin_lock_irqsave(&h->scan_lock, flags);
55825590 if (h->scan_finished)
55835591 break;
5592+ h->scan_waiting = 1;
55845593 spin_unlock_irqrestore(&h->scan_lock, flags);
55855594 wait_event(h->scan_wait_queue, h->scan_finished);
55865595 /* Note: We don't need to worry about a race between this
@@ -5590,6 +5599,7 @@ static void hpsa_scan_start(struct Scsi_Host *sh) · 3 unmodified lines
55905599 */
55915600 }
55925601 h->scan_finished = 0; /* mark scan as in progress */
5602+ h->scan_waiting = 0;
55935603 spin_unlock_irqrestore(&h->scan_lock, flags);
55945604
55955605 if (unlikely(lockup_detected(h)))
@@ -8792,6 +8802,7 @@ reinit_after_soft_reset: · 3196 unmodified lines
87928802 init_waitqueue_head(&h->event_sync_wait_queue);
87938803 mutex_init(&h->reset_mutex);
87948804 h->scan_finished = 1; /* no scan currently in progress */
8805+ h->scan_waiting = 0;
87958806
87968807 pci_set_drvdata(pdev, h);
87978808 h->ndevices = 0;
drivers/scsi/hpsa.h+1−0
@@ -201,6 +201,7 @@ struct ctlr_info { · 200 unmodified lines
201201 dma_addr_t errinfo_pool_dhandle;
202202 unsigned long *cmd_pool_bits;
203203 int scan_finished;
204+ u8 scan_waiting : 1;
204205 spinlock_t scan_lock;
205206 wait_queue_head_t scan_wait_queue;
206207
drivers/scsi/hpsa_cmd.h+2−0
@@ -156,6 +156,7 @@ · 155 unmodified lines
156156 #define CFGTBL_BusType_Fibre2G 0x00000200l
157157
158158 /* VPD Inquiry types */
159+#define HPSA_INQUIRY_FAILED 0x02
159160 #define HPSA_VPD_SUPPORTED_PAGES 0x00
160161 #define HPSA_VPD_LV_DEVICE_ID 0x83
161162 #define HPSA_VPD_LV_DEVICE_GEOMETRY 0xC1
@@ -166,6 +167,7 @@ · 4 unmodified lines
166167 /* Logical volume states */
167168 #define HPSA_VPD_LV_STATUS_UNSUPPORTED 0xff
168169 #define HPSA_LV_OK 0x0
170+#define HPSA_LV_FAILED 0x01
169171 #define HPSA_LV_NOT_AVAILABLE 0x0b
170172 #define HPSA_LV_UNDERGOING_ERASE 0x0F
171173 #define HPSA_LV_UNDERGOING_RPI 0x12
drivers/scsi/lpfc/lpfc_attr.c+2−2
@@ -3315,9 +3315,9 @@ LPFC_ATTR_R(nvmet_mrq_post, LPFC_DEF_MRQ_POST, · 3314 unmodified lines
33153315 * lpfc_enable_fc4_type: Defines what FC4 types are supported.
33163316 * Supported Values: 1 - register just FCP
33173317 * 3 - register both FCP and NVME
3318− * Supported values are [1,3]. Default value is 3
3318+ * Supported values are [1,3]. Default value is 1
33193319 */
3320−LPFC_ATTR_R(enable_fc4_type, LPFC_ENABLE_BOTH,
3320+LPFC_ATTR_R(enable_fc4_type, LPFC_ENABLE_FCP,
33213321 LPFC_ENABLE_FCP, LPFC_ENABLE_BOTH,
33223322 "Define fc4 type to register with fabric.");
33233323
drivers/scsi/lpfc/lpfc_init.c+7−0
@@ -5891,10 +5891,17 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 5890 unmodified lines
58915891 /* Check to see if it matches any module parameter */
58925892 for (i = 0; i < lpfc_enable_nvmet_cnt; i++) {
58935893 if (wwn == lpfc_enable_nvmet[i]) {
5894+#if (IS_ENABLED(CONFIG_NVME_TARGET_FC))
58945895 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
58955896 "6017 NVME Target %016llx\n",
58965897 wwn);
58975898 phba->nvmet_support = 1; /* a match */
5899+#else
5900+ lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
5901+ "6021 Can't enable NVME Target."
5902+ " NVME_TARGET_FC infrastructure"
5903+ " is not in kernel\n");
5904+#endif
58985905 }
58995906 }
59005907 }
drivers/scsi/lpfc/lpfc_nvme.c+4−4
@@ -2149,7 +2149,7 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) · 2148 unmodified lines
21492149 /* localport is allocated from the stack, but the registration
21502150 * call allocates heap memory as well as the private area.
21512151 */
2152−#ifdef CONFIG_LPFC_NVME_INITIATOR
2152+#if (IS_ENABLED(CONFIG_NVME_FC))
21532153 ret = nvme_fc_register_localport(&nfcp_info, &lpfc_nvme_template,
21542154 &vport->phba->pcidev->dev, &localport);
21552155 #else
@@ -2190,7 +2190,7 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) · 34 unmodified lines
21902190 void
21912191 lpfc_nvme_destroy_localport(struct lpfc_vport *vport)
21922192 {
2193−#ifdef CONFIG_LPFC_NVME_INITIATOR
2193+#if (IS_ENABLED(CONFIG_NVME_FC))
21942194 struct nvme_fc_local_port *localport;
21952195 struct lpfc_nvme_lport *lport;
21962196 struct lpfc_nvme_rport *rport = NULL, *rport_next = NULL;
@@ -2274,7 +2274,7 @@ lpfc_nvme_update_localport(struct lpfc_vport *vport) · 77 unmodified lines
22742274 int
22752275 lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
22762276 {
2277−#ifdef CONFIG_LPFC_NVME_INITIATOR
2277+#if (IS_ENABLED(CONFIG_NVME_FC))
22782278 int ret = 0;
22792279 struct nvme_fc_local_port *localport;
22802280 struct lpfc_nvme_lport *lport;
@@ -2403,7 +2403,7 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 122 unmodified lines
24032403 void
24042404 lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
24052405 {
2406−#ifdef CONFIG_LPFC_NVME_INITIATOR
2406+#if (IS_ENABLED(CONFIG_NVME_FC))
24072407 int ret;
24082408 struct nvme_fc_local_port *localport;
24092409 struct lpfc_nvme_lport *lport;
drivers/scsi/lpfc/lpfc_nvmet.c+4−4
@@ -671,7 +671,7 @@ lpfc_nvmet_create_targetport(struct lpfc_hba *phba) · 670 unmodified lines
671671 lpfc_tgttemplate.target_features = NVMET_FCTGTFEAT_READDATA_RSP |
672672 NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED;
673673
674−#ifdef CONFIG_LPFC_NVME_TARGET
674+#if (IS_ENABLED(CONFIG_NVME_TARGET_FC))
675675 error = nvmet_fc_register_targetport(&pinfo, &lpfc_tgttemplate,
676676 &phba->pcidev->dev,
677677 &phba->targetport);
@@ -756,7 +756,7 @@ lpfc_sli4_nvmet_xri_aborted(struct lpfc_hba *phba, · 78 unmodified lines
756756 void
757757 lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba)
758758 {
759−#ifdef CONFIG_LPFC_NVME_TARGET
759+#if (IS_ENABLED(CONFIG_NVME_TARGET_FC))
760760 struct lpfc_nvmet_tgtport *tgtp;
761761
762762 if (phba->nvmet_support == 0)
@@ -788,7 +788,7 @@ static void · 25 unmodified lines
788788 lpfc_nvmet_unsol_ls_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
789789 struct hbq_dmabuf *nvmebuf)
790790 {
791−#ifdef CONFIG_LPFC_NVME_TARGET
791+#if (IS_ENABLED(CONFIG_NVME_TARGET_FC))
792792 struct lpfc_nvmet_tgtport *tgtp;
793793 struct fc_frame_header *fc_hdr;
794794 struct lpfc_nvmet_rcv_ctx *ctxp;
@@ -891,7 +891,7 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba, · 96 unmodified lines
891891 struct rqb_dmabuf *nvmebuf,
892892 uint64_t isr_timestamp)
893893 {
894−#ifdef CONFIG_LPFC_NVME_TARGET
894+#if (IS_ENABLED(CONFIG_NVME_TARGET_FC))
895895 struct lpfc_nvmet_rcv_ctx *ctxp;
896896 struct lpfc_nvmet_tgtport *tgtp;
897897 struct fc_frame_header *fc_hdr;
drivers/scsi/megaraid/megaraid_sas.h+2−2
@@ -35,8 +35,8 @@ · 34 unmodified lines
3535 /*
3636 * MegaRAID SAS Driver meta data
3737 */
38−#define MEGASAS_VERSION "07.701.16.00-rc1"
39−#define MEGASAS_RELDATE "February 2, 2017"
38+#define MEGASAS_VERSION "07.701.17.00-rc1"
39+#define MEGASAS_RELDATE "March 2, 2017"
4040
4141 /*
4242 * Device IDs
drivers/scsi/megaraid/megaraid_sas_base.c+12−5
@@ -1963,6 +1963,9 @@ scan_target: · 1962 unmodified lines
19631963 if (!mr_device_priv_data)
19641964 return -ENOMEM;
19651965 sdev->hostdata = mr_device_priv_data;
1966+
1967+ atomic_set(&mr_device_priv_data->r1_ldio_hint,
1968+ instance->r1_ldio_hint_default);
19661969 return 0;
19671970 }
19681971
@@ -5034,10 +5037,12 @@ megasas_setup_irqs_msix(struct megasas_instance *instance, u8 is_probe) · 3065 unmodified lines
50345037 &instance->irq_context[j]);
50355038 /* Retry irq register for IO_APIC*/
50365039 instance->msix_vectors = 0;
5037− if (is_probe)
5040+ if (is_probe) {
5041+ pci_free_irq_vectors(instance->pdev);
50385042 return megasas_setup_irqs_ioapic(instance);
5039− else
5043+ } else {
50405044 return -1;
5045+ }
50415046 }
50425047 }
50435048 return 0;
@@ -5277,9 +5282,11 @@ static int megasas_init_fw(struct megasas_instance *instance) · 233 unmodified lines
52775282 MPI2_REPLY_POST_HOST_INDEX_OFFSET);
52785283 }
52795284
5280− i = pci_alloc_irq_vectors(instance->pdev, 1, 1, PCI_IRQ_LEGACY);
5281− if (i < 0)
5282− goto fail_setup_irqs;
5285+ if (!instance->msix_vectors) {
5286+ i = pci_alloc_irq_vectors(instance->pdev, 1, 1, PCI_IRQ_LEGACY);
5287+ if (i < 0)
5288+ goto fail_setup_irqs;
5289+ }
52835290
52845291 dev_info(&instance->pdev->dev,
52855292 "firmware supports msix\t: (%d)", fw_msix_count);
drivers/scsi/megaraid/megaraid_sas_fusion.c+2−2
@@ -2159,7 +2159,7 @@ megasas_set_raidflag_cpu_affinity(union RAID_CONTEXT_UNION *praid_context, · 2158 unmodified lines
21592159 cpu_sel = MR_RAID_CTX_CPUSEL_1;
21602160
21612161 if (is_stream_detected(rctx_g35) &&
2162− (raid->level == 5) &&
2162+ ((raid->level == 5) || (raid->level == 6)) &&
21632163 (raid->writeMode == MR_RL_WRITE_THROUGH_MODE) &&
21642164 (cpu_sel == MR_RAID_CTX_CPUSEL_FCFS))
21652165 cpu_sel = MR_RAID_CTX_CPUSEL_0;
@@ -2338,7 +2338,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, · 172 unmodified lines
23382338 fp_possible = false;
23392339 atomic_dec(&instance->fw_outstanding);
23402340 } else if ((scsi_buff_len > MR_LARGE_IO_MIN_SIZE) ||
2341− atomic_dec_if_positive(&mrdev_priv->r1_ldio_hint)) {
2341+ (atomic_dec_if_positive(&mrdev_priv->r1_ldio_hint) > 0)) {
23422342 fp_possible = false;
23432343 atomic_dec(&instance->fw_outstanding);
23442344 if (scsi_buff_len > MR_LARGE_IO_MIN_SIZE)
drivers/scsi/ufs/ufshcd.c+1−1
@@ -7642,7 +7642,7 @@ static inline ssize_t ufshcd_pm_lvl_store(struct device *dev, · 7641 unmodified lines
76427642 if (kstrtoul(buf, 0, &value))
76437643 return -EINVAL;
76447644
7645− if ((value < UFS_PM_LVL_0) || (value >= UFS_PM_LVL_MAX))
7645+ if (value >= UFS_PM_LVL_MAX)
76467646 return -EINVAL;
76477647
76487648 spin_lock_irqsave(hba->host->host_lock, flags);
drivers/tty/serial/8250/8250_dw.c+7−2
@@ -257,7 +257,7 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, · 256 unmodified lines
257257 {
258258 unsigned int baud = tty_termios_baud_rate(termios);
259259 struct dw8250_data *d = p->private_data;
260− unsigned int rate;
260+ long rate;
261261 int ret;
262262
263263 if (IS_ERR(d->clk) || !old)
@@ -265,7 +265,12 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, · 1 unmodified line
265265
266266 clk_disable_unprepare(d->clk);
267267 rate = clk_round_rate(d->clk, baud * 16);
268− ret = clk_set_rate(d->clk, rate);
268+ if (rate < 0)
269+ ret = rate;
270+ else if (rate == 0)
271+ ret = -ENOENT;
272+ else
273+ ret = clk_set_rate(d->clk, rate);
269274 clk_prepare_enable(d->clk);
270275
271276 if (!ret)
drivers/tty/serial/amba-pl011.c+1−1
@@ -2373,7 +2373,7 @@ static int __init pl011_console_match(struct console *co, char *name, int idx, · 2372 unmodified lines
23732373 if (strcmp(name, "qdf2400_e44") == 0) {
23742374 pr_info_once("UART: Working around QDF2400 SoC erratum 44");
23752375 qdf2400_e44_present = true;
2376− } else if (strcmp(name, "pl011") != 0 || strcmp(name, "ttyAMA") != 0) {
2376+ } else if (strcmp(name, "pl011") != 0) {
23772377 return -ENODEV;
23782378 }
23792379
drivers/tty/serial/st-asc.c+6−5
@@ -575,12 +575,13 @@ static void asc_set_termios(struct uart_port *port, struct ktermios *termios, · 574 unmodified lines
575575 pinctrl_select_state(ascport->pinctrl,
576576 ascport->states[NO_HW_FLOWCTRL]);
577577
578− gpiod = devm_get_gpiod_from_child(port->dev, "rts",
579− &np->fwnode);
580− if (!IS_ERR(gpiod)) {
581− gpiod_direction_output(gpiod, 0);
578+ gpiod = devm_fwnode_get_gpiod_from_child(port->dev,
579+ "rts",
580+ &np->fwnode,
581+ GPIOD_OUT_LOW,
582+ np->name);
583+ if (!IS_ERR(gpiod))
582584 ascport->rts = gpiod;
583− }
584585 }
585586 }
586587
drivers/tty/tty_ldisc.c+21−71
@@ -271,10 +271,13 @@ const struct file_operations tty_ldiscs_proc_fops = { · 270 unmodified lines
271271
272272 struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *tty)
273273 {
274+ struct tty_ldisc *ld;
275+
274276 ldsem_down_read(&tty->ldisc_sem, MAX_SCHEDULE_TIMEOUT);
275− if (!tty->ldisc)
277+ ld = tty->ldisc;
278+ if (!ld)
276279 ldsem_up_read(&tty->ldisc_sem);
277− return tty->ldisc;
280+ return ld;
278281 }
279282 EXPORT_SYMBOL_GPL(tty_ldisc_ref_wait);
280283
@@ -488,41 +491,6 @@ static void tty_ldisc_close(struct tty_struct *tty, struct tty_ldisc *ld) · 207 unmodified lines
488491 tty_ldisc_debug(tty, "%p: closed\n", ld);
489492 }
490493
491−/**
492− * tty_ldisc_restore - helper for tty ldisc change
493− * @tty: tty to recover
494− * @old: previous ldisc
495− *
496− * Restore the previous line discipline or N_TTY when a line discipline
497− * change fails due to an open error
498− */
499−
500−static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old)
501−{
502− struct tty_ldisc *new_ldisc;
503− int r;
504−
505− /* There is an outstanding reference here so this is safe */
506− old = tty_ldisc_get(tty, old->ops->num);
507− WARN_ON(IS_ERR(old));
508− tty->ldisc = old;
509− tty_set_termios_ldisc(tty, old->ops->num);
510− if (tty_ldisc_open(tty, old) < 0) {
511− tty_ldisc_put(old);
512− /* This driver is always present */
513− new_ldisc = tty_ldisc_get(tty, N_TTY);
514− if (IS_ERR(new_ldisc))
515− panic("n_tty: get");
516− tty->ldisc = new_ldisc;
517− tty_set_termios_ldisc(tty, N_TTY);
518− r = tty_ldisc_open(tty, new_ldisc);
519− if (r < 0)
520− panic("Couldn't open N_TTY ldisc for "
521− "%s --- error %d.",
522− tty_name(tty), r);
523− }
524−}
525−
526494 /**
527495 * tty_set_ldisc - set line discipline
528496 * @tty: the terminal to set
@@ -536,12 +504,7 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) · 7 unmodified lines
536504
537505 int tty_set_ldisc(struct tty_struct *tty, int disc)
538506 {
539− int retval;
540− struct tty_ldisc *old_ldisc, *new_ldisc;
541−
542− new_ldisc = tty_ldisc_get(tty, disc);
543− if (IS_ERR(new_ldisc))
544− return PTR_ERR(new_ldisc);
507+ int retval, old_disc;
545508
546509 tty_lock(tty);
547510 retval = tty_ldisc_lock(tty, 5 * HZ);
@@ -554,7 +517,8 @@ int tty_set_ldisc(struct tty_struct *tty, int disc) · 6 unmodified lines
554517 }
555518
556519 /* Check the no-op case */
557− if (tty->ldisc->ops->num == disc)
520+ old_disc = tty->ldisc->ops->num;
521+ if (old_disc == disc)
558522 goto out;
559523
560524 if (test_bit(TTY_HUPPED, &tty->flags)) {
@@ -563,34 +527,25 @@ int tty_set_ldisc(struct tty_struct *tty, int disc) · 2 unmodified lines
563527 goto out;
564528 }
565529
566− old_ldisc = tty->ldisc;
567−
568− /* Shutdown the old discipline. */
569− tty_ldisc_close(tty, old_ldisc);
570−
571− /* Now set up the new line discipline. */
572− tty->ldisc = new_ldisc;
573− tty_set_termios_ldisc(tty, disc);
574−
575− retval = tty_ldisc_open(tty, new_ldisc);
530+ retval = tty_ldisc_reinit(tty, disc);
576531 if (retval < 0) {
577532 /* Back to the old one or N_TTY if we can't */
578− tty_ldisc_put(new_ldisc);
579− tty_ldisc_restore(tty, old_ldisc);
533+ if (tty_ldisc_reinit(tty, old_disc) < 0) {
534+ pr_err("tty: TIOCSETD failed, reinitializing N_TTY\n");
535+ if (tty_ldisc_reinit(tty, N_TTY) < 0) {
536+ /* At this point we have tty->ldisc == NULL. */
537+ pr_err("tty: reinitializing N_TTY failed\n");
538+ }
539+ }
580540 }
581541
582− if (tty->ldisc->ops->num != old_ldisc->ops->num && tty->ops->set_ldisc) {
542+ if (tty->ldisc && tty->ldisc->ops->num != old_disc &&
543+ tty->ops->set_ldisc) {
583544 down_read(&tty->termios_rwsem);
584545 tty->ops->set_ldisc(tty);
585546 up_read(&tty->termios_rwsem);
586547 }
587548
588− /* At this point we hold a reference to the new ldisc and a
589− reference to the old ldisc, or we hold two references to
590− the old ldisc (if it was restored as part of error cleanup
591− above). In either case, releasing a single reference from
592− the old ldisc is correct. */
593− new_ldisc = old_ldisc;
594549 out:
595550 tty_ldisc_unlock(tty);
596551
@@ -598,7 +553,6 @@ out: · 1 unmodified line
598553 already running */
599554 tty_buffer_restart_work(tty->port);
600555 err:
601− tty_ldisc_put(new_ldisc); /* drop the extra reference */
602556 tty_unlock(tty);
603557 return retval;
604558 }
@@ -659,10 +613,8 @@ int tty_ldisc_reinit(struct tty_struct *tty, int disc) · 54 unmodified lines
659613 int retval;
660614
661615 ld = tty_ldisc_get(tty, disc);
662− if (IS_ERR(ld)) {
663− BUG_ON(disc == N_TTY);
616+ if (IS_ERR(ld))
664617 return PTR_ERR(ld);
665− }
666618
667619 if (tty->ldisc) {
668620 tty_ldisc_close(tty, tty->ldisc);
@@ -674,10 +626,8 @@ int tty_ldisc_reinit(struct tty_struct *tty, int disc) · 5 unmodified lines
674626 tty_set_termios_ldisc(tty, disc);
675627 retval = tty_ldisc_open(tty, tty->ldisc);
676628 if (retval) {
677− if (!WARN_ON(disc == N_TTY)) {
678− tty_ldisc_put(tty->ldisc);
679− tty->ldisc = NULL;
680− }
629+ tty_ldisc_put(tty->ldisc);
630+ tty->ldisc = NULL;
681631 }
682632 return retval;
683633 }
drivers/usb/class/usbtmc.c+15−3
@@ -1381,7 +1381,7 @@ static int usbtmc_probe(struct usb_interface *intf, · 1380 unmodified lines
13811381
13821382 dev_dbg(&intf->dev, "%s called\n", __func__);
13831383
1384− data = kmalloc(sizeof(*data), GFP_KERNEL);
1384+ data = kzalloc(sizeof(*data), GFP_KERNEL);
13851385 if (!data)
13861386 return -ENOMEM;
13871387
@@ -1444,6 +1444,13 @@ static int usbtmc_probe(struct usb_interface *intf, · 56 unmodified lines
14441444 break;
14451445 }
14461446 }
1447+
1448+ if (!data->bulk_out || !data->bulk_in) {
1449+ dev_err(&intf->dev, "bulk endpoints not found\n");
1450+ retcode = -ENODEV;
1451+ goto err_put;
1452+ }
1453+
14471454 /* Find int endpoint */
14481455 for (n = 0; n < iface_desc->desc.bNumEndpoints; n++) {
14491456 endpoint = &iface_desc->endpoint[n].desc;
@@ -1469,8 +1476,10 @@ static int usbtmc_probe(struct usb_interface *intf, · 19 unmodified lines
14691476 if (data->iin_ep_present) {
14701477 /* allocate int urb */
14711478 data->iin_urb = usb_alloc_urb(0, GFP_KERNEL);
1472− if (!data->iin_urb)
1479+ if (!data->iin_urb) {
1480+ retcode = -ENOMEM;
14731481 goto error_register;
1482+ }
14741483
14751484 /* Protect interrupt in endpoint data until iin_urb is freed */
14761485 kref_get(&data->kref);
@@ -1478,8 +1487,10 @@ static int usbtmc_probe(struct usb_interface *intf, · 1 unmodified line
14781487 /* allocate buffer for interrupt in */
14791488 data->iin_buffer = kmalloc(data->iin_wMaxPacketSize,
14801489 GFP_KERNEL);
1481− if (!data->iin_buffer)
1490+ if (!data->iin_buffer) {
1491+ retcode = -ENOMEM;
14821492 goto error_register;
1493+ }
14831494
14841495 /* fill interrupt urb */
14851496 usb_fill_int_urb(data->iin_urb, data->usb_dev,
@@ -1512,6 +1523,7 @@ error_register: · 26 unmodified lines
15121523 sysfs_remove_group(&intf->dev.kobj, &capability_attr_grp);
15131524 sysfs_remove_group(&intf->dev.kobj, &data_attr_grp);
15141525 usbtmc_free_int(data);
1526+err_put:
15151527 kref_put(&data->kref, usbtmc_delete);
15161528 return retcode;
15171529 }
drivers/usb/core/config.c+10−0
@@ -280,6 +280,16 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, · 279 unmodified lines
280280
281281 /*
282282 * Adjust bInterval for quirked devices.
283+ */
284+ /*
285+ * This quirk fixes bIntervals reported in ms.
286+ */
287+ if (to_usb_device(ddev)->quirks &
288+ USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL) {
289+ n = clamp(fls(d->bInterval) + 3, i, j);
290+ i = j = n;
291+ }
292+ /*
283293 * This quirk fixes bIntervals reported in
284294 * linear microframes.
285295 */
drivers/usb/core/hub.c+1−1
@@ -4275,7 +4275,7 @@ static void hub_set_initial_usb2_lpm_policy(struct usb_device *udev) · 4274 unmodified lines
42754275 struct usb_hub *hub = usb_hub_to_struct_hub(udev->parent);
42764276 int connect_type = USB_PORT_CONNECT_TYPE_UNKNOWN;
42774277
4278− if (!udev->usb2_hw_lpm_capable)
4278+ if (!udev->usb2_hw_lpm_capable || !udev->bos)
42794279 return;
42804280
42814281 if (hub)
drivers/usb/core/quirks.c+8−0
@@ -170,6 +170,14 @@ static const struct usb_device_id usb_quirk_list[] = { · 169 unmodified lines
170170 /* M-Systems Flash Disk Pioneers */
171171 { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
172172
173+ /* Baum Vario Ultra */
174+ { USB_DEVICE(0x0904, 0x6101), .driver_info =
175+ USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL },
176+ { USB_DEVICE(0x0904, 0x6102), .driver_info =
177+ USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL },
178+ { USB_DEVICE(0x0904, 0x6103), .driver_info =
179+ USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL },
180+
173181 /* Keytouch QWERTY Panel keyboard */
174182 { USB_DEVICE(0x0926, 0x3333), .driver_info =
175183 USB_QUIRK_CONFIG_INTF_STRINGS },
drivers/usb/dwc3/gadget.c+17−4
@@ -171,6 +171,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, · 170 unmodified lines
171171 int status)
172172 {
173173 struct dwc3 *dwc = dep->dwc;
174+ unsigned int unmap_after_complete = false;
174175
175176 req->started = false;
176177 list_del(&req->list);
@@ -180,11 +181,19 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, · 3 unmodified lines
180181 if (req->request.status == -EINPROGRESS)
181182 req->request.status = status;
182183
183− if (dwc->ep0_bounced && dep->number <= 1)
184+ /*
185+ * NOTICE we don't want to unmap before calling ->complete() if we're
186+ * dealing with a bounced ep0 request. If we unmap it here, we would end
187+ * up overwritting the contents of req->buf and this could confuse the
188+ * gadget driver.
189+ */
190+ if (dwc->ep0_bounced && dep->number <= 1) {
184191 dwc->ep0_bounced = false;
185−
186− usb_gadget_unmap_request_by_dev(dwc->sysdev,
187− &req->request, req->direction);
192+ unmap_after_complete = true;
193+ } else {
194+ usb_gadget_unmap_request_by_dev(dwc->sysdev,
195+ &req->request, req->direction);
196+ }
188197
189198 trace_dwc3_gadget_giveback(req);
190199
@@ -192,6 +201,10 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, · 1 unmodified line
192201 usb_gadget_giveback_request(&dep->endpoint, &req->request);
193202 spin_lock(&dwc->lock);
194203
204+ if (unmap_after_complete)
205+ usb_gadget_unmap_request_by_dev(dwc->sysdev,
206+ &req->request, req->direction);
207+
195208 if (dep->number > 1)
196209 pm_runtime_put(dwc->dev);
197210 }
drivers/usb/gadget/function/f_acm.c+3−1
@@ -535,13 +535,15 @@ static int acm_notify_serial_state(struct f_acm *acm) · 534 unmodified lines
535535 {
536536 struct usb_composite_dev *cdev = acm->port.func.config->cdev;
537537 int status;
538+ __le16 serial_state;
538539
539540 spin_lock(&acm->lock);
540541 if (acm->notify_req) {
541542 dev_dbg(&cdev->gadget->dev, "acm ttyGS%d serial state %04x\n",
542543 acm->port_num, acm->serial_state);
544+ serial_state = cpu_to_le16(acm->serial_state);
543545 status = acm_cdc_notify(acm, USB_CDC_NOTIFY_SERIAL_STATE,
544− 0, &acm->serial_state, sizeof(acm->serial_state));
546+ 0, &serial_state, sizeof(acm->serial_state));
545547 } else {
546548 acm->pending = true;
547549 status = 0;
drivers/usb/gadget/function/f_hid.c+4−4
@@ -367,7 +367,7 @@ try_again: · 366 unmodified lines
367367 count = min_t(unsigned, count, hidg->report_length);
368368
369369 spin_unlock_irqrestore(&hidg->write_spinlock, flags);
370− status = copy_from_user(hidg->req->buf, buffer, count);
370+ status = copy_from_user(req->buf, buffer, count);
371371
372372 if (status != 0) {
373373 ERROR(hidg->func.config->cdev,
@@ -378,9 +378,9 @@ try_again: · 4 unmodified lines
378378
379379 spin_lock_irqsave(&hidg->write_spinlock, flags);
380380
381− /* we our function has been disabled by host */
381+ /* when our function has been disabled by host */
382382 if (!hidg->req) {
383− free_ep_req(hidg->in_ep, hidg->req);
383+ free_ep_req(hidg->in_ep, req);
384384 /*
385385 * TODO
386386 * Should we fail with error here?
@@ -394,7 +394,7 @@ try_again: · 7 unmodified lines
394394 req->complete = f_hidg_req_complete;
395395 req->context = hidg;
396396
397− status = usb_ep_queue(hidg->in_ep, hidg->req, GFP_ATOMIC);
397+ status = usb_ep_queue(hidg->in_ep, req, GFP_ATOMIC);
398398 if (status < 0) {
399399 ERROR(hidg->func.config->cdev,
400400 "usb_ep_queue error on int endpoint %zd\n", status);
drivers/usb/gadget/function/f_uvc.c+9−1
@@ -594,6 +594,14 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f) · 593 unmodified lines
594594 opts->streaming_maxpacket = clamp(opts->streaming_maxpacket, 1U, 3072U);
595595 opts->streaming_maxburst = min(opts->streaming_maxburst, 15U);
596596
597+ /* For SS, wMaxPacketSize has to be 1024 if bMaxBurst is not 0 */
598+ if (opts->streaming_maxburst &&
599+ (opts->streaming_maxpacket % 1024) != 0) {
600+ opts->streaming_maxpacket = roundup(opts->streaming_maxpacket, 1024);
601+ INFO(cdev, "overriding streaming_maxpacket to %d\n",
602+ opts->streaming_maxpacket);
603+ }
604+
597605 /* Fill in the FS/HS/SS Video Streaming specific descriptors from the
598606 * module parameters.
599607 *
@@ -625,7 +633,7 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f) · 25 unmodified lines
625633 uvc_ss_streaming_comp.bMaxBurst = opts->streaming_maxburst;
626634 uvc_ss_streaming_comp.wBytesPerInterval =
627635 cpu_to_le16(max_packet_size * max_packet_mult *
628− opts->streaming_maxburst);
636+ (opts->streaming_maxburst + 1));
629637
630638 /* Allocate endpoints. */
631639 ep = usb_ep_autoconfig(cdev->gadget, &uvc_control_ep);
drivers/usb/gadget/udc/pch_udc.c+0−1
@@ -1523,7 +1523,6 @@ static void pch_udc_free_dma_chain(struct pch_udc_dev *dev, · 1522 unmodified lines
15231523 td = phys_to_virt(addr);
15241524 addr2 = (dma_addr_t)td->next;
15251525 pci_pool_free(dev->data_requests, td, addr);
1526− td->next = 0x00;
15271526 addr = addr2;
15281527 }
15291528 req->chain_len = 1;
drivers/usb/misc/idmouse.c+3−0
@@ -347,6 +347,9 @@ static int idmouse_probe(struct usb_interface *interface, · 346 unmodified lines
347347 if (iface_desc->desc.bInterfaceClass != 0x0A)
348348 return -ENODEV;
349349
350+ if (iface_desc->desc.bNumEndpoints < 1)
351+ return -ENODEV;
352+
350353 /* allocate memory for our device state and initialize it */
351354 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
352355 if (dev == NULL)
drivers/usb/misc/lvstest.c+4−0
@@ -366,6 +366,10 @@ static int lvs_rh_probe(struct usb_interface *intf, · 365 unmodified lines
366366
367367 hdev = interface_to_usbdev(intf);
368368 desc = intf->cur_altsetting;
369+
370+ if (desc->desc.bNumEndpoints < 1)
371+ return -ENODEV;
372+
369373 endpoint = &desc->endpoint[0].desc;
370374
371375 /* valid only for SS root hub */
drivers/usb/misc/uss720.c+5−0
@@ -709,6 +709,11 @@ static int uss720_probe(struct usb_interface *intf, · 708 unmodified lines
709709
710710 interface = intf->cur_altsetting;
711711
712+ if (interface->desc.bNumEndpoints < 3) {
713+ usb_put_dev(usbdev);
714+ return -ENODEV;
715+ }
716+
712717 /*
713718 * Allocate parport interface
714719 */
drivers/usb/musb/musb_core.c+1−1
@@ -2490,8 +2490,8 @@ static int musb_remove(struct platform_device *pdev) · 2489 unmodified lines
24902490 musb_host_cleanup(musb);
24912491 musb_gadget_cleanup(musb);
24922492
2493− spin_lock_irqsave(&musb->lock, flags);
24942493 musb_platform_disable(musb);
2494+ spin_lock_irqsave(&musb->lock, flags);
24952495 musb_disable_interrupts(musb);
24962496 musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
24972497 spin_unlock_irqrestore(&musb->lock, flags);
drivers/usb/musb/musb_cppi41.c+21−2
@@ -238,8 +238,27 @@ static void cppi41_dma_callback(void *private_data, · 237 unmodified lines
238238 transferred < cppi41_channel->packet_sz)
239239 cppi41_channel->prog_len = 0;
240240
241− if (cppi41_channel->is_tx)
242− empty = musb_is_tx_fifo_empty(hw_ep);
241+ if (cppi41_channel->is_tx) {
242+ u8 type;
243+
244+ if (is_host_active(musb))
245+ type = hw_ep->out_qh->type;
246+ else
247+ type = hw_ep->ep_in.type;
248+
249+ if (type == USB_ENDPOINT_XFER_ISOC)
250+ /*
251+ * Don't use the early-TX-interrupt workaround below
252+ * for Isoch transfter. Since Isoch are periodic
253+ * transfer, by the time the next transfer is
254+ * scheduled, the current one should be done already.
255+ *
256+ * This avoids audio playback underrun issue.
257+ */
258+ empty = true;
259+ else
260+ empty = musb_is_tx_fifo_empty(hw_ep);
261+ }
243262
244263 if (!cppi41_channel->is_tx || empty) {
245264 cppi41_trans_done(cppi41_channel);
drivers/usb/musb/musb_dsps.c+4−1
@@ -933,7 +933,7 @@ static int dsps_probe(struct platform_device *pdev) · 932 unmodified lines
933933 if (usb_get_dr_mode(&pdev->dev) == USB_DR_MODE_PERIPHERAL) {
934934 ret = dsps_setup_optional_vbus_irq(pdev, glue);
935935 if (ret)
936− return ret;
936+ goto err_iounmap;
937937 }
938938
939939 platform_set_drvdata(pdev, glue);
@@ -946,6 +946,8 @@ static int dsps_probe(struct platform_device *pdev) · 6 unmodified lines
946946
947947 err:
948948 pm_runtime_disable(&pdev->dev);
949+err_iounmap:
950+ iounmap(glue->usbss_base);
949951 return ret;
950952 }
951953
@@ -956,6 +958,7 @@ static int dsps_remove(struct platform_device *pdev) · 4 unmodified lines
956958 platform_device_unregister(glue->musb);
957959
958960 pm_runtime_disable(&pdev->dev);
961+ iounmap(glue->usbss_base);
959962
960963 return 0;
961964 }
drivers/usb/serial/option.c+16−1
@@ -233,6 +233,14 @@ static void option_instat_callback(struct urb *urb); · 232 unmodified lines
233233 #define BANDRICH_PRODUCT_1012 0x1012
234234
235235 #define QUALCOMM_VENDOR_ID 0x05C6
236+/* These Quectel products use Qualcomm's vendor ID */
237+#define QUECTEL_PRODUCT_UC20 0x9003
238+#define QUECTEL_PRODUCT_UC15 0x9090
239+
240+#define QUECTEL_VENDOR_ID 0x2c7c
241+/* These Quectel products use Quectel's vendor ID */
242+#define QUECTEL_PRODUCT_EC21 0x0121
243+#define QUECTEL_PRODUCT_EC25 0x0125
236244
237245 #define CMOTECH_VENDOR_ID 0x16d8
238246 #define CMOTECH_PRODUCT_6001 0x6001
@@ -1161,7 +1169,14 @@ static const struct usb_device_id option_ids[] = { · 922 unmodified lines
11611169 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
11621170 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */
11631171 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */
1164− { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9003), /* Quectel UC20 */
1172+ /* Quectel products using Qualcomm vendor ID */
1173+ { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)},
1174+ { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20),
1175+ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1176+ /* Quectel products using Quectel vendor ID */
1177+ { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),
1178+ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1179+ { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25),
11651180 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
11661181 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
11671182 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
drivers/usb/serial/qcserial.c+2−0
@@ -169,6 +169,8 @@ static const struct usb_device_id id_table[] = { · 168 unmodified lines
169169 {DEVICE_SWI(0x413c, 0x81a9)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */
170170 {DEVICE_SWI(0x413c, 0x81b1)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */
171171 {DEVICE_SWI(0x413c, 0x81b3)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */
172+ {DEVICE_SWI(0x413c, 0x81b5)}, /* Dell Wireless 5811e QDL */
173+ {DEVICE_SWI(0x413c, 0x81b6)}, /* Dell Wireless 5811e QDL */
172174
173175 /* Huawei devices */
174176 {DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */
drivers/usb/wusbcore/wa-hc.c+3−0
@@ -39,6 +39,9 @@ int wa_create(struct wahc *wa, struct usb_interface *iface, · 38 unmodified lines
3939 int result;
4040 struct device *dev = &iface->dev;
4141
42+ if (iface->cur_altsetting->desc.bNumEndpoints < 3)
43+ return -ENODEV;
44+
4245 result = wa_rpipes_create(wa);
4346 if (result < 0)
4447 goto error_rpipes_create;
drivers/uwb/hwa-rc.c+3−0
@@ -823,6 +823,9 @@ static int hwarc_probe(struct usb_interface *iface, · 822 unmodified lines
823823 struct hwarc *hwarc;
824824 struct device *dev = &iface->dev;
825825
826+ if (iface->cur_altsetting->desc.bNumEndpoints < 1)
827+ return -ENODEV;
828+
826829 result = -ENOMEM;
827830 uwb_rc = uwb_rc_alloc();
828831 if (uwb_rc == NULL) {
drivers/uwb/i1480/dfu/usb.c+3−0
@@ -362,6 +362,9 @@ int i1480_usb_probe(struct usb_interface *iface, const struct usb_device_id *id) · 361 unmodified lines
362362 result);
363363 }
364364
365+ if (iface->cur_altsetting->desc.bNumEndpoints < 1)
366+ return -ENODEV;
367+
365368 result = -ENOMEM;
366369 i1480_usb = kzalloc(sizeof(*i1480_usb), GFP_KERNEL);
367370 if (i1480_usb == NULL) {
drivers/vfio/vfio.c+5−3
@@ -403,6 +403,7 @@ static void vfio_group_release(struct kref *kref) · 402 unmodified lines
403403 struct iommu_group *iommu_group = group->iommu_group;
404404
405405 WARN_ON(!list_empty(&group->device_list));
406+ WARN_ON(group->notifier.head);
406407
407408 list_for_each_entry_safe(unbound, tmp,
408409 &group->unbound_list, unbound_next) {
@@ -1573,6 +1574,10 @@ static int vfio_group_fops_open(struct inode *inode, struct file *filep) · 1164 unmodified lines
15731574 return -EBUSY;
15741575 }
15751576
1577+ /* Warn if previous user didn't cleanup and re-init to drop them */
1578+ if (WARN_ON(group->notifier.head))
1579+ BLOCKING_INIT_NOTIFIER_HEAD(&group->notifier);
1580+
15761581 filep->private_data = group;
15771582
15781583 return 0;
@@ -1584,9 +1589,6 @@ static int vfio_group_fops_release(struct inode *inode, struct file *filep) · 5 unmodified lines
15841589
15851590 filep->private_data = NULL;
15861591
1587− /* Any user didn't unregister? */
1588− WARN_ON(group->notifier.head);
1589−
15901592 vfio_group_try_dissolve_container(group);
15911593
15921594 atomic_dec(&group->opened);
drivers/vfio/vfio_iommu_type1.c+3−4
@@ -1182,8 +1182,7 @@ static struct vfio_group *find_iommu_group(struct vfio_domain *domain, · 1181 unmodified lines
11821182 return NULL;
11831183 }
11841184
1185−static bool vfio_iommu_has_resv_msi(struct iommu_group *group,
1186− phys_addr_t *base)
1185+static bool vfio_iommu_has_sw_msi(struct iommu_group *group, phys_addr_t *base)
11871186 {
11881187 struct list_head group_resv_regions;
11891188 struct iommu_resv_region *region, *next;
@@ -1192,7 +1191,7 @@ static bool vfio_iommu_has_resv_msi(struct iommu_group *group, · 2 unmodified lines
11921191 INIT_LIST_HEAD(&group_resv_regions);
11931192 iommu_get_group_resv_regions(group, &group_resv_regions);
11941193 list_for_each_entry(region, &group_resv_regions, list) {
1195− if (region->type & IOMMU_RESV_MSI) {
1194+ if (region->type == IOMMU_RESV_SW_MSI) {
11961195 *base = region->start;
11971196 ret = true;
11981197 goto out;
@@ -1283,7 +1282,7 @@ static int vfio_iommu_type1_attach_group(void *iommu_data, · 84 unmodified lines
12831282 if (ret)
12841283 goto out_domain;
12851284
1286− resv_msi = vfio_iommu_has_resv_msi(iommu_group, &resv_msi_base);
1285+ resv_msi = vfio_iommu_has_sw_msi(iommu_group, &resv_msi_base);
12871286
12881287 INIT_LIST_HEAD(&domain->group_list);
12891288 list_add(&group->next, &domain->group_list);
drivers/vhost/vsock.c+41−0
@@ -223,6 +223,46 @@ vhost_transport_send_pkt(struct virtio_vsock_pkt *pkt) · 222 unmodified lines
223223 return len;
224224 }
225225
226+static int
227+vhost_transport_cancel_pkt(struct vsock_sock *vsk)
228+{
229+ struct vhost_vsock *vsock;
230+ struct virtio_vsock_pkt *pkt, *n;
231+ int cnt = 0;
232+ LIST_HEAD(freeme);
233+
234+ /* Find the vhost_vsock according to guest context id */
235+ vsock = vhost_vsock_get(vsk->remote_addr.svm_cid);
236+ if (!vsock)
237+ return -ENODEV;
238+
239+ spin_lock_bh(&vsock->send_pkt_list_lock);
240+ list_for_each_entry_safe(pkt, n, &vsock->send_pkt_list, list) {
241+ if (pkt->vsk != vsk)
242+ continue;
243+ list_move(&pkt->list, &freeme);
244+ }
245+ spin_unlock_bh(&vsock->send_pkt_list_lock);
246+
247+ list_for_each_entry_safe(pkt, n, &freeme, list) {
248+ if (pkt->reply)
249+ cnt++;
250+ list_del(&pkt->list);
251+ virtio_transport_free_pkt(pkt);
252+ }
253+
254+ if (cnt) {
255+ struct vhost_virtqueue *tx_vq = &vsock->vqs[VSOCK_VQ_TX];
256+ int new_cnt;
257+
258+ new_cnt = atomic_sub_return(cnt, &vsock->queued_replies);
259+ if (new_cnt + cnt >= tx_vq->num && new_cnt < tx_vq->num)
260+ vhost_poll_queue(&tx_vq->poll);
261+ }
262+
263+ return 0;
264+}
265+
226266 static struct virtio_vsock_pkt *
227267 vhost_vsock_alloc_pkt(struct vhost_virtqueue *vq,
228268 unsigned int out, unsigned int in)
@@ -675,6 +715,7 @@ static struct virtio_transport vhost_transport = { · 446 unmodified lines
675715 .release = virtio_transport_release,
676716 .connect = virtio_transport_connect,
677717 .shutdown = virtio_transport_shutdown,
718+ .cancel_pkt = vhost_transport_cancel_pkt,
678719
679720 .dgram_enqueue = virtio_transport_dgram_enqueue,
680721 .dgram_dequeue = virtio_transport_dgram_dequeue,
drivers/xen/xen-acpi-processor.c+27−9
@@ -27,10 +27,10 @@ · 26 unmodified lines
2727 #include <linux/init.h>
2828 #include <linux/module.h>
2929 #include <linux/types.h>
30+#include <linux/syscore_ops.h>
3031 #include <linux/acpi.h>
3132 #include <acpi/processor.h>
3233 #include <xen/xen.h>
33−#include <xen/xen-ops.h>
3434 #include <xen/interface/platform.h>
3535 #include <asm/xen/hypercall.h>
3636
@@ -408,7 +408,7 @@ static int check_acpi_ids(struct acpi_processor *pr_backup) · 371 unmodified lines
408408 acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
409409 ACPI_UINT32_MAX,
410410 read_acpi_id, NULL, NULL, NULL);
411− acpi_get_devices("ACPI0007", read_acpi_id, NULL, NULL);
411+ acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, read_acpi_id, NULL, NULL);
412412
413413 upload:
414414 if (!bitmap_equal(acpi_id_present, acpi_ids_done, nr_acpi_bits)) {
@@ -466,15 +466,33 @@ static int xen_upload_processor_pm_data(void) · 51 unmodified lines
466466 return rc;
467467 }
468468
469−static int xen_acpi_processor_resume(struct notifier_block *nb,
470− unsigned long action, void *data)
469+static void xen_acpi_processor_resume_worker(struct work_struct *dummy)
471470 {
471+ int rc;
472+
472473 bitmap_zero(acpi_ids_done, nr_acpi_bits);
473− return xen_upload_processor_pm_data();
474+
475+ rc = xen_upload_processor_pm_data();
476+ if (rc != 0)
477+ pr_info("ACPI data upload failed, error = %d\n", rc);
478+}
479+
480+static void xen_acpi_processor_resume(void)
481+{
482+ static DECLARE_WORK(wq, xen_acpi_processor_resume_worker);
483+
484+ /*
485+ * xen_upload_processor_pm_data() calls non-atomic code.
486+ * However, the context for xen_acpi_processor_resume is syscore
487+ * with only the boot CPU online and in an atomic context.
488+ *
489+ * So defer the upload for some point safer.
490+ */
491+ schedule_work(&wq);
474492 }
475493
476−struct notifier_block xen_acpi_processor_resume_nb = {
477− .notifier_call = xen_acpi_processor_resume,
494+static struct syscore_ops xap_syscore_ops = {
495+ .resume = xen_acpi_processor_resume,
478496 };
479497
480498 static int __init xen_acpi_processor_init(void)
@@ -527,7 +545,7 @@ static int __init xen_acpi_processor_init(void) · 46 unmodified lines
527545 if (rc)
528546 goto err_unregister;
529547
530− xen_resume_notifier_register(&xen_acpi_processor_resume_nb);
548+ register_syscore_ops(&xap_syscore_ops);
531549
532550 return 0;
533551 err_unregister:
@@ -544,7 +562,7 @@ static void __exit xen_acpi_processor_exit(void) · 10 unmodified lines
544562 {
545563 int i;
546564
547− xen_resume_notifier_unregister(&xen_acpi_processor_resume_nb);
565+ unregister_syscore_ops(&xap_syscore_ops);
548566 kfree(acpi_ids_done);
549567 kfree(acpi_id_present);
550568 kfree(acpi_id_cst_present);
fs/btrfs/extent_io.c+2−1
@@ -1714,7 +1714,8 @@ static int __process_pages_contig(struct address_space *mapping, · 1713 unmodified lines
17141714 * can we find nothing at @index.
17151715 */
17161716 ASSERT(page_ops & PAGE_LOCK);
1717− return ret;
1717+ err = -EAGAIN;
1718+ goto out;
17181719 }
17191720
17201721 for (i = 0; i < ret; i++) {
fs/btrfs/inode.c+14−0
@@ -6709,6 +6709,20 @@ static noinline int uncompress_inline(struct btrfs_path *path, · 6708 unmodified lines
67096709 max_size = min_t(unsigned long, PAGE_SIZE, max_size);
67106710 ret = btrfs_decompress(compress_type, tmp, page,
67116711 extent_offset, inline_size, max_size);
6712+
6713+ /*
6714+ * decompression code contains a memset to fill in any space between the end
6715+ * of the uncompressed data and the end of max_size in case the decompressed
6716+ * data ends up shorter than ram_bytes. That doesn't cover the hole between
6717+ * the end of an inline extent and the beginning of the next block, so we
6718+ * cover that region here.
6719+ */
6720+
6721+ if (max_size + pg_offset < PAGE_SIZE) {
6722+ char *map = kmap(page);
6723+ memset(map + pg_offset + max_size, 0, PAGE_SIZE - max_size - pg_offset);
6724+ kunmap(page);
6725+ }
67126726 kfree(tmp);
67136727 return ret;
67146728 }
fs/crypto/crypto.c+1−9
@@ -327,7 +327,6 @@ EXPORT_SYMBOL(fscrypt_decrypt_page); · 326 unmodified lines
327327 static int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags)
328328 {
329329 struct dentry *dir;
330− struct fscrypt_info *ci;
331330 int dir_has_key, cached_with_key;
332331
333332 if (flags & LOOKUP_RCU)
@@ -339,18 +338,11 @@ static int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags) · 5 unmodified lines
339338 return 0;
340339 }
341340
342− ci = d_inode(dir)->i_crypt_info;
343− if (ci && ci->ci_keyring_key &&
344− (ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) |
345− (1 << KEY_FLAG_REVOKED) |
346− (1 << KEY_FLAG_DEAD))))
347− ci = NULL;
348−
349341 /* this should eventually be an flag in d_flags */
350342 spin_lock(&dentry->d_lock);
351343 cached_with_key = dentry->d_flags & DCACHE_ENCRYPTED_WITH_KEY;
352344 spin_unlock(&dentry->d_lock);
353− dir_has_key = (ci != NULL);
345+ dir_has_key = (d_inode(dir)->i_crypt_info != NULL);
354346 dput(dir);
355347
356348 /*
fs/crypto/fname.c+1−1
@@ -350,7 +350,7 @@ int fscrypt_setup_filename(struct inode *dir, const struct qstr *iname, · 349 unmodified lines
350350 fname->disk_name.len = iname->len;
351351 return 0;
352352 }
353− ret = fscrypt_get_crypt_info(dir);
353+ ret = fscrypt_get_encryption_info(dir);
354354 if (ret && ret != -EOPNOTSUPP)
355355 return ret;
356356
fs/crypto/fscrypt_private.h+0−4
@@ -67,7 +67,6 @@ struct fscrypt_info { · 66 unmodified lines
6767 u8 ci_filename_mode;
6868 u8 ci_flags;
6969 struct crypto_skcipher *ci_ctfm;
70− struct key *ci_keyring_key;
7170 u8 ci_master_key[FS_KEY_DESCRIPTOR_SIZE];
7271 };
7372
@@ -101,7 +100,4 @@ extern int fscrypt_do_page_crypto(const struct inode *inode, · 27 unmodified lines
101100 extern struct page *fscrypt_alloc_bounce_page(struct fscrypt_ctx *ctx,
102101 gfp_t gfp_flags);
103102
104−/* keyinfo.c */
105−extern int fscrypt_get_crypt_info(struct inode *);
106−
107103 #endif /* _FSCRYPT_PRIVATE_H */
fs/crypto/keyinfo.c+9−43
@@ -95,6 +95,7 @@ static int validate_user_key(struct fscrypt_info *crypt_info, · 94 unmodified lines
9595 kfree(description);
9696 if (IS_ERR(keyring_key))
9797 return PTR_ERR(keyring_key);
98+ down_read(&keyring_key->sem);
9899
99100 if (keyring_key->type != &key_type_logon) {
100101 printk_once(KERN_WARNING
@@ -102,11 +103,9 @@ static int validate_user_key(struct fscrypt_info *crypt_info, · 1 unmodified line
102103 res = -ENOKEY;
103104 goto out;
104105 }
105− down_read(&keyring_key->sem);
106106 ukp = user_key_payload_locked(keyring_key);
107107 if (ukp->datalen != sizeof(struct fscrypt_key)) {
108108 res = -EINVAL;
109− up_read(&keyring_key->sem);
110109 goto out;
111110 }
112111 master_key = (struct fscrypt_key *)ukp->data;
@@ -117,17 +116,11 @@ static int validate_user_key(struct fscrypt_info *crypt_info, · 4 unmodified lines
117116 "%s: key size incorrect: %d\n",
118117 __func__, master_key->size);
119118 res = -ENOKEY;
120− up_read(&keyring_key->sem);
121119 goto out;
122120 }
123121 res = derive_key_aes(ctx->nonce, master_key->raw, raw_key);
124− up_read(&keyring_key->sem);
125− if (res)
126− goto out;
127−
128− crypt_info->ci_keyring_key = keyring_key;
129− return 0;
130122 out:
123+ up_read(&keyring_key->sem);
131124 key_put(keyring_key);
132125 return res;
133126 }
@@ -169,12 +162,11 @@ static void put_crypt_info(struct fscrypt_info *ci) · 35 unmodified lines
169162 if (!ci)
170163 return;
171164
172− key_put(ci->ci_keyring_key);
173165 crypto_free_skcipher(ci->ci_ctfm);
174166 kmem_cache_free(fscrypt_info_cachep, ci);
175167 }
176168
177−int fscrypt_get_crypt_info(struct inode *inode)
169+int fscrypt_get_encryption_info(struct inode *inode)
178170 {
179171 struct fscrypt_info *crypt_info;
180172 struct fscrypt_context ctx;
@@ -184,21 +176,15 @@ int fscrypt_get_crypt_info(struct inode *inode) · 3 unmodified lines
184176 u8 *raw_key = NULL;
185177 int res;
186178
179+ if (inode->i_crypt_info)
180+ return 0;
181+
187182 res = fscrypt_initialize(inode->i_sb->s_cop->flags);
188183 if (res)
189184 return res;
190185
191186 if (!inode->i_sb->s_cop->get_context)
192187 return -EOPNOTSUPP;
193−retry:
194− crypt_info = ACCESS_ONCE(inode->i_crypt_info);
195− if (crypt_info) {
196− if (!crypt_info->ci_keyring_key ||
197− key_validate(crypt_info->ci_keyring_key) == 0)
198− return 0;
199− fscrypt_put_encryption_info(inode, crypt_info);
200− goto retry;
201− }
202188
203189 res = inode->i_sb->s_cop->get_context(inode, &ctx, sizeof(ctx));
204190 if (res < 0) {
@@ -229,7 +215,6 @@ retry: · 24 unmodified lines
229215 crypt_info->ci_data_mode = ctx.contents_encryption_mode;
230216 crypt_info->ci_filename_mode = ctx.filenames_encryption_mode;
231217 crypt_info->ci_ctfm = NULL;
232− crypt_info->ci_keyring_key = NULL;
233218 memcpy(crypt_info->ci_master_key, ctx.master_key_descriptor,
234219 sizeof(crypt_info->ci_master_key));
235220
@@ -273,14 +258,8 @@ retry: · 37 unmodified lines
273258 if (res)
274259 goto out;
275260
276− kzfree(raw_key);
277− raw_key = NULL;
278− if (cmpxchg(&inode->i_crypt_info, NULL, crypt_info) != NULL) {
279− put_crypt_info(crypt_info);
280− goto retry;
281− }
282− return 0;
283−
261+ if (cmpxchg(&inode->i_crypt_info, NULL, crypt_info) == NULL)
262+ crypt_info = NULL;
284263 out:
285264 if (res == -ENOKEY)
286265 res = 0;
@@ -288,6 +267,7 @@ out: · 1 unmodified line
288267 kzfree(raw_key);
289268 return res;
290269 }
270+EXPORT_SYMBOL(fscrypt_get_encryption_info);
291271
292272 void fscrypt_put_encryption_info(struct inode *inode, struct fscrypt_info *ci)
293273 {
@@ -305,17 +285,3 @@ void fscrypt_put_encryption_info(struct inode *inode, struct fscrypt_info *ci) · 11 unmodified lines
305285 put_crypt_info(ci);
306286 }
307287 EXPORT_SYMBOL(fscrypt_put_encryption_info);
308−
309−int fscrypt_get_encryption_info(struct inode *inode)
310−{
311− struct fscrypt_info *ci = inode->i_crypt_info;
312−
313− if (!ci ||
314− (ci->ci_keyring_key &&
315− (ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) |
316− (1 << KEY_FLAG_REVOKED) |
317− (1 << KEY_FLAG_DEAD)))))
318− return fscrypt_get_crypt_info(inode);
319− return 0;
320−}
321−EXPORT_SYMBOL(fscrypt_get_encryption_info);
fs/crypto/policy.c+0−7
@@ -33,17 +33,10 @@ static int create_encryption_context_from_policy(struct inode *inode, · 32 unmodified lines
3333 const struct fscrypt_policy *policy)
3434 {
3535 struct fscrypt_context ctx;
36− int res;
3736
3837 if (!inode->i_sb->s_cop->set_context)
3938 return -EOPNOTSUPP;
4039
41− if (inode->i_sb->s_cop->prepare_context) {
42− res = inode->i_sb->s_cop->prepare_context(inode);
43− if (res)
44− return res;
45− }
46−
4740 ctx.format = FS_ENCRYPTION_CONTEXT_FORMAT_V1;
4841 memcpy(ctx.master_key_descriptor, policy->master_key_descriptor,
4942 FS_KEY_DESCRIPTOR_SIZE);
fs/ext4/inline.c+2−3
@@ -1169,10 +1169,9 @@ static int ext4_finish_convert_inline_dir(handle_t *handle, · 1168 unmodified lines
11691169 set_buffer_uptodate(dir_block);
11701170 err = ext4_handle_dirty_dirent_node(handle, inode, dir_block);
11711171 if (err)
1172− goto out;
1172+ return err;
11731173 set_buffer_verified(dir_block);
1174−out:
1175− return err;
1174+ return ext4_mark_inode_dirty(handle, inode);
11761175 }
11771176
11781177 static int ext4_convert_inline_data_nolock(handle_t *handle,
fs/ext4/inode.c+1−1
@@ -5400,7 +5400,7 @@ int ext4_getattr(const struct path *path, struct kstat *stat, · 5399 unmodified lines
54005400 * If there is inline data in the inode, the inode will normally not
54015401 * have data blocks allocated (it may have an external xattr block).
54025402 * Report at least one sector for such files, so tools like tar, rsync,
5403− * others doen't incorrectly think the file is completely sparse.
5403+ * others don't incorrectly think the file is completely sparse.
54045404 */
54055405 if (unlikely(ext4_has_inline_data(inode)))
54065406 stat->blocks += (stat->size + 511) >> 9;
fs/ext4/move_extent.c+1−1
@@ -511,7 +511,7 @@ mext_check_arguments(struct inode *orig_inode, · 510 unmodified lines
511511 if ((orig_start & ~(PAGE_MASK >> orig_inode->i_blkbits)) !=
512512 (donor_start & ~(PAGE_MASK >> orig_inode->i_blkbits))) {
513513 ext4_debug("ext4 move extent: orig and donor's start "
514− "offset are not alligned [ino:orig %lu, donor %lu]\n",
514+ "offsets are not aligned [ino:orig %lu, donor %lu]\n",
515515 orig_inode->i_ino, donor_inode->i_ino);
516516 return -EINVAL;
517517 }
fs/ext4/super.c+4−6
@@ -1120,17 +1120,16 @@ static int ext4_get_context(struct inode *inode, void *ctx, size_t len) · 1119 unmodified lines
11201120 EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, ctx, len);
11211121 }
11221122
1123−static int ext4_prepare_context(struct inode *inode)
1124−{
1125− return ext4_convert_inline_data(inode);
1126−}
1127−
11281123 static int ext4_set_context(struct inode *inode, const void *ctx, size_t len,
11291124 void *fs_data)
11301125 {
11311126 handle_t *handle = fs_data;
11321127 int res, res2, retries = 0;
11331128
1129+ res = ext4_convert_inline_data(inode);
1130+ if (res)
1131+ return res;
1132+
11341133 /*
11351134 * If a journal handle was specified, then the encryption context is
11361135 * being set on a new inode via inheritance and is part of a larger
@@ -1196,7 +1195,6 @@ static unsigned ext4_max_namelen(struct inode *inode) · 59 unmodified lines
11961195 static const struct fscrypt_operations ext4_cryptops = {
11971196 .key_prefix = "ext4:",
11981197 .get_context = ext4_get_context,
1199− .prepare_context = ext4_prepare_context,
12001198 .set_context = ext4_set_context,
12011199 .dummy_context = ext4_dummy_context,
12021200 .is_encrypted = ext4_encrypted_inode,
fs/ext4/xattr.c+31−34
@@ -131,31 +131,26 @@ static __le32 ext4_xattr_block_csum(struct inode *inode, · 130 unmodified lines
131131 }
132132
133133 static int ext4_xattr_block_csum_verify(struct inode *inode,
134− sector_t block_nr,
135− struct ext4_xattr_header *hdr)
134+ struct buffer_head *bh)
136135 {
137− if (ext4_has_metadata_csum(inode->i_sb) &&
138− (hdr->h_checksum != ext4_xattr_block_csum(inode, block_nr, hdr)))
139− return 0;
140− return 1;
141−}
142−
143−static void ext4_xattr_block_csum_set(struct inode *inode,
144− sector_t block_nr,
145− struct ext4_xattr_header *hdr)
146−{
147− if (!ext4_has_metadata_csum(inode->i_sb))
148− return;
136+ struct ext4_xattr_header *hdr = BHDR(bh);
137+ int ret = 1;
149138
150− hdr->h_checksum = ext4_xattr_block_csum(inode, block_nr, hdr);
139+ if (ext4_has_metadata_csum(inode->i_sb)) {
140+ lock_buffer(bh);
141+ ret = (hdr->h_checksum == ext4_xattr_block_csum(inode,
142+ bh->b_blocknr, hdr));
143+ unlock_buffer(bh);
144+ }
145+ return ret;
151146 }
152147
153−static inline int ext4_handle_dirty_xattr_block(handle_t *handle,
154− struct inode *inode,
155− struct buffer_head *bh)
148+static void ext4_xattr_block_csum_set(struct inode *inode,
149+ struct buffer_head *bh)
156150 {
157− ext4_xattr_block_csum_set(inode, bh->b_blocknr, BHDR(bh));
158− return ext4_handle_dirty_metadata(handle, inode, bh);
151+ if (ext4_has_metadata_csum(inode->i_sb))
152+ BHDR(bh)->h_checksum = ext4_xattr_block_csum(inode,
153+ bh->b_blocknr, BHDR(bh));
159154 }
160155
161156 static inline const struct xattr_handler *
@@ -233,7 +228,7 @@ ext4_xattr_check_block(struct inode *inode, struct buffer_head *bh) · 71 unmodified lines
233228 if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) ||
234229 BHDR(bh)->h_blocks != cpu_to_le32(1))
235230 return -EFSCORRUPTED;
236− if (!ext4_xattr_block_csum_verify(inode, bh->b_blocknr, BHDR(bh)))
231+ if (!ext4_xattr_block_csum_verify(inode, bh))
237232 return -EFSBADCRC;
238233 error = ext4_xattr_check_names(BFIRST(bh), bh->b_data + bh->b_size,
239234 bh->b_data);
@@ -618,23 +613,22 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode, · 378 unmodified lines
618613 }
619614 }
620615
616+ ext4_xattr_block_csum_set(inode, bh);
621617 /*
622618 * Beware of this ugliness: Releasing of xattr block references
623619 * from different inodes can race and so we have to protect
624620 * from a race where someone else frees the block (and releases
625621 * its journal_head) before we are done dirtying the buffer. In
626622 * nojournal mode this race is harmless and we actually cannot
627− * call ext4_handle_dirty_xattr_block() with locked buffer as
623+ * call ext4_handle_dirty_metadata() with locked buffer as
628624 * that function can call sync_dirty_buffer() so for that case
629625 * we handle the dirtying after unlocking the buffer.
630626 */
631627 if (ext4_handle_valid(handle))
632− error = ext4_handle_dirty_xattr_block(handle, inode,
633− bh);
628+ error = ext4_handle_dirty_metadata(handle, inode, bh);
634629 unlock_buffer(bh);
635630 if (!ext4_handle_valid(handle))
636− error = ext4_handle_dirty_xattr_block(handle, inode,
637− bh);
631+ error = ext4_handle_dirty_metadata(handle, inode, bh);
638632 if (IS_SYNC(inode))
639633 ext4_handle_sync(handle);
640634 dquot_free_block(inode, EXT4_C2B(EXT4_SB(inode->i_sb), 1));
@@ -863,13 +857,14 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, · 222 unmodified lines
863857 ext4_xattr_cache_insert(ext4_mb_cache,
864858 bs->bh);
865859 }
860+ ext4_xattr_block_csum_set(inode, bs->bh);
866861 unlock_buffer(bs->bh);
867862 if (error == -EFSCORRUPTED)
868863 goto bad_block;
869864 if (!error)
870− error = ext4_handle_dirty_xattr_block(handle,
871− inode,
872− bs->bh);
865+ error = ext4_handle_dirty_metadata(handle,
866+ inode,
867+ bs->bh);
873868 if (error)
874869 goto cleanup;
875870 goto inserted;
@@ -967,10 +962,11 @@ inserted: · 91 unmodified lines
967962 ce->e_reusable = 0;
968963 ea_bdebug(new_bh, "reusing; refcount now=%d",
969964 ref);
965+ ext4_xattr_block_csum_set(inode, new_bh);
970966 unlock_buffer(new_bh);
971− error = ext4_handle_dirty_xattr_block(handle,
972− inode,
973− new_bh);
967+ error = ext4_handle_dirty_metadata(handle,
968+ inode,
969+ new_bh);
974970 if (error)
975971 goto cleanup_dquot;
976972 }
@@ -1020,11 +1016,12 @@ getblk_failed: · 43 unmodified lines
10201016 goto getblk_failed;
10211017 }
10221018 memcpy(new_bh->b_data, s->base, new_bh->b_size);
1019+ ext4_xattr_block_csum_set(inode, new_bh);
10231020 set_buffer_uptodate(new_bh);
10241021 unlock_buffer(new_bh);
10251022 ext4_xattr_cache_insert(ext4_mb_cache, new_bh);
1026− error = ext4_handle_dirty_xattr_block(handle,
1027− inode, new_bh);
1023+ error = ext4_handle_dirty_metadata(handle, inode,
1024+ new_bh);
10281025 if (error)
10291026 goto cleanup;
10301027 }
fs/f2fs/debug.c+1−0
@@ -196,6 +196,7 @@ static void update_mem_info(struct f2fs_sb_info *sbi) · 195 unmodified lines
196196 si->base_mem += (NM_I(sbi)->nat_bits_blocks << F2FS_BLKSIZE_BITS);
197197 si->base_mem += NM_I(sbi)->nat_blocks * NAT_ENTRY_BITMAP_SIZE;
198198 si->base_mem += NM_I(sbi)->nat_blocks / 8;
199+ si->base_mem += NM_I(sbi)->nat_blocks * sizeof(unsigned short);
199200
200201 get_cache:
201202 si->cache_mem = 0;
fs/f2fs/dir.c+1−1
@@ -750,7 +750,7 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page, · 749 unmodified lines
750750 dentry_blk = page_address(page);
751751 bit_pos = dentry - dentry_blk->dentry;
752752 for (i = 0; i < slots; i++)
753− clear_bit_le(bit_pos + i, &dentry_blk->dentry_bitmap);
753+ __clear_bit_le(bit_pos + i, &dentry_blk->dentry_bitmap);
754754
755755 /* Let's check and deallocate this dentry page */
756756 bit_pos = find_next_bit_le(&dentry_blk->dentry_bitmap,
fs/f2fs/f2fs.h+2−0
@@ -561,6 +561,8 @@ struct f2fs_nm_info { · 560 unmodified lines
561561 struct mutex build_lock; /* lock for build free nids */
562562 unsigned char (*free_nid_bitmap)[NAT_ENTRY_BITMAP_SIZE];
563563 unsigned char *nat_block_bitmap;
564+ unsigned short *free_nid_count; /* free nid count of NAT block */
565+ spinlock_t free_nid_lock; /* protect updating of nid count */
564566
565567 /* for checkpoint */
566568 char *nat_bitmap; /* NAT bitmap pointer */
fs/f2fs/node.c+77−86
@@ -338,9 +338,6 @@ static void set_node_addr(struct f2fs_sb_info *sbi, struct node_info *ni, · 337 unmodified lines
338338 set_nat_flag(e, IS_CHECKPOINTED, false);
339339 __set_nat_cache_dirty(nm_i, e);
340340
341− if (enabled_nat_bits(sbi, NULL) && new_blkaddr == NEW_ADDR)
342− clear_bit_le(NAT_BLOCK_OFFSET(ni->nid), nm_i->empty_nat_bits);
343−
344341 /* update fsync_mark if its inode nat entry is still alive */
345342 if (ni->nid != ni->ino)
346343 e = __lookup_nat_cache(nm_i, ni->ino);
@@ -1823,7 +1820,8 @@ static void remove_free_nid(struct f2fs_sb_info *sbi, nid_t nid) · 1476 unmodified lines
18231820 kmem_cache_free(free_nid_slab, i);
18241821 }
18251822
1826−void update_free_nid_bitmap(struct f2fs_sb_info *sbi, nid_t nid, bool set)
1823+static void update_free_nid_bitmap(struct f2fs_sb_info *sbi, nid_t nid,
1824+ bool set, bool build, bool locked)
18271825 {
18281826 struct f2fs_nm_info *nm_i = NM_I(sbi);
18291827 unsigned int nat_ofs = NAT_BLOCK_OFFSET(nid);
@@ -1833,9 +1831,18 @@ void update_free_nid_bitmap(struct f2fs_sb_info *sbi, nid_t nid, bool set) · 3 unmodified lines
18331831 return;
18341832
18351833 if (set)
1836− set_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs]);
1834+ __set_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs]);
18371835 else
1838− clear_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs]);
1836+ __clear_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs]);
1837+
1838+ if (!locked)
1839+ spin_lock(&nm_i->free_nid_lock);
1840+ if (set)
1841+ nm_i->free_nid_count[nat_ofs]++;
1842+ else if (!build)
1843+ nm_i->free_nid_count[nat_ofs]--;
1844+ if (!locked)
1845+ spin_unlock(&nm_i->free_nid_lock);
18391846 }
18401847
18411848 static void scan_nat_page(struct f2fs_sb_info *sbi,
@@ -1847,7 +1854,10 @@ static void scan_nat_page(struct f2fs_sb_info *sbi, · 5 unmodified lines
18471854 unsigned int nat_ofs = NAT_BLOCK_OFFSET(start_nid);
18481855 int i;
18491856
1850− set_bit_le(nat_ofs, nm_i->nat_block_bitmap);
1857+ if (test_bit_le(nat_ofs, nm_i->nat_block_bitmap))
1858+ return;
1859+
1860+ __set_bit_le(nat_ofs, nm_i->nat_block_bitmap);
18511861
18521862 i = start_nid % NAT_ENTRY_PER_BLOCK;
18531863
@@ -1861,7 +1871,7 @@ static void scan_nat_page(struct f2fs_sb_info *sbi, · 7 unmodified lines
18611871 f2fs_bug_on(sbi, blk_addr == NEW_ADDR);
18621872 if (blk_addr == NULL_ADDR)
18631873 freed = add_free_nid(sbi, start_nid, true);
1864− update_free_nid_bitmap(sbi, start_nid, freed);
1874+ update_free_nid_bitmap(sbi, start_nid, freed, true, false);
18651875 }
18661876 }
18671877
@@ -1877,6 +1887,8 @@ static void scan_free_nid_bits(struct f2fs_sb_info *sbi) · 9 unmodified lines
18771887 for (i = 0; i < nm_i->nat_blocks; i++) {
18781888 if (!test_bit_le(i, nm_i->nat_block_bitmap))
18791889 continue;
1890+ if (!nm_i->free_nid_count[i])
1891+ continue;
18801892 for (idx = 0; idx < NAT_ENTRY_PER_BLOCK; idx++) {
18811893 nid_t nid;
18821894
@@ -1907,58 +1919,6 @@ out: · 24 unmodified lines
19071919 up_read(&nm_i->nat_tree_lock);
19081920 }
19091921
1910−static int scan_nat_bits(struct f2fs_sb_info *sbi)
1911−{
1912− struct f2fs_nm_info *nm_i = NM_I(sbi);
1913− struct page *page;
1914− unsigned int i = 0;
1915− nid_t nid;
1916−
1917− if (!enabled_nat_bits(sbi, NULL))
1918− return -EAGAIN;
1919−
1920− down_read(&nm_i->nat_tree_lock);
1921−check_empty:
1922− i = find_next_bit_le(nm_i->empty_nat_bits, nm_i->nat_blocks, i);
1923− if (i >= nm_i->nat_blocks) {
1924− i = 0;
1925− goto check_partial;
1926− }
1927−
1928− for (nid = i * NAT_ENTRY_PER_BLOCK; nid < (i + 1) * NAT_ENTRY_PER_BLOCK;
1929− nid++) {
1930− if (unlikely(nid >= nm_i->max_nid))
1931− break;
1932− add_free_nid(sbi, nid, true);
1933− }
1934−
1935− if (nm_i->nid_cnt[FREE_NID_LIST] >= MAX_FREE_NIDS)
1936− goto out;
1937− i++;
1938− goto check_empty;
1939−
1940−check_partial:
1941− i = find_next_zero_bit_le(nm_i->full_nat_bits, nm_i->nat_blocks, i);
1942− if (i >= nm_i->nat_blocks) {
1943− disable_nat_bits(sbi, true);
1944− up_read(&nm_i->nat_tree_lock);
1945− return -EINVAL;
1946− }
1947−
1948− nid = i * NAT_ENTRY_PER_BLOCK;
1949− page = get_current_nat_page(sbi, nid);
1950− scan_nat_page(sbi, page, nid);
1951− f2fs_put_page(page, 1);
1952−
1953− if (nm_i->nid_cnt[FREE_NID_LIST] < MAX_FREE_NIDS) {
1954− i++;
1955− goto check_partial;
1956− }
1957−out:
1958− up_read(&nm_i->nat_tree_lock);
1959− return 0;
1960−}
1961−
19621922 static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount)
19631923 {
19641924 struct f2fs_nm_info *nm_i = NM_I(sbi);
@@ -1980,21 +1940,6 @@ static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount) · 15 unmodified lines
19801940
19811941 if (nm_i->nid_cnt[FREE_NID_LIST])
19821942 return;
1983−
1984− /* try to find free nids with nat_bits */
1985− if (!scan_nat_bits(sbi) && nm_i->nid_cnt[FREE_NID_LIST])
1986− return;
1987− }
1988−
1989− /* find next valid candidate */
1990− if (enabled_nat_bits(sbi, NULL)) {
1991− int idx = find_next_zero_bit_le(nm_i->full_nat_bits,
1992− nm_i->nat_blocks, 0);
1993−
1994− if (idx >= nm_i->nat_blocks)
1995− set_sbi_flag(sbi, SBI_NEED_FSCK);
1996− else
1997− nid = idx * NAT_ENTRY_PER_BLOCK;
19981943 }
19991944
20001945 /* readahead nat pages to be scanned */
@@ -2081,7 +2026,7 @@ retry: · 80 unmodified lines
20812026 __insert_nid_to_list(sbi, i, ALLOC_NID_LIST, false);
20822027 nm_i->available_nids--;
20832028
2084− update_free_nid_bitmap(sbi, *nid, false);
2029+ update_free_nid_bitmap(sbi, *nid, false, false, false);
20852030
20862031 spin_unlock(&nm_i->nid_list_lock);
20872032 return true;
@@ -2137,7 +2082,7 @@ void alloc_nid_failed(struct f2fs_sb_info *sbi, nid_t nid) · 49 unmodified lines
21372082
21382083 nm_i->available_nids++;
21392084
2140− update_free_nid_bitmap(sbi, nid, true);
2085+ update_free_nid_bitmap(sbi, nid, true, false, false);
21412086
21422087 spin_unlock(&nm_i->nid_list_lock);
21432088
@@ -2383,7 +2328,7 @@ add_out: · 239 unmodified lines
23832328 list_add_tail(&nes->set_list, head);
23842329 }
23852330
2386−void __update_nat_bits(struct f2fs_sb_info *sbi, nid_t start_nid,
2331+static void __update_nat_bits(struct f2fs_sb_info *sbi, nid_t start_nid,
23872332 struct page *page)
23882333 {
23892334 struct f2fs_nm_info *nm_i = NM_I(sbi);
@@ -2402,16 +2347,16 @@ void __update_nat_bits(struct f2fs_sb_info *sbi, nid_t start_nid, · 12 unmodified lines
24022347 valid++;
24032348 }
24042349 if (valid == 0) {
2405− set_bit_le(nat_index, nm_i->empty_nat_bits);
2406− clear_bit_le(nat_index, nm_i->full_nat_bits);
2350+ __set_bit_le(nat_index, nm_i->empty_nat_bits);
2351+ __clear_bit_le(nat_index, nm_i->full_nat_bits);
24072352 return;
24082353 }
24092354
2410− clear_bit_le(nat_index, nm_i->empty_nat_bits);
2355+ __clear_bit_le(nat_index, nm_i->empty_nat_bits);
24112356 if (valid == NAT_ENTRY_PER_BLOCK)
2412− set_bit_le(nat_index, nm_i->full_nat_bits);
2357+ __set_bit_le(nat_index, nm_i->full_nat_bits);
24132358 else
2414− clear_bit_le(nat_index, nm_i->full_nat_bits);
2359+ __clear_bit_le(nat_index, nm_i->full_nat_bits);
24152360 }
24162361
24172362 static void __flush_nat_entry_set(struct f2fs_sb_info *sbi,
@@ -2467,11 +2412,11 @@ static void __flush_nat_entry_set(struct f2fs_sb_info *sbi, · 49 unmodified lines
24672412 add_free_nid(sbi, nid, false);
24682413 spin_lock(&NM_I(sbi)->nid_list_lock);
24692414 NM_I(sbi)->available_nids++;
2470− update_free_nid_bitmap(sbi, nid, true);
2415+ update_free_nid_bitmap(sbi, nid, true, false, false);
24712416 spin_unlock(&NM_I(sbi)->nid_list_lock);
24722417 } else {
24732418 spin_lock(&NM_I(sbi)->nid_list_lock);
2474− update_free_nid_bitmap(sbi, nid, false);
2419+ update_free_nid_bitmap(sbi, nid, false, false, false);
24752420 spin_unlock(&NM_I(sbi)->nid_list_lock);
24762421 }
24772422 }
@@ -2577,6 +2522,40 @@ static int __get_nat_bitmaps(struct f2fs_sb_info *sbi) · 99 unmodified lines
25772522 return 0;
25782523 }
25792524
2525+inline void load_free_nid_bitmap(struct f2fs_sb_info *sbi)
2526+{
2527+ struct f2fs_nm_info *nm_i = NM_I(sbi);
2528+ unsigned int i = 0;
2529+ nid_t nid, last_nid;
2530+
2531+ if (!enabled_nat_bits(sbi, NULL))
2532+ return;
2533+
2534+ for (i = 0; i < nm_i->nat_blocks; i++) {
2535+ i = find_next_bit_le(nm_i->empty_nat_bits, nm_i->nat_blocks, i);
2536+ if (i >= nm_i->nat_blocks)
2537+ break;
2538+
2539+ __set_bit_le(i, nm_i->nat_block_bitmap);
2540+
2541+ nid = i * NAT_ENTRY_PER_BLOCK;
2542+ last_nid = (i + 1) * NAT_ENTRY_PER_BLOCK;
2543+
2544+ spin_lock(&nm_i->free_nid_lock);
2545+ for (; nid < last_nid; nid++)
2546+ update_free_nid_bitmap(sbi, nid, true, true, true);
2547+ spin_unlock(&nm_i->free_nid_lock);
2548+ }
2549+
2550+ for (i = 0; i < nm_i->nat_blocks; i++) {
2551+ i = find_next_bit_le(nm_i->full_nat_bits, nm_i->nat_blocks, i);
2552+ if (i >= nm_i->nat_blocks)
2553+ break;
2554+
2555+ __set_bit_le(i, nm_i->nat_block_bitmap);
2556+ }
2557+}
2558+
25802559 static int init_node_manager(struct f2fs_sb_info *sbi)
25812560 {
25822561 struct f2fs_super_block *sb_raw = F2FS_RAW_SUPER(sbi);
@@ -2638,7 +2617,7 @@ static int init_node_manager(struct f2fs_sb_info *sbi) · 55 unmodified lines
26382617 return 0;
26392618 }
26402619
2641−int init_free_nid_cache(struct f2fs_sb_info *sbi)
2620+static int init_free_nid_cache(struct f2fs_sb_info *sbi)
26422621 {
26432622 struct f2fs_nm_info *nm_i = NM_I(sbi);
26442623
@@ -2651,6 +2630,14 @@ int init_free_nid_cache(struct f2fs_sb_info *sbi) · 6 unmodified lines
26512630 GFP_KERNEL);
26522631 if (!nm_i->nat_block_bitmap)
26532632 return -ENOMEM;
2633+
2634+ nm_i->free_nid_count = f2fs_kvzalloc(nm_i->nat_blocks *
2635+ sizeof(unsigned short), GFP_KERNEL);
2636+ if (!nm_i->free_nid_count)
2637+ return -ENOMEM;
2638+
2639+ spin_lock_init(&nm_i->free_nid_lock);
2640+
26542641 return 0;
26552642 }
26562643
@@ -2670,6 +2657,9 @@ int build_node_manager(struct f2fs_sb_info *sbi) · 13 unmodified lines
26702657 if (err)
26712658 return err;
26722659
2660+ /* load free nid status from nat_bits table */
2661+ load_free_nid_bitmap(sbi);
2662+
26732663 build_free_nids(sbi, true, true);
26742664 return 0;
26752665 }
@@ -2730,6 +2720,7 @@ void destroy_node_manager(struct f2fs_sb_info *sbi) · 54 unmodified lines
27302720
27312721 kvfree(nm_i->nat_block_bitmap);
27322722 kvfree(nm_i->free_nid_bitmap);
2723+ kvfree(nm_i->free_nid_count);
27332724
27342725 kfree(nm_i->nat_bitmap);
27352726 kfree(nm_i->nat_bits);
fs/f2fs/segment.c+6−0
@@ -1163,6 +1163,12 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del) · 1162 unmodified lines
11631163 if (f2fs_discard_en(sbi) &&
11641164 !f2fs_test_and_set_bit(offset, se->discard_map))
11651165 sbi->discard_blks--;
1166+
1167+ /* don't overwrite by SSR to keep node chain */
1168+ if (se->type == CURSEG_WARM_NODE) {
1169+ if (!f2fs_test_and_set_bit(offset, se->ckpt_valid_map))
1170+ se->ckpt_valid_blocks++;
1171+ }
11661172 } else {
11671173 if (!f2fs_test_and_clear_bit(offset, se->cur_valid_map)) {
11681174 #ifdef CONFIG_F2FS_CHECK_FS
fs/jbd2/journal.c+11−11
@@ -1125,10 +1125,8 @@ static journal_t *journal_init_common(struct block_device *bdev, · 1124 unmodified lines
11251125
11261126 /* Set up a default-sized revoke table for the new mount. */
11271127 err = jbd2_journal_init_revoke(journal, JOURNAL_REVOKE_DEFAULT_HASH);
1128− if (err) {
1129− kfree(journal);
1130− return NULL;
1131− }
1128+ if (err)
1129+ goto err_cleanup;
11321130
11331131 spin_lock_init(&journal->j_history_lock);
11341132
@@ -1145,23 +1143,25 @@ static journal_t *journal_init_common(struct block_device *bdev, · 10 unmodified lines
11451143 journal->j_wbufsize = n;
11461144 journal->j_wbuf = kmalloc_array(n, sizeof(struct buffer_head *),
11471145 GFP_KERNEL);
1148− if (!journal->j_wbuf) {
1149− kfree(journal);
1150− return NULL;
1151− }
1146+ if (!journal->j_wbuf)
1147+ goto err_cleanup;
11521148
11531149 bh = getblk_unmovable(journal->j_dev, start, journal->j_blocksize);
11541150 if (!bh) {
11551151 pr_err("%s: Cannot get buffer for journal superblock\n",
11561152 __func__);
1157− kfree(journal->j_wbuf);
1158− kfree(journal);
1159− return NULL;
1153+ goto err_cleanup;
11601154 }
11611155 journal->j_sb_buffer = bh;
11621156 journal->j_superblock = (journal_superblock_t *)bh->b_data;
11631157
11641158 return journal;
1159+
1160+err_cleanup:
1161+ kfree(journal->j_wbuf);
1162+ jbd2_journal_destroy_revoke(journal);
1163+ kfree(journal);
1164+ return NULL;
11651165 }
11661166
11671167 /* jbd2_journal_init_dev and jbd2_journal_init_inode:
fs/jbd2/revoke.c+1−0
@@ -280,6 +280,7 @@ int jbd2_journal_init_revoke(journal_t *journal, int hash_size) · 279 unmodified lines
280280
281281 fail1:
282282 jbd2_journal_destroy_revoke_table(journal->j_revoke_table[0]);
283+ journal->j_revoke_table[0] = NULL;
283284 fail0:
284285 return -ENOMEM;
285286 }
fs/kernfs/file.c+2−1
@@ -809,7 +809,8 @@ void kernfs_drain_open_files(struct kernfs_node *kn) · 808 unmodified lines
809809 if (kn->flags & KERNFS_HAS_MMAP)
810810 unmap_mapping_range(inode->i_mapping, 0, 0, 1);
811811
812− kernfs_release_file(kn, of);
812+ if (kn->flags & KERNFS_HAS_RELEASE)
813+ kernfs_release_file(kn, of);
813814 }
814815
815816 mutex_unlock(&kernfs_open_file_mutex);
include/linux/ccp.h+1−1
@@ -556,7 +556,7 @@ enum ccp_engine { · 555 unmodified lines
556556 * struct ccp_cmd - CCP operation request
557557 * @entry: list element (ccp driver use only)
558558 * @work: work element used for callbacks (ccp driver use only)
559− * @ccp: CCP device to be run on (ccp driver use only)
559+ * @ccp: CCP device to be run on
560560 * @ret: operation return code (ccp driver use only)
561561 * @flags: cmd processing flags
562562 * @engine: CCP operation to perform
include/linux/errqueue.h+2−0
@@ -20,6 +20,8 @@ struct sock_exterr_skb { · 19 unmodified lines
2020 struct sock_extended_err ee;
2121 u16 addr_offset;
2222 __be16 port;
23+ u8 opt_stats:1,
24+ unused:7;
2325 };
2426
2527 #endif
include/linux/fscrypt_common.h+0−1
@@ -87,7 +87,6 @@ struct fscrypt_operations { · 86 unmodified lines
8787 unsigned int flags;
8888 const char *key_prefix;
8989 int (*get_context)(struct inode *, void *, size_t);
90− int (*prepare_context)(struct inode *);
9190 int (*set_context)(struct inode *, const void *, size_t, void *);
9291 int (*dummy_context)(struct inode *);
9392 bool (*is_encrypted)(struct inode *);
include/linux/gpio/consumer.h+0−16
@@ -143,15 +143,6 @@ struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev, · 142 unmodified lines
143143 struct fwnode_handle *child,
144144 enum gpiod_flags flags,
145145 const char *label);
146−/* FIXME: delete this helper when users are switched over */
147−static inline struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
148− const char *con_id, struct fwnode_handle *child)
149−{
150− return devm_fwnode_get_index_gpiod_from_child(dev, con_id,
151− 0, child,
152− GPIOD_ASIS,
153− "?");
154−}
155146
156147 #else /* CONFIG_GPIOLIB */
157148
@@ -444,13 +435,6 @@ struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev, · 286 unmodified lines
444435 return ERR_PTR(-ENOSYS);
445436 }
446437
447−/* FIXME: delete this when all users are switched over */
448−static inline struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
449− const char *con_id, struct fwnode_handle *child)
450−{
451− return ERR_PTR(-ENOSYS);
452−}
453−
454438 #endif /* CONFIG_GPIOLIB */
455439
456440 static inline
include/linux/hwmon.h+1−0
@@ -88,6 +88,7 @@ enum hwmon_temp_attributes { · 87 unmodified lines
8888 #define HWMON_T_CRIT_HYST BIT(hwmon_temp_crit_hyst)
8989 #define HWMON_T_EMERGENCY BIT(hwmon_temp_emergency)
9090 #define HWMON_T_EMERGENCY_HYST BIT(hwmon_temp_emergency_hyst)
91+#define HWMON_T_ALARM BIT(hwmon_temp_alarm)
9192 #define HWMON_T_MIN_ALARM BIT(hwmon_temp_min_alarm)
9293 #define HWMON_T_MAX_ALARM BIT(hwmon_temp_max_alarm)
9394 #define HWMON_T_CRIT_ALARM BIT(hwmon_temp_crit_alarm)
include/linux/hyperv.h+7−3
@@ -845,6 +845,13 @@ struct vmbus_channel { · 844 unmodified lines
845845 * link up channels based on their CPU affinity.
846846 */
847847 struct list_head percpu_list;
848+
849+ /*
850+ * Defer freeing channel until after all cpu's have
851+ * gone through grace period.
852+ */
853+ struct rcu_head rcu;
854+
848855 /*
849856 * For performance critical channels (storage, networking
850857 * etc,), Hyper-V has a mechanism to enhance the throughput
@@ -1430,9 +1437,6 @@ extern bool vmbus_prep_negotiate_resp(struct icmsg_hdr *icmsghdrp, u8 *buf, · 579 unmodified lines
14301437 const int *srv_version, int srv_vercnt,
14311438 int *nego_fw_version, int *nego_srv_version);
14321439
1433−void hv_event_tasklet_disable(struct vmbus_channel *channel);
1434−void hv_event_tasklet_enable(struct vmbus_channel *channel);
1435−
14361440 void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid);
14371441
14381442 void vmbus_setevent(struct vmbus_channel *channel);
include/linux/iio/sw_device.h+1−1
@@ -62,7 +62,7 @@ void iio_swd_group_init_type_name(struct iio_sw_device *d, · 61 unmodified lines
6262 const char *name,
6363 struct config_item_type *type)
6464 {
65−#ifdef CONFIG_CONFIGFS_FS
65+#if IS_ENABLED(CONFIG_CONFIGFS_FS)
6666 config_group_init_type_name(&d->group, name, type);
6767 #endif
6868 }
include/linux/iommu.h+13−5
@@ -125,9 +125,16 @@ enum iommu_attr { · 124 unmodified lines
125125 };
126126
127127 /* These are the possible reserved region types */
128−#define IOMMU_RESV_DIRECT (1 << 0)
129−#define IOMMU_RESV_RESERVED (1 << 1)
130−#define IOMMU_RESV_MSI (1 << 2)
128+enum iommu_resv_type {
129+ /* Memory regions which must be mapped 1:1 at all times */
130+ IOMMU_RESV_DIRECT,
131+ /* Arbitrary "never map this or give it to a device" address ranges */
132+ IOMMU_RESV_RESERVED,
133+ /* Hardware MSI region (untranslated) */
134+ IOMMU_RESV_MSI,
135+ /* Software-managed MSI translation window */
136+ IOMMU_RESV_SW_MSI,
137+};
131138
132139 /**
133140 * struct iommu_resv_region - descriptor for a reserved memory region
@@ -142,7 +149,7 @@ struct iommu_resv_region { · 8 unmodified lines
142149 phys_addr_t start;
143150 size_t length;
144151 int prot;
145− int type;
152+ enum iommu_resv_type type;
146153 };
147154
148155 #ifdef CONFIG_IOMMU_API
@@ -288,7 +295,8 @@ extern void iommu_get_resv_regions(struct device *dev, struct list_head *list); · 139 unmodified lines
288295 extern void iommu_put_resv_regions(struct device *dev, struct list_head *list);
289296 extern int iommu_request_dm_for_dev(struct device *dev);
290297 extern struct iommu_resv_region *
291−iommu_alloc_resv_region(phys_addr_t start, size_t length, int prot, int type);
298+iommu_alloc_resv_region(phys_addr_t start, size_t length, int prot,
299+ enum iommu_resv_type type);
292300 extern int iommu_get_group_resv_regions(struct iommu_group *group,
293301 struct list_head *head);
294302
include/linux/mlx4/device.h+1−0
@@ -476,6 +476,7 @@ enum { · 475 unmodified lines
476476 enum {
477477 MLX4_INTERFACE_STATE_UP = 1 << 0,
478478 MLX4_INTERFACE_STATE_DELETION = 1 << 1,
479+ MLX4_INTERFACE_STATE_NOWAIT = 1 << 2,
479480 };
480481
481482 #define MSTR_SM_CHANGE_MASK (MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK | \
include/linux/omap-gpmc.h+3−13
@@ -76,22 +76,12 @@ struct gpmc_timings; · 75 unmodified lines
7676 struct omap_nand_platform_data;
7777 struct omap_onenand_platform_data;
7878
79−#if IS_ENABLED(CONFIG_MTD_NAND_OMAP2)
80−extern int gpmc_nand_init(struct omap_nand_platform_data *d,
81− struct gpmc_timings *gpmc_t);
82−#else
83−static inline int gpmc_nand_init(struct omap_nand_platform_data *d,
84− struct gpmc_timings *gpmc_t)
85−{
86− return 0;
87−}
88−#endif
89−
9079 #if IS_ENABLED(CONFIG_MTD_ONENAND_OMAP2)
91−extern void gpmc_onenand_init(struct omap_onenand_platform_data *d);
80+extern int gpmc_onenand_init(struct omap_onenand_platform_data *d);
9281 #else
9382 #define board_onenand_data NULL
94−static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d)
83+static inline int gpmc_onenand_init(struct omap_onenand_platform_data *d)
9584 {
85+ return 0;
9686 }
9787 #endif
include/linux/reset.h+2−7
@@ -31,31 +31,26 @@ static inline int device_reset_optional(struct device *dev) · 30 unmodified lines
3131
3232 static inline int reset_control_reset(struct reset_control *rstc)
3333 {
34− WARN_ON(1);
3534 return 0;
3635 }
3736
3837 static inline int reset_control_assert(struct reset_control *rstc)
3938 {
40− WARN_ON(1);
4139 return 0;
4240 }
4341
4442 static inline int reset_control_deassert(struct reset_control *rstc)
4543 {
46− WARN_ON(1);
4744 return 0;
4845 }
4946
5047 static inline int reset_control_status(struct reset_control *rstc)
5148 {
52− WARN_ON(1);
5349 return 0;
5450 }
5551
5652 static inline void reset_control_put(struct reset_control *rstc)
5753 {
58− WARN_ON(1);
5954 }
6055
6156 static inline int __must_check device_reset(struct device *dev)
@@ -74,14 +69,14 @@ static inline struct reset_control *__of_reset_control_get( · 12 unmodified lines
7469 const char *id, int index, bool shared,
7570 bool optional)
7671 {
77− return ERR_PTR(-ENOTSUPP);
72+ return optional ? NULL : ERR_PTR(-ENOTSUPP);
7873 }
7974
8075 static inline struct reset_control *__devm_reset_control_get(
8176 struct device *dev, const char *id,
8277 int index, bool shared, bool optional)
8378 {
84− return ERR_PTR(-ENOTSUPP);
79+ return optional ? NULL : ERR_PTR(-ENOTSUPP);
8580 }
8681
8782 #endif /* CONFIG_RESET_CONTROLLER */
include/linux/usb/quirks.h+6−0
@@ -50,4 +50,10 @@ · 49 unmodified lines
5050 /* device can't handle Link Power Management */
5151 #define USB_QUIRK_NO_LPM BIT(10)
5252
53+/*
54+ * Device reports its bInterval as linear frames instead of the
55+ * USB 2.0 calculation.
56+ */
57+#define USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL BIT(11)
58+
5359 #endif /* __LINUX_USB_QUIRKS_H */
include/linux/virtio_vsock.h+3−0
@@ -48,6 +48,8 @@ struct virtio_vsock_pkt { · 47 unmodified lines
4848 struct virtio_vsock_hdr hdr;
4949 struct work_struct work;
5050 struct list_head list;
51+ /* socket refcnt not held, only use for cancellation */
52+ struct vsock_sock *vsk;
5153 void *buf;
5254 u32 len;
5355 u32 off;
@@ -56,6 +58,7 @@ struct virtio_vsock_pkt { · 2 unmodified lines
5658
5759 struct virtio_vsock_pkt_info {
5860 u32 remote_cid, remote_port;
61+ struct vsock_sock *vsk;
5962 struct msghdr *msg;
6063 u32 pkt_len;
6164 u16 type;
include/net/af_vsock.h+3−0
@@ -100,6 +100,9 @@ struct vsock_transport { · 99 unmodified lines
100100 void (*destruct)(struct vsock_sock *);
101101 void (*release)(struct vsock_sock *);
102102
103+ /* Cancel all pending packets sent on vsock. */
104+ int (*cancel_pkt)(struct vsock_sock *vsk);
105+
103106 /* Connections. */
104107 int (*connect)(struct vsock_sock *);
105108
include/net/netfilter/nf_conntrack.h+1−1
@@ -244,7 +244,7 @@ extern s32 (*nf_ct_nat_offset)(const struct nf_conn *ct, · 243 unmodified lines
244244 u32 seq);
245245
246246 /* Fake conntrack entry for untracked connections */
247−DECLARE_PER_CPU(struct nf_conn, nf_conntrack_untracked);
247+DECLARE_PER_CPU_ALIGNED(struct nf_conn, nf_conntrack_untracked);
248248 static inline struct nf_conn *nf_ct_untracked_get(void)
249249 {
250250 return raw_cpu_ptr(&nf_conntrack_untracked);
include/net/netfilter/nf_tables.h+29−1
@@ -103,6 +103,35 @@ struct nft_regs { · 102 unmodified lines
103103 };
104104 };
105105
106+/* Store/load an u16 or u8 integer to/from the u32 data register.
107+ *
108+ * Note, when using concatenations, register allocation happens at 32-bit
109+ * level. So for store instruction, pad the rest part with zero to avoid
110+ * garbage values.
111+ */
112+
113+static inline void nft_reg_store16(u32 *dreg, u16 val)
114+{
115+ *dreg = 0;
116+ *(u16 *)dreg = val;
117+}
118+
119+static inline void nft_reg_store8(u32 *dreg, u8 val)
120+{
121+ *dreg = 0;
122+ *(u8 *)dreg = val;
123+}
124+
125+static inline u16 nft_reg_load16(u32 *sreg)
126+{
127+ return *(u16 *)sreg;
128+}
129+
130+static inline u8 nft_reg_load8(u32 *sreg)
131+{
132+ return *(u8 *)sreg;
133+}
134+
106135 static inline void nft_data_copy(u32 *dst, const struct nft_data *src,
107136 unsigned int len)
108137 {
@@ -203,7 +232,6 @@ struct nft_set_elem { · 94 unmodified lines
203232 struct nft_set;
204233 struct nft_set_iter {
205234 u8 genmask;
206− bool flush;
207235 unsigned int count;
208236 unsigned int skip;
209237 int err;
include/net/netfilter/nf_tables_ipv6.h+4−2
@@ -9,12 +9,13 @@ nft_set_pktinfo_ipv6(struct nft_pktinfo *pkt, · 8 unmodified lines
99 struct sk_buff *skb,
1010 const struct nf_hook_state *state)
1111 {
12+ unsigned int flags = IP6_FH_F_AUTH;
1213 int protohdr, thoff = 0;
1314 unsigned short frag_off;
1415
1516 nft_set_pktinfo(pkt, skb, state);
1617
17− protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, NULL);
18+ protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, &flags);
1819 if (protohdr < 0) {
1920 nft_set_pktinfo_proto_unspec(pkt, skb);
2021 return;
@@ -32,6 +33,7 @@ __nft_set_pktinfo_ipv6_validate(struct nft_pktinfo *pkt, · 11 unmodified lines
3233 const struct nf_hook_state *state)
3334 {
3435 #if IS_ENABLED(CONFIG_IPV6)
36+ unsigned int flags = IP6_FH_F_AUTH;
3537 struct ipv6hdr *ip6h, _ip6h;
3638 unsigned int thoff = 0;
3739 unsigned short frag_off;
@@ -50,7 +52,7 @@ __nft_set_pktinfo_ipv6_validate(struct nft_pktinfo *pkt, · 12 unmodified lines
5052 if (pkt_len + sizeof(*ip6h) > skb->len)
5153 return -1;
5254
53− protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, NULL);
55+ protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, &flags);
5456 if (protohdr < 0)
5557 return -1;
5658
include/net/sctp/structs.h+3−2
@@ -83,6 +83,7 @@ struct sctp_bind_addr; · 82 unmodified lines
8383 struct sctp_ulpq;
8484 struct sctp_ep_common;
8585 struct crypto_shash;
86+struct sctp_stream;
8687
8788
8889 #include <net/sctp/tsnmap.h>
@@ -753,6 +754,8 @@ struct sctp_transport { · 664 unmodified lines
753754 /* Is the Path MTU update pending on this tranport */
754755 pmtu_pending:1,
755756
757+ dst_pending_confirm:1, /* need to confirm neighbour */
758+
756759 /* Has this transport moved the ctsn since we last sacked */
757760 sack_generation:1;
758761 u32 dst_cookie;
@@ -806,8 +809,6 @@ struct sctp_transport { · 47 unmodified lines
806809
807810 __u32 burst_limited; /* Holds old cwnd when max.burst is applied */
808811
809− __u32 dst_pending_confirm; /* need to confirm neighbour */
810−
811812 /* Destination */
812813 struct dst_entry *dst;
813814 /* Source address. */
include/rdma/ib_verbs.h+17−13
@@ -1863,6 +1863,9 @@ struct ib_port_immutable { · 1862 unmodified lines
18631863 };
18641864
18651865 struct ib_device {
1866+ /* Do not access @dma_device directly from ULP nor from HW drivers. */
1867+ struct device *dma_device;
1868+
18661869 char name[IB_DEVICE_NAME_MAX];
18671870
18681871 struct list_head event_handler_list;
@@ -3007,7 +3010,7 @@ static inline int ib_req_ncomp_notif(struct ib_cq *cq, int wc_cnt) · 1138 unmodified lines
30073010 */
30083011 static inline int ib_dma_mapping_error(struct ib_device *dev, u64 dma_addr)
30093012 {
3010− return dma_mapping_error(&dev->dev, dma_addr);
3013+ return dma_mapping_error(dev->dma_device, dma_addr);
30113014 }
30123015
30133016 /**
@@ -3021,7 +3024,7 @@ static inline u64 ib_dma_map_single(struct ib_device *dev, · 7 unmodified lines
30213024 void *cpu_addr, size_t size,
30223025 enum dma_data_direction direction)
30233026 {
3024− return dma_map_single(&dev->dev, cpu_addr, size, direction);
3027+ return dma_map_single(dev->dma_device, cpu_addr, size, direction);
30253028 }
30263029
30273030 /**
@@ -3035,7 +3038,7 @@ static inline void ib_dma_unmap_single(struct ib_device *dev, · 7 unmodified lines
30353038 u64 addr, size_t size,
30363039 enum dma_data_direction direction)
30373040 {
3038− dma_unmap_single(&dev->dev, addr, size, direction);
3041+ dma_unmap_single(dev->dma_device, addr, size, direction);
30393042 }
30403043
30413044 /**
@@ -3052,7 +3055,7 @@ static inline u64 ib_dma_map_page(struct ib_device *dev, · 10 unmodified lines
30523055 size_t size,
30533056 enum dma_data_direction direction)
30543057 {
3055− return dma_map_page(&dev->dev, page, offset, size, direction);
3058+ return dma_map_page(dev->dma_device, page, offset, size, direction);
30563059 }
30573060
30583061 /**
@@ -3066,7 +3069,7 @@ static inline void ib_dma_unmap_page(struct ib_device *dev, · 7 unmodified lines
30663069 u64 addr, size_t size,
30673070 enum dma_data_direction direction)
30683071 {
3069− dma_unmap_page(&dev->dev, addr, size, direction);
3072+ dma_unmap_page(dev->dma_device, addr, size, direction);
30703073 }
30713074
30723075 /**
@@ -3080,7 +3083,7 @@ static inline int ib_dma_map_sg(struct ib_device *dev, · 7 unmodified lines
30803083 struct scatterlist *sg, int nents,
30813084 enum dma_data_direction direction)
30823085 {
3083− return dma_map_sg(&dev->dev, sg, nents, direction);
3086+ return dma_map_sg(dev->dma_device, sg, nents, direction);
30843087 }
30853088
30863089 /**
@@ -3094,7 +3097,7 @@ static inline void ib_dma_unmap_sg(struct ib_device *dev, · 7 unmodified lines
30943097 struct scatterlist *sg, int nents,
30953098 enum dma_data_direction direction)
30963099 {
3097− dma_unmap_sg(&dev->dev, sg, nents, direction);
3100+ dma_unmap_sg(dev->dma_device, sg, nents, direction);
30983101 }
30993102
31003103 static inline int ib_dma_map_sg_attrs(struct ib_device *dev,
@@ -3102,7 +3105,8 @@ static inline int ib_dma_map_sg_attrs(struct ib_device *dev, · 1 unmodified line
31023105 enum dma_data_direction direction,
31033106 unsigned long dma_attrs)
31043107 {
3105− return dma_map_sg_attrs(&dev->dev, sg, nents, direction, dma_attrs);
3108+ return dma_map_sg_attrs(dev->dma_device, sg, nents, direction,
3109+ dma_attrs);
31063110 }
31073111
31083112 static inline void ib_dma_unmap_sg_attrs(struct ib_device *dev,
@@ -3110,7 +3114,7 @@ static inline void ib_dma_unmap_sg_attrs(struct ib_device *dev, · 1 unmodified line
31103114 enum dma_data_direction direction,
31113115 unsigned long dma_attrs)
31123116 {
3113− dma_unmap_sg_attrs(&dev->dev, sg, nents, direction, dma_attrs);
3117+ dma_unmap_sg_attrs(dev->dma_device, sg, nents, direction, dma_attrs);
31143118 }
31153119 /**
31163120 * ib_sg_dma_address - Return the DMA address from a scatter/gather entry
@@ -3152,7 +3156,7 @@ static inline void ib_dma_sync_single_for_cpu(struct ib_device *dev, · 35 unmodified lines
31523156 size_t size,
31533157 enum dma_data_direction dir)
31543158 {
3155− dma_sync_single_for_cpu(&dev->dev, addr, size, dir);
3159+ dma_sync_single_for_cpu(dev->dma_device, addr, size, dir);
31563160 }
31573161
31583162 /**
@@ -3167,7 +3171,7 @@ static inline void ib_dma_sync_single_for_device(struct ib_device *dev, · 8 unmodified lines
31673171 size_t size,
31683172 enum dma_data_direction dir)
31693173 {
3170− dma_sync_single_for_device(&dev->dev, addr, size, dir);
3174+ dma_sync_single_for_device(dev->dma_device, addr, size, dir);
31713175 }
31723176
31733177 /**
@@ -3182,7 +3186,7 @@ static inline void *ib_dma_alloc_coherent(struct ib_device *dev, · 8 unmodified lines
31823186 dma_addr_t *dma_handle,
31833187 gfp_t flag)
31843188 {
3185− return dma_alloc_coherent(&dev->dev, size, dma_handle, flag);
3189+ return dma_alloc_coherent(dev->dma_device, size, dma_handle, flag);
31863190 }
31873191
31883192 /**
@@ -3196,7 +3200,7 @@ static inline void ib_dma_free_coherent(struct ib_device *dev, · 7 unmodified lines
31963200 size_t size, void *cpu_addr,
31973201 dma_addr_t dma_handle)
31983202 {
3199− dma_free_coherent(&dev->dev, size, cpu_addr, dma_handle);
3203+ dma_free_coherent(dev->dma_device, size, cpu_addr, dma_handle);
32003204 }
32013205
32023206 /**
include/uapi/asm-generic/unistd.h+3−1
@@ -730,9 +730,11 @@ __SYSCALL(__NR_pkey_mprotect, sys_pkey_mprotect) · 729 unmodified lines
730730 __SYSCALL(__NR_pkey_alloc, sys_pkey_alloc)
731731 #define __NR_pkey_free 290
732732 __SYSCALL(__NR_pkey_free, sys_pkey_free)
733+#define __NR_statx 291
734+__SYSCALL(__NR_statx, sys_statx)
733735
734736 #undef __NR_syscalls
735−#define __NR_syscalls 291
737+#define __NR_syscalls 292
736738
737739 /*
738740 * All syscalls below here should go away really,
include/uapi/linux/btrfs.h+0−27
@@ -713,33 +713,6 @@ enum btrfs_err_code { · 712 unmodified lines
713713 BTRFS_ERROR_DEV_ONLY_WRITABLE,
714714 BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS
715715 };
716−/* An error code to error string mapping for the kernel
717−* error codes
718−*/
719−static inline char *btrfs_err_str(enum btrfs_err_code err_code)
720−{
721− switch (err_code) {
722− case BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET:
723− return "unable to go below two devices on raid1";
724− case BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET:
725− return "unable to go below four devices on raid10";
726− case BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET:
727− return "unable to go below two devices on raid5";
728− case BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET:
729− return "unable to go below three devices on raid6";
730− case BTRFS_ERROR_DEV_TGT_REPLACE:
731− return "unable to remove the dev_replace target dev";
732− case BTRFS_ERROR_DEV_MISSING_NOT_FOUND:
733− return "no missing devices found to remove";
734− case BTRFS_ERROR_DEV_ONLY_WRITABLE:
735− return "unable to remove the only writeable device";
736− case BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS:
737− return "add/delete/balance/replace/resize operation "\
738− "in progress";
739− default:
740− return NULL;
741− }
742−}
743716
744717 #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
745718 struct btrfs_ioctl_vol_args)
include/uapi/rdma/mlx5-abi.h+2−1
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #define MLX5_ABI_USER_H
3535
3636 #include <linux/types.h>
37+#include <linux/if_ether.h> /* For ETH_ALEN. */
3738
3839 enum {
3940 MLX5_QP_FLAG_SIGNATURE = 1 << 0,
@@ -66,7 +67,7 @@ struct mlx5_ib_alloc_ucontext_req { · 26 unmodified lines
6667 };
6768
6869 enum mlx5_lib_caps {
69− MLX5_LIB_CAP_4K_UAR = (u64)1 << 0,
70+ MLX5_LIB_CAP_4K_UAR = (__u64)1 << 0,
7071 };
7172
7273 struct mlx5_ib_alloc_ucontext_req_v2 {
include/video/exynos5433_decon.h+12−0
@@ -46,6 +46,7 @@ · 45 unmodified lines
4646 #define DECON_FRAMEFIFO_STATUS 0x0524
4747 #define DECON_CMU 0x1404
4848 #define DECON_UPDATE 0x1410
49+#define DECON_CRFMID 0x1414
4950 #define DECON_UPDATE_SCHEME 0x1438
5051 #define DECON_VIDCON1 0x2000
5152 #define DECON_VIDCON2 0x2004
@@ -126,6 +127,10 @@ · 74 unmodified lines
126127
127128 /* VIDINTCON0 */
128129 #define VIDINTCON0_FRAMEDONE (1 << 17)
130+#define VIDINTCON0_FRAMESEL_BP (0 << 15)
131+#define VIDINTCON0_FRAMESEL_VS (1 << 15)
132+#define VIDINTCON0_FRAMESEL_AC (2 << 15)
133+#define VIDINTCON0_FRAMESEL_FP (3 << 15)
129134 #define VIDINTCON0_INTFRMEN (1 << 12)
130135 #define VIDINTCON0_INTEN (1 << 0)
131136
@@ -142,6 +147,13 @@ · 10 unmodified lines
142147 #define STANDALONE_UPDATE_F (1 << 0)
143148
144149 /* DECON_VIDCON1 */
150+#define VIDCON1_LINECNT_MASK (0x0fff << 16)
151+#define VIDCON1_I80_ACTIVE (1 << 15)
152+#define VIDCON1_VSTATUS_MASK (0x3 << 13)
153+#define VIDCON1_VSTATUS_VS (0 << 13)
154+#define VIDCON1_VSTATUS_BP (1 << 13)
155+#define VIDCON1_VSTATUS_AC (2 << 13)
156+#define VIDCON1_VSTATUS_FP (3 << 13)
145157 #define VIDCON1_VCLK_MASK (0x3 << 9)
146158 #define VIDCON1_VCLK_RUN_VDEN_DISABLE (0x3 << 9)
147159 #define VIDCON1_VCLK_HOLD (0x0 << 9)
kernel/audit.c+394−245
@@ -54,6 +54,10 @@ · 53 unmodified lines
5454 #include <linux/kthread.h>
5555 #include <linux/kernel.h>
5656 #include <linux/syscalls.h>
57+#include <linux/spinlock.h>
58+#include <linux/rcupdate.h>
59+#include <linux/mutex.h>
60+#include <linux/gfp.h>
5761
5862 #include <linux/audit.h>
5963
@@ -90,13 +94,34 @@ static u32 audit_default; · 30 unmodified lines
9094 /* If auditing cannot proceed, audit_failure selects what happens. */
9195 static u32 audit_failure = AUDIT_FAIL_PRINTK;
9296
93−/*
94− * If audit records are to be written to the netlink socket, audit_pid
95− * contains the pid of the auditd process and audit_nlk_portid contains
96− * the portid to use to send netlink messages to that process.
97+/* private audit network namespace index */
98+static unsigned int audit_net_id;
99+
100+/**
101+ * struct audit_net - audit private network namespace data
102+ * @sk: communication socket
103+ */
104+struct audit_net {
105+ struct sock *sk;
106+};
107+
108+/**
109+ * struct auditd_connection - kernel/auditd connection state
110+ * @pid: auditd PID
111+ * @portid: netlink portid
112+ * @net: the associated network namespace
113+ * @lock: spinlock to protect write access
114+ *
115+ * Description:
116+ * This struct is RCU protected; you must either hold the RCU lock for reading
117+ * or the included spinlock for writing.
97118 */
98−int audit_pid;
99−static __u32 audit_nlk_portid;
119+static struct auditd_connection {
120+ int pid;
121+ u32 portid;
122+ struct net *net;
123+ spinlock_t lock;
124+} auditd_conn;
100125
101126 /* If audit_rate_limit is non-zero, limit the rate of sending audit records
102127 * to that number per second. This prevents DoS attacks, but results in
@@ -123,10 +148,6 @@ u32 audit_sig_sid = 0; · 20 unmodified lines
123148 */
124149 static atomic_t audit_lost = ATOMIC_INIT(0);
125150
126−/* The netlink socket. */
127−static struct sock *audit_sock;
128−static unsigned int audit_net_id;
129−
130151 /* Hash for inode-based rules */
131152 struct list_head audit_inode_hash[AUDIT_INODE_BUCKETS];
132153
@@ -139,6 +160,7 @@ static LIST_HEAD(audit_freelist); · 6 unmodified lines
139160
140161 /* queue msgs to send via kauditd_task */
141162 static struct sk_buff_head audit_queue;
163+static void kauditd_hold_skb(struct sk_buff *skb);
142164 /* queue msgs due to temporary unicast send problems */
143165 static struct sk_buff_head audit_retry_queue;
144166 /* queue msgs waiting for new auditd connection */
@@ -192,6 +214,43 @@ struct audit_reply { · 47 unmodified lines
192214 struct sk_buff *skb;
193215 };
194216
217+/**
218+ * auditd_test_task - Check to see if a given task is an audit daemon
219+ * @task: the task to check
220+ *
221+ * Description:
222+ * Return 1 if the task is a registered audit daemon, 0 otherwise.
223+ */
224+int auditd_test_task(const struct task_struct *task)
225+{
226+ int rc;
227+
228+ rcu_read_lock();
229+ rc = (auditd_conn.pid && task->tgid == auditd_conn.pid ? 1 : 0);
230+ rcu_read_unlock();
231+
232+ return rc;
233+}
234+
235+/**
236+ * audit_get_sk - Return the audit socket for the given network namespace
237+ * @net: the destination network namespace
238+ *
239+ * Description:
240+ * Returns the sock pointer if valid, NULL otherwise. The caller must ensure
241+ * that a reference is held for the network namespace while the sock is in use.
242+ */
243+static struct sock *audit_get_sk(const struct net *net)
244+{
245+ struct audit_net *aunet;
246+
247+ if (!net)
248+ return NULL;
249+
250+ aunet = net_generic(net, audit_net_id);
251+ return aunet->sk;
252+}
253+
195254 static void audit_set_portid(struct audit_buffer *ab, __u32 portid)
196255 {
197256 if (ab) {
@@ -210,9 +269,7 @@ void audit_panic(const char *message) · 12 unmodified lines
210269 pr_err("%s\n", message);
211270 break;
212271 case AUDIT_FAIL_PANIC:
213− /* test audit_pid since printk is always losey, why bother? */
214− if (audit_pid)
215− panic("audit: %s\n", message);
272+ panic("audit: %s\n", message);
216273 break;
217274 }
218275 }
@@ -370,21 +427,87 @@ static int audit_set_failure(u32 state) · 151 unmodified lines
370427 return audit_do_config_change("audit_failure", &audit_failure, state);
371428 }
372429
373−/*
374− * For one reason or another this nlh isn't getting delivered to the userspace
375− * audit daemon, just send it to printk.
430+/**
431+ * auditd_set - Set/Reset the auditd connection state
432+ * @pid: auditd PID
433+ * @portid: auditd netlink portid
434+ * @net: auditd network namespace pointer
435+ *
436+ * Description:
437+ * This function will obtain and drop network namespace references as
438+ * necessary.
439+ */
440+static void auditd_set(int pid, u32 portid, struct net *net)
441+{
442+ unsigned long flags;
443+
444+ spin_lock_irqsave(&auditd_conn.lock, flags);
445+ auditd_conn.pid = pid;
446+ auditd_conn.portid = portid;
447+ if (auditd_conn.net)
448+ put_net(auditd_conn.net);
449+ if (net)
450+ auditd_conn.net = get_net(net);
451+ else
452+ auditd_conn.net = NULL;
453+ spin_unlock_irqrestore(&auditd_conn.lock, flags);
454+}
455+
456+/**
457+ * auditd_reset - Disconnect the auditd connection
458+ *
459+ * Description:
460+ * Break the auditd/kauditd connection and move all the queued records into the
461+ * hold queue in case auditd reconnects.
462+ */
463+static void auditd_reset(void)
464+{
465+ struct sk_buff *skb;
466+
467+ /* if it isn't already broken, break the connection */
468+ rcu_read_lock();
469+ if (auditd_conn.pid)
470+ auditd_set(0, 0, NULL);
471+ rcu_read_unlock();
472+
473+ /* flush all of the main and retry queues to the hold queue */
474+ while ((skb = skb_dequeue(&audit_retry_queue)))
475+ kauditd_hold_skb(skb);
476+ while ((skb = skb_dequeue(&audit_queue)))
477+ kauditd_hold_skb(skb);
478+}
479+
480+/**
481+ * kauditd_print_skb - Print the audit record to the ring buffer
482+ * @skb: audit record
483+ *
484+ * Whatever the reason, this packet may not make it to the auditd connection
485+ * so write it via printk so the information isn't completely lost.
376486 */
377487 static void kauditd_printk_skb(struct sk_buff *skb)
378488 {
379489 struct nlmsghdr *nlh = nlmsg_hdr(skb);
380490 char *data = nlmsg_data(nlh);
381491
382− if (nlh->nlmsg_type != AUDIT_EOE) {
383− if (printk_ratelimit())
384− pr_notice("type=%d %s\n", nlh->nlmsg_type, data);
385− else
386− audit_log_lost("printk limit exceeded");
387− }
492+ if (nlh->nlmsg_type != AUDIT_EOE && printk_ratelimit())
493+ pr_notice("type=%d %s\n", nlh->nlmsg_type, data);
494+}
495+
496+/**
497+ * kauditd_rehold_skb - Handle a audit record send failure in the hold queue
498+ * @skb: audit record
499+ *
500+ * Description:
501+ * This should only be used by the kauditd_thread when it fails to flush the
502+ * hold queue.
503+ */
504+static void kauditd_rehold_skb(struct sk_buff *skb)
505+{
506+ /* put the record back in the queue at the same place */
507+ skb_queue_head(&audit_hold_queue, skb);
508+
509+ /* fail the auditd connection */
510+ auditd_reset();
388511 }
389512
390513 /**
@@ -421,6 +544,9 @@ static void kauditd_hold_skb(struct sk_buff *skb) · 30 unmodified lines
421544 /* we have no other options - drop the message */
422545 audit_log_lost("kauditd hold queue overflow");
423546 kfree_skb(skb);
547+
548+ /* fail the auditd connection */
549+ auditd_reset();
424550 }
425551
426552 /**
@@ -441,51 +567,122 @@ static void kauditd_retry_skb(struct sk_buff *skb) · 14 unmodified lines
441567 }
442568
443569 /**
444− * auditd_reset - Disconnect the auditd connection
570+ * auditd_send_unicast_skb - Send a record via unicast to auditd
571+ * @skb: audit record
445572 *
446573 * Description:
447− * Break the auditd/kauditd connection and move all the records in the retry
448− * queue into the hold queue in case auditd reconnects. The audit_cmd_mutex
449− * must be held when calling this function.
574+ * Send a skb to the audit daemon, returns positive/zero values on success and
575+ * negative values on failure; in all cases the skb will be consumed by this
576+ * function. If the send results in -ECONNREFUSED the connection with auditd
577+ * will be reset. This function may sleep so callers should not hold any locks
578+ * where this would cause a problem.
450579 */
451−static void auditd_reset(void)
580+static int auditd_send_unicast_skb(struct sk_buff *skb)
452581 {
453− struct sk_buff *skb;
454−
455− /* break the connection */
456− if (audit_sock) {
457− sock_put(audit_sock);
458− audit_sock = NULL;
582+ int rc;
583+ u32 portid;
584+ struct net *net;
585+ struct sock *sk;
586+
587+ /* NOTE: we can't call netlink_unicast while in the RCU section so
588+ * take a reference to the network namespace and grab local
589+ * copies of the namespace, the sock, and the portid; the
590+ * namespace and sock aren't going to go away while we hold a
591+ * reference and if the portid does become invalid after the RCU
592+ * section netlink_unicast() should safely return an error */
593+
594+ rcu_read_lock();
595+ if (!auditd_conn.pid) {
596+ rcu_read_unlock();
597+ rc = -ECONNREFUSED;
598+ goto err;
459599 }
460− audit_pid = 0;
461− audit_nlk_portid = 0;
600+ net = auditd_conn.net;
601+ get_net(net);
602+ sk = audit_get_sk(net);
603+ portid = auditd_conn.portid;
604+ rcu_read_unlock();
462605
463− /* flush all of the retry queue to the hold queue */
464− while ((skb = skb_dequeue(&audit_retry_queue)))
465− kauditd_hold_skb(skb);
606+ rc = netlink_unicast(sk, skb, portid, 0);
607+ put_net(net);
608+ if (rc < 0)
609+ goto err;
610+
611+ return rc;
612+
613+err:
614+ if (rc == -ECONNREFUSED)
615+ auditd_reset();
616+ return rc;
466617 }
467618
468619 /**
469− * kauditd_send_unicast_skb - Send a record via unicast to auditd
470− * @skb: audit record
620+ * kauditd_send_queue - Helper for kauditd_thread to flush skb queues
621+ * @sk: the sending sock
622+ * @portid: the netlink destination
623+ * @queue: the skb queue to process
624+ * @retry_limit: limit on number of netlink unicast failures
625+ * @skb_hook: per-skb hook for additional processing
626+ * @err_hook: hook called if the skb fails the netlink unicast send
627+ *
628+ * Description:
629+ * Run through the given queue and attempt to send the audit records to auditd,
630+ * returns zero on success, negative values on failure. It is up to the caller
631+ * to ensure that the @sk is valid for the duration of this function.
632+ *
471633 */
472−static int kauditd_send_unicast_skb(struct sk_buff *skb)
634+static int kauditd_send_queue(struct sock *sk, u32 portid,
635+ struct sk_buff_head *queue,
636+ unsigned int retry_limit,
637+ void (*skb_hook)(struct sk_buff *skb),
638+ void (*err_hook)(struct sk_buff *skb))
473639 {
474− int rc;
640+ int rc = 0;
641+ struct sk_buff *skb;
642+ static unsigned int failed = 0;
475643
476− /* if we know nothing is connected, don't even try the netlink call */
477− if (!audit_pid)
478− return -ECONNREFUSED;
644+ /* NOTE: kauditd_thread takes care of all our locking, we just use
645+ * the netlink info passed to us (e.g. sk and portid) */
646+
647+ while ((skb = skb_dequeue(queue))) {
648+ /* call the skb_hook for each skb we touch */
649+ if (skb_hook)
650+ (*skb_hook)(skb);
651+
652+ /* can we send to anyone via unicast? */
653+ if (!sk) {
654+ if (err_hook)
655+ (*err_hook)(skb);
656+ continue;
657+ }
479658
480− /* get an extra skb reference in case we fail to send */
481− skb_get(skb);
482− rc = netlink_unicast(audit_sock, skb, audit_nlk_portid, 0);
483− if (rc >= 0) {
484− consume_skb(skb);
485− rc = 0;
659+ /* grab an extra skb reference in case of error */
660+ skb_get(skb);
661+ rc = netlink_unicast(sk, skb, portid, 0);
662+ if (rc < 0) {
663+ /* fatal failure for our queue flush attempt? */
664+ if (++failed >= retry_limit ||
665+ rc == -ECONNREFUSED || rc == -EPERM) {
666+ /* yes - error processing for the queue */
667+ sk = NULL;
668+ if (err_hook)
669+ (*err_hook)(skb);
670+ if (!skb_hook)
671+ goto out;
672+ /* keep processing with the skb_hook */
673+ continue;
674+ } else
675+ /* no - requeue to preserve ordering */
676+ skb_queue_head(queue, skb);
677+ } else {
678+ /* it worked - drop the extra reference and continue */
679+ consume_skb(skb);
680+ failed = 0;
681+ }
486682 }
487683
488− return rc;
684+out:
685+ return (rc >= 0 ? 0 : rc);
489686 }
490687
491688 /*
@@ -493,16 +690,19 @@ static int kauditd_send_unicast_skb(struct sk_buff *skb) · 1 unmodified line
493690 * @skb: audit record
494691 *
495692 * Description:
496− * This function doesn't consume an skb as might be expected since it has to
497− * copy it anyways.
693+ * Write a multicast message to anyone listening in the initial network
694+ * namespace. This function doesn't consume an skb as might be expected since
695+ * it has to copy it anyways.
498696 */
499697 static void kauditd_send_multicast_skb(struct sk_buff *skb)
500698 {
501699 struct sk_buff *copy;
502− struct audit_net *aunet = net_generic(&init_net, audit_net_id);
503− struct sock *sock = aunet->nlsk;
700+ struct sock *sock = audit_get_sk(&init_net);
504701 struct nlmsghdr *nlh;
505702
703+ /* NOTE: we are not taking an additional reference for init_net since
704+ * we don't have to worry about it going away */
705+
506706 if (!netlink_has_listeners(sock, AUDIT_NLGRP_READLOG))
507707 return;
508708
@@ -526,149 +726,75 @@ static void kauditd_send_multicast_skb(struct sk_buff *skb) · 17 unmodified lines
526726 }
527727
528728 /**
529− * kauditd_wake_condition - Return true when it is time to wake kauditd_thread
530− *
531− * Description:
532− * This function is for use by the wait_event_freezable() call in
533− * kauditd_thread().
729+ * kauditd_thread - Worker thread to send audit records to userspace
730+ * @dummy: unused
534731 */
535−static int kauditd_wake_condition(void)
536−{
537− static int pid_last = 0;
538− int rc;
539− int pid = audit_pid;
540−
541− /* wake on new messages or a change in the connected auditd */
542− rc = skb_queue_len(&audit_queue) || (pid && pid != pid_last);
543− if (rc)
544− pid_last = pid;
545−
546− return rc;
547−}
548−
549732 static int kauditd_thread(void *dummy)
550733 {
551734 int rc;
552− int auditd = 0;
553− int reschedule = 0;
554− struct sk_buff *skb;
555− struct nlmsghdr *nlh;
735+ u32 portid = 0;
736+ struct net *net = NULL;
737+ struct sock *sk = NULL;
556738
557739 #define UNICAST_RETRIES 5
558−#define AUDITD_BAD(x,y) \
559− ((x) == -ECONNREFUSED || (x) == -EPERM || ++(y) >= UNICAST_RETRIES)
560−
561− /* NOTE: we do invalidate the auditd connection flag on any sending
562− * errors, but we only "restore" the connection flag at specific places
563− * in the loop in order to help ensure proper ordering of audit
564− * records */
565740
566741 set_freezable();
567742 while (!kthread_should_stop()) {
568− /* NOTE: possible area for future improvement is to look at
569− * the hold and retry queues, since only this thread
570− * has access to these queues we might be able to do
571− * our own queuing and skip some/all of the locking */
572−
573− /* NOTE: it might be a fun experiment to split the hold and
574− * retry queue handling to another thread, but the
575− * synchronization issues and other overhead might kill
576− * any performance gains */
743+ /* NOTE: see the lock comments in auditd_send_unicast_skb() */
744+ rcu_read_lock();
745+ if (!auditd_conn.pid) {
746+ rcu_read_unlock();
747+ goto main_queue;
748+ }
749+ net = auditd_conn.net;
750+ get_net(net);
751+ sk = audit_get_sk(net);
752+ portid = auditd_conn.portid;
753+ rcu_read_unlock();
577754
578755 /* attempt to flush the hold queue */
579− while (auditd && (skb = skb_dequeue(&audit_hold_queue))) {
580− rc = kauditd_send_unicast_skb(skb);
581− if (rc) {
582− /* requeue to the same spot */
583− skb_queue_head(&audit_hold_queue, skb);
584−
585− auditd = 0;
586− if (AUDITD_BAD(rc, reschedule)) {
587− mutex_lock(&audit_cmd_mutex);
588− auditd_reset();
589− mutex_unlock(&audit_cmd_mutex);
590− reschedule = 0;
591− }
592− } else
593− /* we were able to send successfully */
594− reschedule = 0;
756+ rc = kauditd_send_queue(sk, portid,
757+ &audit_hold_queue, UNICAST_RETRIES,
758+ NULL, kauditd_rehold_skb);
759+ if (rc < 0) {
760+ sk = NULL;
761+ goto main_queue;
595762 }
596763
597764 /* attempt to flush the retry queue */
598− while (auditd && (skb = skb_dequeue(&audit_retry_queue))) {
599− rc = kauditd_send_unicast_skb(skb);
600− if (rc) {
601− auditd = 0;
602− if (AUDITD_BAD(rc, reschedule)) {
603− kauditd_hold_skb(skb);
604− mutex_lock(&audit_cmd_mutex);
605− auditd_reset();
606− mutex_unlock(&audit_cmd_mutex);
607− reschedule = 0;
608− } else
609− /* temporary problem (we hope), queue
610− * to the same spot and retry */
611− skb_queue_head(&audit_retry_queue, skb);
612− } else
613− /* we were able to send successfully */
614− reschedule = 0;
765+ rc = kauditd_send_queue(sk, portid,
766+ &audit_retry_queue, UNICAST_RETRIES,
767+ NULL, kauditd_hold_skb);
768+ if (rc < 0) {
769+ sk = NULL;
770+ goto main_queue;
615771 }
616772
617− /* standard queue processing, try to be as quick as possible */
618−quick_loop:
619− skb = skb_dequeue(&audit_queue);
620− if (skb) {
621− /* setup the netlink header, see the comments in
622− * kauditd_send_multicast_skb() for length quirks */
623− nlh = nlmsg_hdr(skb);
624− nlh->nlmsg_len = skb->len - NLMSG_HDRLEN;
625−
626− /* attempt to send to any multicast listeners */
627− kauditd_send_multicast_skb(skb);
628−
629− /* attempt to send to auditd, queue on failure */
630− if (auditd) {
631− rc = kauditd_send_unicast_skb(skb);
632− if (rc) {
633− auditd = 0;
634− if (AUDITD_BAD(rc, reschedule)) {
635− mutex_lock(&audit_cmd_mutex);
636− auditd_reset();
637− mutex_unlock(&audit_cmd_mutex);
638− reschedule = 0;
639− }
640−
641− /* move to the retry queue */
642− kauditd_retry_skb(skb);
643− } else
644− /* everything is working so go fast! */
645− goto quick_loop;
646− } else if (reschedule)
647− /* we are currently having problems, move to
648− * the retry queue */
649− kauditd_retry_skb(skb);
650− else
651− /* dump the message via printk and hold it */
652− kauditd_hold_skb(skb);
653− } else {
654− /* we have flushed the backlog so wake everyone */
655− wake_up(&audit_backlog_wait);
656−
657− /* if everything is okay with auditd (if present), go
658− * to sleep until there is something new in the queue
659− * or we have a change in the connected auditd;
660− * otherwise simply reschedule to give things a chance
661− * to recover */
662− if (reschedule) {
663− set_current_state(TASK_INTERRUPTIBLE);
664− schedule();
665− } else
666− wait_event_freezable(kauditd_wait,
667− kauditd_wake_condition());
668−
669− /* update the auditd connection status */
670− auditd = (audit_pid ? 1 : 0);
773+main_queue:
774+ /* process the main queue - do the multicast send and attempt
775+ * unicast, dump failed record sends to the retry queue; if
776+ * sk == NULL due to previous failures we will just do the
777+ * multicast send and move the record to the retry queue */
778+ kauditd_send_queue(sk, portid, &audit_queue, 1,
779+ kauditd_send_multicast_skb,
780+ kauditd_retry_skb);
781+
782+ /* drop our netns reference, no auditd sends past this line */
783+ if (net) {
784+ put_net(net);
785+ net = NULL;
671786 }
787+ sk = NULL;
788+
789+ /* we have processed all the queues so wake everyone */
790+ wake_up(&audit_backlog_wait);
791+
792+ /* NOTE: we want to wake up if there is anything on the queue,
793+ * regardless of if an auditd is connected, as we need to
794+ * do the multicast send and rotate records from the
795+ * main queue to the retry/hold queues */
796+ wait_event_freezable(kauditd_wait,
797+ (skb_queue_len(&audit_queue) ? 1 : 0));
672798 }
673799
674800 return 0;
@@ -678,17 +804,16 @@ int audit_send_list(void *_dest) · 3 unmodified lines
678804 {
679805 struct audit_netlink_list *dest = _dest;
680806 struct sk_buff *skb;
681− struct net *net = dest->net;
682− struct audit_net *aunet = net_generic(net, audit_net_id);
807+ struct sock *sk = audit_get_sk(dest->net);
683808
684809 /* wait for parent to finish and send an ACK */
685810 mutex_lock(&audit_cmd_mutex);
686811 mutex_unlock(&audit_cmd_mutex);
687812
688813 while ((skb = __skb_dequeue(&dest->q)) != NULL)
689− netlink_unicast(aunet->nlsk, skb, dest->portid, 0);
814+ netlink_unicast(sk, skb, dest->portid, 0);
690815
691− put_net(net);
816+ put_net(dest->net);
692817 kfree(dest);
693818
694819 return 0;
@@ -722,16 +847,15 @@ out_kfree_skb: · 27 unmodified lines
722847 static int audit_send_reply_thread(void *arg)
723848 {
724849 struct audit_reply *reply = (struct audit_reply *)arg;
725− struct net *net = reply->net;
726− struct audit_net *aunet = net_generic(net, audit_net_id);
850+ struct sock *sk = audit_get_sk(reply->net);
727851
728852 mutex_lock(&audit_cmd_mutex);
729853 mutex_unlock(&audit_cmd_mutex);
730854
731855 /* Ignore failure. It'll only happen if the sender goes away,
732856 because our timeout is set to infinite. */
733− netlink_unicast(aunet->nlsk , reply->skb, reply->portid, 0);
734− put_net(net);
857+ netlink_unicast(sk, reply->skb, reply->portid, 0);
858+ put_net(reply->net);
735859 kfree(reply);
736860 return 0;
737861 }
@@ -949,12 +1073,12 @@ static int audit_set_feature(struct sk_buff *skb) · 211 unmodified lines
9491073
9501074 static int audit_replace(pid_t pid)
9511075 {
952− struct sk_buff *skb = audit_make_reply(0, 0, AUDIT_REPLACE, 0, 0,
953− &pid, sizeof(pid));
1076+ struct sk_buff *skb;
9541077
1078+ skb = audit_make_reply(0, 0, AUDIT_REPLACE, 0, 0, &pid, sizeof(pid));
9551079 if (!skb)
9561080 return -ENOMEM;
957− return netlink_unicast(audit_sock, skb, audit_nlk_portid, 0);
1081+ return auditd_send_unicast_skb(skb);
9581082 }
9591083
9601084 static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
@@ -981,7 +1105,9 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) · 20 unmodified lines
9811105 memset(&s, 0, sizeof(s));
9821106 s.enabled = audit_enabled;
9831107 s.failure = audit_failure;
984− s.pid = audit_pid;
1108+ rcu_read_lock();
1109+ s.pid = auditd_conn.pid;
1110+ rcu_read_unlock();
9851111 s.rate_limit = audit_rate_limit;
9861112 s.backlog_limit = audit_backlog_limit;
9871113 s.lost = atomic_read(&audit_lost);
@@ -1014,30 +1140,44 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) · 26 unmodified lines
10141140 * from the initial pid namespace, but something
10151141 * to keep in mind if this changes */
10161142 int new_pid = s.pid;
1143+ pid_t auditd_pid;
10171144 pid_t requesting_pid = task_tgid_vnr(current);
10181145
1019− if ((!new_pid) && (requesting_pid != audit_pid)) {
1020− audit_log_config_change("audit_pid", new_pid, audit_pid, 0);
1146+ /* test the auditd connection */
1147+ audit_replace(requesting_pid);
1148+
1149+ rcu_read_lock();
1150+ auditd_pid = auditd_conn.pid;
1151+ /* only the current auditd can unregister itself */
1152+ if ((!new_pid) && (requesting_pid != auditd_pid)) {
1153+ rcu_read_unlock();
1154+ audit_log_config_change("audit_pid", new_pid,
1155+ auditd_pid, 0);
10211156 return -EACCES;
10221157 }
1023− if (audit_pid && new_pid &&
1024− audit_replace(requesting_pid) != -ECONNREFUSED) {
1025− audit_log_config_change("audit_pid", new_pid, audit_pid, 0);
1158+ /* replacing a healthy auditd is not allowed */
1159+ if (auditd_pid && new_pid) {
1160+ rcu_read_unlock();
1161+ audit_log_config_change("audit_pid", new_pid,
1162+ auditd_pid, 0);
10261163 return -EEXIST;
10271164 }
1165+ rcu_read_unlock();
1166+
10281167 if (audit_enabled != AUDIT_OFF)
1029− audit_log_config_change("audit_pid", new_pid, audit_pid, 1);
1168+ audit_log_config_change("audit_pid", new_pid,
1169+ auditd_pid, 1);
1170+
10301171 if (new_pid) {
1031− if (audit_sock)
1032− sock_put(audit_sock);
1033− audit_pid = new_pid;
1034− audit_nlk_portid = NETLINK_CB(skb).portid;
1035− sock_hold(skb->sk);
1036− audit_sock = skb->sk;
1037− } else {
1172+ /* register a new auditd connection */
1173+ auditd_set(new_pid,
1174+ NETLINK_CB(skb).portid,
1175+ sock_net(NETLINK_CB(skb).sk));
1176+ /* try to process any backlog */
1177+ wake_up_interruptible(&kauditd_wait);
1178+ } else
1179+ /* unregister the auditd connection */
10381180 auditd_reset();
1039− }
1040− wake_up_interruptible(&kauditd_wait);
10411181 }
10421182 if (s.mask & AUDIT_STATUS_RATE_LIMIT) {
10431183 err = audit_set_rate_limit(s.rate_limit);
@@ -1090,7 +1230,6 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) · 46 unmodified lines
10901230 if (err)
10911231 break;
10921232 }
1093− mutex_unlock(&audit_cmd_mutex);
10941233 audit_log_common_recv_msg(&ab, msg_type);
10951234 if (msg_type != AUDIT_USER_TTY)
10961235 audit_log_format(ab, " msg='%.*s'",
@@ -1108,7 +1247,6 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) · 11 unmodified lines
11081247 }
11091248 audit_set_portid(ab, NETLINK_CB(skb).portid);
11101249 audit_log_end(ab);
1111− mutex_lock(&audit_cmd_mutex);
11121250 }
11131251 break;
11141252 case AUDIT_ADD_RULE:
@@ -1298,26 +1436,26 @@ static int __net_init audit_net_init(struct net *net) · 183 unmodified lines
12981436
12991437 struct audit_net *aunet = net_generic(net, audit_net_id);
13001438
1301− aunet->nlsk = netlink_kernel_create(net, NETLINK_AUDIT, &cfg);
1302− if (aunet->nlsk == NULL) {
1439+ aunet->sk = netlink_kernel_create(net, NETLINK_AUDIT, &cfg);
1440+ if (aunet->sk == NULL) {
13031441 audit_panic("cannot initialize netlink socket in namespace");
13041442 return -ENOMEM;
13051443 }
1306− aunet->nlsk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
1444+ aunet->sk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
1445+
13071446 return 0;
13081447 }
13091448
13101449 static void __net_exit audit_net_exit(struct net *net)
13111450 {
13121451 struct audit_net *aunet = net_generic(net, audit_net_id);
1313− struct sock *sock = aunet->nlsk;
1314− mutex_lock(&audit_cmd_mutex);
1315− if (sock == audit_sock)
1452+
1453+ rcu_read_lock();
1454+ if (net == auditd_conn.net)
13161455 auditd_reset();
1317− mutex_unlock(&audit_cmd_mutex);
1456+ rcu_read_unlock();
13181457
1319− netlink_kernel_release(sock);
1320− aunet->nlsk = NULL;
1458+ netlink_kernel_release(aunet->sk);
13211459 }
13221460
13231461 static struct pernet_operations audit_net_ops __net_initdata = {
@@ -1335,20 +1473,24 @@ static int __init audit_init(void) · 11 unmodified lines
13351473 if (audit_initialized == AUDIT_DISABLED)
13361474 return 0;
13371475
1338− pr_info("initializing netlink subsys (%s)\n",
1339− audit_default ? "enabled" : "disabled");
1340− register_pernet_subsys(&audit_net_ops);
1476+ memset(&auditd_conn, 0, sizeof(auditd_conn));
1477+ spin_lock_init(&auditd_conn.lock);
13411478
13421479 skb_queue_head_init(&audit_queue);
13431480 skb_queue_head_init(&audit_retry_queue);
13441481 skb_queue_head_init(&audit_hold_queue);
1345− audit_initialized = AUDIT_INITIALIZED;
1346− audit_enabled = audit_default;
1347− audit_ever_enabled |= !!audit_default;
13481482
13491483 for (i = 0; i < AUDIT_INODE_BUCKETS; i++)
13501484 INIT_LIST_HEAD(&audit_inode_hash[i]);
13511485
1486+ pr_info("initializing netlink subsys (%s)\n",
1487+ audit_default ? "enabled" : "disabled");
1488+ register_pernet_subsys(&audit_net_ops);
1489+
1490+ audit_initialized = AUDIT_INITIALIZED;
1491+ audit_enabled = audit_default;
1492+ audit_ever_enabled |= !!audit_default;
1493+
13521494 kauditd_task = kthread_run(kauditd_thread, NULL, "kauditd");
13531495 if (IS_ERR(kauditd_task)) {
13541496 int err = PTR_ERR(kauditd_task);
@@ -1519,20 +1661,16 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, · 164 unmodified lines
15191661 if (unlikely(!audit_filter(type, AUDIT_FILTER_TYPE)))
15201662 return NULL;
15211663
1522− /* don't ever fail/sleep on these two conditions:
1664+ /* NOTE: don't ever fail/sleep on these two conditions:
15231665 * 1. auditd generated record - since we need auditd to drain the
15241666 * queue; also, when we are checking for auditd, compare PIDs using
15251667 * task_tgid_vnr() since auditd_pid is set in audit_receive_msg()
15261668 * using a PID anchored in the caller's namespace
1527− * 2. audit command message - record types 1000 through 1099 inclusive
1528− * are command messages/records used to manage the kernel subsystem
1529− * and the audit userspace, blocking on these messages could cause
1530− * problems under load so don't do it (note: not all of these
1531− * command types are valid as record types, but it is quicker to
1532− * just check two ints than a series of ints in a if/switch stmt) */
1533− if (!((audit_pid && audit_pid == task_tgid_vnr(current)) ||
1534− (type >= 1000 && type <= 1099))) {
1535− long sleep_time = audit_backlog_wait_time;
1669+ * 2. generator holding the audit_cmd_mutex - we don't want to block
1670+ * while holding the mutex */
1671+ if (!(auditd_test_task(current) ||
1672+ (current == __mutex_owner(&audit_cmd_mutex)))) {
1673+ long stime = audit_backlog_wait_time;
15361674
15371675 while (audit_backlog_limit &&
15381676 (skb_queue_len(&audit_queue) > audit_backlog_limit)) {
@@ -1541,14 +1679,13 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, · 2 unmodified lines
15411679
15421680 /* sleep if we are allowed and we haven't exhausted our
15431681 * backlog wait limit */
1544− if ((gfp_mask & __GFP_DIRECT_RECLAIM) &&
1545− (sleep_time > 0)) {
1682+ if (gfpflags_allow_blocking(gfp_mask) && (stime > 0)) {
15461683 DECLARE_WAITQUEUE(wait, current);
15471684
15481685 add_wait_queue_exclusive(&audit_backlog_wait,
15491686 &wait);
15501687 set_current_state(TASK_UNINTERRUPTIBLE);
1551− sleep_time = schedule_timeout(sleep_time);
1688+ stime = schedule_timeout(stime);
15521689 remove_wait_queue(&audit_backlog_wait, &wait);
15531690 } else {
15541691 if (audit_rate_check() && printk_ratelimit())
@@ -2127,15 +2264,27 @@ out: · 572 unmodified lines
21272264 */
21282265 void audit_log_end(struct audit_buffer *ab)
21292266 {
2267+ struct sk_buff *skb;
2268+ struct nlmsghdr *nlh;
2269+
21302270 if (!ab)
21312271 return;
2132− if (!audit_rate_check()) {
2133− audit_log_lost("rate limit exceeded");
2134− } else {
2135− skb_queue_tail(&audit_queue, ab->skb);
2136− wake_up_interruptible(&kauditd_wait);
2272+
2273+ if (audit_rate_check()) {
2274+ skb = ab->skb;
21372275 ab->skb = NULL;
2138− }
2276+
2277+ /* setup the netlink header, see the comments in
2278+ * kauditd_send_multicast_skb() for length quirks */
2279+ nlh = nlmsg_hdr(skb);
2280+ nlh->nlmsg_len = skb->len - NLMSG_HDRLEN;
2281+
2282+ /* queue the netlink packet and poke the kauditd thread */
2283+ skb_queue_tail(&audit_queue, skb);
2284+ wake_up_interruptible(&kauditd_wait);
2285+ } else
2286+ audit_log_lost("rate limit exceeded");
2287+
21392288 audit_buffer_free(ab);
21402289 }
21412290
kernel/audit.h+2−7
@@ -218,7 +218,7 @@ extern void audit_log_name(struct audit_context *context, · 217 unmodified lines
218218 struct audit_names *n, const struct path *path,
219219 int record_num, int *call_panic);
220220
221−extern int audit_pid;
221+extern int auditd_test_task(const struct task_struct *task);
222222
223223 #define AUDIT_INODE_BUCKETS 32
224224 extern struct list_head audit_inode_hash[AUDIT_INODE_BUCKETS];
@@ -250,10 +250,6 @@ struct audit_netlink_list { · 25 unmodified lines
250250
251251 int audit_send_list(void *);
252252
253−struct audit_net {
254− struct sock *nlsk;
255−};
256−
257253 extern int selinux_audit_rule_update(void);
258254
259255 extern struct mutex audit_filter_mutex;
@@ -340,8 +336,7 @@ extern int audit_filter(int msgtype, unsigned int listtype); · 80 unmodified lines
340336 extern int __audit_signal_info(int sig, struct task_struct *t);
341337 static inline int audit_signal_info(int sig, struct task_struct *t)
342338 {
343− if (unlikely((audit_pid && t->tgid == audit_pid) ||
344− (audit_signals && !audit_dummy_context())))
339+ if (auditd_test_task(t) || (audit_signals && !audit_dummy_context()))
345340 return __audit_signal_info(sig, t);
346341 return 0;
347342 }
kernel/auditsc.c+3−3
@@ -762,7 +762,7 @@ static enum audit_state audit_filter_syscall(struct task_struct *tsk, · 761 unmodified lines
762762 struct audit_entry *e;
763763 enum audit_state state;
764764
765− if (audit_pid && tsk->tgid == audit_pid)
765+ if (auditd_test_task(tsk))
766766 return AUDIT_DISABLED;
767767
768768 rcu_read_lock();
@@ -816,7 +816,7 @@ void audit_filter_inodes(struct task_struct *tsk, struct audit_context *ctx) · 47 unmodified lines
816816 {
817817 struct audit_names *n;
818818
819− if (audit_pid && tsk->tgid == audit_pid)
819+ if (auditd_test_task(tsk))
820820 return;
821821
822822 rcu_read_lock();
@@ -2256,7 +2256,7 @@ int __audit_signal_info(int sig, struct task_struct *t) · 1433 unmodified lines
22562256 struct audit_context *ctx = tsk->audit_context;
22572257 kuid_t uid = current_uid(), t_uid = task_uid(t);
22582258
2259− if (audit_pid && t->tgid == audit_pid) {
2259+ if (auditd_test_task(t)) {
22602260 if (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1 || sig == SIGUSR2) {
22612261 audit_sig_pid = task_tgid_nr(tsk);
22622262 if (uid_valid(tsk->loginuid))
kernel/bpf/hashtab.c+71−73
@@ -30,18 +30,12 @@ struct bpf_htab { · 29 unmodified lines
3030 struct pcpu_freelist freelist;
3131 struct bpf_lru lru;
3232 };
33− void __percpu *extra_elems;
33+ struct htab_elem *__percpu *extra_elems;
3434 atomic_t count; /* number of elements in this hashtable */
3535 u32 n_buckets; /* number of hash buckets */
3636 u32 elem_size; /* size of each element in bytes */
3737 };
3838
39−enum extra_elem_state {
40− HTAB_NOT_AN_EXTRA_ELEM = 0,
41− HTAB_EXTRA_ELEM_FREE,
42− HTAB_EXTRA_ELEM_USED
43−};
44−
4539 /* each htab element is struct htab_elem + key + value */
4640 struct htab_elem {
4741 union {
@@ -56,7 +50,6 @@ struct htab_elem { · 8 unmodified lines
5650 };
5751 union {
5852 struct rcu_head rcu;
59− enum extra_elem_state state;
6053 struct bpf_lru_node lru_node;
6154 };
6255 u32 hash;
@@ -77,6 +70,11 @@ static bool htab_is_percpu(const struct bpf_htab *htab) · 14 unmodified lines
7770 htab->map.map_type == BPF_MAP_TYPE_LRU_PERCPU_HASH;
7871 }
7972
73+static bool htab_is_prealloc(const struct bpf_htab *htab)
74+{
75+ return !(htab->map.map_flags & BPF_F_NO_PREALLOC);
76+}
77+
8078 static inline void htab_elem_set_ptr(struct htab_elem *l, u32 key_size,
8179 void __percpu *pptr)
8280 {
@@ -128,17 +126,20 @@ static struct htab_elem *prealloc_lru_pop(struct bpf_htab *htab, void *key, · 45 unmodified lines
128126
129127 static int prealloc_init(struct bpf_htab *htab)
130128 {
129+ u32 num_entries = htab->map.max_entries;
131130 int err = -ENOMEM, i;
132131
133− htab->elems = bpf_map_area_alloc(htab->elem_size *
134− htab->map.max_entries);
132+ if (!htab_is_percpu(htab) && !htab_is_lru(htab))
133+ num_entries += num_possible_cpus();
134+
135+ htab->elems = bpf_map_area_alloc(htab->elem_size * num_entries);
135136 if (!htab->elems)
136137 return -ENOMEM;
137138
138139 if (!htab_is_percpu(htab))
139140 goto skip_percpu_elems;
140141
141− for (i = 0; i < htab->map.max_entries; i++) {
142+ for (i = 0; i < num_entries; i++) {
142143 u32 size = round_up(htab->map.value_size, 8);
143144 void __percpu *pptr;
144145
@@ -166,11 +167,11 @@ skip_percpu_elems: · 21 unmodified lines
166167 if (htab_is_lru(htab))
167168 bpf_lru_populate(&htab->lru, htab->elems,
168169 offsetof(struct htab_elem, lru_node),
169− htab->elem_size, htab->map.max_entries);
170+ htab->elem_size, num_entries);
170171 else
171172 pcpu_freelist_populate(&htab->freelist,
172173 htab->elems + offsetof(struct htab_elem, fnode),
173− htab->elem_size, htab->map.max_entries);
174+ htab->elem_size, num_entries);
174175
175176 return 0;
176177
@@ -191,16 +192,22 @@ static void prealloc_destroy(struct bpf_htab *htab) · 14 unmodified lines
191192
192193 static int alloc_extra_elems(struct bpf_htab *htab)
193194 {
194− void __percpu *pptr;
195+ struct htab_elem *__percpu *pptr, *l_new;
196+ struct pcpu_freelist_node *l;
195197 int cpu;
196198
197− pptr = __alloc_percpu_gfp(htab->elem_size, 8, GFP_USER | __GFP_NOWARN);
199+ pptr = __alloc_percpu_gfp(sizeof(struct htab_elem *), 8,
200+ GFP_USER | __GFP_NOWARN);
198201 if (!pptr)
199202 return -ENOMEM;
200203
201204 for_each_possible_cpu(cpu) {
202− ((struct htab_elem *)per_cpu_ptr(pptr, cpu))->state =
203− HTAB_EXTRA_ELEM_FREE;
205+ l = pcpu_freelist_pop(&htab->freelist);
206+ /* pop will succeed, since prealloc_init()
207+ * preallocated extra num_possible_cpus elements
208+ */
209+ l_new = container_of(l, struct htab_elem, fnode);
210+ *per_cpu_ptr(pptr, cpu) = l_new;
204211 }
205212 htab->extra_elems = pptr;
206213 return 0;
@@ -342,25 +349,25 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr) · 135 unmodified lines
342349 raw_spin_lock_init(&htab->buckets[i].lock);
343350 }
344351
345− if (!percpu && !lru) {
346− /* lru itself can remove the least used element, so
347− * there is no need for an extra elem during map_update.
348− */
349− err = alloc_extra_elems(htab);
350− if (err)
351− goto free_buckets;
352− }
353−
354352 if (prealloc) {
355353 err = prealloc_init(htab);
356354 if (err)
357− goto free_extra_elems;
355+ goto free_buckets;
356+
357+ if (!percpu && !lru) {
358+ /* lru itself can remove the least used element, so
359+ * there is no need for an extra elem during map_update.
360+ */
361+ err = alloc_extra_elems(htab);
362+ if (err)
363+ goto free_prealloc;
364+ }
358365 }
359366
360367 return &htab->map;
361368
362−free_extra_elems:
363− free_percpu(htab->extra_elems);
369+free_prealloc:
370+ prealloc_destroy(htab);
364371 free_buckets:
365372 bpf_map_area_free(htab->buckets);
366373 free_htab:
@@ -575,12 +582,7 @@ static void htab_elem_free_rcu(struct rcu_head *head) · 208 unmodified lines
575582
576583 static void free_htab_elem(struct bpf_htab *htab, struct htab_elem *l)
577584 {
578− if (l->state == HTAB_EXTRA_ELEM_USED) {
579− l->state = HTAB_EXTRA_ELEM_FREE;
580− return;
581− }
582−
583− if (!(htab->map.map_flags & BPF_F_NO_PREALLOC)) {
585+ if (htab_is_prealloc(htab)) {
584586 pcpu_freelist_push(&htab->freelist, &l->fnode);
585587 } else {
586588 atomic_dec(&htab->count);
@@ -610,47 +612,43 @@ static void pcpu_copy_value(struct bpf_htab *htab, void __percpu *pptr, · 23 unmodified lines
610612 static struct htab_elem *alloc_htab_elem(struct bpf_htab *htab, void *key,
611613 void *value, u32 key_size, u32 hash,
612614 bool percpu, bool onallcpus,
613− bool old_elem_exists)
615+ struct htab_elem *old_elem)
614616 {
615617 u32 size = htab->map.value_size;
616− bool prealloc = !(htab->map.map_flags & BPF_F_NO_PREALLOC);
617− struct htab_elem *l_new;
618+ bool prealloc = htab_is_prealloc(htab);
619+ struct htab_elem *l_new, **pl_new;
618620 void __percpu *pptr;
619− int err = 0;
620621
621622 if (prealloc) {
622− struct pcpu_freelist_node *l;
623+ if (old_elem) {
624+ /* if we're updating the existing element,
625+ * use per-cpu extra elems to avoid freelist_pop/push
626+ */
627+ pl_new = this_cpu_ptr(htab->extra_elems);
628+ l_new = *pl_new;
629+ *pl_new = old_elem;
630+ } else {
631+ struct pcpu_freelist_node *l;
623632
624− l = pcpu_freelist_pop(&htab->freelist);
625− if (!l)
626− err = -E2BIG;
627− else
633+ l = pcpu_freelist_pop(&htab->freelist);
634+ if (!l)
635+ return ERR_PTR(-E2BIG);
628636 l_new = container_of(l, struct htab_elem, fnode);
629− } else {
630− if (atomic_inc_return(&htab->count) > htab->map.max_entries) {
631− atomic_dec(&htab->count);
632− err = -E2BIG;
633− } else {
634− l_new = kmalloc(htab->elem_size,
635− GFP_ATOMIC | __GFP_NOWARN);
636− if (!l_new)
637− return ERR_PTR(-ENOMEM);
638637 }
639− }
640−
641− if (err) {
642− if (!old_elem_exists)
643− return ERR_PTR(err);
644−
645− /* if we're updating the existing element and the hash table
646− * is full, use per-cpu extra elems
647− */
648− l_new = this_cpu_ptr(htab->extra_elems);
649− if (l_new->state != HTAB_EXTRA_ELEM_FREE)
650− return ERR_PTR(-E2BIG);
651− l_new->state = HTAB_EXTRA_ELEM_USED;
652638 } else {
653− l_new->state = HTAB_NOT_AN_EXTRA_ELEM;
639+ if (atomic_inc_return(&htab->count) > htab->map.max_entries)
640+ if (!old_elem) {
641+ /* when map is full and update() is replacing
642+ * old element, it's ok to allocate, since
643+ * old element will be freed immediately.
644+ * Otherwise return an error
645+ */
646+ atomic_dec(&htab->count);
647+ return ERR_PTR(-E2BIG);
648+ }
649+ l_new = kmalloc(htab->elem_size, GFP_ATOMIC | __GFP_NOWARN);
650+ if (!l_new)
651+ return ERR_PTR(-ENOMEM);
654652 }
655653
656654 memcpy(l_new->key, key, key_size);
@@ -731,7 +729,7 @@ static int htab_map_update_elem(struct bpf_map *map, void *key, void *value, · 74 unmodified lines
731729 goto err;
732730
733731 l_new = alloc_htab_elem(htab, key, value, key_size, hash, false, false,
734− !!l_old);
732+ l_old);
735733 if (IS_ERR(l_new)) {
736734 /* all pre-allocated elements are in use or memory exhausted */
737735 ret = PTR_ERR(l_new);
@@ -744,7 +742,8 @@ static int htab_map_update_elem(struct bpf_map *map, void *key, void *value, · 6 unmodified lines
744742 hlist_nulls_add_head_rcu(&l_new->hash_node, head);
745743 if (l_old) {
746744 hlist_nulls_del_rcu(&l_old->hash_node);
747− free_htab_elem(htab, l_old);
745+ if (!htab_is_prealloc(htab))
746+ free_htab_elem(htab, l_old);
748747 }
749748 ret = 0;
750749 err:
@@ -856,7 +855,7 @@ static int __htab_percpu_map_update_elem(struct bpf_map *map, void *key, · 105 unmodified lines
856855 value, onallcpus);
857856 } else {
858857 l_new = alloc_htab_elem(htab, key, value, key_size,
859− hash, true, onallcpus, false);
858+ hash, true, onallcpus, NULL);
860859 if (IS_ERR(l_new)) {
861860 ret = PTR_ERR(l_new);
862861 goto err;
@@ -1024,8 +1023,7 @@ static void delete_all_elements(struct bpf_htab *htab) · 161 unmodified lines
10241023
10251024 hlist_nulls_for_each_entry_safe(l, n, head, hash_node) {
10261025 hlist_nulls_del_rcu(&l->hash_node);
1027− if (l->state != HTAB_EXTRA_ELEM_USED)
1028− htab_elem_free(htab, l);
1026+ htab_elem_free(htab, l);
10291027 }
10301028 }
10311029 }
@@ -1045,7 +1043,7 @@ static void htab_map_free(struct bpf_map *map) · 13 unmodified lines
10451043 * not have executed. Wait for them.
10461044 */
10471045 rcu_barrier();
1048− if (htab->map.map_flags & BPF_F_NO_PREALLOC)
1046+ if (!htab_is_prealloc(htab))
10491047 delete_all_elements(htab);
10501048 else
10511049 prealloc_destroy(htab);
kernel/sched/cpufreq_schedutil.c+7−13
@@ -584,20 +584,14 @@ static int sugov_start(struct cpufreq_policy *policy) · 583 unmodified lines
584584 for_each_cpu(cpu, policy->cpus) {
585585 struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu);
586586
587+ memset(sg_cpu, 0, sizeof(*sg_cpu));
587588 sg_cpu->sg_policy = sg_policy;
588− if (policy_is_shared(policy)) {
589− sg_cpu->util = 0;
590− sg_cpu->max = 0;
591− sg_cpu->flags = SCHED_CPUFREQ_RT;
592− sg_cpu->last_update = 0;
593− sg_cpu->iowait_boost = 0;
594− sg_cpu->iowait_boost_max = policy->cpuinfo.max_freq;
595− cpufreq_add_update_util_hook(cpu, &sg_cpu->update_util,
596− sugov_update_shared);
597− } else {
598− cpufreq_add_update_util_hook(cpu, &sg_cpu->update_util,
599− sugov_update_single);
600− }
589+ sg_cpu->flags = SCHED_CPUFREQ_RT;
590+ sg_cpu->iowait_boost_max = policy->cpuinfo.max_freq;
591+ cpufreq_add_update_util_hook(cpu, &sg_cpu->update_util,
592+ policy_is_shared(policy) ?
593+ sugov_update_shared :
594+ sugov_update_single);
601595 }
602596 return 0;
603597 }
mm/swap_slots.c+0−2
@@ -267,8 +267,6 @@ int free_swap_slot(swp_entry_t entry) · 266 unmodified lines
267267 {
268268 struct swap_slots_cache *cache;
269269
270− WARN_ON_ONCE(!swap_slot_cache_initialized);
271−
272270 cache = &get_cpu_var(swp_slots);
273271 if (use_swap_slot_cache && cache->slots_ret) {
274272 spin_lock_irq(&cache->free_lock);
net/batman-adv/bat_iv_ogm.c+11−0
@@ -2477,6 +2477,16 @@ static void batadv_iv_iface_activate(struct batadv_hard_iface *hard_iface) · 2476 unmodified lines
24772477 batadv_iv_ogm_schedule(hard_iface);
24782478 }
24792479
2480+/**
2481+ * batadv_iv_init_sel_class - initialize GW selection class
2482+ * @bat_priv: the bat priv with all the soft interface information
2483+ */
2484+static void batadv_iv_init_sel_class(struct batadv_priv *bat_priv)
2485+{
2486+ /* set default TQ difference threshold to 20 */
2487+ atomic_set(&bat_priv->gw.sel_class, 20);
2488+}
2489+
24802490 static struct batadv_gw_node *
24812491 batadv_iv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
24822492 {
@@ -2823,6 +2833,7 @@ static struct batadv_algo_ops batadv_batman_iv __read_mostly = { · 340 unmodified lines
28232833 .del_if = batadv_iv_ogm_orig_del_if,
28242834 },
28252835 .gw = {
2836+ .init_sel_class = batadv_iv_init_sel_class,
28262837 .get_best_gw_node = batadv_iv_gw_get_best_gw_node,
28272838 .is_eligible = batadv_iv_gw_is_eligible,
28282839 #ifdef CONFIG_BATMAN_ADV_DEBUGFS
net/batman-adv/bat_v.c+11−3
@@ -668,6 +668,16 @@ err_ifinfo1: · 667 unmodified lines
668668 return ret;
669669 }
670670
671+/**
672+ * batadv_v_init_sel_class - initialize GW selection class
673+ * @bat_priv: the bat priv with all the soft interface information
674+ */
675+static void batadv_v_init_sel_class(struct batadv_priv *bat_priv)
676+{
677+ /* set default throughput difference threshold to 5Mbps */
678+ atomic_set(&bat_priv->gw.sel_class, 50);
679+}
680+
671681 static ssize_t batadv_v_store_sel_class(struct batadv_priv *bat_priv,
672682 char *buff, size_t count)
673683 {
@@ -1052,6 +1062,7 @@ static struct batadv_algo_ops batadv_batman_v __read_mostly = { · 378 unmodified lines
10521062 .dump = batadv_v_orig_dump,
10531063 },
10541064 .gw = {
1065+ .init_sel_class = batadv_v_init_sel_class,
10551066 .store_sel_class = batadv_v_store_sel_class,
10561067 .show_sel_class = batadv_v_show_sel_class,
10571068 .get_best_gw_node = batadv_v_gw_get_best_gw_node,
@@ -1092,9 +1103,6 @@ int batadv_v_mesh_init(struct batadv_priv *bat_priv) · 34 unmodified lines
10921103 if (ret < 0)
10931104 return ret;
10941105
1095− /* set default throughput difference threshold to 5Mbps */
1096− atomic_set(&bat_priv->gw.sel_class, 50);
1097−
10981106 return 0;
10991107 }
11001108
net/batman-adv/fragmentation.c+13−7
@@ -404,7 +404,7 @@ out: · 403 unmodified lines
404404 * batadv_frag_create - create a fragment from skb
405405 * @skb: skb to create fragment from
406406 * @frag_head: header to use in new fragment
407− * @mtu: size of new fragment
407+ * @fragment_size: size of new fragment
408408 *
409409 * Split the passed skb into two fragments: A new one with size matching the
410410 * passed mtu and the old one with the rest. The new skb contains data from the
@@ -414,11 +414,11 @@ out: · 3 unmodified lines
414414 */
415415 static struct sk_buff *batadv_frag_create(struct sk_buff *skb,
416416 struct batadv_frag_packet *frag_head,
417− unsigned int mtu)
417+ unsigned int fragment_size)
418418 {
419419 struct sk_buff *skb_fragment;
420420 unsigned int header_size = sizeof(*frag_head);
421− unsigned int fragment_size = mtu - header_size;
421+ unsigned int mtu = fragment_size + header_size;
422422
423423 skb_fragment = netdev_alloc_skb(NULL, mtu + ETH_HLEN);
424424 if (!skb_fragment)
@@ -456,7 +456,7 @@ int batadv_frag_send_packet(struct sk_buff *skb, · 31 unmodified lines
456456 struct sk_buff *skb_fragment;
457457 unsigned int mtu = neigh_node->if_incoming->net_dev->mtu;
458458 unsigned int header_size = sizeof(frag_header);
459− unsigned int max_fragment_size, max_packet_size;
459+ unsigned int max_fragment_size, num_fragments;
460460 int ret;
461461
462462 /* To avoid merge and refragmentation at next-hops we never send
@@ -464,10 +464,15 @@ int batadv_frag_send_packet(struct sk_buff *skb, · 1 unmodified line
464464 */
465465 mtu = min_t(unsigned int, mtu, BATADV_FRAG_MAX_FRAG_SIZE);
466466 max_fragment_size = mtu - header_size;
467− max_packet_size = max_fragment_size * BATADV_FRAG_MAX_FRAGMENTS;
467+
468+ if (skb->len == 0 || max_fragment_size == 0)
469+ return -EINVAL;
470+
471+ num_fragments = (skb->len - 1) / max_fragment_size + 1;
472+ max_fragment_size = (skb->len - 1) / num_fragments + 1;
468473
469474 /* Don't even try to fragment, if we need more than 16 fragments */
470− if (skb->len > max_packet_size) {
475+ if (num_fragments > BATADV_FRAG_MAX_FRAGMENTS) {
471476 ret = -EAGAIN;
472477 goto free_skb;
473478 }
@@ -507,7 +512,8 @@ int batadv_frag_send_packet(struct sk_buff *skb, · 33 unmodified lines
507512 goto put_primary_if;
508513 }
509514
510− skb_fragment = batadv_frag_create(skb, &frag_header, mtu);
515+ skb_fragment = batadv_frag_create(skb, &frag_header,
516+ max_fragment_size);
511517 if (!skb_fragment) {
512518 ret = -ENOMEM;
513519 goto put_primary_if;
net/batman-adv/gateway_common.c+5−0
@@ -253,6 +253,11 @@ static void batadv_gw_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, · 252 unmodified lines
253253 */
254254 void batadv_gw_init(struct batadv_priv *bat_priv)
255255 {
256+ if (bat_priv->algo_ops->gw.init_sel_class)
257+ bat_priv->algo_ops->gw.init_sel_class(bat_priv);
258+ else
259+ atomic_set(&bat_priv->gw.sel_class, 1);
260+
256261 batadv_tvlv_handler_register(bat_priv, batadv_gw_tvlv_ogm_handler_v1,
257262 NULL, BATADV_TVLV_GW, 1,
258263 BATADV_TVLV_HANDLER_OGM_CIFNOTFND);
net/batman-adv/soft-interface.c+0−1
@@ -819,7 +819,6 @@ static int batadv_softif_init_late(struct net_device *dev) · 818 unmodified lines
819819 atomic_set(&bat_priv->mcast.num_want_all_ipv6, 0);
820820 #endif
821821 atomic_set(&bat_priv->gw.mode, BATADV_GW_MODE_OFF);
822− atomic_set(&bat_priv->gw.sel_class, 20);
823822 atomic_set(&bat_priv->gw.bandwidth_down, 100);
824823 atomic_set(&bat_priv->gw.bandwidth_up, 20);
825824 atomic_set(&bat_priv->orig_interval, 1000);
net/batman-adv/types.h+2−0
@@ -1489,6 +1489,7 @@ struct batadv_algo_orig_ops { · 1488 unmodified lines
14891489
14901490 /**
14911491 * struct batadv_algo_gw_ops - mesh algorithm callbacks (GW specific)
1492+ * @init_sel_class: initialize GW selection class (optional)
14921493 * @store_sel_class: parse and stores a new GW selection class (optional)
14931494 * @show_sel_class: prints the current GW selection class (optional)
14941495 * @get_best_gw_node: select the best GW from the list of available nodes
@@ -1499,6 +1500,7 @@ struct batadv_algo_orig_ops { · 4 unmodified lines
14991500 * @dump: dump gateways to a netlink socket (optional)
15001501 */
15011502 struct batadv_algo_gw_ops {
1503+ void (*init_sel_class)(struct batadv_priv *bat_priv);
15021504 ssize_t (*store_sel_class)(struct batadv_priv *bat_priv, char *buff,
15031505 size_t count);
15041506 ssize_t (*show_sel_class)(struct batadv_priv *bat_priv, char *buff);
net/bridge/br_fdb.c+1−1
@@ -106,7 +106,7 @@ static struct net_bridge_fdb_entry *br_fdb_find(struct net_bridge *br, · 105 unmodified lines
106106 struct hlist_head *head = &br->hash[br_mac_hash(addr, vid)];
107107 struct net_bridge_fdb_entry *fdb;
108108
109− WARN_ON_ONCE(!br_hash_lock_held(br));
109+ lockdep_assert_held_once(&br->hash_lock);
110110
111111 rcu_read_lock();
112112 fdb = fdb_find_rcu(head, addr, vid);
net/bridge/br_netfilter_hooks.c+7−5
@@ -706,18 +706,20 @@ static unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb) · 705 unmodified lines
706706
707707 static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff *skb)
708708 {
709− struct nf_bridge_info *nf_bridge;
710− unsigned int mtu_reserved;
709+ struct nf_bridge_info *nf_bridge = nf_bridge_info_get(skb);
710+ unsigned int mtu, mtu_reserved;
711711
712712 mtu_reserved = nf_bridge_mtu_reduction(skb);
713+ mtu = skb->dev->mtu;
714+
715+ if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu)
716+ mtu = nf_bridge->frag_max_size;
713717
714− if (skb_is_gso(skb) || skb->len + mtu_reserved <= skb->dev->mtu) {
718+ if (skb_is_gso(skb) || skb->len + mtu_reserved <= mtu) {
715719 nf_bridge_info_free(skb);
716720 return br_dev_queue_push_xmit(net, sk, skb);
717721 }
718722
719− nf_bridge = nf_bridge_info_get(skb);
720−
721723 /* This is wrong! We should preserve the original fragment
722724 * boundaries by preserving frag_list rather than refragmenting.
723725 */
net/bridge/br_private.h+0−9
@@ -531,15 +531,6 @@ int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_port *p, · 530 unmodified lines
531531 int br_fdb_external_learn_del(struct net_bridge *br, struct net_bridge_port *p,
532532 const unsigned char *addr, u16 vid);
533533
534−static inline bool br_hash_lock_held(struct net_bridge *br)
535−{
536−#ifdef CONFIG_LOCKDEP
537− return lockdep_is_held(&br->hash_lock);
538−#else
539− return true;
540−#endif
541−}
542−
543534 /* br_forward.c */
544535 enum br_pkt_type {
545536 BR_PKT_UNICAST,
net/ceph/messenger.c+6−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 #include <linux/kthread.h>
88 #include <linux/net.h>
99 #include <linux/nsproxy.h>
10+#include <linux/sched/mm.h>
1011 #include <linux/slab.h>
1112 #include <linux/socket.h>
1213 #include <linux/string.h>
@@ -469,11 +470,16 @@ static int ceph_tcp_connect(struct ceph_connection *con) · 456 unmodified lines
469470 {
470471 struct sockaddr_storage *paddr = &con->peer_addr.in_addr;
471472 struct socket *sock;
473+ unsigned int noio_flag;
472474 int ret;
473475
474476 BUG_ON(con->sock);
477+
478+ /* sock_create_kern() allocates with GFP_KERNEL */
479+ noio_flag = memalloc_noio_save();
475480 ret = sock_create_kern(read_pnet(&con->msgr->net), paddr->ss_family,
476481 SOCK_STREAM, IPPROTO_TCP, &sock);
482+ memalloc_noio_restore(noio_flag);
477483 if (ret)
478484 return ret;
479485 sock->sk->sk_allocation = GFP_NOFS;
net/core/netclassid_cgroup.c+16−16
@@ -71,27 +71,17 @@ static int update_classid_sock(const void *v, struct file *file, unsigned n) · 70 unmodified lines
7171 return 0;
7272 }
7373
74−static void update_classid(struct cgroup_subsys_state *css, void *v)
74+static void cgrp_attach(struct cgroup_taskset *tset)
7575 {
76− struct css_task_iter it;
76+ struct cgroup_subsys_state *css;
7777 struct task_struct *p;
7878
79− css_task_iter_start(css, &it);
80− while ((p = css_task_iter_next(&it))) {
79+ cgroup_taskset_for_each(p, css, tset) {
8180 task_lock(p);
82− iterate_fd(p->files, 0, update_classid_sock, v);
81+ iterate_fd(p->files, 0, update_classid_sock,
82+ (void *)(unsigned long)css_cls_state(css)->classid);
8383 task_unlock(p);
8484 }
85− css_task_iter_end(&it);
86−}
87−
88−static void cgrp_attach(struct cgroup_taskset *tset)
89−{
90− struct cgroup_subsys_state *css;
91−
92− cgroup_taskset_first(tset, &css);
93− update_classid(css,
94− (void *)(unsigned long)css_cls_state(css)->classid);
9585 }
9686
9787 static u64 read_classid(struct cgroup_subsys_state *css, struct cftype *cft)
@@ -103,12 +93,22 @@ static int write_classid(struct cgroup_subsys_state *css, struct cftype *cft, · 5 unmodified lines
10393 u64 value)
10494 {
10595 struct cgroup_cls_state *cs = css_cls_state(css);
96+ struct css_task_iter it;
97+ struct task_struct *p;
10698
10799 cgroup_sk_alloc_disable();
108100
109101 cs->classid = (u32)value;
110102
111− update_classid(css, (void *)(unsigned long)cs->classid);
103+ css_task_iter_start(css, &it);
104+ while ((p = css_task_iter_next(&it))) {
105+ task_lock(p);
106+ iterate_fd(p->files, 0, update_classid_sock,
107+ (void *)(unsigned long)cs->classid);
108+ task_unlock(p);
109+ }
110+ css_task_iter_end(&it);
111+
112112 return 0;
113113 }
114114
net/core/skbuff.c+21−6
@@ -3694,6 +3694,15 @@ static void sock_rmem_free(struct sk_buff *skb) · 3693 unmodified lines
36943694 atomic_sub(skb->truesize, &sk->sk_rmem_alloc);
36953695 }
36963696
3697+static void skb_set_err_queue(struct sk_buff *skb)
3698+{
3699+ /* pkt_type of skbs received on local sockets is never PACKET_OUTGOING.
3700+ * So, it is safe to (mis)use it to mark skbs on the error queue.
3701+ */
3702+ skb->pkt_type = PACKET_OUTGOING;
3703+ BUILD_BUG_ON(PACKET_OUTGOING == 0);
3704+}
3705+
36973706 /*
36983707 * Note: We dont mem charge error packets (no sk_forward_alloc changes)
36993708 */
@@ -3707,6 +3716,7 @@ int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) · 7 unmodified lines
37073716 skb->sk = sk;
37083717 skb->destructor = sock_rmem_free;
37093718 atomic_add(skb->truesize, &sk->sk_rmem_alloc);
3719+ skb_set_err_queue(skb);
37103720
37113721 /* before exiting rcu section, make sure dst is refcounted */
37123722 skb_dst_force(skb);
@@ -3783,16 +3793,20 @@ EXPORT_SYMBOL(skb_clone_sk); · 70 unmodified lines
37833793
37843794 static void __skb_complete_tx_timestamp(struct sk_buff *skb,
37853795 struct sock *sk,
3786− int tstype)
3796+ int tstype,
3797+ bool opt_stats)
37873798 {
37883799 struct sock_exterr_skb *serr;
37893800 int err;
37903801
3802+ BUILD_BUG_ON(sizeof(struct sock_exterr_skb) > sizeof(skb->cb));
3803+
37913804 serr = SKB_EXT_ERR(skb);
37923805 memset(serr, 0, sizeof(*serr));
37933806 serr->ee.ee_errno = ENOMSG;
37943807 serr->ee.ee_origin = SO_EE_ORIGIN_TIMESTAMPING;
37953808 serr->ee.ee_info = tstype;
3809+ serr->opt_stats = opt_stats;
37963810 if (sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID) {
37973811 serr->ee.ee_data = skb_shinfo(skb)->tskey;
37983812 if (sk->sk_protocol == IPPROTO_TCP &&
@@ -3833,7 +3847,7 @@ void skb_complete_tx_timestamp(struct sk_buff *skb, · 34 unmodified lines
38333847 */
38343848 if (likely(atomic_inc_not_zero(&sk->sk_refcnt))) {
38353849 *skb_hwtstamps(skb) = *hwtstamps;
3836− __skb_complete_tx_timestamp(skb, sk, SCM_TSTAMP_SND);
3850+ __skb_complete_tx_timestamp(skb, sk, SCM_TSTAMP_SND, false);
38373851 sock_put(sk);
38383852 }
38393853 }
@@ -3844,7 +3858,7 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb, · 4 unmodified lines
38443858 struct sock *sk, int tstype)
38453859 {
38463860 struct sk_buff *skb;
3847− bool tsonly;
3861+ bool tsonly, opt_stats = false;
38483862
38493863 if (!sk)
38503864 return;
@@ -3857,9 +3871,10 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb, · 6 unmodified lines
38573871 #ifdef CONFIG_INET
38583872 if ((sk->sk_tsflags & SOF_TIMESTAMPING_OPT_STATS) &&
38593873 sk->sk_protocol == IPPROTO_TCP &&
3860− sk->sk_type == SOCK_STREAM)
3874+ sk->sk_type == SOCK_STREAM) {
38613875 skb = tcp_get_timestamping_opt_stats(sk);
3862− else
3876+ opt_stats = true;
3877+ } else
38633878 #endif
38643879 skb = alloc_skb(0, GFP_ATOMIC);
38653880 } else {
@@ -3878,7 +3893,7 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb, · 12 unmodified lines
38783893 else
38793894 skb->tstamp = ktime_get_real();
38803895
3881− __skb_complete_tx_timestamp(skb, sk, tstype);
3896+ __skb_complete_tx_timestamp(skb, sk, tstype, opt_stats);
38823897 }
38833898 EXPORT_SYMBOL_GPL(__skb_tstamp_tx);
38843899
net/core/sock.c+11−5
@@ -1442,6 +1442,11 @@ static void __sk_destruct(struct rcu_head *head) · 1441 unmodified lines
14421442 pr_debug("%s: optmem leakage (%d bytes) detected\n",
14431443 __func__, atomic_read(&sk->sk_omem_alloc));
14441444
1445+ if (sk->sk_frag.page) {
1446+ put_page(sk->sk_frag.page);
1447+ sk->sk_frag.page = NULL;
1448+ }
1449+
14451450 if (sk->sk_peer_cred)
14461451 put_cred(sk->sk_peer_cred);
14471452 put_pid(sk->sk_peer_pid);
@@ -1539,6 +1544,12 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) · 91 unmodified lines
15391544 is_charged = sk_filter_charge(newsk, filter);
15401545
15411546 if (unlikely(!is_charged || xfrm_sk_clone_policy(newsk, sk))) {
1547+ /* We need to make sure that we don't uncharge the new
1548+ * socket if we couldn't charge it in the first place
1549+ * as otherwise we uncharge the parent's filter.
1550+ */
1551+ if (!is_charged)
1552+ RCU_INIT_POINTER(newsk->sk_filter, NULL);
15421553 sk_free_unlock_clone(newsk);
15431554 newsk = NULL;
15441555 goto out;
@@ -2787,11 +2798,6 @@ void sk_common_release(struct sock *sk) · 1242 unmodified lines
27872798
27882799 sk_refcnt_debug_release(sk);
27892800
2790− if (sk->sk_frag.page) {
2791− put_page(sk->sk_frag.page);
2792− sk->sk_frag.page = NULL;
2793− }
2794−
27952801 sock_put(sk);
27962802 }
27972803 EXPORT_SYMBOL(sk_common_release);
net/ipv4/fib_frontend.c+2−1
@@ -1083,7 +1083,8 @@ static void nl_fib_input(struct sk_buff *skb) · 1082 unmodified lines
10831083
10841084 net = sock_net(skb->sk);
10851085 nlh = nlmsg_hdr(skb);
1086− if (skb->len < NLMSG_HDRLEN || skb->len < nlh->nlmsg_len ||
1086+ if (skb->len < nlmsg_total_size(sizeof(*frn)) ||
1087+ skb->len < nlh->nlmsg_len ||
10871088 nlmsg_len(nlh) < sizeof(*frn))
10881089 return;
10891090
net/ipv4/ip_fragment.c+17−8
@@ -198,6 +198,7 @@ static void ip_expire(unsigned long arg) · 197 unmodified lines
198198 qp = container_of((struct inet_frag_queue *) arg, struct ipq, q);
199199 net = container_of(qp->q.net, struct net, ipv4.frags);
200200
201+ rcu_read_lock();
201202 spin_lock(&qp->q.lock);
202203
203204 if (qp->q.flags & INET_FRAG_COMPLETE)
@@ -207,7 +208,7 @@ static void ip_expire(unsigned long arg) · 3 unmodified lines
207208 __IP_INC_STATS(net, IPSTATS_MIB_REASMFAILS);
208209
209210 if (!inet_frag_evicting(&qp->q)) {
210− struct sk_buff *head = qp->q.fragments;
211+ struct sk_buff *clone, *head = qp->q.fragments;
211212 const struct iphdr *iph;
212213 int err;
213214
@@ -216,32 +217,40 @@ static void ip_expire(unsigned long arg) · 2 unmodified lines
216217 if (!(qp->q.flags & INET_FRAG_FIRST_IN) || !qp->q.fragments)
217218 goto out;
218219
219− rcu_read_lock();
220220 head->dev = dev_get_by_index_rcu(net, qp->iif);
221221 if (!head->dev)
222− goto out_rcu_unlock;
222+ goto out;
223+
223224
224225 /* skb has no dst, perform route lookup again */
225226 iph = ip_hdr(head);
226227 err = ip_route_input_noref(head, iph->daddr, iph->saddr,
227228 iph->tos, head->dev);
228229 if (err)
229− goto out_rcu_unlock;
230+ goto out;
230231
231232 /* Only an end host needs to send an ICMP
232233 * "Fragment Reassembly Timeout" message, per RFC792.
233234 */
234235 if (frag_expire_skip_icmp(qp->user) &&
235236 (skb_rtable(head)->rt_type != RTN_LOCAL))
236− goto out_rcu_unlock;
237+ goto out;
238+
239+ clone = skb_clone(head, GFP_ATOMIC);
237240
238241 /* Send an ICMP "Fragment Reassembly Timeout" message. */
239− icmp_send(head, ICMP_TIME_EXCEEDED, ICMP_EXC_FRAGTIME, 0);
240−out_rcu_unlock:
241− rcu_read_unlock();
242+ if (clone) {
243+ spin_unlock(&qp->q.lock);
244+ icmp_send(clone, ICMP_TIME_EXCEEDED,
245+ ICMP_EXC_FRAGTIME, 0);
246+ consume_skb(clone);
247+ goto out_rcu_unlock;
248+ }
242249 }
243250 out:
244251 spin_unlock(&qp->q.lock);
252+out_rcu_unlock:
253+ rcu_read_unlock();
245254 ipq_put(qp);
246255 }
247256
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c+4−0
@@ -165,6 +165,10 @@ static unsigned int ipv4_conntrack_local(void *priv, · 164 unmodified lines
165165 if (skb->len < sizeof(struct iphdr) ||
166166 ip_hdrlen(skb) < sizeof(struct iphdr))
167167 return NF_ACCEPT;
168+
169+ if (ip_is_fragment(ip_hdr(skb))) /* IP_NODEFRAG setsockopt set */
170+ return NF_ACCEPT;
171+
168172 return nf_conntrack_in(state->net, PF_INET, state->hook, skb);
169173 }
170174
net/ipv4/netfilter/nf_nat_l3proto_ipv4.c+0−5
@@ -255,11 +255,6 @@ nf_nat_ipv4_fn(void *priv, struct sk_buff *skb, · 254 unmodified lines
255255 /* maniptype == SRC for postrouting. */
256256 enum nf_nat_manip_type maniptype = HOOK2MANIP(state->hook);
257257
258− /* We never see fragments: conntrack defrags on pre-routing
259− * and local-out, and nf_nat_out protects post-routing.
260− */
261− NF_CT_ASSERT(!ip_is_fragment(ip_hdr(skb)));
262−
263258 ct = nf_ct_get(skb, &ctinfo);
264259 /* Can't track? It's not due to stress, or conntrack would
265260 * have dropped it. Hence it's the user's responsibilty to
net/ipv4/netfilter/nft_masq_ipv4.c+4−4
@@ -26,10 +26,10 @@ static void nft_masq_ipv4_eval(const struct nft_expr *expr, · 25 unmodified lines
2626 memset(&range, 0, sizeof(range));
2727 range.flags = priv->flags;
2828 if (priv->sreg_proto_min) {
29− range.min_proto.all =
30− *(__be16 *)&regs->data[priv->sreg_proto_min];
31− range.max_proto.all =
32− *(__be16 *)&regs->data[priv->sreg_proto_max];
29+ range.min_proto.all = (__force __be16)nft_reg_load16(
30+ &regs->data[priv->sreg_proto_min]);
31+ range.max_proto.all = (__force __be16)nft_reg_load16(
32+ &regs->data[priv->sreg_proto_max]);
3333 }
3434 regs->verdict.code = nf_nat_masquerade_ipv4(pkt->skb, nft_hook(pkt),
3535 &range, nft_out(pkt));
net/ipv4/netfilter/nft_redir_ipv4.c+4−4
@@ -26,10 +26,10 @@ static void nft_redir_ipv4_eval(const struct nft_expr *expr, · 25 unmodified lines
2626
2727 memset(&mr, 0, sizeof(mr));
2828 if (priv->sreg_proto_min) {
29− mr.range[0].min.all =
30− *(__be16 *)&regs->data[priv->sreg_proto_min];
31− mr.range[0].max.all =
32− *(__be16 *)&regs->data[priv->sreg_proto_max];
29+ mr.range[0].min.all = (__force __be16)nft_reg_load16(
30+ &regs->data[priv->sreg_proto_min]);
31+ mr.range[0].max.all = (__force __be16)nft_reg_load16(
32+ &regs->data[priv->sreg_proto_max]);
3333 mr.range[0].flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
3434 }
3535
net/ipv4/tcp.c+2−1
@@ -2770,7 +2770,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) · 2769 unmodified lines
27702770 {
27712771 const struct tcp_sock *tp = tcp_sk(sk); /* iff sk_type == SOCK_STREAM */
27722772 const struct inet_connection_sock *icsk = inet_csk(sk);
2773− u32 now = tcp_time_stamp, intv;
2773+ u32 now, intv;
27742774 u64 rate64;
27752775 bool slow;
27762776 u32 rate;
@@ -2839,6 +2839,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) · 62 unmodified lines
28392839 info->tcpi_retrans = tp->retrans_out;
28402840 info->tcpi_fackets = tp->fackets_out;
28412841
2842+ now = tcp_time_stamp;
28422843 info->tcpi_last_data_sent = jiffies_to_msecs(now - tp->lsndtime);
28432844 info->tcpi_last_data_recv = jiffies_to_msecs(now - icsk->icsk_ack.lrcvtime);
28442845 info->tcpi_last_ack_recv = jiffies_to_msecs(now - tp->rcv_tstamp);
net/ipv4/tcp_input.c+1−1
@@ -5541,6 +5541,7 @@ void tcp_finish_connect(struct sock *sk, struct sk_buff *skb) · 5540 unmodified lines
55415541 struct inet_connection_sock *icsk = inet_csk(sk);
55425542
55435543 tcp_set_state(sk, TCP_ESTABLISHED);
5544+ icsk->icsk_ack.lrcvtime = tcp_time_stamp;
55445545
55455546 if (skb) {
55465547 icsk->icsk_af_ops->sk_rx_dst_set(sk, skb);
@@ -5759,7 +5760,6 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, · 212 unmodified lines
57595760 * to stand against the temptation 8) --ANK
57605761 */
57615762 inet_csk_schedule_ack(sk);
5762− icsk->icsk_ack.lrcvtime = tcp_time_stamp;
57635763 tcp_enter_quickack_mode(sk);
57645764 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
57655765 TCP_DELACK_MAX, TCP_RTO_MAX);
net/ipv4/tcp_minisocks.c+1−0
@@ -460,6 +460,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, · 459 unmodified lines
460460 newtp->mdev_us = jiffies_to_usecs(TCP_TIMEOUT_INIT);
461461 minmax_reset(&newtp->rtt_min, tcp_time_stamp, ~0U);
462462 newicsk->icsk_rto = TCP_TIMEOUT_INIT;
463+ newicsk->icsk_ack.lrcvtime = tcp_time_stamp;
463464
464465 newtp->packets_out = 0;
465466 newtp->retrans_out = 0;
net/ipv6/netfilter/nft_masq_ipv6.c+4−4
@@ -27,10 +27,10 @@ static void nft_masq_ipv6_eval(const struct nft_expr *expr, · 26 unmodified lines
2727 memset(&range, 0, sizeof(range));
2828 range.flags = priv->flags;
2929 if (priv->sreg_proto_min) {
30− range.min_proto.all =
31− *(__be16 *)&regs->data[priv->sreg_proto_min];
32− range.max_proto.all =
33− *(__be16 *)&regs->data[priv->sreg_proto_max];
30+ range.min_proto.all = (__force __be16)nft_reg_load16(
31+ &regs->data[priv->sreg_proto_min]);
32+ range.max_proto.all = (__force __be16)nft_reg_load16(
33+ &regs->data[priv->sreg_proto_max]);
3434 }
3535 regs->verdict.code = nf_nat_masquerade_ipv6(pkt->skb, &range,
3636 nft_out(pkt));
net/ipv6/netfilter/nft_redir_ipv6.c+4−4
@@ -26,10 +26,10 @@ static void nft_redir_ipv6_eval(const struct nft_expr *expr, · 25 unmodified lines
2626
2727 memset(&range, 0, sizeof(range));
2828 if (priv->sreg_proto_min) {
29− range.min_proto.all =
30− *(__be16 *)&regs->data[priv->sreg_proto_min],
31− range.max_proto.all =
32− *(__be16 *)&regs->data[priv->sreg_proto_max],
29+ range.min_proto.all = (__force __be16)nft_reg_load16(
30+ &regs->data[priv->sreg_proto_min]);
31+ range.max_proto.all = (__force __be16)nft_reg_load16(
32+ &regs->data[priv->sreg_proto_max]);
3333 range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
3434 }
3535
net/ipv6/route.c+2−0
@@ -3423,6 +3423,8 @@ static int rt6_fill_node(struct net *net, · 3422 unmodified lines
34233423 }
34243424 else if (rt->rt6i_flags & RTF_LOCAL)
34253425 rtm->rtm_type = RTN_LOCAL;
3426+ else if (rt->rt6i_flags & RTF_ANYCAST)
3427+ rtm->rtm_type = RTN_ANYCAST;
34263428 else if (rt->dst.dev && (rt->dst.dev->flags & IFF_LOOPBACK))
34273429 rtm->rtm_type = RTN_LOCAL;
34283430 else
net/ipv6/udp.c+1−1
@@ -1035,6 +1035,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) · 1034 unmodified lines
10351035 ipc6.hlimit = -1;
10361036 ipc6.tclass = -1;
10371037 ipc6.dontfrag = -1;
1038+ sockc.tsflags = sk->sk_tsflags;
10381039
10391040 /* destination address check */
10401041 if (sin6) {
@@ -1159,7 +1160,6 @@ do_udp_sendmsg: · 118 unmodified lines
11591160
11601161 fl6.flowi6_mark = sk->sk_mark;
11611162 fl6.flowi6_uid = sk->sk_uid;
1162− sockc.tsflags = sk->sk_tsflags;
11631163
11641164 if (msg->msg_controllen) {
11651165 opt = &opt_space;
net/mpls/af_mpls.c+10−3
@@ -1269,6 +1269,8 @@ static void mpls_ifdown(struct net_device *dev, int event) · 1268 unmodified lines
12691269 {
12701270 struct mpls_route __rcu **platform_label;
12711271 struct net *net = dev_net(dev);
1272+ unsigned int nh_flags = RTNH_F_DEAD | RTNH_F_LINKDOWN;
1273+ unsigned int alive;
12721274 unsigned index;
12731275
12741276 platform_label = rtnl_dereference(net->mpls.platform_label);
@@ -1278,9 +1280,11 @@ static void mpls_ifdown(struct net_device *dev, int event) · 3 unmodified lines
12781280 if (!rt)
12791281 continue;
12801282
1283+ alive = 0;
12811284 change_nexthops(rt) {
12821285 if (rtnl_dereference(nh->nh_dev) != dev)
1283− continue;
1286+ goto next;
1287+
12841288 switch (event) {
12851289 case NETDEV_DOWN:
12861290 case NETDEV_UNREGISTER:
@@ -1288,13 +1292,16 @@ static void mpls_ifdown(struct net_device *dev, int event) · 1 unmodified line
12881292 /* fall through */
12891293 case NETDEV_CHANGE:
12901294 nh->nh_flags |= RTNH_F_LINKDOWN;
1291− if (event != NETDEV_UNREGISTER)
1292− ACCESS_ONCE(rt->rt_nhn_alive) = rt->rt_nhn_alive - 1;
12931295 break;
12941296 }
12951297 if (event == NETDEV_UNREGISTER)
12961298 RCU_INIT_POINTER(nh->nh_dev, NULL);
1299+next:
1300+ if (!(nh->nh_flags & nh_flags))
1301+ alive++;
12971302 } endfor_nexthops(rt);
1303+
1304+ WRITE_ONCE(rt->rt_nhn_alive, alive);
12981305 }
12991306 }
13001307
net/netfilter/nf_conntrack_core.c+5−1
@@ -181,7 +181,11 @@ EXPORT_SYMBOL_GPL(nf_conntrack_htable_size); · 180 unmodified lines
181181 unsigned int nf_conntrack_max __read_mostly;
182182 seqcount_t nf_conntrack_generation __read_mostly;
183183
184−DEFINE_PER_CPU(struct nf_conn, nf_conntrack_untracked);
184+/* nf_conn must be 8 bytes aligned, as the 3 LSB bits are used
185+ * for the nfctinfo. We cheat by (ab)using the PER CPU cache line
186+ * alignment to enforce this.
187+ */
188+DEFINE_PER_CPU_ALIGNED(struct nf_conn, nf_conntrack_untracked);
185189 EXPORT_PER_CPU_SYMBOL(nf_conntrack_untracked);
186190
187191 static unsigned int nf_conntrack_hash_rnd __read_mostly;
net/netfilter/nf_nat_proto_sctp.c+12−1
@@ -33,8 +33,16 @@ sctp_manip_pkt(struct sk_buff *skb, · 32 unmodified lines
3333 enum nf_nat_manip_type maniptype)
3434 {
3535 sctp_sctphdr_t *hdr;
36+ int hdrsize = 8;
3637
37− if (!skb_make_writable(skb, hdroff + sizeof(*hdr)))
38+ /* This could be an inner header returned in imcp packet; in such
39+ * cases we cannot update the checksum field since it is outside
40+ * of the 8 bytes of transport layer headers we are guaranteed.
41+ */
42+ if (skb->len >= hdroff + sizeof(*hdr))
43+ hdrsize = sizeof(*hdr);
44+
45+ if (!skb_make_writable(skb, hdroff + hdrsize))
3846 return false;
3947
4048 hdr = (struct sctphdr *)(skb->data + hdroff);
@@ -47,6 +55,9 @@ sctp_manip_pkt(struct sk_buff *skb, · 6 unmodified lines
4755 hdr->dest = tuple->dst.u.sctp.port;
4856 }
4957
58+ if (hdrsize < sizeof(*hdr))
59+ return true;
60+
5061 if (skb->ip_summed != CHECKSUM_PARTIAL) {
5162 hdr->checksum = sctp_compute_cksum(skb, hdroff);
5263 skb->ip_summed = CHECKSUM_NONE;
net/netfilter/nf_tables_api.c+0−4
@@ -3145,7 +3145,6 @@ int nf_tables_bind_set(const struct nft_ctx *ctx, struct nft_set *set, · 3144 unmodified lines
31453145 iter.count = 0;
31463146 iter.err = 0;
31473147 iter.fn = nf_tables_bind_check_setelem;
3148− iter.flush = false;
31493148
31503149 set->ops->walk(ctx, set, &iter);
31513150 if (iter.err < 0)
@@ -3399,7 +3398,6 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb) · 247 unmodified lines
33993398 args.iter.count = 0;
34003399 args.iter.err = 0;
34013400 args.iter.fn = nf_tables_dump_setelem;
3402− args.iter.flush = false;
34033401 set->ops->walk(&ctx, set, &args.iter);
34043402
34053403 nla_nest_end(skb, nest);
@@ -3963,7 +3961,6 @@ static int nf_tables_delsetelem(struct net *net, struct sock *nlsk, · 557 unmodified lines
39633961 struct nft_set_iter iter = {
39643962 .genmask = genmask,
39653963 .fn = nft_flush_set,
3966− .flush = true,
39673964 };
39683965 set->ops->walk(&ctx, set, &iter);
39693966
@@ -5114,7 +5111,6 @@ static int nf_tables_check_loops(const struct nft_ctx *ctx, · 1144 unmodified lines
51145111 iter.count = 0;
51155112 iter.err = 0;
51165113 iter.fn = nf_tables_loop_check_setelem;
5117− iter.flush = false;
51185114
51195115 set->ops->walk(ctx, set, &iter);
51205116 if (iter.err < 0)
net/netfilter/nft_ct.c+12−9
@@ -83,7 +83,7 @@ static void nft_ct_get_eval(const struct nft_expr *expr, · 82 unmodified lines
8383
8484 switch (priv->key) {
8585 case NFT_CT_DIRECTION:
86− *dest = CTINFO2DIR(ctinfo);
86+ nft_reg_store8(dest, CTINFO2DIR(ctinfo));
8787 return;
8888 case NFT_CT_STATUS:
8989 *dest = ct->status;
@@ -151,20 +151,22 @@ static void nft_ct_get_eval(const struct nft_expr *expr, · 61 unmodified lines
151151 return;
152152 }
153153 case NFT_CT_L3PROTOCOL:
154− *dest = nf_ct_l3num(ct);
154+ nft_reg_store8(dest, nf_ct_l3num(ct));
155155 return;
156156 case NFT_CT_PROTOCOL:
157− *dest = nf_ct_protonum(ct);
157+ nft_reg_store8(dest, nf_ct_protonum(ct));
158158 return;
159159 #ifdef CONFIG_NF_CONNTRACK_ZONES
160160 case NFT_CT_ZONE: {
161161 const struct nf_conntrack_zone *zone = nf_ct_zone(ct);
162+ u16 zoneid;
162163
163164 if (priv->dir < IP_CT_DIR_MAX)
164− *dest = nf_ct_zone_id(zone, priv->dir);
165+ zoneid = nf_ct_zone_id(zone, priv->dir);
165166 else
166− *dest = zone->id;
167+ zoneid = zone->id;
167168
169+ nft_reg_store16(dest, zoneid);
168170 return;
169171 }
170172 #endif
@@ -183,10 +185,10 @@ static void nft_ct_get_eval(const struct nft_expr *expr, · 12 unmodified lines
183185 nf_ct_l3num(ct) == NFPROTO_IPV4 ? 4 : 16);
184186 return;
185187 case NFT_CT_PROTO_SRC:
186− *dest = (__force __u16)tuple->src.u.all;
188+ nft_reg_store16(dest, (__force u16)tuple->src.u.all);
187189 return;
188190 case NFT_CT_PROTO_DST:
189− *dest = (__force __u16)tuple->dst.u.all;
191+ nft_reg_store16(dest, (__force u16)tuple->dst.u.all);
190192 return;
191193 default:
192194 break;
@@ -205,7 +207,7 @@ static void nft_ct_set_zone_eval(const struct nft_expr *expr, · 12 unmodified lines
205207 const struct nft_ct *priv = nft_expr_priv(expr);
206208 struct sk_buff *skb = pkt->skb;
207209 enum ip_conntrack_info ctinfo;
208− u16 value = regs->data[priv->sreg];
210+ u16 value = nft_reg_load16(&regs->data[priv->sreg]);
209211 struct nf_conn *ct;
210212
211213 ct = nf_ct_get(skb, &ctinfo);
@@ -542,7 +544,8 @@ static int nft_ct_set_init(const struct nft_ctx *ctx, · 330 unmodified lines
542544 case IP_CT_DIR_REPLY:
543545 break;
544546 default:
545− return -EINVAL;
547+ err = -EINVAL;
548+ goto err1;
546549 }
547550 }
548551
net/netfilter/nft_meta.c+21−19
@@ -45,16 +45,15 @@ void nft_meta_get_eval(const struct nft_expr *expr, · 44 unmodified lines
4545 *dest = skb->len;
4646 break;
4747 case NFT_META_PROTOCOL:
48− *dest = 0;
49− *(__be16 *)dest = skb->protocol;
48+ nft_reg_store16(dest, (__force u16)skb->protocol);
5049 break;
5150 case NFT_META_NFPROTO:
52− *dest = nft_pf(pkt);
51+ nft_reg_store8(dest, nft_pf(pkt));
5352 break;
5453 case NFT_META_L4PROTO:
5554 if (!pkt->tprot_set)
5655 goto err;
57− *dest = pkt->tprot;
56+ nft_reg_store8(dest, pkt->tprot);
5857 break;
5958 case NFT_META_PRIORITY:
6059 *dest = skb->priority;
@@ -85,14 +84,12 @@ void nft_meta_get_eval(const struct nft_expr *expr, · 24 unmodified lines
8584 case NFT_META_IIFTYPE:
8685 if (in == NULL)
8786 goto err;
88− *dest = 0;
89− *(u16 *)dest = in->type;
87+ nft_reg_store16(dest, in->type);
9088 break;
9189 case NFT_META_OIFTYPE:
9290 if (out == NULL)
9391 goto err;
94− *dest = 0;
95− *(u16 *)dest = out->type;
92+ nft_reg_store16(dest, out->type);
9693 break;
9794 case NFT_META_SKUID:
9895 sk = skb_to_full_sk(skb);
@@ -142,19 +139,19 @@ void nft_meta_get_eval(const struct nft_expr *expr, · 43 unmodified lines
142139 #endif
143140 case NFT_META_PKTTYPE:
144141 if (skb->pkt_type != PACKET_LOOPBACK) {
145− *dest = skb->pkt_type;
142+ nft_reg_store8(dest, skb->pkt_type);
146143 break;
147144 }
148145
149146 switch (nft_pf(pkt)) {
150147 case NFPROTO_IPV4:
151148 if (ipv4_is_multicast(ip_hdr(skb)->daddr))
152− *dest = PACKET_MULTICAST;
149+ nft_reg_store8(dest, PACKET_MULTICAST);
153150 else
154− *dest = PACKET_BROADCAST;
151+ nft_reg_store8(dest, PACKET_BROADCAST);
155152 break;
156153 case NFPROTO_IPV6:
157− *dest = PACKET_MULTICAST;
154+ nft_reg_store8(dest, PACKET_MULTICAST);
158155 break;
159156 case NFPROTO_NETDEV:
160157 switch (skb->protocol) {
@@ -168,14 +165,14 @@ void nft_meta_get_eval(const struct nft_expr *expr, · 7 unmodified lines
168165 goto err;
169166
170167 if (ipv4_is_multicast(iph->daddr))
171− *dest = PACKET_MULTICAST;
168+ nft_reg_store8(dest, PACKET_MULTICAST);
172169 else
173− *dest = PACKET_BROADCAST;
170+ nft_reg_store8(dest, PACKET_BROADCAST);
174171
175172 break;
176173 }
177174 case htons(ETH_P_IPV6):
178− *dest = PACKET_MULTICAST;
175+ nft_reg_store8(dest, PACKET_MULTICAST);
179176 break;
180177 default:
181178 WARN_ON_ONCE(1);
@@ -230,7 +227,9 @@ void nft_meta_set_eval(const struct nft_expr *expr, · 48 unmodified lines
230227 {
231228 const struct nft_meta *meta = nft_expr_priv(expr);
232229 struct sk_buff *skb = pkt->skb;
233− u32 value = regs->data[meta->sreg];
230+ u32 *sreg = &regs->data[meta->sreg];
231+ u32 value = *sreg;
232+ u8 pkt_type;
234233
235234 switch (meta->key) {
236235 case NFT_META_MARK:
@@ -240,9 +239,12 @@ void nft_meta_set_eval(const struct nft_expr *expr, · 3 unmodified lines
240239 skb->priority = value;
241240 break;
242241 case NFT_META_PKTTYPE:
243− if (skb->pkt_type != value &&
244− skb_pkt_type_ok(value) && skb_pkt_type_ok(skb->pkt_type))
245− skb->pkt_type = value;
242+ pkt_type = nft_reg_load8(sreg);
243+
244+ if (skb->pkt_type != pkt_type &&
245+ skb_pkt_type_ok(pkt_type) &&
246+ skb_pkt_type_ok(skb->pkt_type))
247+ skb->pkt_type = pkt_type;
246248 break;
247249 case NFT_META_NFTRACE:
248250 skb->nf_trace = !!value;
net/netfilter/nft_nat.c+4−4
@@ -65,10 +65,10 @@ static void nft_nat_eval(const struct nft_expr *expr, · 64 unmodified lines
6565 }
6666
6767 if (priv->sreg_proto_min) {
68− range.min_proto.all =
69− *(__be16 *)&regs->data[priv->sreg_proto_min];
70− range.max_proto.all =
71− *(__be16 *)&regs->data[priv->sreg_proto_max];
68+ range.min_proto.all = (__force __be16)nft_reg_load16(
69+ &regs->data[priv->sreg_proto_min]);
70+ range.max_proto.all = (__force __be16)nft_reg_load16(
71+ &regs->data[priv->sreg_proto_max]);
7272 range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
7373 }
7474
net/netfilter/nft_set_bitmap.c+79−86
@@ -15,6 +15,11 @@ · 14 unmodified lines
1515 #include <linux/netfilter/nf_tables.h>
1616 #include <net/netfilter/nf_tables.h>
1717
18+struct nft_bitmap_elem {
19+ struct list_head head;
20+ struct nft_set_ext ext;
21+};
22+
1823 /* This bitmap uses two bits to represent one element. These two bits determine
1924 * the element state in the current and the future generation.
2025 *
@@ -41,13 +46,22 @@ · 20 unmodified lines
4146 * restore its previous state.
4247 */
4348 struct nft_bitmap {
44− u16 bitmap_size;
45− u8 bitmap[];
49+ struct list_head list;
50+ u16 bitmap_size;
51+ u8 bitmap[];
4652 };
4753
48−static inline void nft_bitmap_location(u32 key, u32 *idx, u32 *off)
54+static inline void nft_bitmap_location(const struct nft_set *set,
55+ const void *key,
56+ u32 *idx, u32 *off)
4957 {
50− u32 k = (key << 1);
58+ u32 k;
59+
60+ if (set->klen == 2)
61+ k = *(u16 *)key;
62+ else
63+ k = *(u8 *)key;
64+ k <<= 1;
5165
5266 *idx = k / BITS_PER_BYTE;
5367 *off = k % BITS_PER_BYTE;
@@ -69,26 +83,48 @@ static bool nft_bitmap_lookup(const struct net *net, const struct nft_set *set, · 15 unmodified lines
6983 u8 genmask = nft_genmask_cur(net);
7084 u32 idx, off;
7185
72− nft_bitmap_location(*key, &idx, &off);
86+ nft_bitmap_location(set, key, &idx, &off);
7387
7488 return nft_bitmap_active(priv->bitmap, idx, off, genmask);
7589 }
7690
91+static struct nft_bitmap_elem *
92+nft_bitmap_elem_find(const struct nft_set *set, struct nft_bitmap_elem *this,
93+ u8 genmask)
94+{
95+ const struct nft_bitmap *priv = nft_set_priv(set);
96+ struct nft_bitmap_elem *be;
97+
98+ list_for_each_entry_rcu(be, &priv->list, head) {
99+ if (memcmp(nft_set_ext_key(&be->ext),
100+ nft_set_ext_key(&this->ext), set->klen) ||
101+ !nft_set_elem_active(&be->ext, genmask))
102+ continue;
103+
104+ return be;
105+ }
106+ return NULL;
107+}
108+
77109 static int nft_bitmap_insert(const struct net *net, const struct nft_set *set,
78110 const struct nft_set_elem *elem,
79− struct nft_set_ext **_ext)
111+ struct nft_set_ext **ext)
80112 {
81113 struct nft_bitmap *priv = nft_set_priv(set);
82− struct nft_set_ext *ext = elem->priv;
114+ struct nft_bitmap_elem *new = elem->priv, *be;
83115 u8 genmask = nft_genmask_next(net);
84116 u32 idx, off;
85117
86− nft_bitmap_location(nft_set_ext_key(ext)->data[0], &idx, &off);
87− if (nft_bitmap_active(priv->bitmap, idx, off, genmask))
118+ be = nft_bitmap_elem_find(set, new, genmask);
119+ if (be) {
120+ *ext = &be->ext;
88121 return -EEXIST;
122+ }
89123
124+ nft_bitmap_location(set, nft_set_ext_key(&new->ext), &idx, &off);
90125 /* Enter 01 state. */
91126 priv->bitmap[idx] |= (genmask << off);
127+ list_add_tail_rcu(&new->head, &priv->list);
92128
93129 return 0;
94130 }
@@ -98,13 +134,14 @@ static void nft_bitmap_remove(const struct net *net, · 3 unmodified lines
98134 const struct nft_set_elem *elem)
99135 {
100136 struct nft_bitmap *priv = nft_set_priv(set);
101− struct nft_set_ext *ext = elem->priv;
137+ struct nft_bitmap_elem *be = elem->priv;
102138 u8 genmask = nft_genmask_next(net);
103139 u32 idx, off;
104140
105− nft_bitmap_location(nft_set_ext_key(ext)->data[0], &idx, &off);
141+ nft_bitmap_location(set, nft_set_ext_key(&be->ext), &idx, &off);
106142 /* Enter 00 state. */
107143 priv->bitmap[idx] &= ~(genmask << off);
144+ list_del_rcu(&be->head);
108145 }
109146
110147 static void nft_bitmap_activate(const struct net *net,
@@ -112,74 +149,52 @@ static void nft_bitmap_activate(const struct net *net, · 1 unmodified line
112149 const struct nft_set_elem *elem)
113150 {
114151 struct nft_bitmap *priv = nft_set_priv(set);
115− struct nft_set_ext *ext = elem->priv;
152+ struct nft_bitmap_elem *be = elem->priv;
116153 u8 genmask = nft_genmask_next(net);
117154 u32 idx, off;
118155
119− nft_bitmap_location(nft_set_ext_key(ext)->data[0], &idx, &off);
156+ nft_bitmap_location(set, nft_set_ext_key(&be->ext), &idx, &off);
120157 /* Enter 11 state. */
121158 priv->bitmap[idx] |= (genmask << off);
159+ nft_set_elem_change_active(net, set, &be->ext);
122160 }
123161
124162 static bool nft_bitmap_flush(const struct net *net,
125− const struct nft_set *set, void *ext)
163+ const struct nft_set *set, void *_be)
126164 {
127165 struct nft_bitmap *priv = nft_set_priv(set);
128166 u8 genmask = nft_genmask_next(net);
167+ struct nft_bitmap_elem *be = _be;
129168 u32 idx, off;
130169
131− nft_bitmap_location(nft_set_ext_key(ext)->data[0], &idx, &off);
170+ nft_bitmap_location(set, nft_set_ext_key(&be->ext), &idx, &off);
132171 /* Enter 10 state, similar to deactivation. */
133172 priv->bitmap[idx] &= ~(genmask << off);
173+ nft_set_elem_change_active(net, set, &be->ext);
134174
135175 return true;
136176 }
137177
138−static struct nft_set_ext *nft_bitmap_ext_alloc(const struct nft_set *set,
139− const struct nft_set_elem *elem)
140−{
141− struct nft_set_ext_tmpl tmpl;
142− struct nft_set_ext *ext;
143−
144− nft_set_ext_prepare(&tmpl);
145− nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY, set->klen);
146−
147− ext = kzalloc(tmpl.len, GFP_KERNEL);
148− if (!ext)
149− return NULL;
150−
151− nft_set_ext_init(ext, &tmpl);
152− memcpy(nft_set_ext_key(ext), elem->key.val.data, set->klen);
153−
154− return ext;
155−}
156−
157178 static void *nft_bitmap_deactivate(const struct net *net,
158179 const struct nft_set *set,
159180 const struct nft_set_elem *elem)
160181 {
161182 struct nft_bitmap *priv = nft_set_priv(set);
183+ struct nft_bitmap_elem *this = elem->priv, *be;
162184 u8 genmask = nft_genmask_next(net);
163− struct nft_set_ext *ext;
164− u32 idx, off, key = 0;
165−
166− memcpy(&key, elem->key.val.data, set->klen);
167− nft_bitmap_location(key, &idx, &off);
185+ u32 idx, off;
168186
169− if (!nft_bitmap_active(priv->bitmap, idx, off, genmask))
170− return NULL;
187+ nft_bitmap_location(set, elem->key.val.data, &idx, &off);
171188
172− /* We have no real set extension since this is a bitmap, allocate this
173− * dummy object that is released from the commit/abort path.
174− */
175− ext = nft_bitmap_ext_alloc(set, elem);
176− if (!ext)
189+ be = nft_bitmap_elem_find(set, this, genmask);
190+ if (!be)
177191 return NULL;
178192
179193 /* Enter 10 state. */
180194 priv->bitmap[idx] &= ~(genmask << off);
195+ nft_set_elem_change_active(net, set, &be->ext);
181196
182− return ext;
197+ return be;
183198 }
184199
185200 static void nft_bitmap_walk(const struct nft_ctx *ctx,
@@ -187,47 +202,23 @@ static void nft_bitmap_walk(const struct nft_ctx *ctx, · 1 unmodified line
187202 struct nft_set_iter *iter)
188203 {
189204 const struct nft_bitmap *priv = nft_set_priv(set);
190− struct nft_set_ext_tmpl tmpl;
205+ struct nft_bitmap_elem *be;
191206 struct nft_set_elem elem;
192− struct nft_set_ext *ext;
193− int idx, off;
194− u16 key;
195−
196− nft_set_ext_prepare(&tmpl);
197− nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY, set->klen);
198−
199− for (idx = 0; idx < priv->bitmap_size; idx++) {
200− for (off = 0; off < BITS_PER_BYTE; off += 2) {
201− if (iter->count < iter->skip)
202− goto cont;
203−
204− if (!nft_bitmap_active(priv->bitmap, idx, off,
205− iter->genmask))
206− goto cont;
207−
208− ext = kzalloc(tmpl.len, GFP_KERNEL);
209− if (!ext) {
210− iter->err = -ENOMEM;
211− return;
212− }
213− nft_set_ext_init(ext, &tmpl);
214− key = ((idx * BITS_PER_BYTE) + off) >> 1;
215− memcpy(nft_set_ext_key(ext), &key, set->klen);
216−
217− elem.priv = ext;
218− iter->err = iter->fn(ctx, set, iter, &elem);
219−
220− /* On set flush, this dummy extension object is released
221− * from the commit/abort path.
222− */
223− if (!iter->flush)
224− kfree(ext);
225−
226− if (iter->err < 0)
227− return;
207+
208+ list_for_each_entry_rcu(be, &priv->list, head) {
209+ if (iter->count < iter->skip)
210+ goto cont;
211+ if (!nft_set_elem_active(&be->ext, iter->genmask))
212+ goto cont;
213+
214+ elem.priv = be;
215+
216+ iter->err = iter->fn(ctx, set, iter, &elem);
217+
218+ if (iter->err < 0)
219+ return;
228220 cont:
229− iter->count++;
230− }
221+ iter->count++;
231222 }
232223 }
233224
@@ -258,6 +249,7 @@ static int nft_bitmap_init(const struct nft_set *set, · 24 unmodified lines
258249 {
259250 struct nft_bitmap *priv = nft_set_priv(set);
260251
252+ INIT_LIST_HEAD(&priv->list);
261253 priv->bitmap_size = nft_bitmap_size(set->klen);
262254
263255 return 0;
@@ -283,6 +275,7 @@ static bool nft_bitmap_estimate(const struct nft_set_desc *desc, u32 features, · 19 unmodified lines
283275
284276 static struct nft_set_ops nft_bitmap_ops __read_mostly = {
285277 .privsize = nft_bitmap_privsize,
278+ .elemsize = offsetof(struct nft_bitmap_elem, ext),
286279 .estimate = nft_bitmap_estimate,
287280 .init = nft_bitmap_init,
288281 .destroy = nft_bitmap_destroy,
net/netlink/af_netlink.c+41−0
@@ -96,6 +96,44 @@ EXPORT_SYMBOL_GPL(nl_table); · 95 unmodified lines
9696
9797 static DECLARE_WAIT_QUEUE_HEAD(nl_table_wait);
9898
99+static struct lock_class_key nlk_cb_mutex_keys[MAX_LINKS];
100+
101+static const char *const nlk_cb_mutex_key_strings[MAX_LINKS + 1] = {
102+ "nlk_cb_mutex-ROUTE",
103+ "nlk_cb_mutex-1",
104+ "nlk_cb_mutex-USERSOCK",
105+ "nlk_cb_mutex-FIREWALL",
106+ "nlk_cb_mutex-SOCK_DIAG",
107+ "nlk_cb_mutex-NFLOG",
108+ "nlk_cb_mutex-XFRM",
109+ "nlk_cb_mutex-SELINUX",
110+ "nlk_cb_mutex-ISCSI",
111+ "nlk_cb_mutex-AUDIT",
112+ "nlk_cb_mutex-FIB_LOOKUP",
113+ "nlk_cb_mutex-CONNECTOR",
114+ "nlk_cb_mutex-NETFILTER",
115+ "nlk_cb_mutex-IP6_FW",
116+ "nlk_cb_mutex-DNRTMSG",
117+ "nlk_cb_mutex-KOBJECT_UEVENT",
118+ "nlk_cb_mutex-GENERIC",
119+ "nlk_cb_mutex-17",
120+ "nlk_cb_mutex-SCSITRANSPORT",
121+ "nlk_cb_mutex-ECRYPTFS",
122+ "nlk_cb_mutex-RDMA",
123+ "nlk_cb_mutex-CRYPTO",
124+ "nlk_cb_mutex-SMC",
125+ "nlk_cb_mutex-23",
126+ "nlk_cb_mutex-24",
127+ "nlk_cb_mutex-25",
128+ "nlk_cb_mutex-26",
129+ "nlk_cb_mutex-27",
130+ "nlk_cb_mutex-28",
131+ "nlk_cb_mutex-29",
132+ "nlk_cb_mutex-30",
133+ "nlk_cb_mutex-31",
134+ "nlk_cb_mutex-MAX_LINKS"
135+};
136+
99137 static int netlink_dump(struct sock *sk);
100138 static void netlink_skb_destructor(struct sk_buff *skb);
101139
@@ -585,6 +623,9 @@ static int __netlink_create(struct net *net, struct socket *sock, · 483 unmodified lines
585623 } else {
586624 nlk->cb_mutex = &nlk->cb_def_mutex;
587625 mutex_init(nlk->cb_mutex);
626+ lockdep_set_class_and_name(nlk->cb_mutex,
627+ nlk_cb_mutex_keys + protocol,
628+ nlk_cb_mutex_key_strings[protocol]);
588629 }
589630 init_waitqueue_head(&nlk->wait);
590631
net/netlink/genetlink.c+3−1
@@ -783,8 +783,10 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb) · 782 unmodified lines
783783
784784 if (ctrl_fill_info(rt, NETLINK_CB(cb->skb).portid,
785785 cb->nlh->nlmsg_seq, NLM_F_MULTI,
786− skb, CTRL_CMD_NEWFAMILY) < 0)
786+ skb, CTRL_CMD_NEWFAMILY) < 0) {
787+ n--;
787788 break;
789+ }
788790 }
789791
790792 cb->args[0] = n;
net/openvswitch/flow_netlink.c+3−1
@@ -604,7 +604,7 @@ static int ip_tun_from_nlattr(const struct nlattr *attr, · 603 unmodified lines
604604 ipv4 = true;
605605 break;
606606 case OVS_TUNNEL_KEY_ATTR_IPV6_SRC:
607− SW_FLOW_KEY_PUT(match, tun_key.u.ipv6.dst,
607+ SW_FLOW_KEY_PUT(match, tun_key.u.ipv6.src,
608608 nla_get_in6_addr(a), is_mask);
609609 ipv6 = true;
610610 break;
@@ -665,6 +665,8 @@ static int ip_tun_from_nlattr(const struct nlattr *attr, · 54 unmodified lines
665665 tun_flags |= TUNNEL_VXLAN_OPT;
666666 opts_type = type;
667667 break;
668+ case OVS_TUNNEL_KEY_ATTR_PAD:
669+ break;
668670 default:
669671 OVS_NLERR(log, "Unknown IP tunnel attribute %d",
670672 type);
net/rxrpc/conn_event.c+4−0
@@ -275,6 +275,10 @@ static int rxrpc_process_event(struct rxrpc_connection *conn, · 274 unmodified lines
275275 rxrpc_conn_retransmit_call(conn, skb);
276276 return 0;
277277
278+ case RXRPC_PACKET_TYPE_BUSY:
279+ /* Just ignore BUSY packets for now. */
280+ return 0;
281+
278282 case RXRPC_PACKET_TYPE_ABORT:
279283 if (skb_copy_bits(skb, sizeof(struct rxrpc_wire_header),
280284 &wtmp, sizeof(wtmp)) < 0)
net/sched/sch_dsmark.c+8−2
@@ -201,9 +201,13 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 200 unmodified lines
201201 pr_debug("%s(skb %p,sch %p,[qdisc %p])\n", __func__, skb, sch, p);
202202
203203 if (p->set_tc_index) {
204+ int wlen = skb_network_offset(skb);
205+
204206 switch (tc_skb_protocol(skb)) {
205207 case htons(ETH_P_IP):
206− if (skb_cow_head(skb, sizeof(struct iphdr)))
208+ wlen += sizeof(struct iphdr);
209+ if (!pskb_may_pull(skb, wlen) ||
210+ skb_try_make_writable(skb, wlen))
207211 goto drop;
208212
209213 skb->tc_index = ipv4_get_dsfield(ip_hdr(skb))
@@ -211,7 +215,9 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 1 unmodified line
211215 break;
212216
213217 case htons(ETH_P_IPV6):
214− if (skb_cow_head(skb, sizeof(struct ipv6hdr)))
218+ wlen += sizeof(struct ipv6hdr);
219+ if (!pskb_may_pull(skb, wlen) ||
220+ skb_try_make_writable(skb, wlen))
215221 goto drop;
216222
217223 skb->tc_index = ipv6_get_dsfield(ipv6_hdr(skb))
net/sctp/associola.c+2−4
@@ -71,9 +71,8 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a · 70 unmodified lines
7171 {
7272 struct net *net = sock_net(sk);
7373 struct sctp_sock *sp;
74− int i;
7574 sctp_paramhdr_t *p;
76− int err;
75+ int i;
7776
7877 /* Retrieve the SCTP per socket area. */
7978 sp = sctp_sk((struct sock *)sk);
@@ -264,8 +263,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a · 184 unmodified lines
264263
265264 /* AUTH related initializations */
266265 INIT_LIST_HEAD(&asoc->endpoint_shared_keys);
267− err = sctp_auth_asoc_copy_shkeys(ep, asoc, gfp);
268− if (err)
266+ if (sctp_auth_asoc_copy_shkeys(ep, asoc, gfp))
269267 goto fail_init;
270268
271269 asoc->active_key_id = ep->active_key_id;
net/sctp/output.c+3−4
@@ -546,7 +546,6 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) · 545 unmodified lines
546546 struct sctp_association *asoc = tp->asoc;
547547 struct sctp_chunk *chunk, *tmp;
548548 int pkt_count, gso = 0;
549− int confirm;
550549 struct dst_entry *dst;
551550 struct sk_buff *head;
552551 struct sctphdr *sh;
@@ -625,13 +624,13 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) · 72 unmodified lines
625624 asoc->peer.last_sent_to = tp;
626625 }
627626 head->ignore_df = packet->ipfragok;
628− confirm = tp->dst_pending_confirm;
629− if (confirm)
627+ if (tp->dst_pending_confirm)
630628 skb_set_dst_pending_confirm(head, 1);
631629 /* neighbour should be confirmed on successful transmission or
632630 * positive error
633631 */
634− if (tp->af_specific->sctp_xmit(head, tp) >= 0 && confirm)
632+ if (tp->af_specific->sctp_xmit(head, tp) >= 0 &&
633+ tp->dst_pending_confirm)
635634 tp->dst_pending_confirm = 0;
636635
637636 out:
net/sctp/outqueue.c+5−6
@@ -382,17 +382,18 @@ static int sctp_prsctp_prune_sent(struct sctp_association *asoc, · 381 unmodified lines
382382 }
383383
384384 static int sctp_prsctp_prune_unsent(struct sctp_association *asoc,
385− struct sctp_sndrcvinfo *sinfo,
386− struct list_head *queue, int msg_len)
385+ struct sctp_sndrcvinfo *sinfo, int msg_len)
387386 {
387+ struct sctp_outq *q = &asoc->outqueue;
388388 struct sctp_chunk *chk, *temp;
389389
390− list_for_each_entry_safe(chk, temp, queue, list) {
390+ list_for_each_entry_safe(chk, temp, &q->out_chunk_list, list) {
391391 if (!SCTP_PR_PRIO_ENABLED(chk->sinfo.sinfo_flags) ||
392392 chk->sinfo.sinfo_timetolive <= sinfo->sinfo_timetolive)
393393 continue;
394394
395395 list_del_init(&chk->list);
396+ q->out_qlen -= chk->skb->len;
396397 asoc->sent_cnt_removable--;
397398 asoc->abandoned_unsent[SCTP_PR_INDEX(PRIO)]++;
398399
@@ -431,9 +432,7 @@ void sctp_prsctp_prune(struct sctp_association *asoc, · 32 unmodified lines
431432 return;
432433 }
433434
434− sctp_prsctp_prune_unsent(asoc, sinfo,
435− &asoc->outqueue.out_chunk_list,
436− msg_len);
435+ sctp_prsctp_prune_unsent(asoc, sinfo, msg_len);
437436 }
438437
439438 /* Mark all the eligible packets on a transport for retransmission. */
net/socket.c+12−1
@@ -652,6 +652,16 @@ int kernel_sendmsg(struct socket *sock, struct msghdr *msg, · 651 unmodified lines
652652 }
653653 EXPORT_SYMBOL(kernel_sendmsg);
654654
655+static bool skb_is_err_queue(const struct sk_buff *skb)
656+{
657+ /* pkt_type of skbs enqueued on the error queue are set to
658+ * PACKET_OUTGOING in skb_set_err_queue(). This is only safe to do
659+ * in recvmsg, since skbs received on a local socket will never
660+ * have a pkt_type of PACKET_OUTGOING.
661+ */
662+ return skb->pkt_type == PACKET_OUTGOING;
663+}
664+
655665 /*
656666 * called from sock_recv_timestamp() if sock_flag(sk, SOCK_RCVTSTAMP)
657667 */
@@ -695,7 +705,8 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, · 37 unmodified lines
695705 put_cmsg(msg, SOL_SOCKET,
696706 SCM_TIMESTAMPING, sizeof(tss), &tss);
697707
698− if (skb->len && (sk->sk_tsflags & SOF_TIMESTAMPING_OPT_STATS))
708+ if (skb_is_err_queue(skb) && skb->len &&
709+ SKB_EXT_ERR(skb)->opt_stats)
699710 put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMPING_OPT_STATS,
700711 skb->len, skb->data);
701712 }
net/tipc/subscr.c+6−1
@@ -141,6 +141,11 @@ void tipc_subscrp_report_overlap(struct tipc_subscription *sub, u32 found_lower, · 140 unmodified lines
141141 static void tipc_subscrp_timeout(unsigned long data)
142142 {
143143 struct tipc_subscription *sub = (struct tipc_subscription *)data;
144+ struct tipc_subscriber *subscriber = sub->subscriber;
145+
146+ spin_lock_bh(&subscriber->lock);
147+ tipc_nametbl_unsubscribe(sub);
148+ spin_unlock_bh(&subscriber->lock);
144149
145150 /* Notify subscriber of timeout */
146151 tipc_subscrp_send_event(sub, sub->evt.s.seq.lower, sub->evt.s.seq.upper,
@@ -173,7 +178,6 @@ static void tipc_subscrp_kref_release(struct kref *kref) · 26 unmodified lines
173178 struct tipc_subscriber *subscriber = sub->subscriber;
174179
175180 spin_lock_bh(&subscriber->lock);
176− tipc_nametbl_unsubscribe(sub);
177181 list_del(&sub->subscrp_list);
178182 atomic_dec(&tn->subscription_count);
179183 spin_unlock_bh(&subscriber->lock);
@@ -205,6 +209,7 @@ static void tipc_subscrb_subscrp_delete(struct tipc_subscriber *subscriber, · 25 unmodified lines
205209 if (s && memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr)))
206210 continue;
207211
212+ tipc_nametbl_unsubscribe(sub);
208213 tipc_subscrp_get(sub);
209214 spin_unlock_bh(&subscriber->lock);
210215 tipc_subscrp_delete(sub);
net/unix/garbage.c+9−8
@@ -146,6 +146,7 @@ void unix_notinflight(struct user_struct *user, struct file *fp) · 145 unmodified lines
146146 if (s) {
147147 struct unix_sock *u = unix_sk(s);
148148
149+ BUG_ON(!atomic_long_read(&u->inflight));
149150 BUG_ON(list_empty(&u->link));
150151
151152 if (atomic_long_dec_and_test(&u->inflight))
@@ -341,6 +342,14 @@ void unix_gc(void) · 189 unmodified lines
341342 }
342343 list_del(&cursor);
343344
345+ /* Now gc_candidates contains only garbage. Restore original
346+ * inflight counters for these as well, and remove the skbuffs
347+ * which are creating the cycle(s).
348+ */
349+ skb_queue_head_init(&hitlist);
350+ list_for_each_entry(u, &gc_candidates, link)
351+ scan_children(&u->sk, inc_inflight, &hitlist);
352+
344353 /* not_cycle_list contains those sockets which do not make up a
345354 * cycle. Restore these to the inflight list.
346355 */
@@ -350,14 +359,6 @@ void unix_gc(void) · 3 unmodified lines
350359 list_move_tail(&u->link, &gc_inflight_list);
351360 }
352361
353− /* Now gc_candidates contains only garbage. Restore original
354− * inflight counters for these as well, and remove the skbuffs
355− * which are creating the cycle(s).
356− */
357− skb_queue_head_init(&hitlist);
358− list_for_each_entry(u, &gc_candidates, link)
359− scan_children(&u->sk, inc_inflight, &hitlist);
360−
361362 spin_unlock(&unix_gc_lock);
362363
363364 /* Here we are. Hitlist is filled. Die. */
net/vmw_vsock/af_vsock.c+14−0
@@ -1102,10 +1102,19 @@ static const struct proto_ops vsock_dgram_ops = { · 1101 unmodified lines
11021102 .sendpage = sock_no_sendpage,
11031103 };
11041104
1105+static int vsock_transport_cancel_pkt(struct vsock_sock *vsk)
1106+{
1107+ if (!transport->cancel_pkt)
1108+ return -EOPNOTSUPP;
1109+
1110+ return transport->cancel_pkt(vsk);
1111+}
1112+
11051113 static void vsock_connect_timeout(struct work_struct *work)
11061114 {
11071115 struct sock *sk;
11081116 struct vsock_sock *vsk;
1117+ int cancel = 0;
11091118
11101119 vsk = container_of(work, struct vsock_sock, dwork.work);
11111120 sk = sk_vsock(vsk);
@@ -1116,8 +1125,11 @@ static void vsock_connect_timeout(struct work_struct *work) · 4 unmodified lines
11161125 sk->sk_state = SS_UNCONNECTED;
11171126 sk->sk_err = ETIMEDOUT;
11181127 sk->sk_error_report(sk);
1128+ cancel = 1;
11191129 }
11201130 release_sock(sk);
1131+ if (cancel)
1132+ vsock_transport_cancel_pkt(vsk);
11211133
11221134 sock_put(sk);
11231135 }
@@ -1224,11 +1236,13 @@ static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr, · 100 unmodified lines
12241236 err = sock_intr_errno(timeout);
12251237 sk->sk_state = SS_UNCONNECTED;
12261238 sock->state = SS_UNCONNECTED;
1239+ vsock_transport_cancel_pkt(vsk);
12271240 goto out_wait;
12281241 } else if (timeout == 0) {
12291242 err = -ETIMEDOUT;
12301243 sk->sk_state = SS_UNCONNECTED;
12311244 sock->state = SS_UNCONNECTED;
1245+ vsock_transport_cancel_pkt(vsk);
12321246 goto out_wait;
12331247 }
12341248
net/vmw_vsock/virtio_transport.c+42−0
@@ -213,6 +213,47 @@ virtio_transport_send_pkt(struct virtio_vsock_pkt *pkt) · 212 unmodified lines
213213 return len;
214214 }
215215
216+static int
217+virtio_transport_cancel_pkt(struct vsock_sock *vsk)
218+{
219+ struct virtio_vsock *vsock;
220+ struct virtio_vsock_pkt *pkt, *n;
221+ int cnt = 0;
222+ LIST_HEAD(freeme);
223+
224+ vsock = virtio_vsock_get();
225+ if (!vsock) {
226+ return -ENODEV;
227+ }
228+
229+ spin_lock_bh(&vsock->send_pkt_list_lock);
230+ list_for_each_entry_safe(pkt, n, &vsock->send_pkt_list, list) {
231+ if (pkt->vsk != vsk)
232+ continue;
233+ list_move(&pkt->list, &freeme);
234+ }
235+ spin_unlock_bh(&vsock->send_pkt_list_lock);
236+
237+ list_for_each_entry_safe(pkt, n, &freeme, list) {
238+ if (pkt->reply)
239+ cnt++;
240+ list_del(&pkt->list);
241+ virtio_transport_free_pkt(pkt);
242+ }
243+
244+ if (cnt) {
245+ struct virtqueue *rx_vq = vsock->vqs[VSOCK_VQ_RX];
246+ int new_cnt;
247+
248+ new_cnt = atomic_sub_return(cnt, &vsock->queued_replies);
249+ if (new_cnt + cnt >= virtqueue_get_vring_size(rx_vq) &&
250+ new_cnt < virtqueue_get_vring_size(rx_vq))
251+ queue_work(virtio_vsock_workqueue, &vsock->rx_work);
252+ }
253+
254+ return 0;
255+}
256+
216257 static void virtio_vsock_rx_fill(struct virtio_vsock *vsock)
217258 {
218259 int buf_len = VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE;
@@ -462,6 +503,7 @@ static struct virtio_transport virtio_transport = { · 243 unmodified lines
462503 .release = virtio_transport_release,
463504 .connect = virtio_transport_connect,
464505 .shutdown = virtio_transport_shutdown,
506+ .cancel_pkt = virtio_transport_cancel_pkt,
465507
466508 .dgram_bind = virtio_transport_dgram_bind,
467509 .dgram_dequeue = virtio_transport_dgram_dequeue,
net/vmw_vsock/virtio_transport_common.c+7−0
@@ -58,6 +58,7 @@ virtio_transport_alloc_pkt(struct virtio_vsock_pkt_info *info, · 57 unmodified lines
5858 pkt->len = len;
5959 pkt->hdr.len = cpu_to_le32(len);
6060 pkt->reply = info->reply;
61+ pkt->vsk = info->vsk;
6162
6263 if (info->msg && len > 0) {
6364 pkt->buf = kmalloc(len, GFP_KERNEL);
@@ -180,6 +181,7 @@ static int virtio_transport_send_credit_update(struct vsock_sock *vsk, · 116 unmodified lines
180181 struct virtio_vsock_pkt_info info = {
181182 .op = VIRTIO_VSOCK_OP_CREDIT_UPDATE,
182183 .type = type,
184+ .vsk = vsk,
183185 };
184186
185187 return virtio_transport_send_pkt_info(vsk, &info);
@@ -519,6 +521,7 @@ int virtio_transport_connect(struct vsock_sock *vsk) · 333 unmodified lines
519521 struct virtio_vsock_pkt_info info = {
520522 .op = VIRTIO_VSOCK_OP_REQUEST,
521523 .type = VIRTIO_VSOCK_TYPE_STREAM,
524+ .vsk = vsk,
522525 };
523526
524527 return virtio_transport_send_pkt_info(vsk, &info);
@@ -534,6 +537,7 @@ int virtio_transport_shutdown(struct vsock_sock *vsk, int mode) · 9 unmodified lines
534537 VIRTIO_VSOCK_SHUTDOWN_RCV : 0) |
535538 (mode & SEND_SHUTDOWN ?
536539 VIRTIO_VSOCK_SHUTDOWN_SEND : 0),
540+ .vsk = vsk,
537541 };
538542
539543 return virtio_transport_send_pkt_info(vsk, &info);
@@ -560,6 +564,7 @@ virtio_transport_stream_enqueue(struct vsock_sock *vsk, · 20 unmodified lines
560564 .type = VIRTIO_VSOCK_TYPE_STREAM,
561565 .msg = msg,
562566 .pkt_len = len,
567+ .vsk = vsk,
563568 };
564569
565570 return virtio_transport_send_pkt_info(vsk, &info);
@@ -581,6 +586,7 @@ static int virtio_transport_reset(struct vsock_sock *vsk, · 15 unmodified lines
581586 .op = VIRTIO_VSOCK_OP_RST,
582587 .type = VIRTIO_VSOCK_TYPE_STREAM,
583588 .reply = !!pkt,
589+ .vsk = vsk,
584590 };
585591
586592 /* Send RST only if the original pkt is not a RST pkt */
@@ -826,6 +832,7 @@ virtio_transport_send_response(struct vsock_sock *vsk, · 239 unmodified lines
826832 .remote_cid = le64_to_cpu(pkt->hdr.src_cid),
827833 .remote_port = le32_to_cpu(pkt->hdr.src_port),
828834 .reply = true,
835+ .vsk = vsk,
829836 };
830837
831838 return virtio_transport_send_pkt_info(vsk, &info);
net/wireless/nl80211.c+56−71
@@ -545,22 +545,18 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb, · 544 unmodified lines
545545 {
546546 int err;
547547
548− rtnl_lock();
549−
550548 if (!cb->args[0]) {
551549 err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
552550 genl_family_attrbuf(&nl80211_fam),
553551 nl80211_fam.maxattr, nl80211_policy);
554552 if (err)
555− goto out_unlock;
553+ return err;
556554
557555 *wdev = __cfg80211_wdev_from_attrs(
558556 sock_net(skb->sk),
559557 genl_family_attrbuf(&nl80211_fam));
560− if (IS_ERR(*wdev)) {
561− err = PTR_ERR(*wdev);
562− goto out_unlock;
563− }
558+ if (IS_ERR(*wdev))
559+ return PTR_ERR(*wdev);
564560 *rdev = wiphy_to_rdev((*wdev)->wiphy);
565561 /* 0 is the first index - add 1 to parse only once */
566562 cb->args[0] = (*rdev)->wiphy_idx + 1;
@@ -570,10 +566,8 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb, · 3 unmodified lines
570566 struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0] - 1);
571567 struct wireless_dev *tmp;
572568
573− if (!wiphy) {
574− err = -ENODEV;
575− goto out_unlock;
576− }
569+ if (!wiphy)
570+ return -ENODEV;
577571 *rdev = wiphy_to_rdev(wiphy);
578572 *wdev = NULL;
579573
@@ -584,21 +578,11 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb, · 4 unmodified lines
584578 }
585579 }
586580
587− if (!*wdev) {
588− err = -ENODEV;
589− goto out_unlock;
590− }
581+ if (!*wdev)
582+ return -ENODEV;
591583 }
592584
593585 return 0;
594− out_unlock:
595− rtnl_unlock();
596− return err;
597−}
598−
599−static void nl80211_finish_wdev_dump(struct cfg80211_registered_device *rdev)
600−{
601− rtnl_unlock();
602586 }
603587
604588 /* IE validation */
@@ -2608,17 +2592,17 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback * · 2003 unmodified lines
26082592 int filter_wiphy = -1;
26092593 struct cfg80211_registered_device *rdev;
26102594 struct wireless_dev *wdev;
2595+ int ret;
26112596
26122597 rtnl_lock();
26132598 if (!cb->args[2]) {
26142599 struct nl80211_dump_wiphy_state state = {
26152600 .filter_wiphy = -1,
26162601 };
2617− int ret;
26182602
26192603 ret = nl80211_dump_wiphy_parse(skb, cb, &state);
26202604 if (ret)
2621− return ret;
2605+ goto out_unlock;
26222606
26232607 filter_wiphy = state.filter_wiphy;
26242608
@@ -2663,12 +2647,14 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback * · 38 unmodified lines
26632647 wp_idx++;
26642648 }
26652649 out:
2666− rtnl_unlock();
2667−
26682650 cb->args[0] = wp_idx;
26692651 cb->args[1] = if_idx;
26702652
2671− return skb->len;
2653+ ret = skb->len;
2654+ out_unlock:
2655+ rtnl_unlock();
2656+
2657+ return ret;
26722658 }
26732659
26742660 static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info)
@@ -4452,9 +4438,10 @@ static int nl80211_dump_station(struct sk_buff *skb, · 1777 unmodified lines
44524438 int sta_idx = cb->args[2];
44534439 int err;
44544440
4441+ rtnl_lock();
44554442 err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
44564443 if (err)
4457− return err;
4444+ goto out_err;
44584445
44594446 if (!wdev->netdev) {
44604447 err = -EINVAL;
@@ -4489,7 +4476,7 @@ static int nl80211_dump_station(struct sk_buff *skb, · 28 unmodified lines
44894476 cb->args[2] = sta_idx;
44904477 err = skb->len;
44914478 out_err:
4492− nl80211_finish_wdev_dump(rdev);
4479+ rtnl_unlock();
44934480
44944481 return err;
44954482 }
@@ -5275,9 +5262,10 @@ static int nl80211_dump_mpath(struct sk_buff *skb, · 779 unmodified lines
52755262 int path_idx = cb->args[2];
52765263 int err;
52775264
5265+ rtnl_lock();
52785266 err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
52795267 if (err)
5280− return err;
5268+ goto out_err;
52815269
52825270 if (!rdev->ops->dump_mpath) {
52835271 err = -EOPNOTSUPP;
@@ -5310,7 +5298,7 @@ static int nl80211_dump_mpath(struct sk_buff *skb, · 26 unmodified lines
53105298 cb->args[2] = path_idx;
53115299 err = skb->len;
53125300 out_err:
5313− nl80211_finish_wdev_dump(rdev);
5301+ rtnl_unlock();
53145302 return err;
53155303 }
53165304
@@ -5470,9 +5458,10 @@ static int nl80211_dump_mpp(struct sk_buff *skb, · 153 unmodified lines
54705458 int path_idx = cb->args[2];
54715459 int err;
54725460
5461+ rtnl_lock();
54735462 err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
54745463 if (err)
5475− return err;
5464+ goto out_err;
54765465
54775466 if (!rdev->ops->dump_mpp) {
54785467 err = -EOPNOTSUPP;
@@ -5505,7 +5494,7 @@ static int nl80211_dump_mpp(struct sk_buff *skb, · 26 unmodified lines
55055494 cb->args[2] = path_idx;
55065495 err = skb->len;
55075496 out_err:
5508− nl80211_finish_wdev_dump(rdev);
5497+ rtnl_unlock();
55095498 return err;
55105499 }
55115500
@@ -7674,9 +7663,12 @@ static int nl80211_dump_scan(struct sk_buff *skb, struct netlink_callback *cb) · 2162 unmodified lines
76747663 int start = cb->args[2], idx = 0;
76757664 int err;
76767665
7666+ rtnl_lock();
76777667 err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
7678− if (err)
7668+ if (err) {
7669+ rtnl_unlock();
76797670 return err;
7671+ }
76807672
76817673 wdev_lock(wdev);
76827674 spin_lock_bh(&rdev->bss_lock);
@@ -7699,7 +7691,7 @@ static int nl80211_dump_scan(struct sk_buff *skb, struct netlink_callback *cb) · 16 unmodified lines
76997691 wdev_unlock(wdev);
77007692
77017693 cb->args[2] = idx;
7702− nl80211_finish_wdev_dump(rdev);
7694+ rtnl_unlock();
77037695
77047696 return skb->len;
77057697 }
@@ -7784,9 +7776,10 @@ static int nl80211_dump_survey(struct sk_buff *skb, struct netlink_callback *cb) · 78 unmodified lines
77847776 int res;
77857777 bool radio_stats;
77867778
7779+ rtnl_lock();
77877780 res = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
77887781 if (res)
7789− return res;
7782+ goto out_err;
77907783
77917784 /* prepare_wdev_dump parsed the attributes */
77927785 radio_stats = attrbuf[NL80211_ATTR_SURVEY_RADIO_STATS];
@@ -7827,7 +7820,7 @@ static int nl80211_dump_survey(struct sk_buff *skb, struct netlink_callback *cb) · 34 unmodified lines
78277820 cb->args[2] = survey_idx;
78287821 res = skb->len;
78297822 out_err:
7830− nl80211_finish_wdev_dump(rdev);
7823+ rtnl_unlock();
78317824 return res;
78327825 }
78337826
@@ -11508,17 +11501,13 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb, · 3674 unmodified lines
1150811501 void *data = NULL;
1150911502 unsigned int data_len = 0;
1151011503
11511− rtnl_lock();
11512−
1151311504 if (cb->args[0]) {
1151411505 /* subtract the 1 again here */
1151511506 struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0] - 1);
1151611507 struct wireless_dev *tmp;
1151711508
11518− if (!wiphy) {
11519− err = -ENODEV;
11520− goto out_unlock;
11521− }
11509+ if (!wiphy)
11510+ return -ENODEV;
1152211511 *rdev = wiphy_to_rdev(wiphy);
1152311512 *wdev = NULL;
1152411513
@@ -11538,23 +11527,19 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb, · 13 unmodified lines
1153811527 err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
1153911528 attrbuf, nl80211_fam.maxattr, nl80211_policy);
1154011529 if (err)
11541− goto out_unlock;
11530+ return err;
1154211531
1154311532 if (!attrbuf[NL80211_ATTR_VENDOR_ID] ||
11544− !attrbuf[NL80211_ATTR_VENDOR_SUBCMD]) {
11545− err = -EINVAL;
11546− goto out_unlock;
11547− }
11533+ !attrbuf[NL80211_ATTR_VENDOR_SUBCMD])
11534+ return -EINVAL;
1154811535
1154911536 *wdev = __cfg80211_wdev_from_attrs(sock_net(skb->sk), attrbuf);
1155011537 if (IS_ERR(*wdev))
1155111538 *wdev = NULL;
1155211539
1155311540 *rdev = __cfg80211_rdev_from_attrs(sock_net(skb->sk), attrbuf);
11554− if (IS_ERR(*rdev)) {
11555− err = PTR_ERR(*rdev);
11556− goto out_unlock;
11557− }
11541+ if (IS_ERR(*rdev))
11542+ return PTR_ERR(*rdev);
1155811543
1155911544 vid = nla_get_u32(attrbuf[NL80211_ATTR_VENDOR_ID]);
1156011545 subcmd = nla_get_u32(attrbuf[NL80211_ATTR_VENDOR_SUBCMD]);
@@ -11567,19 +11552,15 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb, · 6 unmodified lines
1156711552 if (vcmd->info.vendor_id != vid || vcmd->info.subcmd != subcmd)
1156811553 continue;
1156911554
11570− if (!vcmd->dumpit) {
11571− err = -EOPNOTSUPP;
11572− goto out_unlock;
11573− }
11555+ if (!vcmd->dumpit)
11556+ return -EOPNOTSUPP;
1157411557
1157511558 vcmd_idx = i;
1157611559 break;
1157711560 }
1157811561
11579− if (vcmd_idx < 0) {
11580− err = -EOPNOTSUPP;
11581− goto out_unlock;
11582− }
11562+ if (vcmd_idx < 0)
11563+ return -EOPNOTSUPP;
1158311564
1158411565 if (attrbuf[NL80211_ATTR_VENDOR_DATA]) {
1158511566 data = nla_data(attrbuf[NL80211_ATTR_VENDOR_DATA]);
@@ -11596,9 +11577,6 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb, · 10 unmodified lines
1159611577
1159711578 /* keep rtnl locked in successful case */
1159811579 return 0;
11599− out_unlock:
11600− rtnl_unlock();
11601− return err;
1160211580 }
1160311581
1160411582 static int nl80211_vendor_cmd_dump(struct sk_buff *skb,
@@ -11613,9 +11591,10 @@ static int nl80211_vendor_cmd_dump(struct sk_buff *skb, · 8 unmodified lines
1161311591 int err;
1161411592 struct nlattr *vendor_data;
1161511593
11594+ rtnl_lock();
1161611595 err = nl80211_prepare_vendor_dump(skb, cb, &rdev, &wdev);
1161711596 if (err)
11618− return err;
11597+ goto out;
1161911598
1162011599 vcmd_idx = cb->args[2];
1162111600 data = (void *)cb->args[3];
@@ -11624,15 +11603,21 @@ static int nl80211_vendor_cmd_dump(struct sk_buff *skb, · 2 unmodified lines
1162411603
1162511604 if (vcmd->flags & (WIPHY_VENDOR_CMD_NEED_WDEV |
1162611605 WIPHY_VENDOR_CMD_NEED_NETDEV)) {
11627− if (!wdev)
11628− return -EINVAL;
11606+ if (!wdev) {
11607+ err = -EINVAL;
11608+ goto out;
11609+ }
1162911610 if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_NETDEV &&
11630− !wdev->netdev)
11631− return -EINVAL;
11611+ !wdev->netdev) {
11612+ err = -EINVAL;
11613+ goto out;
11614+ }
1163211615
1163311616 if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_RUNNING) {
11634− if (!wdev_running(wdev))
11635− return -ENETDOWN;
11617+ if (!wdev_running(wdev)) {
11618+ err = -ENETDOWN;
11619+ goto out;
11620+ }
1163611621 }
1163711622 }
1163811623
sound/core/seq/seq_clientmgr.c+1−0
@@ -1832,6 +1832,7 @@ static int snd_seq_ioctl_set_client_pool(struct snd_seq_client *client, · 1831 unmodified lines
18321832 info->output_pool != client->pool->size)) {
18331833 if (snd_seq_write_pool_allocated(client)) {
18341834 /* remove all existing cells */
1835+ snd_seq_pool_mark_closing(client->pool);
18351836 snd_seq_queue_client_leave_cells(client->number);
18361837 snd_seq_pool_done(client->pool);
18371838 }
sound/core/seq/seq_fifo.c+3−0
@@ -72,6 +72,9 @@ void snd_seq_fifo_delete(struct snd_seq_fifo **fifo) · 71 unmodified lines
7272 return;
7373 *fifo = NULL;
7474
75+ if (f->pool)
76+ snd_seq_pool_mark_closing(f->pool);
77+
7578 snd_seq_fifo_clear(f);
7679
7780 /* wake up clients if any */
sound/core/seq/seq_memory.c+13−4
@@ -415,6 +415,18 @@ int snd_seq_pool_init(struct snd_seq_pool *pool) · 414 unmodified lines
415415 return 0;
416416 }
417417
418+/* refuse the further insertion to the pool */
419+void snd_seq_pool_mark_closing(struct snd_seq_pool *pool)
420+{
421+ unsigned long flags;
422+
423+ if (snd_BUG_ON(!pool))
424+ return;
425+ spin_lock_irqsave(&pool->lock, flags);
426+ pool->closing = 1;
427+ spin_unlock_irqrestore(&pool->lock, flags);
428+}
429+
418430 /* remove events */
419431 int snd_seq_pool_done(struct snd_seq_pool *pool)
420432 {
@@ -425,10 +437,6 @@ int snd_seq_pool_done(struct snd_seq_pool *pool) · 4 unmodified lines
425437 return -EINVAL;
426438
427439 /* wait for closing all threads */
428− spin_lock_irqsave(&pool->lock, flags);
429− pool->closing = 1;
430− spin_unlock_irqrestore(&pool->lock, flags);
431−
432440 if (waitqueue_active(&pool->output_sleep))
433441 wake_up(&pool->output_sleep);
434442
@@ -485,6 +493,7 @@ int snd_seq_pool_delete(struct snd_seq_pool **ppool) · 50 unmodified lines
485493 *ppool = NULL;
486494 if (pool == NULL)
487495 return 0;
496+ snd_seq_pool_mark_closing(pool);
488497 snd_seq_pool_done(pool);
489498 kfree(pool);
490499 return 0;
sound/core/seq/seq_memory.h+1−0
@@ -84,6 +84,7 @@ static inline int snd_seq_total_cells(struct snd_seq_pool *pool) · 83 unmodified lines
8484 int snd_seq_pool_init(struct snd_seq_pool *pool);
8585
8686 /* done pool - free events */
87+void snd_seq_pool_mark_closing(struct snd_seq_pool *pool);
8788 int snd_seq_pool_done(struct snd_seq_pool *pool);
8889
8990 /* create pool */
sound/pci/ctxfi/cthw20k1.c+1−1
@@ -1905,7 +1905,7 @@ static int hw_card_start(struct hw *hw) · 1904 unmodified lines
19051905 return err;
19061906
19071907 /* Set DMA transfer mask */
1908− if (dma_set_mask(&pci->dev, DMA_BIT_MASK(dma_bits))) {
1908+ if (!dma_set_mask(&pci->dev, DMA_BIT_MASK(dma_bits))) {
19091909 dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(dma_bits));
19101910 } else {
19111911 dma_set_mask(&pci->dev, DMA_BIT_MASK(32));
sound/pci/hda/patch_conexant.c+11−0
@@ -261,6 +261,7 @@ enum { · 260 unmodified lines
261261 CXT_FIXUP_HP_530,
262262 CXT_FIXUP_CAP_MIX_AMP_5047,
263263 CXT_FIXUP_MUTE_LED_EAPD,
264+ CXT_FIXUP_HP_DOCK,
264265 CXT_FIXUP_HP_SPECTRE,
265266 CXT_FIXUP_HP_GATE_MIC,
266267 };
@@ -778,6 +779,14 @@ static const struct hda_fixup cxt_fixups[] = { · 511 unmodified lines
778779 .type = HDA_FIXUP_FUNC,
779780 .v.func = cxt_fixup_mute_led_eapd,
780781 },
782+ [CXT_FIXUP_HP_DOCK] = {
783+ .type = HDA_FIXUP_PINS,
784+ .v.pins = (const struct hda_pintbl[]) {
785+ { 0x16, 0x21011020 }, /* line-out */
786+ { 0x18, 0x2181103f }, /* line-in */
787+ { }
788+ }
789+ },
781790 [CXT_FIXUP_HP_SPECTRE] = {
782791 .type = HDA_FIXUP_PINS,
783792 .v.pins = (const struct hda_pintbl[]) {
@@ -839,6 +848,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = { · 55 unmodified lines
839848 SND_PCI_QUIRK(0x1025, 0x0543, "Acer Aspire One 522", CXT_FIXUP_STEREO_DMIC),
840849 SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT_FIXUP_ASPIRE_DMIC),
841850 SND_PCI_QUIRK(0x1025, 0x054f, "Acer Aspire 4830T", CXT_FIXUP_ASPIRE_DMIC),
851+ SND_PCI_QUIRK(0x103c, 0x8079, "HP EliteBook 840 G3", CXT_FIXUP_HP_DOCK),
842852 SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE),
843853 SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC),
844854 SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN),
@@ -871,6 +881,7 @@ static const struct hda_model_fixup cxt5066_fixup_models[] = { · 26 unmodified lines
871881 { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" },
872882 { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" },
873883 { .id = CXT_FIXUP_MUTE_LED_EAPD, .name = "mute-led-eapd" },
884+ { .id = CXT_FIXUP_HP_DOCK, .name = "hp-dock" },
874885 {}
875886 };
876887
sound/pci/hda/patch_realtek.c+15−1
@@ -4847,6 +4847,7 @@ enum { · 4846 unmodified lines
48474847 ALC286_FIXUP_HP_GPIO_LED,
48484848 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
48494849 ALC280_FIXUP_HP_DOCK_PINS,
4850+ ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
48504851 ALC280_FIXUP_HP_9480M,
48514852 ALC288_FIXUP_DELL_HEADSET_MODE,
48524853 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
@@ -5388,6 +5389,16 @@ static const struct hda_fixup alc269_fixups[] = { · 535 unmodified lines
53885389 .chained = true,
53895390 .chain_id = ALC280_FIXUP_HP_GPIO4
53905391 },
5392+ [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
5393+ .type = HDA_FIXUP_PINS,
5394+ .v.pins = (const struct hda_pintbl[]) {
5395+ { 0x1b, 0x21011020 }, /* line-out */
5396+ { 0x18, 0x2181103f }, /* line-in */
5397+ { },
5398+ },
5399+ .chained = true,
5400+ .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
5401+ },
53915402 [ALC280_FIXUP_HP_9480M] = {
53925403 .type = HDA_FIXUP_FUNC,
53935404 .v.func = alc280_fixup_hp_9480m,
@@ -5647,7 +5658,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 253 unmodified lines
56475658 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
56485659 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
56495660 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5650− SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5661+ SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
56515662 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
56525663 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
56535664 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
@@ -5816,6 +5827,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { · 162 unmodified lines
58165827 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
58175828 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
58185829 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
5830+ {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
58195831 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
58205832 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
58215833 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
@@ -6090,6 +6102,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { · 268 unmodified lines
60906102 ALC295_STANDARD_PINS,
60916103 {0x17, 0x21014040},
60926104 {0x18, 0x21a19050}),
6105+ SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6106+ ALC295_STANDARD_PINS),
60936107 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
60946108 ALC298_STANDARD_PINS,
60956109 {0x17, 0x90170110}),
sound/x86/Kconfig+2−1
@@ -1,6 +1,7 @@
11 menuconfig SND_X86
2− tristate "X86 sound devices"
2+ bool "X86 sound devices"
33 depends on X86
4+ default y
45 ---help---
56 X86 sound devices that don't fall under SoC or PCI categories
67
tools/testing/selftests/bpf/Makefile+10−9
@@ -1,22 +1,23 @@
11 LIBDIR := ../../../lib
2−BPFOBJ := $(LIBDIR)/bpf/bpf.o
2+BPFDIR := $(LIBDIR)/bpf
33
4−CFLAGS += -Wall -O2 -lcap -I../../../include/uapi -I$(LIBDIR) $(BPFOBJ)
4+CFLAGS += -Wall -O2 -I../../../include/uapi -I$(LIBDIR)
5+LDLIBS += -lcap
56
67 TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map
78
89 TEST_PROGS := test_kmod.sh
910
10−all: $(TEST_GEN_PROGS)
11+include ../lib.mk
12+
13+BPFOBJ := $(OUTPUT)/bpf.o
14+
15+$(TEST_GEN_PROGS): $(BPFOBJ)
1116
12−.PHONY: all clean force
17+.PHONY: force
1318
1419 # force a rebuild of BPFOBJ when its dependencies are updated
1520 force:
1621
1722 $(BPFOBJ): force
18− $(MAKE) -C $(dir $(BPFOBJ))
19−
20−$(test_objs): $(BPFOBJ)
21−
22−include ../lib.mk
23+ $(MAKE) -C $(BPFDIR) OUTPUT=$(OUTPUT)/
tools/testing/selftests/bpf/test_maps.c+26−3
@@ -80,8 +80,9 @@ static void test_hashmap(int task, void *data) · 79 unmodified lines
8080 assert(bpf_map_update_elem(fd, &key, &value, BPF_EXIST) == 0);
8181 key = 2;
8282 assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == 0);
83− key = 1;
84− assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == 0);
83+ key = 3;
84+ assert(bpf_map_update_elem(fd, &key, &value, BPF_NOEXIST) == -1 &&
85+ errno == E2BIG);
8586
8687 /* Check that key = 0 doesn't exist. */
8788 key = 0;
@@ -110,6 +111,24 @@ static void test_hashmap(int task, void *data) · 22 unmodified lines
110111 close(fd);
111112 }
112113
114+static void test_hashmap_sizes(int task, void *data)
115+{
116+ int fd, i, j;
117+
118+ for (i = 1; i <= 512; i <<= 1)
119+ for (j = 1; j <= 1 << 18; j <<= 1) {
120+ fd = bpf_create_map(BPF_MAP_TYPE_HASH, i, j,
121+ 2, map_flags);
122+ if (fd < 0) {
123+ printf("Failed to create hashmap key=%d value=%d '%s'\n",
124+ i, j, strerror(errno));
125+ exit(1);
126+ }
127+ close(fd);
128+ usleep(10); /* give kernel time to destroy */
129+ }
130+}
131+
113132 static void test_hashmap_percpu(int task, void *data)
114133 {
115134 unsigned int nr_cpus = bpf_num_possible_cpus();
@@ -317,7 +336,10 @@ static void test_arraymap_percpu(int task, void *data) · 201 unmodified lines
317336 static void test_arraymap_percpu_many_keys(void)
318337 {
319338 unsigned int nr_cpus = bpf_num_possible_cpus();
320− unsigned int nr_keys = 20000;
339+ /* nr_keys is not too large otherwise the test stresses percpu
340+ * allocator more than anything else
341+ */
342+ unsigned int nr_keys = 2000;
321343 long values[nr_cpus];
322344 int key, fd, i;
323345
@@ -419,6 +441,7 @@ static void test_map_stress(void) · 95 unmodified lines
419441 {
420442 run_parallel(100, test_hashmap, NULL);
421443 run_parallel(100, test_hashmap_percpu, NULL);
444+ run_parallel(100, test_hashmap_sizes, NULL);
422445
423446 run_parallel(100, test_arraymap, NULL);
424447 run_parallel(100, test_arraymap_percpu, NULL);

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