History

Merge tag 'v5.4-rc7' into perf/core, to pick up fixes

Ingo Molnar committed 7 years ago

Commit 1ca7feb2 parents d44f821 31f4f5b682 files · +9364 −3184Browse files

Unified · Split

682 files
  1. .mailmap +4 −0
  2. Documentation/arm64/silicon-errata.rst +6 −1
  3. Documentation/networking/device_drivers/intel/e100.rst +7 −7
  4. Documentation/networking/device_drivers/intel/e1000.rst +6 −6
  5. Documentation/networking/device_drivers/intel/e1000e.rst +7 −7
  6. Documentation/networking/device_drivers/intel/fm10k.rst +5 −5
  7. Documentation/networking/device_drivers/intel/i40e.rst +4 −4
  8. Documentation/networking/device_drivers/intel/iavf.rst +4 −4
  9. Documentation/networking/device_drivers/intel/ice.rst +3 −3
  10. Documentation/networking/device_drivers/intel/igb.rst +6 −6
  11. Documentation/networking/device_drivers/intel/igbvf.rst +3 −3
  12. Documentation/networking/device_drivers/intel/ixgbe.rst +5 −5
  13. Documentation/networking/device_drivers/intel/ixgbevf.rst +3 −3
  14. Documentation/networking/device_drivers/pensando/ionic.rst +3 −3
  15. Documentation/networking/ip-sysctl.txt +7 −4
  16. Documentation/networking/tls-offload.rst +4 −0
  17. MAINTAINERS +15 −5
  18. Makefile +1 −1
  19. arch/arc/boot/dts/hsdk.dts +23 −0
  20. arch/arc/configs/hsdk_defconfig +6 −0
  21. arch/arc/kernel/perf_event.c +2 −2
  22. arch/arm/boot/dts/imx6-logicpd-baseboard.dtsi +4 −0
  23. arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +8 −0
  24. arch/arm/boot/dts/stm32mp157c-ev1.dts +2 −11
  25. arch/arm/boot/dts/stm32mp157c.dtsi +2 −2
  26. arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts +1 −0
  27. arch/arm/mach-sunxi/mc_smp.c +5 −1
  28. arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts +1 −1
  29. arch/arm64/boot/dts/freescale/imx8mm.dtsi +3 −3
  30. arch/arm64/boot/dts/freescale/imx8mn.dtsi +3 −3
  31. arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi +1 −1
  32. arch/arm64/include/asm/cputype.h +2 −0
  33. arch/arm64/include/asm/pgtable-prot.h +8 −7
  34. arch/arm64/include/asm/pgtable.h +0 −17
  35. arch/arm64/include/asm/vdso/vsyscall.h +0 −7
  36. arch/arm64/kernel/cpu_errata.c +48 −11
  37. arch/mips/include/asm/vdso/vsyscall.h +0 −7
  38. arch/parisc/kernel/entry.S +1 −1
  39. arch/powerpc/include/asm/book3s/32/kup.h +1 −0
  40. arch/powerpc/include/asm/elf.h +3 −0
  41. arch/powerpc/kernel/prom_init.c +13 −0
  42. arch/powerpc/kernel/prom_init_check.sh +2 −1
  43. arch/powerpc/net/bpf_jit_comp64.c +13 −0
  44. arch/powerpc/platforms/powernv/eeh-powernv.c +1 −1
  45. arch/powerpc/platforms/powernv/smp.c +37 −16
  46. arch/riscv/include/asm/io.h +7 −0
  47. arch/riscv/include/asm/irq.h +3 −0
  48. arch/riscv/include/asm/pgtable.h +6 −1
  49. arch/riscv/include/asm/switch_to.h +1 −0
  50. arch/riscv/kernel/cpufeature.c +1 −0
  51. arch/riscv/kernel/head.h +21 −0
  52. arch/riscv/kernel/irq.c +1 −1
  53. arch/riscv/kernel/module-sections.c +1 −0
  54. arch/riscv/kernel/process.c +2 −0
  55. arch/riscv/kernel/ptrace.c +2 −2
  56. arch/riscv/kernel/reset.c +1 −0
  57. arch/riscv/kernel/setup.c +2 −0
  58. arch/riscv/kernel/signal.c +4 −4
  59. arch/riscv/kernel/smp.c +2 −0
  60. arch/riscv/kernel/smpboot.c +4 −1
  61. arch/riscv/kernel/syscall_table.c +1 −0
  62. arch/riscv/kernel/time.c +1 −0
  63. arch/riscv/kernel/traps.c +3 −2
  64. arch/riscv/kernel/vdso.c +2 −1
  65. arch/riscv/mm/context.c +1 −0
  66. arch/riscv/mm/fault.c +2 −0
  67. arch/riscv/mm/init.c +3 −2
  68. arch/riscv/mm/sifive_l2_cache.c +1 −1
  69. arch/s390/include/asm/unwind.h +1 −0
  70. arch/s390/kernel/idle.c +22 −7
  71. arch/s390/kernel/unwind_bc.c +13 −5
  72. arch/s390/mm/cmm.c +6 −6
  73. arch/um/drivers/ubd_kern.c +6 −2
  74. arch/x86/boot/compressed/eboot.c +3 −1
  75. arch/x86/kernel/apic/apic.c +15 −13
  76. arch/x86/kernel/cpu/resctrl/ctrlmondata.c +4 −0
  77. arch/x86/kernel/dumpstack_64.c +7 −0
  78. arch/x86/kernel/tsc.c +3 −0
  79. arch/x86/kvm/svm.c +8 −2
  80. arch/x86/kvm/vmx/vmx.c +3 −11
  81. block/blk-cgroup.c +8 −5
  82. block/blk-iocost.c +2 −2
  83. drivers/acpi/processor_perflib.c +21 −13
  84. drivers/acpi/processor_thermal.c +21 −13
  85. drivers/block/drbd/drbd_main.c +0 −1
  86. drivers/clk/at91/clk-main.c +4 −1
  87. drivers/clk/at91/sam9x60.c +1 −0
  88. drivers/clk/at91/sckc.c +16 −4
  89. drivers/clk/clk-ast2600.c +4 −3
  90. drivers/clk/imx/clk-imx8mm.c +1 −1
  91. drivers/clk/imx/clk-imx8mn.c +1 −1
  92. drivers/clk/meson/g12a.c +11 −2
  93. drivers/clk/meson/gxbb.c +1 −0
  94. drivers/clk/samsung/clk-exynos5420.c +25 −2
  95. drivers/clk/samsung/clk-exynos5433.c +12 −2
  96. drivers/clk/sunxi-ng/ccu-sun9i-a80.c +1 −1
  97. drivers/clk/sunxi/clk-sunxi.c +2 −2
  98. drivers/clk/ti/clk-dra7-atl.c +0 −6
  99. drivers/clk/ti/clkctrl.c +3 −2
  100. drivers/clocksource/sh_mtu2.c +11 −5
  101. drivers/clocksource/timer-mediatek.c +2 −8
  102. drivers/cpufreq/intel_pstate.c +1 −3
  103. drivers/crypto/chelsio/chtls/chtls_cm.c +1 −1
  104. drivers/crypto/chelsio/chtls/chtls_io.c +1 −1
  105. drivers/dma/imx-sdma.c +8 −0
  106. drivers/dma/qcom/bam_dma.c +19 −0
  107. drivers/dma/sprd-dma.c +25 −2
  108. drivers/dma/tegra210-adma.c +7 −0
  109. drivers/dma/ti/cppi41.c +20 −1
  110. drivers/dma/xilinx/xilinx_dma.c +9 −1
  111. drivers/firmware/efi/Kconfig +1 −0
  112. drivers/firmware/efi/efi.c +1 −1
  113. drivers/firmware/efi/libstub/Makefile +1 −0
  114. drivers/firmware/efi/libstub/arm32-stub.c +13 −3
  115. drivers/firmware/efi/libstub/efi-stub-helper.c +10 −14
  116. drivers/firmware/efi/test/efi_test.c +8 −0
  117. drivers/firmware/efi/tpm.c +1 −0
  118. drivers/gpio/gpio-merrifield.c +13 −20
  119. drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +4 −1
  120. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 −0
  121. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 −0
  122. drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +1 −0
  123. drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +3 −1
  124. drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 −1
  125. drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +51 −3
  126. drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +13 −0
  127. drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c +9 −0
  128. drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +4 −5
  129. drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c +9 −0
  130. drivers/gpu/drm/amd/amdgpu/mmhub_v9_4.c +9 −0
  131. drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1 −0
  132. drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +12 −1
  133. drivers/gpu/drm/amd/amdgpu/soc15.c +0 −5
  134. drivers/gpu/drm/amd/display/dc/calcs/Makefile +12 −7
  135. drivers/gpu/drm/amd/display/dc/core/dc.c +4 −0
  136. drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c +18 −6
  137. drivers/gpu/drm/amd/display/dc/core/dc_resource.c +6 −0
  138. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c +8 −14
  139. drivers/gpu/drm/amd/display/dc/dcn20/Makefile +12 −7
  140. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +6 −1
  141. drivers/gpu/drm/amd/display/dc/dcn21/Makefile +12 −7
  142. drivers/gpu/drm/amd/display/dc/dml/Makefile +12 −7
  143. drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c +2 −1
  144. drivers/gpu/drm/amd/display/dc/dsc/Makefile +12 −7
  145. drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1 −3
  146. drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 −1
  147. drivers/gpu/drm/amd/powerplay/vega20_ppt.c +1 −1
  148. drivers/gpu/drm/drm_atomic_helper.c +14 −1
  149. drivers/gpu/drm/drm_self_refresh_helper.c +11 −7
  150. drivers/gpu/drm/etnaviv/etnaviv_dump.c +2 −2
  151. drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c +4 −2
  152. drivers/gpu/drm/etnaviv/etnaviv_mmu.c +14 −3
  153. drivers/gpu/drm/i915/display/intel_crt.c +7 −0
  154. drivers/gpu/drm/i915/display/intel_display.c +6 −5
  155. drivers/gpu/drm/i915/display/intel_dp.c +11 −1
  156. drivers/gpu/drm/i915/display/intel_dpll_mgr.c +15 −0
  157. drivers/gpu/drm/i915/display/intel_dpll_mgr.h +2 −2
  158. drivers/gpu/drm/i915/display/intel_hdmi.c +6 −0
  159. drivers/gpu/drm/i915/i915_drv.h +2 −0
  160. drivers/gpu/drm/panfrost/panfrost_drv.c +1 −1
  161. drivers/gpu/drm/panfrost/panfrost_mmu.c +8 −7
  162. drivers/gpu/drm/panfrost/panfrost_perfcnt.c +1 −0
  163. drivers/gpu/drm/radeon/radeon_drv.c +14 −0
  164. drivers/gpu/drm/radeon/si_dpm.c +1 −0
  165. drivers/gpu/drm/scheduler/sched_main.c +16 −3
  166. drivers/gpu/drm/v3d/v3d_gem.c +4 −1
  167. drivers/hid/hid-axff.c +9 −2
  168. drivers/hid/hid-core.c +5 −2
  169. drivers/hid/hid-dr.c +9 −3
  170. drivers/hid/hid-emsff.c +9 −3
  171. drivers/hid/hid-gaff.c +9 −3
  172. drivers/hid/hid-google-hammer.c +4 −0
  173. drivers/hid/hid-holtekff.c +9 −3
  174. drivers/hid/hid-ids.h +2 −0
  175. drivers/hid/hid-lg2ff.c +9 −3
  176. drivers/hid/hid-lg3ff.c +9 −2
  177. drivers/hid/hid-lg4ff.c +9 −2
  178. drivers/hid/hid-lgff.c +9 −2
  179. drivers/hid/hid-logitech-hidpp.c +140 −108
  180. drivers/hid/hid-microsoft.c +9 −3
  181. drivers/hid/hid-prodikeys.c +2 −2
  182. drivers/hid/hid-sony.c +9 −3
  183. drivers/hid/hid-tmff.c +9 −3
  184. drivers/hid/hid-zpff.c +9 −3
  185. drivers/hid/i2c-hid/i2c-hid-core.c +11 −111
  186. drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c +19 −0
  187. drivers/hid/intel-ish-hid/ishtp/client-buffers.c +1 −1
  188. drivers/hid/wacom.h +15 −0
  189. drivers/hid/wacom_wac.c +6 −4
  190. drivers/hwmon/ina3221.c +1 −1
  191. drivers/hwmon/nct7904.c +12 −3
  192. drivers/hwtracing/intel_th/gth.c +3 −0
  193. drivers/hwtracing/intel_th/msu.c +8 −3
  194. drivers/hwtracing/intel_th/pci.c +10 −0
  195. drivers/iio/adc/stm32-adc.c +2 −2
  196. drivers/iio/imu/adis16480.c +4 −1
  197. drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +9 −0
  198. drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h +2 −0
  199. drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +12 −3
  200. drivers/iio/proximity/srf04.c +15 −14
  201. drivers/infiniband/core/core_priv.h +1 −0
  202. drivers/infiniband/core/device.c +2 −0
  203. drivers/infiniband/core/iwcm.c +29 −23
  204. drivers/infiniband/core/netlink.c +53 −54
  205. drivers/infiniband/core/nldev.c +1 −1
  206. drivers/infiniband/core/uverbs.h +1 −1
  207. drivers/infiniband/core/verbs.c +5 −4
  208. drivers/infiniband/hw/cxgb4/cm.c +14 −16
  209. drivers/infiniband/hw/hfi1/sdma.c +3 −2
  210. drivers/infiniband/hw/hfi1/tid_rdma.c +0 −5
  211. drivers/infiniband/hw/hfi1/verbs.c +4 −6
  212. drivers/infiniband/hw/hns/hns_roce_hw_v2.c +3 −3
  213. drivers/infiniband/hw/mlx5/mr.c +2 −2
  214. drivers/infiniband/hw/mlx5/qp.c +5 −3
  215. drivers/infiniband/hw/qedr/main.c +1 −1
  216. drivers/infiniband/sw/siw/siw_qp.c +2 −0
  217. drivers/infiniband/sw/siw/siw_verbs.c +0 −2
  218. drivers/interconnect/core.c +4 −0
  219. drivers/interconnect/qcom/qcs404.c +2 −1
  220. drivers/interconnect/qcom/sdm845.c +2 −1
  221. drivers/iommu/amd_iommu_quirks.c +13 −0
  222. drivers/iommu/intel-iommu.c +1 −1
  223. drivers/iommu/ipmmu-vmsa.c +1 −3
  224. drivers/isdn/capi/capi.c +1 −1
  225. drivers/net/bonding/bond_alb.c +1 −1
  226. drivers/net/bonding/bond_main.c +31 −41
  227. drivers/net/can/c_can/c_can.c +64 −7
  228. drivers/net/can/c_can/c_can.h +1 −0
  229. drivers/net/can/dev.c +1 −0
  230. drivers/net/can/flexcan.c +9 −2
  231. drivers/net/can/rx-offload.c +85 −17
  232. drivers/net/can/spi/mcp251x.c +1 −1
  233. drivers/net/can/ti_hecc.c +148 −84
  234. drivers/net/can/usb/gs_usb.c +1 −0
  235. drivers/net/can/usb/mcba_usb.c +1 −2
  236. drivers/net/can/usb/peak_usb/pcan_usb.c +22 −10
  237. drivers/net/can/usb/peak_usb/pcan_usb_core.c +1 −1
  238. drivers/net/can/usb/usb_8dev.c +1 −2
  239. drivers/net/can/xilinx_can.c +0 −1
  240. drivers/net/dsa/bcm_sf2.c +23 −17
  241. drivers/net/dsa/sja1105/Kconfig +2 −2
  242. drivers/net/ethernet/arc/emac_rockchip.c +3 −0
  243. drivers/net/ethernet/broadcom/bnxt/bnxt.c +4 −6
  244. drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +67 −45
  245. drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h +2 −1
  246. drivers/net/ethernet/broadcom/genet/bcmgenet.c +15 −20
  247. drivers/net/ethernet/broadcom/genet/bcmgenet.h +1 −1
  248. drivers/net/ethernet/broadcom/genet/bcmmii.c +94 −51
  249. drivers/net/ethernet/cavium/octeon/octeon_mgmt.c +1 −1
  250. drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c +16 −12
  251. drivers/net/ethernet/chelsio/cxgb4/sge.c +2 −6
  252. drivers/net/ethernet/cortina/gemini.h +1 −1
  253. drivers/net/ethernet/faraday/ftgmac100.c +12 −13
  254. drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.h +1 −1
  255. drivers/net/ethernet/freescale/dpaa2/dprtc-cmd.h +1 −1
  256. drivers/net/ethernet/freescale/dpaa2/dprtc.h +1 −1
  257. drivers/net/ethernet/freescale/fec_main.c +3 −1
  258. drivers/net/ethernet/freescale/fec_ptp.c +2 −2
  259. drivers/net/ethernet/google/gve/gve_rx.c +2 −0
  260. drivers/net/ethernet/google/gve/gve_tx.c +22 −2
  261. drivers/net/ethernet/hisilicon/hip04_eth.c +9 −7
  262. drivers/net/ethernet/hisilicon/hns/hnae.c +0 −1
  263. drivers/net/ethernet/hisilicon/hns/hnae.h +0 −3
  264. drivers/net/ethernet/hisilicon/hns/hns_enet.c +1 −21
  265. drivers/net/ethernet/hisilicon/hns3/hnae3.h +1 −1
  266. drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +1 −1
  267. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h +1 −1
  268. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.h +1 −1
  269. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +17 −1
  270. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +1 −1
  271. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.h +1 −1
  272. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h +1 −1
  273. drivers/net/ethernet/intel/e1000/e1000_ethtool.c +3 −4
  274. drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +2 −0
  275. drivers/net/ethernet/intel/i40e/i40e_common.c +2 −1
  276. drivers/net/ethernet/intel/i40e/i40e_xsk.c +2 −13
  277. drivers/net/ethernet/intel/iavf/iavf_main.c +2 −2
  278. drivers/net/ethernet/intel/ice/ice_sched.c +1 −1
  279. drivers/net/ethernet/intel/igb/e1000_82575.c +1 −1
  280. drivers/net/ethernet/intel/igb/igb_main.c +7 −5
  281. drivers/net/ethernet/intel/igc/igc_main.c +4 −3
  282. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +0 −1
  283. drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +2 −8
  284. drivers/net/ethernet/marvell/mvneta_bm.h +20 −12
  285. drivers/net/ethernet/mellanox/mlx4/main.c +1 −2
  286. drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +26 −16
  287. drivers/net/ethernet/mellanox/mlx5/core/en.h +2 −1
  288. drivers/net/ethernet/mellanox/mlx5/core/en/hv_vhca_stats.c +2 −2
  289. drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +9 −3
  290. drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h +6 −7
  291. drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c +1 −1
  292. drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h +25 −4
  293. drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c +114 −76
  294. drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +1 −1
  295. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +11 −2
  296. drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +2 −2
  297. drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +4 −1
  298. drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c +3 −12
  299. drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +10 −6
  300. drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +6 −4
  301. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +28 −8
  302. drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +20 −15
  303. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +1 −2
  304. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c +17 −6
  305. drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c +3 −1
  306. drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +2 −1
  307. drivers/net/ethernet/mellanox/mlx5/core/health.c +1 −1
  308. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c +1 −0
  309. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c +2 −0
  310. drivers/net/ethernet/mellanox/mlxsw/core.c +2 −2
  311. drivers/net/ethernet/mscc/ocelot.c +14 −6
  312. drivers/net/ethernet/mscc/ocelot.h +1 −1
  313. drivers/net/ethernet/netronome/nfp/nfp_net_repr.c +0 −18
  314. drivers/net/ethernet/pensando/ionic/ionic_lif.c +2 −0
  315. drivers/net/ethernet/pensando/ionic/ionic_main.c +2 −0
  316. drivers/net/ethernet/qlogic/qed/qed_main.c +21 −6
  317. drivers/net/ethernet/qlogic/qed/qed_sriov.c +1 −1
  318. drivers/net/ethernet/qlogic/qede/qede_main.c +10 −2
  319. drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c +2 −2
  320. drivers/net/ethernet/realtek/r8169_main.c +7 −0
  321. drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +1 −1
  322. drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +2 −1
  323. drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +2 −1
  324. drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +3 −1
  325. drivers/net/ethernet/stmicro/stmmac/mmc_core.c +4 −2
  326. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +39 −32
  327. drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +94 −40
  328. drivers/net/fjes/fjes_main.c +14 −1
  329. drivers/net/hamradio/bpqether.c +0 −22
  330. drivers/net/hyperv/netvsc_drv.c +11 −4
  331. drivers/net/ipvlan/ipvlan_main.c +0 −2
  332. drivers/net/macsec.c +0 −18
  333. drivers/net/macvlan.c +0 −19
  334. drivers/net/netdevsim/dev.c +5 −0
  335. drivers/net/phy/phylink.c +16 −0
  336. drivers/net/phy/smsc.c +1 −0
  337. drivers/net/ppp/ppp_generic.c +0 −2
  338. drivers/net/team/team.c +12 −4
  339. drivers/net/usb/cdc_ether.c +7 −0
  340. drivers/net/usb/cdc_ncm.c +3 −3
  341. drivers/net/usb/lan78xx.c +4 −1
  342. drivers/net/usb/qmi_wwan.c +1 −0
  343. drivers/net/usb/r8152.c +1 −0
  344. drivers/net/vrf.c +0 −1
  345. drivers/net/vxlan.c +50 −12
  346. drivers/net/wimax/i2400m/op-rfkill.c +1 −1
  347. drivers/net/wireless/intel/iwlwifi/fw/api/scan.h +20 −2
  348. drivers/net/wireless/intel/iwlwifi/fw/file.h +3 −0
  349. drivers/net/wireless/intel/iwlwifi/iwl-csr.h +1 −0
  350. drivers/net/wireless/intel/iwlwifi/iwl-prph.h +5 −0
  351. drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +6 −0
  352. drivers/net/wireless/intel/iwlwifi/mvm/scan.c +32 −8
  353. drivers/net/wireless/intel/iwlwifi/mvm/sta.c +83 −57
  354. drivers/net/wireless/intel/iwlwifi/pcie/drv.c +64 −67
  355. drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c +25 −0
  356. drivers/net/wireless/intersil/hostap/hostap_hw.c +0 −25
  357. drivers/net/wireless/mediatek/mt76/Makefile +2 −0
  358. drivers/net/wireless/mediatek/mt76/dma.c +4 −2
  359. drivers/net/wireless/mediatek/mt76/mt76.h +4 −2
  360. drivers/net/wireless/mediatek/mt76/mt76x2/pci.c +2 −0
  361. drivers/net/wireless/mediatek/mt76/pci.c +46 −0
  362. drivers/net/wireless/realtek/rtlwifi/pci.c +2 −1
  363. drivers/net/wireless/realtek/rtlwifi/ps.c +6 −0
  364. drivers/net/wireless/virt_wifi.c +52 −2
  365. drivers/nfc/fdp/i2c.c +1 −1
  366. drivers/nfc/st21nfca/core.c +1 −0
  367. drivers/nvme/host/multipath.c +6 −5
  368. drivers/nvme/host/rdma.c +8 −0
  369. drivers/nvme/host/tcp.c +1 −1
  370. drivers/pinctrl/intel/pinctrl-cherryview.c +13 −13
  371. drivers/pinctrl/intel/pinctrl-intel.c +20 −1
  372. drivers/pinctrl/pinctrl-stmfx.c +0 −14
  373. drivers/pwm/core.c +1 −8
  374. drivers/pwm/pwm-bcm-iproc.c +1 −0
  375. drivers/reset/core.c +3 −2
  376. drivers/scsi/lpfc/lpfc_nportdisc.c +2 −2
  377. drivers/scsi/lpfc/lpfc_sli.c +1 −1
  378. drivers/scsi/qla2xxx/qla_attr.c +3 −4
  379. drivers/scsi/qla2xxx/qla_bsg.c +3 −3
  380. drivers/scsi/qla2xxx/qla_mbx.c +2 −1
  381. drivers/scsi/qla2xxx/qla_os.c +4 −0
  382. drivers/scsi/sd.c +2 −1
  383. drivers/scsi/ufs/ufs_bsg.c +4 −0
  384. drivers/soc/imx/gpc.c +4 −4
  385. drivers/soundwire/Kconfig +1 −0
  386. drivers/soundwire/intel.c +2 −2
  387. drivers/soundwire/slave.c +2 −1
  388. drivers/staging/Kconfig +2 −0
  389. drivers/staging/Makefile +1 −0
  390. drivers/staging/vboxsf/Kconfig +10 −0
  391. drivers/staging/vboxsf/Makefile +5 −0
  392. drivers/staging/vboxsf/TODO +7 −0
  393. drivers/staging/vboxsf/dir.c +418 −0
  394. drivers/staging/vboxsf/file.c +370 −0
  395. drivers/staging/vboxsf/shfl_hostintf.h +901 −0
  396. drivers/staging/vboxsf/super.c +501 −0
  397. drivers/staging/vboxsf/utils.c +551 −0
  398. drivers/staging/vboxsf/vboxsf_wrappers.c +371 −0
  399. drivers/staging/vboxsf/vfsmod.h +137 −0
  400. drivers/target/iscsi/cxgbit/cxgbit_cm.c +2 −1
  401. drivers/thunderbolt/nhi_ops.c +0 −1
  402. drivers/thunderbolt/switch.c +11 −17
  403. drivers/usb/cdns3/gadget.c +28 −9
  404. drivers/usb/cdns3/host-export.h +0 −1
  405. drivers/usb/cdns3/host.c +1 −0
  406. drivers/usb/core/config.c +5 −0
  407. drivers/usb/dwc3/Kconfig +1 −0
  408. drivers/usb/dwc3/core.c +1 −2
  409. drivers/usb/dwc3/dwc3-pci.c +1 −1
  410. drivers/usb/dwc3/gadget.c +6 −0
  411. drivers/usb/gadget/composite.c +4 −0
  412. drivers/usb/gadget/configfs.c +105 −5
  413. drivers/usb/gadget/udc/atmel_usba_udc.c +4 −2
  414. drivers/usb/gadget/udc/core.c +11 −0
  415. drivers/usb/gadget/udc/fsl_udc_core.c +1 −1
  416. drivers/usb/gadget/udc/renesas_usb3.c +6 −5
  417. drivers/usb/host/xhci-debugfs.c +12 −12
  418. drivers/usb/host/xhci-ring.c +2 −0
  419. drivers/usb/host/xhci.c +45 −9
  420. drivers/usb/misc/ldusb.c +7 −6
  421. drivers/usb/mtu3/mtu3_core.c +1 −0
  422. drivers/usb/renesas_usbhs/common.c +6 −6
  423. drivers/usb/renesas_usbhs/mod_gadget.c +2 −2
  424. drivers/usb/serial/whiteheat.c +10 −3
  425. drivers/usb/serial/whiteheat.h +1 −1
  426. drivers/usb/storage/scsiglue.c +0 −10
  427. drivers/usb/storage/uas.c +0 −20
  428. drivers/usb/usbip/vhci_tx.c +3 −0
  429. drivers/vhost/vringh.c +7 −1
  430. drivers/video/fbdev/c2p_core.h +4 −4
  431. drivers/virtio/virtio_ring.c +3 −4
  432. drivers/watchdog/bd70528_wdt.c +1 −0
  433. drivers/watchdog/cpwd.c +7 −1
  434. drivers/watchdog/imx_sc_wdt.c +7 −1
  435. drivers/watchdog/meson_gxbb_wdt.c +2 −2
  436. drivers/watchdog/pm8916_wdt.c +11 −4
  437. fs/btrfs/inode.c +14 −1
  438. fs/btrfs/ioctl.c +0 −6
  439. fs/btrfs/space-info.c +21 −0
  440. fs/btrfs/tree-checker.c +0 −8
  441. fs/btrfs/volumes.c +1 −0
  442. fs/ceph/caps.c +5 −5
  443. fs/ceph/dir.c +8 −7
  444. fs/ceph/file.c +13 −2
  445. fs/ceph/inode.c +1 −0
  446. fs/ceph/super.c +10 −1
  447. fs/cifs/smb2ops.c +2 −1
  448. fs/cifs/smb2pdu.h +1 −0
  449. fs/configfs/symlink.c +1 −1
  450. fs/fs-writeback.c +6 −3
  451. fs/fuse/Makefile +2 −1
  452. fs/fuse/dev.c +3 −1
  453. fs/fuse/dir.c +15 −1
  454. fs/fuse/file.c +8 −6
  455. fs/fuse/fuse_i.h +4 −0
  456. fs/fuse/inode.c +4 −0
  457. fs/fuse/virtio_fs.c +113 −56
  458. fs/gfs2/ops_fstype.c +13 −7
  459. fs/io_uring.c +10 −4
  460. fs/nfs/delegation.c +11 −1
  461. fs/nfs/delegation.h +1 −0
  462. fs/nfs/nfs4proc.c +2 −5
  463. fs/ocfs2/file.c +90 −44
  464. include/asm-generic/vdso/vsyscall.h +0 −7
  465. include/drm/drm_gem_shmem_helper.h +13 −0
  466. include/drm/drm_self_refresh_helper.h +2 −1
  467. include/linux/bpf.h +2 −2
  468. include/linux/dynamic_debug.h +6 −0
  469. include/linux/efi.h +16 −2
  470. include/linux/filter.h +0 −1
  471. include/linux/gfp.h +23 −0
  472. include/linux/idr.h +1 −1
  473. include/linux/if_macvlan.h +0 −1
  474. include/linux/if_team.h +1 −0
  475. include/linux/if_vlan.h +0 −11
  476. include/linux/mlx5/mlx5_ifc.h +1 −2
  477. include/linux/mm.h +0 −5
  478. include/linux/mm_types.h +5 −0
  479. include/linux/netdevice.h +27 −34
  480. include/linux/page-flags.h +18 −2
  481. include/linux/platform_data/dma-imx-sdma.h +3 −0
  482. include/linux/radix-tree.h +0 −18
  483. include/linux/reset-controller.h +2 −2
  484. include/linux/reset.h +1 −1
  485. include/linux/security.h +1 −0
  486. include/linux/skbuff.h +26 −10
  487. include/linux/skmsg.h +6 −3
  488. include/linux/socket.h +1 −1
  489. include/linux/sunrpc/bc_xprt.h +5 −0
  490. include/linux/virtio_vsock.h +0 −1
  491. include/net/bonding.h +2 −3
  492. include/net/busy_poll.h +3 −3
  493. include/net/flow_dissector.h +2 −1
  494. include/net/fq.h +1 −1
  495. include/net/fq_impl.h +4 −4
  496. include/net/hwbm.h +7 −3
  497. include/net/ip.h +2 −2
  498. include/net/ip_vs.h +1 −0
  499. include/net/neighbour.h +2 −2
  500. include/net/net_namespace.h +1 −1
  501. include/net/netfilter/nf_tables.h +2 −1
  502. include/net/sch_generic.h +4 −0
  503. include/net/sock.h +12 −7
  504. include/net/tls.h +5 −0
  505. include/net/vxlan.h +1 −0
  506. include/rdma/ib_verbs.h +1 −1
  507. include/uapi/linux/can.h +1 −1
  508. include/uapi/linux/can/bcm.h +1 −1
  509. include/uapi/linux/can/error.h +1 −1
  510. include/uapi/linux/can/gw.h +1 −1
  511. include/uapi/linux/can/j1939.h +1 −1
  512. include/uapi/linux/can/netlink.h +1 −1
  513. include/uapi/linux/can/raw.h +1 −1
  514. include/uapi/linux/can/vxcan.h +1 −1
  515. include/uapi/linux/fuse.h +37 −0
  516. include/uapi/linux/nvme_ioctl.h +1 −0
  517. include/uapi/linux/sched.h +4 −0
  518. kernel/bpf/cgroup.c +2 −2
  519. kernel/bpf/core.c +1 −1
  520. kernel/bpf/devmap.c +32 −1
  521. kernel/bpf/syscall.c +25 −13
  522. kernel/cgroup/cpuset.c +2 −1
  523. kernel/fork.c +32 −1
  524. kernel/irq/irqdomain.c +1 −1
  525. kernel/sched/core.c +16 −7
  526. kernel/sched/deadline.c +20 −20
  527. kernel/sched/fair.c +12 −3
  528. kernel/sched/idle.c +8 −1
  529. kernel/sched/rt.c +19 −18
  530. kernel/sched/sched.h +27 −3
  531. kernel/sched/stop_task.c +11 −7
  532. kernel/sched/topology.c +9 −2
  533. kernel/stacktrace.c +4 −2
  534. kernel/time/vsyscall.c +3 −6
  535. lib/Kconfig +0 −1
  536. lib/dump_stack.c +6 −1
  537. lib/idr.c +11 −20
  538. lib/radix-tree.c +1 −1
  539. lib/test_xarray.c +24 −0
  540. lib/xarray.c +4 −0
  541. mm/khugepaged.c +4 −3
  542. mm/memcontrol.c +16 −7
  543. mm/memory_hotplug.c +8 −0
  544. mm/mmu_notifier.c +1 −1
  545. mm/page_alloc.c +9 −8
  546. mm/slab.h +2 −2
  547. mm/vmstat.c +21 −4
  548. net/8021q/vlan.c +0 −1
  549. net/8021q/vlan_dev.c +0 −33
  550. net/atm/common.c +1 −1
  551. net/batman-adv/bat_iv_ogm.c +52 −9
  552. net/batman-adv/bat_v_ogm.c +33 −8
  553. net/batman-adv/hard-interface.c +2 −0
  554. net/batman-adv/soft-interface.c +0 −32
  555. net/batman-adv/types.h +7 −0
  556. net/bluetooth/6lowpan.c +0 −8
  557. net/bluetooth/af_bluetooth.c +2 −2
  558. net/bridge/br_device.c +0 −8
  559. net/bridge/netfilter/ebt_dnat.c +15 −4
  560. net/bridge/netfilter/nf_conntrack_bridge.c +1 −1
  561. net/caif/caif_socket.c +1 −1
  562. net/can/j1939/socket.c +7 −2
  563. net/can/j1939/transport.c +19 −1
  564. net/core/datagram.c +4 −4
  565. net/core/dev.c +467 −156
  566. net/core/dev_addr_lists.c +6 −6
  567. net/core/ethtool.c +3 −1
  568. net/core/flow_dissector.c +16 −22
  569. net/core/lwt_bpf.c +6 −1
  570. net/core/net_namespace.c +10 −8
  571. net/core/rtnetlink.c +9 −8
  572. net/core/skmsg.c +15 −5
  573. net/core/sock.c +3 −3
  574. net/dccp/ipv4.c +2 −2
  575. net/decnet/af_decnet.c +1 −1
  576. net/dsa/master.c +0 −5
  577. net/dsa/slave.c +0 −12
  578. net/ieee802154/6lowpan/core.c +0 −8
  579. net/ipv4/datagram.c +1 −1
  580. net/ipv4/fib_frontend.c +1 −1
  581. net/ipv4/fib_semantics.c +1 −1
  582. net/ipv4/inet_hashtables.c +1 −1
  583. net/ipv4/ip_gre.c +2 −2
  584. net/ipv4/ip_output.c +6 −5
  585. net/ipv4/tcp.c +2 −2
  586. net/ipv4/tcp_ipv4.c +3 −3
  587. net/ipv4/udp.c +20 −9
  588. net/ipv6/addrconf_core.c +1 −0
  589. net/ipv6/inet6_hashtables.c +1 −1
  590. net/ipv6/ip6_gre.c +2 −2
  591. net/ipv6/route.c +10 −3
  592. net/ipv6/udp.c +1 −1
  593. net/l2tp/l2tp_eth.c +0 −1
  594. net/mac80211/main.c +1 −1
  595. net/mac80211/sta_info.c +2 −1
  596. net/netfilter/ipset/ip_set_core.c +33 −16
  597. net/netfilter/ipset/ip_set_hash_ipmac.c +1 −1
  598. net/netfilter/ipset/ip_set_hash_net.c +1 −0
  599. net/netfilter/ipset/ip_set_hash_netnet.c +1 −0
  600. net/netfilter/ipvs/ip_vs_app.c +10 −2
  601. net/netfilter/ipvs/ip_vs_ctl.c +11 −18
  602. net/netfilter/ipvs/ip_vs_pe.c +2 −1
  603. net/netfilter/ipvs/ip_vs_sched.c +2 −1
  604. net/netfilter/ipvs/ip_vs_sync.c +10 −3
  605. net/netfilter/nf_flow_table_core.c +2 −1
  606. net/netfilter/nf_tables_api.c +3 −4
  607. net/netfilter/nf_tables_offload.c +3 −2
  608. net/netfilter/nft_bitwise.c +3 −2
  609. net/netfilter/nft_cmp.c +1 −1
  610. net/netfilter/nft_payload.c +38 −0
  611. net/netrom/af_netrom.c +0 −23
  612. net/nfc/llcp_sock.c +2 −2
  613. net/nfc/netlink.c +0 −2
  614. net/openvswitch/datapath.c +11 −9
  615. net/openvswitch/vport-internal_dev.c +4 −7
  616. net/phonet/socket.c +2 −2
  617. net/rose/af_rose.c +0 −23
  618. net/rxrpc/ar-internal.h +1 −0
  619. net/rxrpc/recvmsg.c +13 −5
  620. net/sched/cls_api.c +79 −4
  621. net/sched/cls_bpf.c +6 −2
  622. net/sched/sch_generic.c +8 −11
  623. net/sched/sch_hhf.c +4 −4
  624. net/sched/sch_sfb.c +7 −6
  625. net/sched/sch_sfq.c +8 −6
  626. net/sched/sch_taprio.c +4 −3
  627. net/sctp/socket.c +4 −4
  628. net/smc/af_smc.c +10 −3
  629. net/smc/smc_core.c +1 −1
  630. net/smc/smc_pnet.c +1 −3
  631. net/sunrpc/backchannel_rqst.c +4 −3
  632. net/sunrpc/xprt.c +5 −0
  633. net/sunrpc/xprtrdma/backchannel.c +2 −0
  634. net/tipc/socket.c +2 −2
  635. net/tls/tls_device.c +9 −1
  636. net/tls/tls_main.c +2 −0
  637. net/tls/tls_sw.c +10 −20
  638. net/unix/af_unix.c +3 −3
  639. net/vmw_vsock/af_vsock.c +1 −1
  640. net/vmw_vsock/virtio_transport_common.c +5 −3
  641. net/wireless/chan.c +5 −0
  642. net/wireless/nl80211.c +1 −1
  643. net/wireless/util.c +2 −1
  644. net/xdp/xdp_umem.c +6 −0
  645. scripts/gdb/linux/symbols.py +2 −1
  646. scripts/nsdeps +3 −3
  647. security/lockdown/lockdown.c +1 −0
  648. sound/core/compress_offload.c +1 −1
  649. sound/core/timer.c +20 −10
  650. sound/firewire/bebob/bebob_focusrite.c +3 −0
  651. sound/firewire/bebob/bebob_stream.c +1 −2
  652. sound/hda/hdac_controller.c +0 −2
  653. sound/pci/hda/hda_intel.c +1 −1
  654. sound/pci/hda/patch_ca0132.c +1 −1
  655. sound/pci/hda/patch_hdmi.c +19 −4
  656. sound/pci/hda/patch_realtek.c +11 −0
  657. sound/soc/codecs/hdac_hda.c +1 −1
  658. sound/soc/codecs/hdmi-codec.c +5 −7
  659. sound/soc/codecs/max98373.c +2 −2
  660. sound/soc/codecs/msm8916-wcd-analog.c +2 −2
  661. sound/soc/kirkwood/kirkwood-i2s.c +6 −5
  662. sound/soc/rockchip/rockchip_max98090.c +5 −2
  663. sound/soc/sh/rcar/dma.c +2 −2
  664. sound/soc/sof/debug.c +4 −2
  665. sound/soc/sof/intel/hda-stream.c +2 −2
  666. sound/soc/sof/ipc.c +3 −1
  667. sound/soc/sof/topology.c +6 −5
  668. sound/soc/stm/stm32_sai_sub.c +11 −1
  669. sound/soc/ti/sdma-pcm.c +1 −1
  670. sound/usb/quirks.c +1 −0
  671. tools/gpio/Makefile +5 −1
  672. tools/perf/util/hist.c +1 −1
  673. tools/testing/selftests/bpf/test_offload.py +5 −0
  674. tools/testing/selftests/bpf/test_sysctl.c +7 −1
  675. tools/testing/selftests/bpf/test_tc_edt.sh +1 −1
  676. tools/testing/selftests/net/fib_tests.sh +21 −0
  677. tools/testing/selftests/net/l2tp.sh +0 −0
  678. tools/testing/selftests/net/reuseport_dualstack.c +2 −1
  679. tools/testing/selftests/net/tls.c +108 −0
  680. tools/testing/selftests/vm/gup_benchmark.c +1 −1
  681. tools/usb/usbip/libsrc/usbip_device_driver.c +4 −2
  682. virt/kvm/kvm_main.c +26 −22
.mailmap+4−0
@@ -108,6 +108,10 @@ Jason Gunthorpe <jgg@ziepe.ca> <jgg@mellanox.com> · 107 unmodified lines
108108 Jason Gunthorpe <jgg@ziepe.ca> <jgunthorpe@obsidianresearch.com>
109109 Javi Merino <javi.merino@kernel.org> <javi.merino@arm.com>
110110 <javier@osg.samsung.com> <javier.martinez@collabora.co.uk>
111+Jayachandran C <c.jayachandran@gmail.com> <jayachandranc@netlogicmicro.com>
112+Jayachandran C <c.jayachandran@gmail.com> <jchandra@broadcom.com>
113+Jayachandran C <c.jayachandran@gmail.com> <jchandra@digeo.com>
114+Jayachandran C <c.jayachandran@gmail.com> <jnair@caviumnetworks.com>
111115 Jean Tourrilhes <jt@hpl.hp.com>
112116 <jean-philippe@linaro.org> <jean-philippe.brucker@arm.com>
113117 Jeff Garzik <jgarzik@pretzel.yyz.us>
Documentation/arm64/silicon-errata.rst+6−1
@@ -91,6 +91,11 @@ stable kernels. · 90 unmodified lines
9191 | ARM | MMU-500 | #841119,826419 | N/A |
9292 +----------------+-----------------+-----------------+-----------------------------+
9393 +----------------+-----------------+-----------------+-----------------------------+
94+| Broadcom | Brahma-B53 | N/A | ARM64_ERRATUM_845719 |
95++----------------+-----------------+-----------------+-----------------------------+
96+| Broadcom | Brahma-B53 | N/A | ARM64_ERRATUM_843419 |
97++----------------+-----------------+-----------------+-----------------------------+
98++----------------+-----------------+-----------------+-----------------------------+
9499 | Cavium | ThunderX ITS | #22375,24313 | CAVIUM_ERRATUM_22375 |
95100 +----------------+-----------------+-----------------+-----------------------------+
96101 | Cavium | ThunderX ITS | #23144 | CAVIUM_ERRATUM_23144 |
@@ -126,7 +131,7 @@ stable kernels. · 29 unmodified lines
126131 +----------------+-----------------+-----------------+-----------------------------+
127132 | Qualcomm Tech. | Kryo/Falkor v1 | E1003 | QCOM_FALKOR_ERRATUM_1003 |
128133 +----------------+-----------------+-----------------+-----------------------------+
129−| Qualcomm Tech. | Falkor v1 | E1009 | QCOM_FALKOR_ERRATUM_1009 |
134+| Qualcomm Tech. | Kryo/Falkor v1 | E1009 | QCOM_FALKOR_ERRATUM_1009 |
130135 +----------------+-----------------+-----------------+-----------------------------+
131136 | Qualcomm Tech. | QDF2400 ITS | E0065 | QCOM_QDF2400_ERRATUM_0065 |
132137 +----------------+-----------------+-----------------+-----------------------------+
Documentation/networking/device_drivers/intel/e100.rst+7−7
@@ -1,8 +1,8 @@
11 .. SPDX-License-Identifier: GPL-2.0+
22
3−==============================================================
4−Linux* Base Driver for the Intel(R) PRO/100 Family of Adapters
5−==============================================================
3+=============================================================
4+Linux Base Driver for the Intel(R) PRO/100 Family of Adapters
5+=============================================================
66
77 June 1, 2018
88
@@ -21,7 +21,7 @@ Contents · 12 unmodified lines
2121 In This Release
2222 ===============
2323
24−This file describes the Linux* Base Driver for the Intel(R) PRO/100 Family of
24+This file describes the Linux Base Driver for the Intel(R) PRO/100 Family of
2525 Adapters. This driver includes support for Itanium(R)2-based systems.
2626
2727 For questions related to hardware requirements, refer to the documentation
@@ -138,9 +138,9 @@ version 1.6 or later is required for this functionality. · 110 unmodified lines
138138 The latest release of ethtool can be found from
139139 https://www.kernel.org/pub/software/network/ethtool/
140140
141−Enabling Wake on LAN* (WoL)
142−---------------------------
143−WoL is provided through the ethtool* utility. For instructions on
141+Enabling Wake on LAN (WoL)
142+--------------------------
143+WoL is provided through the ethtool utility. For instructions on
144144 enabling WoL with ethtool, refer to the ethtool man page. WoL will be
145145 enabled on the system during the next shut down or reboot. For this
146146 driver version, in order to enable WoL, the e100 driver must be loaded
Documentation/networking/device_drivers/intel/e1000.rst+6−6
@@ -1,8 +1,8 @@
11 .. SPDX-License-Identifier: GPL-2.0+
22
3−===========================================================
4−Linux* Base Driver for Intel(R) Ethernet Network Connection
5−===========================================================
3+==========================================================
4+Linux Base Driver for Intel(R) Ethernet Network Connection
5+==========================================================
66
77 Intel Gigabit Linux driver.
88 Copyright(c) 1999 - 2013 Intel Corporation.
@@ -438,10 +438,10 @@ ethtool · 429 unmodified lines
438438 The latest release of ethtool can be found from
439439 https://www.kernel.org/pub/software/network/ethtool/
440440
441−Enabling Wake on LAN* (WoL)
442−---------------------------
441+Enabling Wake on LAN (WoL)
442+--------------------------
443443
444− WoL is configured through the ethtool* utility.
444+ WoL is configured through the ethtool utility.
445445
446446 WoL will be enabled on the system during the next shut down or reboot.
447447 For this driver version, in order to enable WoL, the e1000 driver must be
Documentation/networking/device_drivers/intel/e1000e.rst+7−7
@@ -1,8 +1,8 @@
11 .. SPDX-License-Identifier: GPL-2.0+
22
3−======================================================
4−Linux* Driver for Intel(R) Ethernet Network Connection
5−======================================================
3+=====================================================
4+Linux Driver for Intel(R) Ethernet Network Connection
5+=====================================================
66
77 Intel Gigabit Linux driver.
88 Copyright(c) 2008-2018 Intel Corporation.
@@ -338,7 +338,7 @@ and higher cannot be forced. Use the autonegotiation advertising setting to · 329 unmodified lines
338338 manually set devices for 1 Gbps and higher.
339339
340340 Speed, duplex, and autonegotiation advertising are configured through the
341−ethtool* utility.
341+ethtool utility.
342342
343343 Caution: Only experienced network administrators should force speed and duplex
344344 or change autonegotiation advertising manually. The settings at the switch must
@@ -351,9 +351,9 @@ will not attempt to auto-negotiate with its link partner since those adapters · 6 unmodified lines
351351 operate only in full duplex and only at their native speed.
352352
353353
354−Enabling Wake on LAN* (WoL)
355−---------------------------
356−WoL is configured through the ethtool* utility.
354+Enabling Wake on LAN (WoL)
355+--------------------------
356+WoL is configured through the ethtool utility.
357357
358358 WoL will be enabled on the system during the next shut down or reboot. For
359359 this driver version, in order to enable WoL, the e1000e driver must be loaded
Documentation/networking/device_drivers/intel/fm10k.rst+5−5
@@ -1,8 +1,8 @@
11 .. SPDX-License-Identifier: GPL-2.0+
22
3−==============================================================
4−Linux* Base Driver for Intel(R) Ethernet Multi-host Controller
5−==============================================================
3+=============================================================
4+Linux Base Driver for Intel(R) Ethernet Multi-host Controller
5+=============================================================
66
77 August 20, 2018
88 Copyright(c) 2015-2018 Intel Corporation.
@@ -120,8 +120,8 @@ rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6 m|v|t|s|d|f|n|r · 111 unmodified lines
120120 Known Issues/Troubleshooting
121121 ============================
122122
123−Enabling SR-IOV in a 64-bit Microsoft* Windows Server* 2012/R2 guest OS under Linux KVM
124−---------------------------------------------------------------------------------------
123+Enabling SR-IOV in a 64-bit Microsoft Windows Server 2012/R2 guest OS under Linux KVM
124+-------------------------------------------------------------------------------------
125125 KVM Hypervisor/VMM supports direct assignment of a PCIe device to a VM. This
126126 includes traditional PCIe devices, as well as SR-IOV-capable devices based on
127127 the Intel Ethernet Controller XL710.
Documentation/networking/device_drivers/intel/i40e.rst+4−4
@@ -1,8 +1,8 @@
11 .. SPDX-License-Identifier: GPL-2.0+
22
3−==================================================================
4−Linux* Base Driver for the Intel(R) Ethernet Controller 700 Series
5−==================================================================
3+=================================================================
4+Linux Base Driver for the Intel(R) Ethernet Controller 700 Series
5+=================================================================
66
77 Intel 40 Gigabit Linux driver.
88 Copyright(c) 1999-2018 Intel Corporation.
@@ -384,7 +384,7 @@ NOTE: You cannot set the speed for devices based on the Intel(R) Ethernet · 375 unmodified lines
384384 Network Adapter XXV710 based devices.
385385
386386 Speed, duplex, and autonegotiation advertising are configured through the
387−ethtool* utility.
387+ethtool utility.
388388
389389 Caution: Only experienced network administrators should force speed and duplex
390390 or change autonegotiation advertising manually. The settings at the switch must
Documentation/networking/device_drivers/intel/iavf.rst+4−4
@@ -1,8 +1,8 @@
11 .. SPDX-License-Identifier: GPL-2.0+
22
3−==================================================================
4−Linux* Base Driver for Intel(R) Ethernet Adaptive Virtual Function
5−==================================================================
3+=================================================================
4+Linux Base Driver for Intel(R) Ethernet Adaptive Virtual Function
5+=================================================================
66
77 Intel Ethernet Adaptive Virtual Function Linux driver.
88 Copyright(c) 2013-2018 Intel Corporation.
@@ -19,7 +19,7 @@ Contents · 10 unmodified lines
1919 Overview
2020 ========
2121
22−This file describes the iavf Linux* Base Driver. This driver was formerly
22+This file describes the iavf Linux Base Driver. This driver was formerly
2323 called i40evf.
2424
2525 The iavf driver supports the below mentioned virtual function devices and
Documentation/networking/device_drivers/intel/ice.rst+3−3
@@ -1,8 +1,8 @@
11 .. SPDX-License-Identifier: GPL-2.0+
22
3−===================================================================
4−Linux* Base Driver for the Intel(R) Ethernet Connection E800 Series
5−===================================================================
3+==================================================================
4+Linux Base Driver for the Intel(R) Ethernet Connection E800 Series
5+==================================================================
66
77 Intel ice Linux driver.
88 Copyright(c) 2018 Intel Corporation.
Documentation/networking/device_drivers/intel/igb.rst+6−6
@@ -1,8 +1,8 @@
11 .. SPDX-License-Identifier: GPL-2.0+
22
3−===========================================================
4−Linux* Base Driver for Intel(R) Ethernet Network Connection
5−===========================================================
3+==========================================================
4+Linux Base Driver for Intel(R) Ethernet Network Connection
5+==========================================================
66
77 Intel Gigabit Linux driver.
88 Copyright(c) 1999-2018 Intel Corporation.
@@ -129,9 +129,9 @@ version is required for this functionality. Download it at: · 120 unmodified lines
129129 https://www.kernel.org/pub/software/network/ethtool/
130130
131131
132−Enabling Wake on LAN* (WoL)
133−---------------------------
134−WoL is configured through the ethtool* utility.
132+Enabling Wake on LAN (WoL)
133+--------------------------
134+WoL is configured through the ethtool utility.
135135
136136 WoL will be enabled on the system during the next shut down or reboot. For
137137 this driver version, in order to enable WoL, the igb driver must be loaded
Documentation/networking/device_drivers/intel/igbvf.rst+3−3
@@ -1,8 +1,8 @@
11 .. SPDX-License-Identifier: GPL-2.0+
22
3−============================================================
4−Linux* Base Virtual Function Driver for Intel(R) 1G Ethernet
5−============================================================
3+===========================================================
4+Linux Base Virtual Function Driver for Intel(R) 1G Ethernet
5+===========================================================
66
77 Intel Gigabit Virtual Function Linux driver.
88 Copyright(c) 1999-2018 Intel Corporation.
Documentation/networking/device_drivers/intel/ixgbe.rst+5−5
@@ -1,8 +1,8 @@
11 .. SPDX-License-Identifier: GPL-2.0+
22
3−=============================================================================
4−Linux* Base Driver for the Intel(R) Ethernet 10 Gigabit PCI Express Adapters
5−=============================================================================
3+===========================================================================
4+Linux Base Driver for the Intel(R) Ethernet 10 Gigabit PCI Express Adapters
5+===========================================================================
66
77 Intel 10 Gigabit Linux driver.
88 Copyright(c) 1999-2018 Intel Corporation.
@@ -519,8 +519,8 @@ The offload is also supported for ixgbe's VFs, but the VF must be set as · 510 unmodified lines
519519 Known Issues/Troubleshooting
520520 ============================
521521
522−Enabling SR-IOV in a 64-bit Microsoft* Windows Server* 2012/R2 guest OS
523−-----------------------------------------------------------------------
522+Enabling SR-IOV in a 64-bit Microsoft Windows Server 2012/R2 guest OS
523+---------------------------------------------------------------------
524524 Linux KVM Hypervisor/VMM supports direct assignment of a PCIe device to a VM.
525525 This includes traditional PCIe devices, as well as SR-IOV-capable devices based
526526 on the Intel Ethernet Controller XL710.
Documentation/networking/device_drivers/intel/ixgbevf.rst+3−3
@@ -1,8 +1,8 @@
11 .. SPDX-License-Identifier: GPL-2.0+
22
3−=============================================================
4−Linux* Base Virtual Function Driver for Intel(R) 10G Ethernet
5−=============================================================
3+============================================================
4+Linux Base Virtual Function Driver for Intel(R) 10G Ethernet
5+============================================================
66
77 Intel 10 Gigabit Virtual Function Linux driver.
88 Copyright(c) 1999-2018 Intel Corporation.
Documentation/networking/device_drivers/pensando/ionic.rst+3−3
@@ -1,8 +1,8 @@
11 .. SPDX-License-Identifier: GPL-2.0+
22
3−==========================================================
4−Linux* Driver for the Pensando(R) Ethernet adapter family
5−==========================================================
3+========================================================
4+Linux Driver for the Pensando(R) Ethernet adapter family
5+========================================================
66
77 Pensando Linux Ethernet driver.
88 Copyright(c) 2019 Pensando Systems, Inc
Documentation/networking/ip-sysctl.txt+7−4
@@ -207,8 +207,8 @@ TCP variables: · 206 unmodified lines
207207
208208 somaxconn - INTEGER
209209 Limit of socket listen() backlog, known in userspace as SOMAXCONN.
210− Defaults to 128. See also tcp_max_syn_backlog for additional tuning
211− for TCP sockets.
210+ Defaults to 4096. (Was 128 before linux-5.4)
211+ See also tcp_max_syn_backlog for additional tuning for TCP sockets.
212212
213213 tcp_abort_on_overflow - BOOLEAN
214214 If listening service is too slow to accept new connections,
@@ -408,11 +408,14 @@ tcp_max_orphans - INTEGER · 193 unmodified lines
408408 up to ~64K of unswappable memory.
409409
410410 tcp_max_syn_backlog - INTEGER
411− Maximal number of remembered connection requests, which have not
412− received an acknowledgment from connecting client.
411+ Maximal number of remembered connection requests (SYN_RECV),
412+ which have not received an acknowledgment from connecting client.
413+ This is a per-listener limit.
413414 The minimal value is 128 for low memory machines, and it will
414415 increase in proportion to the memory of machine.
415416 If server suffers from overload, try increasing this number.
417+ Remember to also check /proc/sys/net/core/somaxconn
418+ A SYN_RECV request socket consumes about 304 bytes of memory.
416419
417420 tcp_max_tw_buckets - INTEGER
418421 Maximal number of timewait sockets held by system simultaneously.
Documentation/networking/tls-offload.rst+4−0
@@ -436,6 +436,10 @@ by the driver: · 435 unmodified lines
436436 encryption.
437437 * ``tx_tls_ooo`` - number of TX packets which were part of a TLS stream
438438 but did not arrive in the expected order.
439+ * ``tx_tls_skip_no_sync_data`` - number of TX packets which were part of
440+ a TLS stream and arrived out-of-order, but skipped the HW offload routine
441+ and went to the regular transmit flow as they were retransmissions of the
442+ connection handshake.
439443 * ``tx_tls_drop_no_sync_data`` - number of TX packets which were part of
440444 a TLS stream dropped, because they arrived out of order and associated
441445 record could not be found.
MAINTAINERS+15−5
@@ -3053,6 +3053,7 @@ M: Daniel Borkmann <daniel@iogearbox.net> · 3052 unmodified lines
30533053 R: Martin KaFai Lau <kafai@fb.com>
30543054 R: Song Liu <songliubraving@fb.com>
30553055 R: Yonghong Song <yhs@fb.com>
3056+R: Andrii Nakryiko <andriin@fb.com>
30563057 L: netdev@vger.kernel.org
30573058 L: bpf@vger.kernel.org
30583059 T: git git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git
@@ -3737,7 +3738,6 @@ F: drivers/crypto/cavium/cpt/ · 678 unmodified lines
37373738
37383739 CAVIUM THUNDERX2 ARM64 SOC
37393740 M: Robert Richter <rrichter@cavium.com>
3740−M: Jayachandran C <jnair@caviumnetworks.com>
37413741 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
37423742 S: Maintained
37433743 F: arch/arm64/boot/dts/cavium/thunder2-99xx*
@@ -10519,8 +10519,12 @@ F: mm/memblock.c · 6775 unmodified lines
1051910519 F: Documentation/core-api/boot-time-mm.rst
1052010520
1052110521 MEMORY MANAGEMENT
10522+M: Andrew Morton <akpm@linux-foundation.org>
1052210523 L: linux-mm@kvack.org
1052310524 W: http://www.linux-mm.org
10525+T: quilt https://ozlabs.org/~akpm/mmotm/
10526+T: quilt https://ozlabs.org/~akpm/mmots/
10527+T: git git://github.com/hnaz/linux-mm.git
1052410528 S: Maintained
1052510529 F: include/linux/mm.h
1052610530 F: include/linux/gfp.h
@@ -11408,7 +11412,6 @@ F: include/trace/events/tcp.h · 881 unmodified lines
1140811412 NETWORKING [TLS]
1140911413 M: Boris Pismenny <borisp@mellanox.com>
1141011414 M: Aviad Yehezkel <aviadye@mellanox.com>
11411−M: Dave Watson <davejwatson@fb.com>
1141211415 M: John Fastabend <john.fastabend@gmail.com>
1141311416 M: Daniel Borkmann <daniel@iogearbox.net>
1141411417 M: Jakub Kicinski <jakub.kicinski@netronome.com>
@@ -13913,7 +13916,7 @@ F: drivers/mtd/nand/raw/r852.h · 2498 unmodified lines
1391313916
1391413917 RISC-V ARCHITECTURE
1391513918 M: Paul Walmsley <paul.walmsley@sifive.com>
13916−M: Palmer Dabbelt <palmer@sifive.com>
13919+M: Palmer Dabbelt <palmer@dabbelt.com>
1391713920 M: Albert Ou <aou@eecs.berkeley.edu>
1391813921 L: linux-riscv@lists.infradead.org
1391913922 T: git git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git
@@ -14790,7 +14793,7 @@ F: drivers/media/usb/siano/ · 870 unmodified lines
1479014793 F: drivers/media/mmc/siano/
1479114794
1479214795 SIFIVE DRIVERS
14793−M: Palmer Dabbelt <palmer@sifive.com>
14796+M: Palmer Dabbelt <palmer@dabbelt.com>
1479414797 M: Paul Walmsley <paul.walmsley@sifive.com>
1479514798 L: linux-riscv@lists.infradead.org
1479614799 T: git git://github.com/sifive/riscv-linux.git
@@ -14800,7 +14803,7 @@ N: sifive · 3 unmodified lines
1480014803
1480114804 SIFIVE FU540 SYSTEM-ON-CHIP
1480214805 M: Paul Walmsley <paul.walmsley@sifive.com>
14803−M: Palmer Dabbelt <palmer@sifive.com>
14806+M: Palmer Dabbelt <palmer@dabbelt.com>
1480414807 L: linux-riscv@lists.infradead.org
1480514808 T: git git://git.kernel.org/pub/scm/linux/kernel/git/pjw/sifive.git
1480614809 S: Supported
@@ -17342,6 +17345,12 @@ F: include/linux/vbox_utils.h · 2535 unmodified lines
1734217345 F: include/uapi/linux/vbox*.h
1734317346 F: drivers/virt/vboxguest/
1734417347
17348+VIRTUAL BOX SHARED FOLDER VFS DRIVER:
17349+M: Hans de Goede <hdegoede@redhat.com>
17350+L: linux-fsdevel@vger.kernel.org
17351+S: Maintained
17352+F: drivers/staging/vboxsf/*
17353+
1734517354 VIRTUAL SERIO DEVICE DRIVER
1734617355 M: Stephen Chandler Paul <thatslyude@gmail.com>
1734717356 S: Maintained
@@ -18042,6 +18051,7 @@ F: Documentation/vm/zsmalloc.rst · 694 unmodified lines
1804218051 ZSWAP COMPRESSED SWAP CACHING
1804318052 M: Seth Jennings <sjenning@redhat.com>
1804418053 M: Dan Streetman <ddstreet@ieee.org>
18054+M: Vitaly Wool <vitaly.wool@konsulko.com>
1804518055 L: linux-mm@kvack.org
1804618056 S: Maintained
1804718057 F: mm/zswap.c
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 4
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc5
5+EXTRAVERSION = -rc7
66 NAME = Kleptomaniac Octopus
77
88 # *DOCUMENTATION*
arch/arc/boot/dts/hsdk.dts+23−0
@@ -65,6 +65,14 @@ · 64 unmodified lines
6565 clock-frequency = <33333333>;
6666 };
6767
68+ reg_5v0: regulator-5v0 {
69+ compatible = "regulator-fixed";
70+
71+ regulator-name = "5v0-supply";
72+ regulator-min-microvolt = <5000000>;
73+ regulator-max-microvolt = <5000000>;
74+ };
75+
6876 cpu_intc: cpu-interrupt-controller {
6977 compatible = "snps,archs-intc";
7078 interrupt-controller;
@@ -264,6 +272,21 @@ · 193 unmodified lines
264272 clocks = <&input_clk>;
265273 cs-gpios = <&creg_gpio 0 GPIO_ACTIVE_LOW>,
266274 <&creg_gpio 1 GPIO_ACTIVE_LOW>;
275+
276+ spi-flash@0 {
277+ compatible = "sst26wf016b", "jedec,spi-nor";
278+ reg = <0>;
279+ #address-cells = <1>;
280+ #size-cells = <1>;
281+ spi-max-frequency = <4000000>;
282+ };
283+
284+ adc@1 {
285+ compatible = "ti,adc108s102";
286+ reg = <1>;
287+ vref-supply = <&reg_5v0>;
288+ spi-max-frequency = <1000000>;
289+ };
267290 };
268291
269292 creg_gpio: gpio@14b0 {
arch/arc/configs/hsdk_defconfig+6−0
@@ -32,6 +32,8 @@ CONFIG_INET=y · 31 unmodified lines
3232 CONFIG_DEVTMPFS=y
3333 # CONFIG_STANDALONE is not set
3434 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
35+CONFIG_MTD=y
36+CONFIG_MTD_SPI_NOR=y
3537 CONFIG_SCSI=y
3638 CONFIG_BLK_DEV_SD=y
3739 CONFIG_NETDEVICES=y
@@ -55,6 +57,8 @@ CONFIG_GPIO_SYSFS=y · 17 unmodified lines
5557 CONFIG_GPIO_DWAPB=y
5658 CONFIG_GPIO_SNPS_CREG=y
5759 # CONFIG_HWMON is not set
60+CONFIG_REGULATOR=y
61+CONFIG_REGULATOR_FIXED_VOLTAGE=y
5862 CONFIG_DRM=y
5963 # CONFIG_DRM_FBDEV_EMULATION is not set
6064 CONFIG_DRM_UDL=y
@@ -72,6 +76,8 @@ CONFIG_MMC_SDHCI_PLTFM=y · 11 unmodified lines
7276 CONFIG_MMC_DW=y
7377 CONFIG_DMADEVICES=y
7478 CONFIG_DW_AXI_DMAC=y
79+CONFIG_IIO=y
80+CONFIG_TI_ADC108S102=y
7581 CONFIG_EXT3_FS=y
7682 CONFIG_VFAT_FS=y
7783 CONFIG_TMPFS=y
arch/arc/kernel/perf_event.c+2−2
@@ -614,8 +614,8 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 613 unmodified lines
614614 /* loop thru all available h/w condition indexes */
615615 for (i = 0; i < cc_bcr.c; i++) {
616616 write_aux_reg(ARC_REG_CC_INDEX, i);
617− cc_name.indiv.word0 = read_aux_reg(ARC_REG_CC_NAME0);
618− cc_name.indiv.word1 = read_aux_reg(ARC_REG_CC_NAME1);
617+ cc_name.indiv.word0 = le32_to_cpu(read_aux_reg(ARC_REG_CC_NAME0));
618+ cc_name.indiv.word1 = le32_to_cpu(read_aux_reg(ARC_REG_CC_NAME1));
619619
620620 arc_pmu_map_hw_event(i, cc_name.str);
621621 arc_pmu_add_raw_event_attr(i, cc_name.str);
arch/arm/boot/dts/imx6-logicpd-baseboard.dtsi+4−0
@@ -328,6 +328,10 @@ · 327 unmodified lines
328328 pinctrl-0 = <&pinctrl_pwm3>;
329329 };
330330
331+&snvs_pwrkey {
332+ status = "okay";
333+};
334+
331335 &ssi2 {
332336 status = "okay";
333337 };
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi+8−0
@@ -230,6 +230,8 @@ · 229 unmodified lines
230230 accelerometer@1c {
231231 compatible = "fsl,mma8451";
232232 reg = <0x1c>;
233+ pinctrl-names = "default";
234+ pinctrl-0 = <&pinctrl_mma8451_int>;
233235 interrupt-parent = <&gpio6>;
234236 interrupts = <31 IRQ_TYPE_LEVEL_LOW>;
235237 };
@@ -628,6 +630,12 @@ · 392 unmodified lines
628630 >;
629631 };
630632
633+ pinctrl_mma8451_int: mma8451intgrp {
634+ fsl,pins = <
635+ MX6QDL_PAD_EIM_BCLK__GPIO6_IO31 0xb0b1
636+ >;
637+ };
638+
631639 pinctrl_pwm3: pwm1grp {
632640 fsl,pins = <
633641 MX6QDL_PAD_SD4_DAT1__PWM3_OUT 0x1b0b1
arch/arm/boot/dts/stm32mp157c-ev1.dts+2−11
@@ -183,14 +183,12 @@ · 182 unmodified lines
183183
184184 ov5640: camera@3c {
185185 compatible = "ovti,ov5640";
186− pinctrl-names = "default";
187− pinctrl-0 = <&ov5640_pins>;
188186 reg = <0x3c>;
189187 clocks = <&clk_ext_camera>;
190188 clock-names = "xclk";
191189 DOVDD-supply = <&v2v8>;
192− powerdown-gpios = <&stmfx_pinctrl 18 GPIO_ACTIVE_HIGH>;
193− reset-gpios = <&stmfx_pinctrl 19 GPIO_ACTIVE_LOW>;
190+ powerdown-gpios = <&stmfx_pinctrl 18 (GPIO_ACTIVE_HIGH | GPIO_PUSH_PULL)>;
191+ reset-gpios = <&stmfx_pinctrl 19 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
194192 rotation = <180>;
195193 status = "okay";
196194
@@ -223,15 +221,8 @@ · 26 unmodified lines
223221
224222 joystick_pins: joystick {
225223 pins = "gpio0", "gpio1", "gpio2", "gpio3", "gpio4";
226− drive-push-pull;
227224 bias-pull-down;
228225 };
229−
230− ov5640_pins: camera {
231− pins = "agpio2", "agpio3"; /* stmfx pins 18 & 19 */
232− drive-push-pull;
233− output-low;
234− };
235226 };
236227 };
237228 };
arch/arm/boot/dts/stm32mp157c.dtsi+2−2
@@ -932,7 +932,7 @@ · 931 unmodified lines
932932 interrupt-names = "int0", "int1";
933933 clocks = <&rcc CK_HSE>, <&rcc FDCAN_K>;
934934 clock-names = "hclk", "cclk";
935− bosch,mram-cfg = <0x1400 0 0 32 0 0 2 2>;
935+ bosch,mram-cfg = <0x0 0 0 32 0 0 2 2>;
936936 status = "disabled";
937937 };
938938
@@ -945,7 +945,7 @@ · 6 unmodified lines
945945 interrupt-names = "int0", "int1";
946946 clocks = <&rcc CK_HSE>, <&rcc FDCAN_K>;
947947 clock-names = "hclk", "cclk";
948− bosch,mram-cfg = <0x0 0 0 32 0 0 2 2>;
948+ bosch,mram-cfg = <0x1400 0 0 32 0 0 2 2>;
949949 status = "disabled";
950950 };
951951
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts+1−0
@@ -192,6 +192,7 @@ · 191 unmodified lines
192192 vqmmc-supply = <&reg_dldo1>;
193193 non-removable;
194194 wakeup-source;
195+ keep-power-in-suspend;
195196 status = "okay";
196197
197198 brcmf: wifi@1 {
arch/arm/mach-sunxi/mc_smp.c+5−1
@@ -481,14 +481,18 @@ static void sunxi_mc_smp_cpu_die(unsigned int l_cpu) · 480 unmodified lines
481481 static int sunxi_cpu_powerdown(unsigned int cpu, unsigned int cluster)
482482 {
483483 u32 reg;
484+ int gating_bit = cpu;
484485
485486 pr_debug("%s: cluster %u cpu %u\n", __func__, cluster, cpu);
486487 if (cpu >= SUNXI_CPUS_PER_CLUSTER || cluster >= SUNXI_NR_CLUSTERS)
487488 return -EINVAL;
488489
490+ if (is_a83t && cpu == 0)
491+ gating_bit = 4;
492+
489493 /* gate processor power */
490494 reg = readl(prcm_base + PRCM_PWROFF_GATING_REG(cluster));
491− reg |= PRCM_PWROFF_GATING_REG_CORE(cpu);
495+ reg |= PRCM_PWROFF_GATING_REG_CORE(gating_bit);
492496 writel(reg, prcm_base + PRCM_PWROFF_GATING_REG(cluster));
493497 udelay(20);
494498
arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts+1−1
@@ -127,7 +127,7 @@ · 126 unmodified lines
127127 status = "okay";
128128
129129 i2c-mux@77 {
130− compatible = "nxp,pca9847";
130+ compatible = "nxp,pca9547";
131131 reg = <0x77>;
132132 #address-cells = <1>;
133133 #size-cells = <0>;
arch/arm64/boot/dts/freescale/imx8mm.dtsi+3−3
@@ -394,7 +394,7 @@ · 393 unmodified lines
394394 };
395395
396396 sdma2: dma-controller@302c0000 {
397− compatible = "fsl,imx8mm-sdma", "fsl,imx7d-sdma";
397+ compatible = "fsl,imx8mm-sdma", "fsl,imx8mq-sdma";
398398 reg = <0x302c0000 0x10000>;
399399 interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
400400 clocks = <&clk IMX8MM_CLK_SDMA2_ROOT>,
@@ -405,7 +405,7 @@ · 4 unmodified lines
405405 };
406406
407407 sdma3: dma-controller@302b0000 {
408− compatible = "fsl,imx8mm-sdma", "fsl,imx7d-sdma";
408+ compatible = "fsl,imx8mm-sdma", "fsl,imx8mq-sdma";
409409 reg = <0x302b0000 0x10000>;
410410 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
411411 clocks = <&clk IMX8MM_CLK_SDMA3_ROOT>,
@@ -737,7 +737,7 @@ · 325 unmodified lines
737737 };
738738
739739 sdma1: dma-controller@30bd0000 {
740− compatible = "fsl,imx8mm-sdma", "fsl,imx7d-sdma";
740+ compatible = "fsl,imx8mm-sdma", "fsl,imx8mq-sdma";
741741 reg = <0x30bd0000 0x10000>;
742742 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
743743 clocks = <&clk IMX8MM_CLK_SDMA1_ROOT>,
arch/arm64/boot/dts/freescale/imx8mn.dtsi+3−3
@@ -288,7 +288,7 @@ · 287 unmodified lines
288288 };
289289
290290 sdma3: dma-controller@302b0000 {
291− compatible = "fsl,imx8mn-sdma", "fsl,imx7d-sdma";
291+ compatible = "fsl,imx8mn-sdma", "fsl,imx8mq-sdma";
292292 reg = <0x302b0000 0x10000>;
293293 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
294294 clocks = <&clk IMX8MN_CLK_SDMA3_ROOT>,
@@ -299,7 +299,7 @@ · 4 unmodified lines
299299 };
300300
301301 sdma2: dma-controller@302c0000 {
302− compatible = "fsl,imx8mn-sdma", "fsl,imx7d-sdma";
302+ compatible = "fsl,imx8mn-sdma", "fsl,imx8mq-sdma";
303303 reg = <0x302c0000 0x10000>;
304304 interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
305305 clocks = <&clk IMX8MN_CLK_SDMA2_ROOT>,
@@ -612,7 +612,7 @@ · 306 unmodified lines
612612 };
613613
614614 sdma1: dma-controller@30bd0000 {
615− compatible = "fsl,imx8mn-sdma", "fsl,imx7d-sdma";
615+ compatible = "fsl,imx8mn-sdma", "fsl,imx8mq-sdma";
616616 reg = <0x30bd0000 0x10000>;
617617 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
618618 clocks = <&clk IMX8MN_CLK_SDMA1_ROOT>,
arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi+1−1
@@ -88,7 +88,7 @@ · 87 unmodified lines
8888 regulator-name = "0V9_ARM";
8989 regulator-min-microvolt = <900000>;
9090 regulator-max-microvolt = <1000000>;
91− gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
91+ gpios = <&gpio3 16 GPIO_ACTIVE_HIGH>;
9292 states = <1000000 0x1
9393 900000 0x0>;
9494 regulator-always-on;
arch/arm64/include/asm/cputype.h+2−0
@@ -79,6 +79,7 @@ · 78 unmodified lines
7979 #define CAVIUM_CPU_PART_THUNDERX_83XX 0x0A3
8080 #define CAVIUM_CPU_PART_THUNDERX2 0x0AF
8181
82+#define BRCM_CPU_PART_BRAHMA_B53 0x100
8283 #define BRCM_CPU_PART_VULCAN 0x516
8384
8485 #define QCOM_CPU_PART_FALKOR_V1 0x800
@@ -105,6 +106,7 @@ · 20 unmodified lines
105106 #define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX)
106107 #define MIDR_THUNDERX_83XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_83XX)
107108 #define MIDR_CAVIUM_THUNDERX2 MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX2)
109+#define MIDR_BRAHMA_B53 MIDR_CPU_MODEL(ARM_CPU_IMP_BRCM, BRCM_CPU_PART_BRAHMA_B53)
108110 #define MIDR_BRCM_VULCAN MIDR_CPU_MODEL(ARM_CPU_IMP_BRCM, BRCM_CPU_PART_VULCAN)
109111 #define MIDR_QCOM_FALKOR_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_FALKOR_V1)
110112 #define MIDR_QCOM_FALKOR MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_FALKOR)
arch/arm64/include/asm/pgtable-prot.h+8−7
@@ -32,11 +32,11 @@ · 31 unmodified lines
3232 #define PROT_DEFAULT (_PROT_DEFAULT | PTE_MAYBE_NG)
3333 #define PROT_SECT_DEFAULT (_PROT_SECT_DEFAULT | PMD_MAYBE_NG)
3434
35−#define PROT_DEVICE_nGnRnE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_DEVICE_nGnRnE))
36−#define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_DEVICE_nGnRE))
37−#define PROT_NORMAL_NC (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_NC))
38−#define PROT_NORMAL_WT (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_WT))
39−#define PROT_NORMAL (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL))
35+#define PROT_DEVICE_nGnRnE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_WRITE | PTE_ATTRINDX(MT_DEVICE_nGnRnE))
36+#define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_WRITE | PTE_ATTRINDX(MT_DEVICE_nGnRE))
37+#define PROT_NORMAL_NC (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_NC))
38+#define PROT_NORMAL_WT (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_WT))
39+#define PROT_NORMAL (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL))
4040
4141 #define PROT_SECT_DEVICE_nGnRE (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PMD_ATTRINDX(MT_DEVICE_nGnRE))
4242 #define PROT_SECT_NORMAL (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PMD_ATTRINDX(MT_NORMAL))
@@ -80,8 +80,9 @@ · 37 unmodified lines
8080 #define PAGE_S2_DEVICE __pgprot(_PROT_DEFAULT | PAGE_S2_MEMATTR(DEVICE_nGnRE) | PTE_S2_RDONLY | PTE_S2_XN)
8181
8282 #define PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_VALID) | PTE_PROT_NONE | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN)
83−#define PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_WRITE)
84−#define PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_WRITE)
83+/* shared+writable pages are clean by default, hence PTE_RDONLY|PTE_WRITE */
84+#define PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN | PTE_WRITE)
85+#define PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_WRITE)
8586 #define PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN)
8687 #define PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN)
8788 #define PAGE_EXECONLY __pgprot(_PAGE_DEFAULT | PTE_RDONLY | PTE_NG | PTE_PXN)
arch/arm64/include/asm/pgtable.h+0−17
@@ -283,23 +283,6 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, · 282 unmodified lines
283283 set_pte(ptep, pte);
284284 }
285285
286−#define __HAVE_ARCH_PTE_SAME
287−static inline int pte_same(pte_t pte_a, pte_t pte_b)
288−{
289− pteval_t lhs, rhs;
290−
291− lhs = pte_val(pte_a);
292− rhs = pte_val(pte_b);
293−
294− if (pte_present(pte_a))
295− lhs &= ~PTE_RDONLY;
296−
297− if (pte_present(pte_b))
298− rhs &= ~PTE_RDONLY;
299−
300− return (lhs == rhs);
301−}
302−
303286 /*
304287 * Huge pte definitions.
305288 */
arch/arm64/include/asm/vdso/vsyscall.h+0−7
@@ -30,13 +30,6 @@ int __arm64_get_clock_mode(struct timekeeper *tk) · 29 unmodified lines
3030 }
3131 #define __arch_get_clock_mode __arm64_get_clock_mode
3232
33−static __always_inline
34−int __arm64_use_vsyscall(struct vdso_data *vdata)
35−{
36− return !vdata[CS_HRES_COARSE].clock_mode;
37−}
38−#define __arch_use_vsyscall __arm64_use_vsyscall
39−
4033 static __always_inline
4134 void __arm64_update_vsyscall(struct vdso_data *vdata, struct timekeeper *tk)
4235 {
arch/arm64/kernel/cpu_errata.c+48−11
@@ -489,6 +489,7 @@ static const struct midr_range arm64_ssb_cpus[] = { · 488 unmodified lines
489489 MIDR_ALL_VERSIONS(MIDR_CORTEX_A35),
490490 MIDR_ALL_VERSIONS(MIDR_CORTEX_A53),
491491 MIDR_ALL_VERSIONS(MIDR_CORTEX_A55),
492+ MIDR_ALL_VERSIONS(MIDR_BRAHMA_B53),
492493 {},
493494 };
494495
@@ -573,6 +574,7 @@ static const struct midr_range spectre_v2_safe_list[] = { · 78 unmodified lines
573574 MIDR_ALL_VERSIONS(MIDR_CORTEX_A35),
574575 MIDR_ALL_VERSIONS(MIDR_CORTEX_A53),
575576 MIDR_ALL_VERSIONS(MIDR_CORTEX_A55),
577+ MIDR_ALL_VERSIONS(MIDR_BRAHMA_B53),
576578 { /* sentinel */ }
577579 };
578580
@@ -659,17 +661,23 @@ static const struct midr_range arm64_harden_el2_vectors[] = { · 80 unmodified lines
659661 #endif
660662
661663 #ifdef CONFIG_ARM64_WORKAROUND_REPEAT_TLBI
662−
663−static const struct midr_range arm64_repeat_tlbi_cpus[] = {
664+static const struct arm64_cpu_capabilities arm64_repeat_tlbi_list[] = {
664665 #ifdef CONFIG_QCOM_FALKOR_ERRATUM_1009
665− MIDR_RANGE(MIDR_QCOM_FALKOR_V1, 0, 0, 0, 0),
666+ {
667+ ERRATA_MIDR_REV(MIDR_QCOM_FALKOR_V1, 0, 0)
668+ },
669+ {
670+ .midr_range.model = MIDR_QCOM_KRYO,
671+ .matches = is_kryo_midr,
672+ },
666673 #endif
667674 #ifdef CONFIG_ARM64_ERRATUM_1286807
668− MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 3, 0),
675+ {
676+ ERRATA_MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 3, 0),
677+ },
669678 #endif
670679 {},
671680 };
672−
673681 #endif
674682
675683 #ifdef CONFIG_CAVIUM_ERRATUM_27456
@@ -737,6 +745,33 @@ static const struct midr_range erratum_1418040_list[] = { · 61 unmodified lines
737745 };
738746 #endif
739747
748+#ifdef CONFIG_ARM64_ERRATUM_845719
749+static const struct midr_range erratum_845719_list[] = {
750+ /* Cortex-A53 r0p[01234] */
751+ MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 4),
752+ /* Brahma-B53 r0p[0] */
753+ MIDR_REV(MIDR_BRAHMA_B53, 0, 0),
754+ {},
755+};
756+#endif
757+
758+#ifdef CONFIG_ARM64_ERRATUM_843419
759+static const struct arm64_cpu_capabilities erratum_843419_list[] = {
760+ {
761+ /* Cortex-A53 r0p[01234] */
762+ .matches = is_affected_midr_range,
763+ ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 4),
764+ MIDR_FIXED(0x4, BIT(8)),
765+ },
766+ {
767+ /* Brahma-B53 r0p[0] */
768+ .matches = is_affected_midr_range,
769+ ERRATA_MIDR_REV(MIDR_BRAHMA_B53, 0, 0),
770+ },
771+ {},
772+};
773+#endif
774+
740775 const struct arm64_cpu_capabilities arm64_errata[] = {
741776 #ifdef CONFIG_ARM64_WORKAROUND_CLEAN_CACHE
742777 {
@@ -768,19 +803,18 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 25 unmodified lines
768803 #endif
769804 #ifdef CONFIG_ARM64_ERRATUM_843419
770805 {
771− /* Cortex-A53 r0p[01234] */
772806 .desc = "ARM erratum 843419",
773807 .capability = ARM64_WORKAROUND_843419,
774− ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 4),
775− MIDR_FIXED(0x4, BIT(8)),
808+ .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
809+ .matches = cpucap_multi_entry_cap_matches,
810+ .match_list = erratum_843419_list,
776811 },
777812 #endif
778813 #ifdef CONFIG_ARM64_ERRATUM_845719
779814 {
780− /* Cortex-A53 r0p[01234] */
781815 .desc = "ARM erratum 845719",
782816 .capability = ARM64_WORKAROUND_845719,
783− ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 4),
817+ ERRATA_MIDR_RANGE_LIST(erratum_845719_list),
784818 },
785819 #endif
786820 #ifdef CONFIG_CAVIUM_ERRATUM_23154
@@ -816,6 +850,7 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 29 unmodified lines
816850 {
817851 .desc = "Qualcomm Technologies Falkor/Kryo erratum 1003",
818852 .capability = ARM64_WORKAROUND_QCOM_FALKOR_E1003,
853+ .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
819854 .matches = cpucap_multi_entry_cap_matches,
820855 .match_list = qcom_erratum_1003_list,
821856 },
@@ -824,7 +859,9 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 2 unmodified lines
824859 {
825860 .desc = "Qualcomm erratum 1009, ARM erratum 1286807",
826861 .capability = ARM64_WORKAROUND_REPEAT_TLBI,
827− ERRATA_MIDR_RANGE_LIST(arm64_repeat_tlbi_cpus),
862+ .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
863+ .matches = cpucap_multi_entry_cap_matches,
864+ .match_list = arm64_repeat_tlbi_list,
828865 },
829866 #endif
830867 #ifdef CONFIG_ARM64_ERRATUM_858921
arch/mips/include/asm/vdso/vsyscall.h+0−7
@@ -28,13 +28,6 @@ int __mips_get_clock_mode(struct timekeeper *tk) · 27 unmodified lines
2828 }
2929 #define __arch_get_clock_mode __mips_get_clock_mode
3030
31−static __always_inline
32−int __mips_use_vsyscall(struct vdso_data *vdata)
33−{
34− return (vdata[CS_HRES_COARSE].clock_mode != VDSO_CLOCK_NONE);
35−}
36−#define __arch_use_vsyscall __mips_use_vsyscall
37−
3831 /* The asm-generic header needs to be included after the definitions above */
3932 #include <asm-generic/vdso/vsyscall.h>
4033
arch/parisc/kernel/entry.S+1−1
@@ -2125,7 +2125,7 @@ ftrace_regs_caller: · 2124 unmodified lines
21252125 copy %rp, %r26
21262126 LDREG -FTRACE_FRAME_SIZE-PT_SZ_ALGN(%sp), %r25
21272127 ldo -8(%r25), %r25
2128− copy %r3, %arg2
2128+ ldo -FTRACE_FRAME_SIZE(%r1), %arg2
21292129 b,l ftrace_function_trampoline, %rp
21302130 copy %r1, %arg3 /* struct pt_regs */
21312131
arch/powerpc/include/asm/book3s/32/kup.h+1−0
@@ -91,6 +91,7 @@ · 90 unmodified lines
9191
9292 static inline void kuap_update_sr(u32 sr, u32 addr, u32 end)
9393 {
94+ addr &= 0xf0000000; /* align addr to start of segment */
9495 barrier(); /* make sure thread.kuap is updated before playing with SRs */
9596 while (addr < end) {
9697 mtsrin(sr, addr);
arch/powerpc/include/asm/elf.h+3−0
@@ -175,4 +175,7 @@ do { \ · 174 unmodified lines
175175 ARCH_DLINFO_CACHE_GEOMETRY; \
176176 } while (0)
177177
178+/* Relocate the kernel image to @final_address */
179+void relocate(unsigned long final_address);
180+
178181 #endif /* _ASM_POWERPC_ELF_H */
arch/powerpc/kernel/prom_init.c+13−0
@@ -3249,7 +3249,20 @@ static void setup_secure_guest(unsigned long kbase, unsigned long fdt) · 3248 unmodified lines
32493249 /* Switch to secure mode. */
32503250 prom_printf("Switching to secure mode.\n");
32513251
3252+ /*
3253+ * The ultravisor will do an integrity check of the kernel image but we
3254+ * relocated it so the check will fail. Restore the original image by
3255+ * relocating it back to the kernel virtual base address.
3256+ */
3257+ if (IS_ENABLED(CONFIG_RELOCATABLE))
3258+ relocate(KERNELBASE);
3259+
32523260 ret = enter_secure_mode(kbase, fdt);
3261+
3262+ /* Relocate the kernel again. */
3263+ if (IS_ENABLED(CONFIG_RELOCATABLE))
3264+ relocate(kbase);
3265+
32533266 if (ret != U_SUCCESS) {
32543267 prom_printf("Returned %d from switching to secure mode.\n", ret);
32553268 prom_rtas_os_term("Switch to secure mode failed.\n");
arch/powerpc/kernel/prom_init_check.sh+2−1
@@ -26,7 +26,8 @@ _end enter_prom $MEM_FUNCS reloc_offset __secondary_hold · 25 unmodified lines
2626 __secondary_hold_acknowledge __secondary_hold_spinloop __start
2727 logo_linux_clut224 btext_prepare_BAT
2828 reloc_got2 kernstart_addr memstart_addr linux_banner _stext
29−__prom_init_toc_start __prom_init_toc_end btext_setup_display TOC."
29+__prom_init_toc_start __prom_init_toc_end btext_setup_display TOC.
30+relocate"
3031
3132 NM="$1"
3233 OBJ="$2"
arch/powerpc/net/bpf_jit_comp64.c+13−0
@@ -1141,6 +1141,19 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp) · 1140 unmodified lines
11411141 goto out_addrs;
11421142 }
11431143
1144+ /*
1145+ * If we have seen a tail call, we need a second pass.
1146+ * This is because bpf_jit_emit_common_epilogue() is called
1147+ * from bpf_jit_emit_tail_call() with a not yet stable ctx->seen.
1148+ */
1149+ if (cgctx.seen & SEEN_TAILCALL) {
1150+ cgctx.idx = 0;
1151+ if (bpf_jit_build_body(fp, 0, &cgctx, addrs, false)) {
1152+ fp = org_fp;
1153+ goto out_addrs;
1154+ }
1155+ }
1156+
11441157 /*
11451158 * Pretend to build prologue, given the features we've seen. This will
11461159 * update ctgtx.idx as it pretends to output instructions, then we can
arch/powerpc/platforms/powernv/eeh-powernv.c+1−1
@@ -42,7 +42,7 @@ void pnv_pcibios_bus_add_device(struct pci_dev *pdev) · 41 unmodified lines
4242 {
4343 struct pci_dn *pdn = pci_get_pdn(pdev);
4444
45− if (eeh_has_flag(EEH_FORCE_DISABLED))
45+ if (!pdn || eeh_has_flag(EEH_FORCE_DISABLED))
4646 return;
4747
4848 dev_dbg(&pdev->dev, "EEH: Setting up device\n");
arch/powerpc/platforms/powernv/smp.c+37−16
@@ -146,20 +146,25 @@ static int pnv_smp_cpu_disable(void) · 145 unmodified lines
146146 return 0;
147147 }
148148
149+static void pnv_flush_interrupts(void)
150+{
151+ if (cpu_has_feature(CPU_FTR_ARCH_300)) {
152+ if (xive_enabled())
153+ xive_flush_interrupt();
154+ else
155+ icp_opal_flush_interrupt();
156+ } else {
157+ icp_native_flush_interrupt();
158+ }
159+}
160+
149161 static void pnv_smp_cpu_kill_self(void)
150162 {
163+ unsigned long srr1, unexpected_mask, wmask;
151164 unsigned int cpu;
152− unsigned long srr1, wmask;
153165 u64 lpcr_val;
154166
155167 /* Standard hot unplug procedure */
156− /*
157− * This hard disables local interurpts, ensuring we have no lazy
158− * irqs pending.
159− */
160− WARN_ON(irqs_disabled());
161− hard_irq_disable();
162− WARN_ON(lazy_irq_pending());
163168
164169 idle_task_exit();
165170 current->active_mm = NULL; /* for sanity */
@@ -172,6 +177,27 @@ static void pnv_smp_cpu_kill_self(void) · 6 unmodified lines
172177 if (cpu_has_feature(CPU_FTR_ARCH_207S))
173178 wmask = SRR1_WAKEMASK_P8;
174179
180+ /*
181+ * This turns the irq soft-disabled state we're called with, into a
182+ * hard-disabled state with pending irq_happened interrupts cleared.
183+ *
184+ * PACA_IRQ_DEC - Decrementer should be ignored.
185+ * PACA_IRQ_HMI - Can be ignored, processing is done in real mode.
186+ * PACA_IRQ_DBELL, EE, PMI - Unexpected.
187+ */
188+ hard_irq_disable();
189+ if (generic_check_cpu_restart(cpu))
190+ goto out;
191+
192+ unexpected_mask = ~(PACA_IRQ_DEC | PACA_IRQ_HMI | PACA_IRQ_HARD_DIS);
193+ if (local_paca->irq_happened & unexpected_mask) {
194+ if (local_paca->irq_happened & PACA_IRQ_EE)
195+ pnv_flush_interrupts();
196+ DBG("CPU%d Unexpected exit while offline irq_happened=%lx!\n",
197+ cpu, local_paca->irq_happened);
198+ }
199+ local_paca->irq_happened = PACA_IRQ_HARD_DIS;
200+
175201 /*
176202 * We don't want to take decrementer interrupts while we are
177203 * offline, so clear LPCR:PECE1. We keep PECE2 (and
@@ -197,6 +223,7 @@ static void pnv_smp_cpu_kill_self(void) · 19 unmodified lines
197223
198224 srr1 = pnv_cpu_offline(cpu);
199225
226+ WARN_ON_ONCE(!irqs_disabled());
200227 WARN_ON(lazy_irq_pending());
201228
202229 /*
@@ -212,13 +239,7 @@ static void pnv_smp_cpu_kill_self(void) · 9 unmodified lines
212239 */
213240 if (((srr1 & wmask) == SRR1_WAKEEE) ||
214241 ((srr1 & wmask) == SRR1_WAKEHVI)) {
215− if (cpu_has_feature(CPU_FTR_ARCH_300)) {
216− if (xive_enabled())
217− xive_flush_interrupt();
218− else
219− icp_opal_flush_interrupt();
220− } else
221− icp_native_flush_interrupt();
242+ pnv_flush_interrupts();
222243 } else if ((srr1 & wmask) == SRR1_WAKEHDBELL) {
223244 unsigned long msg = PPC_DBELL_TYPE(PPC_DBELL_SERVER);
224245 asm volatile(PPC_MSGCLR(%0) : : "r" (msg));
@@ -266,7 +287,7 @@ static void pnv_smp_cpu_kill_self(void) · 41 unmodified lines
266287 */
267288 lpcr_val = mfspr(SPRN_LPCR) | (u64)LPCR_PECE1;
268289 pnv_program_cpu_hotplug_lpcr(cpu, lpcr_val);
269−
290+out:
270291 DBG("CPU%d coming online...\n", cpu);
271292 }
272293
arch/riscv/include/asm/io.h+7−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313
1414 #include <linux/types.h>
1515 #include <asm/mmiowb.h>
16+#include <asm/pgtable.h>
1617
1718 extern void __iomem *ioremap(phys_addr_t offset, unsigned long size);
1819
@@ -161,6 +162,12 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) · 142 unmodified lines
161162 #define writeq(v,c) ({ __io_bw(); writeq_cpu((v),(c)); __io_aw(); })
162163 #endif
163164
165+/*
166+ * I/O port access constants.
167+ */
168+#define IO_SPACE_LIMIT (PCI_IO_SIZE - 1)
169+#define PCI_IOBASE ((void __iomem *)PCI_IO_START)
170+
164171 /*
165172 * Emulation routines for the port-mapped IO space used by some PCI drivers.
166173 * These are defined as being "fully synchronous", but also "not guaranteed to
arch/riscv/include/asm/irq.h+3−0
@@ -7,6 +7,9 @@ · 6 unmodified lines
77 #ifndef _ASM_RISCV_IRQ_H
88 #define _ASM_RISCV_IRQ_H
99
10+#include <linux/interrupt.h>
11+#include <linux/linkage.h>
12+
1013 #define NR_IRQS 0
1114
1215 void riscv_timer_interrupt(void);
arch/riscv/include/asm/pgtable.h+6−1
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 #define _ASM_RISCV_PGTABLE_H
88
99 #include <linux/mmzone.h>
10+#include <linux/sizes.h>
1011
1112 #include <asm/pgtable-bits.h>
1213
@@ -86,6 +87,7 @@ extern pgd_t swapper_pg_dir[]; · 73 unmodified lines
8687 #define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1)
8788 #define VMALLOC_END (PAGE_OFFSET - 1)
8889 #define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
90+#define PCI_IO_SIZE SZ_16M
8991
9092 /*
9193 * Roughly size the vmemmap space to be large enough to fit enough
@@ -100,7 +102,10 @@ extern pgd_t swapper_pg_dir[]; · 8 unmodified lines
100102
101103 #define vmemmap ((struct page *)VMEMMAP_START)
102104
103−#define FIXADDR_TOP (VMEMMAP_START)
105+#define PCI_IO_END VMEMMAP_START
106+#define PCI_IO_START (PCI_IO_END - PCI_IO_SIZE)
107+#define FIXADDR_TOP PCI_IO_START
108+
104109 #ifdef CONFIG_64BIT
105110 #define FIXADDR_SIZE PMD_SIZE
106111 #else
arch/riscv/include/asm/switch_to.h+1−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #ifndef _ASM_RISCV_SWITCH_TO_H
77 #define _ASM_RISCV_SWITCH_TO_H
88
9+#include <linux/sched/task_stack.h>
910 #include <asm/processor.h>
1011 #include <asm/ptrace.h>
1112 #include <asm/csr.h>
arch/riscv/kernel/cpufeature.c+1−0
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #include <asm/processor.h>
1111 #include <asm/hwcap.h>
1212 #include <asm/smp.h>
13+#include <asm/switch_to.h>
1314
1415 unsigned long elf_hwcap __read_mostly;
1516 #ifdef CONFIG_FPU
arch/riscv/kernel/head.h+21−0
@@ -0,0 +1,21 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
3+ * Copyright (C) 2019 SiFive, Inc.
4+ */
5+#ifndef __ASM_HEAD_H
6+#define __ASM_HEAD_H
7+
8+#include <linux/linkage.h>
9+#include <linux/init.h>
10+
11+extern atomic_t hart_lottery;
12+
13+asmlinkage void do_page_fault(struct pt_regs *regs);
14+asmlinkage void __init setup_vm(uintptr_t dtb_pa);
15+
16+extern void *__cpu_up_stack_pointer[];
17+extern void *__cpu_up_task_pointer[];
18+
19+void __init parse_dtb(void);
20+
21+#endif /* __ASM_HEAD_H */
arch/riscv/kernel/irq.c+1−1
@@ -24,7 +24,7 @@ int arch_show_interrupts(struct seq_file *p, int prec) · 23 unmodified lines
2424 return 0;
2525 }
2626
27−asmlinkage void __irq_entry do_IRQ(struct pt_regs *regs)
27+asmlinkage __visible void __irq_entry do_IRQ(struct pt_regs *regs)
2828 {
2929 struct pt_regs *old_regs = set_irq_regs(regs);
3030
arch/riscv/kernel/module-sections.c+1−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #include <linux/elf.h>
99 #include <linux/kernel.h>
1010 #include <linux/module.h>
11+#include <linux/moduleloader.h>
1112
1213 unsigned long module_emit_got_entry(struct module *mod, unsigned long val)
1314 {
arch/riscv/kernel/process.c+2−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 * Copyright (C) 2017 SiFive
88 */
99
10+#include <linux/cpu.h>
1011 #include <linux/kernel.h>
1112 #include <linux/sched.h>
1213 #include <linux/sched/task_stack.h>
@@ -19,6 +20,7 @@ · 6 unmodified lines
1920 #include <asm/csr.h>
2021 #include <asm/string.h>
2122 #include <asm/switch_to.h>
23+#include <asm/thread_info.h>
2224
2325 extern asmlinkage void ret_from_fork(void);
2426 extern asmlinkage void ret_from_kernel_thread(void);
arch/riscv/kernel/ptrace.c+2−2
@@ -148,7 +148,7 @@ long arch_ptrace(struct task_struct *child, long request, · 147 unmodified lines
148148 * Allows PTRACE_SYSCALL to work. These are called from entry.S in
149149 * {handle,ret_from}_syscall.
150150 */
151−void do_syscall_trace_enter(struct pt_regs *regs)
151+__visible void do_syscall_trace_enter(struct pt_regs *regs)
152152 {
153153 if (test_thread_flag(TIF_SYSCALL_TRACE))
154154 if (tracehook_report_syscall_entry(regs))
@@ -162,7 +162,7 @@ void do_syscall_trace_enter(struct pt_regs *regs) · 7 unmodified lines
162162 audit_syscall_entry(regs->a7, regs->a0, regs->a1, regs->a2, regs->a3);
163163 }
164164
165−void do_syscall_trace_exit(struct pt_regs *regs)
165+__visible void do_syscall_trace_exit(struct pt_regs *regs)
166166 {
167167 audit_syscall_exit(regs);
168168
arch/riscv/kernel/reset.c+1−0
@@ -4,6 +4,7 @@ · 3 unmodified lines
44 */
55
66 #include <linux/reboot.h>
7+#include <linux/pm.h>
78 #include <asm/sbi.h>
89
910 static void default_power_off(void)
arch/riscv/kernel/setup.c+2−0
@@ -24,6 +24,8 @@ · 23 unmodified lines
2424 #include <asm/tlbflush.h>
2525 #include <asm/thread_info.h>
2626
27+#include "head.h"
28+
2729 #ifdef CONFIG_DUMMY_CONSOLE
2830 struct screen_info screen_info = {
2931 .orig_video_lines = 30,
arch/riscv/kernel/signal.c+4−4
@@ -26,7 +26,7 @@ struct rt_sigframe { · 25 unmodified lines
2626
2727 #ifdef CONFIG_FPU
2828 static long restore_fp_state(struct pt_regs *regs,
29− union __riscv_fp_state *sc_fpregs)
29+ union __riscv_fp_state __user *sc_fpregs)
3030 {
3131 long err;
3232 struct __riscv_d_ext_state __user *state = &sc_fpregs->d;
@@ -53,7 +53,7 @@ static long restore_fp_state(struct pt_regs *regs, · 20 unmodified lines
5353 }
5454
5555 static long save_fp_state(struct pt_regs *regs,
56− union __riscv_fp_state *sc_fpregs)
56+ union __riscv_fp_state __user *sc_fpregs)
5757 {
5858 long err;
5959 struct __riscv_d_ext_state __user *state = &sc_fpregs->d;
@@ -292,8 +292,8 @@ static void do_signal(struct pt_regs *regs) · 232 unmodified lines
292292 * notification of userspace execution resumption
293293 * - triggered by the _TIF_WORK_MASK flags
294294 */
295−asmlinkage void do_notify_resume(struct pt_regs *regs,
296− unsigned long thread_info_flags)
295+asmlinkage __visible void do_notify_resume(struct pt_regs *regs,
296+ unsigned long thread_info_flags)
297297 {
298298 /* Handle pending signal delivery */
299299 if (thread_info_flags & _TIF_SIGPENDING)
arch/riscv/kernel/smp.c+2−0
@@ -8,7 +8,9 @@ · 7 unmodified lines
88 * Copyright (C) 2017 SiFive
99 */
1010
11+#include <linux/cpu.h>
1112 #include <linux/interrupt.h>
13+#include <linux/profile.h>
1214 #include <linux/smp.h>
1315 #include <linux/sched.h>
1416 #include <linux/seq_file.h>
arch/riscv/kernel/smpboot.c+4−1
@@ -29,6 +29,9 @@ · 28 unmodified lines
2929 #include <asm/tlbflush.h>
3030 #include <asm/sections.h>
3131 #include <asm/sbi.h>
32+#include <asm/smp.h>
33+
34+#include "head.h"
3235
3336 void *__cpu_up_stack_pointer[NR_CPUS];
3437 void *__cpu_up_task_pointer[NR_CPUS];
@@ -130,7 +133,7 @@ void __init smp_cpus_done(unsigned int max_cpus) · 95 unmodified lines
130133 /*
131134 * C entry point for a secondary processor.
132135 */
133−asmlinkage void __init smp_callin(void)
136+asmlinkage __visible void __init smp_callin(void)
134137 {
135138 struct mm_struct *mm = &init_mm;
136139
arch/riscv/kernel/syscall_table.c+1−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #include <linux/syscalls.h>
99 #include <asm-generic/syscalls.h>
1010 #include <asm/vdso.h>
11+#include <asm/syscall.h>
1112
1213 #undef __SYSCALL
1314 #define __SYSCALL(nr, call) [nr] = (call),
arch/riscv/kernel/time.c+1−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 #include <linux/clocksource.h>
88 #include <linux/delay.h>
99 #include <asm/sbi.h>
10+#include <asm/processor.h>
1011
1112 unsigned long riscv_timebase;
1213 EXPORT_SYMBOL_GPL(riscv_timebase);
arch/riscv/kernel/traps.c+3−2
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 * Copyright (C) 2012 Regents of the University of California
44 */
55
6+#include <linux/cpu.h>
67 #include <linux/kernel.h>
78 #include <linux/init.h>
89 #include <linux/sched.h>
@@ -83,7 +84,7 @@ static void do_trap_error(struct pt_regs *regs, int signo, int code, · 74 unmodified lines
8384 }
8485
8586 #define DO_ERROR_INFO(name, signo, code, str) \
86−asmlinkage void name(struct pt_regs *regs) \
87+asmlinkage __visible void name(struct pt_regs *regs) \
8788 { \
8889 do_trap_error(regs, signo, code, regs->sepc, "Oops - " str); \
8990 }
@@ -120,7 +121,7 @@ static inline unsigned long get_break_insn_length(unsigned long pc) · 30 unmodified lines
120121 return (((insn & __INSN_LENGTH_MASK) == __INSN_LENGTH_32) ? 4UL : 2UL);
121122 }
122123
123−asmlinkage void do_trap_break(struct pt_regs *regs)
124+asmlinkage __visible void do_trap_break(struct pt_regs *regs)
124125 {
125126 if (user_mode(regs))
126127 force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->sepc);
arch/riscv/kernel/vdso.c+2−1
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 * Copyright (C) 2015 Regents of the University of California
77 */
88
9+#include <linux/elf.h>
910 #include <linux/mm.h>
1011 #include <linux/slab.h>
1112 #include <linux/binfmts.h>
@@ -25,7 +26,7 @@ static union { · 13 unmodified lines
2526 struct vdso_data data;
2627 u8 page[PAGE_SIZE];
2728 } vdso_data_store __page_aligned_data;
28−struct vdso_data *vdso_data = &vdso_data_store.data;
29+static struct vdso_data *vdso_data = &vdso_data_store.data;
2930
3031 static int __init vdso_init(void)
3132 {
arch/riscv/mm/context.c+1−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 #include <linux/mm.h>
88 #include <asm/tlbflush.h>
99 #include <asm/cacheflush.h>
10+#include <asm/mmu_context.h>
1011
1112 /*
1213 * When necessary, performs a deferred icache flush for the given MM context,
arch/riscv/mm/fault.c+2−0
@@ -18,6 +18,8 @@ · 17 unmodified lines
1818 #include <asm/ptrace.h>
1919 #include <asm/tlbflush.h>
2020
21+#include "../kernel/head.h"
22+
2123 /*
2224 * This routine handles page faults. It determines the address and the
2325 * problem, and then passes it off to one of the appropriate routines.
arch/riscv/mm/init.c+3−2
@@ -19,6 +19,8 @@ · 18 unmodified lines
1919 #include <asm/pgtable.h>
2020 #include <asm/io.h>
2121
22+#include "../kernel/head.h"
23+
2224 unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]
2325 __page_aligned_bss;
2426 EXPORT_SYMBOL(empty_zero_page);
@@ -337,8 +339,7 @@ static uintptr_t __init best_map_size(phys_addr_t base, phys_addr_t size) · 312 unmodified lines
337339 */
338340
339341 #ifndef __riscv_cmodel_medany
340−#error "setup_vm() is called from head.S before relocate so it should "
341− "not use absolute addressing."
342+#error "setup_vm() is called from head.S before relocate so it should not use absolute addressing."
342343 #endif
343344
344345 asmlinkage void __init setup_vm(uintptr_t dtb_pa)
arch/riscv/mm/sifive_l2_cache.c+1−1
@@ -142,7 +142,7 @@ static irqreturn_t l2_int_handler(int irq, void *device) · 141 unmodified lines
142142 return IRQ_HANDLED;
143143 }
144144
145−int __init sifive_l2_init(void)
145+static int __init sifive_l2_init(void)
146146 {
147147 struct device_node *np;
148148 struct resource res;
arch/s390/include/asm/unwind.h+1−0
@@ -35,6 +35,7 @@ struct unwind_state { · 34 unmodified lines
3535 struct task_struct *task;
3636 struct pt_regs *regs;
3737 unsigned long sp, ip;
38+ bool reuse_sp;
3839 int graph_idx;
3940 bool reliable;
4041 bool error;
arch/s390/kernel/idle.c+22−7
@@ -69,18 +69,26 @@ DEVICE_ATTR(idle_count, 0444, show_idle_count, NULL); · 68 unmodified lines
6969 static ssize_t show_idle_time(struct device *dev,
7070 struct device_attribute *attr, char *buf)
7171 {
72+ unsigned long long now, idle_time, idle_enter, idle_exit, in_idle;
7273 struct s390_idle_data *idle = &per_cpu(s390_idle, dev->id);
73− unsigned long long now, idle_time, idle_enter, idle_exit;
7474 unsigned int seq;
7575
7676 do {
77− now = get_tod_clock();
7877 seq = read_seqcount_begin(&idle->seqcount);
7978 idle_time = READ_ONCE(idle->idle_time);
8079 idle_enter = READ_ONCE(idle->clock_idle_enter);
8180 idle_exit = READ_ONCE(idle->clock_idle_exit);
8281 } while (read_seqcount_retry(&idle->seqcount, seq));
83− idle_time += idle_enter ? ((idle_exit ? : now) - idle_enter) : 0;
82+ in_idle = 0;
83+ now = get_tod_clock();
84+ if (idle_enter) {
85+ if (idle_exit) {
86+ in_idle = idle_exit - idle_enter;
87+ } else if (now > idle_enter) {
88+ in_idle = now - idle_enter;
89+ }
90+ }
91+ idle_time += in_idle;
8492 return sprintf(buf, "%llu\n", idle_time >> 12);
8593 }
8694 DEVICE_ATTR(idle_time_us, 0444, show_idle_time, NULL);
@@ -88,17 +96,24 @@ DEVICE_ATTR(idle_time_us, 0444, show_idle_time, NULL); · 1 unmodified line
8896 u64 arch_cpu_idle_time(int cpu)
8997 {
9098 struct s390_idle_data *idle = &per_cpu(s390_idle, cpu);
91− unsigned long long now, idle_enter, idle_exit;
99+ unsigned long long now, idle_enter, idle_exit, in_idle;
92100 unsigned int seq;
93101
94102 do {
95− now = get_tod_clock();
96103 seq = read_seqcount_begin(&idle->seqcount);
97104 idle_enter = READ_ONCE(idle->clock_idle_enter);
98105 idle_exit = READ_ONCE(idle->clock_idle_exit);
99106 } while (read_seqcount_retry(&idle->seqcount, seq));
100−
101− return cputime_to_nsecs(idle_enter ? ((idle_exit ?: now) - idle_enter) : 0);
107+ in_idle = 0;
108+ now = get_tod_clock();
109+ if (idle_enter) {
110+ if (idle_exit) {
111+ in_idle = idle_exit - idle_enter;
112+ } else if (now > idle_enter) {
113+ in_idle = now - idle_enter;
114+ }
115+ }
116+ return cputime_to_nsecs(in_idle);
102117 }
103118
104119 void arch_cpu_idle_enter(void)
arch/s390/kernel/unwind_bc.c+13−5
@@ -46,10 +46,15 @@ bool unwind_next_frame(struct unwind_state *state) · 45 unmodified lines
4646
4747 regs = state->regs;
4848 if (unlikely(regs)) {
49− sp = READ_ONCE_NOCHECK(regs->gprs[15]);
50− if (unlikely(outside_of_stack(state, sp))) {
51− if (!update_stack_info(state, sp))
52− goto out_err;
49+ if (state->reuse_sp) {
50+ sp = state->sp;
51+ state->reuse_sp = false;
52+ } else {
53+ sp = READ_ONCE_NOCHECK(regs->gprs[15]);
54+ if (unlikely(outside_of_stack(state, sp))) {
55+ if (!update_stack_info(state, sp))
56+ goto out_err;
57+ }
5358 }
5459 sf = (struct stack_frame *) sp;
5560 ip = READ_ONCE_NOCHECK(sf->gprs[8]);
@@ -107,9 +112,9 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task, · 51 unmodified lines
107112 {
108113 struct stack_info *info = &state->stack_info;
109114 unsigned long *mask = &state->stack_mask;
115+ bool reliable, reuse_sp;
110116 struct stack_frame *sf;
111117 unsigned long ip;
112− bool reliable;
113118
114119 memset(state, 0, sizeof(*state));
115120 state->task = task;
@@ -134,10 +139,12 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task, · 18 unmodified lines
134139 if (regs) {
135140 ip = READ_ONCE_NOCHECK(regs->psw.addr);
136141 reliable = true;
142+ reuse_sp = true;
137143 } else {
138144 sf = (struct stack_frame *) sp;
139145 ip = READ_ONCE_NOCHECK(sf->gprs[8]);
140146 reliable = false;
147+ reuse_sp = false;
141148 }
142149
143150 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
@@ -151,5 +158,6 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task, · 7 unmodified lines
151158 state->sp = sp;
152159 state->ip = ip;
153160 state->reliable = reliable;
161+ state->reuse_sp = reuse_sp;
154162 }
155163 EXPORT_SYMBOL_GPL(__unwind_start);
arch/s390/mm/cmm.c+6−6
@@ -298,16 +298,16 @@ static int cmm_timeout_handler(struct ctl_table *ctl, int write, · 297 unmodified lines
298298 }
299299
300300 if (write) {
301− len = *lenp;
302− if (copy_from_user(buf, buffer,
303− len > sizeof(buf) ? sizeof(buf) : len))
301+ len = min(*lenp, sizeof(buf));
302+ if (copy_from_user(buf, buffer, len))
304303 return -EFAULT;
305− buf[sizeof(buf) - 1] = '\0';
304+ buf[len - 1] = '\0';
306305 cmm_skip_blanks(buf, &p);
307306 nr = simple_strtoul(p, &p, 0);
308307 cmm_skip_blanks(p, &p);
309308 seconds = simple_strtoul(p, &p, 0);
310309 cmm_set_timeout(nr, seconds);
310+ *ppos += *lenp;
311311 } else {
312312 len = sprintf(buf, "%ld %ld\n",
313313 cmm_timeout_pages, cmm_timeout_seconds);
@@ -315,9 +315,9 @@ static int cmm_timeout_handler(struct ctl_table *ctl, int write, · 1 unmodified line
315315 len = *lenp;
316316 if (copy_to_user(buffer, buf, len))
317317 return -EFAULT;
318+ *lenp = len;
319+ *ppos += len;
318320 }
319− *lenp = len;
320− *ppos += len;
321321 return 0;
322322 }
323323
arch/um/drivers/ubd_kern.c+6−2
@@ -1403,8 +1403,12 @@ static blk_status_t ubd_queue_rq(struct blk_mq_hw_ctx *hctx, · 1402 unmodified lines
14031403
14041404 spin_unlock_irq(&ubd_dev->lock);
14051405
1406− if (ret < 0)
1407− blk_mq_requeue_request(req, true);
1406+ if (ret < 0) {
1407+ if (ret == -ENOMEM)
1408+ res = BLK_STS_RESOURCE;
1409+ else
1410+ res = BLK_STS_DEV_RESOURCE;
1411+ }
14081412
14091413 return res;
14101414 }
arch/x86/boot/compressed/eboot.c+3−1
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <asm/e820/types.h>
1414 #include <asm/setup.h>
1515 #include <asm/desc.h>
16+#include <asm/boot.h>
1617
1718 #include "../string.h"
1819 #include "eboot.h"
@@ -813,7 +814,8 @@ efi_main(struct efi_config *c, struct boot_params *boot_params) · 794 unmodified lines
813814 status = efi_relocate_kernel(sys_table, &bzimage_addr,
814815 hdr->init_size, hdr->init_size,
815816 hdr->pref_address,
816− hdr->kernel_alignment);
817+ hdr->kernel_alignment,
818+ LOAD_PHYSICAL_ADDR);
817819 if (status != EFI_SUCCESS) {
818820 efi_printk(sys_table, "efi_relocate_kernel() failed!\n");
819821 goto fail;
arch/x86/kernel/apic/apic.c+15−13
@@ -1586,9 +1586,6 @@ static void setup_local_APIC(void) · 1585 unmodified lines
15861586 {
15871587 int cpu = smp_processor_id();
15881588 unsigned int value;
1589−#ifdef CONFIG_X86_32
1590− int logical_apicid, ldr_apicid;
1591−#endif
15921589
15931590 if (disable_apic) {
15941591 disable_ioapic_support();
@@ -1626,16 +1623,21 @@ static void setup_local_APIC(void) · 31 unmodified lines
16261623 apic->init_apic_ldr();
16271624
16281625 #ifdef CONFIG_X86_32
1629− /*
1630− * APIC LDR is initialized. If logical_apicid mapping was
1631− * initialized during get_smp_config(), make sure it matches the
1632− * actual value.
1633− */
1634− logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
1635− ldr_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
1636− WARN_ON(logical_apicid != BAD_APICID && logical_apicid != ldr_apicid);
1637− /* always use the value from LDR */
1638− early_per_cpu(x86_cpu_to_logical_apicid, cpu) = ldr_apicid;
1626+ if (apic->dest_logical) {
1627+ int logical_apicid, ldr_apicid;
1628+
1629+ /*
1630+ * APIC LDR is initialized. If logical_apicid mapping was
1631+ * initialized during get_smp_config(), make sure it matches
1632+ * the actual value.
1633+ */
1634+ logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
1635+ ldr_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
1636+ if (logical_apicid != BAD_APICID)
1637+ WARN_ON(logical_apicid != ldr_apicid);
1638+ /* Always use the value from LDR. */
1639+ early_per_cpu(x86_cpu_to_logical_apicid, cpu) = ldr_apicid;
1640+ }
16391641 #endif
16401642
16411643 /*
arch/x86/kernel/cpu/resctrl/ctrlmondata.c+4−0
@@ -522,6 +522,10 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg) · 521 unmodified lines
522522 int ret = 0;
523523
524524 rdtgrp = rdtgroup_kn_lock_live(of->kn);
525+ if (!rdtgrp) {
526+ ret = -ENOENT;
527+ goto out;
528+ }
525529
526530 md.priv = of->kn->priv;
527531 resid = md.u.rid;
arch/x86/kernel/dumpstack_64.c+7−0
@@ -94,6 +94,13 @@ static bool in_exception_stack(unsigned long *stack, struct stack_info *info) · 93 unmodified lines
9494 BUILD_BUG_ON(N_EXCEPTION_STACKS != 6);
9595
9696 begin = (unsigned long)__this_cpu_read(cea_exception_stacks);
97+ /*
98+ * Handle the case where stack trace is collected _before_
99+ * cea_exception_stacks had been initialized.
100+ */
101+ if (!begin)
102+ return false;
103+
97104 end = begin + sizeof(struct cea_exception_stacks);
98105 /* Bail if @stack is outside the exception stack area. */
99106 if (stk < begin || stk >= end)
arch/x86/kernel/tsc.c+3−0
@@ -1505,6 +1505,9 @@ void __init tsc_init(void) · 1504 unmodified lines
15051505 return;
15061506 }
15071507
1508+ if (tsc_clocksource_reliable || no_tsc_watchdog)
1509+ clocksource_tsc_early.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
1510+
15081511 clocksource_register_khz(&clocksource_tsc_early, tsc_khz);
15091512 detect_art();
15101513 }
arch/x86/kvm/svm.c+8−2
@@ -734,8 +734,14 @@ static int get_npt_level(struct kvm_vcpu *vcpu) · 733 unmodified lines
734734 static void svm_set_efer(struct kvm_vcpu *vcpu, u64 efer)
735735 {
736736 vcpu->arch.efer = efer;
737− if (!npt_enabled && !(efer & EFER_LMA))
738− efer &= ~EFER_LME;
737+
738+ if (!npt_enabled) {
739+ /* Shadow paging assumes NX to be available. */
740+ efer |= EFER_NX;
741+
742+ if (!(efer & EFER_LMA))
743+ efer &= ~EFER_LME;
744+ }
739745
740746 to_svm(vcpu)->vmcb->save.efer = efer | EFER_SVME;
741747 mark_dirty(to_svm(vcpu)->vmcb, VMCB_CR);
arch/x86/kvm/vmx/vmx.c+3−11
@@ -969,17 +969,9 @@ static bool update_transition_efer(struct vcpu_vmx *vmx, int efer_offset) · 968 unmodified lines
969969 u64 guest_efer = vmx->vcpu.arch.efer;
970970 u64 ignore_bits = 0;
971971
972− if (!enable_ept) {
973− /*
974− * NX is needed to handle CR0.WP=1, CR4.SMEP=1. Testing
975− * host CPUID is more efficient than testing guest CPUID
976− * or CR4. Host SMEP is anyway a requirement for guest SMEP.
977− */
978− if (boot_cpu_has(X86_FEATURE_SMEP))
979− guest_efer |= EFER_NX;
980− else if (!(guest_efer & EFER_NX))
981− ignore_bits |= EFER_NX;
982− }
972+ /* Shadow paging assumes NX to be available. */
973+ if (!enable_ept)
974+ guest_efer |= EFER_NX;
983975
984976 /*
985977 * LMA and LME handled by hardware; SCE meaningless outside long mode.
block/blk-cgroup.c+8−5
@@ -934,9 +934,14 @@ static int blkcg_print_stat(struct seq_file *sf, void *v) · 933 unmodified lines
934934 int i;
935935 bool has_stats = false;
936936
937+ spin_lock_irq(&blkg->q->queue_lock);
938+
939+ if (!blkg->online)
940+ goto skip;
941+
937942 dname = blkg_dev_name(blkg);
938943 if (!dname)
939− continue;
944+ goto skip;
940945
941946 /*
942947 * Hooray string manipulation, count is the size written NOT
@@ -946,8 +951,6 @@ static int blkcg_print_stat(struct seq_file *sf, void *v) · 3 unmodified lines
946951 */
947952 off += scnprintf(buf+off, size-off, "%s ", dname);
948953
949− spin_lock_irq(&blkg->q->queue_lock);
950−
951954 blkg_rwstat_recursive_sum(blkg, NULL,
952955 offsetof(struct blkcg_gq, stat_bytes), &rwstat);
953956 rbytes = rwstat.cnt[BLKG_RWSTAT_READ];
@@ -960,8 +963,6 @@ static int blkcg_print_stat(struct seq_file *sf, void *v) · 6 unmodified lines
960963 wios = rwstat.cnt[BLKG_RWSTAT_WRITE];
961964 dios = rwstat.cnt[BLKG_RWSTAT_DISCARD];
962965
963− spin_unlock_irq(&blkg->q->queue_lock);
964−
965966 if (rbytes || wbytes || rios || wios) {
966967 has_stats = true;
967968 off += scnprintf(buf+off, size-off,
@@ -999,6 +1000,8 @@ static int blkcg_print_stat(struct seq_file *sf, void *v) · 31 unmodified lines
9991000 seq_commit(sf, -1);
10001001 }
10011002 }
1003+ skip:
1004+ spin_unlock_irq(&blkg->q->queue_lock);
10021005 }
10031006
10041007 rcu_read_unlock();
block/blk-iocost.c+2−2
@@ -2110,10 +2110,10 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf, · 2109 unmodified lines
21102110 goto einval;
21112111 }
21122112
2113− spin_lock_irq(&iocg->ioc->lock);
2113+ spin_lock(&iocg->ioc->lock);
21142114 iocg->cfg_weight = v;
21152115 weight_updated(iocg);
2116− spin_unlock_irq(&iocg->ioc->lock);
2116+ spin_unlock(&iocg->ioc->lock);
21172117
21182118 blkg_conf_finish(&ctx);
21192119 return nbytes;
drivers/acpi/processor_perflib.c+21−13
@@ -159,26 +159,34 @@ void acpi_processor_ignore_ppc_init(void) · 158 unmodified lines
159159
160160 void acpi_processor_ppc_init(struct cpufreq_policy *policy)
161161 {
162− int cpu = policy->cpu;
163− struct acpi_processor *pr = per_cpu(processors, cpu);
164− int ret;
162+ unsigned int cpu;
165163
166− if (!pr)
167− return;
164+ for_each_cpu(cpu, policy->related_cpus) {
165+ struct acpi_processor *pr = per_cpu(processors, cpu);
166+ int ret;
167+
168+ if (!pr)
169+ continue;
168170
169− ret = freq_qos_add_request(&policy->constraints, &pr->perflib_req,
170− FREQ_QOS_MAX, INT_MAX);
171− if (ret < 0)
172− pr_err("Failed to add freq constraint for CPU%d (%d)\n", cpu,
173− ret);
171+ ret = freq_qos_add_request(&policy->constraints,
172+ &pr->perflib_req,
173+ FREQ_QOS_MAX, INT_MAX);
174+ if (ret < 0)
175+ pr_err("Failed to add freq constraint for CPU%d (%d)\n",
176+ cpu, ret);
177+ }
174178 }
175179
176180 void acpi_processor_ppc_exit(struct cpufreq_policy *policy)
177181 {
178− struct acpi_processor *pr = per_cpu(processors, policy->cpu);
182+ unsigned int cpu;
179183
180− if (pr)
181− freq_qos_remove_request(&pr->perflib_req);
184+ for_each_cpu(cpu, policy->related_cpus) {
185+ struct acpi_processor *pr = per_cpu(processors, cpu);
186+
187+ if (pr)
188+ freq_qos_remove_request(&pr->perflib_req);
189+ }
182190 }
183191
184192 static int acpi_processor_get_performance_control(struct acpi_processor *pr)
drivers/acpi/processor_thermal.c+21−13
@@ -127,26 +127,34 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) · 126 unmodified lines
127127
128128 void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy)
129129 {
130− int cpu = policy->cpu;
131− struct acpi_processor *pr = per_cpu(processors, cpu);
132− int ret;
130+ unsigned int cpu;
133131
134− if (!pr)
135− return;
132+ for_each_cpu(cpu, policy->related_cpus) {
133+ struct acpi_processor *pr = per_cpu(processors, cpu);
134+ int ret;
135+
136+ if (!pr)
137+ continue;
136138
137− ret = freq_qos_add_request(&policy->constraints, &pr->thermal_req,
138− FREQ_QOS_MAX, INT_MAX);
139− if (ret < 0)
140− pr_err("Failed to add freq constraint for CPU%d (%d)\n", cpu,
141− ret);
139+ ret = freq_qos_add_request(&policy->constraints,
140+ &pr->thermal_req,
141+ FREQ_QOS_MAX, INT_MAX);
142+ if (ret < 0)
143+ pr_err("Failed to add freq constraint for CPU%d (%d)\n",
144+ cpu, ret);
145+ }
142146 }
143147
144148 void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy)
145149 {
146− struct acpi_processor *pr = per_cpu(processors, policy->cpu);
150+ unsigned int cpu;
151+
152+ for_each_cpu(cpu, policy->related_cpus) {
153+ struct acpi_processor *pr = per_cpu(processors, policy->cpu);
147154
148− if (pr)
149− freq_qos_remove_request(&pr->thermal_req);
155+ if (pr)
156+ freq_qos_remove_request(&pr->thermal_req);
157+ }
150158 }
151159 #else /* ! CONFIG_CPU_FREQ */
152160 static int cpufreq_get_max_state(unsigned int cpu)
drivers/block/drbd/drbd_main.c+0−1
@@ -786,7 +786,6 @@ int __drbd_send_protocol(struct drbd_connection *connection, enum drbd_packet cm · 785 unmodified lines
786786
787787 if (nc->tentative && connection->agreed_pro_version < 92) {
788788 rcu_read_unlock();
789− mutex_unlock(&sock->mutex);
790789 drbd_err(connection, "--dry-run is not supported by peer");
791790 return -EOPNOTSUPP;
792791 }
drivers/clk/at91/clk-main.c+4−1
@@ -297,7 +297,10 @@ static int clk_main_probe_frequency(struct regmap *regmap) · 296 unmodified lines
297297 regmap_read(regmap, AT91_CKGR_MCFR, &mcfr);
298298 if (mcfr & AT91_PMC_MAINRDY)
299299 return 0;
300− usleep_range(MAINF_LOOP_MIN_WAIT, MAINF_LOOP_MAX_WAIT);
300+ if (system_state < SYSTEM_RUNNING)
301+ udelay(MAINF_LOOP_MIN_WAIT);
302+ else
303+ usleep_range(MAINF_LOOP_MIN_WAIT, MAINF_LOOP_MAX_WAIT);
301304 } while (time_before(prep_time, timeout));
302305
303306 return -ETIMEDOUT;
drivers/clk/at91/sam9x60.c+1−0
@@ -43,6 +43,7 @@ static const struct clk_pll_characteristics upll_characteristics = { · 42 unmodified lines
4343 };
4444
4545 static const struct clk_programmable_layout sam9x60_programmable_layout = {
46+ .pres_mask = 0xff,
4647 .pres_shift = 8,
4748 .css_mask = 0x1f,
4849 .have_slck_mck = 0,
drivers/clk/at91/sckc.c+16−4
@@ -76,7 +76,10 @@ static int clk_slow_osc_prepare(struct clk_hw *hw) · 75 unmodified lines
7676
7777 writel(tmp | osc->bits->cr_osc32en, sckcr);
7878
79− usleep_range(osc->startup_usec, osc->startup_usec + 1);
79+ if (system_state < SYSTEM_RUNNING)
80+ udelay(osc->startup_usec);
81+ else
82+ usleep_range(osc->startup_usec, osc->startup_usec + 1);
8083
8184 return 0;
8285 }
@@ -187,7 +190,10 @@ static int clk_slow_rc_osc_prepare(struct clk_hw *hw) · 104 unmodified lines
187190
188191 writel(readl(sckcr) | osc->bits->cr_rcen, sckcr);
189192
190− usleep_range(osc->startup_usec, osc->startup_usec + 1);
193+ if (system_state < SYSTEM_RUNNING)
194+ udelay(osc->startup_usec);
195+ else
196+ usleep_range(osc->startup_usec, osc->startup_usec + 1);
191197
192198 return 0;
193199 }
@@ -288,7 +294,10 @@ static int clk_sam9x5_slow_set_parent(struct clk_hw *hw, u8 index) · 94 unmodified lines
288294
289295 writel(tmp, sckcr);
290296
291− usleep_range(SLOWCK_SW_TIME_USEC, SLOWCK_SW_TIME_USEC + 1);
297+ if (system_state < SYSTEM_RUNNING)
298+ udelay(SLOWCK_SW_TIME_USEC);
299+ else
300+ usleep_range(SLOWCK_SW_TIME_USEC, SLOWCK_SW_TIME_USEC + 1);
292301
293302 return 0;
294303 }
@@ -533,7 +542,10 @@ static int clk_sama5d4_slow_osc_prepare(struct clk_hw *hw) · 238 unmodified lines
533542 return 0;
534543 }
535544
536− usleep_range(osc->startup_usec, osc->startup_usec + 1);
545+ if (system_state < SYSTEM_RUNNING)
546+ udelay(osc->startup_usec);
547+ else
548+ usleep_range(osc->startup_usec, osc->startup_usec + 1);
537549 osc->prepared = true;
538550
539551 return 0;
drivers/clk/clk-ast2600.c+4−3
@@ -266,10 +266,11 @@ static int aspeed_g6_clk_enable(struct clk_hw *hw) · 265 unmodified lines
266266
267267 /* Enable clock */
268268 if (gate->flags & CLK_GATE_SET_TO_DISABLE) {
269− regmap_write(gate->map, get_clock_reg(gate), clk);
270− } else {
271− /* Use set to clear register */
269+ /* Clock is clear to enable, so use set to clear register */
272270 regmap_write(gate->map, get_clock_reg(gate) + 0x04, clk);
271+ } else {
272+ /* Clock is set to enable, so use write to set register */
273+ regmap_write(gate->map, get_clock_reg(gate), clk);
273274 }
274275
275276 if (gate->reset_idx >= 0) {
drivers/clk/imx/clk-imx8mm.c+1−1
@@ -638,7 +638,7 @@ static int imx8mm_clocks_probe(struct platform_device *pdev) · 637 unmodified lines
638638 clks[IMX8MM_CLK_A53_DIV],
639639 clks[IMX8MM_CLK_A53_SRC],
640640 clks[IMX8MM_ARM_PLL_OUT],
641− clks[IMX8MM_CLK_24M]);
641+ clks[IMX8MM_SYS_PLL1_800M]);
642642
643643 imx_check_clocks(clks, ARRAY_SIZE(clks));
644644
drivers/clk/imx/clk-imx8mn.c+1−1
@@ -610,7 +610,7 @@ static int imx8mn_clocks_probe(struct platform_device *pdev) · 609 unmodified lines
610610 clks[IMX8MN_CLK_A53_DIV],
611611 clks[IMX8MN_CLK_A53_SRC],
612612 clks[IMX8MN_ARM_PLL_OUT],
613− clks[IMX8MN_CLK_24M]);
613+ clks[IMX8MN_SYS_PLL1_800M]);
614614
615615 imx_check_clocks(clks, ARRAY_SIZE(clks));
616616
drivers/clk/meson/g12a.c+11−2
@@ -343,6 +343,7 @@ static struct clk_regmap g12a_cpu_clk_premux0 = { · 342 unmodified lines
343343 .offset = HHI_SYS_CPU_CLK_CNTL0,
344344 .mask = 0x3,
345345 .shift = 0,
346+ .flags = CLK_MUX_ROUND_CLOSEST,
346347 },
347348 .hw.init = &(struct clk_init_data){
348349 .name = "cpu_clk_dyn0_sel",
@@ -353,8 +354,7 @@ static struct clk_regmap g12a_cpu_clk_premux0 = { · 4 unmodified lines
353354 { .hw = &g12a_fclk_div3.hw },
354355 },
355356 .num_parents = 3,
356− /* This sub-tree is used a parking clock */
357− .flags = CLK_SET_RATE_NO_REPARENT,
357+ .flags = CLK_SET_RATE_PARENT,
358358 },
359359 };
360360
@@ -410,6 +410,7 @@ static struct clk_regmap g12a_cpu_clk_postmux0 = { · 49 unmodified lines
410410 .offset = HHI_SYS_CPU_CLK_CNTL0,
411411 .mask = 0x1,
412412 .shift = 2,
413+ .flags = CLK_MUX_ROUND_CLOSEST,
413414 },
414415 .hw.init = &(struct clk_init_data){
415416 .name = "cpu_clk_dyn0",
@@ -466,6 +467,7 @@ static struct clk_regmap g12a_cpu_clk_dyn = { · 50 unmodified lines
466467 .offset = HHI_SYS_CPU_CLK_CNTL0,
467468 .mask = 0x1,
468469 .shift = 10,
470+ .flags = CLK_MUX_ROUND_CLOSEST,
469471 },
470472 .hw.init = &(struct clk_init_data){
471473 .name = "cpu_clk_dyn",
@@ -485,6 +487,7 @@ static struct clk_regmap g12a_cpu_clk = { · 13 unmodified lines
485487 .offset = HHI_SYS_CPU_CLK_CNTL0,
486488 .mask = 0x1,
487489 .shift = 11,
490+ .flags = CLK_MUX_ROUND_CLOSEST,
488491 },
489492 .hw.init = &(struct clk_init_data){
490493 .name = "cpu_clk",
@@ -504,6 +507,7 @@ static struct clk_regmap g12b_cpu_clk = { · 13 unmodified lines
504507 .offset = HHI_SYS_CPU_CLK_CNTL0,
505508 .mask = 0x1,
506509 .shift = 11,
510+ .flags = CLK_MUX_ROUND_CLOSEST,
507511 },
508512 .hw.init = &(struct clk_init_data){
509513 .name = "cpu_clk",
@@ -523,6 +527,7 @@ static struct clk_regmap g12b_cpub_clk_premux0 = { · 13 unmodified lines
523527 .offset = HHI_SYS_CPUB_CLK_CNTL,
524528 .mask = 0x3,
525529 .shift = 0,
530+ .flags = CLK_MUX_ROUND_CLOSEST,
526531 },
527532 .hw.init = &(struct clk_init_data){
528533 .name = "cpub_clk_dyn0_sel",
@@ -533,6 +538,7 @@ static struct clk_regmap g12b_cpub_clk_premux0 = { · 4 unmodified lines
533538 { .hw = &g12a_fclk_div3.hw },
534539 },
535540 .num_parents = 3,
541+ .flags = CLK_SET_RATE_PARENT,
536542 },
537543 };
538544
@@ -567,6 +573,7 @@ static struct clk_regmap g12b_cpub_clk_postmux0 = { · 28 unmodified lines
567573 .offset = HHI_SYS_CPUB_CLK_CNTL,
568574 .mask = 0x1,
569575 .shift = 2,
576+ .flags = CLK_MUX_ROUND_CLOSEST,
570577 },
571578 .hw.init = &(struct clk_init_data){
572579 .name = "cpub_clk_dyn0",
@@ -644,6 +651,7 @@ static struct clk_regmap g12b_cpub_clk_dyn = { · 71 unmodified lines
644651 .offset = HHI_SYS_CPUB_CLK_CNTL,
645652 .mask = 0x1,
646653 .shift = 10,
654+ .flags = CLK_MUX_ROUND_CLOSEST,
647655 },
648656 .hw.init = &(struct clk_init_data){
649657 .name = "cpub_clk_dyn",
@@ -663,6 +671,7 @@ static struct clk_regmap g12b_cpub_clk = { · 13 unmodified lines
663671 .offset = HHI_SYS_CPUB_CLK_CNTL,
664672 .mask = 0x1,
665673 .shift = 11,
674+ .flags = CLK_MUX_ROUND_CLOSEST,
666675 },
667676 .hw.init = &(struct clk_init_data){
668677 .name = "cpub_clk",
drivers/clk/meson/gxbb.c+1−0
@@ -935,6 +935,7 @@ static struct clk_regmap gxbb_sar_adc_clk_div = { · 934 unmodified lines
935935 &gxbb_sar_adc_clk_sel.hw
936936 },
937937 .num_parents = 1,
938+ .flags = CLK_SET_RATE_PARENT,
938939 },
939940 };
940941
drivers/clk/samsung/clk-exynos5420.c+25−2
@@ -165,12 +165,18 @@ static const unsigned long exynos5x_clk_regs[] __initconst = { · 164 unmodified lines
165165 GATE_BUS_CPU,
166166 GATE_SCLK_CPU,
167167 CLKOUT_CMU_CPU,
168+ CPLL_CON0,
169+ DPLL_CON0,
168170 EPLL_CON0,
169171 EPLL_CON1,
170172 EPLL_CON2,
171173 RPLL_CON0,
172174 RPLL_CON1,
173175 RPLL_CON2,
176+ IPLL_CON0,
177+ SPLL_CON0,
178+ VPLL_CON0,
179+ MPLL_CON0,
174180 SRC_TOP0,
175181 SRC_TOP1,
176182 SRC_TOP2,
@@ -1172,8 +1178,6 @@ static const struct samsung_gate_clock exynos5x_gate_clks[] __initconst = { · 995 unmodified lines
11721178 GATE(CLK_SCLK_ISP_SENSOR2, "sclk_isp_sensor2", "dout_isp_sensor2",
11731179 GATE_TOP_SCLK_ISP, 12, CLK_SET_RATE_PARENT, 0),
11741180
1175− GATE(CLK_G3D, "g3d", "mout_user_aclk_g3d", GATE_IP_G3D, 9, 0, 0),
1176−
11771181 /* CDREX */
11781182 GATE(CLK_CLKM_PHY0, "clkm_phy0", "dout_sclk_cdrex",
11791183 GATE_BUS_CDREX0, 0, 0, 0),
@@ -1248,6 +1252,15 @@ static struct exynos5_subcmu_reg_dump exynos5x_gsc_suspend_regs[] = { · 68 unmodified lines
12481252 { DIV2_RATIO0, 0, 0x30 }, /* DIV dout_gscl_blk_300 */
12491253 };
12501254
1255+static const struct samsung_gate_clock exynos5x_g3d_gate_clks[] __initconst = {
1256+ GATE(CLK_G3D, "g3d", "mout_user_aclk_g3d", GATE_IP_G3D, 9, 0, 0),
1257+};
1258+
1259+static struct exynos5_subcmu_reg_dump exynos5x_g3d_suspend_regs[] = {
1260+ { GATE_IP_G3D, 0x3ff, 0x3ff }, /* G3D gates */
1261+ { SRC_TOP5, 0, BIT(16) }, /* MUX mout_user_aclk_g3d */
1262+};
1263+
12511264 static const struct samsung_div_clock exynos5x_mfc_div_clks[] __initconst = {
12521265 DIV(0, "dout_mfc_blk", "mout_user_aclk333", DIV4_RATIO, 0, 2),
12531266 };
@@ -1320,6 +1333,14 @@ static const struct exynos5_subcmu_info exynos5x_gsc_subcmu = { · 66 unmodified lines
13201333 .pd_name = "GSC",
13211334 };
13221335
1336+static const struct exynos5_subcmu_info exynos5x_g3d_subcmu = {
1337+ .gate_clks = exynos5x_g3d_gate_clks,
1338+ .nr_gate_clks = ARRAY_SIZE(exynos5x_g3d_gate_clks),
1339+ .suspend_regs = exynos5x_g3d_suspend_regs,
1340+ .nr_suspend_regs = ARRAY_SIZE(exynos5x_g3d_suspend_regs),
1341+ .pd_name = "G3D",
1342+};
1343+
13231344 static const struct exynos5_subcmu_info exynos5x_mfc_subcmu = {
13241345 .div_clks = exynos5x_mfc_div_clks,
13251346 .nr_div_clks = ARRAY_SIZE(exynos5x_mfc_div_clks),
@@ -1351,6 +1372,7 @@ static const struct exynos5_subcmu_info exynos5800_mau_subcmu = { · 25 unmodified lines
13511372 static const struct exynos5_subcmu_info *exynos5x_subcmus[] = {
13521373 &exynos5x_disp_subcmu,
13531374 &exynos5x_gsc_subcmu,
1375+ &exynos5x_g3d_subcmu,
13541376 &exynos5x_mfc_subcmu,
13551377 &exynos5x_mscl_subcmu,
13561378 };
@@ -1358,6 +1380,7 @@ static const struct exynos5_subcmu_info *exynos5x_subcmus[] = { · 1 unmodified line
13581380 static const struct exynos5_subcmu_info *exynos5800_subcmus[] = {
13591381 &exynos5x_disp_subcmu,
13601382 &exynos5x_gsc_subcmu,
1383+ &exynos5x_g3d_subcmu,
13611384 &exynos5x_mfc_subcmu,
13621385 &exynos5x_mscl_subcmu,
13631386 &exynos5800_mau_subcmu,
drivers/clk/samsung/clk-exynos5433.c+12−2
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/of_device.h>
1414 #include <linux/platform_device.h>
1515 #include <linux/pm_runtime.h>
16+#include <linux/slab.h>
1617
1718 #include <dt-bindings/clock/exynos5433.h>
1819
@@ -5584,6 +5585,8 @@ static int __init exynos5433_cmu_probe(struct platform_device *pdev) · 5565 unmodified lines
55845585
55855586 data->clk_save = samsung_clk_alloc_reg_dump(info->clk_regs,
55865587 info->nr_clk_regs);
5588+ if (!data->clk_save)
5589+ return -ENOMEM;
55875590 data->nr_clk_save = info->nr_clk_regs;
55885591 data->clk_suspend = info->suspend_regs;
55895592 data->nr_clk_suspend = info->nr_suspend_regs;
@@ -5592,12 +5595,19 @@ static int __init exynos5433_cmu_probe(struct platform_device *pdev) · 2 unmodified lines
55925595 if (data->nr_pclks > 0) {
55935596 data->pclks = devm_kcalloc(dev, sizeof(struct clk *),
55945597 data->nr_pclks, GFP_KERNEL);
5595−
5598+ if (!data->pclks) {
5599+ kfree(data->clk_save);
5600+ return -ENOMEM;
5601+ }
55965602 for (i = 0; i < data->nr_pclks; i++) {
55975603 struct clk *clk = of_clk_get(dev->of_node, i);
55985604
5599− if (IS_ERR(clk))
5605+ if (IS_ERR(clk)) {
5606+ kfree(data->clk_save);
5607+ while (--i >= 0)
5608+ clk_put(data->pclks[i]);
56005609 return PTR_ERR(clk);
5610+ }
56015611 data->pclks[i] = clk;
56025612 }
56035613 }
drivers/clk/sunxi-ng/ccu-sun9i-a80.c+1−1
@@ -1224,7 +1224,7 @@ static int sun9i_a80_ccu_probe(struct platform_device *pdev) · 1223 unmodified lines
12241224
12251225 /* Enforce d1 = 0, d2 = 0 for Audio PLL */
12261226 val = readl(reg + SUN9I_A80_PLL_AUDIO_REG);
1227− val &= (BIT(16) & BIT(18));
1227+ val &= ~(BIT(16) | BIT(18));
12281228 writel(val, reg + SUN9I_A80_PLL_AUDIO_REG);
12291229
12301230 /* Enforce P = 1 for both CPU cluster PLLs */
drivers/clk/sunxi/clk-sunxi.c+2−2
@@ -1080,8 +1080,8 @@ static struct clk ** __init sunxi_divs_clk_setup(struct device_node *node, · 1079 unmodified lines
10801080 rate_hw, rate_ops,
10811081 gate_hw, &clk_gate_ops,
10821082 clkflags |
1083− data->div[i].critical ?
1084− CLK_IS_CRITICAL : 0);
1083+ (data->div[i].critical ?
1084+ CLK_IS_CRITICAL : 0));
10851085
10861086 WARN_ON(IS_ERR(clk_data->clks[i]));
10871087 }
drivers/clk/ti/clk-dra7-atl.c+0−6
@@ -174,7 +174,6 @@ static void __init of_dra7_atl_clock_setup(struct device_node *node) · 173 unmodified lines
174174 struct clk_init_data init = { NULL };
175175 const char **parent_names = NULL;
176176 struct clk *clk;
177− int ret;
178177
179178 clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
180179 if (!clk_hw) {
@@ -207,11 +206,6 @@ static void __init of_dra7_atl_clock_setup(struct device_node *node) · 26 unmodified lines
207206 clk = ti_clk_register(NULL, &clk_hw->hw, node->name);
208207
209208 if (!IS_ERR(clk)) {
210− ret = ti_clk_add_alias(NULL, clk, node->name);
211− if (ret) {
212− clk_unregister(clk);
213− goto cleanup;
214− }
215209 of_clk_add_provider(node, of_clk_src_simple_get, clk);
216210 kfree(parent_names);
217211 return;
drivers/clk/ti/clkctrl.c+3−2
@@ -100,11 +100,12 @@ static bool _omap4_is_timeout(union omap4_timeout *time, u32 timeout) · 99 unmodified lines
100100 * can be from a timer that requires pm_runtime access, which
101101 * will eventually bring us here with timekeeping_suspended,
102102 * during both suspend entry and resume paths. This happens
103− * at least on am43xx platform.
103+ * at least on am43xx platform. Account for flakeyness
104+ * with udelay() by multiplying the timeout value by 2.
104105 */
105106 if (unlikely(_early_timeout || timekeeping_suspended)) {
106107 if (time->cycles++ < timeout) {
107− udelay(1);
108+ udelay(1 * 2);
108109 return false;
109110 }
110111 } else {
drivers/clocksource/sh_mtu2.c+11−5
@@ -328,12 +328,13 @@ static int sh_mtu2_register(struct sh_mtu2_channel *ch, const char *name) · 327 unmodified lines
328328 return 0;
329329 }
330330
331+static const unsigned int sh_mtu2_channel_offsets[] = {
332+ 0x300, 0x380, 0x000,
333+};
334+
331335 static int sh_mtu2_setup_channel(struct sh_mtu2_channel *ch, unsigned int index,
332336 struct sh_mtu2_device *mtu)
333337 {
334− static const unsigned int channel_offsets[] = {
335− 0x300, 0x380, 0x000,
336− };
337338 char name[6];
338339 int irq;
339340 int ret;
@@ -356,7 +357,7 @@ static int sh_mtu2_setup_channel(struct sh_mtu2_channel *ch, unsigned int index, · 16 unmodified lines
356357 return ret;
357358 }
358359
359− ch->base = mtu->mapbase + channel_offsets[index];
360+ ch->base = mtu->mapbase + sh_mtu2_channel_offsets[index];
360361 ch->index = index;
361362
362363 return sh_mtu2_register(ch, dev_name(&mtu->pdev->dev));
@@ -408,7 +409,12 @@ static int sh_mtu2_setup(struct sh_mtu2_device *mtu, · 45 unmodified lines
408409 }
409410
410411 /* Allocate and setup the channels. */
411− mtu->num_channels = 3;
412+ ret = platform_irq_count(pdev);
413+ if (ret < 0)
414+ goto err_unmap;
415+
416+ mtu->num_channels = min_t(unsigned int, ret,
417+ ARRAY_SIZE(sh_mtu2_channel_offsets));
412418
413419 mtu->channels = kcalloc(mtu->num_channels, sizeof(*mtu->channels),
414420 GFP_KERNEL);
drivers/clocksource/timer-mediatek.c+2−8
@@ -268,15 +268,12 @@ static int __init mtk_syst_init(struct device_node *node) · 267 unmodified lines
268268
269269 ret = timer_of_init(node, &to);
270270 if (ret)
271− goto err;
271+ return ret;
272272
273273 clockevents_config_and_register(&to.clkevt, timer_of_rate(&to),
274274 TIMER_SYNC_TICKS, 0xffffffff);
275275
276276 return 0;
277−err:
278− timer_of_cleanup(&to);
279− return ret;
280277 }
281278
282279 static int __init mtk_gpt_init(struct device_node *node)
@@ -293,7 +290,7 @@ static int __init mtk_gpt_init(struct device_node *node) · 10 unmodified lines
293290
294291 ret = timer_of_init(node, &to);
295292 if (ret)
296− goto err;
293+ return ret;
297294
298295 /* Configure clock source */
299296 mtk_gpt_setup(&to, TIMER_CLK_SRC, GPT_CTRL_OP_FREERUN);
@@ -311,9 +308,6 @@ static int __init mtk_gpt_init(struct device_node *node) · 11 unmodified lines
311308 mtk_gpt_enable_irq(&to, TIMER_CLK_EVT);
312309
313310 return 0;
314−err:
315− timer_of_cleanup(&to);
316− return ret;
317311 }
318312 TIMER_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_gpt_init);
319313 TIMER_OF_DECLARE(mtk_mt6765, "mediatek,mt6765-timer", mtk_syst_init);
drivers/cpufreq/intel_pstate.c+1−3
@@ -847,11 +847,9 @@ static void intel_pstate_hwp_force_min_perf(int cpu) · 846 unmodified lines
847847 value |= HWP_MAX_PERF(min_perf);
848848 value |= HWP_MIN_PERF(min_perf);
849849
850− /* Set EPP/EPB to min */
850+ /* Set EPP to min */
851851 if (boot_cpu_has(X86_FEATURE_HWP_EPP))
852852 value |= HWP_ENERGY_PERF_PREFERENCE(HWP_EPP_POWERSAVE);
853− else
854− intel_pstate_set_epb(cpu, HWP_EPP_BALANCE_POWERSAVE);
855853
856854 wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value);
857855 }
drivers/crypto/chelsio/chtls/chtls_cm.c+1−1
@@ -1297,7 +1297,7 @@ static void make_established(struct sock *sk, u32 snd_isn, unsigned int opt) · 1296 unmodified lines
12971297 tp->write_seq = snd_isn;
12981298 tp->snd_nxt = snd_isn;
12991299 tp->snd_una = snd_isn;
1300− inet_sk(sk)->inet_id = tp->write_seq ^ jiffies;
1300+ inet_sk(sk)->inet_id = prandom_u32();
13011301 assign_rxopt(sk, opt);
13021302
13031303 if (tp->rcv_wnd > (RCV_BUFSIZ_M << 10))
drivers/crypto/chelsio/chtls/chtls_io.c+1−1
@@ -1702,7 +1702,7 @@ int chtls_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, · 1701 unmodified lines
17021702 return peekmsg(sk, msg, len, nonblock, flags);
17031703
17041704 if (sk_can_busy_loop(sk) &&
1705− skb_queue_empty(&sk->sk_receive_queue) &&
1705+ skb_queue_empty_lockless(&sk->sk_receive_queue) &&
17061706 sk->sk_state == TCP_ESTABLISHED)
17071707 sk_busy_loop(sk, nonblock);
17081708
drivers/dma/imx-sdma.c+8−0
@@ -1707,6 +1707,14 @@ static void sdma_add_scripts(struct sdma_engine *sdma, · 1706 unmodified lines
17071707 if (!sdma->script_number)
17081708 sdma->script_number = SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1;
17091709
1710+ if (sdma->script_number > sizeof(struct sdma_script_start_addrs)
1711+ / sizeof(s32)) {
1712+ dev_err(sdma->dev,
1713+ "SDMA script number %d not match with firmware.\n",
1714+ sdma->script_number);
1715+ return;
1716+ }
1717+
17101718 for (i = 0; i < sdma->script_number; i++)
17111719 if (addr_arr[i] > 0)
17121720 saddr_arr[i] = addr_arr[i];
drivers/dma/qcom/bam_dma.c+19−0
@@ -694,6 +694,25 @@ static int bam_dma_terminate_all(struct dma_chan *chan) · 693 unmodified lines
694694
695695 /* remove all transactions, including active transaction */
696696 spin_lock_irqsave(&bchan->vc.lock, flag);
697+ /*
698+ * If we have transactions queued, then some might be committed to the
699+ * hardware in the desc fifo. The only way to reset the desc fifo is
700+ * to do a hardware reset (either by pipe or the entire block).
701+ * bam_chan_init_hw() will trigger a pipe reset, and also reinit the
702+ * pipe. If the pipe is left disabled (default state after pipe reset)
703+ * and is accessed by a connected hardware engine, a fatal error in
704+ * the BAM will occur. There is a small window where this could happen
705+ * with bam_chan_init_hw(), but it is assumed that the caller has
706+ * stopped activity on any attached hardware engine. Make sure to do
707+ * this first so that the BAM hardware doesn't cause memory corruption
708+ * by accessing freed resources.
709+ */
710+ if (!list_empty(&bchan->desc_list)) {
711+ async_desc = list_first_entry(&bchan->desc_list,
712+ struct bam_async_desc, desc_node);
713+ bam_chan_init_hw(bchan, async_desc->dir);
714+ }
715+
697716 list_for_each_entry_safe(async_desc, tmp,
698717 &bchan->desc_list, desc_node) {
699718 list_add(&async_desc->vd.node, &bchan->vc.desc_issued);
drivers/dma/sprd-dma.c+25−2
@@ -134,6 +134,10 @@ · 133 unmodified lines
134134 #define SPRD_DMA_SRC_TRSF_STEP_OFFSET 0
135135 #define SPRD_DMA_TRSF_STEP_MASK GENMASK(15, 0)
136136
137+/* SPRD DMA_SRC_BLK_STEP register definition */
138+#define SPRD_DMA_LLIST_HIGH_MASK GENMASK(31, 28)
139+#define SPRD_DMA_LLIST_HIGH_SHIFT 28
140+
137141 /* define DMA channel mode & trigger mode mask */
138142 #define SPRD_DMA_CHN_MODE_MASK GENMASK(7, 0)
139143 #define SPRD_DMA_TRG_MODE_MASK GENMASK(7, 0)
@@ -208,6 +212,7 @@ struct sprd_dma_dev { · 68 unmodified lines
208212 struct sprd_dma_chn channels[0];
209213 };
210214
215+static void sprd_dma_free_desc(struct virt_dma_desc *vd);
211216 static bool sprd_dma_filter_fn(struct dma_chan *chan, void *param);
212217 static struct of_dma_filter_info sprd_dma_info = {
213218 .filter_fn = sprd_dma_filter_fn,
@@ -609,12 +614,19 @@ static int sprd_dma_alloc_chan_resources(struct dma_chan *chan) · 395 unmodified lines
609614 static void sprd_dma_free_chan_resources(struct dma_chan *chan)
610615 {
611616 struct sprd_dma_chn *schan = to_sprd_dma_chan(chan);
617+ struct virt_dma_desc *cur_vd = NULL;
612618 unsigned long flags;
613619
614620 spin_lock_irqsave(&schan->vc.lock, flags);
621+ if (schan->cur_desc)
622+ cur_vd = &schan->cur_desc->vd;
623+
615624 sprd_dma_stop(schan);
616625 spin_unlock_irqrestore(&schan->vc.lock, flags);
617626
627+ if (cur_vd)
628+ sprd_dma_free_desc(cur_vd);
629+
618630 vchan_free_chan_resources(&schan->vc);
619631 pm_runtime_put(chan->device->dev);
620632 }
@@ -717,6 +729,7 @@ static int sprd_dma_fill_desc(struct dma_chan *chan, · 96 unmodified lines
717729 u32 int_mode = flags & SPRD_DMA_INT_MASK;
718730 int src_datawidth, dst_datawidth, src_step, dst_step;
719731 u32 temp, fix_mode = 0, fix_en = 0;
732+ phys_addr_t llist_ptr;
720733
721734 if (dir == DMA_MEM_TO_DEV) {
722735 src_step = sprd_dma_get_step(slave_cfg->src_addr_width);
@@ -814,13 +827,16 @@ static int sprd_dma_fill_desc(struct dma_chan *chan, · 91 unmodified lines
814827 * Set the link-list pointer point to next link-list
815828 * configuration's physical address.
816829 */
817− hw->llist_ptr = schan->linklist.phy_addr + temp;
830+ llist_ptr = schan->linklist.phy_addr + temp;
831+ hw->llist_ptr = lower_32_bits(llist_ptr);
832+ hw->src_blk_step = (upper_32_bits(llist_ptr) << SPRD_DMA_LLIST_HIGH_SHIFT) &
833+ SPRD_DMA_LLIST_HIGH_MASK;
818834 } else {
819835 hw->llist_ptr = 0;
836+ hw->src_blk_step = 0;
820837 }
821838
822839 hw->frg_step = 0;
823− hw->src_blk_step = 0;
824840 hw->des_blk_step = 0;
825841 return 0;
826842 }
@@ -1023,15 +1039,22 @@ static int sprd_dma_resume(struct dma_chan *chan) · 196 unmodified lines
10231039 static int sprd_dma_terminate_all(struct dma_chan *chan)
10241040 {
10251041 struct sprd_dma_chn *schan = to_sprd_dma_chan(chan);
1042+ struct virt_dma_desc *cur_vd = NULL;
10261043 unsigned long flags;
10271044 LIST_HEAD(head);
10281045
10291046 spin_lock_irqsave(&schan->vc.lock, flags);
1047+ if (schan->cur_desc)
1048+ cur_vd = &schan->cur_desc->vd;
1049+
10301050 sprd_dma_stop(schan);
10311051
10321052 vchan_get_all_descriptors(&schan->vc, &head);
10331053 spin_unlock_irqrestore(&schan->vc.lock, flags);
10341054
1055+ if (cur_vd)
1056+ sprd_dma_free_desc(cur_vd);
1057+
10351058 vchan_dma_desc_free_list(&schan->vc, &head);
10361059 return 0;
10371060 }
drivers/dma/tegra210-adma.c+7−0
@@ -40,6 +40,7 @@ · 39 unmodified lines
4040 #define ADMA_CH_CONFIG_MAX_BURST_SIZE 16
4141 #define ADMA_CH_CONFIG_WEIGHT_FOR_WRR(val) ((val) & 0xf)
4242 #define ADMA_CH_CONFIG_MAX_BUFS 8
43+#define TEGRA186_ADMA_CH_CONFIG_OUTSTANDING_REQS(reqs) (reqs << 4)
4344
4445 #define ADMA_CH_FIFO_CTRL 0x2c
4546 #define TEGRA210_ADMA_CH_FIFO_CTRL_TXSIZE(val) (((val) & 0xf) << 8)
@@ -77,6 +78,7 @@ struct tegra_adma; · 31 unmodified lines
7778 * @ch_req_tx_shift: Register offset for AHUB transmit channel select.
7879 * @ch_req_rx_shift: Register offset for AHUB receive channel select.
7980 * @ch_base_offset: Register offset of DMA channel registers.
81+ * @has_outstanding_reqs: If DMA channel can have outstanding requests.
8082 * @ch_fifo_ctrl: Default value for channel FIFO CTRL register.
8183 * @ch_req_mask: Mask for Tx or Rx channel select.
8284 * @ch_req_max: Maximum number of Tx or Rx channels available.
@@ -95,6 +97,7 @@ struct tegra_adma_chip_data { · 12 unmodified lines
9597 unsigned int ch_req_max;
9698 unsigned int ch_reg_size;
9799 unsigned int nr_channels;
100+ bool has_outstanding_reqs;
98101 };
99102
100103 /*
@@ -594,6 +597,8 @@ static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc, · 493 unmodified lines
594597 ADMA_CH_CTRL_FLOWCTRL_EN;
595598 ch_regs->config |= cdata->adma_get_burst_config(burst_size);
596599 ch_regs->config |= ADMA_CH_CONFIG_WEIGHT_FOR_WRR(1);
600+ if (cdata->has_outstanding_reqs)
601+ ch_regs->config |= TEGRA186_ADMA_CH_CONFIG_OUTSTANDING_REQS(8);
597602 ch_regs->fifo_ctrl = cdata->ch_fifo_ctrl;
598603 ch_regs->tc = desc->period_len & ADMA_CH_TC_COUNT_MASK;
599604
@@ -778,6 +783,7 @@ static const struct tegra_adma_chip_data tegra210_chip_data = { · 178 unmodified lines
778783 .ch_req_tx_shift = 28,
779784 .ch_req_rx_shift = 24,
780785 .ch_base_offset = 0,
786+ .has_outstanding_reqs = false,
781787 .ch_fifo_ctrl = TEGRA210_FIFO_CTRL_DEFAULT,
782788 .ch_req_mask = 0xf,
783789 .ch_req_max = 10,
@@ -792,6 +798,7 @@ static const struct tegra_adma_chip_data tegra186_chip_data = { · 8 unmodified lines
792798 .ch_req_tx_shift = 27,
793799 .ch_req_rx_shift = 22,
794800 .ch_base_offset = 0x10000,
801+ .has_outstanding_reqs = true,
795802 .ch_fifo_ctrl = TEGRA186_FIFO_CTRL_DEFAULT,
796803 .ch_req_mask = 0x1f,
797804 .ch_req_max = 20,
drivers/dma/ti/cppi41.c+20−1
@@ -586,9 +586,22 @@ static struct dma_async_tx_descriptor *cppi41_dma_prep_slave_sg( · 585 unmodified lines
586586 enum dma_transfer_direction dir, unsigned long tx_flags, void *context)
587587 {
588588 struct cppi41_channel *c = to_cpp41_chan(chan);
589+ struct dma_async_tx_descriptor *txd = NULL;
590+ struct cppi41_dd *cdd = c->cdd;
589591 struct cppi41_desc *d;
590592 struct scatterlist *sg;
591593 unsigned int i;
594+ int error;
595+
596+ error = pm_runtime_get(cdd->ddev.dev);
597+ if (error < 0) {
598+ pm_runtime_put_noidle(cdd->ddev.dev);
599+
600+ return NULL;
601+ }
602+
603+ if (cdd->is_suspended)
604+ goto err_out_not_ready;
592605
593606 d = c->desc;
594607 for_each_sg(sgl, sg, sg_len, i) {
@@ -611,7 +624,13 @@ static struct dma_async_tx_descriptor *cppi41_dma_prep_slave_sg( · 16 unmodified lines
611624 d++;
612625 }
613626
614− return &c->txd;
627+ txd = &c->txd;
628+
629+err_out_not_ready:
630+ pm_runtime_mark_last_busy(cdd->ddev.dev);
631+ pm_runtime_put_autosuspend(cdd->ddev.dev);
632+
633+ return txd;
615634 }
616635
617636 static void cppi41_compute_td_desc(struct cppi41_desc *d)
drivers/dma/xilinx/xilinx_dma.c+9−1
@@ -68,6 +68,9 @@ · 67 unmodified lines
6868 #define XILINX_DMA_DMACR_CIRC_EN BIT(1)
6969 #define XILINX_DMA_DMACR_RUNSTOP BIT(0)
7070 #define XILINX_DMA_DMACR_FSYNCSRC_MASK GENMASK(6, 5)
71+#define XILINX_DMA_DMACR_DELAY_MASK GENMASK(31, 24)
72+#define XILINX_DMA_DMACR_FRAME_COUNT_MASK GENMASK(23, 16)
73+#define XILINX_DMA_DMACR_MASTER_MASK GENMASK(11, 8)
7174
7275 #define XILINX_DMA_REG_DMASR 0x0004
7376 #define XILINX_DMA_DMASR_EOL_LATE_ERR BIT(15)
@@ -1354,7 +1357,8 @@ static void xilinx_dma_start_transfer(struct xilinx_dma_chan *chan) · 1280 unmodified lines
13541357 node);
13551358 hw = &segment->hw;
13561359
1357− xilinx_write(chan, XILINX_DMA_REG_SRCDSTADDR, hw->buf_addr);
1360+ xilinx_write(chan, XILINX_DMA_REG_SRCDSTADDR,
1361+ xilinx_prep_dma_addr_t(hw->buf_addr));
13581362
13591363 /* Start the transfer */
13601364 dma_ctrl_write(chan, XILINX_DMA_REG_BTT,
@@ -2117,8 +2121,10 @@ int xilinx_vdma_channel_set_config(struct dma_chan *dchan, · 756 unmodified lines
21172121 chan->config.gen_lock = cfg->gen_lock;
21182122 chan->config.master = cfg->master;
21192123
2124+ dmacr &= ~XILINX_DMA_DMACR_GENLOCK_EN;
21202125 if (cfg->gen_lock && chan->genlock) {
21212126 dmacr |= XILINX_DMA_DMACR_GENLOCK_EN;
2127+ dmacr &= ~XILINX_DMA_DMACR_MASTER_MASK;
21222128 dmacr |= cfg->master << XILINX_DMA_DMACR_MASTER_SHIFT;
21232129 }
21242130
@@ -2134,11 +2140,13 @@ int xilinx_vdma_channel_set_config(struct dma_chan *dchan, · 9 unmodified lines
21342140 chan->config.delay = cfg->delay;
21352141
21362142 if (cfg->coalesc <= XILINX_DMA_DMACR_FRAME_COUNT_MAX) {
2143+ dmacr &= ~XILINX_DMA_DMACR_FRAME_COUNT_MASK;
21372144 dmacr |= cfg->coalesc << XILINX_DMA_DMACR_FRAME_COUNT_SHIFT;
21382145 chan->config.coalesc = cfg->coalesc;
21392146 }
21402147
21412148 if (cfg->delay <= XILINX_DMA_DMACR_DELAY_MAX) {
2149+ dmacr &= ~XILINX_DMA_DMACR_DELAY_MASK;
21422150 dmacr |= cfg->delay << XILINX_DMA_DMACR_DELAY_SHIFT;
21432151 chan->config.delay = cfg->delay;
21442152 }
drivers/firmware/efi/Kconfig+1−0
@@ -182,6 +182,7 @@ config RESET_ATTACK_MITIGATION · 181 unmodified lines
182182
183183 config EFI_RCI2_TABLE
184184 bool "EFI Runtime Configuration Interface Table Version 2 Support"
185+ depends on X86 || COMPILE_TEST
185186 help
186187 Displays the content of the Runtime Configuration Interface
187188 Table version 2 on Dell EMC PowerEdge systems as a binary
drivers/firmware/efi/efi.c+1−1
@@ -554,7 +554,7 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz, · 553 unmodified lines
554554 sizeof(*seed) + size);
555555 if (seed != NULL) {
556556 pr_notice("seeding entropy pool\n");
557− add_device_randomness(seed->bits, seed->size);
557+ add_bootloader_randomness(seed->bits, seed->size);
558558 early_memunmap(seed, sizeof(*seed) + size);
559559 } else {
560560 pr_err("Could not map UEFI random seed!\n");
drivers/firmware/efi/libstub/Makefile+1−0
@@ -52,6 +52,7 @@ lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o string.o random.o \ · 51 unmodified lines
5252
5353 lib-$(CONFIG_ARM) += arm32-stub.o
5454 lib-$(CONFIG_ARM64) += arm64-stub.o
55+CFLAGS_arm32-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
5556 CFLAGS_arm64-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
5657
5758 #
drivers/firmware/efi/libstub/arm32-stub.c+13−3
@@ -195,6 +195,7 @@ efi_status_t handle_kernel_image(efi_system_table_t *sys_table, · 194 unmodified lines
195195 unsigned long dram_base,
196196 efi_loaded_image_t *image)
197197 {
198+ unsigned long kernel_base;
198199 efi_status_t status;
199200
200201 /*
@@ -204,9 +205,18 @@ efi_status_t handle_kernel_image(efi_system_table_t *sys_table, · 3 unmodified lines
204205 * loaded. These assumptions are made by the decompressor,
205206 * before any memory map is available.
206207 */
207− dram_base = round_up(dram_base, SZ_128M);
208+ kernel_base = round_up(dram_base, SZ_128M);
208209
209− status = reserve_kernel_base(sys_table, dram_base, reserve_addr,
210+ /*
211+ * Note that some platforms (notably, the Raspberry Pi 2) put
212+ * spin-tables and other pieces of firmware at the base of RAM,
213+ * abusing the fact that the window of TEXT_OFFSET bytes at the
214+ * base of the kernel image is only partially used at the moment.
215+ * (Up to 5 pages are used for the swapper page tables)
216+ */
217+ kernel_base += TEXT_OFFSET - 5 * PAGE_SIZE;
218+
219+ status = reserve_kernel_base(sys_table, kernel_base, reserve_addr,
210220 reserve_size);
211221 if (status != EFI_SUCCESS) {
212222 pr_efi_err(sys_table, "Unable to allocate memory for uncompressed kernel.\n");
@@ -220,7 +230,7 @@ efi_status_t handle_kernel_image(efi_system_table_t *sys_table, · 7 unmodified lines
220230 *image_size = image->image_size;
221231 status = efi_relocate_kernel(sys_table, image_addr, *image_size,
222232 *image_size,
223− dram_base + MAX_UNCOMP_KERNEL_SIZE, 0);
233+ kernel_base + MAX_UNCOMP_KERNEL_SIZE, 0, 0);
224234 if (status != EFI_SUCCESS) {
225235 pr_efi_err(sys_table, "Failed to relocate kernel.\n");
226236 efi_free(sys_table, *reserve_size, *reserve_addr);
drivers/firmware/efi/libstub/efi-stub-helper.c+10−14
@@ -260,11 +260,11 @@ fail: · 259 unmodified lines
260260 }
261261
262262 /*
263− * Allocate at the lowest possible address.
263+ * Allocate at the lowest possible address that is not below 'min'.
264264 */
265−efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,
266− unsigned long size, unsigned long align,
267− unsigned long *addr)
265+efi_status_t efi_low_alloc_above(efi_system_table_t *sys_table_arg,
266+ unsigned long size, unsigned long align,
267+ unsigned long *addr, unsigned long min)
268268 {
269269 unsigned long map_size, desc_size, buff_size;
270270 efi_memory_desc_t *map;
@@ -311,13 +311,8 @@ efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg, · 40 unmodified lines
311311 start = desc->phys_addr;
312312 end = start + desc->num_pages * EFI_PAGE_SIZE;
313313
314− /*
315− * Don't allocate at 0x0. It will confuse code that
316− * checks pointers against NULL. Skip the first 8
317− * bytes so we start at a nice even number.
318− */
319− if (start == 0x0)
320− start += 8;
314+ if (start < min)
315+ start = min;
321316
322317 start = round_up(start, align);
323318 if ((start + size) > end)
@@ -698,7 +693,8 @@ efi_status_t efi_relocate_kernel(efi_system_table_t *sys_table_arg, · 374 unmodified lines
698693 unsigned long image_size,
699694 unsigned long alloc_size,
700695 unsigned long preferred_addr,
701− unsigned long alignment)
696+ unsigned long alignment,
697+ unsigned long min_addr)
702698 {
703699 unsigned long cur_image_addr;
704700 unsigned long new_addr = 0;
@@ -731,8 +727,8 @@ efi_status_t efi_relocate_kernel(efi_system_table_t *sys_table_arg, · 26 unmodified lines
731727 * possible.
732728 */
733729 if (status != EFI_SUCCESS) {
734− status = efi_low_alloc(sys_table_arg, alloc_size, alignment,
735− &new_addr);
730+ status = efi_low_alloc_above(sys_table_arg, alloc_size,
731+ alignment, &new_addr, min_addr);
736732 }
737733 if (status != EFI_SUCCESS) {
738734 pr_efi_err(sys_table_arg, "Failed to allocate usable memory for kernel.\n");
drivers/firmware/efi/test/efi_test.c+8−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <linux/init.h>
1515 #include <linux/proc_fs.h>
1616 #include <linux/efi.h>
17+#include <linux/security.h>
1718 #include <linux/slab.h>
1819 #include <linux/uaccess.h>
1920
@@ -717,6 +718,13 @@ static long efi_test_ioctl(struct file *file, unsigned int cmd, · 697 unmodified lines
717718
718719 static int efi_test_open(struct inode *inode, struct file *file)
719720 {
721+ int ret = security_locked_down(LOCKDOWN_EFI_TEST);
722+
723+ if (ret)
724+ return ret;
725+
726+ if (!capable(CAP_SYS_ADMIN))
727+ return -EACCES;
720728 /*
721729 * nothing special to do here
722730 * We do accept multiple open files at the same time as we
drivers/firmware/efi/tpm.c+1−0
@@ -88,6 +88,7 @@ int __init efi_tpm_eventlog_init(void) · 87 unmodified lines
8888
8989 if (tbl_size < 0) {
9090 pr_err(FW_BUG "Failed to parse event in TPM Final Events Log\n");
91+ ret = -EINVAL;
9192 goto out_calc;
9293 }
9394
drivers/gpio/gpio-merrifield.c+13−20
@@ -362,9 +362,8 @@ static void mrfld_irq_handler(struct irq_desc *desc) · 361 unmodified lines
362362 chained_irq_exit(irqchip, desc);
363363 }
364364
365−static int mrfld_irq_init_hw(struct gpio_chip *chip)
365+static void mrfld_irq_init_hw(struct mrfld_gpio *priv)
366366 {
367− struct mrfld_gpio *priv = gpiochip_get_data(chip);
368367 void __iomem *reg;
369368 unsigned int base;
370369
@@ -376,8 +375,6 @@ static int mrfld_irq_init_hw(struct gpio_chip *chip) · 5 unmodified lines
376375 reg = gpio_reg(&priv->chip, base, GFER);
377376 writel(0, reg);
378377 }
379−
380− return 0;
381378 }
382379
383380 static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv)
@@ -400,7 +397,6 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id · 16 unmodified lines
400397 {
401398 const struct mrfld_gpio_pinrange *range;
402399 const char *pinctrl_dev_name;
403− struct gpio_irq_chip *girq;
404400 struct mrfld_gpio *priv;
405401 u32 gpio_base, irq_base;
406402 void __iomem *base;
@@ -448,21 +444,6 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id · 41 unmodified lines
448444
449445 raw_spin_lock_init(&priv->lock);
450446
451− girq = &priv->chip.irq;
452− girq->chip = &mrfld_irqchip;
453− girq->init_hw = mrfld_irq_init_hw;
454− girq->parent_handler = mrfld_irq_handler;
455− girq->num_parents = 1;
456− girq->parents = devm_kcalloc(&pdev->dev, girq->num_parents,
457− sizeof(*girq->parents),
458− GFP_KERNEL);
459− if (!girq->parents)
460− return -ENOMEM;
461− girq->parents[0] = pdev->irq;
462− girq->first = irq_base;
463− girq->default_type = IRQ_TYPE_NONE;
464− girq->handler = handle_bad_irq;
465−
466447 pci_set_drvdata(pdev, priv);
467448 retval = devm_gpiochip_add_data(&pdev->dev, &priv->chip, priv);
468449 if (retval) {
@@ -484,6 +465,18 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id · 15 unmodified lines
484465 }
485466 }
486467
468+ retval = gpiochip_irqchip_add(&priv->chip, &mrfld_irqchip, irq_base,
469+ handle_bad_irq, IRQ_TYPE_NONE);
470+ if (retval) {
471+ dev_err(&pdev->dev, "could not connect irqchip to gpiochip\n");
472+ return retval;
473+ }
474+
475+ mrfld_irq_init_hw(priv);
476+
477+ gpiochip_set_chained_irqchip(&priv->chip, &mrfld_irqchip, pdev->irq,
478+ mrfld_irq_handler);
479+
487480 return 0;
488481 }
489482
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c+4−1
@@ -604,8 +604,11 @@ void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr) · 603 unmodified lines
604604 continue;
605605 }
606606
607− for (i = 0; i < num_entities; i++)
607+ for (i = 0; i < num_entities; i++) {
608+ mutex_lock(&ctx->adev->lock_reset);
608609 drm_sched_entity_fini(&ctx->entities[0][i].entity);
610+ mutex_unlock(&ctx->adev->lock_reset);
611+ }
609612 }
610613 }
611614
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+7−0
@@ -2885,6 +2885,13 @@ fence_driver_init: · 2884 unmodified lines
28852885 DRM_INFO("amdgpu: acceleration disabled, skipping benchmarks\n");
28862886 }
28872887
2888+ /*
2889+ * Register gpu instance before amdgpu_device_enable_mgpu_fan_boost.
2890+ * Otherwise the mgpu fan boost feature will be skipped due to the
2891+ * gpu instance is counted less.
2892+ */
2893+ amdgpu_register_gpu_instance(adev);
2894+
28882895 /* enable clockgating, etc. after ib tests, etc. since some blocks require
28892896 * explicit gating rather than handling it automatically.
28902897 */
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+1−0
@@ -1016,6 +1016,7 @@ static const struct pci_device_id pciidlist[] = { · 1015 unmodified lines
10161016 {0x1002, 0x7340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14|AMD_EXP_HW_SUPPORT},
10171017 {0x1002, 0x7341, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14|AMD_EXP_HW_SUPPORT},
10181018 {0x1002, 0x7347, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14|AMD_EXP_HW_SUPPORT},
1019+ {0x1002, 0x734F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14|AMD_EXP_HW_SUPPORT},
10191020
10201021 /* Renoir */
10211022 {0x1002, 0x1636, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU|AMD_EXP_HW_SUPPORT},
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h+1−0
@@ -289,6 +289,7 @@ struct amdgpu_gfx { · 288 unmodified lines
289289 uint32_t mec2_feature_version;
290290 bool mec_fw_write_wait;
291291 bool me_fw_write_wait;
292+ bool cp_fw_write_wait;
292293 struct amdgpu_ring gfx_ring[AMDGPU_MAX_GFX_RINGS];
293294 unsigned num_gfx_rings;
294295 struct amdgpu_ring compute_ring[AMDGPU_MAX_COMPUTE_RINGS];
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c+3−1
@@ -218,7 +218,7 @@ static struct dma_fence *amdgpu_job_run(struct drm_sched_job *sched_job) · 217 unmodified lines
218218 struct amdgpu_ring *ring = to_amdgpu_ring(sched_job->sched);
219219 struct dma_fence *fence = NULL, *finished;
220220 struct amdgpu_job *job;
221− int r;
221+ int r = 0;
222222
223223 job = to_amdgpu_job(sched_job);
224224 finished = &job->base.s_fence->finished;
@@ -243,6 +243,8 @@ static struct dma_fence *amdgpu_job_run(struct drm_sched_job *sched_job) · 18 unmodified lines
243243 job->fence = dma_fence_get(fence);
244244
245245 amdgpu_job_free_resources(job);
246+
247+ fence = r ? ERR_PTR(r) : fence;
246248 return fence;
247249 }
248250
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c+0−1
@@ -190,7 +190,6 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags) · 189 unmodified lines
190190 pm_runtime_put_autosuspend(dev->dev);
191191 }
192192
193− amdgpu_register_gpu_instance(adev);
194193 out:
195194 if (r) {
196195 /* balance pm_runtime_get_sync in amdgpu_driver_unload_kms */
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c+51−3
@@ -93,7 +93,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_1[] = · 92 unmodified lines
9393 {
9494 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x00400014),
9595 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_CPF_CLK_CTRL, 0xfcff8fff, 0xf8000100),
96− SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_CLK_CTRL, 0xc0000000, 0xc0000100),
96+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_CLK_CTRL, 0xcd000000, 0x0d000100),
9797 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQ_CLK_CTRL, 0x60000ff0, 0x60000100),
9898 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQG_CLK_CTRL, 0x40000000, 0x40000100),
9999 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_VGT_CLK_CTRL, 0xffff8fff, 0xffff8100),
@@ -140,7 +140,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_1_1[] = · 40 unmodified lines
140140 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x003c0014),
141141 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_GS_NGG_CLK_CTRL, 0xffff8fff, 0xffff8100),
142142 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_IA_CLK_CTRL, 0xffff0fff, 0xffff0100),
143− SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_CLK_CTRL, 0xc0000000, 0xc0000100),
143+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_CLK_CTRL, 0xcd000000, 0x0d000100),
144144 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQ_CLK_CTRL, 0xf8ff0fff, 0x60000100),
145145 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQG_CLK_CTRL, 0x40000ff0, 0x40000100),
146146 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_VGT_CLK_CTRL, 0xffff8fff, 0xffff8100),
@@ -179,7 +179,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_1_2[] = · 32 unmodified lines
179179 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0x003e001f, 0x003c0014),
180180 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_GS_NGG_CLK_CTRL, 0xffff8fff, 0xffff8100),
181181 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_IA_CLK_CTRL, 0xffff0fff, 0xffff0100),
182− SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_CLK_CTRL, 0xff7f0fff, 0xc0000100),
182+ SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_CLK_CTRL, 0xff7f0fff, 0x0d000100),
183183 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQ_CLK_CTRL, 0xffffcfff, 0x60000100),
184184 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQG_CLK_CTRL, 0xffff0fff, 0x40000100),
185185 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_VGT_CLK_CTRL, 0xffff8fff, 0xffff8100),
@@ -564,6 +564,32 @@ static void gfx_v10_0_free_microcode(struct amdgpu_device *adev) · 378 unmodified lines
564564 kfree(adev->gfx.rlc.register_list_format);
565565 }
566566
567+static void gfx_v10_0_check_fw_write_wait(struct amdgpu_device *adev)
568+{
569+ adev->gfx.cp_fw_write_wait = false;
570+
571+ switch (adev->asic_type) {
572+ case CHIP_NAVI10:
573+ case CHIP_NAVI12:
574+ case CHIP_NAVI14:
575+ if ((adev->gfx.me_fw_version >= 0x00000046) &&
576+ (adev->gfx.me_feature_version >= 27) &&
577+ (adev->gfx.pfp_fw_version >= 0x00000068) &&
578+ (adev->gfx.pfp_feature_version >= 27) &&
579+ (adev->gfx.mec_fw_version >= 0x0000005b) &&
580+ (adev->gfx.mec_feature_version >= 27))
581+ adev->gfx.cp_fw_write_wait = true;
582+ break;
583+ default:
584+ break;
585+ }
586+
587+ if (adev->gfx.cp_fw_write_wait == false)
588+ DRM_WARN_ONCE("Warning: check cp_fw_version and update it to realize \
589+ GRBM requires 1-cycle delay in cp firmware\n");
590+}
591+
592+
567593 static void gfx_v10_0_init_rlc_ext_microcode(struct amdgpu_device *adev)
568594 {
569595 const struct rlc_firmware_header_v2_1 *rlc_hdr;
@@ -832,6 +858,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) · 262 unmodified lines
832858 }
833859 }
834860
861+ gfx_v10_0_check_fw_write_wait(adev);
835862 out:
836863 if (err) {
837864 dev_err(adev->dev,
@@ -4765,6 +4792,24 @@ static void gfx_v10_0_ring_emit_reg_wait(struct amdgpu_ring *ring, uint32_t reg, · 3927 unmodified lines
47654792 gfx_v10_0_wait_reg_mem(ring, 0, 0, 0, reg, 0, val, mask, 0x20);
47664793 }
47674794
4795+static void gfx_v10_0_ring_emit_reg_write_reg_wait(struct amdgpu_ring *ring,
4796+ uint32_t reg0, uint32_t reg1,
4797+ uint32_t ref, uint32_t mask)
4798+{
4799+ int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);
4800+ struct amdgpu_device *adev = ring->adev;
4801+ bool fw_version_ok = false;
4802+
4803+ fw_version_ok = adev->gfx.cp_fw_write_wait;
4804+
4805+ if (fw_version_ok)
4806+ gfx_v10_0_wait_reg_mem(ring, usepfp, 0, 1, reg0, reg1,
4807+ ref, mask, 0x20);
4808+ else
4809+ amdgpu_ring_emit_reg_write_reg_wait_helper(ring, reg0, reg1,
4810+ ref, mask);
4811+}
4812+
47684813 static void
47694814 gfx_v10_0_set_gfx_eop_interrupt_state(struct amdgpu_device *adev,
47704815 uint32_t me, uint32_t pipe,
@@ -5155,6 +5200,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = { · 384 unmodified lines
51555200 .emit_tmz = gfx_v10_0_ring_emit_tmz,
51565201 .emit_wreg = gfx_v10_0_ring_emit_wreg,
51575202 .emit_reg_wait = gfx_v10_0_ring_emit_reg_wait,
5203+ .emit_reg_write_reg_wait = gfx_v10_0_ring_emit_reg_write_reg_wait,
51585204 };
51595205
51605206 static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = {
@@ -5188,6 +5234,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = { · 27 unmodified lines
51885234 .pad_ib = amdgpu_ring_generic_pad_ib,
51895235 .emit_wreg = gfx_v10_0_ring_emit_wreg,
51905236 .emit_reg_wait = gfx_v10_0_ring_emit_reg_wait,
5237+ .emit_reg_write_reg_wait = gfx_v10_0_ring_emit_reg_write_reg_wait,
51915238 };
51925239
51935240 static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_kiq = {
@@ -5218,6 +5265,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_kiq = { · 24 unmodified lines
52185265 .emit_rreg = gfx_v10_0_ring_emit_rreg,
52195266 .emit_wreg = gfx_v10_0_ring_emit_wreg,
52205267 .emit_reg_wait = gfx_v10_0_ring_emit_reg_wait,
5268+ .emit_reg_write_reg_wait = gfx_v10_0_ring_emit_reg_write_reg_wait,
52215269 };
52225270
52235271 static void gfx_v10_0_set_ring_funcs(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c+13−0
@@ -973,6 +973,13 @@ static void gfx_v9_0_check_fw_write_wait(struct amdgpu_device *adev) · 972 unmodified lines
973973 adev->gfx.me_fw_write_wait = false;
974974 adev->gfx.mec_fw_write_wait = false;
975975
976+ if ((adev->gfx.mec_fw_version < 0x000001a5) ||
977+ (adev->gfx.mec_feature_version < 46) ||
978+ (adev->gfx.pfp_fw_version < 0x000000b7) ||
979+ (adev->gfx.pfp_feature_version < 46))
980+ DRM_WARN_ONCE("Warning: check cp_fw_version and update it to realize \
981+ GRBM requires 1-cycle delay in cp firmware\n");
982+
976983 switch (adev->asic_type) {
977984 case CHIP_VEGA10:
978985 if ((adev->gfx.me_fw_version >= 0x0000009c) &&
@@ -1039,6 +1046,12 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev) · 60 unmodified lines
10391046 !adev->gfx.rlc.is_rlc_v2_1))
10401047 adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
10411048
1049+ if (adev->pm.pp_feature & PP_GFXOFF_MASK)
1050+ adev->pg_flags |= AMD_PG_SUPPORT_GFX_PG |
1051+ AMD_PG_SUPPORT_CP |
1052+ AMD_PG_SUPPORT_RLC_SMU_HS;
1053+ break;
1054+ case CHIP_RENOIR:
10421055 if (adev->pm.pp_feature & PP_GFXOFF_MASK)
10431056 adev->pg_flags |= AMD_PG_SUPPORT_GFX_PG |
10441057 AMD_PG_SUPPORT_CP |
drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c+9−0
@@ -151,6 +151,15 @@ static void gfxhub_v2_0_init_cache_regs(struct amdgpu_device *adev) · 150 unmodified lines
151151 WREG32_SOC15(GC, 0, mmGCVM_L2_CNTL2, tmp);
152152
153153 tmp = mmGCVM_L2_CNTL3_DEFAULT;
154+ if (adev->gmc.translate_further) {
155+ tmp = REG_SET_FIELD(tmp, GCVM_L2_CNTL3, BANK_SELECT, 12);
156+ tmp = REG_SET_FIELD(tmp, GCVM_L2_CNTL3,
157+ L2_CACHE_BIGK_FRAGMENT_SIZE, 9);
158+ } else {
159+ tmp = REG_SET_FIELD(tmp, GCVM_L2_CNTL3, BANK_SELECT, 9);
160+ tmp = REG_SET_FIELD(tmp, GCVM_L2_CNTL3,
161+ L2_CACHE_BIGK_FRAGMENT_SIZE, 6);
162+ }
154163 WREG32_SOC15(GC, 0, mmGCVM_L2_CNTL3, tmp);
155164
156165 tmp = mmGCVM_L2_CNTL4_DEFAULT;
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c+4−5
@@ -309,6 +309,7 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, · 308 unmodified lines
309309
310310 job->vm_pd_addr = amdgpu_gmc_pd_addr(adev->gart.bo);
311311 job->vm_needs_flush = true;
312+ job->ibs->ptr[job->ibs->length_dw++] = ring->funcs->nop;
312313 amdgpu_ring_pad_ib(ring, &job->ibs[0]);
313314 r = amdgpu_job_submit(job, &adev->mman.entity,
314315 AMDGPU_FENCE_OWNER_UNDEFINED, &fence);
@@ -343,11 +344,9 @@ static uint64_t gmc_v10_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring, · 28 unmodified lines
343344 amdgpu_ring_emit_wreg(ring, hub->ctx0_ptb_addr_hi32 + (2 * vmid),
344345 upper_32_bits(pd_addr));
345346
346− amdgpu_ring_emit_wreg(ring, hub->vm_inv_eng0_req + eng, req);
347−
348− /* wait for the invalidate to complete */
349− amdgpu_ring_emit_reg_wait(ring, hub->vm_inv_eng0_ack + eng,
350− 1 << vmid, 1 << vmid);
347+ amdgpu_ring_emit_reg_write_reg_wait(ring, hub->vm_inv_eng0_req + eng,
348+ hub->vm_inv_eng0_ack + eng,
349+ req, 1 << vmid);
351350
352351 return pd_addr;
353352 }
drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c+9−0
@@ -137,6 +137,15 @@ static void mmhub_v2_0_init_cache_regs(struct amdgpu_device *adev) · 136 unmodified lines
137137 WREG32_SOC15(MMHUB, 0, mmMMVM_L2_CNTL2, tmp);
138138
139139 tmp = mmMMVM_L2_CNTL3_DEFAULT;
140+ if (adev->gmc.translate_further) {
141+ tmp = REG_SET_FIELD(tmp, MMVM_L2_CNTL3, BANK_SELECT, 12);
142+ tmp = REG_SET_FIELD(tmp, MMVM_L2_CNTL3,
143+ L2_CACHE_BIGK_FRAGMENT_SIZE, 9);
144+ } else {
145+ tmp = REG_SET_FIELD(tmp, MMVM_L2_CNTL3, BANK_SELECT, 9);
146+ tmp = REG_SET_FIELD(tmp, MMVM_L2_CNTL3,
147+ L2_CACHE_BIGK_FRAGMENT_SIZE, 6);
148+ }
140149 WREG32_SOC15(MMHUB, 0, mmMMVM_L2_CNTL3, tmp);
141150
142151 tmp = mmMMVM_L2_CNTL4_DEFAULT;
drivers/gpu/drm/amd/amdgpu/mmhub_v9_4.c+9−0
@@ -219,6 +219,15 @@ static void mmhub_v9_4_init_cache_regs(struct amdgpu_device *adev, int hubid) · 218 unmodified lines
219219 hubid * MMHUB_INSTANCE_REGISTER_OFFSET, tmp);
220220
221221 tmp = mmVML2PF0_VM_L2_CNTL3_DEFAULT;
222+ if (adev->gmc.translate_further) {
223+ tmp = REG_SET_FIELD(tmp, VML2PF0_VM_L2_CNTL3, BANK_SELECT, 12);
224+ tmp = REG_SET_FIELD(tmp, VML2PF0_VM_L2_CNTL3,
225+ L2_CACHE_BIGK_FRAGMENT_SIZE, 9);
226+ } else {
227+ tmp = REG_SET_FIELD(tmp, VML2PF0_VM_L2_CNTL3, BANK_SELECT, 9);
228+ tmp = REG_SET_FIELD(tmp, VML2PF0_VM_L2_CNTL3,
229+ L2_CACHE_BIGK_FRAGMENT_SIZE, 6);
230+ }
222231 WREG32_SOC15_OFFSET(MMHUB, 0, mmVML2PF0_VM_L2_CNTL3,
223232 hubid * MMHUB_INSTANCE_REGISTER_OFFSET, tmp);
224233
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c+1−0
@@ -254,6 +254,7 @@ static const struct soc15_reg_golden golden_settings_sdma_4_3[] = { · 253 unmodified lines
254254 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC0_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
255255 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC1_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
256256 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_PAGE, 0x000003ff, 0x000003c0),
257+ SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_WATERMK, 0xfc000000, 0x00000000)
257258 };
258259
259260 static u32 sdma_v4_0_get_reg_offset(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c+12−1
@@ -1173,6 +1173,16 @@ static void sdma_v5_0_ring_emit_reg_wait(struct amdgpu_ring *ring, uint32_t reg, · 1172 unmodified lines
11731173 SDMA_PKT_POLL_REGMEM_DW5_INTERVAL(10));
11741174 }
11751175
1176+static void sdma_v5_0_ring_emit_reg_write_reg_wait(struct amdgpu_ring *ring,
1177+ uint32_t reg0, uint32_t reg1,
1178+ uint32_t ref, uint32_t mask)
1179+{
1180+ amdgpu_ring_emit_wreg(ring, reg0, ref);
1181+ /* wait for a cycle to reset vm_inv_eng*_ack */
1182+ amdgpu_ring_emit_reg_wait(ring, reg0, 0, 0);
1183+ amdgpu_ring_emit_reg_wait(ring, reg1, mask, mask);
1184+}
1185+
11761186 static int sdma_v5_0_early_init(void *handle)
11771187 {
11781188 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1588,7 +1598,7 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = { · 409 unmodified lines
15881598 6 + /* sdma_v5_0_ring_emit_pipeline_sync */
15891599 /* sdma_v5_0_ring_emit_vm_flush */
15901600 SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
1591− SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 +
1601+ SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 * 2 +
15921602 10 + 10 + 10, /* sdma_v5_0_ring_emit_fence x3 for user fence, vm fence */
15931603 .emit_ib_size = 7 + 6, /* sdma_v5_0_ring_emit_ib */
15941604 .emit_ib = sdma_v5_0_ring_emit_ib,
@@ -1602,6 +1612,7 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = { · 7 unmodified lines
16021612 .pad_ib = sdma_v5_0_ring_pad_ib,
16031613 .emit_wreg = sdma_v5_0_ring_emit_wreg,
16041614 .emit_reg_wait = sdma_v5_0_ring_emit_reg_wait,
1615+ .emit_reg_write_reg_wait = sdma_v5_0_ring_emit_reg_write_reg_wait,
16051616 .init_cond_exec = sdma_v5_0_ring_init_cond_exec,
16061617 .patch_cond_exec = sdma_v5_0_ring_patch_cond_exec,
16071618 .preempt_ib = sdma_v5_0_ring_preempt_ib,
drivers/gpu/drm/amd/amdgpu/soc15.c+0−5
@@ -1186,11 +1186,6 @@ static int soc15_common_early_init(void *handle) · 1185 unmodified lines
11861186 AMD_PG_SUPPORT_VCN |
11871187 AMD_PG_SUPPORT_VCN_DPG;
11881188 adev->external_rev_id = adev->rev_id + 0x91;
1189−
1190− if (adev->pm.pp_feature & PP_GFXOFF_MASK)
1191− adev->pg_flags |= AMD_PG_SUPPORT_GFX_PG |
1192− AMD_PG_SUPPORT_CP |
1193− AMD_PG_SUPPORT_RLC_SMU_HS;
11941189 break;
11951190 default:
11961191 /* FIXME: not supported yet */
drivers/gpu/drm/amd/display/dc/calcs/Makefile+12−7
@@ -24,15 +24,20 @@ · 23 unmodified lines
2424 # It calculates Bandwidth and Watermarks values for HW programming
2525 #
2626
27−ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
28− cc_stack_align := -mpreferred-stack-boundary=4
29−else ifneq ($(call cc-option, -mstack-alignment=16),)
30− cc_stack_align := -mstack-alignment=16
31−endif
27+calcs_ccflags := -mhard-float -msse
3228
33−calcs_ccflags := -mhard-float -msse $(cc_stack_align)
29+ifdef CONFIG_CC_IS_GCC
30+ifeq ($(call cc-ifversion, -lt, 0701, y), y)
31+IS_OLD_GCC = 1
32+endif
33+endif
3434
35−ifdef CONFIG_CC_IS_CLANG
35+ifdef IS_OLD_GCC
36+# Stack alignment mismatch, proceed with caution.
37+# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
38+# (8B stack alignment).
39+calcs_ccflags += -mpreferred-stack-boundary=4
40+else
3641 calcs_ccflags += -msse2
3742 endif
3843
drivers/gpu/drm/amd/display/dc/core/dc.c+4−0
@@ -580,6 +580,10 @@ static bool construct(struct dc *dc, · 579 unmodified lines
580580 #ifdef CONFIG_DRM_AMD_DC_DCN2_0
581581 // Allocate memory for the vm_helper
582582 dc->vm_helper = kzalloc(sizeof(struct vm_helper), GFP_KERNEL);
583+ if (!dc->vm_helper) {
584+ dm_error("%s: failed to create dc->vm_helper\n", __func__);
585+ goto fail;
586+ }
583587
584588 #endif
585589 memcpy(&dc->bb_overrides, &init_params->bb_overrides, sizeof(dc->bb_overrides));
drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c+18−6
@@ -374,6 +374,7 @@ void dal_ddc_service_i2c_query_dp_dual_mode_adaptor( · 373 unmodified lines
374374 enum display_dongle_type *dongle = &sink_cap->dongle_type;
375375 uint8_t type2_dongle_buf[DP_ADAPTOR_TYPE2_SIZE];
376376 bool is_type2_dongle = false;
377+ int retry_count = 2;
377378 struct dp_hdmi_dongle_signature_data *dongle_signature;
378379
379380 /* Assume we have no valid DP passive dongle connected */
@@ -386,13 +387,24 @@ void dal_ddc_service_i2c_query_dp_dual_mode_adaptor( · 6 unmodified lines
386387 DP_HDMI_DONGLE_ADDRESS,
387388 type2_dongle_buf,
388389 sizeof(type2_dongle_buf))) {
389− *dongle = DISPLAY_DONGLE_DP_DVI_DONGLE;
390− sink_cap->max_hdmi_pixel_clock = DP_ADAPTOR_DVI_MAX_TMDS_CLK;
390+ /* Passive HDMI dongles can sometimes fail here without retrying*/
391+ while (retry_count > 0) {
392+ if (i2c_read(ddc,
393+ DP_HDMI_DONGLE_ADDRESS,
394+ type2_dongle_buf,
395+ sizeof(type2_dongle_buf)))
396+ break;
397+ retry_count--;
398+ }
399+ if (retry_count == 0) {
400+ *dongle = DISPLAY_DONGLE_DP_DVI_DONGLE;
401+ sink_cap->max_hdmi_pixel_clock = DP_ADAPTOR_DVI_MAX_TMDS_CLK;
391402
392− CONN_DATA_DETECT(ddc->link, type2_dongle_buf, sizeof(type2_dongle_buf),
393− "DP-DVI passive dongle %dMhz: ",
394− DP_ADAPTOR_DVI_MAX_TMDS_CLK / 1000);
395− return;
403+ CONN_DATA_DETECT(ddc->link, type2_dongle_buf, sizeof(type2_dongle_buf),
404+ "DP-DVI passive dongle %dMhz: ",
405+ DP_ADAPTOR_DVI_MAX_TMDS_CLK / 1000);
406+ return;
407+ }
396408 }
397409
398410 /* Check if Type 2 dongle.*/
drivers/gpu/drm/amd/display/dc/core/dc_resource.c+6−0
@@ -404,6 +404,9 @@ bool resource_are_streams_timing_synchronizable( · 403 unmodified lines
404404 if (stream1->view_format != stream2->view_format)
405405 return false;
406406
407+ if (stream1->ignore_msa_timing_param || stream2->ignore_msa_timing_param)
408+ return false;
409+
407410 return true;
408411 }
409412 static bool is_dp_and_hdmi_sharable(
@@ -1540,6 +1543,9 @@ bool dc_is_stream_unchanged( · 1130 unmodified lines
15401543 if (!are_stream_backends_same(old_stream, stream))
15411544 return false;
15421545
1546+ if (old_stream->ignore_msa_timing_param != stream->ignore_msa_timing_param)
1547+ return false;
1548+
15431549 return true;
15441550 }
15451551
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c+8−14
@@ -393,6 +393,10 @@ bool cm_helper_translate_curve_to_hw_format( · 392 unmodified lines
393393 rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index];
394394 rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index];
395395
396+ rgb_resulted[hw_points].red = rgb_resulted[hw_points - 1].red;
397+ rgb_resulted[hw_points].green = rgb_resulted[hw_points - 1].green;
398+ rgb_resulted[hw_points].blue = rgb_resulted[hw_points - 1].blue;
399+
396400 // All 3 color channels have same x
397401 corner_points[0].red.x = dc_fixpt_pow(dc_fixpt_from_int(2),
398402 dc_fixpt_from_int(region_start));
@@ -464,13 +468,6 @@ bool cm_helper_translate_curve_to_hw_format( · 65 unmodified lines
464468
465469 i = 1;
466470 while (i != hw_points + 1) {
467− if (dc_fixpt_lt(rgb_plus_1->red, rgb->red))
468− rgb_plus_1->red = rgb->red;
469− if (dc_fixpt_lt(rgb_plus_1->green, rgb->green))
470− rgb_plus_1->green = rgb->green;
471− if (dc_fixpt_lt(rgb_plus_1->blue, rgb->blue))
472− rgb_plus_1->blue = rgb->blue;
473−
474471 rgb->delta_red = dc_fixpt_sub(rgb_plus_1->red, rgb->red);
475472 rgb->delta_green = dc_fixpt_sub(rgb_plus_1->green, rgb->green);
476473 rgb->delta_blue = dc_fixpt_sub(rgb_plus_1->blue, rgb->blue);
@@ -562,6 +559,10 @@ bool cm_helper_translate_curve_to_degamma_hw_format( · 85 unmodified lines
562559 rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index];
563560 rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index];
564561
562+ rgb_resulted[hw_points].red = rgb_resulted[hw_points - 1].red;
563+ rgb_resulted[hw_points].green = rgb_resulted[hw_points - 1].green;
564+ rgb_resulted[hw_points].blue = rgb_resulted[hw_points - 1].blue;
565+
565566 corner_points[0].red.x = dc_fixpt_pow(dc_fixpt_from_int(2),
566567 dc_fixpt_from_int(region_start));
567568 corner_points[0].green.x = corner_points[0].red.x;
@@ -624,13 +625,6 @@ bool cm_helper_translate_curve_to_degamma_hw_format( · 56 unmodified lines
624625
625626 i = 1;
626627 while (i != hw_points + 1) {
627− if (dc_fixpt_lt(rgb_plus_1->red, rgb->red))
628− rgb_plus_1->red = rgb->red;
629− if (dc_fixpt_lt(rgb_plus_1->green, rgb->green))
630− rgb_plus_1->green = rgb->green;
631− if (dc_fixpt_lt(rgb_plus_1->blue, rgb->blue))
632− rgb_plus_1->blue = rgb->blue;
633−
634628 rgb->delta_red = dc_fixpt_sub(rgb_plus_1->red, rgb->red);
635629 rgb->delta_green = dc_fixpt_sub(rgb_plus_1->green, rgb->green);
636630 rgb->delta_blue = dc_fixpt_sub(rgb_plus_1->blue, rgb->blue);
drivers/gpu/drm/amd/display/dc/dcn20/Makefile+12−7
@@ -10,15 +10,20 @@ ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT · 9 unmodified lines
1010 DCN20 += dcn20_dsc.o
1111 endif
1212
13−ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
14− cc_stack_align := -mpreferred-stack-boundary=4
15−else ifneq ($(call cc-option, -mstack-alignment=16),)
16− cc_stack_align := -mstack-alignment=16
17−endif
13+CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse
1814
19−CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse $(cc_stack_align)
15+ifdef CONFIG_CC_IS_GCC
16+ifeq ($(call cc-ifversion, -lt, 0701, y), y)
17+IS_OLD_GCC = 1
18+endif
19+endif
2020
21−ifdef CONFIG_CC_IS_CLANG
21+ifdef IS_OLD_GCC
22+# Stack alignment mismatch, proceed with caution.
23+# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
24+# (8B stack alignment).
25+CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -mpreferred-stack-boundary=4
26+else
2227 CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2
2328 endif
2429
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c+6−1
@@ -814,7 +814,7 @@ static const struct resource_caps res_cap_nv14 = { · 813 unmodified lines
814814 .num_audio = 6,
815815 .num_stream_encoder = 5,
816816 .num_pll = 5,
817− .num_dwb = 0,
817+ .num_dwb = 1,
818818 .num_ddc = 5,
819819 };
820820
@@ -1107,6 +1107,11 @@ struct stream_encoder *dcn20_stream_encoder_create( · 286 unmodified lines
11071107 if (!enc1)
11081108 return NULL;
11091109
1110+ if (ASICREV_IS_NAVI14_M(ctx->asic_id.hw_internal_rev)) {
1111+ if (eng_id >= ENGINE_ID_DIGD)
1112+ eng_id++;
1113+ }
1114+
11101115 dcn20_stream_encoder_construct(enc1, ctx, ctx->dc_bios, eng_id,
11111116 &stream_enc_regs[eng_id],
11121117 &se_shift, &se_mask);
drivers/gpu/drm/amd/display/dc/dcn21/Makefile+12−7
@@ -3,15 +3,20 @@ · 2 unmodified lines
33
44 DCN21 = dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o
55
6−ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
7− cc_stack_align := -mpreferred-stack-boundary=4
8−else ifneq ($(call cc-option, -mstack-alignment=16),)
9− cc_stack_align := -mstack-alignment=16
10−endif
6+CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse
117
12−CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse $(cc_stack_align)
8+ifdef CONFIG_CC_IS_GCC
9+ifeq ($(call cc-ifversion, -lt, 0701, y), y)
10+IS_OLD_GCC = 1
11+endif
12+endif
1313
14−ifdef CONFIG_CC_IS_CLANG
14+ifdef IS_OLD_GCC
15+# Stack alignment mismatch, proceed with caution.
16+# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
17+# (8B stack alignment).
18+CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -mpreferred-stack-boundary=4
19+else
1520 CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2
1621 endif
1722
drivers/gpu/drm/amd/display/dc/dml/Makefile+12−7
@@ -24,15 +24,20 @@ · 23 unmodified lines
2424 # It provides the general basic services required by other DAL
2525 # subcomponents.
2626
27−ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
28− cc_stack_align := -mpreferred-stack-boundary=4
29−else ifneq ($(call cc-option, -mstack-alignment=16),)
30− cc_stack_align := -mstack-alignment=16
31−endif
27+dml_ccflags := -mhard-float -msse
3228
33−dml_ccflags := -mhard-float -msse $(cc_stack_align)
29+ifdef CONFIG_CC_IS_GCC
30+ifeq ($(call cc-ifversion, -lt, 0701, y), y)
31+IS_OLD_GCC = 1
32+endif
33+endif
3434
35−ifdef CONFIG_CC_IS_CLANG
35+ifdef IS_OLD_GCC
36+# Stack alignment mismatch, proceed with caution.
37+# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
38+# (8B stack alignment).
39+dml_ccflags += -mpreferred-stack-boundary=4
40+else
3641 dml_ccflags += -msse2
3742 endif
3843
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c+2−1
@@ -2577,7 +2577,8 @@ static void dml20_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPer · 2576 unmodified lines
25772577 mode_lib->vba.MinActiveDRAMClockChangeMargin
25782578 + mode_lib->vba.DRAMClockChangeLatency;
25792579
2580− if (mode_lib->vba.MinActiveDRAMClockChangeMargin > 0) {
2580+ if (mode_lib->vba.MinActiveDRAMClockChangeMargin > 50) {
2581+ mode_lib->vba.DRAMClockChangeWatermark += 25;
25812582 mode_lib->vba.DRAMClockChangeSupport[0][0] = dm_dram_clock_change_vactive;
25822583 } else {
25832584 if (mode_lib->vba.SynchronizedVBlank || mode_lib->vba.NumberOfActivePlanes == 1) {
drivers/gpu/drm/amd/display/dc/dsc/Makefile+12−7
@@ -1,15 +1,20 @@
11 #
22 # Makefile for the 'dsc' sub-component of DAL.
33
4−ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
5− cc_stack_align := -mpreferred-stack-boundary=4
6−else ifneq ($(call cc-option, -mstack-alignment=16),)
7− cc_stack_align := -mstack-alignment=16
8−endif
4+dsc_ccflags := -mhard-float -msse
95
10−dsc_ccflags := -mhard-float -msse $(cc_stack_align)
6+ifdef CONFIG_CC_IS_GCC
7+ifeq ($(call cc-ifversion, -lt, 0701, y), y)
8+IS_OLD_GCC = 1
9+endif
10+endif
1111
12−ifdef CONFIG_CC_IS_CLANG
12+ifdef IS_OLD_GCC
13+# Stack alignment mismatch, proceed with caution.
14+# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
15+# (8B stack alignment).
16+dsc_ccflags += -mpreferred-stack-boundary=4
17+else
1318 dsc_ccflags += -msse2
1419 endif
1520
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c+1−3
@@ -5098,9 +5098,7 @@ static void vega10_odn_update_soc_table(struct pp_hwmgr *hwmgr, · 5097 unmodified lines
50985098
50995099 if (type == PP_OD_EDIT_SCLK_VDDC_TABLE) {
51005100 podn_vdd_dep = &data->odn_dpm_table.vdd_dep_on_sclk;
5101− for (i = 0; i < podn_vdd_dep->count - 1; i++)
5102− od_vddc_lookup_table->entries[i].us_vdd = podn_vdd_dep->entries[i].vddc;
5103− if (od_vddc_lookup_table->entries[i].us_vdd < podn_vdd_dep->entries[i].vddc)
5101+ for (i = 0; i < podn_vdd_dep->count; i++)
51045102 od_vddc_lookup_table->entries[i].us_vdd = podn_vdd_dep->entries[i].vddc;
51055103 } else if (type == PP_OD_EDIT_MCLK_VDDC_TABLE) {
51065104 podn_vdd_dep = &data->odn_dpm_table.vdd_dep_on_mclk;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c+1−1
@@ -205,7 +205,7 @@ static struct smu_11_0_cmn2aisc_mapping navi10_workload_map[PP_SMC_POWER_PROFILE · 204 unmodified lines
205205 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_POWERSAVING, WORKLOAD_PPLIB_POWER_SAVING_BIT),
206206 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VIDEO, WORKLOAD_PPLIB_VIDEO_BIT),
207207 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VR, WORKLOAD_PPLIB_VR_BIT),
208− WORKLOAD_MAP(PP_SMC_POWER_PROFILE_COMPUTE, WORKLOAD_PPLIB_CUSTOM_BIT),
208+ WORKLOAD_MAP(PP_SMC_POWER_PROFILE_COMPUTE, WORKLOAD_PPLIB_COMPUTE_BIT),
209209 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_CUSTOM, WORKLOAD_PPLIB_CUSTOM_BIT),
210210 };
211211
drivers/gpu/drm/amd/powerplay/vega20_ppt.c+1−1
@@ -219,7 +219,7 @@ static struct smu_11_0_cmn2aisc_mapping vega20_workload_map[PP_SMC_POWER_PROFILE · 218 unmodified lines
219219 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_POWERSAVING, WORKLOAD_PPLIB_POWER_SAVING_BIT),
220220 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VIDEO, WORKLOAD_PPLIB_VIDEO_BIT),
221221 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VR, WORKLOAD_PPLIB_VR_BIT),
222− WORKLOAD_MAP(PP_SMC_POWER_PROFILE_COMPUTE, WORKLOAD_PPLIB_CUSTOM_BIT),
222+ WORKLOAD_MAP(PP_SMC_POWER_PROFILE_COMPUTE, WORKLOAD_PPLIB_COMPUTE_BIT),
223223 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_CUSTOM, WORKLOAD_PPLIB_CUSTOM_BIT),
224224 };
225225
drivers/gpu/drm/drm_atomic_helper.c+14−1
@@ -1581,8 +1581,11 @@ static void commit_tail(struct drm_atomic_state *old_state) · 1580 unmodified lines
15811581 {
15821582 struct drm_device *dev = old_state->dev;
15831583 const struct drm_mode_config_helper_funcs *funcs;
1584+ struct drm_crtc_state *new_crtc_state;
1585+ struct drm_crtc *crtc;
15841586 ktime_t start;
15851587 s64 commit_time_ms;
1588+ unsigned int i, new_self_refresh_mask = 0;
15861589
15871590 funcs = dev->mode_config.helper_private;
15881591
@@ -1602,6 +1605,15 @@ static void commit_tail(struct drm_atomic_state *old_state) · 13 unmodified lines
16021605
16031606 drm_atomic_helper_wait_for_dependencies(old_state);
16041607
1608+ /*
1609+ * We cannot safely access new_crtc_state after
1610+ * drm_atomic_helper_commit_hw_done() so figure out which crtc's have
1611+ * self-refresh active beforehand:
1612+ */
1613+ for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i)
1614+ if (new_crtc_state->self_refresh_active)
1615+ new_self_refresh_mask |= BIT(i);
1616+
16051617 if (funcs && funcs->atomic_commit_tail)
16061618 funcs->atomic_commit_tail(old_state);
16071619 else
@@ -1610,7 +1622,8 @@ static void commit_tail(struct drm_atomic_state *old_state) · 2 unmodified lines
16101622 commit_time_ms = ktime_ms_delta(ktime_get(), start);
16111623 if (commit_time_ms > 0)
16121624 drm_self_refresh_helper_update_avg_times(old_state,
1613− (unsigned long)commit_time_ms);
1625+ (unsigned long)commit_time_ms,
1626+ new_self_refresh_mask);
16141627
16151628 drm_atomic_helper_commit_cleanup_done(old_state);
16161629
drivers/gpu/drm/drm_self_refresh_helper.c+11−7
@@ -133,29 +133,33 @@ out_drop_locks: · 132 unmodified lines
133133 * drm_self_refresh_helper_update_avg_times - Updates a crtc's SR time averages
134134 * @state: the state which has just been applied to hardware
135135 * @commit_time_ms: the amount of time in ms that this commit took to complete
136+ * @new_self_refresh_mask: bitmask of crtc's that have self_refresh_active in
137+ * new state
136138 *
137139 * Called after &drm_mode_config_funcs.atomic_commit_tail, this function will
138140 * update the average entry/exit self refresh times on self refresh transitions.
139141 * These averages will be used when calculating how long to delay before
140142 * entering self refresh mode after activity.
141143 */
142−void drm_self_refresh_helper_update_avg_times(struct drm_atomic_state *state,
143− unsigned int commit_time_ms)
144+void
145+drm_self_refresh_helper_update_avg_times(struct drm_atomic_state *state,
146+ unsigned int commit_time_ms,
147+ unsigned int new_self_refresh_mask)
144148 {
145149 struct drm_crtc *crtc;
146− struct drm_crtc_state *old_crtc_state, *new_crtc_state;
150+ struct drm_crtc_state *old_crtc_state;
147151 int i;
148152
149− for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,
150− new_crtc_state, i) {
153+ for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) {
154+ bool new_self_refresh_active = new_self_refresh_mask & BIT(i);
151155 struct drm_self_refresh_data *sr_data = crtc->self_refresh_data;
152156 struct ewma_psr_time *time;
153157
154158 if (old_crtc_state->self_refresh_active ==
155− new_crtc_state->self_refresh_active)
159+ new_self_refresh_active)
156160 continue;
157161
158− if (new_crtc_state->self_refresh_active)
162+ if (new_self_refresh_active)
159163 time = &sr_data->entry_avg_ms;
160164 else
161165 time = &sr_data->exit_avg_ms;
drivers/gpu/drm/etnaviv/etnaviv_dump.c+2−2
@@ -180,6 +180,8 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit) · 179 unmodified lines
180180 etnaviv_cmdbuf_get_va(&submit->cmdbuf,
181181 &gpu->mmu_context->cmdbuf_mapping));
182182
183+ mutex_unlock(&gpu->mmu_context->lock);
184+
183185 /* Reserve space for the bomap */
184186 if (n_bomap_pages) {
185187 bomap_start = bomap = iter.data;
@@ -221,8 +223,6 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit) · 35 unmodified lines
221223 obj->base.size);
222224 }
223225
224− mutex_unlock(&gpu->mmu_context->lock);
225−
226226 etnaviv_core_dump_header(&iter, ETDUMP_BUF_END, iter.data);
227227
228228 dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, GFP_KERNEL);
drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c+4−2
@@ -155,9 +155,11 @@ static void etnaviv_iommuv2_dump(struct etnaviv_iommu_context *context, void *bu · 154 unmodified lines
155155
156156 memcpy(buf, v2_context->mtlb_cpu, SZ_4K);
157157 buf += SZ_4K;
158− for (i = 0; i < MMUv2_MAX_STLB_ENTRIES; i++, buf += SZ_4K)
159− if (v2_context->mtlb_cpu[i] & MMUv2_PTE_PRESENT)
158+ for (i = 0; i < MMUv2_MAX_STLB_ENTRIES; i++)
159+ if (v2_context->mtlb_cpu[i] & MMUv2_PTE_PRESENT) {
160160 memcpy(buf, v2_context->stlb_cpu[i], SZ_4K);
161+ buf += SZ_4K;
162+ }
161163 }
162164
163165 static void etnaviv_iommuv2_restore_nonsec(struct etnaviv_gpu *gpu,
drivers/gpu/drm/etnaviv/etnaviv_mmu.c+14−3
@@ -328,12 +328,23 @@ etnaviv_iommu_context_init(struct etnaviv_iommu_global *global, · 327 unmodified lines
328328
329329 ret = etnaviv_cmdbuf_suballoc_map(suballoc, ctx, &ctx->cmdbuf_mapping,
330330 global->memory_base);
331− if (ret) {
332− global->ops->free(ctx);
333− return NULL;
331+ if (ret)
332+ goto out_free;
333+
334+ if (global->version == ETNAVIV_IOMMU_V1 &&
335+ ctx->cmdbuf_mapping.iova > 0x80000000) {
336+ dev_err(global->dev,
337+ "command buffer outside valid memory window\n");
338+ goto out_unmap;
334339 }
335340
336341 return ctx;
342+
343+out_unmap:
344+ etnaviv_cmdbuf_suballoc_unmap(ctx, &ctx->cmdbuf_mapping);
345+out_free:
346+ global->ops->free(ctx);
347+ return NULL;
337348 }
338349
339350 void etnaviv_iommu_restore(struct etnaviv_gpu *gpu,
drivers/gpu/drm/i915/display/intel_crt.c+7−0
@@ -864,6 +864,13 @@ load_detect: · 863 unmodified lines
864864
865865 out:
866866 intel_display_power_put(dev_priv, intel_encoder->power_domain, wakeref);
867+
868+ /*
869+ * Make sure the refs for power wells enabled during detect are
870+ * dropped to avoid a new detect cycle triggered by HPD polling.
871+ */
872+ intel_display_power_flush_work(dev_priv);
873+
867874 return status;
868875 }
869876
drivers/gpu/drm/i915/display/intel_display.c+6−5
@@ -9315,7 +9315,6 @@ static bool wrpll_uses_pch_ssc(struct drm_i915_private *dev_priv, · 9314 unmodified lines
93159315 static void lpt_init_pch_refclk(struct drm_i915_private *dev_priv)
93169316 {
93179317 struct intel_encoder *encoder;
9318− bool pch_ssc_in_use = false;
93199318 bool has_fdi = false;
93209319
93219320 for_each_intel_encoder(&dev_priv->drm, encoder) {
@@ -9343,22 +9342,24 @@ static void lpt_init_pch_refclk(struct drm_i915_private *dev_priv) · 21 unmodified lines
93439342 * clock hierarchy. That would also allow us to do
93449343 * clock bending finally.
93459344 */
9345+ dev_priv->pch_ssc_use = 0;
9346+
93469347 if (spll_uses_pch_ssc(dev_priv)) {
93479348 DRM_DEBUG_KMS("SPLL using PCH SSC\n");
9348− pch_ssc_in_use = true;
9349+ dev_priv->pch_ssc_use |= BIT(DPLL_ID_SPLL);
93499350 }
93509351
93519352 if (wrpll_uses_pch_ssc(dev_priv, DPLL_ID_WRPLL1)) {
93529353 DRM_DEBUG_KMS("WRPLL1 using PCH SSC\n");
9353− pch_ssc_in_use = true;
9354+ dev_priv->pch_ssc_use |= BIT(DPLL_ID_WRPLL1);
93549355 }
93559356
93569357 if (wrpll_uses_pch_ssc(dev_priv, DPLL_ID_WRPLL2)) {
93579358 DRM_DEBUG_KMS("WRPLL2 using PCH SSC\n");
9358− pch_ssc_in_use = true;
9359+ dev_priv->pch_ssc_use |= BIT(DPLL_ID_WRPLL2);
93599360 }
93609361
9361− if (pch_ssc_in_use)
9362+ if (dev_priv->pch_ssc_use)
93629363 return;
93639364
93649365 if (has_fdi) {
drivers/gpu/drm/i915/display/intel_dp.c+11−1
@@ -1256,6 +1256,9 @@ static u32 skl_get_aux_send_ctl(struct intel_dp *intel_dp, · 1255 unmodified lines
12561256 u32 unused)
12571257 {
12581258 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
1259+ struct drm_i915_private *i915 =
1260+ to_i915(intel_dig_port->base.base.dev);
1261+ enum phy phy = intel_port_to_phy(i915, intel_dig_port->base.port);
12591262 u32 ret;
12601263
12611264 ret = DP_AUX_CH_CTL_SEND_BUSY |
@@ -1268,7 +1271,8 @@ static u32 skl_get_aux_send_ctl(struct intel_dp *intel_dp, · 6 unmodified lines
12681271 DP_AUX_CH_CTL_FW_SYNC_PULSE_SKL(32) |
12691272 DP_AUX_CH_CTL_SYNC_PULSE_SKL(32);
12701273
1271− if (intel_dig_port->tc_mode == TC_PORT_TBT_ALT)
1274+ if (intel_phy_is_tc(i915, phy) &&
1275+ intel_dig_port->tc_mode == TC_PORT_TBT_ALT)
12721276 ret |= DP_AUX_CH_CTL_TBT_IO;
12731277
12741278 return ret;
@@ -5436,6 +5440,12 @@ out: · 4161 unmodified lines
54365440 if (status != connector_status_connected && !intel_dp->is_mst)
54375441 intel_dp_unset_edid(intel_dp);
54385442
5443+ /*
5444+ * Make sure the refs for power wells enabled during detect are
5445+ * dropped to avoid a new detect cycle triggered by HPD polling.
5446+ */
5447+ intel_display_power_flush_work(dev_priv);
5448+
54395449 return status;
54405450 }
54415451
drivers/gpu/drm/i915/display/intel_dpll_mgr.c+15−0
@@ -525,16 +525,31 @@ static void hsw_ddi_wrpll_disable(struct drm_i915_private *dev_priv, · 524 unmodified lines
525525 val = I915_READ(WRPLL_CTL(id));
526526 I915_WRITE(WRPLL_CTL(id), val & ~WRPLL_PLL_ENABLE);
527527 POSTING_READ(WRPLL_CTL(id));
528+
529+ /*
530+ * Try to set up the PCH reference clock once all DPLLs
531+ * that depend on it have been shut down.
532+ */
533+ if (dev_priv->pch_ssc_use & BIT(id))
534+ intel_init_pch_refclk(dev_priv);
528535 }
529536
530537 static void hsw_ddi_spll_disable(struct drm_i915_private *dev_priv,
531538 struct intel_shared_dpll *pll)
532539 {
540+ enum intel_dpll_id id = pll->info->id;
533541 u32 val;
534542
535543 val = I915_READ(SPLL_CTL);
536544 I915_WRITE(SPLL_CTL, val & ~SPLL_PLL_ENABLE);
537545 POSTING_READ(SPLL_CTL);
546+
547+ /*
548+ * Try to set up the PCH reference clock once all DPLLs
549+ * that depend on it have been shut down.
550+ */
551+ if (dev_priv->pch_ssc_use & BIT(id))
552+ intel_init_pch_refclk(dev_priv);
538553 }
539554
540555 static bool hsw_ddi_wrpll_get_hw_state(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/display/intel_dpll_mgr.h+2−2
@@ -147,11 +147,11 @@ enum intel_dpll_id { · 146 unmodified lines
147147 */
148148 DPLL_ID_ICL_MGPLL4 = 6,
149149 /**
150− * @DPLL_ID_TGL_TCPLL5: TGL TC PLL port 5 (TC5)
150+ * @DPLL_ID_TGL_MGPLL5: TGL TC PLL port 5 (TC5)
151151 */
152152 DPLL_ID_TGL_MGPLL5 = 7,
153153 /**
154− * @DPLL_ID_TGL_TCPLL6: TGL TC PLL port 6 (TC6)
154+ * @DPLL_ID_TGL_MGPLL6: TGL TC PLL port 6 (TC6)
155155 */
156156 DPLL_ID_TGL_MGPLL6 = 8,
157157 };
drivers/gpu/drm/i915/display/intel_hdmi.c+6−0
@@ -2565,6 +2565,12 @@ out: · 2564 unmodified lines
25652565 if (status != connector_status_connected)
25662566 cec_notifier_phys_addr_invalidate(intel_hdmi->cec_notifier);
25672567
2568+ /*
2569+ * Make sure the refs for power wells enabled during detect are
2570+ * dropped to avoid a new detect cycle triggered by HPD polling.
2571+ */
2572+ intel_display_power_flush_work(dev_priv);
2573+
25682574 return status;
25692575 }
25702576
drivers/gpu/drm/i915/i915_drv.h+2−0
@@ -1723,6 +1723,8 @@ struct drm_i915_private { · 1722 unmodified lines
17231723 struct work_struct idle_work;
17241724 } gem;
17251725
1726+ u8 pch_ssc_use;
1727+
17261728 /* For i945gm vblank irq vs. C3 workaround */
17271729 struct {
17281730 struct work_struct work;
drivers/gpu/drm/panfrost/panfrost_drv.c+1−1
@@ -556,11 +556,11 @@ static int panfrost_probe(struct platform_device *pdev) · 555 unmodified lines
556556 return 0;
557557
558558 err_out2:
559+ pm_runtime_disable(pfdev->dev);
559560 panfrost_devfreq_fini(pfdev);
560561 err_out1:
561562 panfrost_device_fini(pfdev);
562563 err_out0:
563− pm_runtime_disable(pfdev->dev);
564564 drm_dev_put(ddev);
565565 return err;
566566 }
drivers/gpu/drm/panfrost/panfrost_mmu.c+8−7
@@ -224,9 +224,9 @@ static size_t get_pgsize(u64 addr, size_t size) · 223 unmodified lines
224224 return SZ_2M;
225225 }
226226
227−void panfrost_mmu_flush_range(struct panfrost_device *pfdev,
228− struct panfrost_mmu *mmu,
229− u64 iova, size_t size)
227+static void panfrost_mmu_flush_range(struct panfrost_device *pfdev,
228+ struct panfrost_mmu *mmu,
229+ u64 iova, size_t size)
230230 {
231231 if (mmu->as < 0)
232232 return;
@@ -406,11 +406,11 @@ addr_to_drm_mm_node(struct panfrost_device *pfdev, int as, u64 addr) · 173 unmodified lines
406406 spin_lock(&pfdev->as_lock);
407407 list_for_each_entry(mmu, &pfdev->as_lru_list, list) {
408408 if (as == mmu->as)
409− break;
409+ goto found_mmu;
410410 }
411− if (as != mmu->as)
412− goto out;
411+ goto out;
413412
413+found_mmu:
414414 priv = container_of(mmu, struct panfrost_file_priv, mmu);
415415
416416 spin_lock(&priv->mm_lock);
@@ -432,7 +432,8 @@ out: · 15 unmodified lines
432432
433433 #define NUM_FAULT_PAGES (SZ_2M / PAGE_SIZE)
434434
435−int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, u64 addr)
435+static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as,
436+ u64 addr)
436437 {
437438 int ret, i;
438439 struct panfrost_gem_object *bo;
drivers/gpu/drm/panfrost/panfrost_perfcnt.c+1−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include "panfrost_issues.h"
1717 #include "panfrost_job.h"
1818 #include "panfrost_mmu.h"
19+#include "panfrost_perfcnt.h"
1920 #include "panfrost_regs.h"
2021
2122 #define COUNTERS_PER_BLOCK 64
drivers/gpu/drm/radeon/radeon_drv.c+14−0
@@ -379,11 +379,25 @@ radeon_pci_remove(struct pci_dev *pdev) · 378 unmodified lines
379379 static void
380380 radeon_pci_shutdown(struct pci_dev *pdev)
381381 {
382+#ifdef CONFIG_PPC64
383+ struct drm_device *ddev = pci_get_drvdata(pdev);
384+#endif
385+
382386 /* if we are running in a VM, make sure the device
383387 * torn down properly on reboot/shutdown
384388 */
385389 if (radeon_device_is_virtual())
386390 radeon_pci_remove(pdev);
391+
392+#ifdef CONFIG_PPC64
393+ /* Some adapters need to be suspended before a
394+ * shutdown occurs in order to prevent an error
395+ * during kexec.
396+ * Make this power specific becauase it breaks
397+ * some non-power boards.
398+ */
399+ radeon_suspend_kms(ddev, true, true, false);
400+#endif
387401 }
388402
389403 static int radeon_pmops_suspend(struct device *dev)
drivers/gpu/drm/radeon/si_dpm.c+1−0
@@ -1958,6 +1958,7 @@ static void si_initialize_powertune_defaults(struct radeon_device *rdev) · 1957 unmodified lines
19581958 case 0x682C:
19591959 si_pi->cac_weights = cac_weights_cape_verde_pro;
19601960 si_pi->dte_data = dte_data_sun_xt;
1961+ update_dte_from_pl2 = true;
19611962 break;
19621963 case 0x6825:
19631964 case 0x6827:
drivers/gpu/drm/scheduler/sched_main.c+16−3
@@ -479,6 +479,7 @@ void drm_sched_resubmit_jobs(struct drm_gpu_scheduler *sched) · 478 unmodified lines
479479 struct drm_sched_job *s_job, *tmp;
480480 uint64_t guilty_context;
481481 bool found_guilty = false;
482+ struct dma_fence *fence;
482483
483484 list_for_each_entry_safe(s_job, tmp, &sched->ring_mirror_list, node) {
484485 struct drm_sched_fence *s_fence = s_job->s_fence;
@@ -492,7 +493,16 @@ void drm_sched_resubmit_jobs(struct drm_gpu_scheduler *sched) · 7 unmodified lines
492493 dma_fence_set_error(&s_fence->finished, -ECANCELED);
493494
494495 dma_fence_put(s_job->s_fence->parent);
495− s_job->s_fence->parent = sched->ops->run_job(s_job);
496+ fence = sched->ops->run_job(s_job);
497+
498+ if (IS_ERR_OR_NULL(fence)) {
499+ s_job->s_fence->parent = NULL;
500+ dma_fence_set_error(&s_fence->finished, PTR_ERR(fence));
501+ } else {
502+ s_job->s_fence->parent = fence;
503+ }
504+
505+
496506 }
497507 }
498508 EXPORT_SYMBOL(drm_sched_resubmit_jobs);
@@ -720,7 +730,7 @@ static int drm_sched_main(void *param) · 221 unmodified lines
720730 fence = sched->ops->run_job(sched_job);
721731 drm_sched_fence_scheduled(s_fence);
722732
723− if (fence) {
733+ if (!IS_ERR_OR_NULL(fence)) {
724734 s_fence->parent = dma_fence_get(fence);
725735 r = dma_fence_add_callback(fence, &sched_job->cb,
726736 drm_sched_process_job);
@@ -730,8 +740,11 @@ static int drm_sched_main(void *param) · 3 unmodified lines
730740 DRM_ERROR("fence add callback failed (%d)\n",
731741 r);
732742 dma_fence_put(fence);
733− } else
743+ } else {
744+
745+ dma_fence_set_error(&s_fence->finished, PTR_ERR(fence));
734746 drm_sched_process_job(NULL, &sched_job->cb);
747+ }
735748
736749 wake_up(&sched->job_scheduled);
737750 }
drivers/gpu/drm/v3d/v3d_gem.c+4−1
@@ -557,13 +557,16 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data, · 556 unmodified lines
557557
558558 if (args->bcl_start != args->bcl_end) {
559559 bin = kcalloc(1, sizeof(*bin), GFP_KERNEL);
560− if (!bin)
560+ if (!bin) {
561+ v3d_job_put(&render->base);
561562 return -ENOMEM;
563+ }
562564
563565 ret = v3d_job_init(v3d, file_priv, &bin->base,
564566 v3d_job_free, args->in_sync_bcl);
565567 if (ret) {
566568 v3d_job_put(&render->base);
569+ kfree(bin);
567570 return ret;
568571 }
569572
drivers/hid/hid-axff.c+9−2
@@ -63,13 +63,20 @@ static int axff_init(struct hid_device *hid) · 62 unmodified lines
6363 {
6464 struct axff_device *axff;
6565 struct hid_report *report;
66− struct hid_input *hidinput = list_first_entry(&hid->inputs, struct hid_input, list);
66+ struct hid_input *hidinput;
6767 struct list_head *report_list =&hid->report_enum[HID_OUTPUT_REPORT].report_list;
68− struct input_dev *dev = hidinput->input;
68+ struct input_dev *dev;
6969 int field_count = 0;
7070 int i, j;
7171 int error;
7272
73+ if (list_empty(&hid->inputs)) {
74+ hid_err(hid, "no inputs found\n");
75+ return -ENODEV;
76+ }
77+ hidinput = list_first_entry(&hid->inputs, struct hid_input, list);
78+ dev = hidinput->input;
79+
7380 if (list_empty(report_list)) {
7481 hid_err(hid, "no output reports found\n");
7582 return -ENODEV;
drivers/hid/hid-core.c+5−2
@@ -1139,6 +1139,7 @@ int hid_open_report(struct hid_device *device) · 1138 unmodified lines
11391139 __u8 *start;
11401140 __u8 *buf;
11411141 __u8 *end;
1142+ __u8 *next;
11421143 int ret;
11431144 static int (*dispatch_type[])(struct hid_parser *parser,
11441145 struct hid_item *item) = {
@@ -1192,7 +1193,8 @@ int hid_open_report(struct hid_device *device) · 47 unmodified lines
11921193 device->collection_size = HID_DEFAULT_NUM_COLLECTIONS;
11931194
11941195 ret = -EINVAL;
1195− while ((start = fetch_item(start, end, &item)) != NULL) {
1196+ while ((next = fetch_item(start, end, &item)) != NULL) {
1197+ start = next;
11961198
11971199 if (item.format != HID_ITEM_FORMAT_SHORT) {
11981200 hid_err(device, "unexpected long global item\n");
@@ -1230,7 +1232,8 @@ int hid_open_report(struct hid_device *device) · 31 unmodified lines
12301232 }
12311233 }
12321234
1233− hid_err(device, "item fetching failed at offset %d\n", (int)(end - start));
1235+ hid_err(device, "item fetching failed at offset %u/%u\n",
1236+ size - (unsigned int)(end - start), size);
12341237 err:
12351238 kfree(parser->collection_stack);
12361239 alloc_err:
drivers/hid/hid-dr.c+9−3
@@ -75,13 +75,19 @@ static int drff_init(struct hid_device *hid) · 74 unmodified lines
7575 {
7676 struct drff_device *drff;
7777 struct hid_report *report;
78− struct hid_input *hidinput = list_first_entry(&hid->inputs,
79− struct hid_input, list);
78+ struct hid_input *hidinput;
8079 struct list_head *report_list =
8180 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
82− struct input_dev *dev = hidinput->input;
81+ struct input_dev *dev;
8382 int error;
8483
84+ if (list_empty(&hid->inputs)) {
85+ hid_err(hid, "no inputs found\n");
86+ return -ENODEV;
87+ }
88+ hidinput = list_first_entry(&hid->inputs, struct hid_input, list);
89+ dev = hidinput->input;
90+
8591 if (list_empty(report_list)) {
8692 hid_err(hid, "no output reports found\n");
8793 return -ENODEV;
drivers/hid/hid-emsff.c+9−3
@@ -47,13 +47,19 @@ static int emsff_init(struct hid_device *hid) · 46 unmodified lines
4747 {
4848 struct emsff_device *emsff;
4949 struct hid_report *report;
50− struct hid_input *hidinput = list_first_entry(&hid->inputs,
51− struct hid_input, list);
50+ struct hid_input *hidinput;
5251 struct list_head *report_list =
5352 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
54− struct input_dev *dev = hidinput->input;
53+ struct input_dev *dev;
5554 int error;
5655
56+ if (list_empty(&hid->inputs)) {
57+ hid_err(hid, "no inputs found\n");
58+ return -ENODEV;
59+ }
60+ hidinput = list_first_entry(&hid->inputs, struct hid_input, list);
61+ dev = hidinput->input;
62+
5763 if (list_empty(report_list)) {
5864 hid_err(hid, "no output reports found\n");
5965 return -ENODEV;
drivers/hid/hid-gaff.c+9−3
@@ -64,14 +64,20 @@ static int gaff_init(struct hid_device *hid) · 63 unmodified lines
6464 {
6565 struct gaff_device *gaff;
6666 struct hid_report *report;
67− struct hid_input *hidinput = list_entry(hid->inputs.next,
68− struct hid_input, list);
67+ struct hid_input *hidinput;
6968 struct list_head *report_list =
7069 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
7170 struct list_head *report_ptr = report_list;
72− struct input_dev *dev = hidinput->input;
71+ struct input_dev *dev;
7372 int error;
7473
74+ if (list_empty(&hid->inputs)) {
75+ hid_err(hid, "no inputs found\n");
76+ return -ENODEV;
77+ }
78+ hidinput = list_entry(hid->inputs.next, struct hid_input, list);
79+ dev = hidinput->input;
80+
7581 if (list_empty(report_list)) {
7682 hid_err(hid, "no output reports found\n");
7783 return -ENODEV;
drivers/hid/hid-google-hammer.c+4−0
@@ -469,6 +469,10 @@ static int hammer_probe(struct hid_device *hdev, · 468 unmodified lines
469469 static const struct hid_device_id hammer_devices[] = {
470470 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
471471 USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_HAMMER) },
472+ { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
473+ USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_MAGNEMITE) },
474+ { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
475+ USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_MASTERBALL) },
472476 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
473477 USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_STAFF) },
474478 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
drivers/hid/hid-holtekff.c+9−3
@@ -124,13 +124,19 @@ static int holtekff_init(struct hid_device *hid) · 123 unmodified lines
124124 {
125125 struct holtekff_device *holtekff;
126126 struct hid_report *report;
127− struct hid_input *hidinput = list_entry(hid->inputs.next,
128− struct hid_input, list);
127+ struct hid_input *hidinput;
129128 struct list_head *report_list =
130129 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
131− struct input_dev *dev = hidinput->input;
130+ struct input_dev *dev;
132131 int error;
133132
133+ if (list_empty(&hid->inputs)) {
134+ hid_err(hid, "no inputs found\n");
135+ return -ENODEV;
136+ }
137+ hidinput = list_entry(hid->inputs.next, struct hid_input, list);
138+ dev = hidinput->input;
139+
134140 if (list_empty(report_list)) {
135141 hid_err(hid, "no output report found\n");
136142 return -ENODEV;
drivers/hid/hid-ids.h+2−0
@@ -476,6 +476,8 @@ · 475 unmodified lines
476476 #define USB_DEVICE_ID_GOOGLE_STAFF 0x502b
477477 #define USB_DEVICE_ID_GOOGLE_WAND 0x502d
478478 #define USB_DEVICE_ID_GOOGLE_WHISKERS 0x5030
479+#define USB_DEVICE_ID_GOOGLE_MASTERBALL 0x503c
480+#define USB_DEVICE_ID_GOOGLE_MAGNEMITE 0x503d
479481
480482 #define USB_VENDOR_ID_GOTOP 0x08f2
481483 #define USB_DEVICE_ID_SUPER_Q2 0x007f
drivers/hid/hid-lg2ff.c+9−3
@@ -50,11 +50,17 @@ int lg2ff_init(struct hid_device *hid) · 49 unmodified lines
5050 {
5151 struct lg2ff_device *lg2ff;
5252 struct hid_report *report;
53− struct hid_input *hidinput = list_entry(hid->inputs.next,
54− struct hid_input, list);
55− struct input_dev *dev = hidinput->input;
53+ struct hid_input *hidinput;
54+ struct input_dev *dev;
5655 int error;
5756
57+ if (list_empty(&hid->inputs)) {
58+ hid_err(hid, "no inputs found\n");
59+ return -ENODEV;
60+ }
61+ hidinput = list_entry(hid->inputs.next, struct hid_input, list);
62+ dev = hidinput->input;
63+
5864 /* Check that the report looks ok */
5965 report = hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 7);
6066 if (!report)
drivers/hid/hid-lg3ff.c+9−2
@@ -117,12 +117,19 @@ static const signed short ff3_joystick_ac[] = { · 116 unmodified lines
117117
118118 int lg3ff_init(struct hid_device *hid)
119119 {
120− struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list);
121− struct input_dev *dev = hidinput->input;
120+ struct hid_input *hidinput;
121+ struct input_dev *dev;
122122 const signed short *ff_bits = ff3_joystick_ac;
123123 int error;
124124 int i;
125125
126+ if (list_empty(&hid->inputs)) {
127+ hid_err(hid, "no inputs found\n");
128+ return -ENODEV;
129+ }
130+ hidinput = list_entry(hid->inputs.next, struct hid_input, list);
131+ dev = hidinput->input;
132+
126133 /* Check that the report looks ok */
127134 if (!hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 35))
128135 return -ENODEV;
drivers/hid/hid-lg4ff.c+9−2
@@ -1253,8 +1253,8 @@ static int lg4ff_handle_multimode_wheel(struct hid_device *hid, u16 *real_produc · 1252 unmodified lines
12531253
12541254 int lg4ff_init(struct hid_device *hid)
12551255 {
1256− struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list);
1257− struct input_dev *dev = hidinput->input;
1256+ struct hid_input *hidinput;
1257+ struct input_dev *dev;
12581258 struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;
12591259 struct hid_report *report = list_entry(report_list->next, struct hid_report, list);
12601260 const struct usb_device_descriptor *udesc = &(hid_to_usb_dev(hid)->descriptor);
@@ -1266,6 +1266,13 @@ int lg4ff_init(struct hid_device *hid) · 5 unmodified lines
12661266 int mmode_ret, mmode_idx = -1;
12671267 u16 real_product_id;
12681268
1269+ if (list_empty(&hid->inputs)) {
1270+ hid_err(hid, "no inputs found\n");
1271+ return -ENODEV;
1272+ }
1273+ hidinput = list_entry(hid->inputs.next, struct hid_input, list);
1274+ dev = hidinput->input;
1275+
12691276 /* Check that the report looks ok */
12701277 if (!hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 7))
12711278 return -1;
drivers/hid/hid-lgff.c+9−2
@@ -115,12 +115,19 @@ static void hid_lgff_set_autocenter(struct input_dev *dev, u16 magnitude) · 114 unmodified lines
115115
116116 int lgff_init(struct hid_device* hid)
117117 {
118− struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list);
119− struct input_dev *dev = hidinput->input;
118+ struct hid_input *hidinput;
119+ struct input_dev *dev;
120120 const signed short *ff_bits = ff_joystick;
121121 int error;
122122 int i;
123123
124+ if (list_empty(&hid->inputs)) {
125+ hid_err(hid, "no inputs found\n");
126+ return -ENODEV;
127+ }
128+ hidinput = list_entry(hid->inputs.next, struct hid_input, list);
129+ dev = hidinput->input;
130+
124131 /* Check that the report looks ok */
125132 if (!hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 7))
126133 return -ENODEV;
drivers/hid/hid-logitech-hidpp.c+140−108
@@ -1669,6 +1669,7 @@ static void hidpp_touchpad_raw_xy_event(struct hidpp_device *hidpp_dev, · 1668 unmodified lines
16691669
16701670 #define HIDPP_FF_EFFECTID_NONE -1
16711671 #define HIDPP_FF_EFFECTID_AUTOCENTER -2
1672+#define HIDPP_AUTOCENTER_PARAMS_LENGTH 18
16721673
16731674 #define HIDPP_FF_MAX_PARAMS 20
16741675 #define HIDPP_FF_RESERVED_SLOTS 1
@@ -2009,7 +2010,7 @@ static int hidpp_ff_erase_effect(struct input_dev *dev, int effect_id) · 334 unmodified lines
20092010 static void hidpp_ff_set_autocenter(struct input_dev *dev, u16 magnitude)
20102011 {
20112012 struct hidpp_ff_private_data *data = dev->ff->private;
2012− u8 params[18];
2013+ u8 params[HIDPP_AUTOCENTER_PARAMS_LENGTH];
20132014
20142015 dbg_hid("Setting autocenter to %d.\n", magnitude);
20152016
@@ -2077,23 +2078,34 @@ static DEVICE_ATTR(range, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH, hidpp · 61 unmodified lines
20772078 static void hidpp_ff_destroy(struct ff_device *ff)
20782079 {
20792080 struct hidpp_ff_private_data *data = ff->private;
2081+ struct hid_device *hid = data->hidpp->hid_dev;
20802082
2083+ hid_info(hid, "Unloading HID++ force feedback.\n");
2084+
2085+ device_remove_file(&hid->dev, &dev_attr_range);
2086+ destroy_workqueue(data->wq);
20812087 kfree(data->effect_ids);
20822088 }
20832089
2084−static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index)
2090+static int hidpp_ff_init(struct hidpp_device *hidpp,
2091+ struct hidpp_ff_private_data *data)
20852092 {
20862093 struct hid_device *hid = hidpp->hid_dev;
2087− struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list);
2088− struct input_dev *dev = hidinput->input;
2094+ struct hid_input *hidinput;
2095+ struct input_dev *dev;
20892096 const struct usb_device_descriptor *udesc = &(hid_to_usb_dev(hid)->descriptor);
20902097 const u16 bcdDevice = le16_to_cpu(udesc->bcdDevice);
20912098 struct ff_device *ff;
2092− struct hidpp_report response;
2093− struct hidpp_ff_private_data *data;
2094− int error, j, num_slots;
2099+ int error, j, num_slots = data->num_effects;
20952100 u8 version;
20962101
2102+ if (list_empty(&hid->inputs)) {
2103+ hid_err(hid, "no inputs found\n");
2104+ return -ENODEV;
2105+ }
2106+ hidinput = list_entry(hid->inputs.next, struct hid_input, list);
2107+ dev = hidinput->input;
2108+
20972109 if (!dev) {
20982110 hid_err(hid, "Struct input_dev not set!\n");
20992111 return -EINVAL;
@@ -2109,27 +2121,17 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index) · 9 unmodified lines
21092121 for (j = 0; hidpp_ff_effects_v2[j] >= 0; j++)
21102122 set_bit(hidpp_ff_effects_v2[j], dev->ffbit);
21112123
2112− /* Read number of slots available in device */
2113− error = hidpp_send_fap_command_sync(hidpp, feature_index,
2114− HIDPP_FF_GET_INFO, NULL, 0, &response);
2115− if (error) {
2116− if (error < 0)
2117− return error;
2118− hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n",
2119− __func__, error);
2120− return -EPROTO;
2121− }
2122−
2123− num_slots = response.fap.params[0] - HIDPP_FF_RESERVED_SLOTS;
2124−
21252124 error = input_ff_create(dev, num_slots);
21262125
21272126 if (error) {
21282127 hid_err(dev, "Failed to create FF device!\n");
21292128 return error;
21302129 }
2131−
2132− data = kzalloc(sizeof(*data), GFP_KERNEL);
2130+ /*
2131+ * Create a copy of passed data, so we can transfer memory
2132+ * ownership to FF core
2133+ */
2134+ data = kmemdup(data, sizeof(*data), GFP_KERNEL);
21332135 if (!data)
21342136 return -ENOMEM;
21352137 data->effect_ids = kcalloc(num_slots, sizeof(int), GFP_KERNEL);
@@ -2145,10 +2147,7 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index) · 9 unmodified lines
21452147 }
21462148
21472149 data->hidpp = hidpp;
2148− data->feature_index = feature_index;
21492150 data->version = version;
2150− data->slot_autocenter = 0;
2151− data->num_effects = num_slots;
21522151 for (j = 0; j < num_slots; j++)
21532152 data->effect_ids[j] = -1;
21542153
@@ -2162,68 +2161,20 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index) · 7 unmodified lines
21622161 ff->set_autocenter = hidpp_ff_set_autocenter;
21632162 ff->destroy = hidpp_ff_destroy;
21642163
2165−
2166− /* reset all forces */
2167− error = hidpp_send_fap_command_sync(hidpp, feature_index,
2168− HIDPP_FF_RESET_ALL, NULL, 0, &response);
2169−
2170− /* Read current Range */
2171− error = hidpp_send_fap_command_sync(hidpp, feature_index,
2172− HIDPP_FF_GET_APERTURE, NULL, 0, &response);
2173− if (error)
2174− hid_warn(hidpp->hid_dev, "Failed to read range from device!\n");
2175− data->range = error ? 900 : get_unaligned_be16(&response.fap.params[0]);
2176−
21772164 /* Create sysfs interface */
21782165 error = device_create_file(&(hidpp->hid_dev->dev), &dev_attr_range);
21792166 if (error)
21802167 hid_warn(hidpp->hid_dev, "Unable to create sysfs interface for \"range\", errno %d!\n", error);
21812168
2182− /* Read the current gain values */
2183− error = hidpp_send_fap_command_sync(hidpp, feature_index,
2184− HIDPP_FF_GET_GLOBAL_GAINS, NULL, 0, &response);
2185− if (error)
2186− hid_warn(hidpp->hid_dev, "Failed to read gain values from device!\n");
2187− data->gain = error ? 0xffff : get_unaligned_be16(&response.fap.params[0]);
2188− /* ignore boost value at response.fap.params[2] */
2189−
21902169 /* init the hardware command queue */
21912170 atomic_set(&data->workqueue_size, 0);
21922171
2193− /* initialize with zero autocenter to get wheel in usable state */
2194− hidpp_ff_set_autocenter(dev, 0);
2195−
21962172 hid_info(hid, "Force feedback support loaded (firmware release %d).\n",
21972173 version);
21982174
21992175 return 0;
22002176 }
22012177
2202−static int hidpp_ff_deinit(struct hid_device *hid)
2203−{
2204− struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list);
2205− struct input_dev *dev = hidinput->input;
2206− struct hidpp_ff_private_data *data;
2207−
2208− if (!dev) {
2209− hid_err(hid, "Struct input_dev not found!\n");
2210− return -EINVAL;
2211− }
2212−
2213− hid_info(hid, "Unloading HID++ force feedback.\n");
2214− data = dev->ff->private;
2215− if (!data) {
2216− hid_err(hid, "Private data not found!\n");
2217− return -EINVAL;
2218− }
2219−
2220− destroy_workqueue(data->wq);
2221− device_remove_file(&hid->dev, &dev_attr_range);
2222−
2223− return 0;
2224−}
2225−
2226−
22272178 /* ************************************************************************** */
22282179 /* */
22292180 /* Device Support */
@@ -2725,24 +2676,93 @@ static int k400_connect(struct hid_device *hdev, bool connected) · 495 unmodified lines
27252676
27262677 #define HIDPP_PAGE_G920_FORCE_FEEDBACK 0x8123
27272678
2728−static int g920_get_config(struct hidpp_device *hidpp)
2679+static int g920_ff_set_autocenter(struct hidpp_device *hidpp,
2680+ struct hidpp_ff_private_data *data)
27292681 {
2682+ struct hidpp_report response;
2683+ u8 params[HIDPP_AUTOCENTER_PARAMS_LENGTH] = {
2684+ [1] = HIDPP_FF_EFFECT_SPRING | HIDPP_FF_EFFECT_AUTOSTART,
2685+ };
2686+ int ret;
2687+
2688+ /* initialize with zero autocenter to get wheel in usable state */
2689+
2690+ dbg_hid("Setting autocenter to 0.\n");
2691+ ret = hidpp_send_fap_command_sync(hidpp, data->feature_index,
2692+ HIDPP_FF_DOWNLOAD_EFFECT,
2693+ params, ARRAY_SIZE(params),
2694+ &response);
2695+ if (ret)
2696+ hid_warn(hidpp->hid_dev, "Failed to autocenter device!\n");
2697+ else
2698+ data->slot_autocenter = response.fap.params[0];
2699+
2700+ return ret;
2701+}
2702+
2703+static int g920_get_config(struct hidpp_device *hidpp,
2704+ struct hidpp_ff_private_data *data)
2705+{
2706+ struct hidpp_report response;
27302707 u8 feature_type;
2731− u8 feature_index;
27322708 int ret;
27332709
2710+ memset(data, 0, sizeof(*data));
2711+
27342712 /* Find feature and store for later use */
27352713 ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_G920_FORCE_FEEDBACK,
2736− &feature_index, &feature_type);
2714+ &data->feature_index, &feature_type);
27372715 if (ret)
27382716 return ret;
27392717
2740− ret = hidpp_ff_init(hidpp, feature_index);
2718+ /* Read number of slots available in device */
2719+ ret = hidpp_send_fap_command_sync(hidpp, data->feature_index,
2720+ HIDPP_FF_GET_INFO,
2721+ NULL, 0,
2722+ &response);
2723+ if (ret) {
2724+ if (ret < 0)
2725+ return ret;
2726+ hid_err(hidpp->hid_dev,
2727+ "%s: received protocol error 0x%02x\n", __func__, ret);
2728+ return -EPROTO;
2729+ }
2730+
2731+ data->num_effects = response.fap.params[0] - HIDPP_FF_RESERVED_SLOTS;
2732+
2733+ /* reset all forces */
2734+ ret = hidpp_send_fap_command_sync(hidpp, data->feature_index,
2735+ HIDPP_FF_RESET_ALL,
2736+ NULL, 0,
2737+ &response);
27412738 if (ret)
2742− hid_warn(hidpp->hid_dev, "Unable to initialize force feedback support, errno %d\n",
2743− ret);
2739+ hid_warn(hidpp->hid_dev, "Failed to reset all forces!\n");
27442740
2745− return 0;
2741+ ret = hidpp_send_fap_command_sync(hidpp, data->feature_index,
2742+ HIDPP_FF_GET_APERTURE,
2743+ NULL, 0,
2744+ &response);
2745+ if (ret) {
2746+ hid_warn(hidpp->hid_dev,
2747+ "Failed to read range from device!\n");
2748+ }
2749+ data->range = ret ?
2750+ 900 : get_unaligned_be16(&response.fap.params[0]);
2751+
2752+ /* Read the current gain values */
2753+ ret = hidpp_send_fap_command_sync(hidpp, data->feature_index,
2754+ HIDPP_FF_GET_GLOBAL_GAINS,
2755+ NULL, 0,
2756+ &response);
2757+ if (ret)
2758+ hid_warn(hidpp->hid_dev,
2759+ "Failed to read gain values from device!\n");
2760+ data->gain = ret ?
2761+ 0xffff : get_unaligned_be16(&response.fap.params[0]);
2762+
2763+ /* ignore boost value at response.fap.params[2] */
2764+
2765+ return g920_ff_set_autocenter(hidpp, data);
27462766 }
27472767
27482768 /* -------------------------------------------------------------------------- */
@@ -3458,34 +3478,45 @@ static int hidpp_get_report_length(struct hid_device *hdev, int id) · 709 unmodified lines
34583478 return report->field[0]->report_count + 1;
34593479 }
34603480
3461−static bool hidpp_validate_report(struct hid_device *hdev, int id,
3462− int expected_length, bool optional)
3481+static bool hidpp_validate_device(struct hid_device *hdev)
34633482 {
3464− int report_length;
3483+ struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3484+ int id, report_length, supported_reports = 0;
34653485
3466− if (id >= HID_MAX_IDS || id < 0) {
3467− hid_err(hdev, "invalid HID report id %u\n", id);
3468− return false;
3486+ id = REPORT_ID_HIDPP_SHORT;
3487+ report_length = hidpp_get_report_length(hdev, id);
3488+ if (report_length) {
3489+ if (report_length < HIDPP_REPORT_SHORT_LENGTH)
3490+ goto bad_device;
3491+
3492+ supported_reports++;
34693493 }
34703494
3495+ id = REPORT_ID_HIDPP_LONG;
34713496 report_length = hidpp_get_report_length(hdev, id);
3472− if (!report_length)
3473− return optional;
3497+ if (report_length) {
3498+ if (report_length < HIDPP_REPORT_LONG_LENGTH)
3499+ goto bad_device;
34743500
3475− if (report_length < expected_length) {
3476− hid_warn(hdev, "not enough values in hidpp report %d\n", id);
3477− return false;
3501+ supported_reports++;
34783502 }
34793503
3480− return true;
3481−}
3504+ id = REPORT_ID_HIDPP_VERY_LONG;
3505+ report_length = hidpp_get_report_length(hdev, id);
3506+ if (report_length) {
3507+ if (report_length < HIDPP_REPORT_LONG_LENGTH ||
3508+ report_length > HIDPP_REPORT_VERY_LONG_MAX_LENGTH)
3509+ goto bad_device;
34823510
3483−static bool hidpp_validate_device(struct hid_device *hdev)
3484−{
3485− return hidpp_validate_report(hdev, REPORT_ID_HIDPP_SHORT,
3486− HIDPP_REPORT_SHORT_LENGTH, false) &&
3487− hidpp_validate_report(hdev, REPORT_ID_HIDPP_LONG,
3488− HIDPP_REPORT_LONG_LENGTH, true);
3511+ supported_reports++;
3512+ hidpp->very_long_report_length = report_length;
3513+ }
3514+
3515+ return supported_reports;
3516+
3517+bad_device:
3518+ hid_warn(hdev, "not enough values in hidpp report %d\n", id);
3519+ return false;
34893520 }
34903521
34913522 static bool hidpp_application_equals(struct hid_device *hdev,
@@ -3505,6 +3536,7 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) · 13 unmodified lines
35053536 int ret;
35063537 bool connected;
35073538 unsigned int connect_mask = HID_CONNECT_DEFAULT;
3539+ struct hidpp_ff_private_data data;
35083540
35093541 /* report_fixup needs drvdata to be set before we call hid_parse */
35103542 hidpp = devm_kzalloc(&hdev->dev, sizeof(*hidpp), GFP_KERNEL);
@@ -3531,11 +3563,6 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) · 20 unmodified lines
35313563 return hid_hw_start(hdev, HID_CONNECT_DEFAULT);
35323564 }
35333565
3534− hidpp->very_long_report_length =
3535− hidpp_get_report_length(hdev, REPORT_ID_HIDPP_VERY_LONG);
3536− if (hidpp->very_long_report_length > HIDPP_REPORT_VERY_LONG_MAX_LENGTH)
3537− hidpp->very_long_report_length = HIDPP_REPORT_VERY_LONG_MAX_LENGTH;
3538−
35393566 if (id->group == HID_GROUP_LOGITECH_DJ_DEVICE)
35403567 hidpp->quirks |= HIDPP_QUIRK_UNIFYING;
35413568
@@ -3614,7 +3641,7 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) · 72 unmodified lines
36143641 if (ret)
36153642 goto hid_hw_init_fail;
36163643 } else if (connected && (hidpp->quirks & HIDPP_QUIRK_CLASS_G920)) {
3617− ret = g920_get_config(hidpp);
3644+ ret = g920_get_config(hidpp, &data);
36183645 if (ret)
36193646 goto hid_hw_init_fail;
36203647 }
@@ -3636,6 +3663,14 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) · 15 unmodified lines
36363663 goto hid_hw_start_fail;
36373664 }
36383665
3666+ if (hidpp->quirks & HIDPP_QUIRK_CLASS_G920) {
3667+ ret = hidpp_ff_init(hidpp, &data);
3668+ if (ret)
3669+ hid_warn(hidpp->hid_dev,
3670+ "Unable to initialize force feedback support, errno %d\n",
3671+ ret);
3672+ }
3673+
36393674 return ret;
36403675
36413676 hid_hw_init_fail:
@@ -3658,9 +3693,6 @@ static void hidpp_remove(struct hid_device *hdev) · 16 unmodified lines
36583693
36593694 sysfs_remove_group(&hdev->dev.kobj, &ps_attribute_group);
36603695
3661− if (hidpp->quirks & HIDPP_QUIRK_CLASS_G920)
3662− hidpp_ff_deinit(hdev);
3663−
36643696 hid_hw_stop(hdev);
36653697 cancel_work_sync(&hidpp->work);
36663698 mutex_destroy(&hidpp->send_mutex);
drivers/hid/hid-microsoft.c+9−3
@@ -328,11 +328,17 @@ static int ms_play_effect(struct input_dev *dev, void *data, · 327 unmodified lines
328328
329329 static int ms_init_ff(struct hid_device *hdev)
330330 {
331− struct hid_input *hidinput = list_entry(hdev->inputs.next,
332− struct hid_input, list);
333− struct input_dev *input_dev = hidinput->input;
331+ struct hid_input *hidinput;
332+ struct input_dev *input_dev;
334333 struct ms_data *ms = hid_get_drvdata(hdev);
335334
335+ if (list_empty(&hdev->inputs)) {
336+ hid_err(hdev, "no inputs found\n");
337+ return -ENODEV;
338+ }
339+ hidinput = list_entry(hdev->inputs.next, struct hid_input, list);
340+ input_dev = hidinput->input;
341+
336342 if (!(ms->quirks & MS_QUIRK_FF))
337343 return 0;
338344
drivers/hid/hid-prodikeys.c+2−2
@@ -516,7 +516,7 @@ static void pcmidi_setup_extra_keys( · 515 unmodified lines
516516 MY PICTURES => KEY_WORDPROCESSOR
517517 MY MUSIC=> KEY_SPREADSHEET
518518 */
519− unsigned int keys[] = {
519+ static const unsigned int keys[] = {
520520 KEY_FN,
521521 KEY_MESSENGER, KEY_CALENDAR,
522522 KEY_ADDRESSBOOK, KEY_DOCUMENTS,
@@ -532,7 +532,7 @@ static void pcmidi_setup_extra_keys( · 9 unmodified lines
532532 0
533533 };
534534
535− unsigned int *pkeys = &keys[0];
535+ const unsigned int *pkeys = &keys[0];
536536 unsigned short i;
537537
538538 if (pm->ifnum != 1) /* only set up ONCE for interace 1 */
drivers/hid/hid-sony.c+9−3
@@ -2254,9 +2254,15 @@ static int sony_play_effect(struct input_dev *dev, void *data, · 2253 unmodified lines
22542254
22552255 static int sony_init_ff(struct sony_sc *sc)
22562256 {
2257− struct hid_input *hidinput = list_entry(sc->hdev->inputs.next,
2258− struct hid_input, list);
2259− struct input_dev *input_dev = hidinput->input;
2257+ struct hid_input *hidinput;
2258+ struct input_dev *input_dev;
2259+
2260+ if (list_empty(&sc->hdev->inputs)) {
2261+ hid_err(sc->hdev, "no inputs found\n");
2262+ return -ENODEV;
2263+ }
2264+ hidinput = list_entry(sc->hdev->inputs.next, struct hid_input, list);
2265+ input_dev = hidinput->input;
22602266
22612267 input_set_capability(input_dev, EV_FF, FF_RUMBLE);
22622268 return input_ff_create_memless(input_dev, NULL, sony_play_effect);
drivers/hid/hid-tmff.c+9−3
@@ -124,12 +124,18 @@ static int tmff_init(struct hid_device *hid, const signed short *ff_bits) · 123 unmodified lines
124124 struct tmff_device *tmff;
125125 struct hid_report *report;
126126 struct list_head *report_list;
127− struct hid_input *hidinput = list_entry(hid->inputs.next,
128− struct hid_input, list);
129− struct input_dev *input_dev = hidinput->input;
127+ struct hid_input *hidinput;
128+ struct input_dev *input_dev;
130129 int error;
131130 int i;
132131
132+ if (list_empty(&hid->inputs)) {
133+ hid_err(hid, "no inputs found\n");
134+ return -ENODEV;
135+ }
136+ hidinput = list_entry(hid->inputs.next, struct hid_input, list);
137+ input_dev = hidinput->input;
138+
133139 tmff = kzalloc(sizeof(struct tmff_device), GFP_KERNEL);
134140 if (!tmff)
135141 return -ENOMEM;
drivers/hid/hid-zpff.c+9−3
@@ -54,11 +54,17 @@ static int zpff_init(struct hid_device *hid) · 53 unmodified lines
5454 {
5555 struct zpff_device *zpff;
5656 struct hid_report *report;
57− struct hid_input *hidinput = list_entry(hid->inputs.next,
58− struct hid_input, list);
59− struct input_dev *dev = hidinput->input;
57+ struct hid_input *hidinput;
58+ struct input_dev *dev;
6059 int i, error;
6160
61+ if (list_empty(&hid->inputs)) {
62+ hid_err(hid, "no inputs found\n");
63+ return -ENODEV;
64+ }
65+ hidinput = list_entry(hid->inputs.next, struct hid_input, list);
66+ dev = hidinput->input;
67+
6268 for (i = 0; i < 4; i++) {
6369 report = hid_validate_values(hid, HID_OUTPUT_REPORT, 0, i, 1);
6470 if (!report)
drivers/hid/i2c-hid/i2c-hid-core.c+11−111
@@ -26,7 +26,6 @@ · 25 unmodified lines
2626 #include <linux/delay.h>
2727 #include <linux/slab.h>
2828 #include <linux/pm.h>
29−#include <linux/pm_runtime.h>
3029 #include <linux/device.h>
3130 #include <linux/wait.h>
3231 #include <linux/err.h>
@@ -48,8 +47,6 @@ · 15 unmodified lines
4847 /* quirks to control the device */
4948 #define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0)
5049 #define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1)
51−#define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2)
52−#define I2C_HID_QUIRK_DELAY_AFTER_SLEEP BIT(3)
5350 #define I2C_HID_QUIRK_BOGUS_IRQ BIT(4)
5451
5552 /* flags */
@@ -172,14 +169,7 @@ static const struct i2c_hid_quirks { · 116 unmodified lines
172169 { USB_VENDOR_ID_WEIDA, HID_ANY_ID,
173170 I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV },
174171 { I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288,
175− I2C_HID_QUIRK_NO_IRQ_AFTER_RESET |
176− I2C_HID_QUIRK_NO_RUNTIME_PM },
177− { I2C_VENDOR_ID_RAYDIUM, I2C_PRODUCT_ID_RAYDIUM_4B33,
178− I2C_HID_QUIRK_DELAY_AFTER_SLEEP },
179− { USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_8001,
180− I2C_HID_QUIRK_NO_RUNTIME_PM },
181− { I2C_VENDOR_ID_GOODIX, I2C_DEVICE_ID_GOODIX_01F0,
182− I2C_HID_QUIRK_NO_RUNTIME_PM },
172+ I2C_HID_QUIRK_NO_IRQ_AFTER_RESET },
183173 { USB_VENDOR_ID_ELAN, HID_ANY_ID,
184174 I2C_HID_QUIRK_BOGUS_IRQ },
185175 { 0, 0 }
@@ -397,7 +387,6 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state) · 211 unmodified lines
397387 {
398388 struct i2c_hid *ihid = i2c_get_clientdata(client);
399389 int ret;
400− unsigned long now, delay;
401390
402391 i2c_hid_dbg(ihid, "%s\n", __func__);
403392
@@ -415,22 +404,9 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state) · 11 unmodified lines
415404 goto set_pwr_exit;
416405 }
417406
418− if (ihid->quirks & I2C_HID_QUIRK_DELAY_AFTER_SLEEP &&
419− power_state == I2C_HID_PWR_ON) {
420− now = jiffies;
421− if (time_after(ihid->sleep_delay, now)) {
422− delay = jiffies_to_usecs(ihid->sleep_delay - now);
423− usleep_range(delay, delay + 1);
424− }
425− }
426−
427407 ret = __i2c_hid_command(client, &hid_set_power_cmd, power_state,
428408 0, NULL, 0, NULL, 0);
429409
430− if (ihid->quirks & I2C_HID_QUIRK_DELAY_AFTER_SLEEP &&
431− power_state == I2C_HID_PWR_SLEEP)
432− ihid->sleep_delay = jiffies + msecs_to_jiffies(20);
433−
434410 if (ret)
435411 dev_err(&client->dev, "failed to change power setting.\n");
436412
@@ -471,8 +447,12 @@ static int i2c_hid_hwreset(struct i2c_client *client) · 34 unmodified lines
471447 if (ret) {
472448 dev_err(&client->dev, "failed to reset device.\n");
473449 i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
450+ goto out_unlock;
474451 }
475452
453+ /* At least some SIS devices need this after reset */
454+ ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
455+
476456 out_unlock:
477457 mutex_unlock(&ihid->reset_lock);
478458 return ret;
@@ -791,11 +771,6 @@ static int i2c_hid_open(struct hid_device *hid) · 312 unmodified lines
791771 {
792772 struct i2c_client *client = hid->driver_data;
793773 struct i2c_hid *ihid = i2c_get_clientdata(client);
794− int ret = 0;
795−
796− ret = pm_runtime_get_sync(&client->dev);
797− if (ret < 0)
798− return ret;
799774
800775 set_bit(I2C_HID_STARTED, &ihid->flags);
801776 return 0;
@@ -807,27 +782,6 @@ static void i2c_hid_close(struct hid_device *hid) · 5 unmodified lines
807782 struct i2c_hid *ihid = i2c_get_clientdata(client);
808783
809784 clear_bit(I2C_HID_STARTED, &ihid->flags);
810−
811− /* Save some power */
812− pm_runtime_put(&client->dev);
813−}
814−
815−static int i2c_hid_power(struct hid_device *hid, int lvl)
816−{
817− struct i2c_client *client = hid->driver_data;
818− struct i2c_hid *ihid = i2c_get_clientdata(client);
819−
820− i2c_hid_dbg(ihid, "%s lvl:%d\n", __func__, lvl);
821−
822− switch (lvl) {
823− case PM_HINT_FULLON:
824− pm_runtime_get_sync(&client->dev);
825− break;
826− case PM_HINT_NORMAL:
827− pm_runtime_put(&client->dev);
828− break;
829− }
830− return 0;
831785 }
832786
833787 struct hid_ll_driver i2c_hid_ll_driver = {
@@ -836,7 +790,6 @@ struct hid_ll_driver i2c_hid_ll_driver = { · 2 unmodified lines
836790 .stop = i2c_hid_stop,
837791 .open = i2c_hid_open,
838792 .close = i2c_hid_close,
839− .power = i2c_hid_power,
840793 .output_report = i2c_hid_output_report,
841794 .raw_request = i2c_hid_raw_request,
842795 };
@@ -1104,9 +1057,6 @@ static int i2c_hid_probe(struct i2c_client *client, · 261 unmodified lines
11041057
11051058 i2c_hid_acpi_fix_up_power(&client->dev);
11061059
1107− pm_runtime_get_noresume(&client->dev);
1108− pm_runtime_set_active(&client->dev);
1109− pm_runtime_enable(&client->dev);
11101060 device_enable_async_suspend(&client->dev);
11111061
11121062 /* Make sure there is something at this address */
@@ -1114,16 +1064,16 @@ static int i2c_hid_probe(struct i2c_client *client, · 1 unmodified line
11141064 if (ret < 0) {
11151065 dev_dbg(&client->dev, "nothing at this address: %d\n", ret);
11161066 ret = -ENXIO;
1117− goto err_pm;
1067+ goto err_regulator;
11181068 }
11191069
11201070 ret = i2c_hid_fetch_hid_descriptor(ihid);
11211071 if (ret < 0)
1122− goto err_pm;
1072+ goto err_regulator;
11231073
11241074 ret = i2c_hid_init_irq(client);
11251075 if (ret < 0)
1126− goto err_pm;
1076+ goto err_regulator;
11271077
11281078 hid = hid_allocate_device();
11291079 if (IS_ERR(hid)) {
@@ -1154,9 +1104,6 @@ static int i2c_hid_probe(struct i2c_client *client, · 24 unmodified lines
11541104 goto err_mem_free;
11551105 }
11561106
1157− if (!(ihid->quirks & I2C_HID_QUIRK_NO_RUNTIME_PM))
1158− pm_runtime_put(&client->dev);
1159−
11601107 return 0;
11611108
11621109 err_mem_free:
@@ -1165,10 +1112,6 @@ err_mem_free: · 2 unmodified lines
11651112 err_irq:
11661113 free_irq(client->irq, ihid);
11671114
1168−err_pm:
1169− pm_runtime_put_noidle(&client->dev);
1170− pm_runtime_disable(&client->dev);
1171−
11721115 err_regulator:
11731116 regulator_bulk_disable(ARRAY_SIZE(ihid->pdata.supplies),
11741117 ihid->pdata.supplies);
@@ -1181,12 +1124,6 @@ static int i2c_hid_remove(struct i2c_client *client) · 6 unmodified lines
11811124 struct i2c_hid *ihid = i2c_get_clientdata(client);
11821125 struct hid_device *hid;
11831126
1184− if (!(ihid->quirks & I2C_HID_QUIRK_NO_RUNTIME_PM))
1185− pm_runtime_get_sync(&client->dev);
1186− pm_runtime_disable(&client->dev);
1187− pm_runtime_set_suspended(&client->dev);
1188− pm_runtime_put_noidle(&client->dev);
1189−
11901127 hid = ihid->hid;
11911128 hid_destroy_device(hid);
11921129
@@ -1219,25 +1156,15 @@ static int i2c_hid_suspend(struct device *dev) · 26 unmodified lines
12191156 int wake_status;
12201157
12211158 if (hid->driver && hid->driver->suspend) {
1222− /*
1223− * Wake up the device so that IO issues in
1224− * HID driver's suspend code can succeed.
1225− */
1226− ret = pm_runtime_resume(dev);
1227− if (ret < 0)
1228− return ret;
1229−
12301159 ret = hid->driver->suspend(hid, PMSG_SUSPEND);
12311160 if (ret < 0)
12321161 return ret;
12331162 }
12341163
1235− if (!pm_runtime_suspended(dev)) {
1236− /* Save some power */
1237− i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
1164+ /* Save some power */
1165+ i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
12381166
1239− disable_irq(client->irq);
1240− }
1167+ disable_irq(client->irq);
12411168
12421169 if (device_may_wakeup(&client->dev)) {
12431170 wake_status = enable_irq_wake(client->irq);
@@ -1279,11 +1206,6 @@ static int i2c_hid_resume(struct device *dev) · 35 unmodified lines
12791206 wake_status);
12801207 }
12811208
1282− /* We'll resume to full power */
1283− pm_runtime_disable(dev);
1284− pm_runtime_set_active(dev);
1285− pm_runtime_enable(dev);
1286−
12871209 enable_irq(client->irq);
12881210
12891211 /* Instead of resetting device, simply powers the device on. This
@@ -1304,30 +1226,8 @@ static int i2c_hid_resume(struct device *dev) · 14 unmodified lines
13041226 }
13051227 #endif
13061228
1307−#ifdef CONFIG_PM
1308−static int i2c_hid_runtime_suspend(struct device *dev)
1309−{
1310− struct i2c_client *client = to_i2c_client(dev);
1311−
1312− i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
1313− disable_irq(client->irq);
1314− return 0;
1315−}
1316−
1317−static int i2c_hid_runtime_resume(struct device *dev)
1318−{
1319− struct i2c_client *client = to_i2c_client(dev);
1320−
1321− enable_irq(client->irq);
1322− i2c_hid_set_power(client, I2C_HID_PWR_ON);
1323− return 0;
1324−}
1325−#endif
1326−
13271229 static const struct dev_pm_ops i2c_hid_pm = {
13281230 SET_SYSTEM_SLEEP_PM_OPS(i2c_hid_suspend, i2c_hid_resume)
1329− SET_RUNTIME_PM_OPS(i2c_hid_runtime_suspend, i2c_hid_runtime_resume,
1330− NULL)
13311231 };
13321232
13331233 static const struct i2c_device_id i2c_hid_id_table[] = {
drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c+19−0
@@ -322,6 +322,25 @@ static const struct dmi_system_id i2c_hid_dmi_desc_override_table[] = { · 321 unmodified lines
322322 },
323323 .driver_data = (void *)&sipodev_desc
324324 },
325+ {
326+ /*
327+ * There are at least 2 Primebook C11B versions, the older
328+ * version has a product-name of "Primebook C11B", and a
329+ * bios version / release / firmware revision of:
330+ * V2.1.2 / 05/03/2018 / 18.2
331+ * The new version has "PRIMEBOOK C11B" as product-name and a
332+ * bios version / release / firmware revision of:
333+ * CFALKSW05_BIOS_V1.1.2 / 11/19/2018 / 19.2
334+ * Only the older version needs this quirk, note the newer
335+ * version will not match as it has a different product-name.
336+ */
337+ .ident = "Trekstor Primebook C11B",
338+ .matches = {
339+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
340+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Primebook C11B"),
341+ },
342+ .driver_data = (void *)&sipodev_desc
343+ },
325344 {
326345 .ident = "Direkt-Tek DTLAPY116-2",
327346 .matches = {
drivers/hid/intel-ish-hid/ishtp/client-buffers.c+1−1
@@ -84,7 +84,7 @@ int ishtp_cl_alloc_tx_ring(struct ishtp_cl *cl) · 83 unmodified lines
8484 return 0;
8585 out:
8686 dev_err(&cl->device->dev, "error in allocating Tx pool\n");
87− ishtp_cl_free_rx_ring(cl);
87+ ishtp_cl_free_tx_ring(cl);
8888 return -ENOMEM;
8989 }
9090
drivers/hid/wacom.h+15−0
@@ -202,6 +202,21 @@ static inline void wacom_schedule_work(struct wacom_wac *wacom_wac, · 201 unmodified lines
202202 }
203203 }
204204
205+/*
206+ * Convert a signed 32-bit integer to an unsigned n-bit integer. Undoes
207+ * the normally-helpful work of 'hid_snto32' for fields that use signed
208+ * ranges for questionable reasons.
209+ */
210+static inline __u32 wacom_s32tou(s32 value, __u8 n)
211+{
212+ switch (n) {
213+ case 8: return ((__u8)value);
214+ case 16: return ((__u16)value);
215+ case 32: return ((__u32)value);
216+ }
217+ return value & (1 << (n - 1)) ? value & (~(~0U << n)) : value;
218+}
219+
205220 extern const struct hid_device_id wacom_ids[];
206221
207222 void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len);
drivers/hid/wacom_wac.c+6−4
@@ -2303,7 +2303,7 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field · 2302 unmodified lines
23032303 case HID_DG_TOOLSERIALNUMBER:
23042304 if (value) {
23052305 wacom_wac->serial[0] = (wacom_wac->serial[0] & ~0xFFFFFFFFULL);
2306− wacom_wac->serial[0] |= (__u32)value;
2306+ wacom_wac->serial[0] |= wacom_s32tou(value, field->report_size);
23072307 }
23082308 return;
23092309 case HID_DG_TWIST:
@@ -2319,15 +2319,17 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field · 9 unmodified lines
23192319 return;
23202320 case WACOM_HID_WD_SERIALHI:
23212321 if (value) {
2322+ __u32 raw_value = wacom_s32tou(value, field->report_size);
2323+
23222324 wacom_wac->serial[0] = (wacom_wac->serial[0] & 0xFFFFFFFF);
2323− wacom_wac->serial[0] |= ((__u64)value) << 32;
2325+ wacom_wac->serial[0] |= ((__u64)raw_value) << 32;
23242326 /*
23252327 * Non-USI EMR devices may contain additional tool type
23262328 * information here. See WACOM_HID_WD_TOOLTYPE case for
23272329 * more details.
23282330 */
23292331 if (value >> 20 == 1) {
2330− wacom_wac->id[0] |= value & 0xFFFFF;
2332+ wacom_wac->id[0] |= raw_value & 0xFFFFF;
23312333 }
23322334 }
23332335 return;
@@ -2339,7 +2341,7 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field · 5 unmodified lines
23392341 * bitwise OR so the complete value can be built
23402342 * up over time :(
23412343 */
2342− wacom_wac->id[0] |= value;
2344+ wacom_wac->id[0] |= wacom_s32tou(value, field->report_size);
23432345 return;
23442346 case WACOM_HID_WD_OFFSETLEFT:
23452347 if (features->offset_left && value != features->offset_left)
drivers/hwmon/ina3221.c+1−1
@@ -170,7 +170,7 @@ static inline int ina3221_wait_for_data(struct ina3221_data *ina) · 169 unmodified lines
170170
171171 /* Polling the CVRF bit to make sure read data is ready */
172172 return regmap_field_read_poll_timeout(ina->fields[F_CVRF],
173− cvrf, cvrf, wait, 100000);
173+ cvrf, cvrf, wait, wait * 2);
174174 }
175175
176176 static int ina3221_read_value(struct ina3221_data *ina, unsigned int reg,
drivers/hwmon/nct7904.c+12−3
@@ -82,6 +82,10 @@ · 81 unmodified lines
8282 #define FANCTL1_FMR_REG 0x00 /* Bank 3; 1 reg per channel */
8383 #define FANCTL1_OUT_REG 0x10 /* Bank 3; 1 reg per channel */
8484
85+#define VOLT_MONITOR_MODE 0x0
86+#define THERMAL_DIODE_MODE 0x1
87+#define THERMISTOR_MODE 0x3
88+
8589 #define ENABLE_TSI BIT(1)
8690
8791 static const unsigned short normal_i2c[] = {
@@ -935,11 +939,16 @@ static int nct7904_probe(struct i2c_client *client, · 847 unmodified lines
935939 for (i = 0; i < 4; i++) {
936940 val = (ret >> (i * 2)) & 0x03;
937941 bit = (1 << i);
938− if (val == 0) {
942+ if (val == VOLT_MONITOR_MODE) {
939943 data->tcpu_mask &= ~bit;
944+ } else if (val == THERMAL_DIODE_MODE && i < 2) {
945+ data->temp_mode |= bit;
946+ data->vsen_mask &= ~(0x06 << (i * 2));
947+ } else if (val == THERMISTOR_MODE) {
948+ data->vsen_mask &= ~(0x02 << (i * 2));
940949 } else {
941− if (val == 0x1 || val == 0x2)
942− data->temp_mode |= bit;
950+ /* Reserved */
951+ data->tcpu_mask &= ~bit;
943952 data->vsen_mask &= ~(0x06 << (i * 2));
944953 }
945954 }
drivers/hwtracing/intel_th/gth.c+3−0
@@ -626,6 +626,9 @@ static void intel_th_gth_switch(struct intel_th_device *thdev, · 625 unmodified lines
626626 if (!count)
627627 dev_dbg(&thdev->dev, "timeout waiting for CTS Trigger\n");
628628
629+ /* De-assert the trigger */
630+ iowrite32(0, gth->base + REG_CTS_CTL);
631+
629632 intel_th_gth_stop(gth, output, false);
630633 intel_th_gth_start(gth, output);
631634 }
drivers/hwtracing/intel_th/msu.c+8−3
@@ -164,7 +164,7 @@ struct msc { · 163 unmodified lines
164164 };
165165
166166 static LIST_HEAD(msu_buffer_list);
167−static struct mutex msu_buffer_mutex;
167+static DEFINE_MUTEX(msu_buffer_mutex);
168168
169169 /**
170170 * struct msu_buffer_entry - internal MSU buffer bookkeeping
@@ -327,7 +327,7 @@ static size_t msc_win_total_sz(struct msc_window *win) · 156 unmodified lines
327327 struct msc_block_desc *bdesc = sg_virt(sg);
328328
329329 if (msc_block_wrapped(bdesc))
330− return win->nr_blocks << PAGE_SHIFT;
330+ return (size_t)win->nr_blocks << PAGE_SHIFT;
331331
332332 size += msc_total_sz(bdesc);
333333 if (msc_block_last_written(bdesc))
@@ -1848,9 +1848,14 @@ mode_store(struct device *dev, struct device_attribute *attr, const char *buf, · 1514 unmodified lines
18481848 len = cp - buf;
18491849
18501850 mode = kstrndup(buf, len, GFP_KERNEL);
1851+ if (!mode)
1852+ return -ENOMEM;
1853+
18511854 i = match_string(msc_mode, ARRAY_SIZE(msc_mode), mode);
1852− if (i >= 0)
1855+ if (i >= 0) {
1856+ kfree(mode);
18531857 goto found;
1858+ }
18541859
18551860 /* Buffer sinks only work with a usable IRQ */
18561861 if (!msc->do_irq) {
drivers/hwtracing/intel_th/pci.c+10−0
@@ -199,6 +199,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { · 198 unmodified lines
199199 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x02a6),
200200 .driver_data = (kernel_ulong_t)&intel_th_2x,
201201 },
202+ {
203+ /* Comet Lake PCH */
204+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x06a6),
205+ .driver_data = (kernel_ulong_t)&intel_th_2x,
206+ },
202207 {
203208 /* Ice Lake NNPI */
204209 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x45c5),
@@ -209,6 +214,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { · 4 unmodified lines
209214 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa0a6),
210215 .driver_data = (kernel_ulong_t)&intel_th_2x,
211216 },
217+ {
218+ /* Jasper Lake PCH */
219+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4da6),
220+ .driver_data = (kernel_ulong_t)&intel_th_2x,
221+ },
212222 { 0 },
213223 };
214224
drivers/iio/adc/stm32-adc.c+2−2
@@ -1399,7 +1399,7 @@ static int stm32_adc_dma_start(struct iio_dev *indio_dev) · 1398 unmodified lines
13991399 cookie = dmaengine_submit(desc);
14001400 ret = dma_submit_error(cookie);
14011401 if (ret) {
1402− dmaengine_terminate_all(adc->dma_chan);
1402+ dmaengine_terminate_sync(adc->dma_chan);
14031403 return ret;
14041404 }
14051405
@@ -1477,7 +1477,7 @@ static void __stm32_adc_buffer_predisable(struct iio_dev *indio_dev) · 71 unmodified lines
14771477 stm32_adc_conv_irq_disable(adc);
14781478
14791479 if (adc->dma_chan)
1480− dmaengine_terminate_all(adc->dma_chan);
1480+ dmaengine_terminate_sync(adc->dma_chan);
14811481
14821482 if (stm32_adc_set_trig(indio_dev, NULL))
14831483 dev_err(&indio_dev->dev, "Can't clear trigger\n");
drivers/iio/imu/adis16480.c+4−1
@@ -317,8 +317,11 @@ static int adis16480_set_freq(struct iio_dev *indio_dev, int val, int val2) · 316 unmodified lines
317317 struct adis16480 *st = iio_priv(indio_dev);
318318 unsigned int t, reg;
319319
320+ if (val < 0 || val2 < 0)
321+ return -EINVAL;
322+
320323 t = val * 1000 + val2 / 1000;
321− if (t <= 0)
324+ if (t == 0)
322325 return -EINVAL;
323326
324327 /*
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c+9−0
@@ -114,54 +114,63 @@ static const struct inv_mpu6050_hw hw_info[] = { · 113 unmodified lines
114114 .name = "MPU6050",
115115 .reg = &reg_set_6050,
116116 .config = &chip_config_6050,
117+ .fifo_size = 1024,
117118 },
118119 {
119120 .whoami = INV_MPU6500_WHOAMI_VALUE,
120121 .name = "MPU6500",
121122 .reg = &reg_set_6500,
122123 .config = &chip_config_6050,
124+ .fifo_size = 512,
123125 },
124126 {
125127 .whoami = INV_MPU6515_WHOAMI_VALUE,
126128 .name = "MPU6515",
127129 .reg = &reg_set_6500,
128130 .config = &chip_config_6050,
131+ .fifo_size = 512,
129132 },
130133 {
131134 .whoami = INV_MPU6000_WHOAMI_VALUE,
132135 .name = "MPU6000",
133136 .reg = &reg_set_6050,
134137 .config = &chip_config_6050,
138+ .fifo_size = 1024,
135139 },
136140 {
137141 .whoami = INV_MPU9150_WHOAMI_VALUE,
138142 .name = "MPU9150",
139143 .reg = &reg_set_6050,
140144 .config = &chip_config_6050,
145+ .fifo_size = 1024,
141146 },
142147 {
143148 .whoami = INV_MPU9250_WHOAMI_VALUE,
144149 .name = "MPU9250",
145150 .reg = &reg_set_6500,
146151 .config = &chip_config_6050,
152+ .fifo_size = 512,
147153 },
148154 {
149155 .whoami = INV_MPU9255_WHOAMI_VALUE,
150156 .name = "MPU9255",
151157 .reg = &reg_set_6500,
152158 .config = &chip_config_6050,
159+ .fifo_size = 512,
153160 },
154161 {
155162 .whoami = INV_ICM20608_WHOAMI_VALUE,
156163 .name = "ICM20608",
157164 .reg = &reg_set_6500,
158165 .config = &chip_config_6050,
166+ .fifo_size = 512,
159167 },
160168 {
161169 .whoami = INV_ICM20602_WHOAMI_VALUE,
162170 .name = "ICM20602",
163171 .reg = &reg_set_icm20602,
164172 .config = &chip_config_6050,
173+ .fifo_size = 1008,
165174 },
166175 };
167176
drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h+2−0
@@ -100,12 +100,14 @@ struct inv_mpu6050_chip_config { · 99 unmodified lines
100100 * @name: name of the chip.
101101 * @reg: register map of the chip.
102102 * @config: configuration of the chip.
103+ * @fifo_size: size of the FIFO in bytes.
103104 */
104105 struct inv_mpu6050_hw {
105106 u8 whoami;
106107 u8 *name;
107108 const struct inv_mpu6050_reg_map *reg;
108109 const struct inv_mpu6050_chip_config *config;
110+ size_t fifo_size;
109111 };
110112
111113 /*
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c+12−3
@@ -180,9 +180,6 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) · 179 unmodified lines
180180 "failed to ack interrupt\n");
181181 goto flush_fifo;
182182 }
183− /* handle fifo overflow by reseting fifo */
184− if (int_status & INV_MPU6050_BIT_FIFO_OVERFLOW_INT)
185− goto flush_fifo;
186183 if (!(int_status & INV_MPU6050_BIT_RAW_DATA_RDY_INT)) {
187184 dev_warn(regmap_get_device(st->map),
188185 "spurious interrupt with status 0x%x\n", int_status);
@@ -211,6 +208,18 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) · 22 unmodified lines
211208 if (result)
212209 goto end_session;
213210 fifo_count = get_unaligned_be16(&data[0]);
211+
212+ /*
213+ * Handle fifo overflow by resetting fifo.
214+ * Reset if there is only 3 data set free remaining to mitigate
215+ * possible delay between reading fifo count and fifo data.
216+ */
217+ nb = 3 * bytes_per_datum;
218+ if (fifo_count >= st->hw->fifo_size - nb) {
219+ dev_warn(regmap_get_device(st->map), "fifo overflow reset\n");
220+ goto flush_fifo;
221+ }
222+
214223 /* compute and process all complete datum */
215224 nb = fifo_count / bytes_per_datum;
216225 inv_mpu6050_update_period(st, pf->timestamp, nb);
drivers/iio/proximity/srf04.c+15−14
@@ -110,7 +110,7 @@ static int srf04_read(struct srf04_data *data) · 109 unmodified lines
110110 udelay(data->cfg->trigger_pulse_us);
111111 gpiod_set_value(data->gpiod_trig, 0);
112112
113− /* it cannot take more than 20 ms */
113+ /* it should not take more than 20 ms until echo is rising */
114114 ret = wait_for_completion_killable_timeout(&data->rising, HZ/50);
115115 if (ret < 0) {
116116 mutex_unlock(&data->lock);
@@ -120,7 +120,8 @@ static int srf04_read(struct srf04_data *data) · 3 unmodified lines
120120 return -ETIMEDOUT;
121121 }
122122
123− ret = wait_for_completion_killable_timeout(&data->falling, HZ/50);
123+ /* it cannot take more than 50 ms until echo is falling */
124+ ret = wait_for_completion_killable_timeout(&data->falling, HZ/20);
124125 if (ret < 0) {
125126 mutex_unlock(&data->lock);
126127 return ret;
@@ -135,19 +136,19 @@ static int srf04_read(struct srf04_data *data) · 8 unmodified lines
135136
136137 dt_ns = ktime_to_ns(ktime_dt);
137138 /*
138− * measuring more than 3 meters is beyond the capabilities of
139− * the sensor
139+ * measuring more than 6,45 meters is beyond the capabilities of
140+ * the supported sensors
140141 * ==> filter out invalid results for not measuring echos of
141142 * another us sensor
142143 *
143144 * formula:
144− * distance 3 m
145− * time = ---------- = --------- = 9404389 ns
146− * speed 319 m/s
145+ * distance 6,45 * 2 m
146+ * time = ---------- = ------------ = 40438871 ns
147+ * speed 319 m/s
147148 *
148149 * using a minimum speed at -20 °C of 319 m/s
149150 */
150− if (dt_ns > 9404389)
151+ if (dt_ns > 40438871)
151152 return -EIO;
152153
153154 time_ns = dt_ns;
@@ -159,20 +160,20 @@ static int srf04_read(struct srf04_data *data) · 5 unmodified lines
159160 * with Temp in °C
160161 * and speed in m/s
161162 *
162− * use 343 m/s as ultrasonic speed at 20 °C here in absence of the
163+ * use 343,5 m/s as ultrasonic speed at 20 °C here in absence of the
163164 * temperature
164165 *
165166 * therefore:
166− * time 343
167− * distance = ------ * -----
168− * 10^6 2
167+ * time 343,5 time * 106
168+ * distance = ------ * ------- = ------------
169+ * 10^6 2 617176
169170 * with time in ns
170171 * and distance in mm (one way)
171172 *
172− * because we limit to 3 meters the multiplication with 343 just
173+ * because we limit to 6,45 meters the multiplication with 106 just
173174 * fits into 32 bit
174175 */
175− distance_mm = time_ns * 343 / 2000000;
176+ distance_mm = time_ns * 106 / 617176;
176177
177178 return distance_mm;
178179 }
drivers/infiniband/core/core_priv.h+1−0
@@ -199,6 +199,7 @@ void ib_mad_cleanup(void); · 198 unmodified lines
199199 int ib_sa_init(void);
200200 void ib_sa_cleanup(void);
201201
202+void rdma_nl_init(void);
202203 void rdma_nl_exit(void);
203204
204205 int ib_nl_handle_resolve_resp(struct sk_buff *skb,
drivers/infiniband/core/device.c+2−0
@@ -2716,6 +2716,8 @@ static int __init ib_core_init(void) · 2715 unmodified lines
27162716 goto err_comp_unbound;
27172717 }
27182718
2719+ rdma_nl_init();
2720+
27192721 ret = addr_init();
27202722 if (ret) {
27212723 pr_warn("Could't init IB address resolution\n");
drivers/infiniband/core/iwcm.c+29−23
@@ -372,6 +372,7 @@ EXPORT_SYMBOL(iw_cm_disconnect); · 371 unmodified lines
372372 static void destroy_cm_id(struct iw_cm_id *cm_id)
373373 {
374374 struct iwcm_id_private *cm_id_priv;
375+ struct ib_qp *qp;
375376 unsigned long flags;
376377
377378 cm_id_priv = container_of(cm_id, struct iwcm_id_private, id);
@@ -389,6 +390,9 @@ static void destroy_cm_id(struct iw_cm_id *cm_id) · 11 unmodified lines
389390 set_bit(IWCM_F_DROP_EVENTS, &cm_id_priv->flags);
390391
391392 spin_lock_irqsave(&cm_id_priv->lock, flags);
393+ qp = cm_id_priv->qp;
394+ cm_id_priv->qp = NULL;
395+
392396 switch (cm_id_priv->state) {
393397 case IW_CM_STATE_LISTEN:
394398 cm_id_priv->state = IW_CM_STATE_DESTROYING;
@@ -401,7 +405,7 @@ static void destroy_cm_id(struct iw_cm_id *cm_id) · 6 unmodified lines
401405 cm_id_priv->state = IW_CM_STATE_DESTROYING;
402406 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
403407 /* Abrupt close of the connection */
404− (void)iwcm_modify_qp_err(cm_id_priv->qp);
408+ (void)iwcm_modify_qp_err(qp);
405409 spin_lock_irqsave(&cm_id_priv->lock, flags);
406410 break;
407411 case IW_CM_STATE_IDLE:
@@ -426,11 +430,9 @@ static void destroy_cm_id(struct iw_cm_id *cm_id) · 18 unmodified lines
426430 BUG();
427431 break;
428432 }
429− if (cm_id_priv->qp) {
430− cm_id_priv->id.device->ops.iw_rem_ref(cm_id_priv->qp);
431− cm_id_priv->qp = NULL;
432− }
433433 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
434+ if (qp)
435+ cm_id_priv->id.device->ops.iw_rem_ref(qp);
434436
435437 if (cm_id->mapped) {
436438 iwpm_remove_mapinfo(&cm_id->local_addr, &cm_id->m_local_addr);
@@ -671,11 +673,11 @@ int iw_cm_accept(struct iw_cm_id *cm_id, · 234 unmodified lines
671673 BUG_ON(cm_id_priv->state != IW_CM_STATE_CONN_RECV);
672674 cm_id_priv->state = IW_CM_STATE_IDLE;
673675 spin_lock_irqsave(&cm_id_priv->lock, flags);
674− if (cm_id_priv->qp) {
675− cm_id->device->ops.iw_rem_ref(qp);
676− cm_id_priv->qp = NULL;
677− }
676+ qp = cm_id_priv->qp;
677+ cm_id_priv->qp = NULL;
678678 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
679+ if (qp)
680+ cm_id->device->ops.iw_rem_ref(qp);
679681 clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags);
680682 wake_up_all(&cm_id_priv->connect_wait);
681683 }
@@ -696,7 +698,7 @@ int iw_cm_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param) · 14 unmodified lines
696698 struct iwcm_id_private *cm_id_priv;
697699 int ret;
698700 unsigned long flags;
699− struct ib_qp *qp;
701+ struct ib_qp *qp = NULL;
700702
701703 cm_id_priv = container_of(cm_id, struct iwcm_id_private, id);
702704
@@ -730,13 +732,13 @@ int iw_cm_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param) · 27 unmodified lines
730732 return 0; /* success */
731733
732734 spin_lock_irqsave(&cm_id_priv->lock, flags);
733− if (cm_id_priv->qp) {
734− cm_id->device->ops.iw_rem_ref(qp);
735− cm_id_priv->qp = NULL;
736− }
735+ qp = cm_id_priv->qp;
736+ cm_id_priv->qp = NULL;
737737 cm_id_priv->state = IW_CM_STATE_IDLE;
738738 err:
739739 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
740+ if (qp)
741+ cm_id->device->ops.iw_rem_ref(qp);
740742 clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags);
741743 wake_up_all(&cm_id_priv->connect_wait);
742744 return ret;
@@ -878,6 +880,7 @@ static int cm_conn_est_handler(struct iwcm_id_private *cm_id_priv, · 135 unmodified lines
878880 static int cm_conn_rep_handler(struct iwcm_id_private *cm_id_priv,
879881 struct iw_cm_event *iw_event)
880882 {
883+ struct ib_qp *qp = NULL;
881884 unsigned long flags;
882885 int ret;
883886
@@ -896,11 +899,13 @@ static int cm_conn_rep_handler(struct iwcm_id_private *cm_id_priv, · 12 unmodified lines
896899 cm_id_priv->state = IW_CM_STATE_ESTABLISHED;
897900 } else {
898901 /* REJECTED or RESET */
899− cm_id_priv->id.device->ops.iw_rem_ref(cm_id_priv->qp);
902+ qp = cm_id_priv->qp;
900903 cm_id_priv->qp = NULL;
901904 cm_id_priv->state = IW_CM_STATE_IDLE;
902905 }
903906 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
907+ if (qp)
908+ cm_id_priv->id.device->ops.iw_rem_ref(qp);
904909 ret = cm_id_priv->id.cm_handler(&cm_id_priv->id, iw_event);
905910
906911 if (iw_event->private_data_len)
@@ -942,21 +947,18 @@ static void cm_disconnect_handler(struct iwcm_id_private *cm_id_priv, · 35 unmodified lines
942947 static int cm_close_handler(struct iwcm_id_private *cm_id_priv,
943948 struct iw_cm_event *iw_event)
944949 {
950+ struct ib_qp *qp;
945951 unsigned long flags;
946− int ret = 0;
952+ int ret = 0, notify_event = 0;
947953 spin_lock_irqsave(&cm_id_priv->lock, flags);
954+ qp = cm_id_priv->qp;
955+ cm_id_priv->qp = NULL;
948956
949− if (cm_id_priv->qp) {
950− cm_id_priv->id.device->ops.iw_rem_ref(cm_id_priv->qp);
951− cm_id_priv->qp = NULL;
952− }
953957 switch (cm_id_priv->state) {
954958 case IW_CM_STATE_ESTABLISHED:
955959 case IW_CM_STATE_CLOSING:
956960 cm_id_priv->state = IW_CM_STATE_IDLE;
957− spin_unlock_irqrestore(&cm_id_priv->lock, flags);
958− ret = cm_id_priv->id.cm_handler(&cm_id_priv->id, iw_event);
959− spin_lock_irqsave(&cm_id_priv->lock, flags);
961+ notify_event = 1;
960962 break;
961963 case IW_CM_STATE_DESTROYING:
962964 break;
@@ -965,6 +967,10 @@ static int cm_close_handler(struct iwcm_id_private *cm_id_priv, · 2 unmodified lines
965967 }
966968 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
967969
970+ if (qp)
971+ cm_id_priv->id.device->ops.iw_rem_ref(qp);
972+ if (notify_event)
973+ ret = cm_id_priv->id.cm_handler(&cm_id_priv->id, iw_event);
968974 return ret;
969975 }
970976
drivers/infiniband/core/netlink.c+53−54
@@ -42,9 +42,12 @@ · 41 unmodified lines
4242 #include <linux/module.h>
4343 #include "core_priv.h"
4444
45−static DEFINE_MUTEX(rdma_nl_mutex);
4645 static struct {
47− const struct rdma_nl_cbs *cb_table;
46+ const struct rdma_nl_cbs *cb_table;
47+ /* Synchronizes between ongoing netlink commands and netlink client
48+ * unregistration.
49+ */
50+ struct rw_semaphore sem;
4851 } rdma_nl_types[RDMA_NL_NUM_CLIENTS];
4952
5053 bool rdma_nl_chk_listeners(unsigned int group)
@@ -75,70 +78,53 @@ static bool is_nl_msg_valid(unsigned int type, unsigned int op) · 24 unmodified lines
7578 return (op < max_num_ops[type]) ? true : false;
7679 }
7780
78−static bool
79−is_nl_valid(const struct sk_buff *skb, unsigned int type, unsigned int op)
81+static const struct rdma_nl_cbs *
82+get_cb_table(const struct sk_buff *skb, unsigned int type, unsigned int op)
8083 {
8184 const struct rdma_nl_cbs *cb_table;
8285
83− if (!is_nl_msg_valid(type, op))
84− return false;
85−
8686 /*
8787 * Currently only NLDEV client is supporting netlink commands in
8888 * non init_net net namespace.
8989 */
9090 if (sock_net(skb->sk) != &init_net && type != RDMA_NL_NLDEV)
91− return false;
91+ return NULL;
9292
93− if (!rdma_nl_types[type].cb_table) {
94− mutex_unlock(&rdma_nl_mutex);
95− request_module("rdma-netlink-subsys-%d", type);
96− mutex_lock(&rdma_nl_mutex);
97− }
93+ cb_table = READ_ONCE(rdma_nl_types[type].cb_table);
94+ if (!cb_table) {
95+ /*
96+ * Didn't get valid reference of the table, attempt module
97+ * load once.
98+ */
99+ up_read(&rdma_nl_types[type].sem);
98100
99− cb_table = rdma_nl_types[type].cb_table;
101+ request_module("rdma-netlink-subsys-%d", type);
100102
103+ down_read(&rdma_nl_types[type].sem);
104+ cb_table = READ_ONCE(rdma_nl_types[type].cb_table);
105+ }
101106 if (!cb_table || (!cb_table[op].dump && !cb_table[op].doit))
102− return false;
103− return true;
107+ return NULL;
108+ return cb_table;
104109 }
105110
106111 void rdma_nl_register(unsigned int index,
107112 const struct rdma_nl_cbs cb_table[])
108113 {
109− mutex_lock(&rdma_nl_mutex);
110− if (!is_nl_msg_valid(index, 0)) {
111− /*
112− * All clients are not interesting in success/failure of
113− * this call. They want to see the print to error log and
114− * continue their initialization. Print warning for them,
115− * because it is programmer's error to be here.
116− */
117− mutex_unlock(&rdma_nl_mutex);
118− WARN(true,
119− "The not-valid %u index was supplied to RDMA netlink\n",
120− index);
114+ if (WARN_ON(!is_nl_msg_valid(index, 0)) ||
115+ WARN_ON(READ_ONCE(rdma_nl_types[index].cb_table)))
121116 return;
122− }
123−
124− if (rdma_nl_types[index].cb_table) {
125− mutex_unlock(&rdma_nl_mutex);
126− WARN(true,
127− "The %u index is already registered in RDMA netlink\n",
128− index);
129− return;
130− }
131117
132− rdma_nl_types[index].cb_table = cb_table;
133− mutex_unlock(&rdma_nl_mutex);
118+ /* Pairs with the READ_ONCE in is_nl_valid() */
119+ smp_store_release(&rdma_nl_types[index].cb_table, cb_table);
134120 }
135121 EXPORT_SYMBOL(rdma_nl_register);
136122
137123 void rdma_nl_unregister(unsigned int index)
138124 {
139− mutex_lock(&rdma_nl_mutex);
125+ down_write(&rdma_nl_types[index].sem);
140126 rdma_nl_types[index].cb_table = NULL;
141− mutex_unlock(&rdma_nl_mutex);
127+ up_write(&rdma_nl_types[index].sem);
142128 }
143129 EXPORT_SYMBOL(rdma_nl_unregister);
144130
@@ -170,15 +156,21 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, · 25 unmodified lines
170156 unsigned int index = RDMA_NL_GET_CLIENT(type);
171157 unsigned int op = RDMA_NL_GET_OP(type);
172158 const struct rdma_nl_cbs *cb_table;
159+ int err = -EINVAL;
173160
174− if (!is_nl_valid(skb, index, op))
161+ if (!is_nl_msg_valid(index, op))
175162 return -EINVAL;
176163
177− cb_table = rdma_nl_types[index].cb_table;
164+ down_read(&rdma_nl_types[index].sem);
165+ cb_table = get_cb_table(skb, index, op);
166+ if (!cb_table)
167+ goto done;
178168
179169 if ((cb_table[op].flags & RDMA_NL_ADMIN_PERM) &&
180− !netlink_capable(skb, CAP_NET_ADMIN))
181− return -EPERM;
170+ !netlink_capable(skb, CAP_NET_ADMIN)) {
171+ err = -EPERM;
172+ goto done;
173+ }
182174
183175 /*
184176 * LS responses overload the 0x100 (NLM_F_ROOT) flag. Don't
@@ -186,8 +178,8 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, · 1 unmodified line
186178 */
187179 if (index == RDMA_NL_LS) {
188180 if (cb_table[op].doit)
189− return cb_table[op].doit(skb, nlh, extack);
190− return -EINVAL;
181+ err = cb_table[op].doit(skb, nlh, extack);
182+ goto done;
191183 }
192184 /* FIXME: Convert IWCM to properly handle doit callbacks */
193185 if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_IWCM) {
@@ -195,14 +187,15 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, · 1 unmodified line
195187 .dump = cb_table[op].dump,
196188 };
197189 if (c.dump)
198− return netlink_dump_start(skb->sk, skb, nlh, &c);
199− return -EINVAL;
190+ err = netlink_dump_start(skb->sk, skb, nlh, &c);
191+ goto done;
200192 }
201193
202194 if (cb_table[op].doit)
203− return cb_table[op].doit(skb, nlh, extack);
204−
205− return 0;
195+ err = cb_table[op].doit(skb, nlh, extack);
196+done:
197+ up_read(&rdma_nl_types[index].sem);
198+ return err;
206199 }
207200
208201 /*
@@ -263,9 +256,7 @@ skip: · 54 unmodified lines
263256
264257 static void rdma_nl_rcv(struct sk_buff *skb)
265258 {
266− mutex_lock(&rdma_nl_mutex);
267259 rdma_nl_rcv_skb(skb, &rdma_nl_rcv_msg);
268− mutex_unlock(&rdma_nl_mutex);
269260 }
270261
271262 int rdma_nl_unicast(struct net *net, struct sk_buff *skb, u32 pid)
@@ -297,6 +288,14 @@ int rdma_nl_multicast(struct net *net, struct sk_buff *skb, · 25 unmodified lines
297288 }
298289 EXPORT_SYMBOL(rdma_nl_multicast);
299290
291+void rdma_nl_init(void)
292+{
293+ int idx;
294+
295+ for (idx = 0; idx < RDMA_NL_NUM_CLIENTS; idx++)
296+ init_rwsem(&rdma_nl_types[idx].sem);
297+}
298+
300299 void rdma_nl_exit(void)
301300 {
302301 int idx;
drivers/infiniband/core/nldev.c+1−1
@@ -778,7 +778,7 @@ static int fill_res_counter_entry(struct sk_buff *msg, bool has_cap_net_admin, · 777 unmodified lines
778778 container_of(res, struct rdma_counter, res);
779779
780780 if (port && port != counter->port)
781− return 0;
781+ return -EAGAIN;
782782
783783 /* Dump it even query failed */
784784 rdma_counter_query_stats(counter);
drivers/infiniband/core/uverbs.h+1−1
@@ -98,7 +98,7 @@ ib_uverbs_init_udata_buf_or_null(struct ib_udata *udata, · 97 unmodified lines
9898
9999 struct ib_uverbs_device {
100100 atomic_t refcount;
101− int num_comp_vectors;
101+ u32 num_comp_vectors;
102102 struct completion comp;
103103 struct device dev;
104104 /* First group for device attributes, NULL terminated array */
drivers/infiniband/core/verbs.c+5−4
@@ -662,16 +662,17 @@ static bool find_gid_index(const union ib_gid *gid, · 661 unmodified lines
662662 void *context)
663663 {
664664 struct find_gid_index_context *ctx = context;
665+ u16 vlan_id = 0xffff;
666+ int ret;
665667
666668 if (ctx->gid_type != gid_attr->gid_type)
667669 return false;
668670
669− if ((!!(ctx->vlan_id != 0xffff) == !is_vlan_dev(gid_attr->ndev)) ||
670− (is_vlan_dev(gid_attr->ndev) &&
671− vlan_dev_vlan_id(gid_attr->ndev) != ctx->vlan_id))
671+ ret = rdma_read_gid_l2_fields(gid_attr, &vlan_id, NULL);
672+ if (ret)
672673 return false;
673674
674− return true;
675+ return ctx->vlan_id == vlan_id;
675676 }
676677
677678 static const struct ib_gid_attr *
drivers/infiniband/hw/cxgb4/cm.c+14−16
@@ -495,7 +495,6 @@ static int _put_ep_safe(struct c4iw_dev *dev, struct sk_buff *skb) · 494 unmodified lines
495495
496496 ep = *((struct c4iw_ep **)(skb->cb + 2 * sizeof(void *)));
497497 release_ep_resources(ep);
498− kfree_skb(skb);
499498 return 0;
500499 }
501500
@@ -506,7 +505,6 @@ static int _put_pass_ep_safe(struct c4iw_dev *dev, struct sk_buff *skb) · 4 unmodified lines
506505 ep = *((struct c4iw_ep **)(skb->cb + 2 * sizeof(void *)));
507506 c4iw_put_ep(&ep->parent_ep->com);
508507 release_ep_resources(ep);
509− kfree_skb(skb);
510508 return 0;
511509 }
512510
@@ -2424,20 +2422,6 @@ static int accept_cr(struct c4iw_ep *ep, struct sk_buff *skb, · 1911 unmodified lines
24242422 enum chip_type adapter_type = ep->com.dev->rdev.lldi.adapter_type;
24252423
24262424 pr_debug("ep %p tid %u\n", ep, ep->hwtid);
2427−
2428− skb_get(skb);
2429− rpl = cplhdr(skb);
2430− if (!is_t4(adapter_type)) {
2431− skb_trim(skb, roundup(sizeof(*rpl5), 16));
2432− rpl5 = (void *)rpl;
2433− INIT_TP_WR(rpl5, ep->hwtid);
2434− } else {
2435− skb_trim(skb, sizeof(*rpl));
2436− INIT_TP_WR(rpl, ep->hwtid);
2437− }
2438− OPCODE_TID(rpl) = cpu_to_be32(MK_OPCODE_TID(CPL_PASS_ACCEPT_RPL,
2439− ep->hwtid));
2440−
24412425 cxgb_best_mtu(ep->com.dev->rdev.lldi.mtus, ep->mtu, &mtu_idx,
24422426 enable_tcp_timestamps && req->tcpopt.tstamp,
24432427 (ep->com.remote_addr.ss_family == AF_INET) ? 0 : 1);
@@ -2483,6 +2467,20 @@ static int accept_cr(struct c4iw_ep *ep, struct sk_buff *skb, · 39 unmodified lines
24832467 if (tcph->ece && tcph->cwr)
24842468 opt2 |= CCTRL_ECN_V(1);
24852469 }
2470+
2471+ skb_get(skb);
2472+ rpl = cplhdr(skb);
2473+ if (!is_t4(adapter_type)) {
2474+ skb_trim(skb, roundup(sizeof(*rpl5), 16));
2475+ rpl5 = (void *)rpl;
2476+ INIT_TP_WR(rpl5, ep->hwtid);
2477+ } else {
2478+ skb_trim(skb, sizeof(*rpl));
2479+ INIT_TP_WR(rpl, ep->hwtid);
2480+ }
2481+ OPCODE_TID(rpl) = cpu_to_be32(MK_OPCODE_TID(CPL_PASS_ACCEPT_RPL,
2482+ ep->hwtid));
2483+
24862484 if (CHELSIO_CHIP_VERSION(adapter_type) > CHELSIO_T4) {
24872485 u32 isn = (prandom_u32() & ~7UL) - 1;
24882486 opt2 |= T5_OPT_2_VALID_F;
drivers/infiniband/hw/hfi1/sdma.c+3−2
@@ -65,6 +65,7 @@ · 64 unmodified lines
6565 #define SDMA_DESCQ_CNT 2048
6666 #define SDMA_DESC_INTR 64
6767 #define INVALID_TAIL 0xffff
68+#define SDMA_PAD max_t(size_t, MAX_16B_PADDING, sizeof(u32))
6869
6970 static uint sdma_descq_cnt = SDMA_DESCQ_CNT;
7071 module_param(sdma_descq_cnt, uint, S_IRUGO);
@@ -1296,7 +1297,7 @@ void sdma_clean(struct hfi1_devdata *dd, size_t num_engines) · 1225 unmodified lines
12961297 struct sdma_engine *sde;
12971298
12981299 if (dd->sdma_pad_dma) {
1299− dma_free_coherent(&dd->pcidev->dev, 4,
1300+ dma_free_coherent(&dd->pcidev->dev, SDMA_PAD,
13001301 (void *)dd->sdma_pad_dma,
13011302 dd->sdma_pad_phys);
13021303 dd->sdma_pad_dma = NULL;
@@ -1491,7 +1492,7 @@ int sdma_init(struct hfi1_devdata *dd, u8 port) · 188 unmodified lines
14911492 }
14921493
14931494 /* Allocate memory for pad */
1494− dd->sdma_pad_dma = dma_alloc_coherent(&dd->pcidev->dev, sizeof(u32),
1495+ dd->sdma_pad_dma = dma_alloc_coherent(&dd->pcidev->dev, SDMA_PAD,
14951496 &dd->sdma_pad_phys, GFP_KERNEL);
14961497 if (!dd->sdma_pad_dma) {
14971498 dd_dev_err(dd, "failed to allocate SendDMA pad memory\n");
drivers/infiniband/hw/hfi1/tid_rdma.c+0−5
@@ -2736,11 +2736,6 @@ static bool handle_read_kdeth_eflags(struct hfi1_ctxtdata *rcd, · 2735 unmodified lines
27362736 diff = cmp_psn(psn,
27372737 flow->flow_state.r_next_psn);
27382738 if (diff > 0) {
2739− if (!(qp->r_flags & RVT_R_RDMAR_SEQ))
2740− restart_tid_rdma_read_req(rcd,
2741− qp,
2742− wqe);
2743−
27442739 /* Drop the packet.*/
27452740 goto s_unlock;
27462741 } else if (diff < 0) {
drivers/infiniband/hw/hfi1/verbs.c+4−6
@@ -147,9 +147,6 @@ static int pio_wait(struct rvt_qp *qp, · 146 unmodified lines
147147 /* Length of buffer to create verbs txreq cache name */
148148 #define TXREQ_NAME_LEN 24
149149
150−/* 16B trailing buffer */
151−static const u8 trail_buf[MAX_16B_PADDING];
152−
153150 static uint wss_threshold = 80;
154151 module_param(wss_threshold, uint, S_IRUGO);
155152 MODULE_PARM_DESC(wss_threshold, "Percentage (1-100) of LLC to use as a threshold for a cacheless copy");
@@ -820,8 +817,8 @@ static int build_verbs_tx_desc( · 664 unmodified lines
820817
821818 /* add icrc, lt byte, and padding to flit */
822819 if (extra_bytes)
823− ret = sdma_txadd_kvaddr(sde->dd, &tx->txreq,
824− (void *)trail_buf, extra_bytes);
820+ ret = sdma_txadd_daddr(sde->dd, &tx->txreq,
821+ sde->dd->sdma_pad_phys, extra_bytes);
825822
826823 bail_txadd:
827824 return ret;
@@ -1089,7 +1086,8 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps, · 261 unmodified lines
10891086 }
10901087 /* add icrc, lt byte, and padding to flit */
10911088 if (extra_bytes)
1092− seg_pio_copy_mid(pbuf, trail_buf, extra_bytes);
1089+ seg_pio_copy_mid(pbuf, ppd->dd->sdma_pad_dma,
1090+ extra_bytes);
10931091
10941092 seg_pio_copy_end(pbuf);
10951093 }
drivers/infiniband/hw/hns/hns_roce_hw_v2.c+3−3
@@ -5389,9 +5389,9 @@ static void hns_roce_v2_free_eq(struct hns_roce_dev *hr_dev, · 5388 unmodified lines
53895389 return;
53905390 }
53915391
5392− if (eq->buf_list)
5393− dma_free_coherent(hr_dev->dev, buf_chk_sz,
5394− eq->buf_list->buf, eq->buf_list->map);
5392+ dma_free_coherent(hr_dev->dev, buf_chk_sz, eq->buf_list->buf,
5393+ eq->buf_list->map);
5394+ kfree(eq->buf_list);
53955395 }
53965396
53975397 static void hns_roce_config_eqc(struct hns_roce_dev *hr_dev,
drivers/infiniband/hw/mlx5/mr.c+2−2
@@ -1967,8 +1967,8 @@ int mlx5_ib_dealloc_mw(struct ib_mw *mw) · 1966 unmodified lines
19671967 int err;
19681968
19691969 if (IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING)) {
1970− xa_erase(&dev->mdev->priv.mkey_table,
1971− mlx5_base_mkey(mmw->mmkey.key));
1970+ xa_erase_irq(&dev->mdev->priv.mkey_table,
1971+ mlx5_base_mkey(mmw->mmkey.key));
19721972 /*
19731973 * pagefault_single_data_segment() may be accessing mmw under
19741974 * SRCU if the user bound an ODP MR to this MW.
drivers/infiniband/hw/mlx5/qp.c+5−3
@@ -3249,10 +3249,12 @@ static int modify_raw_packet_qp_sq( · 3248 unmodified lines
32493249 }
32503250
32513251 /* Only remove the old rate after new rate was set */
3252− if ((old_rl.rate &&
3253− !mlx5_rl_are_equal(&old_rl, &new_rl)) ||
3254− (new_state != MLX5_SQC_STATE_RDY))
3252+ if ((old_rl.rate && !mlx5_rl_are_equal(&old_rl, &new_rl)) ||
3253+ (new_state != MLX5_SQC_STATE_RDY)) {
32553254 mlx5_rl_remove_rate(dev, &old_rl);
3255+ if (new_state != MLX5_SQC_STATE_RDY)
3256+ memset(&new_rl, 0, sizeof(new_rl));
3257+ }
32563258
32573259 ibqp->rl = new_rl;
32583260 sq->state = new_state;
drivers/infiniband/hw/qedr/main.c+1−1
@@ -76,7 +76,7 @@ static void qedr_get_dev_fw_str(struct ib_device *ibdev, char *str) · 75 unmodified lines
7676 struct qedr_dev *qedr = get_qedr_dev(ibdev);
7777 u32 fw_ver = (u32)qedr->attr.fw_ver;
7878
79− snprintf(str, IB_FW_VERSION_NAME_MAX, "%d. %d. %d. %d",
79+ snprintf(str, IB_FW_VERSION_NAME_MAX, "%d.%d.%d.%d",
8080 (fw_ver >> 24) & 0xFF, (fw_ver >> 16) & 0xFF,
8181 (fw_ver >> 8) & 0xFF, fw_ver & 0xFF);
8282 }
drivers/infiniband/sw/siw/siw_qp.c+2−0
@@ -1312,6 +1312,7 @@ int siw_qp_add(struct siw_device *sdev, struct siw_qp *qp) · 1311 unmodified lines
13121312 void siw_free_qp(struct kref *ref)
13131313 {
13141314 struct siw_qp *found, *qp = container_of(ref, struct siw_qp, ref);
1315+ struct siw_base_qp *siw_base_qp = to_siw_base_qp(qp->ib_qp);
13151316 struct siw_device *sdev = qp->sdev;
13161317 unsigned long flags;
13171318
@@ -1334,4 +1335,5 @@ void siw_free_qp(struct kref *ref) · 16 unmodified lines
13341335 atomic_dec(&sdev->num_qp);
13351336 siw_dbg_qp(qp, "free QP\n");
13361337 kfree_rcu(qp, rcu);
1338+ kfree(siw_base_qp);
13371339 }
drivers/infiniband/sw/siw/siw_verbs.c+0−2
@@ -604,7 +604,6 @@ out: · 603 unmodified lines
604604 int siw_destroy_qp(struct ib_qp *base_qp, struct ib_udata *udata)
605605 {
606606 struct siw_qp *qp = to_siw_qp(base_qp);
607− struct siw_base_qp *siw_base_qp = to_siw_base_qp(base_qp);
608607 struct siw_ucontext *uctx =
609608 rdma_udata_to_drv_context(udata, struct siw_ucontext,
610609 base_ucontext);
@@ -641,7 +640,6 @@ int siw_destroy_qp(struct ib_qp *base_qp, struct ib_udata *udata) · 30 unmodified lines
641640 qp->scq = qp->rcq = NULL;
642641
643642 siw_qp_put(qp);
644− kfree(siw_base_qp);
645643
646644 return 0;
647645 }
drivers/interconnect/core.c+4−0
@@ -405,8 +405,12 @@ void icc_set_tag(struct icc_path *path, u32 tag) · 404 unmodified lines
405405 if (!path)
406406 return;
407407
408+ mutex_lock(&icc_lock);
409+
408410 for (i = 0; i < path->num_nodes; i++)
409411 path->reqs[i].tag = tag;
412+
413+ mutex_unlock(&icc_lock);
410414 }
411415 EXPORT_SYMBOL_GPL(icc_set_tag);
412416
drivers/interconnect/qcom/qcs404.c+2−1
@@ -433,7 +433,8 @@ static int qnoc_probe(struct platform_device *pdev) · 432 unmodified lines
433433 if (!qp)
434434 return -ENOMEM;
435435
436− data = devm_kcalloc(dev, num_nodes, sizeof(*node), GFP_KERNEL);
436+ data = devm_kzalloc(dev, struct_size(data, nodes, num_nodes),
437+ GFP_KERNEL);
437438 if (!data)
438439 return -ENOMEM;
439440
drivers/interconnect/qcom/sdm845.c+2−1
@@ -790,7 +790,8 @@ static int qnoc_probe(struct platform_device *pdev) · 789 unmodified lines
790790 if (!qp)
791791 return -ENOMEM;
792792
793− data = devm_kcalloc(&pdev->dev, num_nodes, sizeof(*node), GFP_KERNEL);
793+ data = devm_kzalloc(&pdev->dev, struct_size(data, nodes, num_nodes),
794+ GFP_KERNEL);
794795 if (!data)
795796 return -ENOMEM;
796797
drivers/iommu/amd_iommu_quirks.c+13−0
@@ -73,6 +73,19 @@ static const struct dmi_system_id ivrs_quirks[] __initconst = { · 72 unmodified lines
7373 },
7474 .driver_data = (void *)&ivrs_ioapic_quirks[DELL_LATITUDE_5495],
7575 },
76+ {
77+ /*
78+ * Acer Aspire A315-41 requires the very same workaround as
79+ * Dell Latitude 5495
80+ */
81+ .callback = ivrs_ioapic_quirk_cb,
82+ .ident = "Acer Aspire A315-41",
83+ .matches = {
84+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
85+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A315-41"),
86+ },
87+ .driver_data = (void *)&ivrs_ioapic_quirks[DELL_LATITUDE_5495],
88+ },
7689 {
7790 .callback = ivrs_ioapic_quirk_cb,
7891 .ident = "Lenovo ideapad 330S-15ARR",
drivers/iommu/intel-iommu.c+1−1
@@ -2794,7 +2794,7 @@ static int identity_mapping(struct device *dev) · 2793 unmodified lines
27942794 struct device_domain_info *info;
27952795
27962796 info = dev->archdata.iommu;
2797− if (info && info != DUMMY_DEVICE_DOMAIN_INFO)
2797+ if (info && info != DUMMY_DEVICE_DOMAIN_INFO && info != DEFER_DEVICE_DOMAIN_INFO)
27982798 return (info->domain == si_domain);
27992799
28002800 return 0;
drivers/iommu/ipmmu-vmsa.c+1−3
@@ -1105,10 +1105,8 @@ static int ipmmu_probe(struct platform_device *pdev) · 1104 unmodified lines
11051105 /* Root devices have mandatory IRQs */
11061106 if (ipmmu_is_root(mmu)) {
11071107 irq = platform_get_irq(pdev, 0);
1108− if (irq < 0) {
1109− dev_err(&pdev->dev, "no IRQ found\n");
1108+ if (irq < 0)
11101109 return irq;
1111− }
11121110
11131111 ret = devm_request_irq(&pdev->dev, irq, ipmmu_irq, 0,
11141112 dev_name(&pdev->dev), mmu);
drivers/isdn/capi/capi.c+1−1
@@ -744,7 +744,7 @@ capi_poll(struct file *file, poll_table *wait) · 743 unmodified lines
744744
745745 poll_wait(file, &(cdev->recvwait), wait);
746746 mask = EPOLLOUT | EPOLLWRNORM;
747− if (!skb_queue_empty(&cdev->recvqueue))
747+ if (!skb_queue_empty_lockless(&cdev->recvqueue))
748748 mask |= EPOLLIN | EPOLLRDNORM;
749749 return mask;
750750 }
drivers/net/bonding/bond_alb.c+1−1
@@ -952,7 +952,7 @@ static int alb_upper_dev_walk(struct net_device *upper, void *_data) · 951 unmodified lines
952952 struct bond_vlan_tag *tags;
953953
954954 if (is_vlan_dev(upper) &&
955− bond->nest_level == vlan_get_encap_level(upper) - 1) {
955+ bond->dev->lower_level == upper->lower_level - 1) {
956956 if (upper->addr_assign_type == NET_ADDR_STOLEN) {
957957 alb_send_lp_vid(slave, mac_addr,
958958 vlan_dev_vlan_proto(upper),
drivers/net/bonding/bond_main.c+31−41
@@ -1733,8 +1733,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, · 1732 unmodified lines
17331733 goto err_upper_unlink;
17341734 }
17351735
1736− bond->nest_level = dev_get_nest_level(bond_dev) + 1;
1737−
17381736 /* If the mode uses primary, then the following is handled by
17391737 * bond_change_active_slave().
17401738 */
@@ -1816,7 +1814,8 @@ err_detach: · 75 unmodified lines
18161814 slave_disable_netpoll(new_slave);
18171815
18181816 err_close:
1819− slave_dev->priv_flags &= ~IFF_BONDING;
1817+ if (!netif_is_bond_master(slave_dev))
1818+ slave_dev->priv_flags &= ~IFF_BONDING;
18201819 dev_close(slave_dev);
18211820
18221821 err_restore_mac:
@@ -1956,9 +1955,6 @@ static int __bond_release_one(struct net_device *bond_dev, · 133 unmodified lines
19561955 if (!bond_has_slaves(bond)) {
19571956 bond_set_carrier(bond);
19581957 eth_hw_addr_random(bond_dev);
1959− bond->nest_level = SINGLE_DEPTH_NESTING;
1960− } else {
1961− bond->nest_level = dev_get_nest_level(bond_dev) + 1;
19621958 }
19631959
19641960 unblock_netpoll_tx();
@@ -2017,7 +2013,8 @@ static int __bond_release_one(struct net_device *bond_dev, · 52 unmodified lines
20172013 else
20182014 dev_set_mtu(slave_dev, slave->original_mtu);
20192015
2020− slave_dev->priv_flags &= ~IFF_BONDING;
2016+ if (!netif_is_bond_master(slave_dev))
2017+ slave_dev->priv_flags &= ~IFF_BONDING;
20212018
20222019 bond_free_slave(slave);
20232020
@@ -2086,8 +2083,7 @@ static int bond_miimon_inspect(struct bonding *bond) · 62 unmodified lines
20862083 ignore_updelay = !rcu_dereference(bond->curr_active_slave);
20872084
20882085 bond_for_each_slave_rcu(bond, slave, iter) {
2089− slave->new_link = BOND_LINK_NOCHANGE;
2090− slave->link_new_state = slave->link;
2086+ bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
20912087
20922088 link_state = bond_check_dev_link(bond, slave->dev, 0);
20932089
@@ -2121,7 +2117,7 @@ static int bond_miimon_inspect(struct bonding *bond) · 27 unmodified lines
21212117 }
21222118
21232119 if (slave->delay <= 0) {
2124− slave->new_link = BOND_LINK_DOWN;
2120+ bond_propose_link_state(slave, BOND_LINK_DOWN);
21252121 commit++;
21262122 continue;
21272123 }
@@ -2158,7 +2154,7 @@ static int bond_miimon_inspect(struct bonding *bond) · 30 unmodified lines
21582154 slave->delay = 0;
21592155
21602156 if (slave->delay <= 0) {
2161− slave->new_link = BOND_LINK_UP;
2157+ bond_propose_link_state(slave, BOND_LINK_UP);
21622158 commit++;
21632159 ignore_updelay = false;
21642160 continue;
@@ -2196,7 +2192,7 @@ static void bond_miimon_commit(struct bonding *bond) · 31 unmodified lines
21962192 struct slave *slave, *primary;
21972193
21982194 bond_for_each_slave(bond, slave, iter) {
2199− switch (slave->new_link) {
2195+ switch (slave->link_new_state) {
22002196 case BOND_LINK_NOCHANGE:
22012197 /* For 802.3ad mode, check current slave speed and
22022198 * duplex again in case its port was disabled after
@@ -2268,8 +2264,8 @@ static void bond_miimon_commit(struct bonding *bond) · 65 unmodified lines
22682264
22692265 default:
22702266 slave_err(bond->dev, slave->dev, "invalid new link %d on slave\n",
2271− slave->new_link);
2272− slave->new_link = BOND_LINK_NOCHANGE;
2267+ slave->link_new_state);
2268+ bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
22732269
22742270 continue;
22752271 }
@@ -2677,13 +2673,13 @@ static void bond_loadbalance_arp_mon(struct bonding *bond) · 401 unmodified lines
26772673 bond_for_each_slave_rcu(bond, slave, iter) {
26782674 unsigned long trans_start = dev_trans_start(slave->dev);
26792675
2680− slave->new_link = BOND_LINK_NOCHANGE;
2676+ bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
26812677
26822678 if (slave->link != BOND_LINK_UP) {
26832679 if (bond_time_in_interval(bond, trans_start, 1) &&
26842680 bond_time_in_interval(bond, slave->last_rx, 1)) {
26852681
2686− slave->new_link = BOND_LINK_UP;
2682+ bond_propose_link_state(slave, BOND_LINK_UP);
26872683 slave_state_changed = 1;
26882684
26892685 /* primary_slave has no meaning in round-robin
@@ -2708,7 +2704,7 @@ static void bond_loadbalance_arp_mon(struct bonding *bond) · 18 unmodified lines
27082704 if (!bond_time_in_interval(bond, trans_start, 2) ||
27092705 !bond_time_in_interval(bond, slave->last_rx, 2)) {
27102706
2711− slave->new_link = BOND_LINK_DOWN;
2707+ bond_propose_link_state(slave, BOND_LINK_DOWN);
27122708 slave_state_changed = 1;
27132709
27142710 if (slave->link_failure_count < UINT_MAX)
@@ -2739,8 +2735,8 @@ static void bond_loadbalance_arp_mon(struct bonding *bond) · 24 unmodified lines
27392735 goto re_arm;
27402736
27412737 bond_for_each_slave(bond, slave, iter) {
2742− if (slave->new_link != BOND_LINK_NOCHANGE)
2743− slave->link = slave->new_link;
2738+ if (slave->link_new_state != BOND_LINK_NOCHANGE)
2739+ slave->link = slave->link_new_state;
27442740 }
27452741
27462742 if (slave_state_changed) {
@@ -2763,9 +2759,9 @@ re_arm: · 16 unmodified lines
27632759 }
27642760
27652761 /* Called to inspect slaves for active-backup mode ARP monitor link state
2766− * changes. Sets new_link in slaves to specify what action should take
2767− * place for the slave. Returns 0 if no changes are found, >0 if changes
2768− * to link states must be committed.
2762+ * changes. Sets proposed link state in slaves to specify what action
2763+ * should take place for the slave. Returns 0 if no changes are found, >0
2764+ * if changes to link states must be committed.
27692765 *
27702766 * Called with rcu_read_lock held.
27712767 */
@@ -2777,12 +2773,12 @@ static int bond_ab_arp_inspect(struct bonding *bond) · 5 unmodified lines
27772773 int commit = 0;
27782774
27792775 bond_for_each_slave_rcu(bond, slave, iter) {
2780− slave->new_link = BOND_LINK_NOCHANGE;
2776+ bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
27812777 last_rx = slave_last_rx(bond, slave);
27822778
27832779 if (slave->link != BOND_LINK_UP) {
27842780 if (bond_time_in_interval(bond, last_rx, 1)) {
2785− slave->new_link = BOND_LINK_UP;
2781+ bond_propose_link_state(slave, BOND_LINK_UP);
27862782 commit++;
27872783 }
27882784 continue;
@@ -2810,7 +2806,7 @@ static int bond_ab_arp_inspect(struct bonding *bond) · 21 unmodified lines
28102806 if (!bond_is_active_slave(slave) &&
28112807 !rcu_access_pointer(bond->current_arp_slave) &&
28122808 !bond_time_in_interval(bond, last_rx, 3)) {
2813− slave->new_link = BOND_LINK_DOWN;
2809+ bond_propose_link_state(slave, BOND_LINK_DOWN);
28142810 commit++;
28152811 }
28162812
@@ -2823,7 +2819,7 @@ static int bond_ab_arp_inspect(struct bonding *bond) · 6 unmodified lines
28232819 if (bond_is_active_slave(slave) &&
28242820 (!bond_time_in_interval(bond, trans_start, 2) ||
28252821 !bond_time_in_interval(bond, last_rx, 2))) {
2826− slave->new_link = BOND_LINK_DOWN;
2822+ bond_propose_link_state(slave, BOND_LINK_DOWN);
28272823 commit++;
28282824 }
28292825 }
@@ -2843,7 +2839,7 @@ static void bond_ab_arp_commit(struct bonding *bond) · 13 unmodified lines
28432839 struct slave *slave;
28442840
28452841 bond_for_each_slave(bond, slave, iter) {
2846− switch (slave->new_link) {
2842+ switch (slave->link_new_state) {
28472843 case BOND_LINK_NOCHANGE:
28482844 continue;
28492845
@@ -2893,8 +2889,9 @@ static void bond_ab_arp_commit(struct bonding *bond) · 43 unmodified lines
28932889 continue;
28942890
28952891 default:
2896− slave_err(bond->dev, slave->dev, "impossible: new_link %d on slave\n",
2897− slave->new_link);
2892+ slave_err(bond->dev, slave->dev,
2893+ "impossible: link_new_state %d on slave\n",
2894+ slave->link_new_state);
28982895 continue;
28992896 }
29002897
@@ -3442,13 +3439,6 @@ static void bond_fold_stats(struct rtnl_link_stats64 *_res, · 541 unmodified lines
34423439 }
34433440 }
34443441
3445−static int bond_get_nest_level(struct net_device *bond_dev)
3446−{
3447− struct bonding *bond = netdev_priv(bond_dev);
3448−
3449− return bond->nest_level;
3450−}
3451−
34523442 static void bond_get_stats(struct net_device *bond_dev,
34533443 struct rtnl_link_stats64 *stats)
34543444 {
@@ -3457,7 +3447,7 @@ static void bond_get_stats(struct net_device *bond_dev, · 2 unmodified lines
34573447 struct list_head *iter;
34583448 struct slave *slave;
34593449
3460− spin_lock_nested(&bond->stats_lock, bond_get_nest_level(bond_dev));
3450+ spin_lock(&bond->stats_lock);
34613451 memcpy(stats, &bond->bond_stats, sizeof(*stats));
34623452
34633453 rcu_read_lock();
@@ -4268,7 +4258,6 @@ static const struct net_device_ops bond_netdev_ops = { · 804 unmodified lines
42684258 .ndo_neigh_setup = bond_neigh_setup,
42694259 .ndo_vlan_rx_add_vid = bond_vlan_rx_add_vid,
42704260 .ndo_vlan_rx_kill_vid = bond_vlan_rx_kill_vid,
4271− .ndo_get_lock_subclass = bond_get_nest_level,
42724261 #ifdef CONFIG_NET_POLL_CONTROLLER
42734262 .ndo_netpoll_setup = bond_netpoll_setup,
42744263 .ndo_netpoll_cleanup = bond_netpoll_cleanup,
@@ -4296,7 +4285,6 @@ void bond_setup(struct net_device *bond_dev) · 21 unmodified lines
42964285 struct bonding *bond = netdev_priv(bond_dev);
42974286
42984287 spin_lock_init(&bond->mode_lock);
4299− spin_lock_init(&bond->stats_lock);
43004288 bond->params = bonding_defaults;
43014289
43024290 /* Initialize pointers */
@@ -4365,6 +4353,7 @@ static void bond_uninit(struct net_device *bond_dev) · 62 unmodified lines
43654353
43664354 list_del(&bond->bond_list);
43674355
4356+ lockdep_unregister_key(&bond->stats_lock_key);
43684357 bond_debug_unregister(bond);
43694358 }
43704359
@@ -4768,8 +4757,9 @@ static int bond_init(struct net_device *bond_dev) · 397 unmodified lines
47684757 if (!bond->wq)
47694758 return -ENOMEM;
47704759
4771− bond->nest_level = SINGLE_DEPTH_NESTING;
4772− netdev_lockdep_set_classes(bond_dev);
4760+ spin_lock_init(&bond->stats_lock);
4761+ lockdep_register_key(&bond->stats_lock_key);
4762+ lockdep_set_class(&bond->stats_lock, &bond->stats_lock_key);
47734763
47744764 list_add_tail(&bond->bond_list, &bn->dev_list);
47754765
drivers/net/can/c_can/c_can.c+64−7
@@ -52,6 +52,7 @@ · 51 unmodified lines
5252 #define CONTROL_EX_PDR BIT(8)
5353
5454 /* control register */
55+#define CONTROL_SWR BIT(15)
5556 #define CONTROL_TEST BIT(7)
5657 #define CONTROL_CCE BIT(6)
5758 #define CONTROL_DISABLE_AR BIT(5)
@@ -97,6 +98,9 @@ · 39 unmodified lines
9798 #define BTR_TSEG2_SHIFT 12
9899 #define BTR_TSEG2_MASK (0x7 << BTR_TSEG2_SHIFT)
99100
101+/* interrupt register */
102+#define INT_STS_PENDING 0x8000
103+
100104 /* brp extension register */
101105 #define BRP_EXT_BRPE_MASK 0x0f
102106 #define BRP_EXT_BRPE_SHIFT 0
@@ -569,6 +573,26 @@ static void c_can_configure_msg_objects(struct net_device *dev) · 466 unmodified lines
569573 IF_MCONT_RCV_EOB);
570574 }
571575
576+static int c_can_software_reset(struct net_device *dev)
577+{
578+ struct c_can_priv *priv = netdev_priv(dev);
579+ int retry = 0;
580+
581+ if (priv->type != BOSCH_D_CAN)
582+ return 0;
583+
584+ priv->write_reg(priv, C_CAN_CTRL_REG, CONTROL_SWR | CONTROL_INIT);
585+ while (priv->read_reg(priv, C_CAN_CTRL_REG) & CONTROL_SWR) {
586+ msleep(20);
587+ if (retry++ > 100) {
588+ netdev_err(dev, "CCTRL: software reset failed\n");
589+ return -EIO;
590+ }
591+ }
592+
593+ return 0;
594+}
595+
572596 /*
573597 * Configure C_CAN chip:
574598 * - enable/disable auto-retransmission
@@ -578,6 +602,11 @@ static void c_can_configure_msg_objects(struct net_device *dev) · 3 unmodified lines
578602 static int c_can_chip_config(struct net_device *dev)
579603 {
580604 struct c_can_priv *priv = netdev_priv(dev);
605+ int err;
606+
607+ err = c_can_software_reset(dev);
608+ if (err)
609+ return err;
581610
582611 /* enable automatic retransmission */
583612 priv->write_reg(priv, C_CAN_CTRL_REG, CONTROL_ENABLE_AR);
@@ -886,6 +915,9 @@ static int c_can_handle_state_change(struct net_device *dev, · 302 unmodified lines
886915 struct can_berr_counter bec;
887916
888917 switch (error_type) {
918+ case C_CAN_NO_ERROR:
919+ priv->can.state = CAN_STATE_ERROR_ACTIVE;
920+ break;
889921 case C_CAN_ERROR_WARNING:
890922 /* error warning state */
891923 priv->can.can_stats.error_warning++;
@@ -916,6 +948,13 @@ static int c_can_handle_state_change(struct net_device *dev, · 24 unmodified lines
916948 ERR_CNT_RP_SHIFT;
917949
918950 switch (error_type) {
951+ case C_CAN_NO_ERROR:
952+ /* error warning state */
953+ cf->can_id |= CAN_ERR_CRTL;
954+ cf->data[1] = CAN_ERR_CRTL_ACTIVE;
955+ cf->data[6] = bec.txerr;
956+ cf->data[7] = bec.rxerr;
957+ break;
919958 case C_CAN_ERROR_WARNING:
920959 /* error warning state */
921960 cf->can_id |= CAN_ERR_CRTL;
@@ -1029,10 +1068,16 @@ static int c_can_poll(struct napi_struct *napi, int quota) · 107 unmodified lines
10291068 u16 curr, last = priv->last_status;
10301069 int work_done = 0;
10311070
1032− priv->last_status = curr = priv->read_reg(priv, C_CAN_STS_REG);
1033− /* Ack status on C_CAN. D_CAN is self clearing */
1034− if (priv->type != BOSCH_D_CAN)
1035− priv->write_reg(priv, C_CAN_STS_REG, LEC_UNUSED);
1071+ /* Only read the status register if a status interrupt was pending */
1072+ if (atomic_xchg(&priv->sie_pending, 0)) {
1073+ priv->last_status = curr = priv->read_reg(priv, C_CAN_STS_REG);
1074+ /* Ack status on C_CAN. D_CAN is self clearing */
1075+ if (priv->type != BOSCH_D_CAN)
1076+ priv->write_reg(priv, C_CAN_STS_REG, LEC_UNUSED);
1077+ } else {
1078+ /* no change detected ... */
1079+ curr = last;
1080+ }
10361081
10371082 /* handle state changes */
10381083 if ((curr & STATUS_EWARN) && (!(last & STATUS_EWARN))) {
@@ -1054,11 +1099,17 @@ static int c_can_poll(struct napi_struct *napi, int quota) · 15 unmodified lines
10541099 /* handle bus recovery events */
10551100 if ((!(curr & STATUS_BOFF)) && (last & STATUS_BOFF)) {
10561101 netdev_dbg(dev, "left bus off state\n");
1057− priv->can.state = CAN_STATE_ERROR_ACTIVE;
1102+ work_done += c_can_handle_state_change(dev, C_CAN_ERROR_PASSIVE);
10581103 }
1104+
10591105 if ((!(curr & STATUS_EPASS)) && (last & STATUS_EPASS)) {
10601106 netdev_dbg(dev, "left error passive state\n");
1061− priv->can.state = CAN_STATE_ERROR_ACTIVE;
1107+ work_done += c_can_handle_state_change(dev, C_CAN_ERROR_WARNING);
1108+ }
1109+
1110+ if ((!(curr & STATUS_EWARN)) && (last & STATUS_EWARN)) {
1111+ netdev_dbg(dev, "left error warning state\n");
1112+ work_done += c_can_handle_state_change(dev, C_CAN_NO_ERROR);
10621113 }
10631114
10641115 /* handle lec errors on the bus */
@@ -1083,10 +1134,16 @@ static irqreturn_t c_can_isr(int irq, void *dev_id) · 18 unmodified lines
10831134 {
10841135 struct net_device *dev = (struct net_device *)dev_id;
10851136 struct c_can_priv *priv = netdev_priv(dev);
1137+ int reg_int;
10861138
1087− if (!priv->read_reg(priv, C_CAN_INT_REG))
1139+ reg_int = priv->read_reg(priv, C_CAN_INT_REG);
1140+ if (!reg_int)
10881141 return IRQ_NONE;
10891142
1143+ /* save for later use */
1144+ if (reg_int & INT_STS_PENDING)
1145+ atomic_set(&priv->sie_pending, 1);
1146+
10901147 /* disable all interrupts and schedule the NAPI */
10911148 c_can_irq_control(priv, false);
10921149 napi_schedule(&priv->napi);
drivers/net/can/c_can/c_can.h+1−0
@@ -198,6 +198,7 @@ struct c_can_priv { · 197 unmodified lines
198198 struct net_device *dev;
199199 struct device *device;
200200 atomic_t tx_active;
201+ atomic_t sie_pending;
201202 unsigned long tx_dir;
202203 int last_status;
203204 u16 (*read_reg) (const struct c_can_priv *priv, enum reg index);
drivers/net/can/dev.c+1−0
@@ -848,6 +848,7 @@ void of_can_transceiver(struct net_device *dev) · 847 unmodified lines
848848 return;
849849
850850 ret = of_property_read_u32(dn, "max-bitrate", &priv->bitrate_max);
851+ of_node_put(dn);
851852 if ((ret && ret != -EINVAL) || (!ret && !priv->bitrate_max))
852853 netdev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit.\n");
853854 }
drivers/net/can/flexcan.c+9−2
@@ -677,6 +677,7 @@ static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr) · 676 unmodified lines
677677 struct can_frame *cf;
678678 bool rx_errors = false, tx_errors = false;
679679 u32 timestamp;
680+ int err;
680681
681682 timestamp = priv->read(&regs->timer) << 16;
682683
@@ -725,7 +726,9 @@ static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr) · 42 unmodified lines
725726 if (tx_errors)
726727 dev->stats.tx_errors++;
727728
728− can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
729+ err = can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
730+ if (err)
731+ dev->stats.rx_fifo_errors++;
729732 }
730733
731734 static void flexcan_irq_state(struct net_device *dev, u32 reg_esr)
@@ -738,6 +741,7 @@ static void flexcan_irq_state(struct net_device *dev, u32 reg_esr) · 6 unmodified lines
738741 int flt;
739742 struct can_berr_counter bec;
740743 u32 timestamp;
744+ int err;
741745
742746 timestamp = priv->read(&regs->timer) << 16;
743747
@@ -769,7 +773,9 @@ static void flexcan_irq_state(struct net_device *dev, u32 reg_esr) · 25 unmodified lines
769773 if (unlikely(new_state == CAN_STATE_BUS_OFF))
770774 can_bus_off(dev);
771775
772− can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
776+ err = can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
777+ if (err)
778+ dev->stats.rx_fifo_errors++;
773779 }
774780
775781 static inline struct flexcan_priv *rx_offload_to_priv(struct can_rx_offload *offload)
@@ -1188,6 +1194,7 @@ static int flexcan_chip_start(struct net_device *dev) · 412 unmodified lines
11881194 reg_mecr = priv->read(&regs->mecr);
11891195 reg_mecr &= ~FLEXCAN_MECR_ECRWRDIS;
11901196 priv->write(reg_mecr, &regs->mecr);
1197+ reg_mecr |= FLEXCAN_MECR_ECCDIS;
11911198 reg_mecr &= ~(FLEXCAN_MECR_NCEFAFRZ | FLEXCAN_MECR_HANCEI_MSK |
11921199 FLEXCAN_MECR_FANCEI_MSK);
11931200 priv->write(reg_mecr, &regs->mecr);
drivers/net/can/rx-offload.c+85−17
@@ -107,37 +107,95 @@ static int can_rx_offload_compare(struct sk_buff *a, struct sk_buff *b) · 106 unmodified lines
107107 return cb_b->timestamp - cb_a->timestamp;
108108 }
109109
110−static struct sk_buff *can_rx_offload_offload_one(struct can_rx_offload *offload, unsigned int n)
110+/**
111+ * can_rx_offload_offload_one() - Read one CAN frame from HW
112+ * @offload: pointer to rx_offload context
113+ * @n: number of mailbox to read
114+ *
115+ * The task of this function is to read a CAN frame from mailbox @n
116+ * from the device and return the mailbox's content as a struct
117+ * sk_buff.
118+ *
119+ * If the struct can_rx_offload::skb_queue exceeds the maximal queue
120+ * length (struct can_rx_offload::skb_queue_len_max) or no skb can be
121+ * allocated, the mailbox contents is discarded by reading it into an
122+ * overflow buffer. This way the mailbox is marked as free by the
123+ * driver.
124+ *
125+ * Return: A pointer to skb containing the CAN frame on success.
126+ *
127+ * NULL if the mailbox @n is empty.
128+ *
129+ * ERR_PTR() in case of an error
130+ */
131+static struct sk_buff *
132+can_rx_offload_offload_one(struct can_rx_offload *offload, unsigned int n)
111133 {
112− struct sk_buff *skb = NULL;
134+ struct sk_buff *skb = NULL, *skb_error = NULL;
113135 struct can_rx_offload_cb *cb;
114136 struct can_frame *cf;
115137 int ret;
116138
117− /* If queue is full or skb not available, read to discard mailbox */
118− if (likely(skb_queue_len(&offload->skb_queue) <=
119− offload->skb_queue_len_max))
139+ if (likely(skb_queue_len(&offload->skb_queue) <
140+ offload->skb_queue_len_max)) {
120141 skb = alloc_can_skb(offload->dev, &cf);
142+ if (unlikely(!skb))
143+ skb_error = ERR_PTR(-ENOMEM); /* skb alloc failed */
144+ } else {
145+ skb_error = ERR_PTR(-ENOBUFS); /* skb_queue is full */
146+ }
121147
122− if (!skb) {
148+ /* If queue is full or skb not available, drop by reading into
149+ * overflow buffer.
150+ */
151+ if (unlikely(skb_error)) {
123152 struct can_frame cf_overflow;
124153 u32 timestamp;
125154
126155 ret = offload->mailbox_read(offload, &cf_overflow,
127156 &timestamp, n);
128− if (ret)
129− offload->dev->stats.rx_dropped++;
130157
131− return NULL;
158+ /* Mailbox was empty. */
159+ if (unlikely(!ret))
160+ return NULL;
161+
162+ /* Mailbox has been read and we're dropping it or
163+ * there was a problem reading the mailbox.
164+ *
165+ * Increment error counters in any case.
166+ */
167+ offload->dev->stats.rx_dropped++;
168+ offload->dev->stats.rx_fifo_errors++;
169+
170+ /* There was a problem reading the mailbox, propagate
171+ * error value.
172+ */
173+ if (unlikely(ret < 0))
174+ return ERR_PTR(ret);
175+
176+ return skb_error;
132177 }
133178
134179 cb = can_rx_offload_get_cb(skb);
135180 ret = offload->mailbox_read(offload, cf, &cb->timestamp, n);
136− if (!ret) {
181+
182+ /* Mailbox was empty. */
183+ if (unlikely(!ret)) {
137184 kfree_skb(skb);
138185 return NULL;
139186 }
140187
188+ /* There was a problem reading the mailbox, propagate error value. */
189+ if (unlikely(ret < 0)) {
190+ kfree_skb(skb);
191+
192+ offload->dev->stats.rx_dropped++;
193+ offload->dev->stats.rx_fifo_errors++;
194+
195+ return ERR_PTR(ret);
196+ }
197+
198+ /* Mailbox was read. */
141199 return skb;
142200 }
143201
@@ -157,8 +215,8 @@ int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, u64 pen · 13 unmodified lines
157215 continue;
158216
159217 skb = can_rx_offload_offload_one(offload, i);
160− if (!skb)
161− break;
218+ if (IS_ERR_OR_NULL(skb))
219+ continue;
162220
163221 __skb_queue_add_sort(&skb_queue, skb, can_rx_offload_compare);
164222 }
@@ -188,7 +246,13 @@ int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload) · 23 unmodified lines
188246 struct sk_buff *skb;
189247 int received = 0;
190248
191− while ((skb = can_rx_offload_offload_one(offload, 0))) {
249+ while (1) {
250+ skb = can_rx_offload_offload_one(offload, 0);
251+ if (IS_ERR(skb))
252+ continue;
253+ if (!skb)
254+ break;
255+
192256 skb_queue_tail(&offload->skb_queue, skb);
193257 received++;
194258 }
@@ -207,8 +271,10 @@ int can_rx_offload_queue_sorted(struct can_rx_offload *offload, · 12 unmodified lines
207271 unsigned long flags;
208272
209273 if (skb_queue_len(&offload->skb_queue) >
210− offload->skb_queue_len_max)
211− return -ENOMEM;
274+ offload->skb_queue_len_max) {
275+ kfree_skb(skb);
276+ return -ENOBUFS;
277+ }
212278
213279 cb = can_rx_offload_get_cb(skb);
214280 cb->timestamp = timestamp;
@@ -250,8 +316,10 @@ int can_rx_offload_queue_tail(struct can_rx_offload *offload, · 35 unmodified lines
250316 struct sk_buff *skb)
251317 {
252318 if (skb_queue_len(&offload->skb_queue) >
253− offload->skb_queue_len_max)
254− return -ENOMEM;
319+ offload->skb_queue_len_max) {
320+ kfree_skb(skb);
321+ return -ENOBUFS;
322+ }
255323
256324 skb_queue_tail(&offload->skb_queue, skb);
257325 can_rx_offload_schedule(offload);
drivers/net/can/spi/mcp251x.c+1−1
@@ -717,6 +717,7 @@ static void mcp251x_restart_work_handler(struct work_struct *ws) · 716 unmodified lines
717717 if (priv->after_suspend) {
718718 mcp251x_hw_reset(spi);
719719 mcp251x_setup(net, spi);
720+ priv->force_quit = 0;
720721 if (priv->after_suspend & AFTER_SUSPEND_RESTART) {
721722 mcp251x_set_normal_mode(spi);
722723 } else if (priv->after_suspend & AFTER_SUSPEND_UP) {
@@ -728,7 +729,6 @@ static void mcp251x_restart_work_handler(struct work_struct *ws) · 5 unmodified lines
728729 mcp251x_hw_sleep(spi);
729730 }
730731 priv->after_suspend = 0;
731− priv->force_quit = 0;
732732 }
733733
734734 if (priv->restart_tx) {
drivers/net/can/ti_hecc.c+148−84
@@ -73,6 +73,7 @@ MODULE_VERSION(HECC_MODULE_VERSION); · 72 unmodified lines
7373 */
7474 #define HECC_MAX_RX_MBOX (HECC_MAX_MAILBOXES - HECC_MAX_TX_MBOX)
7575 #define HECC_RX_FIRST_MBOX (HECC_MAX_MAILBOXES - 1)
76+#define HECC_RX_LAST_MBOX (HECC_MAX_TX_MBOX)
7677
7778 /* TI HECC module registers */
7879 #define HECC_CANME 0x0 /* Mailbox enable */
@@ -82,7 +83,7 @@ MODULE_VERSION(HECC_MODULE_VERSION); · 3 unmodified lines
8283 #define HECC_CANTA 0x10 /* Transmission acknowledge */
8384 #define HECC_CANAA 0x14 /* Abort acknowledge */
8485 #define HECC_CANRMP 0x18 /* Receive message pending */
85−#define HECC_CANRML 0x1C /* Remote message lost */
86+#define HECC_CANRML 0x1C /* Receive message lost */
8687 #define HECC_CANRFP 0x20 /* Remote frame pending */
8788 #define HECC_CANGAM 0x24 /* SECC only:Global acceptance mask */
8889 #define HECC_CANMC 0x28 /* Master control */
@@ -149,6 +150,8 @@ MODULE_VERSION(HECC_MODULE_VERSION); · 60 unmodified lines
149150 #define HECC_BUS_ERROR (HECC_CANES_FE | HECC_CANES_BE |\
150151 HECC_CANES_CRCE | HECC_CANES_SE |\
151152 HECC_CANES_ACKE)
153+#define HECC_CANES_FLAGS (HECC_BUS_ERROR | HECC_CANES_BO |\
154+ HECC_CANES_EP | HECC_CANES_EW)
152155
153156 #define HECC_CANMCF_RTR BIT(4) /* Remote transmit request */
154157
@@ -382,8 +385,18 @@ static void ti_hecc_start(struct net_device *ndev) · 227 unmodified lines
382385 hecc_set_bit(priv, HECC_CANMIM, mbx_mask);
383386 }
384387
385− /* Prevent message over-write & Enable interrupts */
386− hecc_write(priv, HECC_CANOPC, HECC_SET_REG);
388+ /* Enable tx interrupts */
389+ hecc_set_bit(priv, HECC_CANMIM, BIT(HECC_MAX_TX_MBOX) - 1);
390+
391+ /* Prevent message over-write to create a rx fifo, but not for
392+ * the lowest priority mailbox, since that allows detecting
393+ * overflows instead of the hardware silently dropping the
394+ * messages.
395+ */
396+ mbx_mask = ~BIT(HECC_RX_LAST_MBOX);
397+ hecc_write(priv, HECC_CANOPC, mbx_mask);
398+
399+ /* Enable interrupts */
387400 if (priv->use_hecc1int) {
388401 hecc_write(priv, HECC_CANMIL, HECC_SET_REG);
389402 hecc_write(priv, HECC_CANGIM, HECC_CANGIM_DEF_MASK |
@@ -400,6 +413,9 @@ static void ti_hecc_stop(struct net_device *ndev) · 10 unmodified lines
400413 {
401414 struct ti_hecc_priv *priv = netdev_priv(ndev);
402415
416+ /* Disable the CPK; stop sending, erroring and acking */
417+ hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_CCR);
418+
403419 /* Disable interrupts and disable mailboxes */
404420 hecc_write(priv, HECC_CANGIM, 0);
405421 hecc_write(priv, HECC_CANMIM, 0);
@@ -508,8 +524,6 @@ static netdev_tx_t ti_hecc_xmit(struct sk_buff *skb, struct net_device *ndev) · 102 unmodified lines
508524 hecc_set_bit(priv, HECC_CANME, mbx_mask);
509525 spin_unlock_irqrestore(&priv->mbx_lock, flags);
510526
511− hecc_clear_bit(priv, HECC_CANMD, mbx_mask);
512− hecc_set_bit(priv, HECC_CANMIM, mbx_mask);
513527 hecc_write(priv, HECC_CANTRS, mbx_mask);
514528
515529 return NETDEV_TX_OK;
@@ -526,8 +540,10 @@ static unsigned int ti_hecc_mailbox_read(struct can_rx_offload *offload, · 10 unmodified lines
526540 u32 *timestamp, unsigned int mbxno)
527541 {
528542 struct ti_hecc_priv *priv = rx_offload_to_priv(offload);
529− u32 data;
543+ u32 data, mbx_mask;
544+ int ret = 1;
530545
546+ mbx_mask = BIT(mbxno);
531547 data = hecc_read_mbx(priv, mbxno, HECC_CANMID);
532548 if (data & HECC_CANMID_IDE)
533549 cf->can_id = (data & CAN_EFF_MASK) | CAN_EFF_FLAG;
@@ -548,7 +564,25 @@ static unsigned int ti_hecc_mailbox_read(struct can_rx_offload *offload, · 14 unmodified lines
548564
549565 *timestamp = hecc_read_stamp(priv, mbxno);
550566
551− return 1;
567+ /* Check for FIFO overrun.
568+ *
569+ * All but the last RX mailbox have activated overwrite
570+ * protection. So skip check for overrun, if we're not
571+ * handling the last RX mailbox.
572+ *
573+ * As the overwrite protection for the last RX mailbox is
574+ * disabled, the CAN core might update while we're reading
575+ * it. This means the skb might be inconsistent.
576+ *
577+ * Return an error to let rx-offload discard this CAN frame.
578+ */
579+ if (unlikely(mbxno == HECC_RX_LAST_MBOX &&
580+ hecc_read(priv, HECC_CANRML) & mbx_mask))
581+ ret = -ENOBUFS;
582+
583+ hecc_write(priv, HECC_CANRMP, mbx_mask);
584+
585+ return ret;
552586 }
553587
554588 static int ti_hecc_error(struct net_device *ndev, int int_status,
@@ -558,92 +592,73 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, · 3 unmodified lines
558592 struct can_frame *cf;
559593 struct sk_buff *skb;
560594 u32 timestamp;
595+ int err;
561596
562− /* propagate the error condition to the can stack */
563− skb = alloc_can_err_skb(ndev, &cf);
564− if (!skb) {
565− if (printk_ratelimit())
566− netdev_err(priv->ndev,
567− "%s: alloc_can_err_skb() failed\n",
568− __func__);
569− return -ENOMEM;
570− }
571−
572− if (int_status & HECC_CANGIF_WLIF) { /* warning level int */
573− if ((int_status & HECC_CANGIF_BOIF) == 0) {
574− priv->can.state = CAN_STATE_ERROR_WARNING;
575− ++priv->can.can_stats.error_warning;
576− cf->can_id |= CAN_ERR_CRTL;
577− if (hecc_read(priv, HECC_CANTEC) > 96)
578− cf->data[1] |= CAN_ERR_CRTL_TX_WARNING;
579− if (hecc_read(priv, HECC_CANREC) > 96)
580− cf->data[1] |= CAN_ERR_CRTL_RX_WARNING;
581− }
582− hecc_set_bit(priv, HECC_CANES, HECC_CANES_EW);
583− netdev_dbg(priv->ndev, "Error Warning interrupt\n");
584− hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR);
585− }
586−
587− if (int_status & HECC_CANGIF_EPIF) { /* error passive int */
588− if ((int_status & HECC_CANGIF_BOIF) == 0) {
589− priv->can.state = CAN_STATE_ERROR_PASSIVE;
590− ++priv->can.can_stats.error_passive;
591− cf->can_id |= CAN_ERR_CRTL;
592− if (hecc_read(priv, HECC_CANTEC) > 127)
593− cf->data[1] |= CAN_ERR_CRTL_TX_PASSIVE;
594− if (hecc_read(priv, HECC_CANREC) > 127)
595− cf->data[1] |= CAN_ERR_CRTL_RX_PASSIVE;
597+ if (err_status & HECC_BUS_ERROR) {
598+ /* propagate the error condition to the can stack */
599+ skb = alloc_can_err_skb(ndev, &cf);
600+ if (!skb) {
601+ if (net_ratelimit())
602+ netdev_err(priv->ndev,
603+ "%s: alloc_can_err_skb() failed\n",
604+ __func__);
605+ return -ENOMEM;
596606 }
597− hecc_set_bit(priv, HECC_CANES, HECC_CANES_EP);
598− netdev_dbg(priv->ndev, "Error passive interrupt\n");
599− hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR);
600− }
601−
602− /* Need to check busoff condition in error status register too to
603− * ensure warning interrupts don't hog the system
604− */
605− if ((int_status & HECC_CANGIF_BOIF) || (err_status & HECC_CANES_BO)) {
606− priv->can.state = CAN_STATE_BUS_OFF;
607− cf->can_id |= CAN_ERR_BUSOFF;
608− hecc_set_bit(priv, HECC_CANES, HECC_CANES_BO);
609− hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR);
610− /* Disable all interrupts in bus-off to avoid int hog */
611− hecc_write(priv, HECC_CANGIM, 0);
612− ++priv->can.can_stats.bus_off;
613− can_bus_off(ndev);
614− }
615607
616− if (err_status & HECC_BUS_ERROR) {
617608 ++priv->can.can_stats.bus_error;
618609 cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;
619− if (err_status & HECC_CANES_FE) {
620− hecc_set_bit(priv, HECC_CANES, HECC_CANES_FE);
610+ if (err_status & HECC_CANES_FE)
621611 cf->data[2] |= CAN_ERR_PROT_FORM;
622− }
623− if (err_status & HECC_CANES_BE) {
624− hecc_set_bit(priv, HECC_CANES, HECC_CANES_BE);
612+ if (err_status & HECC_CANES_BE)
625613 cf->data[2] |= CAN_ERR_PROT_BIT;
626− }
627− if (err_status & HECC_CANES_SE) {
628− hecc_set_bit(priv, HECC_CANES, HECC_CANES_SE);
614+ if (err_status & HECC_CANES_SE)
629615 cf->data[2] |= CAN_ERR_PROT_STUFF;
630− }
631− if (err_status & HECC_CANES_CRCE) {
632− hecc_set_bit(priv, HECC_CANES, HECC_CANES_CRCE);
616+ if (err_status & HECC_CANES_CRCE)
633617 cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
634− }
635− if (err_status & HECC_CANES_ACKE) {
636− hecc_set_bit(priv, HECC_CANES, HECC_CANES_ACKE);
618+ if (err_status & HECC_CANES_ACKE)
637619 cf->data[3] = CAN_ERR_PROT_LOC_ACK;
638− }
620+
621+ timestamp = hecc_read(priv, HECC_CANLNT);
622+ err = can_rx_offload_queue_sorted(&priv->offload, skb,
623+ timestamp);
624+ if (err)
625+ ndev->stats.rx_fifo_errors++;
639626 }
640627
641− timestamp = hecc_read(priv, HECC_CANLNT);
642− can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
628+ hecc_write(priv, HECC_CANES, HECC_CANES_FLAGS);
643629
644630 return 0;
645631 }
646632
633+static void ti_hecc_change_state(struct net_device *ndev,
634+ enum can_state rx_state,
635+ enum can_state tx_state)
636+{
637+ struct ti_hecc_priv *priv = netdev_priv(ndev);
638+ struct can_frame *cf;
639+ struct sk_buff *skb;
640+ u32 timestamp;
641+ int err;
642+
643+ skb = alloc_can_err_skb(priv->ndev, &cf);
644+ if (unlikely(!skb)) {
645+ priv->can.state = max(tx_state, rx_state);
646+ return;
647+ }
648+
649+ can_change_state(priv->ndev, cf, tx_state, rx_state);
650+
651+ if (max(tx_state, rx_state) != CAN_STATE_BUS_OFF) {
652+ cf->data[6] = hecc_read(priv, HECC_CANTEC);
653+ cf->data[7] = hecc_read(priv, HECC_CANREC);
654+ }
655+
656+ timestamp = hecc_read(priv, HECC_CANLNT);
657+ err = can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
658+ if (err)
659+ ndev->stats.rx_fifo_errors++;
660+}
661+
647662 static irqreturn_t ti_hecc_interrupt(int irq, void *dev_id)
648663 {
649664 struct net_device *ndev = (struct net_device *)dev_id;
@@ -651,6 +666,7 @@ static irqreturn_t ti_hecc_interrupt(int irq, void *dev_id) · 1 unmodified line
651666 struct net_device_stats *stats = &ndev->stats;
652667 u32 mbxno, mbx_mask, int_status, err_status, stamp;
653668 unsigned long flags, rx_pending;
669+ u32 handled = 0;
654670
655671 int_status = hecc_read(priv,
656672 priv->use_hecc1int ?
@@ -660,17 +676,66 @@ static irqreturn_t ti_hecc_interrupt(int irq, void *dev_id) · 3 unmodified lines
660676 return IRQ_NONE;
661677
662678 err_status = hecc_read(priv, HECC_CANES);
663− if (err_status & (HECC_BUS_ERROR | HECC_CANES_BO |
664− HECC_CANES_EP | HECC_CANES_EW))
679+ if (unlikely(err_status & HECC_CANES_FLAGS))
665680 ti_hecc_error(ndev, int_status, err_status);
666681
682+ if (unlikely(int_status & HECC_CANGIM_DEF_MASK)) {
683+ enum can_state rx_state, tx_state;
684+ u32 rec = hecc_read(priv, HECC_CANREC);
685+ u32 tec = hecc_read(priv, HECC_CANTEC);
686+
687+ if (int_status & HECC_CANGIF_WLIF) {
688+ handled |= HECC_CANGIF_WLIF;
689+ rx_state = rec >= tec ? CAN_STATE_ERROR_WARNING : 0;
690+ tx_state = rec <= tec ? CAN_STATE_ERROR_WARNING : 0;
691+ netdev_dbg(priv->ndev, "Error Warning interrupt\n");
692+ ti_hecc_change_state(ndev, rx_state, tx_state);
693+ }
694+
695+ if (int_status & HECC_CANGIF_EPIF) {
696+ handled |= HECC_CANGIF_EPIF;
697+ rx_state = rec >= tec ? CAN_STATE_ERROR_PASSIVE : 0;
698+ tx_state = rec <= tec ? CAN_STATE_ERROR_PASSIVE : 0;
699+ netdev_dbg(priv->ndev, "Error passive interrupt\n");
700+ ti_hecc_change_state(ndev, rx_state, tx_state);
701+ }
702+
703+ if (int_status & HECC_CANGIF_BOIF) {
704+ handled |= HECC_CANGIF_BOIF;
705+ rx_state = CAN_STATE_BUS_OFF;
706+ tx_state = CAN_STATE_BUS_OFF;
707+ netdev_dbg(priv->ndev, "Bus off interrupt\n");
708+
709+ /* Disable all interrupts */
710+ hecc_write(priv, HECC_CANGIM, 0);
711+ can_bus_off(ndev);
712+ ti_hecc_change_state(ndev, rx_state, tx_state);
713+ }
714+ } else if (unlikely(priv->can.state != CAN_STATE_ERROR_ACTIVE)) {
715+ enum can_state new_state, tx_state, rx_state;
716+ u32 rec = hecc_read(priv, HECC_CANREC);
717+ u32 tec = hecc_read(priv, HECC_CANTEC);
718+
719+ if (rec >= 128 || tec >= 128)
720+ new_state = CAN_STATE_ERROR_PASSIVE;
721+ else if (rec >= 96 || tec >= 96)
722+ new_state = CAN_STATE_ERROR_WARNING;
723+ else
724+ new_state = CAN_STATE_ERROR_ACTIVE;
725+
726+ if (new_state < priv->can.state) {
727+ rx_state = rec >= tec ? new_state : 0;
728+ tx_state = rec <= tec ? new_state : 0;
729+ ti_hecc_change_state(ndev, rx_state, tx_state);
730+ }
731+ }
732+
667733 if (int_status & HECC_CANGIF_GMIF) {
668734 while (priv->tx_tail - priv->tx_head > 0) {
669735 mbxno = get_tx_tail_mb(priv);
670736 mbx_mask = BIT(mbxno);
671737 if (!(mbx_mask & hecc_read(priv, HECC_CANTA)))
672738 break;
673− hecc_clear_bit(priv, HECC_CANMIM, mbx_mask);
674739 hecc_write(priv, HECC_CANTA, mbx_mask);
675740 spin_lock_irqsave(&priv->mbx_lock, flags);
676741 hecc_clear_bit(priv, HECC_CANME, mbx_mask);
@@ -695,16 +760,15 @@ static irqreturn_t ti_hecc_interrupt(int irq, void *dev_id) · 18 unmodified lines
695760 while ((rx_pending = hecc_read(priv, HECC_CANRMP))) {
696761 can_rx_offload_irq_offload_timestamp(&priv->offload,
697762 rx_pending);
698− hecc_write(priv, HECC_CANRMP, rx_pending);
699763 }
700764 }
701765
702766 /* clear all interrupt conditions - read back to avoid spurious ints */
703767 if (priv->use_hecc1int) {
704− hecc_write(priv, HECC_CANGIF1, HECC_SET_REG);
768+ hecc_write(priv, HECC_CANGIF1, handled);
705769 int_status = hecc_read(priv, HECC_CANGIF1);
706770 } else {
707− hecc_write(priv, HECC_CANGIF0, HECC_SET_REG);
771+ hecc_write(priv, HECC_CANGIF0, handled);
708772 int_status = hecc_read(priv, HECC_CANGIF0);
709773 }
710774
@@ -877,7 +941,7 @@ static int ti_hecc_probe(struct platform_device *pdev) · 166 unmodified lines
877941
878942 priv->offload.mailbox_read = ti_hecc_mailbox_read;
879943 priv->offload.mb_first = HECC_RX_FIRST_MBOX;
880− priv->offload.mb_last = HECC_MAX_TX_MBOX;
944+ priv->offload.mb_last = HECC_RX_LAST_MBOX;
881945 err = can_rx_offload_add_timestamp(ndev, &priv->offload);
882946 if (err) {
883947 dev_err(&pdev->dev, "can_rx_offload_add_timestamp() failed\n");
drivers/net/can/usb/gs_usb.c+1−0
@@ -623,6 +623,7 @@ static int gs_can_open(struct net_device *netdev) · 622 unmodified lines
623623 rc);
624624
625625 usb_unanchor_urb(urb);
626+ usb_free_urb(urb);
626627 break;
627628 }
628629
drivers/net/can/usb/mcba_usb.c+1−2
@@ -876,9 +876,8 @@ static void mcba_usb_disconnect(struct usb_interface *intf) · 875 unmodified lines
876876 netdev_info(priv->netdev, "device disconnected\n");
877877
878878 unregister_candev(priv->netdev);
879− free_candev(priv->netdev);
880−
881879 mcba_urb_unlink(priv);
880+ free_candev(priv->netdev);
882881 }
883882
884883 static struct usb_driver mcba_usb_driver = {
drivers/net/can/usb/peak_usb/pcan_usb.c+22−10
@@ -100,7 +100,7 @@ struct pcan_usb_msg_context { · 99 unmodified lines
100100 u8 *end;
101101 u8 rec_cnt;
102102 u8 rec_idx;
103− u8 rec_data_idx;
103+ u8 rec_ts_idx;
104104 struct net_device *netdev;
105105 struct pcan_usb *pdev;
106106 };
@@ -436,8 +436,8 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n, · 329 unmodified lines
436436 }
437437 if ((n & PCAN_USB_ERROR_BUS_LIGHT) == 0) {
438438 /* no error (back to active state) */
439− mc->pdev->dev.can.state = CAN_STATE_ERROR_ACTIVE;
440− return 0;
439+ new_state = CAN_STATE_ERROR_ACTIVE;
440+ break;
441441 }
442442 break;
443443
@@ -460,9 +460,9 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n, · 16 unmodified lines
460460 }
461461
462462 if ((n & PCAN_USB_ERROR_BUS_HEAVY) == 0) {
463− /* no error (back to active state) */
464− mc->pdev->dev.can.state = CAN_STATE_ERROR_ACTIVE;
465− return 0;
463+ /* no error (back to warning state) */
464+ new_state = CAN_STATE_ERROR_WARNING;
465+ break;
466466 }
467467 break;
468468
@@ -501,6 +501,11 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n, · 32 unmodified lines
501501 mc->pdev->dev.can.can_stats.error_warning++;
502502 break;
503503
504+ case CAN_STATE_ERROR_ACTIVE:
505+ cf->can_id |= CAN_ERR_CRTL;
506+ cf->data[1] = CAN_ERR_CRTL_ACTIVE;
507+ break;
508+
504509 default:
505510 /* CAN_STATE_MAX (trick to handle other errors) */
506511 cf->can_id |= CAN_ERR_CRTL;
@@ -547,10 +552,15 @@ static int pcan_usb_decode_status(struct pcan_usb_msg_context *mc, · 40 unmodified lines
547552 mc->ptr += PCAN_USB_CMD_ARGS;
548553
549554 if (status_len & PCAN_USB_STATUSLEN_TIMESTAMP) {
550− int err = pcan_usb_decode_ts(mc, !mc->rec_idx);
555+ int err = pcan_usb_decode_ts(mc, !mc->rec_ts_idx);
551556
552557 if (err)
553558 return err;
559+
560+ /* Next packet in the buffer will have a timestamp on a single
561+ * byte
562+ */
563+ mc->rec_ts_idx++;
554564 }
555565
556566 switch (f) {
@@ -632,10 +642,13 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len) · 75 unmodified lines
632642
633643 cf->can_dlc = get_can_dlc(rec_len);
634644
635− /* first data packet timestamp is a word */
636− if (pcan_usb_decode_ts(mc, !mc->rec_data_idx))
645+ /* Only first packet timestamp is a word */
646+ if (pcan_usb_decode_ts(mc, !mc->rec_ts_idx))
637647 goto decode_failed;
638648
649+ /* Next packet in the buffer will have a timestamp on a single byte */
650+ mc->rec_ts_idx++;
651+
639652 /* read data */
640653 memset(cf->data, 0x0, sizeof(cf->data));
641654 if (status_len & PCAN_USB_STATUSLEN_RTR) {
@@ -688,7 +701,6 @@ static int pcan_usb_decode_msg(struct peak_usb_device *dev, u8 *ibuf, u32 lbuf) · 46 unmodified lines
688701 /* handle normal can frames here */
689702 } else {
690703 err = pcan_usb_decode_data(&mc, sl);
691− mc.rec_data_idx++;
692704 }
693705 }
694706
drivers/net/can/usb/peak_usb/pcan_usb_core.c+1−1
@@ -750,7 +750,7 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter, · 749 unmodified lines
750750 dev = netdev_priv(netdev);
751751
752752 /* allocate a buffer large enough to send commands */
753− dev->cmd_buf = kmalloc(PCAN_USB_MAX_CMD_LEN, GFP_KERNEL);
753+ dev->cmd_buf = kzalloc(PCAN_USB_MAX_CMD_LEN, GFP_KERNEL);
754754 if (!dev->cmd_buf) {
755755 err = -ENOMEM;
756756 goto lbl_free_candev;
drivers/net/can/usb/usb_8dev.c+1−2
@@ -996,9 +996,8 @@ static void usb_8dev_disconnect(struct usb_interface *intf) · 995 unmodified lines
996996 netdev_info(priv->netdev, "device disconnected\n");
997997
998998 unregister_netdev(priv->netdev);
999− free_candev(priv->netdev);
1000−
1001999 unlink_all_urbs(priv);
1000+ free_candev(priv->netdev);
10021001 }
10031002
10041003 }
drivers/net/can/xilinx_can.c+0−1
@@ -1599,7 +1599,6 @@ static const struct xcan_devtype_data xcan_zynq_data = { · 1598 unmodified lines
15991599
16001600 static const struct xcan_devtype_data xcan_axi_data = {
16011601 .cantype = XAXI_CAN,
1602− .flags = XCAN_FLAG_TXFEMP,
16031602 .bittiming_const = &xcan_bittiming_const,
16041603 .btr_ts2_shift = XCAN_BTR_TS2_SHIFT,
16051604 .btr_sjw_shift = XCAN_BTR_SJW_SHIFT,
drivers/net/dsa/bcm_sf2.c+23−17
@@ -37,22 +37,11 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) · 36 unmodified lines
3737 unsigned int i;
3838 u32 reg, offset;
3939
40− if (priv->type == BCM7445_DEVICE_ID)
41− offset = CORE_STS_OVERRIDE_IMP;
42− else
43− offset = CORE_STS_OVERRIDE_IMP2;
44−
4540 /* Enable the port memories */
4641 reg = core_readl(priv, CORE_MEM_PSM_VDD_CTRL);
4742 reg &= ~P_TXQ_PSM_VDD(port);
4843 core_writel(priv, reg, CORE_MEM_PSM_VDD_CTRL);
4944
50− /* Enable Broadcast, Multicast, Unicast forwarding to IMP port */
51− reg = core_readl(priv, CORE_IMP_CTL);
52− reg |= (RX_BCST_EN | RX_MCST_EN | RX_UCST_EN);
53− reg &= ~(RX_DIS | TX_DIS);
54− core_writel(priv, reg, CORE_IMP_CTL);
55−
5645 /* Enable forwarding */
5746 core_writel(priv, SW_FWDG_EN, CORE_SWMODE);
5847
@@ -71,10 +60,27 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) · 12 unmodified lines
7160
7261 b53_brcm_hdr_setup(ds, port);
7362
74− /* Force link status for IMP port */
75− reg = core_readl(priv, offset);
76− reg |= (MII_SW_OR | LINK_STS);
77− core_writel(priv, reg, offset);
63+ if (port == 8) {
64+ if (priv->type == BCM7445_DEVICE_ID)
65+ offset = CORE_STS_OVERRIDE_IMP;
66+ else
67+ offset = CORE_STS_OVERRIDE_IMP2;
68+
69+ /* Force link status for IMP port */
70+ reg = core_readl(priv, offset);
71+ reg |= (MII_SW_OR | LINK_STS);
72+ core_writel(priv, reg, offset);
73+
74+ /* Enable Broadcast, Multicast, Unicast forwarding to IMP port */
75+ reg = core_readl(priv, CORE_IMP_CTL);
76+ reg |= (RX_BCST_EN | RX_MCST_EN | RX_UCST_EN);
77+ reg &= ~(RX_DIS | TX_DIS);
78+ core_writel(priv, reg, CORE_IMP_CTL);
79+ } else {
80+ reg = core_readl(priv, CORE_G_PCTL_PORT(port));
81+ reg &= ~(RX_DIS | TX_DIS);
82+ core_writel(priv, reg, CORE_G_PCTL_PORT(port));
83+ }
7884 }
7985
8086 static void bcm_sf2_gphy_enable_set(struct dsa_switch *ds, bool enable)
@@ -1209,10 +1215,10 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev) · 1128 unmodified lines
12091215 struct bcm_sf2_priv *priv = platform_get_drvdata(pdev);
12101216
12111217 priv->wol_ports_mask = 0;
1218+ /* Disable interrupts */
1219+ bcm_sf2_intr_disable(priv);
12121220 dsa_unregister_switch(priv->dev->ds);
12131221 bcm_sf2_cfp_exit(priv->dev->ds);
1214− /* Disable all ports and interrupts */
1215− bcm_sf2_sw_suspend(priv->dev->ds);
12161222 bcm_sf2_mdio_unregister(priv);
12171223
12181224 return 0;
drivers/net/dsa/sja1105/Kconfig+2−2
@@ -26,8 +26,8 @@ config NET_DSA_SJA1105_PTP · 25 unmodified lines
2626
2727 config NET_DSA_SJA1105_TAS
2828 bool "Support for the Time-Aware Scheduler on NXP SJA1105"
29− depends on NET_DSA_SJA1105
30− depends on NET_SCH_TAPRIO
29+ depends on NET_DSA_SJA1105 && NET_SCH_TAPRIO
30+ depends on NET_SCH_TAPRIO=y || NET_DSA_SJA1105=m
3131 help
3232 This enables support for the TTEthernet-based egress scheduling
3333 engine in the SJA1105 DSA driver, which is controlled using a
drivers/net/ethernet/arc/emac_rockchip.c+3−0
@@ -256,6 +256,9 @@ static int emac_rockchip_remove(struct platform_device *pdev) · 255 unmodified lines
256256 if (priv->regulator)
257257 regulator_disable(priv->regulator);
258258
259+ if (priv->soc_data->need_div_macclk)
260+ clk_disable_unprepare(priv->macclk);
261+
259262 free_netdev(ndev);
260263 return err;
261264 }
drivers/net/ethernet/broadcom/bnxt/bnxt.c+4−6
@@ -10382,7 +10382,8 @@ static void bnxt_cleanup_pci(struct bnxt *bp) · 10381 unmodified lines
1038210382 {
1038310383 bnxt_unmap_bars(bp, bp->pdev);
1038410384 pci_release_regions(bp->pdev);
10385− pci_disable_device(bp->pdev);
10385+ if (pci_is_enabled(bp->pdev))
10386+ pci_disable_device(bp->pdev);
1038610387 }
1038710388
1038810389 static void bnxt_init_dflt_coal(struct bnxt *bp)
@@ -10669,14 +10670,11 @@ static void bnxt_fw_reset_task(struct work_struct *work) · 280 unmodified lines
1066910670 bp->fw_reset_state = BNXT_FW_RESET_STATE_RESET_FW;
1067010671 }
1067110672 /* fall through */
10672− case BNXT_FW_RESET_STATE_RESET_FW: {
10673− u32 wait_dsecs = bp->fw_health->post_reset_wait_dsecs;
10674−
10673+ case BNXT_FW_RESET_STATE_RESET_FW:
1067510674 bnxt_reset_all(bp);
1067610675 bp->fw_reset_state = BNXT_FW_RESET_STATE_ENABLE_DEV;
10677− bnxt_queue_fw_reset_work(bp, wait_dsecs * HZ / 10);
10676+ bnxt_queue_fw_reset_work(bp, bp->fw_reset_min_dsecs * HZ / 10);
1067810677 return;
10679− }
1068010678 case BNXT_FW_RESET_STATE_ENABLE_DEV:
1068110679 if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state) &&
1068210680 bp->fw_health) {
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c+67−45
@@ -29,25 +29,20 @@ static int bnxt_fw_reporter_diagnose(struct devlink_health_reporter *reporter, · 28 unmodified lines
2929 val = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG);
3030 health_status = val & 0xffff;
3131
32− if (health_status == BNXT_FW_STATUS_HEALTHY) {
33− rc = devlink_fmsg_string_pair_put(fmsg, "FW status",
34− "Healthy;");
35− if (rc)
36− return rc;
37− } else if (health_status < BNXT_FW_STATUS_HEALTHY) {
38− rc = devlink_fmsg_string_pair_put(fmsg, "FW status",
39− "Not yet completed initialization;");
32+ if (health_status < BNXT_FW_STATUS_HEALTHY) {
33+ rc = devlink_fmsg_string_pair_put(fmsg, "Description",
34+ "Not yet completed initialization");
4035 if (rc)
4136 return rc;
4237 } else if (health_status > BNXT_FW_STATUS_HEALTHY) {
43− rc = devlink_fmsg_string_pair_put(fmsg, "FW status",
44− "Encountered fatal error and cannot recover;");
38+ rc = devlink_fmsg_string_pair_put(fmsg, "Description",
39+ "Encountered fatal error and cannot recover");
4540 if (rc)
4641 return rc;
4742 }
4843
4944 if (val >> 16) {
50− rc = devlink_fmsg_u32_pair_put(fmsg, "Error", val >> 16);
45+ rc = devlink_fmsg_u32_pair_put(fmsg, "Error code", val >> 16);
5146 if (rc)
5247 return rc;
5348 }
@@ -215,25 +210,68 @@ enum bnxt_dl_param_id { · 161 unmodified lines
215210
216211 static const struct bnxt_dl_nvm_param nvm_params[] = {
217212 {DEVLINK_PARAM_GENERIC_ID_ENABLE_SRIOV, NVM_OFF_ENABLE_SRIOV,
218− BNXT_NVM_SHARED_CFG, 1},
213+ BNXT_NVM_SHARED_CFG, 1, 1},
219214 {DEVLINK_PARAM_GENERIC_ID_IGNORE_ARI, NVM_OFF_IGNORE_ARI,
220− BNXT_NVM_SHARED_CFG, 1},
215+ BNXT_NVM_SHARED_CFG, 1, 1},
221216 {DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MAX,
222− NVM_OFF_MSIX_VEC_PER_PF_MAX, BNXT_NVM_SHARED_CFG, 10},
217+ NVM_OFF_MSIX_VEC_PER_PF_MAX, BNXT_NVM_SHARED_CFG, 10, 4},
223218 {DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN,
224− NVM_OFF_MSIX_VEC_PER_PF_MIN, BNXT_NVM_SHARED_CFG, 7},
219+ NVM_OFF_MSIX_VEC_PER_PF_MIN, BNXT_NVM_SHARED_CFG, 7, 4},
225220 {BNXT_DEVLINK_PARAM_ID_GRE_VER_CHECK, NVM_OFF_DIS_GRE_VER_CHECK,
226− BNXT_NVM_SHARED_CFG, 1},
221+ BNXT_NVM_SHARED_CFG, 1, 1},
227222 };
228223
224+union bnxt_nvm_data {
225+ u8 val8;
226+ __le32 val32;
227+};
228+
229+static void bnxt_copy_to_nvm_data(union bnxt_nvm_data *dst,
230+ union devlink_param_value *src,
231+ int nvm_num_bits, int dl_num_bytes)
232+{
233+ u32 val32 = 0;
234+
235+ if (nvm_num_bits == 1) {
236+ dst->val8 = src->vbool;
237+ return;
238+ }
239+ if (dl_num_bytes == 4)
240+ val32 = src->vu32;
241+ else if (dl_num_bytes == 2)
242+ val32 = (u32)src->vu16;
243+ else if (dl_num_bytes == 1)
244+ val32 = (u32)src->vu8;
245+ dst->val32 = cpu_to_le32(val32);
246+}
247+
248+static void bnxt_copy_from_nvm_data(union devlink_param_value *dst,
249+ union bnxt_nvm_data *src,
250+ int nvm_num_bits, int dl_num_bytes)
251+{
252+ u32 val32;
253+
254+ if (nvm_num_bits == 1) {
255+ dst->vbool = src->val8;
256+ return;
257+ }
258+ val32 = le32_to_cpu(src->val32);
259+ if (dl_num_bytes == 4)
260+ dst->vu32 = val32;
261+ else if (dl_num_bytes == 2)
262+ dst->vu16 = (u16)val32;
263+ else if (dl_num_bytes == 1)
264+ dst->vu8 = (u8)val32;
265+}
266+
229267 static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg,
230268 int msg_len, union devlink_param_value *val)
231269 {
232270 struct hwrm_nvm_get_variable_input *req = msg;
233− void *data_addr = NULL, *buf = NULL;
234271 struct bnxt_dl_nvm_param nvm_param;
235− int bytesize, idx = 0, rc, i;
272+ union bnxt_nvm_data *data;
236273 dma_addr_t data_dma_addr;
274+ int idx = 0, rc, i;
237275
238276 /* Get/Set NVM CFG parameter is supported only on PFs */
239277 if (BNXT_VF(bp))
@@ -254,47 +292,31 @@ static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg, · 14 unmodified lines
254292 else if (nvm_param.dir_type == BNXT_NVM_FUNC_CFG)
255293 idx = bp->pf.fw_fid - BNXT_FIRST_PF_FID;
256294
257− bytesize = roundup(nvm_param.num_bits, BITS_PER_BYTE) / BITS_PER_BYTE;
258− switch (bytesize) {
259− case 1:
260− if (nvm_param.num_bits == 1)
261− buf = &val->vbool;
262− else
263− buf = &val->vu8;
264− break;
265− case 2:
266− buf = &val->vu16;
267− break;
268− case 4:
269− buf = &val->vu32;
270− break;
271− default:
272− return -EFAULT;
273− }
274−
275− data_addr = dma_alloc_coherent(&bp->pdev->dev, bytesize,
276− &data_dma_addr, GFP_KERNEL);
277− if (!data_addr)
295+ data = dma_alloc_coherent(&bp->pdev->dev, sizeof(*data),
296+ &data_dma_addr, GFP_KERNEL);
297+ if (!data)
278298 return -ENOMEM;
279299
280300 req->dest_data_addr = cpu_to_le64(data_dma_addr);
281− req->data_len = cpu_to_le16(nvm_param.num_bits);
301+ req->data_len = cpu_to_le16(nvm_param.nvm_num_bits);
282302 req->option_num = cpu_to_le16(nvm_param.offset);
283303 req->index_0 = cpu_to_le16(idx);
284304 if (idx)
285305 req->dimensions = cpu_to_le16(1);
286306
287307 if (req->req_type == cpu_to_le16(HWRM_NVM_SET_VARIABLE)) {
288− memcpy(data_addr, buf, bytesize);
308+ bnxt_copy_to_nvm_data(data, val, nvm_param.nvm_num_bits,
309+ nvm_param.dl_num_bytes);
289310 rc = hwrm_send_message(bp, msg, msg_len, HWRM_CMD_TIMEOUT);
290311 } else {
291312 rc = hwrm_send_message_silent(bp, msg, msg_len,
292313 HWRM_CMD_TIMEOUT);
314+ if (!rc)
315+ bnxt_copy_from_nvm_data(val, data,
316+ nvm_param.nvm_num_bits,
317+ nvm_param.dl_num_bytes);
293318 }
294− if (!rc && req->req_type == cpu_to_le16(HWRM_NVM_GET_VARIABLE))
295− memcpy(buf, data_addr, bytesize);
296−
297− dma_free_coherent(&bp->pdev->dev, bytesize, data_addr, data_dma_addr);
319+ dma_free_coherent(&bp->pdev->dev, sizeof(*data), data, data_dma_addr);
298320 if (rc == -EACCES)
299321 netdev_err(bp->dev, "PF does not have admin privileges to modify NVM config\n");
300322 return rc;
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h+2−1
@@ -52,7 +52,8 @@ struct bnxt_dl_nvm_param { · 51 unmodified lines
5252 u16 id;
5353 u16 offset;
5454 u16 dir_type;
55− u16 num_bits;
55+ u16 nvm_num_bits;
56+ u8 dl_num_bytes;
5657 };
5758
5859 void bnxt_devlink_health_report(struct bnxt *bp, unsigned long event);
drivers/net/ethernet/broadcom/genet/bcmgenet.c+15−20
@@ -1996,8 +1996,6 @@ static void reset_umac(struct bcmgenet_priv *priv) · 1995 unmodified lines
19961996
19971997 /* issue soft reset with (rg)mii loopback to ensure a stable rxclk */
19981998 bcmgenet_umac_writel(priv, CMD_SW_RESET | CMD_LCL_LOOP_EN, UMAC_CMD);
1999− udelay(2);
2000− bcmgenet_umac_writel(priv, 0, UMAC_CMD);
20011999 }
20022000
20032001 static void bcmgenet_intr_disable(struct bcmgenet_priv *priv)
@@ -2614,8 +2612,10 @@ static void bcmgenet_irq_task(struct work_struct *work) · 610 unmodified lines
26142612 spin_unlock_irq(&priv->lock);
26152613
26162614 if (status & UMAC_IRQ_PHY_DET_R &&
2617− priv->dev->phydev->autoneg != AUTONEG_ENABLE)
2615+ priv->dev->phydev->autoneg != AUTONEG_ENABLE) {
26182616 phy_init_hw(priv->dev->phydev);
2617+ genphy_config_aneg(priv->dev->phydev);
2618+ }
26192619
26202620 /* Link UP/DOWN event */
26212621 if (status & UMAC_IRQ_LINK_EVENT)
@@ -2879,12 +2879,6 @@ static int bcmgenet_open(struct net_device *dev) · 257 unmodified lines
28792879 if (priv->internal_phy)
28802880 bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
28812881
2882− ret = bcmgenet_mii_connect(dev);
2883− if (ret) {
2884− netdev_err(dev, "failed to connect to PHY\n");
2885− goto err_clk_disable;
2886− }
2887−
28882882 /* take MAC out of reset */
28892883 bcmgenet_umac_reset(priv);
28902884
@@ -2894,12 +2888,6 @@ static int bcmgenet_open(struct net_device *dev) · 3 unmodified lines
28942888 reg = bcmgenet_umac_readl(priv, UMAC_CMD);
28952889 priv->crc_fwd_en = !!(reg & CMD_CRC_FWD);
28962890
2897− ret = bcmgenet_mii_config(dev, true);
2898− if (ret) {
2899− netdev_err(dev, "unsupported PHY\n");
2900− goto err_disconnect_phy;
2901− }
2902−
29032891 bcmgenet_set_hw_addr(priv, dev->dev_addr);
29042892
29052893 if (priv->internal_phy) {
@@ -2915,7 +2903,7 @@ static int bcmgenet_open(struct net_device *dev) · 9 unmodified lines
29152903 ret = bcmgenet_init_dma(priv);
29162904 if (ret) {
29172905 netdev_err(dev, "failed to initialize DMA\n");
2918− goto err_disconnect_phy;
2906+ goto err_clk_disable;
29192907 }
29202908
29212909 /* Always enable ring 16 - descriptor ring */
@@ -2938,19 +2926,25 @@ static int bcmgenet_open(struct net_device *dev) · 16 unmodified lines
29382926 goto err_irq0;
29392927 }
29402928
2929+ ret = bcmgenet_mii_probe(dev);
2930+ if (ret) {
2931+ netdev_err(dev, "failed to connect to PHY\n");
2932+ goto err_irq1;
2933+ }
2934+
29412935 bcmgenet_netif_start(dev);
29422936
29432937 netif_tx_start_all_queues(dev);
29442938
29452939 return 0;
29462940
2941+err_irq1:
2942+ free_irq(priv->irq1, priv);
29472943 err_irq0:
29482944 free_irq(priv->irq0, priv);
29492945 err_fini_dma:
29502946 bcmgenet_dma_teardown(priv);
29512947 bcmgenet_fini_dma(priv);
2952−err_disconnect_phy:
2953− phy_disconnect(dev->phydev);
29542948 err_clk_disable:
29552949 if (priv->internal_phy)
29562950 bcmgenet_power_down(priv, GENET_POWER_PASSIVE);
@@ -3631,8 +3625,6 @@ static int bcmgenet_resume(struct device *d) · 674 unmodified lines
36313625 if (priv->internal_phy)
36323626 bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
36333627
3634− phy_init_hw(dev->phydev);
3635−
36363628 bcmgenet_umac_reset(priv);
36373629
36383630 init_umac(priv);
@@ -3641,7 +3633,10 @@ static int bcmgenet_resume(struct device *d) · 2 unmodified lines
36413633 if (priv->wolopts)
36423634 clk_disable_unprepare(priv->clk_wol);
36433635
3636+ phy_init_hw(dev->phydev);
3637+
36443638 /* Speed settings must be restored */
3639+ genphy_config_aneg(dev->phydev);
36453640 bcmgenet_mii_config(priv->dev, false);
36463641
36473642 bcmgenet_set_hw_addr(priv, dev->dev_addr);
drivers/net/ethernet/broadcom/genet/bcmgenet.h+1−1
@@ -720,8 +720,8 @@ GENET_IO_MACRO(rbuf, GENET_RBUF_OFF); · 719 unmodified lines
720720
721721 /* MDIO routines */
722722 int bcmgenet_mii_init(struct net_device *dev);
723−int bcmgenet_mii_connect(struct net_device *dev);
724723 int bcmgenet_mii_config(struct net_device *dev, bool init);
724+int bcmgenet_mii_probe(struct net_device *dev);
725725 void bcmgenet_mii_exit(struct net_device *dev);
726726 void bcmgenet_phy_power_set(struct net_device *dev, bool enable);
727727 void bcmgenet_mii_setup(struct net_device *dev);
drivers/net/ethernet/broadcom/genet/bcmmii.c+94−51
@@ -173,46 +173,6 @@ static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv) · 172 unmodified lines
173173 bcmgenet_fixed_phy_link_update);
174174 }
175175
176−int bcmgenet_mii_connect(struct net_device *dev)
177−{
178− struct bcmgenet_priv *priv = netdev_priv(dev);
179− struct device_node *dn = priv->pdev->dev.of_node;
180− struct phy_device *phydev;
181− u32 phy_flags = 0;
182− int ret;
183−
184− /* Communicate the integrated PHY revision */
185− if (priv->internal_phy)
186− phy_flags = priv->gphy_rev;
187−
188− /* Initialize link state variables that bcmgenet_mii_setup() uses */
189− priv->old_link = -1;
190− priv->old_speed = -1;
191− priv->old_duplex = -1;
192− priv->old_pause = -1;
193−
194− if (dn) {
195− phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup,
196− phy_flags, priv->phy_interface);
197− if (!phydev) {
198− pr_err("could not attach to PHY\n");
199− return -ENODEV;
200− }
201− } else {
202− phydev = dev->phydev;
203− phydev->dev_flags = phy_flags;
204−
205− ret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup,
206− priv->phy_interface);
207− if (ret) {
208− pr_err("could not attach to PHY\n");
209− return -ENODEV;
210− }
211− }
212−
213− return 0;
214−}
215−
216176 int bcmgenet_mii_config(struct net_device *dev, bool init)
217177 {
218178 struct bcmgenet_priv *priv = netdev_priv(dev);
@@ -221,8 +181,38 @@ int bcmgenet_mii_config(struct net_device *dev, bool init) · 2 unmodified lines
221181 const char *phy_name = NULL;
222182 u32 id_mode_dis = 0;
223183 u32 port_ctrl;
184+ int bmcr = -1;
185+ int ret;
224186 u32 reg;
225187
188+ /* MAC clocking workaround during reset of umac state machines */
189+ reg = bcmgenet_umac_readl(priv, UMAC_CMD);
190+ if (reg & CMD_SW_RESET) {
191+ /* An MII PHY must be isolated to prevent TXC contention */
192+ if (priv->phy_interface == PHY_INTERFACE_MODE_MII) {
193+ ret = phy_read(phydev, MII_BMCR);
194+ if (ret >= 0) {
195+ bmcr = ret;
196+ ret = phy_write(phydev, MII_BMCR,
197+ bmcr | BMCR_ISOLATE);
198+ }
199+ if (ret) {
200+ netdev_err(dev, "failed to isolate PHY\n");
201+ return ret;
202+ }
203+ }
204+ /* Switch MAC clocking to RGMII generated clock */
205+ bcmgenet_sys_writel(priv, PORT_MODE_EXT_GPHY, SYS_PORT_CTRL);
206+ /* Ensure 5 clks with Rx disabled
207+ * followed by 5 clks with Reset asserted
208+ */
209+ udelay(4);
210+ reg &= ~(CMD_SW_RESET | CMD_LCL_LOOP_EN);
211+ bcmgenet_umac_writel(priv, reg, UMAC_CMD);
212+ /* Ensure 5 more clocks before Rx is enabled */
213+ udelay(2);
214+ }
215+
226216 priv->ext_phy = !priv->internal_phy &&
227217 (priv->phy_interface != PHY_INTERFACE_MODE_MOCA);
228218
@@ -254,6 +244,9 @@ int bcmgenet_mii_config(struct net_device *dev, bool init) · 25 unmodified lines
254244 phy_set_max_speed(phydev, SPEED_100);
255245 bcmgenet_sys_writel(priv,
256246 PORT_MODE_EXT_EPHY, SYS_PORT_CTRL);
247+ /* Restore the MII PHY after isolation */
248+ if (bmcr >= 0)
249+ phy_write(phydev, MII_BMCR, bmcr);
257250 break;
258251
259252 case PHY_INTERFACE_MODE_REVMII:
@@ -306,21 +299,71 @@ int bcmgenet_mii_config(struct net_device *dev, bool init) · 46 unmodified lines
306299 bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);
307300 }
308301
309− if (init) {
310− linkmode_copy(phydev->advertising, phydev->supported);
302+ if (init)
303+ dev_info(kdev, "configuring instance for %s\n", phy_name);
311304
312− /* The internal PHY has its link interrupts routed to the
313− * Ethernet MAC ISRs. On GENETv5 there is a hardware issue
314− * that prevents the signaling of link UP interrupts when
315− * the link operates at 10Mbps, so fallback to polling for
316− * those versions of GENET.
317− */
318− if (priv->internal_phy && !GENET_IS_V5(priv))
319− phydev->irq = PHY_IGNORE_INTERRUPT;
305+ return 0;
306+}
320307
321− dev_info(kdev, "configuring instance for %s\n", phy_name);
308+int bcmgenet_mii_probe(struct net_device *dev)
309+{
310+ struct bcmgenet_priv *priv = netdev_priv(dev);
311+ struct device_node *dn = priv->pdev->dev.of_node;
312+ struct phy_device *phydev;
313+ u32 phy_flags = 0;
314+ int ret;
315+
316+ /* Communicate the integrated PHY revision */
317+ if (priv->internal_phy)
318+ phy_flags = priv->gphy_rev;
319+
320+ /* Initialize link state variables that bcmgenet_mii_setup() uses */
321+ priv->old_link = -1;
322+ priv->old_speed = -1;
323+ priv->old_duplex = -1;
324+ priv->old_pause = -1;
325+
326+ if (dn) {
327+ phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup,
328+ phy_flags, priv->phy_interface);
329+ if (!phydev) {
330+ pr_err("could not attach to PHY\n");
331+ return -ENODEV;
332+ }
333+ } else {
334+ phydev = dev->phydev;
335+ phydev->dev_flags = phy_flags;
336+
337+ ret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup,
338+ priv->phy_interface);
339+ if (ret) {
340+ pr_err("could not attach to PHY\n");
341+ return -ENODEV;
342+ }
322343 }
323344
345+ /* Configure port multiplexer based on what the probed PHY device since
346+ * reading the 'max-speed' property determines the maximum supported
347+ * PHY speed which is needed for bcmgenet_mii_config() to configure
348+ * things appropriately.
349+ */
350+ ret = bcmgenet_mii_config(dev, true);
351+ if (ret) {
352+ phy_disconnect(dev->phydev);
353+ return ret;
354+ }
355+
356+ linkmode_copy(phydev->advertising, phydev->supported);
357+
358+ /* The internal PHY has its link interrupts routed to the
359+ * Ethernet MAC ISRs. On GENETv5 there is a hardware issue
360+ * that prevents the signaling of link UP interrupts when
361+ * the link operates at 10Mbps, so fallback to polling for
362+ * those versions of GENET.
363+ */
364+ if (priv->internal_phy && !GENET_IS_V5(priv))
365+ dev->phydev->irq = PHY_IGNORE_INTERRUPT;
366+
324367 return 0;
325368 }
326369
drivers/net/ethernet/cavium/octeon/octeon_mgmt.c+1−1
@@ -1499,7 +1499,7 @@ static int octeon_mgmt_probe(struct platform_device *pdev) · 1498 unmodified lines
14991499 netdev->ethtool_ops = &octeon_mgmt_ethtool_ops;
15001500
15011501 netdev->min_mtu = 64 - OCTEON_MGMT_RX_HEADROOM;
1502− netdev->max_mtu = 16383 - OCTEON_MGMT_RX_HEADROOM;
1502+ netdev->max_mtu = 16383 - OCTEON_MGMT_RX_HEADROOM - VLAN_HLEN;
15031503
15041504 mac = of_get_mac_address(pdev->dev.of_node);
15051505
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c+16−12
@@ -695,10 +695,10 @@ static void uld_init(struct adapter *adap, struct cxgb4_lld_info *lld) · 694 unmodified lines
695695 lld->write_cmpl_support = adap->params.write_cmpl_support;
696696 }
697697
698−static void uld_attach(struct adapter *adap, unsigned int uld)
698+static int uld_attach(struct adapter *adap, unsigned int uld)
699699 {
700− void *handle;
701700 struct cxgb4_lld_info lli;
701+ void *handle;
702702
703703 uld_init(adap, &lli);
704704 uld_queue_init(adap, uld, &lli);
@@ -708,7 +708,7 @@ static void uld_attach(struct adapter *adap, unsigned int uld) · 3 unmodified lines
708708 dev_warn(adap->pdev_dev,
709709 "could not attach to the %s driver, error %ld\n",
710710 adap->uld[uld].name, PTR_ERR(handle));
711− return;
711+ return PTR_ERR(handle);
712712 }
713713
714714 adap->uld[uld].handle = handle;
@@ -716,22 +716,22 @@ static void uld_attach(struct adapter *adap, unsigned int uld) · 1 unmodified line
716716
717717 if (adap->flags & CXGB4_FULL_INIT_DONE)
718718 adap->uld[uld].state_change(handle, CXGB4_STATE_UP);
719+
720+ return 0;
719721 }
720722
721−/**
722− * cxgb4_register_uld - register an upper-layer driver
723− * @type: the ULD type
724− * @p: the ULD methods
723+/* cxgb4_register_uld - register an upper-layer driver
724+ * @type: the ULD type
725+ * @p: the ULD methods
725726 *
726− * Registers an upper-layer driver with this driver and notifies the ULD
727− * about any presently available devices that support its type. Returns
728− * %-EBUSY if a ULD of the same type is already registered.
727+ * Registers an upper-layer driver with this driver and notifies the ULD
728+ * about any presently available devices that support its type.
729729 */
730730 void cxgb4_register_uld(enum cxgb4_uld type,
731731 const struct cxgb4_uld_info *p)
732732 {
733− int ret = 0;
734733 struct adapter *adap;
734+ int ret = 0;
735735
736736 if (type >= CXGB4_ULD_MAX)
737737 return;
@@ -763,8 +763,12 @@ void cxgb4_register_uld(enum cxgb4_uld type, · 25 unmodified lines
763763 if (ret)
764764 goto free_irq;
765765 adap->uld[type] = *p;
766− uld_attach(adap, type);
766+ ret = uld_attach(adap, type);
767+ if (ret)
768+ goto free_txq;
767769 continue;
770+free_txq:
771+ release_sge_txq_uld(adap, type);
768772 free_irq:
769773 if (adap->flags & CXGB4_FULL_INIT_DONE)
770774 quiesce_rx_uld(adap, type);
drivers/net/ethernet/chelsio/cxgb4/sge.c+2−6
@@ -3791,15 +3791,11 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, · 3790 unmodified lines
37913791 * write the CIDX Updates into the Status Page at the end of the
37923792 * TX Queue.
37933793 */
3794− c.autoequiqe_to_viid = htonl((dbqt
3795− ? FW_EQ_ETH_CMD_AUTOEQUIQE_F
3796− : FW_EQ_ETH_CMD_AUTOEQUEQE_F) |
3794+ c.autoequiqe_to_viid = htonl(FW_EQ_ETH_CMD_AUTOEQUEQE_F |
37973795 FW_EQ_ETH_CMD_VIID_V(pi->viid));
37983796
37993797 c.fetchszm_to_iqid =
3800− htonl(FW_EQ_ETH_CMD_HOSTFCMODE_V(dbqt
3801− ? HOSTFCMODE_INGRESS_QUEUE_X
3802− : HOSTFCMODE_STATUS_PAGE_X) |
3798+ htonl(FW_EQ_ETH_CMD_HOSTFCMODE_V(HOSTFCMODE_STATUS_PAGE_X) |
38033799 FW_EQ_ETH_CMD_PCIECHN_V(pi->tx_chan) |
38043800 FW_EQ_ETH_CMD_FETCHRO_F | FW_EQ_ETH_CMD_IQID_V(iqid));
38053801
drivers/net/ethernet/cortina/gemini.h+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0
1+/* SPDX-License-Identifier: GPL-2.0 */
22 /* Register definitions for Gemini GMAC Ethernet device driver
33 *
44 * Copyright (C) 2006 Storlink, Corp.
drivers/net/ethernet/faraday/ftgmac100.c+12−13
@@ -727,6 +727,18 @@ static netdev_tx_t ftgmac100_hard_start_xmit(struct sk_buff *skb, · 726 unmodified lines
727727 */
728728 nfrags = skb_shinfo(skb)->nr_frags;
729729
730+ /* Setup HW checksumming */
731+ csum_vlan = 0;
732+ if (skb->ip_summed == CHECKSUM_PARTIAL &&
733+ !ftgmac100_prep_tx_csum(skb, &csum_vlan))
734+ goto drop;
735+
736+ /* Add VLAN tag */
737+ if (skb_vlan_tag_present(skb)) {
738+ csum_vlan |= FTGMAC100_TXDES1_INS_VLANTAG;
739+ csum_vlan |= skb_vlan_tag_get(skb) & 0xffff;
740+ }
741+
730742 /* Get header len */
731743 len = skb_headlen(skb);
732744
@@ -753,19 +765,6 @@ static netdev_tx_t ftgmac100_hard_start_xmit(struct sk_buff *skb, · 20 unmodified lines
753765 if (nfrags == 0)
754766 f_ctl_stat |= FTGMAC100_TXDES0_LTS;
755767 txdes->txdes3 = cpu_to_le32(map);
756−
757− /* Setup HW checksumming */
758− csum_vlan = 0;
759− if (skb->ip_summed == CHECKSUM_PARTIAL &&
760− !ftgmac100_prep_tx_csum(skb, &csum_vlan))
761− goto drop;
762−
763− /* Add VLAN tag */
764− if (skb_vlan_tag_present(skb)) {
765− csum_vlan |= FTGMAC100_TXDES1_INS_VLANTAG;
766− csum_vlan |= skb_vlan_tag_get(skb) & 0xffff;
767− }
768−
769768 txdes->txdes1 = cpu_to_le32(csum_vlan);
770769
771770 /* Next descriptor */
drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.h+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0
1+/* SPDX-License-Identifier: GPL-2.0 */
22 /*
33 * Copyright 2018 NXP
44 */
drivers/net/ethernet/freescale/dpaa2/dprtc-cmd.h+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0
1+/* SPDX-License-Identifier: GPL-2.0 */
22 /*
33 * Copyright 2013-2016 Freescale Semiconductor Inc.
44 * Copyright 2016-2018 NXP
drivers/net/ethernet/freescale/dpaa2/dprtc.h+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0
1+/* SPDX-License-Identifier: GPL-2.0 */
22 /*
33 * Copyright 2013-2016 Freescale Semiconductor Inc.
44 * Copyright 2016-2018 NXP
drivers/net/ethernet/freescale/fec_main.c+3−1
@@ -3558,7 +3558,7 @@ fec_probe(struct platform_device *pdev) · 3557 unmodified lines
35583558
35593559 for (i = 0; i < irq_cnt; i++) {
35603560 snprintf(irq_name, sizeof(irq_name), "int%d", i);
3561− irq = platform_get_irq_byname(pdev, irq_name);
3561+ irq = platform_get_irq_byname_optional(pdev, irq_name);
35623562 if (irq < 0)
35633563 irq = platform_get_irq(pdev, i);
35643564 if (irq < 0) {
@@ -3645,6 +3645,8 @@ fec_drv_remove(struct platform_device *pdev) · 80 unmodified lines
36453645 regulator_disable(fep->reg_phy);
36463646 pm_runtime_put(&pdev->dev);
36473647 pm_runtime_disable(&pdev->dev);
3648+ clk_disable_unprepare(fep->clk_ahb);
3649+ clk_disable_unprepare(fep->clk_ipg);
36483650 if (of_phy_is_fixed_link(np))
36493651 of_phy_deregister_fixed_link(np);
36503652 of_node_put(fep->phy_node);
drivers/net/ethernet/freescale/fec_ptp.c+2−2
@@ -600,9 +600,9 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx) · 599 unmodified lines
600600
601601 INIT_DELAYED_WORK(&fep->time_keep, fec_time_keep);
602602
603− irq = platform_get_irq_byname(pdev, "pps");
603+ irq = platform_get_irq_byname_optional(pdev, "pps");
604604 if (irq < 0)
605− irq = platform_get_irq(pdev, irq_idx);
605+ irq = platform_get_irq_optional(pdev, irq_idx);
606606 /* Failure to get an irq is not fatal,
607607 * only the PTP_CLOCK_PPS clock events should stop
608608 */
drivers/net/ethernet/google/gve/gve_rx.c+2−0
@@ -289,6 +289,8 @@ static bool gve_rx(struct gve_rx_ring *rx, struct gve_rx_desc *rx_desc, · 288 unmodified lines
289289
290290 len = be16_to_cpu(rx_desc->len) - GVE_RX_PAD;
291291 page_info = &rx->data.page_info[idx];
292+ dma_sync_single_for_cpu(&priv->pdev->dev, rx->data.qpl->page_buses[idx],
293+ PAGE_SIZE, DMA_FROM_DEVICE);
292294
293295 /* gvnic can only receive into registered segments. If the buffer
294296 * can't be recycled, our only choice is to copy the data out of
drivers/net/ethernet/google/gve/gve_tx.c+22−2
@@ -390,7 +390,21 @@ static void gve_tx_fill_seg_desc(union gve_tx_desc *seg_desc, · 389 unmodified lines
390390 seg_desc->seg.seg_addr = cpu_to_be64(addr);
391391 }
392392
393−static int gve_tx_add_skb(struct gve_tx_ring *tx, struct sk_buff *skb)
393+static void gve_dma_sync_for_device(struct device *dev, dma_addr_t *page_buses,
394+ u64 iov_offset, u64 iov_len)
395+{
396+ dma_addr_t dma;
397+ u64 addr;
398+
399+ for (addr = iov_offset; addr < iov_offset + iov_len;
400+ addr += PAGE_SIZE) {
401+ dma = page_buses[addr / PAGE_SIZE];
402+ dma_sync_single_for_device(dev, dma, PAGE_SIZE, DMA_TO_DEVICE);
403+ }
404+}
405+
406+static int gve_tx_add_skb(struct gve_tx_ring *tx, struct sk_buff *skb,
407+ struct device *dev)
394408 {
395409 int pad_bytes, hlen, hdr_nfrags, payload_nfrags, l4_hdr_offset;
396410 union gve_tx_desc *pkt_desc, *seg_desc;
@@ -432,6 +446,9 @@ static int gve_tx_add_skb(struct gve_tx_ring *tx, struct sk_buff *skb) · 35 unmodified lines
432446 skb_copy_bits(skb, 0,
433447 tx->tx_fifo.base + info->iov[hdr_nfrags - 1].iov_offset,
434448 hlen);
449+ gve_dma_sync_for_device(dev, tx->tx_fifo.qpl->page_buses,
450+ info->iov[hdr_nfrags - 1].iov_offset,
451+ info->iov[hdr_nfrags - 1].iov_len);
435452 copy_offset = hlen;
436453
437454 for (i = payload_iov; i < payload_nfrags + payload_iov; i++) {
@@ -445,6 +462,9 @@ static int gve_tx_add_skb(struct gve_tx_ring *tx, struct sk_buff *skb) · 7 unmodified lines
445462 skb_copy_bits(skb, copy_offset,
446463 tx->tx_fifo.base + info->iov[i].iov_offset,
447464 info->iov[i].iov_len);
465+ gve_dma_sync_for_device(dev, tx->tx_fifo.qpl->page_buses,
466+ info->iov[i].iov_offset,
467+ info->iov[i].iov_len);
448468 copy_offset += info->iov[i].iov_len;
449469 }
450470
@@ -473,7 +493,7 @@ netdev_tx_t gve_tx(struct sk_buff *skb, struct net_device *dev) · 22 unmodified lines
473493 gve_tx_put_doorbell(priv, tx->q_resources, tx->req);
474494 return NETDEV_TX_BUSY;
475495 }
476− nsegs = gve_tx_add_skb(tx, skb);
496+ nsegs = gve_tx_add_skb(tx, skb, &priv->pdev->dev);
477497
478498 netdev_tx_sent_queue(tx->netdev_txq, skb->len);
479499 skb_tx_timestamp(skb);
drivers/net/ethernet/hisilicon/hip04_eth.c+9−7
@@ -237,6 +237,7 @@ struct hip04_priv { · 236 unmodified lines
237237 dma_addr_t rx_phys[RX_DESC_NUM];
238238 unsigned int rx_head;
239239 unsigned int rx_buf_size;
240+ unsigned int rx_cnt_remaining;
240241
241242 struct device_node *phy_node;
242243 struct phy_device *phy;
@@ -575,7 +576,6 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget) · 332 unmodified lines
575576 struct hip04_priv *priv = container_of(napi, struct hip04_priv, napi);
576577 struct net_device *ndev = priv->ndev;
577578 struct net_device_stats *stats = &ndev->stats;
578− unsigned int cnt = hip04_recv_cnt(priv);
579579 struct rx_desc *desc;
580580 struct sk_buff *skb;
581581 unsigned char *buf;
@@ -588,8 +588,8 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget) · 6 unmodified lines
588588
589589 /* clean up tx descriptors */
590590 tx_remaining = hip04_tx_reclaim(ndev, false);
591−
592− while (cnt && !last) {
591+ priv->rx_cnt_remaining += hip04_recv_cnt(priv);
592+ while (priv->rx_cnt_remaining && !last) {
593593 buf = priv->rx_buf[priv->rx_head];
594594 skb = build_skb(buf, priv->rx_buf_size);
595595 if (unlikely(!skb)) {
@@ -635,11 +635,13 @@ refill: · 39 unmodified lines
635635 hip04_set_recv_desc(priv, phys);
636636
637637 priv->rx_head = RX_NEXT(priv->rx_head);
638− if (rx >= budget)
638+ if (rx >= budget) {
639+ --priv->rx_cnt_remaining;
639640 goto done;
641+ }
640642
641− if (--cnt == 0)
642− cnt = hip04_recv_cnt(priv);
643+ if (--priv->rx_cnt_remaining == 0)
644+ priv->rx_cnt_remaining += hip04_recv_cnt(priv);
643645 }
644646
645647 if (!(priv->reg_inten & RCV_INT)) {
@@ -724,6 +726,7 @@ static int hip04_mac_open(struct net_device *ndev) · 78 unmodified lines
724726 int i;
725727
726728 priv->rx_head = 0;
729+ priv->rx_cnt_remaining = 0;
727730 priv->tx_head = 0;
728731 priv->tx_tail = 0;
729732 hip04_reset_ppe(priv);
@@ -1038,7 +1041,6 @@ static int hip04_remove(struct platform_device *pdev) · 308 unmodified lines
10381041
10391042 hip04_free_ring(ndev, d);
10401043 unregister_netdev(ndev);
1041− free_irq(ndev->irq, ndev);
10421044 of_node_put(priv->phy_node);
10431045 cancel_work_sync(&priv->tx_timeout_task);
10441046 free_netdev(ndev);
drivers/net/ethernet/hisilicon/hns/hnae.c+0−1
@@ -199,7 +199,6 @@ hnae_init_ring(struct hnae_queue *q, struct hnae_ring *ring, int flags) · 198 unmodified lines
199199
200200 ring->q = q;
201201 ring->flags = flags;
202− spin_lock_init(&ring->lock);
203202 ring->coal_param = q->handle->coal_param;
204203 assert(!ring->desc && !ring->desc_cb && !ring->desc_dma_addr);
205204
drivers/net/ethernet/hisilicon/hns/hnae.h+0−3
@@ -274,9 +274,6 @@ struct hnae_ring { · 273 unmodified lines
274274 /* statistic */
275275 struct ring_stats stats;
276276
277− /* ring lock for poll one */
278− spinlock_t lock;
279−
280277 dma_addr_t desc_dma_addr;
281278 u32 buf_size; /* size for hnae_desc->addr, preset by AE */
282279 u16 desc_num; /* total number of desc */
drivers/net/ethernet/hisilicon/hns/hns_enet.c+1−21
@@ -943,15 +943,6 @@ static int is_valid_clean_head(struct hnae_ring *ring, int h) · 942 unmodified lines
943943 return u > c ? (h > c && h <= u) : (h > c || h <= u);
944944 }
945945
946−/* netif_tx_lock will turn down the performance, set only when necessary */
947−#ifdef CONFIG_NET_POLL_CONTROLLER
948−#define NETIF_TX_LOCK(ring) spin_lock(&(ring)->lock)
949−#define NETIF_TX_UNLOCK(ring) spin_unlock(&(ring)->lock)
950−#else
951−#define NETIF_TX_LOCK(ring)
952−#define NETIF_TX_UNLOCK(ring)
953−#endif
954−
955946 /* reclaim all desc in one budget
956947 * return error or number of desc left
957948 */
@@ -965,21 +956,16 @@ static int hns_nic_tx_poll_one(struct hns_nic_ring_data *ring_data, · 7 unmodified lines
965956 int head;
966957 int bytes, pkts;
967958
968− NETIF_TX_LOCK(ring);
969−
970959 head = readl_relaxed(ring->io_base + RCB_REG_HEAD);
971960 rmb(); /* make sure head is ready before touch any data */
972961
973− if (is_ring_empty(ring) || head == ring->next_to_clean) {
974− NETIF_TX_UNLOCK(ring);
962+ if (is_ring_empty(ring) || head == ring->next_to_clean)
975963 return 0; /* no data to poll */
976− }
977964
978965 if (!is_valid_clean_head(ring, head)) {
979966 netdev_err(ndev, "wrong head (%d, %d-%d)\n", head,
980967 ring->next_to_use, ring->next_to_clean);
981968 ring->stats.io_err_cnt++;
982− NETIF_TX_UNLOCK(ring);
983969 return -EIO;
984970 }
985971
@@ -994,8 +980,6 @@ static int hns_nic_tx_poll_one(struct hns_nic_ring_data *ring_data, · 8 unmodified lines
994980 ring->stats.tx_pkts += pkts;
995981 ring->stats.tx_bytes += bytes;
996982
997− NETIF_TX_UNLOCK(ring);
998−
999983 dev_queue = netdev_get_tx_queue(ndev, ring_data->queue_index);
1000984 netdev_tx_completed_queue(dev_queue, pkts, bytes);
1001985
@@ -1055,16 +1039,12 @@ static void hns_nic_tx_clr_all_bufs(struct hns_nic_ring_data *ring_data) · 53 unmodified lines
10551039 int head;
10561040 int bytes, pkts;
10571041
1058− NETIF_TX_LOCK(ring);
1059−
10601042 head = ring->next_to_use; /* ntu :soft setted ring position*/
10611043 bytes = 0;
10621044 pkts = 0;
10631045 while (head != ring->next_to_clean)
10641046 hns_nic_reclaim_one_desc(ring, &bytes, &pkts);
10651047
1066− NETIF_TX_UNLOCK(ring);
1067−
10681048 dev_queue = netdev_get_tx_queue(ndev, ring_data->queue_index);
10691049 netdev_tx_reset_queue(dev_queue);
10701050 }
drivers/net/ethernet/hisilicon/hns3/hnae3.h+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0+
1+/* SPDX-License-Identifier: GPL-2.0+ */
22 // Copyright (c) 2016-2017 Hisilicon Limited.
33
44 #ifndef __HNAE3_H
drivers/net/ethernet/hisilicon/hns3/hns3_enet.h+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0+
1+/* SPDX-License-Identifier: GPL-2.0+ */
22 // Copyright (c) 2016-2017 Hisilicon Limited.
33
44 #ifndef __HNS3_ENET_H
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0+
1+/* SPDX-License-Identifier: GPL-2.0+ */
22 // Copyright (c) 2016-2017 Hisilicon Limited.
33
44 #ifndef __HCLGE_CMD_H
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.h+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0+
1+/* SPDX-License-Identifier: GPL-2.0+ */
22 // Copyright (c) 2016-2017 Hisilicon Limited.
33
44 #ifndef __HCLGE_DCB_H__
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c+17−1
@@ -3587,12 +3587,28 @@ static int hclge_set_rst_done(struct hclge_dev *hdev) · 3586 unmodified lines
35873587 {
35883588 struct hclge_pf_rst_done_cmd *req;
35893589 struct hclge_desc desc;
3590+ int ret;
35903591
35913592 req = (struct hclge_pf_rst_done_cmd *)desc.data;
35923593 hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_PF_RST_DONE, false);
35933594 req->pf_rst_done |= HCLGE_PF_RESET_DONE_BIT;
35943595
3595− return hclge_cmd_send(&hdev->hw, &desc, 1);
3596+ ret = hclge_cmd_send(&hdev->hw, &desc, 1);
3597+ /* To be compatible with the old firmware, which does not support
3598+ * command HCLGE_OPC_PF_RST_DONE, just print a warning and
3599+ * return success
3600+ */
3601+ if (ret == -EOPNOTSUPP) {
3602+ dev_warn(&hdev->pdev->dev,
3603+ "current firmware does not support command(0x%x)!\n",
3604+ HCLGE_OPC_PF_RST_DONE);
3605+ return 0;
3606+ } else if (ret) {
3607+ dev_err(&hdev->pdev->dev, "assert PF reset done fail %d!\n",
3608+ ret);
3609+ }
3610+
3611+ return ret;
35963612 }
35973613
35983614 static int hclge_reset_prepare_up(struct hclge_dev *hdev)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0+
1+/* SPDX-License-Identifier: GPL-2.0+ */
22 // Copyright (c) 2016-2017 Hisilicon Limited.
33
44 #ifndef __HCLGE_MAIN_H
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.h+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0+
1+/* SPDX-License-Identifier: GPL-2.0+ */
22 // Copyright (c) 2016-2017 Hisilicon Limited.
33
44 #ifndef __HCLGE_MDIO_H
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0+
1+/* SPDX-License-Identifier: GPL-2.0+ */
22 // Copyright (c) 2016-2017 Hisilicon Limited.
33
44 #ifndef __HCLGE_TM_H
drivers/net/ethernet/intel/e1000/e1000_ethtool.c+3−4
@@ -607,6 +607,7 @@ static int e1000_set_ringparam(struct net_device *netdev, · 606 unmodified lines
607607 for (i = 0; i < adapter->num_rx_queues; i++)
608608 rxdr[i].count = rxdr->count;
609609
610+ err = 0;
610611 if (netif_running(adapter->netdev)) {
611612 /* Try to get new resources before deleting old */
612613 err = e1000_setup_all_rx_resources(adapter);
@@ -627,14 +628,13 @@ static int e1000_set_ringparam(struct net_device *netdev, · 14 unmodified lines
627628 adapter->rx_ring = rxdr;
628629 adapter->tx_ring = txdr;
629630 err = e1000_up(adapter);
630− if (err)
631− goto err_setup;
632631 }
633632 kfree(tx_old);
634633 kfree(rx_old);
635634
636635 clear_bit(__E1000_RESETTING, &adapter->flags);
637− return 0;
636+ return err;
637+
638638 err_setup_tx:
639639 e1000_free_all_rx_resources(adapter);
640640 err_setup_rx:
@@ -646,7 +646,6 @@ err_alloc_rx: · 5 unmodified lines
646646 err_alloc_tx:
647647 if (netif_running(adapter->netdev))
648648 e1000_up(adapter);
649−err_setup:
650649 clear_bit(__E1000_RESETTING, &adapter->flags);
651650 return err;
652651 }
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h+2−0
@@ -20,6 +20,8 @@ · 19 unmodified lines
2020
2121 /* API version 1.7 implements additional link and PHY-specific APIs */
2222 #define I40E_MINOR_VER_GET_LINK_INFO_XL710 0x0007
23+/* API version 1.9 for X722 implements additional link and PHY-specific APIs */
24+#define I40E_MINOR_VER_GET_LINK_INFO_X722 0x0009
2325 /* API version 1.6 for X722 devices adds ability to stop FW LLDP agent */
2426 #define I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722 0x0006
2527
drivers/net/ethernet/intel/i40e/i40e_common.c+2−1
@@ -1876,7 +1876,8 @@ i40e_status i40e_aq_get_link_info(struct i40e_hw *hw, · 1875 unmodified lines
18761876 hw->aq.fw_min_ver < 40)) && hw_link_info->phy_type == 0xE)
18771877 hw_link_info->phy_type = I40E_PHY_TYPE_10GBASE_SFPP_CU;
18781878
1879− if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE) {
1879+ if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE &&
1880+ hw->mac.type != I40E_MAC_X722) {
18801881 __le32 tmp;
18811882
18821883 memcpy(&tmp, resp->link_type, sizeof(tmp));
drivers/net/ethernet/intel/i40e/i40e_xsk.c+2−13
@@ -157,11 +157,6 @@ static int i40e_xsk_umem_disable(struct i40e_vsi *vsi, u16 qid) · 156 unmodified lines
157157 err = i40e_queue_pair_enable(vsi, qid);
158158 if (err)
159159 return err;
160−
161− /* Kick start the NAPI context so that receiving will start */
162− err = i40e_xsk_wakeup(vsi->netdev, qid, XDP_WAKEUP_RX);
163− if (err)
164− return err;
165160 }
166161
167162 return 0;
@@ -694,8 +689,6 @@ static bool i40e_xmit_zc(struct i40e_ring *xdp_ring, unsigned int budget) · 526 unmodified lines
694689 i40e_xdp_ring_update_tail(xdp_ring);
695690
696691 xsk_umem_consume_tx_done(xdp_ring->xsk_umem);
697− if (xsk_umem_uses_need_wakeup(xdp_ring->xsk_umem))
698− xsk_clear_tx_need_wakeup(xdp_ring->xsk_umem);
699692 }
700693
701694 return !!budget && work_done;
@@ -774,12 +767,8 @@ bool i40e_clean_xdp_tx_irq(struct i40e_vsi *vsi, · 72 unmodified lines
774767 i40e_update_tx_stats(tx_ring, completed_frames, total_bytes);
775768
776769 out_xmit:
777− if (xsk_umem_uses_need_wakeup(tx_ring->xsk_umem)) {
778− if (tx_ring->next_to_clean == tx_ring->next_to_use)
779− xsk_set_tx_need_wakeup(tx_ring->xsk_umem);
780− else
781− xsk_clear_tx_need_wakeup(tx_ring->xsk_umem);
782− }
770+ if (xsk_umem_uses_need_wakeup(tx_ring->xsk_umem))
771+ xsk_set_tx_need_wakeup(tx_ring->xsk_umem);
783772
784773 xmit_done = i40e_xmit_zc(tx_ring, budget);
785774
drivers/net/ethernet/intel/iavf/iavf_main.c+2−2
@@ -314,7 +314,7 @@ iavf_map_vector_to_rxq(struct iavf_adapter *adapter, int v_idx, int r_idx) · 313 unmodified lines
314314 q_vector->rx.target_itr = ITR_TO_REG(rx_ring->itr_setting);
315315 q_vector->ring_mask |= BIT(r_idx);
316316 wr32(hw, IAVF_VFINT_ITRN1(IAVF_RX_ITR, q_vector->reg_idx),
317− q_vector->rx.current_itr);
317+ q_vector->rx.current_itr >> 1);
318318 q_vector->rx.current_itr = q_vector->rx.target_itr;
319319 }
320320
@@ -340,7 +340,7 @@ iavf_map_vector_to_txq(struct iavf_adapter *adapter, int v_idx, int t_idx) · 19 unmodified lines
340340 q_vector->tx.target_itr = ITR_TO_REG(tx_ring->itr_setting);
341341 q_vector->num_ringpairs++;
342342 wr32(hw, IAVF_VFINT_ITRN1(IAVF_TX_ITR, q_vector->reg_idx),
343− q_vector->tx.target_itr);
343+ q_vector->tx.target_itr >> 1);
344344 q_vector->tx.current_itr = q_vector->tx.target_itr;
345345 }
346346
drivers/net/ethernet/intel/ice/ice_sched.c+1−1
@@ -1036,7 +1036,7 @@ enum ice_status ice_sched_query_res_alloc(struct ice_hw *hw) · 1035 unmodified lines
10361036 struct ice_aqc_query_txsched_res_resp *buf;
10371037 enum ice_status status = 0;
10381038 __le16 max_sibl;
1039− u8 i;
1039+ u16 i;
10401040
10411041 if (hw->layer_info)
10421042 return status;
drivers/net/ethernet/intel/igb/e1000_82575.c+1−1
@@ -466,7 +466,7 @@ static s32 igb_init_mac_params_82575(struct e1000_hw *hw) · 465 unmodified lines
466466 ? igb_setup_copper_link_82575
467467 : igb_setup_serdes_link_82575;
468468
469− if (mac->type == e1000_82580) {
469+ if (mac->type == e1000_82580 || mac->type == e1000_i350) {
470470 switch (hw->device_id) {
471471 /* feature not supported on these id's */
472472 case E1000_DEV_ID_DH89XXCC_SGMII:
drivers/net/ethernet/intel/igb/igb_main.c+7−5
@@ -753,7 +753,8 @@ u32 igb_rd32(struct e1000_hw *hw, u32 reg) · 752 unmodified lines
753753 struct net_device *netdev = igb->netdev;
754754 hw->hw_addr = NULL;
755755 netdev_err(netdev, "PCIe link lost\n");
756− WARN(1, "igb: Failed to read reg 0x%x!\n", reg);
756+ WARN(pci_device_is_present(igb->pdev),
757+ "igb: Failed to read reg 0x%x!\n", reg);
757758 }
758759
759760 return value;
@@ -2064,7 +2065,8 @@ static void igb_check_swap_media(struct igb_adapter *adapter) · 1304 unmodified lines
20642065 if ((hw->phy.media_type == e1000_media_type_copper) &&
20652066 (!(connsw & E1000_CONNSW_AUTOSENSE_EN))) {
20662067 swap_now = true;
2067− } else if (!(connsw & E1000_CONNSW_SERDESD)) {
2068+ } else if ((hw->phy.media_type != e1000_media_type_copper) &&
2069+ !(connsw & E1000_CONNSW_SERDESD)) {
20682070 /* copper signal takes time to appear */
20692071 if (adapter->copper_tries < 4) {
20702072 adapter->copper_tries++;
@@ -2370,7 +2372,7 @@ void igb_reset(struct igb_adapter *adapter) · 299 unmodified lines
23702372 adapter->ei.get_invariants(hw);
23712373 adapter->flags &= ~IGB_FLAG_MEDIA_RESET;
23722374 }
2373− if ((mac->type == e1000_82575) &&
2375+ if ((mac->type == e1000_82575 || mac->type == e1000_i350) &&
23742376 (adapter->flags & IGB_FLAG_MAS_ENABLE)) {
23752377 igb_enable_mas(adapter);
23762378 }
@@ -5673,8 +5675,8 @@ static void igb_tx_ctxtdesc(struct igb_ring *tx_ring, · 3296 unmodified lines
56735675 * should have been handled by the upper layers.
56745676 */
56755677 if (tx_ring->launchtime_enable) {
5676− ts = ns_to_timespec64(first->skb->tstamp);
5677− first->skb->tstamp = 0;
5678+ ts = ktime_to_timespec64(first->skb->tstamp);
5679+ first->skb->tstamp = ktime_set(0, 0);
56785680 context_desc->seqnum_seed = cpu_to_le32(ts.tv_nsec / 32);
56795681 } else {
56805682 context_desc->seqnum_seed = 0;
drivers/net/ethernet/intel/igc/igc_main.c+4−3
@@ -824,8 +824,8 @@ static void igc_tx_ctxtdesc(struct igc_ring *tx_ring, · 823 unmodified lines
824824 * should have been handled by the upper layers.
825825 */
826826 if (tx_ring->launchtime_enable) {
827− ts = ns_to_timespec64(first->skb->tstamp);
828− first->skb->tstamp = 0;
827+ ts = ktime_to_timespec64(first->skb->tstamp);
828+ first->skb->tstamp = ktime_set(0, 0);
829829 context_desc->launch_time = cpu_to_le32(ts.tv_nsec / 32);
830830 } else {
831831 context_desc->launch_time = 0;
@@ -4047,7 +4047,8 @@ u32 igc_rd32(struct igc_hw *hw, u32 reg) · 3215 unmodified lines
40474047 hw->hw_addr = NULL;
40484048 netif_device_detach(netdev);
40494049 netdev_err(netdev, "PCIe link lost, device now detached\n");
4050− WARN(1, "igc: Failed to read reg 0x%x!\n", reg);
4050+ WARN(pci_device_is_present(igc->pdev),
4051+ "igc: Failed to read reg 0x%x!\n", reg);
40514052 }
40524053
40534054 return value;
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+0−1
@@ -4310,7 +4310,6 @@ static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter) · 4309 unmodified lines
43104310 if (test_bit(__IXGBE_RX_FCOE, &rx_ring->state))
43114311 set_bit(__IXGBE_RX_3K_BUFFER, &rx_ring->state);
43124312
4313− clear_bit(__IXGBE_RX_BUILD_SKB_ENABLED, &rx_ring->state);
43144313 if (adapter->flags2 & IXGBE_FLAG2_RX_LEGACY)
43154314 continue;
43164315
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c+2−8
@@ -622,8 +622,6 @@ static bool ixgbe_xmit_zc(struct ixgbe_ring *xdp_ring, unsigned int budget) · 621 unmodified lines
622622 if (tx_desc) {
623623 ixgbe_xdp_ring_update_tail(xdp_ring);
624624 xsk_umem_consume_tx_done(xdp_ring->xsk_umem);
625− if (xsk_umem_uses_need_wakeup(xdp_ring->xsk_umem))
626− xsk_clear_tx_need_wakeup(xdp_ring->xsk_umem);
627625 }
628626
629627 return !!budget && work_done;
@@ -691,12 +689,8 @@ bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector, · 61 unmodified lines
691689 if (xsk_frames)
692690 xsk_umem_complete_tx(umem, xsk_frames);
693691
694− if (xsk_umem_uses_need_wakeup(tx_ring->xsk_umem)) {
695− if (tx_ring->next_to_clean == tx_ring->next_to_use)
696− xsk_set_tx_need_wakeup(tx_ring->xsk_umem);
697− else
698− xsk_clear_tx_need_wakeup(tx_ring->xsk_umem);
699− }
692+ if (xsk_umem_uses_need_wakeup(tx_ring->xsk_umem))
693+ xsk_set_tx_need_wakeup(tx_ring->xsk_umem);
700694
701695 return ixgbe_xmit_zc(tx_ring, q_vector->tx.work_limit);
702696 }
drivers/net/ethernet/marvell/mvneta_bm.h+20−12
@@ -160,16 +160,23 @@ static inline u32 mvneta_bm_pool_get_bp(struct mvneta_bm *priv, · 159 unmodified lines
160160 (bm_pool->id << MVNETA_BM_POOL_ACCESS_OFFS));
161161 }
162162 #else
163−void mvneta_bm_pool_destroy(struct mvneta_bm *priv,
164− struct mvneta_bm_pool *bm_pool, u8 port_map) {}
165−void mvneta_bm_bufs_free(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
166− u8 port_map) {}
167−int mvneta_bm_construct(struct hwbm_pool *hwbm_pool, void *buf) { return 0; }
168−int mvneta_bm_pool_refill(struct mvneta_bm *priv,
169− struct mvneta_bm_pool *bm_pool) {return 0; }
170−struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,
171− enum mvneta_bm_type type, u8 port_id,
172− int pkt_size) { return NULL; }
163+static inline void mvneta_bm_pool_destroy(struct mvneta_bm *priv,
164+ struct mvneta_bm_pool *bm_pool,
165+ u8 port_map) {}
166+static inline void mvneta_bm_bufs_free(struct mvneta_bm *priv,
167+ struct mvneta_bm_pool *bm_pool,
168+ u8 port_map) {}
169+static inline int mvneta_bm_construct(struct hwbm_pool *hwbm_pool, void *buf)
170+{ return 0; }
171+static inline int mvneta_bm_pool_refill(struct mvneta_bm *priv,
172+ struct mvneta_bm_pool *bm_pool)
173+{ return 0; }
174+static inline struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv,
175+ u8 pool_id,
176+ enum mvneta_bm_type type,
177+ u8 port_id,
178+ int pkt_size)
179+{ return NULL; }
173180
174181 static inline void mvneta_bm_pool_put_bp(struct mvneta_bm *priv,
175182 struct mvneta_bm_pool *bm_pool,
@@ -178,7 +185,8 @@ static inline void mvneta_bm_pool_put_bp(struct mvneta_bm *priv, · 2 unmodified lines
178185 static inline u32 mvneta_bm_pool_get_bp(struct mvneta_bm *priv,
179186 struct mvneta_bm_pool *bm_pool)
180187 { return 0; }
181−struct mvneta_bm *mvneta_bm_get(struct device_node *node) { return NULL; }
182−void mvneta_bm_put(struct mvneta_bm *priv) {}
188+static inline struct mvneta_bm *mvneta_bm_get(struct device_node *node)
189+{ return NULL; }
190+static inline void mvneta_bm_put(struct mvneta_bm *priv) {}
183191 #endif /* CONFIG_MVNETA_BM */
184192 #endif
drivers/net/ethernet/mellanox/mlx4/main.c+1−2
@@ -514,8 +514,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) · 513 unmodified lines
514514 dev->caps.max_rq_desc_sz = dev_cap->max_rq_desc_sz;
515515 /*
516516 * Subtract 1 from the limit because we need to allocate a
517− * spare CQE so the HCA HW can tell the difference between an
518− * empty CQ and a full CQ.
517+ * spare CQE to enable resizing the CQ.
519518 */
520519 dev->caps.max_cqes = dev_cap->max_cq_sz - 1;
521520 dev->caps.reserved_cqs = dev_cap->reserved_cqs;
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c+26−16
@@ -471,12 +471,31 @@ void mlx4_init_quotas(struct mlx4_dev *dev) · 470 unmodified lines
471471 priv->mfunc.master.res_tracker.res_alloc[RES_MPT].quota[pf];
472472 }
473473
474−static int get_max_gauranteed_vfs_counter(struct mlx4_dev *dev)
474+static int
475+mlx4_calc_res_counter_guaranteed(struct mlx4_dev *dev,
476+ struct resource_allocator *res_alloc,
477+ int vf)
475478 {
476− /* reduce the sink counter */
477− return (dev->caps.max_counters - 1 -
478− (MLX4_PF_COUNTERS_PER_PORT * MLX4_MAX_PORTS))
479− / MLX4_MAX_PORTS;
479+ struct mlx4_active_ports actv_ports;
480+ int ports, counters_guaranteed;
481+
482+ /* For master, only allocate according to the number of phys ports */
483+ if (vf == mlx4_master_func_num(dev))
484+ return MLX4_PF_COUNTERS_PER_PORT * dev->caps.num_ports;
485+
486+ /* calculate real number of ports for the VF */
487+ actv_ports = mlx4_get_active_ports(dev, vf);
488+ ports = bitmap_weight(actv_ports.ports, dev->caps.num_ports);
489+ counters_guaranteed = ports * MLX4_VF_COUNTERS_PER_PORT;
490+
491+ /* If we do not have enough counters for this VF, do not
492+ * allocate any for it. '-1' to reduce the sink counter.
493+ */
494+ if ((res_alloc->res_reserved + counters_guaranteed) >
495+ (dev->caps.max_counters - 1))
496+ return 0;
497+
498+ return counters_guaranteed;
480499 }
481500
482501 int mlx4_init_resource_tracker(struct mlx4_dev *dev)
@@ -484,7 +503,6 @@ int mlx4_init_resource_tracker(struct mlx4_dev *dev) · 1 unmodified line
484503 struct mlx4_priv *priv = mlx4_priv(dev);
485504 int i, j;
486505 int t;
487− int max_vfs_guarantee_counter = get_max_gauranteed_vfs_counter(dev);
488506
489507 priv->mfunc.master.res_tracker.slave_list =
490508 kcalloc(dev->num_slaves, sizeof(struct slave_list),
@@ -603,16 +621,8 @@ int mlx4_init_resource_tracker(struct mlx4_dev *dev) · 112 unmodified lines
603621 break;
604622 case RES_COUNTER:
605623 res_alloc->quota[t] = dev->caps.max_counters;
606− if (t == mlx4_master_func_num(dev))
607− res_alloc->guaranteed[t] =
608− MLX4_PF_COUNTERS_PER_PORT *
609− MLX4_MAX_PORTS;
610− else if (t <= max_vfs_guarantee_counter)
611− res_alloc->guaranteed[t] =
612− MLX4_VF_COUNTERS_PER_PORT *
613− MLX4_MAX_PORTS;
614− else
615− res_alloc->guaranteed[t] = 0;
624+ res_alloc->guaranteed[t] =
625+ mlx4_calc_res_counter_guaranteed(dev, res_alloc, t);
616626 break;
617627 default:
618628 break;
drivers/net/ethernet/mellanox/mlx5/core/en.h+2−1
@@ -345,7 +345,7 @@ struct mlx5e_tx_wqe_info { · 344 unmodified lines
345345 u8 num_wqebbs;
346346 u8 num_dma;
347347 #ifdef CONFIG_MLX5_EN_TLS
348− skb_frag_t *resync_dump_frag;
348+ struct page *resync_dump_frag_page;
349349 #endif
350350 };
351351
@@ -410,6 +410,7 @@ struct mlx5e_txqsq { · 58 unmodified lines
410410 struct device *pdev;
411411 __be32 mkey_be;
412412 unsigned long state;
413+ unsigned int hw_mtu;
413414 struct hwtstamp_config *tstamp;
414415 struct mlx5_clock *clock;
415416
drivers/net/ethernet/mellanox/mlx5/core/en/hv_vhca_stats.c+2−2
@@ -141,7 +141,7 @@ int mlx5e_hv_vhca_stats_create(struct mlx5e_priv *priv) · 140 unmodified lines
141141 "Failed to create hv vhca stats agent, err = %ld\n",
142142 PTR_ERR(agent));
143143
144− kfree(priv->stats_agent.buf);
144+ kvfree(priv->stats_agent.buf);
145145 return IS_ERR_OR_NULL(agent);
146146 }
147147
@@ -157,5 +157,5 @@ void mlx5e_hv_vhca_stats_destroy(struct mlx5e_priv *priv) · 9 unmodified lines
157157 return;
158158
159159 mlx5_hv_vhca_agent_destroy(priv->stats_agent.agent);
160− kfree(priv->stats_agent.buf);
160+ kvfree(priv->stats_agent.buf);
161161 }
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c+9−3
@@ -97,15 +97,19 @@ static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv, · 96 unmodified lines
9797 if (ret)
9898 return ret;
9999
100− if (mlx5_lag_is_multipath(mdev) && rt->rt_gw_family != AF_INET)
100+ if (mlx5_lag_is_multipath(mdev) && rt->rt_gw_family != AF_INET) {
101+ ip_rt_put(rt);
101102 return -ENETUNREACH;
103+ }
102104 #else
103105 return -EOPNOTSUPP;
104106 #endif
105107
106108 ret = get_route_and_out_devs(priv, rt->dst.dev, route_dev, out_dev);
107− if (ret < 0)
109+ if (ret < 0) {
110+ ip_rt_put(rt);
108111 return ret;
112+ }
109113
110114 if (!(*out_ttl))
111115 *out_ttl = ip4_dst_hoplimit(&rt->dst);
@@ -149,8 +153,10 @@ static int mlx5e_route_lookup_ipv6(struct mlx5e_priv *priv, · 37 unmodified lines
149153 *out_ttl = ip6_dst_hoplimit(dst);
150154
151155 ret = get_route_and_out_devs(priv, dst->dev, route_dev, out_dev);
152− if (ret < 0)
156+ if (ret < 0) {
157+ dst_release(dst);
153158 return ret;
159+ }
154160 #else
155161 return -EOPNOTSUPP;
156162 #endif
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h+6−7
@@ -15,15 +15,14 @@ · 14 unmodified lines
1515 #else
1616 /* TLS offload requires additional stop_room for:
1717 * - a resync SKB.
18− * kTLS offload requires additional stop_room for:
19− * - static params WQE,
20− * - progress params WQE, and
21− * - resync DUMP per frag.
18+ * kTLS offload requires fixed additional stop_room for:
19+ * - a static params WQE, and a progress params WQE.
20+ * The additional MTU-depending room for the resync DUMP WQEs
21+ * will be calculated and added in runtime.
2222 */
2323 #define MLX5E_SQ_TLS_ROOM \
2424 (MLX5_SEND_WQE_MAX_WQEBBS + \
25− MLX5E_KTLS_STATIC_WQEBBS + MLX5E_KTLS_PROGRESS_WQEBBS + \
26− MAX_SKB_FRAGS * MLX5E_KTLS_MAX_DUMP_WQEBBS)
25+ MLX5E_KTLS_STATIC_WQEBBS + MLX5E_KTLS_PROGRESS_WQEBBS)
2726 #endif
2827
2928 #define INL_HDR_START_SZ (sizeof(((struct mlx5_wqe_eth_seg *)NULL)->inline_hdr.start))
@@ -92,7 +91,7 @@ mlx5e_fill_sq_frag_edge(struct mlx5e_txqsq *sq, struct mlx5_wq_cyc *wq, · 62 unmodified lines
9291
9392 /* fill sq frag edge with nops to avoid wqe wrapping two pages */
9493 for (; wi < edge_wi; wi++) {
95− wi->skb = NULL;
94+ memset(wi, 0, sizeof(*wi));
9695 wi->num_wqebbs = 1;
9796 mlx5e_post_nop(wq, sq->sqn, &sq->pc);
9897 }
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c+1−1
@@ -38,7 +38,7 @@ static int mlx5e_ktls_add(struct net_device *netdev, struct sock *sk, · 37 unmodified lines
3838 return -ENOMEM;
3939
4040 tx_priv->expected_seq = start_offload_tcp_sn;
41− tx_priv->crypto_info = crypto_info;
41+ tx_priv->crypto_info = *(struct tls12_crypto_info_aes_gcm_128 *)crypto_info;
4242 mlx5e_set_ktls_tx_priv_ctx(tls_ctx, tx_priv);
4343
4444 /* tc and underlay_qpn values are not in use for tls tis */
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h+25−4
@@ -21,7 +21,14 @@ · 20 unmodified lines
2121 MLX5_ST_SZ_BYTES(tls_progress_params))
2222 #define MLX5E_KTLS_PROGRESS_WQEBBS \
2323 (DIV_ROUND_UP(MLX5E_KTLS_PROGRESS_WQE_SZ, MLX5_SEND_WQE_BB))
24−#define MLX5E_KTLS_MAX_DUMP_WQEBBS 2
24+
25+struct mlx5e_dump_wqe {
26+ struct mlx5_wqe_ctrl_seg ctrl;
27+ struct mlx5_wqe_data_seg data;
28+};
29+
30+#define MLX5E_KTLS_DUMP_WQEBBS \
31+ (DIV_ROUND_UP(sizeof(struct mlx5e_dump_wqe), MLX5_SEND_WQE_BB))
2532
2633 enum {
2734 MLX5E_TLS_PROGRESS_PARAMS_AUTH_STATE_NO_OFFLOAD = 0,
@@ -37,7 +44,7 @@ enum { · 9 unmodified lines
3744
3845 struct mlx5e_ktls_offload_context_tx {
3946 struct tls_offload_context_tx *tx_ctx;
40− struct tls_crypto_info *crypto_info;
47+ struct tls12_crypto_info_aes_gcm_128 crypto_info;
4148 u32 expected_seq;
4249 u32 tisn;
4350 u32 key_id;
@@ -86,14 +93,28 @@ struct sk_buff *mlx5e_ktls_handle_tx_skb(struct net_device *netdev, · 42 unmodified lines
8693 struct mlx5e_tx_wqe **wqe, u16 *pi);
8794 void mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
8895 struct mlx5e_tx_wqe_info *wi,
89− struct mlx5e_sq_dma *dma);
90−
96+ u32 *dma_fifo_cc);
97+static inline u8
98+mlx5e_ktls_dumps_num_wqebbs(struct mlx5e_txqsq *sq, unsigned int nfrags,
99+ unsigned int sync_len)
100+{
101+ /* Given the MTU and sync_len, calculates an upper bound for the
102+ * number of WQEBBs needed for the TX resync DUMP WQEs of a record.
103+ */
104+ return MLX5E_KTLS_DUMP_WQEBBS *
105+ (nfrags + DIV_ROUND_UP(sync_len, sq->hw_mtu));
106+}
91107 #else
92108
93109 static inline void mlx5e_ktls_build_netdev(struct mlx5e_priv *priv)
94110 {
95111 }
96112
113+static inline void
114+mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
115+ struct mlx5e_tx_wqe_info *wi,
116+ u32 *dma_fifo_cc) {}
117+
97118 #endif
98119
99120 #endif /* __MLX5E_TLS_H__ */
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c+114−76
@@ -24,17 +24,12 @@ enum { · 23 unmodified lines
2424 static void
2525 fill_static_params_ctx(void *ctx, struct mlx5e_ktls_offload_context_tx *priv_tx)
2626 {
27− struct tls_crypto_info *crypto_info = priv_tx->crypto_info;
28− struct tls12_crypto_info_aes_gcm_128 *info;
27+ struct tls12_crypto_info_aes_gcm_128 *info = &priv_tx->crypto_info;
2928 char *initial_rn, *gcm_iv;
3029 u16 salt_sz, rec_seq_sz;
3130 char *salt, *rec_seq;
3231 u8 tls_version;
3332
34− if (WARN_ON(crypto_info->cipher_type != TLS_CIPHER_AES_GCM_128))
35− return;
36−
37− info = (struct tls12_crypto_info_aes_gcm_128 *)crypto_info;
3833 EXTRACT_INFO_FIELDS;
3934
4035 gcm_iv = MLX5_ADDR_OF(tls_static_params, ctx, gcm_iv);
@@ -108,16 +103,15 @@ build_progress_params(struct mlx5e_tx_wqe *wqe, u16 pc, u32 sqn, · 67 unmodified lines
108103 }
109104
110105 static void tx_fill_wi(struct mlx5e_txqsq *sq,
111− u16 pi, u8 num_wqebbs,
112− skb_frag_t *resync_dump_frag,
113− u32 num_bytes)
106+ u16 pi, u8 num_wqebbs, u32 num_bytes,
107+ struct page *page)
114108 {
115109 struct mlx5e_tx_wqe_info *wi = &sq->db.wqe_info[pi];
116110
117− wi->skb = NULL;
118− wi->num_wqebbs = num_wqebbs;
119− wi->resync_dump_frag = resync_dump_frag;
120− wi->num_bytes = num_bytes;
111+ memset(wi, 0, sizeof(*wi));
112+ wi->num_wqebbs = num_wqebbs;
113+ wi->num_bytes = num_bytes;
114+ wi->resync_dump_frag_page = page;
121115 }
122116
123117 void mlx5e_ktls_tx_offload_set_pending(struct mlx5e_ktls_offload_context_tx *priv_tx)
@@ -145,7 +139,7 @@ post_static_params(struct mlx5e_txqsq *sq, · 21 unmodified lines
145139
146140 umr_wqe = mlx5e_sq_fetch_wqe(sq, MLX5E_KTLS_STATIC_UMR_WQE_SZ, &pi);
147141 build_static_params(umr_wqe, sq->pc, sq->sqn, priv_tx, fence);
148− tx_fill_wi(sq, pi, MLX5E_KTLS_STATIC_WQEBBS, NULL, 0);
142+ tx_fill_wi(sq, pi, MLX5E_KTLS_STATIC_WQEBBS, 0, NULL);
149143 sq->pc += MLX5E_KTLS_STATIC_WQEBBS;
150144 }
151145
@@ -159,7 +153,7 @@ post_progress_params(struct mlx5e_txqsq *sq, · 7 unmodified lines
159153
160154 wqe = mlx5e_sq_fetch_wqe(sq, MLX5E_KTLS_PROGRESS_WQE_SZ, &pi);
161155 build_progress_params(wqe, sq->pc, sq->sqn, priv_tx, fence);
162− tx_fill_wi(sq, pi, MLX5E_KTLS_PROGRESS_WQEBBS, NULL, 0);
156+ tx_fill_wi(sq, pi, MLX5E_KTLS_PROGRESS_WQEBBS, 0, NULL);
163157 sq->pc += MLX5E_KTLS_PROGRESS_WQEBBS;
164158 }
165159
@@ -169,6 +163,14 @@ mlx5e_ktls_tx_post_param_wqes(struct mlx5e_txqsq *sq, · 3 unmodified lines
169163 bool skip_static_post, bool fence_first_post)
170164 {
171165 bool progress_fence = skip_static_post || !fence_first_post;
166+ struct mlx5_wq_cyc *wq = &sq->wq;
167+ u16 contig_wqebbs_room, pi;
168+
169+ pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
170+ contig_wqebbs_room = mlx5_wq_cyc_get_contig_wqebbs(wq, pi);
171+ if (unlikely(contig_wqebbs_room <
172+ MLX5E_KTLS_STATIC_WQEBBS + MLX5E_KTLS_PROGRESS_WQEBBS))
173+ mlx5e_fill_sq_frag_edge(sq, wq, pi, contig_wqebbs_room);
172174
173175 if (!skip_static_post)
174176 post_static_params(sq, priv_tx, fence_first_post);
@@ -180,29 +182,36 @@ struct tx_sync_info { · 5 unmodified lines
180182 u64 rcd_sn;
181183 s32 sync_len;
182184 int nr_frags;
183− skb_frag_t *frags[MAX_SKB_FRAGS];
185+ skb_frag_t frags[MAX_SKB_FRAGS];
186+};
187+
188+enum mlx5e_ktls_sync_retval {
189+ MLX5E_KTLS_SYNC_DONE,
190+ MLX5E_KTLS_SYNC_FAIL,
191+ MLX5E_KTLS_SYNC_SKIP_NO_DATA,
184192 };
185193
186−static bool tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
187− u32 tcp_seq, struct tx_sync_info *info)
194+static enum mlx5e_ktls_sync_retval
195+tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
196+ u32 tcp_seq, struct tx_sync_info *info)
188197 {
189198 struct tls_offload_context_tx *tx_ctx = priv_tx->tx_ctx;
199+ enum mlx5e_ktls_sync_retval ret = MLX5E_KTLS_SYNC_DONE;
190200 struct tls_record_info *record;
191201 int remaining, i = 0;
192202 unsigned long flags;
193− bool ret = true;
194203
195204 spin_lock_irqsave(&tx_ctx->lock, flags);
196205 record = tls_get_record(tx_ctx, tcp_seq, &info->rcd_sn);
197206
198207 if (unlikely(!record)) {
199− ret = false;
208+ ret = MLX5E_KTLS_SYNC_FAIL;
200209 goto out;
201210 }
202211
203212 if (unlikely(tcp_seq < tls_record_start_seq(record))) {
204− if (!tls_record_is_start_marker(record))
205− ret = false;
213+ ret = tls_record_is_start_marker(record) ?
214+ MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL;
206215 goto out;
207216 }
208217
@@ -211,13 +220,13 @@ static bool tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx, · 2 unmodified lines
211220 while (remaining > 0) {
212221 skb_frag_t *frag = &record->frags[i];
213222
214− __skb_frag_ref(frag);
223+ get_page(skb_frag_page(frag));
215224 remaining -= skb_frag_size(frag);
216− info->frags[i++] = frag;
225+ info->frags[i++] = *frag;
217226 }
218227 /* reduce the part which will be sent with the original SKB */
219228 if (remaining < 0)
220− skb_frag_size_add(info->frags[i - 1], remaining);
229+ skb_frag_size_add(&info->frags[i - 1], remaining);
221230 info->nr_frags = i;
222231 out:
223232 spin_unlock_irqrestore(&tx_ctx->lock, flags);
@@ -229,17 +238,12 @@ tx_post_resync_params(struct mlx5e_txqsq *sq, · 5 unmodified lines
229238 struct mlx5e_ktls_offload_context_tx *priv_tx,
230239 u64 rcd_sn)
231240 {
232− struct tls_crypto_info *crypto_info = priv_tx->crypto_info;
233− struct tls12_crypto_info_aes_gcm_128 *info;
241+ struct tls12_crypto_info_aes_gcm_128 *info = &priv_tx->crypto_info;
234242 __be64 rn_be = cpu_to_be64(rcd_sn);
235243 bool skip_static_post;
236244 u16 rec_seq_sz;
237245 char *rec_seq;
238246
239− if (WARN_ON(crypto_info->cipher_type != TLS_CIPHER_AES_GCM_128))
240− return;
241−
242− info = (struct tls12_crypto_info_aes_gcm_128 *)crypto_info;
243247 rec_seq = info->rec_seq;
244248 rec_seq_sz = sizeof(info->rec_seq);
245249
@@ -250,11 +254,6 @@ tx_post_resync_params(struct mlx5e_txqsq *sq, · 4 unmodified lines
250254 mlx5e_ktls_tx_post_param_wqes(sq, priv_tx, skip_static_post, true);
251255 }
252256
253−struct mlx5e_dump_wqe {
254− struct mlx5_wqe_ctrl_seg ctrl;
255− struct mlx5_wqe_data_seg data;
256−};
257−
258257 static int
259258 tx_post_resync_dump(struct mlx5e_txqsq *sq, skb_frag_t *frag, u32 tisn, bool first)
260259 {
@@ -262,7 +261,6 @@ tx_post_resync_dump(struct mlx5e_txqsq *sq, skb_frag_t *frag, u32 tisn, bool fir · 1 unmodified line
262261 struct mlx5_wqe_data_seg *dseg;
263262 struct mlx5e_dump_wqe *wqe;
264263 dma_addr_t dma_addr = 0;
265− u8 num_wqebbs;
266264 u16 ds_cnt;
267265 int fsz;
268266 u16 pi;
@@ -270,7 +268,6 @@ tx_post_resync_dump(struct mlx5e_txqsq *sq, skb_frag_t *frag, u32 tisn, bool fir · 1 unmodified line
270268 wqe = mlx5e_sq_fetch_wqe(sq, sizeof(*wqe), &pi);
271269
272270 ds_cnt = sizeof(*wqe) / MLX5_SEND_WQE_DS;
273− num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS);
274271
275272 cseg = &wqe->ctrl;
276273 dseg = &wqe->data;
@@ -291,24 +288,27 @@ tx_post_resync_dump(struct mlx5e_txqsq *sq, skb_frag_t *frag, u32 tisn, bool fir · 14 unmodified lines
291288 dseg->byte_count = cpu_to_be32(fsz);
292289 mlx5e_dma_push(sq, dma_addr, fsz, MLX5E_DMA_MAP_PAGE);
293290
294− tx_fill_wi(sq, pi, num_wqebbs, frag, fsz);
295− sq->pc += num_wqebbs;
296−
297− WARN(num_wqebbs > MLX5E_KTLS_MAX_DUMP_WQEBBS,
298− "unexpected DUMP num_wqebbs, %d > %d",
299− num_wqebbs, MLX5E_KTLS_MAX_DUMP_WQEBBS);
291+ tx_fill_wi(sq, pi, MLX5E_KTLS_DUMP_WQEBBS, fsz, skb_frag_page(frag));
292+ sq->pc += MLX5E_KTLS_DUMP_WQEBBS;
300293
301294 return 0;
302295 }
303296
304297 void mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
305298 struct mlx5e_tx_wqe_info *wi,
306− struct mlx5e_sq_dma *dma)
299+ u32 *dma_fifo_cc)
307300 {
308− struct mlx5e_sq_stats *stats = sq->stats;
301+ struct mlx5e_sq_stats *stats;
302+ struct mlx5e_sq_dma *dma;
303+
304+ if (!wi->resync_dump_frag_page)
305+ return;
306+
307+ dma = mlx5e_dma_get(sq, (*dma_fifo_cc)++);
308+ stats = sq->stats;
309309
310310 mlx5e_tx_dma_unmap(sq->pdev, dma);
311− __skb_frag_unref(wi->resync_dump_frag);
311+ put_page(wi->resync_dump_frag_page);
312312 stats->tls_dump_packets++;
313313 stats->tls_dump_bytes += wi->num_bytes;
314314 }
@@ -318,25 +318,31 @@ static void tx_post_fence_nop(struct mlx5e_txqsq *sq) · 3 unmodified lines
318318 struct mlx5_wq_cyc *wq = &sq->wq;
319319 u16 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
320320
321− tx_fill_wi(sq, pi, 1, NULL, 0);
321+ tx_fill_wi(sq, pi, 1, 0, NULL);
322322
323323 mlx5e_post_nop_fence(wq, sq->sqn, &sq->pc);
324324 }
325325
326−static struct sk_buff *
326+static enum mlx5e_ktls_sync_retval
327327 mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,
328328 struct mlx5e_txqsq *sq,
329− struct sk_buff *skb,
329+ int datalen,
330330 u32 seq)
331331 {
332332 struct mlx5e_sq_stats *stats = sq->stats;
333333 struct mlx5_wq_cyc *wq = &sq->wq;
334+ enum mlx5e_ktls_sync_retval ret;
334335 struct tx_sync_info info = {};
335336 u16 contig_wqebbs_room, pi;
336337 u8 num_wqebbs;
337− int i;
338−
339− if (!tx_sync_info_get(priv_tx, seq, &info)) {
338+ int i = 0;
339+
340+ ret = tx_sync_info_get(priv_tx, seq, &info);
341+ if (unlikely(ret != MLX5E_KTLS_SYNC_DONE)) {
342+ if (ret == MLX5E_KTLS_SYNC_SKIP_NO_DATA) {
343+ stats->tls_skip_no_sync_data++;
344+ return MLX5E_KTLS_SYNC_SKIP_NO_DATA;
345+ }
340346 /* We might get here if a retransmission reaches the driver
341347 * after the relevant record is acked.
342348 * It should be safe to drop the packet in this case
@@ -346,13 +352,8 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx, · 3 unmodified lines
346352 }
347353
348354 if (unlikely(info.sync_len < 0)) {
349− u32 payload;
350− int headln;
351−
352− headln = skb_transport_offset(skb) + tcp_hdrlen(skb);
353− payload = skb->len - headln;
354− if (likely(payload <= -info.sync_len))
355− return skb;
355+ if (likely(datalen <= -info.sync_len))
356+ return MLX5E_KTLS_SYNC_DONE;
356357
357358 stats->tls_drop_bypass_req++;
358359 goto err_out;
@@ -360,30 +361,62 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx, · 1 unmodified line
360361
361362 stats->tls_ooo++;
362363
363− num_wqebbs = MLX5E_KTLS_STATIC_WQEBBS + MLX5E_KTLS_PROGRESS_WQEBBS +
364− (info.nr_frags ? info.nr_frags * MLX5E_KTLS_MAX_DUMP_WQEBBS : 1);
364+ tx_post_resync_params(sq, priv_tx, info.rcd_sn);
365+
366+ /* If no dump WQE was sent, we need to have a fence NOP WQE before the
367+ * actual data xmit.
368+ */
369+ if (!info.nr_frags) {
370+ tx_post_fence_nop(sq);
371+ return MLX5E_KTLS_SYNC_DONE;
372+ }
373+
374+ num_wqebbs = mlx5e_ktls_dumps_num_wqebbs(sq, info.nr_frags, info.sync_len);
365375 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
366376 contig_wqebbs_room = mlx5_wq_cyc_get_contig_wqebbs(wq, pi);
377+
367378 if (unlikely(contig_wqebbs_room < num_wqebbs))
368379 mlx5e_fill_sq_frag_edge(sq, wq, pi, contig_wqebbs_room);
369380
370381 tx_post_resync_params(sq, priv_tx, info.rcd_sn);
371382
372− for (i = 0; i < info.nr_frags; i++)
373− if (tx_post_resync_dump(sq, info.frags[i], priv_tx->tisn, !i))
374− goto err_out;
383+ for (; i < info.nr_frags; i++) {
384+ unsigned int orig_fsz, frag_offset = 0, n = 0;
385+ skb_frag_t *f = &info.frags[i];
375386
376− /* If no dump WQE was sent, we need to have a fence NOP WQE before the
377− * actual data xmit.
378− */
379− if (!info.nr_frags)
380− tx_post_fence_nop(sq);
387+ orig_fsz = skb_frag_size(f);
381388
382− return skb;
389+ do {
390+ bool fence = !(i || frag_offset);
391+ unsigned int fsz;
392+
393+ n++;
394+ fsz = min_t(unsigned int, sq->hw_mtu, orig_fsz - frag_offset);
395+ skb_frag_size_set(f, fsz);
396+ if (tx_post_resync_dump(sq, f, priv_tx->tisn, fence)) {
397+ page_ref_add(skb_frag_page(f), n - 1);
398+ goto err_out;
399+ }
400+
401+ skb_frag_off_add(f, fsz);
402+ frag_offset += fsz;
403+ } while (frag_offset < orig_fsz);
404+
405+ page_ref_add(skb_frag_page(f), n - 1);
406+ }
407+
408+ return MLX5E_KTLS_SYNC_DONE;
383409
384410 err_out:
385− dev_kfree_skb_any(skb);
386− return NULL;
411+ for (; i < info.nr_frags; i++)
412+ /* The put_page() here undoes the page ref obtained in tx_sync_info_get().
413+ * Page refs obtained for the DUMP WQEs above (by page_ref_add) will be
414+ * released only upon their completions (or in mlx5e_free_txqsq_descs,
415+ * if channel closes).
416+ */
417+ put_page(skb_frag_page(&info.frags[i]));
418+
419+ return MLX5E_KTLS_SYNC_FAIL;
387420 }
388421
389422 struct sk_buff *mlx5e_ktls_handle_tx_skb(struct net_device *netdev,
@@ -419,10 +452,15 @@ struct sk_buff *mlx5e_ktls_handle_tx_skb(struct net_device *netdev, · 29 unmodified lines
419452
420453 seq = ntohl(tcp_hdr(skb)->seq);
421454 if (unlikely(priv_tx->expected_seq != seq)) {
422− skb = mlx5e_ktls_tx_handle_ooo(priv_tx, sq, skb, seq);
423− if (unlikely(!skb))
455+ enum mlx5e_ktls_sync_retval ret =
456+ mlx5e_ktls_tx_handle_ooo(priv_tx, sq, datalen, seq);
457+
458+ if (likely(ret == MLX5E_KTLS_SYNC_DONE))
459+ *wqe = mlx5e_sq_fetch_wqe(sq, sizeof(**wqe), pi);
460+ else if (ret == MLX5E_KTLS_SYNC_FAIL)
461+ goto err_out;
462+ else /* ret == MLX5E_KTLS_SYNC_SKIP_NO_DATA */
424463 goto out;
425− *wqe = mlx5e_sq_fetch_wqe(sq, sizeof(**wqe), pi);
426464 }
427465
428466 priv_tx->expected_seq = seq + datalen;
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c+1−1
@@ -1021,7 +1021,7 @@ static bool ext_link_mode_requested(const unsigned long *adver) · 1020 unmodified lines
10211021 {
10221022 #define MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT ETHTOOL_LINK_MODE_50000baseKR_Full_BIT
10231023 int size = __ETHTOOL_LINK_MODE_MASK_NBITS - MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT;
1024− __ETHTOOL_DECLARE_LINK_MODE_MASK(modes);
1024+ __ETHTOOL_DECLARE_LINK_MODE_MASK(modes) = {0,};
10251025
10261026 bitmap_set(modes, MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT, size);
10271027 return bitmap_intersects(modes, adver, __ETHTOOL_LINK_MODE_MASK_NBITS);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+11−2
@@ -1128,6 +1128,7 @@ static int mlx5e_alloc_txqsq(struct mlx5e_channel *c, · 1127 unmodified lines
11281128 sq->txq_ix = txq_ix;
11291129 sq->uar_map = mdev->mlx5e_res.bfreg.map;
11301130 sq->min_inline_mode = params->tx_min_inline_mode;
1131+ sq->hw_mtu = MLX5E_SW2HW_MTU(params, params->sw_mtu);
11311132 sq->stats = &c->priv->channel_stats[c->ix].sq[tc];
11321133 sq->stop_room = MLX5E_SQ_STOP_ROOM;
11331134 INIT_WORK(&sq->recover_work, mlx5e_tx_err_cqe_work);
@@ -1135,10 +1136,14 @@ static int mlx5e_alloc_txqsq(struct mlx5e_channel *c, · 1 unmodified line
11351136 set_bit(MLX5E_SQ_STATE_VLAN_NEED_L2_INLINE, &sq->state);
11361137 if (MLX5_IPSEC_DEV(c->priv->mdev))
11371138 set_bit(MLX5E_SQ_STATE_IPSEC, &sq->state);
1139+#ifdef CONFIG_MLX5_EN_TLS
11381140 if (mlx5_accel_is_tls_device(c->priv->mdev)) {
11391141 set_bit(MLX5E_SQ_STATE_TLS, &sq->state);
1140− sq->stop_room += MLX5E_SQ_TLS_ROOM;
1142+ sq->stop_room += MLX5E_SQ_TLS_ROOM +
1143+ mlx5e_ktls_dumps_num_wqebbs(sq, MAX_SKB_FRAGS,
1144+ TLS_MAX_PAYLOAD_SIZE);
11411145 }
1146+#endif
11421147
11431148 param->wq.db_numa_node = cpu_to_node(c->cpu);
11441149 err = mlx5_wq_cyc_create(mdev, &param->wq, sqc_wq, wq, &sq->wq_ctrl);
@@ -1349,9 +1354,13 @@ static void mlx5e_deactivate_txqsq(struct mlx5e_txqsq *sq) · 204 unmodified lines
13491354 /* last doorbell out, godspeed .. */
13501355 if (mlx5e_wqc_has_room_for(wq, sq->cc, sq->pc, 1)) {
13511356 u16 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
1357+ struct mlx5e_tx_wqe_info *wi;
13521358 struct mlx5e_tx_wqe *nop;
13531359
1354− sq->db.wqe_info[pi].skb = NULL;
1360+ wi = &sq->db.wqe_info[pi];
1361+
1362+ memset(wi, 0, sizeof(*wi));
1363+ wi->num_wqebbs = 1;
13551364 nop = mlx5e_post_nop(wq, sq->sqn, &sq->pc);
13561365 mlx5e_notify_hw(wq, sq->pc, sq->uar_map, &nop->ctrl);
13571366 }
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c+2−2
@@ -611,8 +611,8 @@ static void mlx5e_rep_update_flows(struct mlx5e_priv *priv, · 610 unmodified lines
611611
612612 mutex_lock(&esw->offloads.encap_tbl_lock);
613613 encap_connected = !!(e->flags & MLX5_ENCAP_ENTRY_VALID);
614− if (e->compl_result || (encap_connected == neigh_connected &&
615− ether_addr_equal(e->h_dest, ha)))
614+ if (e->compl_result < 0 || (encap_connected == neigh_connected &&
615+ ether_addr_equal(e->h_dest, ha)))
616616 goto unlock;
617617
618618 mlx5e_take_all_encap_flows(e, &flow_list);
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c+4−1
@@ -1386,8 +1386,11 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget) · 1385 unmodified lines
13861386 if (unlikely(!test_bit(MLX5E_RQ_STATE_ENABLED, &rq->state)))
13871387 return 0;
13881388
1389− if (rq->cqd.left)
1389+ if (rq->cqd.left) {
13901390 work_done += mlx5e_decompress_cqes_cont(rq, cqwq, 0, budget);
1391+ if (rq->cqd.left || work_done >= budget)
1392+ goto out;
1393+ }
13911394
13921395 cqe = mlx5_cqwq_get_cqe(cqwq);
13931396 if (!cqe) {
drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c+3−12
@@ -35,6 +35,7 @@ · 34 unmodified lines
3535 #include <linux/udp.h>
3636 #include <net/udp.h>
3737 #include "en.h"
38+#include "en/port.h"
3839
3940 enum {
4041 MLX5E_ST_LINK_STATE,
@@ -80,22 +81,12 @@ static int mlx5e_test_link_state(struct mlx5e_priv *priv) · 39 unmodified lines
8081
8182 static int mlx5e_test_link_speed(struct mlx5e_priv *priv)
8283 {
83− u32 out[MLX5_ST_SZ_DW(ptys_reg)];
84− u32 eth_proto_oper;
85− int i;
84+ u32 speed;
8685
8786 if (!netif_carrier_ok(priv->netdev))
8887 return 1;
8988
90− if (mlx5_query_port_ptys(priv->mdev, out, sizeof(out), MLX5_PTYS_EN, 1))
91− return 1;
92−
93− eth_proto_oper = MLX5_GET(ptys_reg, out, eth_proto_oper);
94− for (i = 0; i < MLX5E_LINK_MODES_NUMBER; i++) {
95− if (eth_proto_oper & MLX5E_PROT_MASK(i))
96− return 0;
97− }
98− return 1;
89+ return mlx5e_port_linkspeed(priv->mdev, &speed);
9990 }
10091
10192 struct mlx5ehdr {
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c+10−6
@@ -52,11 +52,12 @@ static const struct counter_desc sw_stats_desc[] = { · 51 unmodified lines
5252 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_encrypted_bytes) },
5353 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_ctx) },
5454 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_ooo) },
55+ { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_dump_packets) },
56+ { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_dump_bytes) },
5557 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_resync_bytes) },
58+ { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_skip_no_sync_data) },
5659 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_drop_no_sync_data) },
5760 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_drop_bypass_req) },
58− { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_dump_packets) },
59− { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_dump_bytes) },
6061 #endif
6162
6263 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_packets) },
@@ -288,11 +289,12 @@ static void mlx5e_grp_sw_update_stats(struct mlx5e_priv *priv) · 225 unmodified lines
288289 s->tx_tls_encrypted_bytes += sq_stats->tls_encrypted_bytes;
289290 s->tx_tls_ctx += sq_stats->tls_ctx;
290291 s->tx_tls_ooo += sq_stats->tls_ooo;
292+ s->tx_tls_dump_bytes += sq_stats->tls_dump_bytes;
293+ s->tx_tls_dump_packets += sq_stats->tls_dump_packets;
291294 s->tx_tls_resync_bytes += sq_stats->tls_resync_bytes;
295+ s->tx_tls_skip_no_sync_data += sq_stats->tls_skip_no_sync_data;
292296 s->tx_tls_drop_no_sync_data += sq_stats->tls_drop_no_sync_data;
293297 s->tx_tls_drop_bypass_req += sq_stats->tls_drop_bypass_req;
294− s->tx_tls_dump_bytes += sq_stats->tls_dump_bytes;
295− s->tx_tls_dump_packets += sq_stats->tls_dump_packets;
296298 #endif
297299 s->tx_cqes += sq_stats->cqes;
298300 }
@@ -1472,10 +1474,12 @@ static const struct counter_desc sq_stats_desc[] = { · 1173 unmodified lines
14721474 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_encrypted_bytes) },
14731475 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_ctx) },
14741476 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_ooo) },
1475− { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_drop_no_sync_data) },
1476− { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_drop_bypass_req) },
14771477 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_dump_packets) },
14781478 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_dump_bytes) },
1479+ { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_resync_bytes) },
1480+ { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_skip_no_sync_data) },
1481+ { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_drop_no_sync_data) },
1482+ { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_drop_bypass_req) },
14791483 #endif
14801484 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_none) },
14811485 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, stopped) },
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h+6−4
@@ -129,11 +129,12 @@ struct mlx5e_sw_stats { · 128 unmodified lines
129129 u64 tx_tls_encrypted_bytes;
130130 u64 tx_tls_ctx;
131131 u64 tx_tls_ooo;
132+ u64 tx_tls_dump_packets;
133+ u64 tx_tls_dump_bytes;
132134 u64 tx_tls_resync_bytes;
135+ u64 tx_tls_skip_no_sync_data;
133136 u64 tx_tls_drop_no_sync_data;
134137 u64 tx_tls_drop_bypass_req;
135− u64 tx_tls_dump_packets;
136− u64 tx_tls_dump_bytes;
137138 #endif
138139
139140 u64 rx_xsk_packets;
@@ -273,11 +274,12 @@ struct mlx5e_sq_stats { · 133 unmodified lines
273274 u64 tls_encrypted_bytes;
274275 u64 tls_ctx;
275276 u64 tls_ooo;
277+ u64 tls_dump_packets;
278+ u64 tls_dump_bytes;
276279 u64 tls_resync_bytes;
280+ u64 tls_skip_no_sync_data;
277281 u64 tls_drop_no_sync_data;
278282 u64 tls_drop_bypass_req;
279− u64 tls_dump_packets;
280− u64 tls_dump_bytes;
281283 #endif
282284 /* less likely accessed in data path */
283285 u64 csum_none;
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+28−8
@@ -1278,8 +1278,10 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv, · 1277 unmodified lines
12781278 mlx5_eswitch_del_vlan_action(esw, attr);
12791279
12801280 for (out_index = 0; out_index < MLX5_MAX_FLOW_FWD_VPORTS; out_index++)
1281− if (attr->dests[out_index].flags & MLX5_ESW_DEST_ENCAP)
1281+ if (attr->dests[out_index].flags & MLX5_ESW_DEST_ENCAP) {
12821282 mlx5e_detach_encap(priv, flow, out_index);
1283+ kfree(attr->parse_attr->tun_info[out_index]);
1284+ }
12831285 kvfree(attr->parse_attr);
12841286
12851287 if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
@@ -1559,6 +1561,7 @@ static void mlx5e_encap_dealloc(struct mlx5e_priv *priv, struct mlx5e_encap_entr · 273 unmodified lines
15591561 mlx5_packet_reformat_dealloc(priv->mdev, e->pkt_reformat);
15601562 }
15611563
1564+ kfree(e->tun_info);
15621565 kfree(e->encap_header);
15631566 kfree_rcu(e, rcu);
15641567 }
@@ -2972,6 +2975,13 @@ mlx5e_encap_get(struct mlx5e_priv *priv, struct encap_key *key, · 1407 unmodified lines
29722975 return NULL;
29732976 }
29742977
2978+static struct ip_tunnel_info *dup_tun_info(const struct ip_tunnel_info *tun_info)
2979+{
2980+ size_t tun_size = sizeof(*tun_info) + tun_info->options_len;
2981+
2982+ return kmemdup(tun_info, tun_size, GFP_KERNEL);
2983+}
2984+
29752985 static int mlx5e_attach_encap(struct mlx5e_priv *priv,
29762986 struct mlx5e_tc_flow *flow,
29772987 struct net_device *mirred_dev,
@@ -3028,13 +3038,15 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv, · 50 unmodified lines
30283038 refcount_set(&e->refcnt, 1);
30293039 init_completion(&e->res_ready);
30303040
3041+ tun_info = dup_tun_info(tun_info);
3042+ if (!tun_info) {
3043+ err = -ENOMEM;
3044+ goto out_err_init;
3045+ }
30313046 e->tun_info = tun_info;
30323047 err = mlx5e_tc_tun_init_encap_attr(mirred_dev, priv, e, extack);
3033− if (err) {
3034− kfree(e);
3035− e = NULL;
3036− goto out_err;
3037− }
3048+ if (err)
3049+ goto out_err_init;
30383050
30393051 INIT_LIST_HEAD(&e->flows);
30403052 hash_add_rcu(esw->offloads.encap_tbl, &e->encap_hlist, hash_key);
@@ -3075,6 +3087,12 @@ out_err: · 34 unmodified lines
30753087 if (e)
30763088 mlx5e_encap_put(priv, e);
30773089 return err;
3090+
3091+out_err_init:
3092+ mutex_unlock(&esw->offloads.encap_tbl_lock);
3093+ kfree(tun_info);
3094+ kfree(e);
3095+ return err;
30783096 }
30793097
30803098 static int parse_tc_vlan_action(struct mlx5e_priv *priv,
@@ -3160,7 +3178,7 @@ static int add_vlan_pop_action(struct mlx5e_priv *priv, · 79 unmodified lines
31603178 struct mlx5_esw_flow_attr *attr,
31613179 u32 *action)
31623180 {
3163− int nest_level = vlan_get_encap_level(attr->parse_attr->filter_dev);
3181+ int nest_level = attr->parse_attr->filter_dev->lower_level;
31643182 struct flow_action_entry vlan_act = {
31653183 .id = FLOW_ACTION_VLAN_POP,
31663184 };
@@ -3295,7 +3313,9 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, · 128 unmodified lines
32953313 } else if (encap) {
32963314 parse_attr->mirred_ifindex[attr->out_count] =
32973315 out_dev->ifindex;
3298− parse_attr->tun_info[attr->out_count] = info;
3316+ parse_attr->tun_info[attr->out_count] = dup_tun_info(info);
3317+ if (!parse_attr->tun_info[attr->out_count])
3318+ return -ENOMEM;
32993319 encap = false;
33003320 attr->dests[attr->out_count].flags |=
33013321 MLX5_ESW_DEST_ENCAP;
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c+20−15
@@ -403,7 +403,10 @@ netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev) · 402 unmodified lines
403403 static void mlx5e_dump_error_cqe(struct mlx5e_txqsq *sq,
404404 struct mlx5_err_cqe *err_cqe)
405405 {
406− u32 ci = mlx5_cqwq_get_ci(&sq->cq.wq);
406+ struct mlx5_cqwq *wq = &sq->cq.wq;
407+ u32 ci;
408+
409+ ci = mlx5_cqwq_ctr2ix(wq, wq->cc - 1);
407410
408411 netdev_err(sq->channel->netdev,
409412 "Error cqe on cqn 0x%x, ci 0x%x, sqn 0x%x, opcode 0x%x, syndrome 0x%x, vendor syndrome 0x%x\n",
@@ -479,14 +482,7 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget) · 69 unmodified lines
479482 skb = wi->skb;
480483
481484 if (unlikely(!skb)) {
482−#ifdef CONFIG_MLX5_EN_TLS
483− if (wi->resync_dump_frag) {
484− struct mlx5e_sq_dma *dma =
485− mlx5e_dma_get(sq, dma_fifo_cc++);
486−
487− mlx5e_ktls_tx_handle_resync_dump_comp(sq, wi, dma);
488− }
489−#endif
485+ mlx5e_ktls_tx_handle_resync_dump_comp(sq, wi, &dma_fifo_cc);
490486 sqcc += wi->num_wqebbs;
491487 continue;
492488 }
@@ -542,29 +538,38 @@ void mlx5e_free_txqsq_descs(struct mlx5e_txqsq *sq) · 49 unmodified lines
542538 {
543539 struct mlx5e_tx_wqe_info *wi;
544540 struct sk_buff *skb;
541+ u32 dma_fifo_cc;
542+ u16 sqcc;
545543 u16 ci;
546544 int i;
547545
548− while (sq->cc != sq->pc) {
549− ci = mlx5_wq_cyc_ctr2ix(&sq->wq, sq->cc);
546+ sqcc = sq->cc;
547+ dma_fifo_cc = sq->dma_fifo_cc;
548+
549+ while (sqcc != sq->pc) {
550+ ci = mlx5_wq_cyc_ctr2ix(&sq->wq, sqcc);
550551 wi = &sq->db.wqe_info[ci];
551552 skb = wi->skb;
552553
553− if (!skb) { /* nop */
554− sq->cc++;
554+ if (!skb) {
555+ mlx5e_ktls_tx_handle_resync_dump_comp(sq, wi, &dma_fifo_cc);
556+ sqcc += wi->num_wqebbs;
555557 continue;
556558 }
557559
558560 for (i = 0; i < wi->num_dma; i++) {
559561 struct mlx5e_sq_dma *dma =
560− mlx5e_dma_get(sq, sq->dma_fifo_cc++);
562+ mlx5e_dma_get(sq, dma_fifo_cc++);
561563
562564 mlx5e_tx_dma_unmap(sq->pdev, dma);
563565 }
564566
565567 dev_kfree_skb_any(skb);
566− sq->cc += wi->num_wqebbs;
568+ sqcc += wi->num_wqebbs;
567569 }
570+
571+ sq->dma_fifo_cc = dma_fifo_cc;
572+ sq->cc = sqcc;
568573 }
569574
570575 #ifdef CONFIG_MLX5_CORE_IPOIB
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c+1−2
@@ -285,7 +285,6 @@ mlx5_eswitch_add_fwd_rule(struct mlx5_eswitch *esw, · 284 unmodified lines
285285
286286 mlx5_eswitch_set_rule_source_port(esw, spec, attr);
287287
288− spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS;
289288 if (attr->outer_match_level != MLX5_MATCH_NONE)
290289 spec->match_criteria_enable |= MLX5_MATCH_OUTER_HEADERS;
291290
@@ -1080,7 +1079,7 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw, int nvports) · 788 unmodified lines
10801079 MLX5_CAP_GEN(dev, max_flow_counter_15_0);
10811080 fdb_max = 1 << MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size);
10821081
1083− esw_debug(dev, "Create offloads FDB table, min (max esw size(2^%d), max counters(%d), groups(%d), max flow table size(2^%d))\n",
1082+ esw_debug(dev, "Create offloads FDB table, min (max esw size(2^%d), max counters(%d), groups(%d), max flow table size(%d))\n",
10841083 MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size),
10851084 max_flow_counter, ESW_OFFLOADS_NUM_GROUPS,
10861085 fdb_max);
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c+17−6
@@ -177,22 +177,33 @@ mlx5_eswitch_termtbl_actions_move(struct mlx5_flow_act *src, · 176 unmodified lines
177177 memset(&src->vlan[1], 0, sizeof(src->vlan[1]));
178178 }
179179
180+static bool mlx5_eswitch_offload_is_uplink_port(const struct mlx5_eswitch *esw,
181+ const struct mlx5_flow_spec *spec)
182+{
183+ u32 port_mask, port_value;
184+
185+ if (MLX5_CAP_ESW_FLOWTABLE(esw->dev, flow_source))
186+ return spec->flow_context.flow_source ==
187+ MLX5_FLOW_CONTEXT_FLOW_SOURCE_UPLINK;
188+
189+ port_mask = MLX5_GET(fte_match_param, spec->match_criteria,
190+ misc_parameters.source_port);
191+ port_value = MLX5_GET(fte_match_param, spec->match_value,
192+ misc_parameters.source_port);
193+ return (port_mask & port_value & 0xffff) == MLX5_VPORT_UPLINK;
194+}
195+
180196 bool
181197 mlx5_eswitch_termtbl_required(struct mlx5_eswitch *esw,
182198 struct mlx5_flow_act *flow_act,
183199 struct mlx5_flow_spec *spec)
184200 {
185− u32 port_mask = MLX5_GET(fte_match_param, spec->match_criteria,
186− misc_parameters.source_port);
187− u32 port_value = MLX5_GET(fte_match_param, spec->match_value,
188− misc_parameters.source_port);
189−
190201 if (!MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, termination_table))
191202 return false;
192203
193204 /* push vlan on RX */
194205 return (flow_act->action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH) &&
195− ((port_mask & port_value) == MLX5_VPORT_UPLINK);
206+ mlx5_eswitch_offload_is_uplink_port(esw, spec);
196207 }
197208
198209 struct mlx5_flow_handle *
drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c+3−1
@@ -464,8 +464,10 @@ static int mlx5_fpga_conn_create_cq(struct mlx5_fpga_conn *conn, int cq_size) · 463 unmodified lines
464464 }
465465
466466 err = mlx5_vector2eqn(mdev, smp_processor_id(), &eqn, &irqn);
467− if (err)
467+ if (err) {
468+ kvfree(in);
468469 goto err_cqwq;
470+ }
469471
470472 cqc = MLX5_ADDR_OF(create_cq_in, in, cq_context);
471473 MLX5_SET(cqc, cqc, log_cq_size, ilog2(cq_size));
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c+2−1
@@ -507,7 +507,8 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev, · 506 unmodified lines
507507 MLX5_SET(dest_format_struct, in_dests,
508508 destination_eswitch_owner_vhca_id,
509509 dst->dest_attr.vport.vhca_id);
510− if (extended_dest) {
510+ if (extended_dest &&
511+ dst->dest_attr.vport.pkt_reformat) {
511512 MLX5_SET(dest_format_struct, in_dests,
512513 packet_reformat,
513514 !!(dst->dest_attr.vport.flags &
drivers/net/ethernet/mellanox/mlx5/core/health.c+1−1
@@ -572,7 +572,7 @@ mlx5_fw_fatal_reporter_dump(struct devlink_health_reporter *reporter, · 571 unmodified lines
572572 return -ENOMEM;
573573 err = mlx5_crdump_collect(dev, cr_data);
574574 if (err)
575− return err;
575+ goto free_data;
576576
577577 if (priv_ctx) {
578578 struct mlx5_fw_reporter_ctx *fw_reporter_ctx = priv_ctx;
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c+1−0
@@ -1577,6 +1577,7 @@ int mlx5dr_action_destroy(struct mlx5dr_action *action) · 1576 unmodified lines
15771577 break;
15781578 case DR_ACTION_TYP_MODIFY_HDR:
15791579 mlx5dr_icm_free_chunk(action->rewrite.chunk);
1580+ kfree(action->rewrite.data);
15801581 refcount_dec(&action->rewrite.dmn->refcount);
15811582 break;
15821583 default:
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c+2−0
@@ -1096,6 +1096,8 @@ dr_rule_create_rule_nic(struct mlx5dr_rule *rule, · 1095 unmodified lines
10961096 if (htbl)
10971097 mlx5dr_htbl_put(htbl);
10981098
1099+ kfree(hw_ste_arr);
1100+
10991101 return 0;
11001102
11011103 free_ste:
drivers/net/ethernet/mellanox/mlxsw/core.c+2−2
@@ -1186,7 +1186,7 @@ __mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info, · 1185 unmodified lines
11861186 if (err)
11871187 goto err_thermal_init;
11881188
1189− if (mlxsw_driver->params_register && !reload)
1189+ if (mlxsw_driver->params_register)
11901190 devlink_params_publish(devlink);
11911191
11921192 return 0;
@@ -1259,7 +1259,7 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core, · 66 unmodified lines
12591259 return;
12601260 }
12611261
1262− if (mlxsw_core->driver->params_unregister && !reload)
1262+ if (mlxsw_core->driver->params_unregister)
12631263 devlink_params_unpublish(devlink);
12641264 mlxsw_thermal_fini(mlxsw_core->thermal);
12651265 mlxsw_hwmon_fini(mlxsw_core->hwmon);
drivers/net/ethernet/mscc/ocelot.c+14−6
@@ -261,8 +261,15 @@ static int ocelot_vlan_vid_add(struct net_device *dev, u16 vid, bool pvid, · 260 unmodified lines
261261 port->pvid = vid;
262262
263263 /* Untagged egress vlan clasification */
264− if (untagged)
264+ if (untagged && port->vid != vid) {
265+ if (port->vid) {
266+ dev_err(ocelot->dev,
267+ "Port already has a native VLAN: %d\n",
268+ port->vid);
269+ return -EBUSY;
270+ }
265271 port->vid = vid;
272+ }
266273
267274 ocelot_vlan_port_apply(ocelot, port);
268275
@@ -934,7 +941,7 @@ end: · 665 unmodified lines
934941 static int ocelot_vlan_rx_add_vid(struct net_device *dev, __be16 proto,
935942 u16 vid)
936943 {
937− return ocelot_vlan_vid_add(dev, vid, false, true);
944+ return ocelot_vlan_vid_add(dev, vid, false, false);
938945 }
939946
940947 static int ocelot_vlan_rx_kill_vid(struct net_device *dev, __be16 proto,
@@ -1673,9 +1680,6 @@ static int ocelot_netdevice_port_event(struct net_device *dev, · 732 unmodified lines
16731680 struct ocelot_port *ocelot_port = netdev_priv(dev);
16741681 int err = 0;
16751682
1676− if (!ocelot_netdevice_dev_check(dev))
1677− return 0;
1678−
16791683 switch (event) {
16801684 case NETDEV_CHANGEUPPER:
16811685 if (netif_is_bridge_master(info->upper_dev)) {
@@ -1712,12 +1716,16 @@ static int ocelot_netdevice_event(struct notifier_block *unused, · 30 unmodified lines
17121716 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
17131717 int ret = 0;
17141718
1719+ if (!ocelot_netdevice_dev_check(dev))
1720+ return 0;
1721+
17151722 if (event == NETDEV_PRECHANGEUPPER &&
17161723 netif_is_lag_master(info->upper_dev)) {
17171724 struct netdev_lag_upper_info *lag_upper_info = info->upper_info;
17181725 struct netlink_ext_ack *extack;
17191726
1720− if (lag_upper_info->tx_type != NETDEV_LAG_TX_TYPE_HASH) {
1727+ if (lag_upper_info &&
1728+ lag_upper_info->tx_type != NETDEV_LAG_TX_TYPE_HASH) {
17211729 extack = netdev_notifier_info_to_extack(&info->info);
17221730 NL_SET_ERR_MSG_MOD(extack, "LAG device using unsupported Tx type");
17231731
drivers/net/ethernet/mscc/ocelot.h+1−1
@@ -523,7 +523,7 @@ void __ocelot_write_ix(struct ocelot *ocelot, u32 val, u32 reg, u32 offset); · 522 unmodified lines
523523 #define ocelot_write_rix(ocelot, val, reg, ri) __ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri))
524524 #define ocelot_write(ocelot, val, reg) __ocelot_write_ix(ocelot, val, reg, 0)
525525
526−void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 reg, u32 mask,
526+void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, u32 reg,
527527 u32 offset);
528528 #define ocelot_rmw_ix(ocelot, val, m, reg, gi, ri) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
529529 #define ocelot_rmw_gix(ocelot, val, m, reg, gi) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi))
drivers/net/ethernet/netronome/nfp/nfp_net_repr.c+0−18
@@ -299,22 +299,6 @@ static void nfp_repr_clean(struct nfp_repr *repr) · 298 unmodified lines
299299 nfp_port_free(repr->port);
300300 }
301301
302−static struct lock_class_key nfp_repr_netdev_xmit_lock_key;
303−static struct lock_class_key nfp_repr_netdev_addr_lock_key;
304−
305−static void nfp_repr_set_lockdep_class_one(struct net_device *dev,
306− struct netdev_queue *txq,
307− void *_unused)
308−{
309− lockdep_set_class(&txq->_xmit_lock, &nfp_repr_netdev_xmit_lock_key);
310−}
311−
312−static void nfp_repr_set_lockdep_class(struct net_device *dev)
313−{
314− lockdep_set_class(&dev->addr_list_lock, &nfp_repr_netdev_addr_lock_key);
315− netdev_for_each_tx_queue(dev, nfp_repr_set_lockdep_class_one, NULL);
316−}
317−
318302 int nfp_repr_init(struct nfp_app *app, struct net_device *netdev,
319303 u32 cmsg_port_id, struct nfp_port *port,
320304 struct net_device *pf_netdev)
@@ -324,8 +308,6 @@ int nfp_repr_init(struct nfp_app *app, struct net_device *netdev, · 3 unmodified lines
324308 u32 repr_cap = nn->tlv_caps.repr_cap;
325309 int err;
326310
327− nfp_repr_set_lockdep_class(netdev);
328−
329311 repr->port = port;
330312 repr->dst = metadata_dst_alloc(0, METADATA_HW_PORT_MUX, GFP_KERNEL);
331313 if (!repr->dst)
drivers/net/ethernet/pensando/ionic/ionic_lif.c+2−0
@@ -1,6 +1,8 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
33
4+#include <linux/printk.h>
5+#include <linux/dynamic_debug.h>
46 #include <linux/netdevice.h>
57 #include <linux/etherdevice.h>
68 #include <linux/rtnetlink.h>
drivers/net/ethernet/pensando/ionic/ionic_main.c+2−0
@@ -1,6 +1,8 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
33
4+#include <linux/printk.h>
5+#include <linux/dynamic_debug.h>
46 #include <linux/module.h>
57 #include <linux/netdevice.h>
68 #include <linux/utsname.h>
drivers/net/ethernet/qlogic/qed/qed_main.c+21−6
@@ -67,10 +67,9 @@ · 66 unmodified lines
6767 #define QED_ROCE_QPS (8192)
6868 #define QED_ROCE_DPIS (8)
6969 #define QED_RDMA_SRQS QED_ROCE_QPS
70−#define QED_NVM_CFG_SET_FLAGS 0xE
71−#define QED_NVM_CFG_SET_PF_FLAGS 0x1E
7270 #define QED_NVM_CFG_GET_FLAGS 0xA
7371 #define QED_NVM_CFG_GET_PF_FLAGS 0x1A
72+#define QED_NVM_CFG_MAX_ATTRS 50
7473
7574 static char version[] =
7675 "QLogic FastLinQ 4xxxx Core Module qed " DRV_MODULE_VERSION "\n";
@@ -2255,6 +2254,7 @@ static int qed_nvm_flash_cfg_write(struct qed_dev *cdev, const u8 **data) · 2178 unmodified lines
22552254 {
22562255 struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev);
22572256 u8 entity_id, len, buf[32];
2257+ bool need_nvm_init = true;
22582258 struct qed_ptt *ptt;
22592259 u16 cfg_id, count;
22602260 int rc = 0, i;
@@ -2271,8 +2271,10 @@ static int qed_nvm_flash_cfg_write(struct qed_dev *cdev, const u8 **data) · 10 unmodified lines
22712271
22722272 DP_VERBOSE(cdev, NETIF_MSG_DRV,
22732273 "Read config ids: num_attrs = %0d\n", count);
2274− /* NVM CFG ID attributes */
2275− for (i = 0; i < count; i++) {
2274+ /* NVM CFG ID attributes. Start loop index from 1 to avoid additional
2275+ * arithmetic operations in the implementation.
2276+ */
2277+ for (i = 1; i <= count; i++) {
22762278 cfg_id = *((u16 *)*data);
22772279 *data += 2;
22782280 entity_id = **data;
@@ -2282,8 +2284,21 @@ static int qed_nvm_flash_cfg_write(struct qed_dev *cdev, const u8 **data) · 3 unmodified lines
22822284 memcpy(buf, *data, len);
22832285 *data += len;
22842286
2285− flags = entity_id ? QED_NVM_CFG_SET_PF_FLAGS :
2286− QED_NVM_CFG_SET_FLAGS;
2287+ flags = 0;
2288+ if (need_nvm_init) {
2289+ flags |= QED_NVM_CFG_OPTION_INIT;
2290+ need_nvm_init = false;
2291+ }
2292+
2293+ /* Commit to flash and free the resources */
2294+ if (!(i % QED_NVM_CFG_MAX_ATTRS) || i == count) {
2295+ flags |= QED_NVM_CFG_OPTION_COMMIT |
2296+ QED_NVM_CFG_OPTION_FREE;
2297+ need_nvm_init = true;
2298+ }
2299+
2300+ if (entity_id)
2301+ flags |= QED_NVM_CFG_OPTION_ENTITY_SEL;
22872302
22882303 DP_VERBOSE(cdev, NETIF_MSG_DRV,
22892304 "cfg_id = %d entity = %d len = %d\n", cfg_id,
drivers/net/ethernet/qlogic/qed/qed_sriov.c+1−1
@@ -2005,7 +2005,7 @@ static void qed_iov_vf_mbx_stop_vport(struct qed_hwfn *p_hwfn, · 2004 unmodified lines
20052005 (qed_iov_validate_active_txq(p_hwfn, vf))) {
20062006 vf->b_malicious = true;
20072007 DP_NOTICE(p_hwfn,
2008− "VF [%02x] - considered malicious; Unable to stop RX/TX queuess\n",
2008+ "VF [%02x] - considered malicious; Unable to stop RX/TX queues\n",
20092009 vf->abs_vf_id);
20102010 status = PFVF_STATUS_MALICIOUS;
20112011 goto out;
drivers/net/ethernet/qlogic/qede/qede_main.c+10−2
@@ -1208,8 +1208,16 @@ enum qede_remove_mode { · 1207 unmodified lines
12081208 static void __qede_remove(struct pci_dev *pdev, enum qede_remove_mode mode)
12091209 {
12101210 struct net_device *ndev = pci_get_drvdata(pdev);
1211− struct qede_dev *edev = netdev_priv(ndev);
1212− struct qed_dev *cdev = edev->cdev;
1211+ struct qede_dev *edev;
1212+ struct qed_dev *cdev;
1213+
1214+ if (!ndev) {
1215+ dev_info(&pdev->dev, "Device has already been removed\n");
1216+ return;
1217+ }
1218+
1219+ edev = netdev_priv(ndev);
1220+ cdev = edev->cdev;
12131221
12141222 DP_INFO(edev, "Starting qede_remove\n");
12151223
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c+2−2
@@ -57,10 +57,10 @@ static int rmnet_unregister_real_device(struct net_device *real_dev, · 56 unmodified lines
5757 if (port->nr_rmnet_devs)
5858 return -EINVAL;
5959
60− kfree(port);
61−
6260 netdev_rx_handler_unregister(real_dev);
6361
62+ kfree(port);
63+
6464 /* release reference on real_dev */
6565 dev_put(real_dev);
6666
drivers/net/ethernet/realtek/r8169_main.c+7−0
@@ -916,6 +916,9 @@ static void r8168g_mdio_write(struct rtl8169_private *tp, int reg, int value) · 915 unmodified lines
916916
917917 static int r8168g_mdio_read(struct rtl8169_private *tp, int reg)
918918 {
919+ if (reg == 0x1f)
920+ return tp->ocp_base == OCP_STD_PHY_BASE ? 0 : tp->ocp_base >> 4;
921+
919922 if (tp->ocp_base != OCP_STD_PHY_BASE)
920923 reg -= 0x10;
921924
@@ -1029,6 +1032,10 @@ static int r8168dp_2_mdio_read(struct rtl8169_private *tp, int reg) · 107 unmodified lines
10291032 {
10301033 int value;
10311034
1035+ /* Work around issue with chip reporting wrong PHY ID */
1036+ if (reg == MII_PHYSID2)
1037+ return 0xc912;
1038+
10321039 r8168dp_2_mdio_start(tp);
10331040
10341041 value = r8169_mdio_read(tp, reg);
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c+1−1
@@ -432,7 +432,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw, · 431 unmodified lines
432432 * bits used depends on the hardware configuration
433433 * selected at core configuration time.
434434 */
435− int bit_nr = bitrev32(~crc32_le(~0, ha->addr,
435+ u32 bit_nr = bitrev32(~crc32_le(~0, ha->addr,
436436 ETH_ALEN)) >> (32 - mcbitslog2);
437437 /* The most significant bit determines the register to
438438 * use (H/L) while the other 5 bits determine the bit
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c+2−1
@@ -224,6 +224,7 @@ static void dwxgmac2_config_cbs(struct mac_device_info *hw, · 223 unmodified lines
224224 writel(low_credit, ioaddr + XGMAC_MTL_TCx_LOCREDIT(queue));
225225
226226 value = readl(ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(queue));
227+ value &= ~XGMAC_TSA;
227228 value |= XGMAC_CC | XGMAC_CBS;
228229 writel(value, ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(queue));
229230 }
@@ -463,7 +464,7 @@ static void dwxgmac2_set_filter(struct mac_device_info *hw, · 233 unmodified lines
463464 value |= XGMAC_FILTER_HMC;
464465
465466 netdev_for_each_mc_addr(ha, dev) {
466− int nr = (bitrev32(~crc32_le(~0, ha->addr, 6)) >>
467+ u32 nr = (bitrev32(~crc32_le(~0, ha->addr, 6)) >>
467468 (32 - mcbitslog2));
468469 mc_filter[nr >> 5] |= (1 << (nr & 0x1F));
469470 }
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c+2−1
@@ -288,7 +288,8 @@ static int dwxgmac2_get_rx_hash(struct dma_desc *p, u32 *hash, · 287 unmodified lines
288288
289289 static int dwxgmac2_get_rx_header_len(struct dma_desc *p, unsigned int *len)
290290 {
291− *len = le32_to_cpu(p->des2) & XGMAC_RDES2_HL;
291+ if (le32_to_cpu(p->des3) & XGMAC_RDES3_L34T)
292+ *len = le32_to_cpu(p->des2) & XGMAC_RDES2_HL;
292293 return 0;
293294 }
294295
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c+3−1
@@ -369,7 +369,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, · 368 unmodified lines
369369 dma_cap->eee = (hw_cap & XGMAC_HWFEAT_EEESEL) >> 13;
370370 dma_cap->atime_stamp = (hw_cap & XGMAC_HWFEAT_TSSEL) >> 12;
371371 dma_cap->av = (hw_cap & XGMAC_HWFEAT_AVSEL) >> 11;
372− dma_cap->av &= !(hw_cap & XGMAC_HWFEAT_RAVSEL) >> 10;
372+ dma_cap->av &= !((hw_cap & XGMAC_HWFEAT_RAVSEL) >> 10);
373373 dma_cap->arpoffsel = (hw_cap & XGMAC_HWFEAT_ARPOFFSEL) >> 9;
374374 dma_cap->rmon = (hw_cap & XGMAC_HWFEAT_MMCSEL) >> 8;
375375 dma_cap->pmt_magic_frame = (hw_cap & XGMAC_HWFEAT_MGKSEL) >> 7;
@@ -470,6 +470,7 @@ static void dwxgmac2_enable_tso(void __iomem *ioaddr, bool en, u32 chan) · 94 unmodified lines
470470 static void dwxgmac2_qmode(void __iomem *ioaddr, u32 channel, u8 qmode)
471471 {
472472 u32 value = readl(ioaddr + XGMAC_MTL_TXQ_OPMODE(channel));
473+ u32 flow = readl(ioaddr + XGMAC_RX_FLOW_CTRL);
473474
474475 value &= ~XGMAC_TXQEN;
475476 if (qmode != MTL_QUEUE_AVB) {
@@ -477,6 +478,7 @@ static void dwxgmac2_qmode(void __iomem *ioaddr, u32 channel, u8 qmode) · 1 unmodified line
477478 writel(0, ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(channel));
478479 } else {
479480 value |= 0x1 << XGMAC_TXQEN_SHIFT;
481+ writel(flow & (~XGMAC_RFE), ioaddr + XGMAC_RX_FLOW_CTRL);
480482 }
481483
482484 writel(value, ioaddr + XGMAC_MTL_TXQ_OPMODE(channel));
drivers/net/ethernet/stmicro/stmmac/mmc_core.c+4−2
@@ -176,6 +176,7 @@ · 175 unmodified lines
176176 #define MMC_XGMAC_RX_PKT_SMD_ERR 0x22c
177177 #define MMC_XGMAC_RX_PKT_ASSEMBLY_OK 0x230
178178 #define MMC_XGMAC_RX_FPE_FRAG 0x234
179+#define MMC_XGMAC_RX_IPC_INTR_MASK 0x25c
179180
180181 static void dwmac_mmc_ctrl(void __iomem *mmcaddr, unsigned int mode)
181182 {
@@ -333,8 +334,9 @@ static void dwxgmac_mmc_ctrl(void __iomem *mmcaddr, unsigned int mode) · 151 unmodified lines
333334
334335 static void dwxgmac_mmc_intr_all_mask(void __iomem *mmcaddr)
335336 {
336− writel(MMC_DEFAULT_MASK, mmcaddr + MMC_RX_INTR_MASK);
337− writel(MMC_DEFAULT_MASK, mmcaddr + MMC_TX_INTR_MASK);
337+ writel(0x0, mmcaddr + MMC_RX_INTR_MASK);
338+ writel(0x0, mmcaddr + MMC_TX_INTR_MASK);
339+ writel(MMC_DEFAULT_MASK, mmcaddr + MMC_XGMAC_RX_IPC_INTR_MASK);
338340 }
339341
340342 static void dwxgmac_read_mmc_reg(void __iomem *addr, u32 reg, u32 *dest)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+39−32
@@ -2995,6 +2995,8 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) · 2994 unmodified lines
29952995 } else {
29962996 stmmac_set_desc_addr(priv, first, des);
29972997 tmp_pay_len = pay_len;
2998+ des += proto_hdr_len;
2999+ pay_len = 0;
29983000 }
29993001
30003002 stmmac_tso_allocator(priv, des, tmp_pay_len, (nfrags == 0), queue);
@@ -3022,6 +3024,19 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) · 21 unmodified lines
30223024 /* Only the last descriptor gets to point to the skb. */
30233025 tx_q->tx_skbuff[tx_q->cur_tx] = skb;
30243026
3027+ /* Manage tx mitigation */
3028+ tx_q->tx_count_frames += nfrags + 1;
3029+ if (likely(priv->tx_coal_frames > tx_q->tx_count_frames) &&
3030+ !((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
3031+ priv->hwts_tx_en)) {
3032+ stmmac_tx_timer_arm(priv, queue);
3033+ } else {
3034+ desc = &tx_q->dma_tx[tx_q->cur_tx];
3035+ tx_q->tx_count_frames = 0;
3036+ stmmac_set_tx_ic(priv, desc);
3037+ priv->xstats.tx_set_ic_bit++;
3038+ }
3039+
30253040 /* We've used all descriptors we need for this skb, however,
30263041 * advance cur_tx so that it references a fresh descriptor.
30273042 * ndo_start_xmit will fill this descriptor the next time it's
@@ -3039,19 +3054,6 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) · 11 unmodified lines
30393054 priv->xstats.tx_tso_frames++;
30403055 priv->xstats.tx_tso_nfrags += nfrags;
30413056
3042− /* Manage tx mitigation */
3043− tx_q->tx_count_frames += nfrags + 1;
3044− if (likely(priv->tx_coal_frames > tx_q->tx_count_frames) &&
3045− !(priv->synopsys_id >= DWMAC_CORE_4_00 &&
3046− (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
3047− priv->hwts_tx_en)) {
3048− stmmac_tx_timer_arm(priv, queue);
3049− } else {
3050− tx_q->tx_count_frames = 0;
3051− stmmac_set_tx_ic(priv, desc);
3052− priv->xstats.tx_set_ic_bit++;
3053− }
3054−
30553057 if (priv->sarc_type)
30563058 stmmac_set_desc_sarc(priv, first, priv->sarc_type);
30573059
@@ -3223,6 +3225,27 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 165 unmodified lines
32233225 /* Only the last descriptor gets to point to the skb. */
32243226 tx_q->tx_skbuff[entry] = skb;
32253227
3228+ /* According to the coalesce parameter the IC bit for the latest
3229+ * segment is reset and the timer re-started to clean the tx status.
3230+ * This approach takes care about the fragments: desc is the first
3231+ * element in case of no SG.
3232+ */
3233+ tx_q->tx_count_frames += nfrags + 1;
3234+ if (likely(priv->tx_coal_frames > tx_q->tx_count_frames) &&
3235+ !((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
3236+ priv->hwts_tx_en)) {
3237+ stmmac_tx_timer_arm(priv, queue);
3238+ } else {
3239+ if (likely(priv->extend_desc))
3240+ desc = &tx_q->dma_etx[entry].basic;
3241+ else
3242+ desc = &tx_q->dma_tx[entry];
3243+
3244+ tx_q->tx_count_frames = 0;
3245+ stmmac_set_tx_ic(priv, desc);
3246+ priv->xstats.tx_set_ic_bit++;
3247+ }
3248+
32263249 /* We've used all descriptors we need for this skb, however,
32273250 * advance cur_tx so that it references a fresh descriptor.
32283251 * ndo_start_xmit will fill this descriptor the next time it's
@@ -3258,23 +3281,6 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 29 unmodified lines
32583281
32593282 dev->stats.tx_bytes += skb->len;
32603283
3261− /* According to the coalesce parameter the IC bit for the latest
3262− * segment is reset and the timer re-started to clean the tx status.
3263− * This approach takes care about the fragments: desc is the first
3264− * element in case of no SG.
3265− */
3266− tx_q->tx_count_frames += nfrags + 1;
3267− if (likely(priv->tx_coal_frames > tx_q->tx_count_frames) &&
3268− !(priv->synopsys_id >= DWMAC_CORE_4_00 &&
3269− (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
3270− priv->hwts_tx_en)) {
3271− stmmac_tx_timer_arm(priv, queue);
3272− } else {
3273− tx_q->tx_count_frames = 0;
3274− stmmac_set_tx_ic(priv, desc);
3275− priv->xstats.tx_set_ic_bit++;
3276− }
3277−
32783284 if (priv->sarc_type)
32793285 stmmac_set_desc_sarc(priv, first, priv->sarc_type);
32803286
@@ -3505,8 +3511,6 @@ read_again: · 224 unmodified lines
35053511 if (unlikely(status & dma_own))
35063512 break;
35073513
3508− count++;
3509−
35103514 rx_q->cur_rx = STMMAC_GET_ENTRY(rx_q->cur_rx, DMA_RX_SIZE);
35113515 next_entry = rx_q->cur_rx;
35123516
@@ -3533,6 +3537,7 @@ read_again: · 20 unmodified lines
35333537 goto read_again;
35343538 if (unlikely(error)) {
35353539 dev_kfree_skb(skb);
3540+ count++;
35363541 continue;
35373542 }
35383543
@@ -3572,6 +3577,7 @@ read_again: · 33 unmodified lines
35723577 skb = napi_alloc_skb(&ch->rx_napi, len);
35733578 if (!skb) {
35743579 priv->dev->stats.rx_dropped++;
3580+ count++;
35753581 continue;
35763582 }
35773583
@@ -3637,6 +3643,7 @@ read_again: · 59 unmodified lines
36373643
36383644 priv->dev->stats.rx_packets++;
36393645 priv->dev->stats.rx_bytes += len;
3646+ count++;
36403647 }
36413648
36423649 if (status & rx_not_ls) {
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c+94−40
@@ -6,7 +6,9 @@ · 5 unmodified lines
66 * Author: Jose Abreu <joabreu@synopsys.com>
77 */
88
9+#include <linux/bitrev.h>
910 #include <linux/completion.h>
11+#include <linux/crc32.h>
1012 #include <linux/ethtool.h>
1113 #include <linux/ip.h>
1214 #include <linux/phy.h>
@@ -485,12 +487,48 @@ static int stmmac_filter_check(struct stmmac_priv *priv) · 472 unmodified lines
485487 return -EOPNOTSUPP;
486488 }
487489
490+static bool stmmac_hash_check(struct stmmac_priv *priv, unsigned char *addr)
491+{
492+ int mc_offset = 32 - priv->hw->mcast_bits_log2;
493+ struct netdev_hw_addr *ha;
494+ u32 hash, hash_nr;
495+
496+ /* First compute the hash for desired addr */
497+ hash = bitrev32(~crc32_le(~0, addr, 6)) >> mc_offset;
498+ hash_nr = hash >> 5;
499+ hash = 1 << (hash & 0x1f);
500+
501+ /* Now, check if it collides with any existing one */
502+ netdev_for_each_mc_addr(ha, priv->dev) {
503+ u32 nr = bitrev32(~crc32_le(~0, ha->addr, ETH_ALEN)) >> mc_offset;
504+ if (((nr >> 5) == hash_nr) && ((1 << (nr & 0x1f)) == hash))
505+ return false;
506+ }
507+
508+ /* No collisions, address is good to go */
509+ return true;
510+}
511+
512+static bool stmmac_perfect_check(struct stmmac_priv *priv, unsigned char *addr)
513+{
514+ struct netdev_hw_addr *ha;
515+
516+ /* Check if it collides with any existing one */
517+ netdev_for_each_uc_addr(ha, priv->dev) {
518+ if (!memcmp(ha->addr, addr, ETH_ALEN))
519+ return false;
520+ }
521+
522+ /* No collisions, address is good to go */
523+ return true;
524+}
525+
488526 static int stmmac_test_hfilt(struct stmmac_priv *priv)
489527 {
490− unsigned char gd_addr[ETH_ALEN] = {0x01, 0xee, 0xdd, 0xcc, 0xbb, 0xaa};
491− unsigned char bd_addr[ETH_ALEN] = {0x01, 0x01, 0x02, 0x03, 0x04, 0x05};
528+ unsigned char gd_addr[ETH_ALEN] = {0xf1, 0xee, 0xdd, 0xcc, 0xbb, 0xaa};
529+ unsigned char bd_addr[ETH_ALEN] = {0xf1, 0xff, 0xff, 0xff, 0xff, 0xff};
492530 struct stmmac_packet_attrs attr = { };
493− int ret;
531+ int ret, tries = 256;
494532
495533 ret = stmmac_filter_check(priv);
496534 if (ret)
@@ -499,6 +537,16 @@ static int stmmac_test_hfilt(struct stmmac_priv *priv) · 2 unmodified lines
499537 if (netdev_mc_count(priv->dev) >= priv->hw->multicast_filter_bins)
500538 return -EOPNOTSUPP;
501539
540+ while (--tries) {
541+ /* We only need to check the bd_addr for collisions */
542+ bd_addr[ETH_ALEN - 1] = tries;
543+ if (stmmac_hash_check(priv, bd_addr))
544+ break;
545+ }
546+
547+ if (!tries)
548+ return -EOPNOTSUPP;
549+
502550 ret = dev_mc_add(priv->dev, gd_addr);
503551 if (ret)
504552 return ret;
@@ -523,13 +571,25 @@ cleanup: · 18 unmodified lines
523571
524572 static int stmmac_test_pfilt(struct stmmac_priv *priv)
525573 {
526− unsigned char gd_addr[ETH_ALEN] = {0x00, 0x01, 0x44, 0x55, 0x66, 0x77};
527− unsigned char bd_addr[ETH_ALEN] = {0x08, 0x00, 0x22, 0x33, 0x44, 0x55};
574+ unsigned char gd_addr[ETH_ALEN] = {0xf0, 0x01, 0x44, 0x55, 0x66, 0x77};
575+ unsigned char bd_addr[ETH_ALEN] = {0xf0, 0xff, 0xff, 0xff, 0xff, 0xff};
528576 struct stmmac_packet_attrs attr = { };
529− int ret;
577+ int ret, tries = 256;
530578
531579 if (stmmac_filter_check(priv))
532580 return -EOPNOTSUPP;
581+ if (netdev_uc_count(priv->dev) >= priv->hw->unicast_filter_entries)
582+ return -EOPNOTSUPP;
583+
584+ while (--tries) {
585+ /* We only need to check the bd_addr for collisions */
586+ bd_addr[ETH_ALEN - 1] = tries;
587+ if (stmmac_perfect_check(priv, bd_addr))
588+ break;
589+ }
590+
591+ if (!tries)
592+ return -EOPNOTSUPP;
533593
534594 ret = dev_uc_add(priv->dev, gd_addr);
535595 if (ret)
@@ -553,39 +613,31 @@ cleanup: · 17 unmodified lines
553613 return ret;
554614 }
555615
556−static int stmmac_dummy_sync(struct net_device *netdev, const u8 *addr)
557−{
558− return 0;
559−}
560−
561−static void stmmac_test_set_rx_mode(struct net_device *netdev)
562−{
563− /* As we are in test mode of ethtool we already own the rtnl lock
564− * so no address will change from user. We can just call the
565− * ndo_set_rx_mode() callback directly */
566− if (netdev->netdev_ops->ndo_set_rx_mode)
567− netdev->netdev_ops->ndo_set_rx_mode(netdev);
568−}
569−
570616 static int stmmac_test_mcfilt(struct stmmac_priv *priv)
571617 {
572− unsigned char uc_addr[ETH_ALEN] = {0x00, 0x01, 0x44, 0x55, 0x66, 0x77};
573− unsigned char mc_addr[ETH_ALEN] = {0x01, 0x01, 0x44, 0x55, 0x66, 0x77};
618+ unsigned char uc_addr[ETH_ALEN] = {0xf0, 0xff, 0xff, 0xff, 0xff, 0xff};
619+ unsigned char mc_addr[ETH_ALEN] = {0xf1, 0xff, 0xff, 0xff, 0xff, 0xff};
574620 struct stmmac_packet_attrs attr = { };
575− int ret;
621+ int ret, tries = 256;
576622
577623 if (stmmac_filter_check(priv))
578624 return -EOPNOTSUPP;
579− if (!priv->hw->multicast_filter_bins)
625+ if (netdev_uc_count(priv->dev) >= priv->hw->unicast_filter_entries)
580626 return -EOPNOTSUPP;
581627
582− /* Remove all MC addresses */
583− __dev_mc_unsync(priv->dev, NULL);
584− stmmac_test_set_rx_mode(priv->dev);
628+ while (--tries) {
629+ /* We only need to check the mc_addr for collisions */
630+ mc_addr[ETH_ALEN - 1] = tries;
631+ if (stmmac_hash_check(priv, mc_addr))
632+ break;
633+ }
634+
635+ if (!tries)
636+ return -EOPNOTSUPP;
585637
586638 ret = dev_uc_add(priv->dev, uc_addr);
587639 if (ret)
588− goto cleanup;
640+ return ret;
589641
590642 attr.dst = uc_addr;
591643
@@ -602,30 +654,34 @@ static int stmmac_test_mcfilt(struct stmmac_priv *priv) · 10 unmodified lines
602654
603655 cleanup:
604656 dev_uc_del(priv->dev, uc_addr);
605− __dev_mc_sync(priv->dev, stmmac_dummy_sync, NULL);
606− stmmac_test_set_rx_mode(priv->dev);
607657 return ret;
608658 }
609659
610660 static int stmmac_test_ucfilt(struct stmmac_priv *priv)
611661 {
612− unsigned char uc_addr[ETH_ALEN] = {0x00, 0x01, 0x44, 0x55, 0x66, 0x77};
613− unsigned char mc_addr[ETH_ALEN] = {0x01, 0x01, 0x44, 0x55, 0x66, 0x77};
662+ unsigned char uc_addr[ETH_ALEN] = {0xf0, 0xff, 0xff, 0xff, 0xff, 0xff};
663+ unsigned char mc_addr[ETH_ALEN] = {0xf1, 0xff, 0xff, 0xff, 0xff, 0xff};
614664 struct stmmac_packet_attrs attr = { };
615− int ret;
665+ int ret, tries = 256;
616666
617667 if (stmmac_filter_check(priv))
618668 return -EOPNOTSUPP;
619− if (!priv->hw->multicast_filter_bins)
669+ if (netdev_mc_count(priv->dev) >= priv->hw->multicast_filter_bins)
620670 return -EOPNOTSUPP;
621671
622− /* Remove all UC addresses */
623− __dev_uc_unsync(priv->dev, NULL);
624− stmmac_test_set_rx_mode(priv->dev);
672+ while (--tries) {
673+ /* We only need to check the uc_addr for collisions */
674+ uc_addr[ETH_ALEN - 1] = tries;
675+ if (stmmac_perfect_check(priv, uc_addr))
676+ break;
677+ }
678+
679+ if (!tries)
680+ return -EOPNOTSUPP;
625681
626682 ret = dev_mc_add(priv->dev, mc_addr);
627683 if (ret)
628− goto cleanup;
684+ return ret;
629685
630686 attr.dst = mc_addr;
631687
@@ -642,8 +698,6 @@ static int stmmac_test_ucfilt(struct stmmac_priv *priv) · 10 unmodified lines
642698
643699 cleanup:
644700 dev_mc_del(priv->dev, mc_addr);
645− __dev_uc_sync(priv->dev, stmmac_dummy_sync, NULL);
646− stmmac_test_set_rx_mode(priv->dev);
647701 return ret;
648702 }
649703
drivers/net/fjes/fjes_main.c+14−1
@@ -1237,8 +1237,17 @@ static int fjes_probe(struct platform_device *plat_dev) · 1236 unmodified lines
12371237 adapter->open_guard = false;
12381238
12391239 adapter->txrx_wq = alloc_workqueue(DRV_NAME "/txrx", WQ_MEM_RECLAIM, 0);
1240+ if (unlikely(!adapter->txrx_wq)) {
1241+ err = -ENOMEM;
1242+ goto err_free_netdev;
1243+ }
1244+
12401245 adapter->control_wq = alloc_workqueue(DRV_NAME "/control",
12411246 WQ_MEM_RECLAIM, 0);
1247+ if (unlikely(!adapter->control_wq)) {
1248+ err = -ENOMEM;
1249+ goto err_free_txrx_wq;
1250+ }
12421251
12431252 INIT_WORK(&adapter->tx_stall_task, fjes_tx_stall_task);
12441253 INIT_WORK(&adapter->raise_intr_rxdata_task,
@@ -1255,7 +1264,7 @@ static int fjes_probe(struct platform_device *plat_dev) · 10 unmodified lines
12551264 hw->hw_res.irq = platform_get_irq(plat_dev, 0);
12561265 err = fjes_hw_init(&adapter->hw);
12571266 if (err)
1258− goto err_free_netdev;
1267+ goto err_free_control_wq;
12591268
12601269 /* setup MAC address (02:00:00:00:00:[epid])*/
12611270 netdev->dev_addr[0] = 2;
@@ -1277,6 +1286,10 @@ static int fjes_probe(struct platform_device *plat_dev) · 15 unmodified lines
12771286
12781287 err_hw_exit:
12791288 fjes_hw_exit(&adapter->hw);
1289+err_free_control_wq:
1290+ destroy_workqueue(adapter->control_wq);
1291+err_free_txrx_wq:
1292+ destroy_workqueue(adapter->txrx_wq);
12801293 err_free_netdev:
12811294 free_netdev(netdev);
12821295 err_out:
drivers/net/hamradio/bpqether.c+0−22
@@ -107,27 +107,6 @@ struct bpqdev { · 106 unmodified lines
107107
108108 static LIST_HEAD(bpq_devices);
109109
110−/*
111− * bpqether network devices are paired with ethernet devices below them, so
112− * form a special "super class" of normal ethernet devices; split their locks
113− * off into a separate class since they always nest.
114− */
115−static struct lock_class_key bpq_netdev_xmit_lock_key;
116−static struct lock_class_key bpq_netdev_addr_lock_key;
117−
118−static void bpq_set_lockdep_class_one(struct net_device *dev,
119− struct netdev_queue *txq,
120− void *_unused)
121−{
122− lockdep_set_class(&txq->_xmit_lock, &bpq_netdev_xmit_lock_key);
123−}
124−
125−static void bpq_set_lockdep_class(struct net_device *dev)
126−{
127− lockdep_set_class(&dev->addr_list_lock, &bpq_netdev_addr_lock_key);
128− netdev_for_each_tx_queue(dev, bpq_set_lockdep_class_one, NULL);
129−}
130−
131110 /* ------------------------------------------------------------------------ */
132111
133112
@@ -498,7 +477,6 @@ static int bpq_new_device(struct net_device *edev) · 364 unmodified lines
498477 err = register_netdevice(ndev);
499478 if (err)
500479 goto error;
501− bpq_set_lockdep_class(ndev);
502480
503481 /* List protected by RTNL */
504482 list_add_rcu(&bpq->bpq_list, &bpq_devices);
drivers/net/hyperv/netvsc_drv.c+11−4
@@ -982,7 +982,7 @@ static int netvsc_attach(struct net_device *ndev, · 981 unmodified lines
982982 if (netif_running(ndev)) {
983983 ret = rndis_filter_open(nvdev);
984984 if (ret)
985− return ret;
985+ goto err;
986986
987987 rdev = nvdev->extension;
988988 if (!rdev->link_state)
@@ -990,6 +990,13 @@ static int netvsc_attach(struct net_device *ndev, · 1 unmodified line
990990 }
991991
992992 return 0;
993+
994+err:
995+ netif_device_detach(ndev);
996+
997+ rndis_filter_device_remove(hdev, nvdev);
998+
999+ return ret;
9931000 }
9941001
9951002 static int netvsc_set_channels(struct net_device *net,
@@ -1807,8 +1814,10 @@ static int netvsc_set_features(struct net_device *ndev, · 811 unmodified lines
18071814
18081815 ret = rndis_filter_set_offload_params(ndev, nvdev, &offloads);
18091816
1810− if (ret)
1817+ if (ret) {
18111818 features ^= NETIF_F_LRO;
1819+ ndev->features = features;
1820+ }
18121821
18131822 syncvf:
18141823 if (!vf_netdev)
@@ -2335,8 +2344,6 @@ static int netvsc_probe(struct hv_device *dev, · 520 unmodified lines
23352344 NETIF_F_HW_VLAN_CTAG_RX;
23362345 net->vlan_features = net->features;
23372346
2338− netdev_lockdep_set_classes(net);
2339−
23402347 /* MTU range: 68 - 1500 or 65521 */
23412348 net->min_mtu = NETVSC_MTU_MIN;
23422349 if (nvdev->nvsp_version >= NVSP_PROTOCOL_VERSION_2)
drivers/net/ipvlan/ipvlan_main.c+0−2
@@ -131,8 +131,6 @@ static int ipvlan_init(struct net_device *dev) · 130 unmodified lines
131131 dev->gso_max_segs = phy_dev->gso_max_segs;
132132 dev->hard_header_len = phy_dev->hard_header_len;
133133
134− netdev_lockdep_set_classes(dev);
135−
136134 ipvlan->pcpu_stats = netdev_alloc_pcpu_stats(struct ipvl_pcpu_stats);
137135 if (!ipvlan->pcpu_stats)
138136 return -ENOMEM;
drivers/net/macsec.c+0−18
@@ -267,7 +267,6 @@ struct macsec_dev { · 266 unmodified lines
267267 struct pcpu_secy_stats __percpu *stats;
268268 struct list_head secys;
269269 struct gro_cells gro_cells;
270− unsigned int nest_level;
271270 };
272271
273272 /**
@@ -2750,7 +2749,6 @@ static netdev_tx_t macsec_start_xmit(struct sk_buff *skb, · 2476 unmodified lines
27502749
27512750 #define MACSEC_FEATURES \
27522751 (NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST)
2753−static struct lock_class_key macsec_netdev_addr_lock_key;
27542752
27552753 static int macsec_dev_init(struct net_device *dev)
27562754 {
@@ -2958,11 +2956,6 @@ static int macsec_get_iflink(const struct net_device *dev) · 201 unmodified lines
29582956 return macsec_priv(dev)->real_dev->ifindex;
29592957 }
29602958
2961−static int macsec_get_nest_level(struct net_device *dev)
2962−{
2963− return macsec_priv(dev)->nest_level;
2964−}
2965−
29662959 static const struct net_device_ops macsec_netdev_ops = {
29672960 .ndo_init = macsec_dev_init,
29682961 .ndo_uninit = macsec_dev_uninit,
@@ -2976,7 +2969,6 @@ static const struct net_device_ops macsec_netdev_ops = { · 7 unmodified lines
29762969 .ndo_start_xmit = macsec_start_xmit,
29772970 .ndo_get_stats64 = macsec_get_stats64,
29782971 .ndo_get_iflink = macsec_get_iflink,
2979− .ndo_get_lock_subclass = macsec_get_nest_level,
29802972 };
29812973
29822974 static const struct device_type macsec_type = {
@@ -3001,12 +2993,10 @@ static const struct nla_policy macsec_rtnl_policy[IFLA_MACSEC_MAX + 1] = { · 18 unmodified lines
30012993 static void macsec_free_netdev(struct net_device *dev)
30022994 {
30032995 struct macsec_dev *macsec = macsec_priv(dev);
3004− struct net_device *real_dev = macsec->real_dev;
30052996
30062997 free_percpu(macsec->stats);
30072998 free_percpu(macsec->secy.tx_sc.stats);
30082999
3009− dev_put(real_dev);
30103000 }
30113001
30123002 static void macsec_setup(struct net_device *dev)
@@ -3261,14 +3251,6 @@ static int macsec_newlink(struct net *net, struct net_device *dev, · 248 unmodified lines
32613251 if (err < 0)
32623252 return err;
32633253
3264− dev_hold(real_dev);
3265−
3266− macsec->nest_level = dev_get_nest_level(real_dev) + 1;
3267− netdev_lockdep_set_classes(dev);
3268− lockdep_set_class_and_subclass(&dev->addr_list_lock,
3269− &macsec_netdev_addr_lock_key,
3270− macsec_get_nest_level(dev));
3271−
32723254 err = netdev_upper_dev_link(real_dev, dev, extack);
32733255 if (err < 0)
32743256 goto unregister;
drivers/net/macvlan.c+0−19
@@ -852,8 +852,6 @@ static int macvlan_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) · 851 unmodified lines
852852 * "super class" of normal network devices; split their locks off into a
853853 * separate class since they always nest.
854854 */
855−static struct lock_class_key macvlan_netdev_addr_lock_key;
856−
857855 #define ALWAYS_ON_OFFLOADS \
858856 (NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE | \
859857 NETIF_F_GSO_ROBUST | NETIF_F_GSO_ENCAP_ALL)
@@ -869,19 +867,6 @@ static struct lock_class_key macvlan_netdev_addr_lock_key; · 9 unmodified lines
869867 #define MACVLAN_STATE_MASK \
870868 ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))
871869
872−static int macvlan_get_nest_level(struct net_device *dev)
873−{
874− return ((struct macvlan_dev *)netdev_priv(dev))->nest_level;
875−}
876−
877−static void macvlan_set_lockdep_class(struct net_device *dev)
878−{
879− netdev_lockdep_set_classes(dev);
880− lockdep_set_class_and_subclass(&dev->addr_list_lock,
881− &macvlan_netdev_addr_lock_key,
882− macvlan_get_nest_level(dev));
883−}
884−
885870 static int macvlan_init(struct net_device *dev)
886871 {
887872 struct macvlan_dev *vlan = netdev_priv(dev);
@@ -900,8 +885,6 @@ static int macvlan_init(struct net_device *dev) · 12 unmodified lines
900885 dev->gso_max_segs = lowerdev->gso_max_segs;
901886 dev->hard_header_len = lowerdev->hard_header_len;
902887
903− macvlan_set_lockdep_class(dev);
904−
905888 vlan->pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats);
906889 if (!vlan->pcpu_stats)
907890 return -ENOMEM;
@@ -1161,7 +1144,6 @@ static const struct net_device_ops macvlan_netdev_ops = { · 253 unmodified lines
11611144 .ndo_fdb_add = macvlan_fdb_add,
11621145 .ndo_fdb_del = macvlan_fdb_del,
11631146 .ndo_fdb_dump = ndo_dflt_fdb_dump,
1164− .ndo_get_lock_subclass = macvlan_get_nest_level,
11651147 #ifdef CONFIG_NET_POLL_CONTROLLER
11661148 .ndo_poll_controller = macvlan_dev_poll_controller,
11671149 .ndo_netpoll_setup = macvlan_dev_netpoll_setup,
@@ -1445,7 +1427,6 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev, · 277 unmodified lines
14451427 vlan->dev = dev;
14461428 vlan->port = port;
14471429 vlan->set_features = MACVLAN_FEATURES;
1448− vlan->nest_level = dev_get_nest_level(lowerdev) + 1;
14491430
14501431 vlan->mode = MACVLAN_MODE_VEPA;
14511432 if (data && data[IFLA_MACVLAN_MODE])
drivers/net/netdevsim/dev.c+5−0
@@ -806,9 +806,11 @@ static void nsim_dev_port_del_all(struct nsim_dev *nsim_dev) · 805 unmodified lines
806806 {
807807 struct nsim_dev_port *nsim_dev_port, *tmp;
808808
809+ mutex_lock(&nsim_dev->port_list_lock);
809810 list_for_each_entry_safe(nsim_dev_port, tmp,
810811 &nsim_dev->port_list, list)
811812 __nsim_dev_port_del(nsim_dev_port);
813+ mutex_unlock(&nsim_dev->port_list_lock);
812814 }
813815
814816 int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev)
@@ -822,14 +824,17 @@ int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev) · 7 unmodified lines
822824 return PTR_ERR(nsim_dev);
823825 dev_set_drvdata(&nsim_bus_dev->dev, nsim_dev);
824826
827+ mutex_lock(&nsim_dev->port_list_lock);
825828 for (i = 0; i < nsim_bus_dev->port_count; i++) {
826829 err = __nsim_dev_port_add(nsim_dev, i);
827830 if (err)
828831 goto err_port_del_all;
829832 }
833+ mutex_unlock(&nsim_dev->port_list_lock);
830834 return 0;
831835
832836 err_port_del_all:
837+ mutex_unlock(&nsim_dev->port_list_lock);
833838 nsim_dev_port_del_all(nsim_dev);
834839 nsim_dev_destroy(nsim_dev);
835840 return err;
drivers/net/phy/phylink.c+16−0
@@ -87,8 +87,24 @@ struct phylink { · 86 unmodified lines
8787 phylink_printk(KERN_WARNING, pl, fmt, ##__VA_ARGS__)
8888 #define phylink_info(pl, fmt, ...) \
8989 phylink_printk(KERN_INFO, pl, fmt, ##__VA_ARGS__)
90+#if defined(CONFIG_DYNAMIC_DEBUG)
9091 #define phylink_dbg(pl, fmt, ...) \
92+do { \
93+ if ((pl)->config->type == PHYLINK_NETDEV) \
94+ netdev_dbg((pl)->netdev, fmt, ##__VA_ARGS__); \
95+ else if ((pl)->config->type == PHYLINK_DEV) \
96+ dev_dbg((pl)->dev, fmt, ##__VA_ARGS__); \
97+} while (0)
98+#elif defined(DEBUG)
99+#define phylink_dbg(pl, fmt, ...) \
91100 phylink_printk(KERN_DEBUG, pl, fmt, ##__VA_ARGS__)
101+#else
102+#define phylink_dbg(pl, fmt, ...) \
103+({ \
104+ if (0) \
105+ phylink_printk(KERN_DEBUG, pl, fmt, ##__VA_ARGS__); \
106+})
107+#endif
92108
93109 /**
94110 * phylink_set_port_modes() - set the port type modes in the ethtool mask
drivers/net/phy/smsc.c+1−0
@@ -327,6 +327,7 @@ static struct phy_driver smsc_phy_driver[] = { · 326 unmodified lines
327327 .name = "SMSC LAN8740",
328328
329329 /* PHY_BASIC_FEATURES */
330+ .flags = PHY_RST_AFTER_CLK_EN,
330331
331332 .probe = smsc_phy_probe,
332333
drivers/net/ppp/ppp_generic.c+0−2
@@ -1324,8 +1324,6 @@ static int ppp_dev_init(struct net_device *dev) · 1323 unmodified lines
13241324 {
13251325 struct ppp *ppp;
13261326
1327− netdev_lockdep_set_classes(dev);
1328−
13291327 ppp = netdev_priv(dev);
13301328 /* Let the netdevice take a reference on the ppp file. This ensures
13311329 * that ppp_destroy_interface() won't run before the device gets
drivers/net/team/team.c+12−4
@@ -1615,7 +1615,6 @@ static int team_init(struct net_device *dev) · 1614 unmodified lines
16151615 int err;
16161616
16171617 team->dev = dev;
1618− mutex_init(&team->lock);
16191618 team_set_no_mode(team);
16201619
16211620 team->pcpu_stats = netdev_alloc_pcpu_stats(struct team_pcpu_stats);
@@ -1642,7 +1641,8 @@ static int team_init(struct net_device *dev) · 20 unmodified lines
16421641 goto err_options_register;
16431642 netif_carrier_off(dev);
16441643
1645− netdev_lockdep_set_classes(dev);
1644+ lockdep_register_key(&team->team_lock_key);
1645+ __mutex_init(&team->lock, "team->team_lock_key", &team->team_lock_key);
16461646
16471647 return 0;
16481648
@@ -1673,6 +1673,7 @@ static void team_uninit(struct net_device *dev) · 24 unmodified lines
16731673 team_queue_override_fini(team);
16741674 mutex_unlock(&team->lock);
16751675 netdev_change_features(dev);
1676+ lockdep_unregister_key(&team->team_lock_key);
16761677 }
16771678
16781679 static void team_destructor(struct net_device *dev)
@@ -1976,8 +1977,15 @@ static int team_del_slave(struct net_device *dev, struct net_device *port_dev) · 297 unmodified lines
19761977 err = team_port_del(team, port_dev);
19771978 mutex_unlock(&team->lock);
19781979
1979− if (!err)
1980− netdev_change_features(dev);
1980+ if (err)
1981+ return err;
1982+
1983+ if (netif_is_team_master(port_dev)) {
1984+ lockdep_unregister_key(&team->team_lock_key);
1985+ lockdep_register_key(&team->team_lock_key);
1986+ lockdep_set_class(&team->lock, &team->team_lock_key);
1987+ }
1988+ netdev_change_features(dev);
19811989
19821990 return err;
19831991 }
drivers/net/usb/cdc_ether.c+7−0
@@ -787,6 +787,13 @@ static const struct usb_device_id products[] = { · 786 unmodified lines
787787 .driver_info = 0,
788788 },
789789
790+/* ThinkPad USB-C Dock Gen 2 (based on Realtek RTL8153) */
791+{
792+ USB_DEVICE_AND_INTERFACE_INFO(LENOVO_VENDOR_ID, 0xa387, USB_CLASS_COMM,
793+ USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
794+ .driver_info = 0,
795+},
796+
790797 /* NVIDIA Tegra USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */
791798 {
792799 USB_DEVICE_AND_INTERFACE_INFO(NVIDIA_VENDOR_ID, 0x09ff, USB_CLASS_COMM,
drivers/net/usb/cdc_ncm.c+3−3
@@ -578,8 +578,8 @@ static void cdc_ncm_set_dgram_size(struct usbnet *dev, int new_size) · 577 unmodified lines
578578 /* read current mtu value from device */
579579 err = usbnet_read_cmd(dev, USB_CDC_GET_MAX_DATAGRAM_SIZE,
580580 USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE,
581− 0, iface_no, &max_datagram_size, 2);
582− if (err < 0) {
581+ 0, iface_no, &max_datagram_size, sizeof(max_datagram_size));
582+ if (err < sizeof(max_datagram_size)) {
583583 dev_dbg(&dev->intf->dev, "GET_MAX_DATAGRAM_SIZE failed\n");
584584 goto out;
585585 }
@@ -590,7 +590,7 @@ static void cdc_ncm_set_dgram_size(struct usbnet *dev, int new_size) · 4 unmodified lines
590590 max_datagram_size = cpu_to_le16(ctx->max_datagram_size);
591591 err = usbnet_write_cmd(dev, USB_CDC_SET_MAX_DATAGRAM_SIZE,
592592 USB_TYPE_CLASS | USB_DIR_OUT | USB_RECIP_INTERFACE,
593− 0, iface_no, &max_datagram_size, 2);
593+ 0, iface_no, &max_datagram_size, sizeof(max_datagram_size));
594594 if (err < 0)
595595 dev_dbg(&dev->intf->dev, "SET_MAX_DATAGRAM_SIZE failed\n");
596596
drivers/net/usb/lan78xx.c+4−1
@@ -1264,8 +1264,11 @@ static void lan78xx_status(struct lan78xx_net *dev, struct urb *urb) · 1263 unmodified lines
12641264 netif_dbg(dev, link, dev->net, "PHY INTR: 0x%08x\n", intdata);
12651265 lan78xx_defer_kevent(dev, EVENT_LINK_RESET);
12661266
1267− if (dev->domain_data.phyirq > 0)
1267+ if (dev->domain_data.phyirq > 0) {
1268+ local_irq_disable();
12681269 generic_handle_irq(dev->domain_data.phyirq);
1270+ local_irq_enable();
1271+ }
12691272 } else
12701273 netdev_warn(dev->net,
12711274 "unexpected interrupt: 0x%08x\n", intdata);
drivers/net/usb/qmi_wwan.c+1−0
@@ -1362,6 +1362,7 @@ static const struct usb_device_id products[] = { · 1361 unmodified lines
13621362 {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */
13631363 {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */
13641364 {QMI_FIXED_INTF(0x413c, 0x81d7, 0)}, /* Dell Wireless 5821e */
1365+ {QMI_FIXED_INTF(0x413c, 0x81e0, 0)}, /* Dell Wireless 5821e with eSIM support*/
13651366 {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
13661367 {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */
13671368 {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
drivers/net/usb/r8152.c+1−0
@@ -5755,6 +5755,7 @@ static const struct usb_device_id rtl8152_table[] = { · 5754 unmodified lines
57555755 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7205)},
57565756 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x720c)},
57575757 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7214)},
5758+ {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0xa387)},
57585759 {REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041)},
57595760 {REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff)},
57605761 {REALTEK_USB_DEVICE(VENDOR_ID_TPLINK, 0x0601)},
drivers/net/vrf.c+0−1
@@ -865,7 +865,6 @@ static int vrf_dev_init(struct net_device *dev) · 864 unmodified lines
865865
866866 /* similarly, oper state is irrelevant; set to up to avoid confusion */
867867 dev->operstate = IF_OPER_UP;
868− netdev_lockdep_set_classes(dev);
869868 return 0;
870869
871870 out_rth:
drivers/net/vxlan.c+50−12
@@ -2487,9 +2487,11 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, · 2486 unmodified lines
24872487 vni = tunnel_id_to_key32(info->key.tun_id);
24882488 ifindex = 0;
24892489 dst_cache = &info->dst_cache;
2490− if (info->options_len &&
2491− info->key.tun_flags & TUNNEL_VXLAN_OPT)
2490+ if (info->key.tun_flags & TUNNEL_VXLAN_OPT) {
2491+ if (info->options_len < sizeof(*md))
2492+ goto drop;
24922493 md = ip_tunnel_info_opts(info);
2494+ }
24932495 ttl = info->key.ttl;
24942496 tos = info->key.tos;
24952497 label = info->key.label;
@@ -3566,10 +3568,13 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev, · 1070 unmodified lines
35663568 {
35673569 struct vxlan_net *vn = net_generic(net, vxlan_net_id);
35683570 struct vxlan_dev *vxlan = netdev_priv(dev);
3571+ struct net_device *remote_dev = NULL;
35693572 struct vxlan_fdb *f = NULL;
35703573 bool unregister = false;
3574+ struct vxlan_rdst *dst;
35713575 int err;
35723576
3577+ dst = &vxlan->default_dst;
35733578 err = vxlan_dev_configure(net, dev, conf, false, extack);
35743579 if (err)
35753580 return err;
@@ -3577,14 +3582,14 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev, · 1 unmodified line
35773582 dev->ethtool_ops = &vxlan_ethtool_ops;
35783583
35793584 /* create an fdb entry for a valid default destination */
3580− if (!vxlan_addr_any(&vxlan->default_dst.remote_ip)) {
3585+ if (!vxlan_addr_any(&dst->remote_ip)) {
35813586 err = vxlan_fdb_create(vxlan, all_zeros_mac,
3582− &vxlan->default_dst.remote_ip,
3587+ &dst->remote_ip,
35833588 NUD_REACHABLE | NUD_PERMANENT,
35843589 vxlan->cfg.dst_port,
3585− vxlan->default_dst.remote_vni,
3586− vxlan->default_dst.remote_vni,
3587− vxlan->default_dst.remote_ifindex,
3590+ dst->remote_vni,
3591+ dst->remote_vni,
3592+ dst->remote_ifindex,
35883593 NTF_SELF, &f);
35893594 if (err)
35903595 return err;
@@ -3595,26 +3600,41 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev, · 4 unmodified lines
35953600 goto errout;
35963601 unregister = true;
35973602
3603+ if (dst->remote_ifindex) {
3604+ remote_dev = __dev_get_by_index(net, dst->remote_ifindex);
3605+ if (!remote_dev)
3606+ goto errout;
3607+
3608+ err = netdev_upper_dev_link(remote_dev, dev, extack);
3609+ if (err)
3610+ goto errout;
3611+ }
3612+
35983613 err = rtnl_configure_link(dev, NULL);
35993614 if (err)
3600− goto errout;
3615+ goto unlink;
36013616
36023617 if (f) {
3603− vxlan_fdb_insert(vxlan, all_zeros_mac,
3604− vxlan->default_dst.remote_vni, f);
3618+ vxlan_fdb_insert(vxlan, all_zeros_mac, dst->remote_vni, f);
36053619
36063620 /* notify default fdb entry */
36073621 err = vxlan_fdb_notify(vxlan, f, first_remote_rtnl(f),
36083622 RTM_NEWNEIGH, true, extack);
36093623 if (err) {
36103624 vxlan_fdb_destroy(vxlan, f, false, false);
3625+ if (remote_dev)
3626+ netdev_upper_dev_unlink(remote_dev, dev);
36113627 goto unregister;
36123628 }
36133629 }
36143630
36153631 list_add(&vxlan->next, &vn->vxlan_list);
3632+ if (remote_dev)
3633+ dst->remote_dev = remote_dev;
36163634 return 0;
3617−
3635+unlink:
3636+ if (remote_dev)
3637+ netdev_upper_dev_unlink(remote_dev, dev);
36183638 errout:
36193639 /* unregister_netdevice() destroys the default FDB entry with deletion
36203640 * notification. But the addition notification was not sent yet, so
@@ -3932,11 +3952,12 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[], · 311 unmodified lines
39323952 struct netlink_ext_ack *extack)
39333953 {
39343954 struct vxlan_dev *vxlan = netdev_priv(dev);
3935− struct vxlan_rdst *dst = &vxlan->default_dst;
39363955 struct net_device *lowerdev;
39373956 struct vxlan_config conf;
3957+ struct vxlan_rdst *dst;
39383958 int err;
39393959
3960+ dst = &vxlan->default_dst;
39403961 err = vxlan_nl2conf(tb, data, dev, &conf, true, extack);
39413962 if (err)
39423963 return err;
@@ -3946,6 +3967,14 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[], · 3 unmodified lines
39463967 if (err)
39473968 return err;
39483969
3970+ if (dst->remote_dev == lowerdev)
3971+ lowerdev = NULL;
3972+
3973+ err = netdev_adjacent_change_prepare(dst->remote_dev, lowerdev, dev,
3974+ extack);
3975+ if (err)
3976+ return err;
3977+
39493978 /* handle default dst entry */
39503979 if (!vxlan_addr_equal(&conf.remote_ip, &dst->remote_ip)) {
39513980 u32 hash_index = fdb_head_index(vxlan, all_zeros_mac, conf.vni);
@@ -3962,6 +3991,8 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[], · 10 unmodified lines
39623991 NTF_SELF, true, extack);
39633992 if (err) {
39643993 spin_unlock_bh(&vxlan->hash_lock[hash_index]);
3994+ netdev_adjacent_change_abort(dst->remote_dev,
3995+ lowerdev, dev);
39653996 return err;
39663997 }
39673998 }
@@ -3979,6 +4010,11 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[], · 11 unmodified lines
39794010 if (conf.age_interval != vxlan->cfg.age_interval)
39804011 mod_timer(&vxlan->age_timer, jiffies);
39814012
4013+ netdev_adjacent_change_commit(dst->remote_dev, lowerdev, dev);
4014+ if (lowerdev && lowerdev != dst->remote_dev) {
4015+ dst->remote_dev = lowerdev;
4016+ netdev_update_lockdep_key(lowerdev);
4017+ }
39824018 vxlan_config_apply(dev, &conf, lowerdev, vxlan->net, true);
39834019 return 0;
39844020 }
@@ -3991,6 +4027,8 @@ static void vxlan_dellink(struct net_device *dev, struct list_head *head) · 6 unmodified lines
39914027
39924028 list_del(&vxlan->next);
39934029 unregister_netdevice_queue(dev, head);
4030+ if (vxlan->default_dst.remote_dev)
4031+ netdev_upper_dev_unlink(vxlan->default_dst.remote_dev, dev);
39944032 }
39954033
39964034 static size_t vxlan_get_size(const struct net_device *dev)
drivers/net/wimax/i2400m/op-rfkill.c+1−1
@@ -127,12 +127,12 @@ int i2400m_op_rfkill_sw_toggle(struct wimax_dev *wimax_dev, · 126 unmodified lines
127127 "%d\n", result);
128128 result = 0;
129129 error_cmd:
130− kfree(cmd);
131130 kfree_skb(ack_skb);
132131 error_msg_to_dev:
133132 error_alloc:
134133 d_fnend(4, dev, "(wimax_dev %p state %d) = %d\n",
135134 wimax_dev, state, result);
135+ kfree(cmd);
136136 return result;
137137 }
138138
drivers/net/wireless/intel/iwlwifi/fw/api/scan.h+20−2
@@ -520,7 +520,7 @@ struct iwl_scan_dwell { · 519 unmodified lines
520520 } __packed;
521521
522522 /**
523− * struct iwl_scan_config
523+ * struct iwl_scan_config_v1
524524 * @flags: enum scan_config_flags
525525 * @tx_chains: valid_tx antenna - ANT_* definitions
526526 * @rx_chains: valid_rx antenna - ANT_* definitions
@@ -552,7 +552,7 @@ struct iwl_scan_config_v1 { · 25 unmodified lines
552552 #define SCAN_LB_LMAC_IDX 0
553553 #define SCAN_HB_LMAC_IDX 1
554554
555−struct iwl_scan_config {
555+struct iwl_scan_config_v2 {
556556 __le32 flags;
557557 __le32 tx_chains;
558558 __le32 rx_chains;
@@ -564,6 +564,24 @@ struct iwl_scan_config { · 5 unmodified lines
564564 u8 bcast_sta_id;
565565 u8 channel_flags;
566566 u8 channel_array[];
567+} __packed; /* SCAN_CONFIG_DB_CMD_API_S_2 */
568+
569+/**
570+ * struct iwl_scan_config
571+ * @enable_cam_mode: whether to enable CAM mode.
572+ * @enable_promiscouos_mode: whether to enable promiscouos mode
573+ * @bcast_sta_id: the index of the station in the fw
574+ * @reserved: reserved
575+ * @tx_chains: valid_tx antenna - ANT_* definitions
576+ * @rx_chains: valid_rx antenna - ANT_* definitions
577+ */
578+struct iwl_scan_config {
579+ u8 enable_cam_mode;
580+ u8 enable_promiscouos_mode;
581+ u8 bcast_sta_id;
582+ u8 reserved;
583+ __le32 tx_chains;
584+ __le32 rx_chains;
567585 } __packed; /* SCAN_CONFIG_DB_CMD_API_S_3 */
568586
569587 /**
drivers/net/wireless/intel/iwlwifi/fw/file.h+3−0
@@ -288,6 +288,8 @@ typedef unsigned int __bitwise iwl_ucode_tlv_api_t; · 287 unmodified lines
288288 * STA_CONTEXT_DOT11AX_API_S
289289 * @IWL_UCODE_TLV_CAPA_SAR_TABLE_VER: This ucode supports different sar
290290 * version tables.
291+ * @IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG: This ucode supports v3 of
292+ * SCAN_CONFIG_DB_CMD_API_S.
291293 *
292294 * @NUM_IWL_UCODE_TLV_API: number of bits used
293295 */
@@ -321,6 +323,7 @@ enum iwl_ucode_tlv_api { · 27 unmodified lines
321323 IWL_UCODE_TLV_API_WOWLAN_TCP_SYN_WAKE = (__force iwl_ucode_tlv_api_t)53,
322324 IWL_UCODE_TLV_API_FTM_RTT_ACCURACY = (__force iwl_ucode_tlv_api_t)54,
323325 IWL_UCODE_TLV_API_SAR_TABLE_VER = (__force iwl_ucode_tlv_api_t)55,
326+ IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG = (__force iwl_ucode_tlv_api_t)56,
324327 IWL_UCODE_TLV_API_ADWELL_HB_DEF_N_AP = (__force iwl_ucode_tlv_api_t)57,
325328 IWL_UCODE_TLV_API_SCAN_EXT_CHAN_VER = (__force iwl_ucode_tlv_api_t)58,
326329
drivers/net/wireless/intel/iwlwifi/iwl-csr.h+1−0
@@ -279,6 +279,7 @@ · 278 unmodified lines
279279 * Indicates MAC is entering a power-saving sleep power-down.
280280 * Not a good time to access device-internal resources.
281281 */
282+#define CSR_GP_CNTRL_REG_FLAG_INIT_DONE (0x00000004)
282283 #define CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010)
283284 #define CSR_GP_CNTRL_REG_FLAG_XTAL_ON (0x00000400)
284285
drivers/net/wireless/intel/iwlwifi/iwl-prph.h+5−0
@@ -449,6 +449,11 @@ enum { · 448 unmodified lines
449449 #define PERSISTENCE_BIT BIT(12)
450450 #define PREG_WFPM_ACCESS BIT(12)
451451
452+#define HPM_HIPM_GEN_CFG 0xA03458
453+#define HPM_HIPM_GEN_CFG_CR_PG_EN BIT(0)
454+#define HPM_HIPM_GEN_CFG_CR_SLP_EN BIT(1)
455+#define HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE BIT(10)
456+
452457 #define UREG_DOORBELL_TO_ISR6 0xA05C04
453458 #define UREG_DOORBELL_TO_ISR6_NMI_BIT BIT(0)
454459 #define UREG_DOORBELL_TO_ISR6_SUSPEND BIT(18)
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h+6−0
@@ -1405,6 +1405,12 @@ static inline bool iwl_mvm_is_scan_ext_chan_supported(struct iwl_mvm *mvm) · 1404 unmodified lines
14051405 IWL_UCODE_TLV_API_SCAN_EXT_CHAN_VER);
14061406 }
14071407
1408+static inline bool iwl_mvm_is_reduced_config_scan_supported(struct iwl_mvm *mvm)
1409+{
1410+ return fw_has_api(&mvm->fw->ucode_capa,
1411+ IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG);
1412+}
1413+
14081414 static inline bool iwl_mvm_has_new_rx_stats_api(struct iwl_mvm *mvm)
14091415 {
14101416 return fw_has_api(&mvm->fw->ucode_capa,
drivers/net/wireless/intel/iwlwifi/mvm/scan.c+32−8
@@ -1137,11 +1137,11 @@ static void iwl_mvm_fill_scan_config_v1(struct iwl_mvm *mvm, void *config, · 1136 unmodified lines
11371137 iwl_mvm_fill_channels(mvm, cfg->channel_array, max_channels);
11381138 }
11391139
1140−static void iwl_mvm_fill_scan_config(struct iwl_mvm *mvm, void *config,
1141− u32 flags, u8 channel_flags,
1142− u32 max_channels)
1140+static void iwl_mvm_fill_scan_config_v2(struct iwl_mvm *mvm, void *config,
1141+ u32 flags, u8 channel_flags,
1142+ u32 max_channels)
11431143 {
1144− struct iwl_scan_config *cfg = config;
1144+ struct iwl_scan_config_v2 *cfg = config;
11451145
11461146 cfg->flags = cpu_to_le32(flags);
11471147 cfg->tx_chains = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm));
@@ -1185,7 +1185,7 @@ static void iwl_mvm_fill_scan_config(struct iwl_mvm *mvm, void *config, · 37 unmodified lines
11851185 iwl_mvm_fill_channels(mvm, cfg->channel_array, max_channels);
11861186 }
11871187
1188−int iwl_mvm_config_scan(struct iwl_mvm *mvm)
1188+static int iwl_mvm_legacy_config_scan(struct iwl_mvm *mvm)
11891189 {
11901190 void *cfg;
11911191 int ret, cmd_size;
@@ -1217,7 +1217,7 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm) · 25 unmodified lines
12171217 }
12181218
12191219 if (iwl_mvm_cdb_scan_api(mvm))
1220− cmd_size = sizeof(struct iwl_scan_config);
1220+ cmd_size = sizeof(struct iwl_scan_config_v2);
12211221 else
12221222 cmd_size = sizeof(struct iwl_scan_config_v1);
12231223 cmd_size += num_channels;
@@ -1254,8 +1254,8 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm) · 30 unmodified lines
12541254 flags |= (iwl_mvm_is_scan_fragmented(hb_type)) ?
12551255 SCAN_CONFIG_FLAG_SET_LMAC2_FRAGMENTED :
12561256 SCAN_CONFIG_FLAG_CLEAR_LMAC2_FRAGMENTED;
1257− iwl_mvm_fill_scan_config(mvm, cfg, flags, channel_flags,
1258− num_channels);
1257+ iwl_mvm_fill_scan_config_v2(mvm, cfg, flags, channel_flags,
1258+ num_channels);
12591259 } else {
12601260 iwl_mvm_fill_scan_config_v1(mvm, cfg, flags, channel_flags,
12611261 num_channels);
@@ -1277,6 +1277,30 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm) · 15 unmodified lines
12771277 return ret;
12781278 }
12791279
1280+int iwl_mvm_config_scan(struct iwl_mvm *mvm)
1281+{
1282+ struct iwl_scan_config cfg;
1283+ struct iwl_host_cmd cmd = {
1284+ .id = iwl_cmd_id(SCAN_CFG_CMD, IWL_ALWAYS_LONG_GROUP, 0),
1285+ .len[0] = sizeof(cfg),
1286+ .data[0] = &cfg,
1287+ .dataflags[0] = IWL_HCMD_DFL_NOCOPY,
1288+ };
1289+
1290+ if (!iwl_mvm_is_reduced_config_scan_supported(mvm))
1291+ return iwl_mvm_legacy_config_scan(mvm);
1292+
1293+ memset(&cfg, 0, sizeof(cfg));
1294+
1295+ cfg.bcast_sta_id = mvm->aux_sta.sta_id;
1296+ cfg.tx_chains = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm));
1297+ cfg.rx_chains = cpu_to_le32(iwl_mvm_scan_rx_ant(mvm));
1298+
1299+ IWL_DEBUG_SCAN(mvm, "Sending UMAC scan config\n");
1300+
1301+ return iwl_mvm_send_cmd(mvm, &cmd);
1302+}
1303+
12801304 static int iwl_mvm_scan_uid_by_status(struct iwl_mvm *mvm, int status)
12811305 {
12821306 int i;
drivers/net/wireless/intel/iwlwifi/mvm/sta.c+83−57
@@ -1482,6 +1482,13 @@ static void iwl_mvm_realloc_queues_after_restart(struct iwl_mvm *mvm, · 1481 unmodified lines
14821482 mvm_sta->sta_id, i);
14831483 txq_id = iwl_mvm_tvqm_enable_txq(mvm, mvm_sta->sta_id,
14841484 i, wdg);
1485+ /*
1486+ * on failures, just set it to IWL_MVM_INVALID_QUEUE
1487+ * to try again later, we have no other good way of
1488+ * failing here
1489+ */
1490+ if (txq_id < 0)
1491+ txq_id = IWL_MVM_INVALID_QUEUE;
14851492 tid_data->txq_id = txq_id;
14861493
14871494 /*
@@ -1950,30 +1957,73 @@ void iwl_mvm_dealloc_int_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *sta) · 462 unmodified lines
19501957 sta->sta_id = IWL_MVM_INVALID_STA;
19511958 }
19521959
1953−static void iwl_mvm_enable_aux_snif_queue(struct iwl_mvm *mvm, u16 *queue,
1960+static void iwl_mvm_enable_aux_snif_queue(struct iwl_mvm *mvm, u16 queue,
19541961 u8 sta_id, u8 fifo)
19551962 {
19561963 unsigned int wdg_timeout = iwlmvm_mod_params.tfd_q_hang_detect ?
19571964 mvm->trans->trans_cfg->base_params->wd_timeout :
19581965 IWL_WATCHDOG_DISABLED;
1966+ struct iwl_trans_txq_scd_cfg cfg = {
1967+ .fifo = fifo,
1968+ .sta_id = sta_id,
1969+ .tid = IWL_MAX_TID_COUNT,
1970+ .aggregate = false,
1971+ .frame_limit = IWL_FRAME_LIMIT,
1972+ };
1973+
1974+ WARN_ON(iwl_mvm_has_new_tx_api(mvm));
1975+
1976+ iwl_mvm_enable_txq(mvm, NULL, queue, 0, &cfg, wdg_timeout);
1977+}
1978+
1979+static int iwl_mvm_enable_aux_snif_queue_tvqm(struct iwl_mvm *mvm, u8 sta_id)
1980+{
1981+ unsigned int wdg_timeout = iwlmvm_mod_params.tfd_q_hang_detect ?
1982+ mvm->trans->trans_cfg->base_params->wd_timeout :
1983+ IWL_WATCHDOG_DISABLED;
1984+
1985+ WARN_ON(!iwl_mvm_has_new_tx_api(mvm));
1986+
1987+ return iwl_mvm_tvqm_enable_txq(mvm, sta_id, IWL_MAX_TID_COUNT,
1988+ wdg_timeout);
1989+}
19591990
1991+static int iwl_mvm_add_int_sta_with_queue(struct iwl_mvm *mvm, int macidx,
1992+ int maccolor,
1993+ struct iwl_mvm_int_sta *sta,
1994+ u16 *queue, int fifo)
1995+{
1996+ int ret;
1997+
1998+ /* Map queue to fifo - needs to happen before adding station */
1999+ if (!iwl_mvm_has_new_tx_api(mvm))
2000+ iwl_mvm_enable_aux_snif_queue(mvm, *queue, sta->sta_id, fifo);
2001+
2002+ ret = iwl_mvm_add_int_sta_common(mvm, sta, NULL, macidx, maccolor);
2003+ if (ret) {
2004+ if (!iwl_mvm_has_new_tx_api(mvm))
2005+ iwl_mvm_disable_txq(mvm, NULL, *queue,
2006+ IWL_MAX_TID_COUNT, 0);
2007+ return ret;
2008+ }
2009+
2010+ /*
2011+ * For 22000 firmware and on we cannot add queue to a station unknown
2012+ * to firmware so enable queue here - after the station was added
2013+ */
19602014 if (iwl_mvm_has_new_tx_api(mvm)) {
1961− int tvqm_queue =
1962− iwl_mvm_tvqm_enable_txq(mvm, sta_id,
1963− IWL_MAX_TID_COUNT,
1964− wdg_timeout);
1965− *queue = tvqm_queue;
1966− } else {
1967− struct iwl_trans_txq_scd_cfg cfg = {
1968− .fifo = fifo,
1969− .sta_id = sta_id,
1970− .tid = IWL_MAX_TID_COUNT,
1971− .aggregate = false,
1972− .frame_limit = IWL_FRAME_LIMIT,
1973− };
2015+ int txq;
19742016
1975− iwl_mvm_enable_txq(mvm, NULL, *queue, 0, &cfg, wdg_timeout);
2017+ txq = iwl_mvm_enable_aux_snif_queue_tvqm(mvm, sta->sta_id);
2018+ if (txq < 0) {
2019+ iwl_mvm_rm_sta_common(mvm, sta->sta_id);
2020+ return txq;
2021+ }
2022+
2023+ *queue = txq;
19762024 }
2025+
2026+ return 0;
19772027 }
19782028
19792029 int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm)
@@ -1989,59 +2039,26 @@ int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm) · 9 unmodified lines
19892039 if (ret)
19902040 return ret;
19912041
1992− /* Map Aux queue to fifo - needs to happen before adding Aux station */
1993− if (!iwl_mvm_has_new_tx_api(mvm))
1994− iwl_mvm_enable_aux_snif_queue(mvm, &mvm->aux_queue,
1995− mvm->aux_sta.sta_id,
1996− IWL_MVM_TX_FIFO_MCAST);
1997−
1998− ret = iwl_mvm_add_int_sta_common(mvm, &mvm->aux_sta, NULL,
1999− MAC_INDEX_AUX, 0);
2042+ ret = iwl_mvm_add_int_sta_with_queue(mvm, MAC_INDEX_AUX, 0,
2043+ &mvm->aux_sta, &mvm->aux_queue,
2044+ IWL_MVM_TX_FIFO_MCAST);
20002045 if (ret) {
20012046 iwl_mvm_dealloc_int_sta(mvm, &mvm->aux_sta);
20022047 return ret;
20032048 }
20042049
2005− /*
2006− * For 22000 firmware and on we cannot add queue to a station unknown
2007− * to firmware so enable queue here - after the station was added
2008− */
2009− if (iwl_mvm_has_new_tx_api(mvm))
2010− iwl_mvm_enable_aux_snif_queue(mvm, &mvm->aux_queue,
2011− mvm->aux_sta.sta_id,
2012− IWL_MVM_TX_FIFO_MCAST);
2013−
20142050 return 0;
20152051 }
20162052
20172053 int iwl_mvm_add_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
20182054 {
20192055 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
2020− int ret;
20212056
20222057 lockdep_assert_held(&mvm->mutex);
20232058
2024− /* Map snif queue to fifo - must happen before adding snif station */
2025− if (!iwl_mvm_has_new_tx_api(mvm))
2026− iwl_mvm_enable_aux_snif_queue(mvm, &mvm->snif_queue,
2027− mvm->snif_sta.sta_id,
2059+ return iwl_mvm_add_int_sta_with_queue(mvm, mvmvif->id, mvmvif->color,
2060+ &mvm->snif_sta, &mvm->snif_queue,
20282061 IWL_MVM_TX_FIFO_BE);
2029−
2030− ret = iwl_mvm_add_int_sta_common(mvm, &mvm->snif_sta, vif->addr,
2031− mvmvif->id, 0);
2032− if (ret)
2033− return ret;
2034−
2035− /*
2036− * For 22000 firmware and on we cannot add queue to a station unknown
2037− * to firmware so enable queue here - after the station was added
2038− */
2039− if (iwl_mvm_has_new_tx_api(mvm))
2040− iwl_mvm_enable_aux_snif_queue(mvm, &mvm->snif_queue,
2041− mvm->snif_sta.sta_id,
2042− IWL_MVM_TX_FIFO_BE);
2043−
2044− return 0;
20452062 }
20462063
20472064 int iwl_mvm_rm_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
@@ -2133,6 +2150,10 @@ int iwl_mvm_send_add_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) · 85 unmodified lines
21332150 queue = iwl_mvm_tvqm_enable_txq(mvm, bsta->sta_id,
21342151 IWL_MAX_TID_COUNT,
21352152 wdg_timeout);
2153+ if (queue < 0) {
2154+ iwl_mvm_rm_sta_common(mvm, bsta->sta_id);
2155+ return queue;
2156+ }
21362157
21372158 if (vif->type == NL80211_IFTYPE_AP ||
21382159 vif->type == NL80211_IFTYPE_ADHOC)
@@ -2307,10 +2328,8 @@ int iwl_mvm_add_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) · 168 unmodified lines
23072328 }
23082329 ret = iwl_mvm_add_int_sta_common(mvm, msta, maddr,
23092330 mvmvif->id, mvmvif->color);
2310− if (ret) {
2311− iwl_mvm_dealloc_int_sta(mvm, msta);
2312− return ret;
2313− }
2331+ if (ret)
2332+ goto err;
23142333
23152334 /*
23162335 * Enable cab queue after the ADD_STA command is sent.
@@ -2323,6 +2342,10 @@ int iwl_mvm_add_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) · 6 unmodified lines
23232342 int queue = iwl_mvm_tvqm_enable_txq(mvm, msta->sta_id,
23242343 0,
23252344 timeout);
2345+ if (queue < 0) {
2346+ ret = queue;
2347+ goto err;
2348+ }
23262349 mvmvif->cab_queue = queue;
23272350 } else if (!fw_has_api(&mvm->fw->ucode_capa,
23282351 IWL_UCODE_TLV_API_STA_TYPE))
@@ -2330,6 +2353,9 @@ int iwl_mvm_add_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) · 1 unmodified line
23302353 timeout);
23312354
23322355 return 0;
2356+err:
2357+ iwl_mvm_dealloc_int_sta(mvm, msta);
2358+ return ret;
23332359 }
23342360
23352361 static int __iwl_mvm_remove_sta_key(struct iwl_mvm *mvm, u8 sta_id,
drivers/net/wireless/intel/iwlwifi/pcie/drv.c+64−67
@@ -573,20 +573,20 @@ static const struct pci_device_id iwl_hw_card_ids[] = { · 572 unmodified lines
573573 {IWL_PCI_DEVICE(0x2526, 0x0034, iwl9560_2ac_cfg)},
574574 {IWL_PCI_DEVICE(0x2526, 0x0038, iwl9560_2ac_160_cfg)},
575575 {IWL_PCI_DEVICE(0x2526, 0x003C, iwl9560_2ac_160_cfg)},
576− {IWL_PCI_DEVICE(0x2526, 0x0060, iwl9460_2ac_cfg)},
577− {IWL_PCI_DEVICE(0x2526, 0x0064, iwl9460_2ac_cfg)},
578− {IWL_PCI_DEVICE(0x2526, 0x00A0, iwl9460_2ac_cfg)},
579− {IWL_PCI_DEVICE(0x2526, 0x00A4, iwl9460_2ac_cfg)},
576+ {IWL_PCI_DEVICE(0x2526, 0x0060, iwl9461_2ac_cfg_soc)},
577+ {IWL_PCI_DEVICE(0x2526, 0x0064, iwl9461_2ac_cfg_soc)},
578+ {IWL_PCI_DEVICE(0x2526, 0x00A0, iwl9462_2ac_cfg_soc)},
579+ {IWL_PCI_DEVICE(0x2526, 0x00A4, iwl9462_2ac_cfg_soc)},
580580 {IWL_PCI_DEVICE(0x2526, 0x0210, iwl9260_2ac_cfg)},
581581 {IWL_PCI_DEVICE(0x2526, 0x0214, iwl9260_2ac_cfg)},
582582 {IWL_PCI_DEVICE(0x2526, 0x0230, iwl9560_2ac_cfg)},
583583 {IWL_PCI_DEVICE(0x2526, 0x0234, iwl9560_2ac_cfg)},
584584 {IWL_PCI_DEVICE(0x2526, 0x0238, iwl9560_2ac_cfg)},
585585 {IWL_PCI_DEVICE(0x2526, 0x023C, iwl9560_2ac_cfg)},
586− {IWL_PCI_DEVICE(0x2526, 0x0260, iwl9460_2ac_cfg)},
586+ {IWL_PCI_DEVICE(0x2526, 0x0260, iwl9461_2ac_cfg_soc)},
587587 {IWL_PCI_DEVICE(0x2526, 0x0264, iwl9461_2ac_cfg_soc)},
588− {IWL_PCI_DEVICE(0x2526, 0x02A0, iwl9460_2ac_cfg)},
589− {IWL_PCI_DEVICE(0x2526, 0x02A4, iwl9460_2ac_cfg)},
588+ {IWL_PCI_DEVICE(0x2526, 0x02A0, iwl9462_2ac_cfg_soc)},
589+ {IWL_PCI_DEVICE(0x2526, 0x02A4, iwl9462_2ac_cfg_soc)},
590590 {IWL_PCI_DEVICE(0x2526, 0x1010, iwl9260_2ac_cfg)},
591591 {IWL_PCI_DEVICE(0x2526, 0x1030, iwl9560_2ac_cfg)},
592592 {IWL_PCI_DEVICE(0x2526, 0x1210, iwl9260_2ac_cfg)},
@@ -603,7 +603,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = { · 10 unmodified lines
603603 {IWL_PCI_DEVICE(0x2526, 0x401C, iwl9260_2ac_160_cfg)},
604604 {IWL_PCI_DEVICE(0x2526, 0x4030, iwl9560_2ac_160_cfg)},
605605 {IWL_PCI_DEVICE(0x2526, 0x4034, iwl9560_2ac_160_cfg_soc)},
606− {IWL_PCI_DEVICE(0x2526, 0x40A4, iwl9460_2ac_cfg)},
606+ {IWL_PCI_DEVICE(0x2526, 0x40A4, iwl9462_2ac_cfg_soc)},
607607 {IWL_PCI_DEVICE(0x2526, 0x4234, iwl9560_2ac_cfg_soc)},
608608 {IWL_PCI_DEVICE(0x2526, 0x42A4, iwl9462_2ac_cfg_soc)},
609609 {IWL_PCI_DEVICE(0x2526, 0x6010, iwl9260_2ac_160_cfg)},
@@ -618,60 +618,61 @@ static const struct pci_device_id iwl_hw_card_ids[] = { · 8 unmodified lines
618618 {IWL_PCI_DEVICE(0x271B, 0x0210, iwl9160_2ac_cfg)},
619619 {IWL_PCI_DEVICE(0x271B, 0x0214, iwl9260_2ac_cfg)},
620620 {IWL_PCI_DEVICE(0x271C, 0x0214, iwl9260_2ac_cfg)},
621− {IWL_PCI_DEVICE(0x2720, 0x0034, iwl9560_2ac_160_cfg)},
622− {IWL_PCI_DEVICE(0x2720, 0x0038, iwl9560_2ac_160_cfg)},
623− {IWL_PCI_DEVICE(0x2720, 0x003C, iwl9560_2ac_160_cfg)},
624− {IWL_PCI_DEVICE(0x2720, 0x0060, iwl9461_2ac_cfg_soc)},
625− {IWL_PCI_DEVICE(0x2720, 0x0064, iwl9461_2ac_cfg_soc)},
626− {IWL_PCI_DEVICE(0x2720, 0x00A0, iwl9462_2ac_cfg_soc)},
627− {IWL_PCI_DEVICE(0x2720, 0x00A4, iwl9462_2ac_cfg_soc)},
628− {IWL_PCI_DEVICE(0x2720, 0x0230, iwl9560_2ac_cfg)},
629− {IWL_PCI_DEVICE(0x2720, 0x0234, iwl9560_2ac_cfg)},
630− {IWL_PCI_DEVICE(0x2720, 0x0238, iwl9560_2ac_cfg)},
631− {IWL_PCI_DEVICE(0x2720, 0x023C, iwl9560_2ac_cfg)},
632− {IWL_PCI_DEVICE(0x2720, 0x0260, iwl9461_2ac_cfg_soc)},
633− {IWL_PCI_DEVICE(0x2720, 0x0264, iwl9461_2ac_cfg_soc)},
634− {IWL_PCI_DEVICE(0x2720, 0x02A0, iwl9462_2ac_cfg_soc)},
635− {IWL_PCI_DEVICE(0x2720, 0x02A4, iwl9462_2ac_cfg_soc)},
636− {IWL_PCI_DEVICE(0x2720, 0x1010, iwl9260_2ac_cfg)},
637− {IWL_PCI_DEVICE(0x2720, 0x1030, iwl9560_2ac_cfg_soc)},
638− {IWL_PCI_DEVICE(0x2720, 0x1210, iwl9260_2ac_cfg)},
639− {IWL_PCI_DEVICE(0x2720, 0x1551, iwl9560_killer_s_2ac_cfg_soc)},
640− {IWL_PCI_DEVICE(0x2720, 0x1552, iwl9560_killer_2ac_cfg_soc)},
641− {IWL_PCI_DEVICE(0x2720, 0x2030, iwl9560_2ac_160_cfg_soc)},
642− {IWL_PCI_DEVICE(0x2720, 0x2034, iwl9560_2ac_160_cfg_soc)},
643− {IWL_PCI_DEVICE(0x2720, 0x4030, iwl9560_2ac_160_cfg)},
644− {IWL_PCI_DEVICE(0x2720, 0x4034, iwl9560_2ac_160_cfg_soc)},
645− {IWL_PCI_DEVICE(0x2720, 0x40A4, iwl9462_2ac_cfg_soc)},
646− {IWL_PCI_DEVICE(0x2720, 0x4234, iwl9560_2ac_cfg_soc)},
647− {IWL_PCI_DEVICE(0x2720, 0x42A4, iwl9462_2ac_cfg_soc)},
648−
649− {IWL_PCI_DEVICE(0x30DC, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
650− {IWL_PCI_DEVICE(0x30DC, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)},
651− {IWL_PCI_DEVICE(0x30DC, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
652− {IWL_PCI_DEVICE(0x30DC, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
653− {IWL_PCI_DEVICE(0x30DC, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)},
654− {IWL_PCI_DEVICE(0x30DC, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)},
655− {IWL_PCI_DEVICE(0x30DC, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
656− {IWL_PCI_DEVICE(0x30DC, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
657− {IWL_PCI_DEVICE(0x30DC, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)},
658− {IWL_PCI_DEVICE(0x30DC, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
659− {IWL_PCI_DEVICE(0x30DC, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)},
660− {IWL_PCI_DEVICE(0x30DC, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)},
661− {IWL_PCI_DEVICE(0x30DC, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)},
662− {IWL_PCI_DEVICE(0x30DC, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)},
663− {IWL_PCI_DEVICE(0x30DC, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
664− {IWL_PCI_DEVICE(0x30DC, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
665− {IWL_PCI_DEVICE(0x30DC, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)},
666− {IWL_PCI_DEVICE(0x30DC, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)},
667− {IWL_PCI_DEVICE(0x30DC, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)},
668− {IWL_PCI_DEVICE(0x30DC, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
669− {IWL_PCI_DEVICE(0x30DC, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
670− {IWL_PCI_DEVICE(0x30DC, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
671− {IWL_PCI_DEVICE(0x30DC, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
672− {IWL_PCI_DEVICE(0x30DC, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
673− {IWL_PCI_DEVICE(0x30DC, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
674− {IWL_PCI_DEVICE(0x30DC, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
621+
622+ {IWL_PCI_DEVICE(0x2720, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)},
623+ {IWL_PCI_DEVICE(0x2720, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
624+ {IWL_PCI_DEVICE(0x2720, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
625+ {IWL_PCI_DEVICE(0x2720, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)},
626+ {IWL_PCI_DEVICE(0x2720, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)},
627+ {IWL_PCI_DEVICE(0x2720, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
628+ {IWL_PCI_DEVICE(0x2720, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
629+ {IWL_PCI_DEVICE(0x2720, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)},
630+ {IWL_PCI_DEVICE(0x2720, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
631+ {IWL_PCI_DEVICE(0x2720, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)},
632+ {IWL_PCI_DEVICE(0x2720, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)},
633+ {IWL_PCI_DEVICE(0x2720, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)},
634+ {IWL_PCI_DEVICE(0x2720, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)},
635+ {IWL_PCI_DEVICE(0x2720, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
636+ {IWL_PCI_DEVICE(0x2720, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
637+ {IWL_PCI_DEVICE(0x2720, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)},
638+ {IWL_PCI_DEVICE(0x2720, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)},
639+ {IWL_PCI_DEVICE(0x2720, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)},
640+ {IWL_PCI_DEVICE(0x2720, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
641+ {IWL_PCI_DEVICE(0x2720, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
642+ {IWL_PCI_DEVICE(0x2720, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
643+ {IWL_PCI_DEVICE(0x2720, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
644+ {IWL_PCI_DEVICE(0x2720, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
645+ {IWL_PCI_DEVICE(0x2720, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
646+ {IWL_PCI_DEVICE(0x2720, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
647+
648+ {IWL_PCI_DEVICE(0x30DC, 0x0030, iwl9560_2ac_160_cfg_soc)},
649+ {IWL_PCI_DEVICE(0x30DC, 0x0034, iwl9560_2ac_cfg_soc)},
650+ {IWL_PCI_DEVICE(0x30DC, 0x0038, iwl9560_2ac_160_cfg_soc)},
651+ {IWL_PCI_DEVICE(0x30DC, 0x003C, iwl9560_2ac_160_cfg_soc)},
652+ {IWL_PCI_DEVICE(0x30DC, 0x0060, iwl9460_2ac_cfg_soc)},
653+ {IWL_PCI_DEVICE(0x30DC, 0x0064, iwl9461_2ac_cfg_soc)},
654+ {IWL_PCI_DEVICE(0x30DC, 0x00A0, iwl9462_2ac_cfg_soc)},
655+ {IWL_PCI_DEVICE(0x30DC, 0x00A4, iwl9462_2ac_cfg_soc)},
656+ {IWL_PCI_DEVICE(0x30DC, 0x0230, iwl9560_2ac_cfg_soc)},
657+ {IWL_PCI_DEVICE(0x30DC, 0x0234, iwl9560_2ac_cfg_soc)},
658+ {IWL_PCI_DEVICE(0x30DC, 0x0238, iwl9560_2ac_cfg_soc)},
659+ {IWL_PCI_DEVICE(0x30DC, 0x023C, iwl9560_2ac_cfg_soc)},
660+ {IWL_PCI_DEVICE(0x30DC, 0x0260, iwl9461_2ac_cfg_soc)},
661+ {IWL_PCI_DEVICE(0x30DC, 0x0264, iwl9461_2ac_cfg_soc)},
662+ {IWL_PCI_DEVICE(0x30DC, 0x02A0, iwl9462_2ac_cfg_soc)},
663+ {IWL_PCI_DEVICE(0x30DC, 0x02A4, iwl9462_2ac_cfg_soc)},
664+ {IWL_PCI_DEVICE(0x30DC, 0x1010, iwl9260_2ac_cfg)},
665+ {IWL_PCI_DEVICE(0x30DC, 0x1030, iwl9560_2ac_cfg_soc)},
666+ {IWL_PCI_DEVICE(0x30DC, 0x1210, iwl9260_2ac_cfg)},
667+ {IWL_PCI_DEVICE(0x30DC, 0x1551, iwl9560_killer_s_2ac_cfg_soc)},
668+ {IWL_PCI_DEVICE(0x30DC, 0x1552, iwl9560_killer_2ac_cfg_soc)},
669+ {IWL_PCI_DEVICE(0x30DC, 0x2030, iwl9560_2ac_160_cfg_soc)},
670+ {IWL_PCI_DEVICE(0x30DC, 0x2034, iwl9560_2ac_160_cfg_soc)},
671+ {IWL_PCI_DEVICE(0x30DC, 0x4030, iwl9560_2ac_160_cfg_soc)},
672+ {IWL_PCI_DEVICE(0x30DC, 0x4034, iwl9560_2ac_160_cfg_soc)},
673+ {IWL_PCI_DEVICE(0x30DC, 0x40A4, iwl9462_2ac_cfg_soc)},
674+ {IWL_PCI_DEVICE(0x30DC, 0x4234, iwl9560_2ac_cfg_soc)},
675+ {IWL_PCI_DEVICE(0x30DC, 0x42A4, iwl9462_2ac_cfg_soc)},
675676
676677 {IWL_PCI_DEVICE(0x31DC, 0x0030, iwl9560_2ac_160_cfg_shared_clk)},
677678 {IWL_PCI_DEVICE(0x31DC, 0x0034, iwl9560_2ac_cfg_shared_clk)},
@@ -1067,11 +1068,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 389 unmodified lines
10671068 }
10681069 } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(iwl_trans->hw_rf_id) ==
10691070 CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR) &&
1070− ((cfg != &iwl_ax200_cfg_cc &&
1071− cfg != &killer1650x_2ax_cfg &&
1072− cfg != &killer1650w_2ax_cfg &&
1073− cfg != &iwl_ax201_cfg_quz_hr) ||
1074− iwl_trans->hw_rev == CSR_HW_REV_TYPE_QNJ_B0)) {
1071+ iwl_trans->hw_rev == CSR_HW_REV_TYPE_QNJ_B0) {
10751072 u32 hw_status;
10761073
10771074 hw_status = iwl_read_prph(iwl_trans, UMAG_GEN_HW_STATUS);
drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c+25−0
@@ -57,6 +57,24 @@ · 56 unmodified lines
5757 #include "internal.h"
5858 #include "fw/dbg.h"
5959
60+static int iwl_pcie_gen2_force_power_gating(struct iwl_trans *trans)
61+{
62+ iwl_set_bits_prph(trans, HPM_HIPM_GEN_CFG,
63+ HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE);
64+ udelay(20);
65+ iwl_set_bits_prph(trans, HPM_HIPM_GEN_CFG,
66+ HPM_HIPM_GEN_CFG_CR_PG_EN |
67+ HPM_HIPM_GEN_CFG_CR_SLP_EN);
68+ udelay(20);
69+ iwl_clear_bits_prph(trans, HPM_HIPM_GEN_CFG,
70+ HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE);
71+
72+ iwl_trans_sw_reset(trans);
73+ iwl_clear_bit(trans, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
74+
75+ return 0;
76+}
77+
6078 /*
6179 * Start up NIC's basic functionality after it has been reset
6280 * (e.g. after platform boot, or shutdown via iwl_pcie_apm_stop())
@@ -92,6 +110,13 @@ int iwl_pcie_gen2_apm_init(struct iwl_trans *trans) · 29 unmodified lines
92110
93111 iwl_pcie_apm_config(trans);
94112
113+ if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000 &&
114+ trans->cfg->integrated) {
115+ ret = iwl_pcie_gen2_force_power_gating(trans);
116+ if (ret)
117+ return ret;
118+ }
119+
95120 ret = iwl_finish_nic_init(trans, trans->trans_cfg);
96121 if (ret)
97122 return ret;
drivers/net/wireless/intersil/hostap/hostap_hw.c+0−25
@@ -3041,30 +3041,6 @@ static void prism2_clear_set_tim_queue(local_info_t *local) · 3040 unmodified lines
30413041 }
30423042 }
30433043
3044−
3045−/*
3046− * HostAP uses two layers of net devices, where the inner
3047− * layer gets called all the time from the outer layer.
3048− * This is a natural nesting, which needs a split lock type.
3049− */
3050−static struct lock_class_key hostap_netdev_xmit_lock_key;
3051−static struct lock_class_key hostap_netdev_addr_lock_key;
3052−
3053−static void prism2_set_lockdep_class_one(struct net_device *dev,
3054− struct netdev_queue *txq,
3055− void *_unused)
3056−{
3057− lockdep_set_class(&txq->_xmit_lock,
3058− &hostap_netdev_xmit_lock_key);
3059−}
3060−
3061−static void prism2_set_lockdep_class(struct net_device *dev)
3062−{
3063− lockdep_set_class(&dev->addr_list_lock,
3064− &hostap_netdev_addr_lock_key);
3065− netdev_for_each_tx_queue(dev, prism2_set_lockdep_class_one, NULL);
3066−}
3067−
30683044 static struct net_device *
30693045 prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx,
30703046 struct device *sdev)
@@ -3223,7 +3199,6 @@ while (0) · 152 unmodified lines
32233199 if (ret >= 0)
32243200 ret = register_netdevice(dev);
32253201
3226− prism2_set_lockdep_class(dev);
32273202 rtnl_unlock();
32283203 if (ret < 0) {
32293204 printk(KERN_WARNING "%s: register netdevice failed!\n",
drivers/net/wireless/mediatek/mt76/Makefile+2−0
@@ -8,6 +8,8 @@ mt76-y := \ · 7 unmodified lines
88 mmio.o util.o trace.o dma.o mac80211.o debugfs.o eeprom.o \
99 tx.o agg-rx.o mcu.o
1010
11+mt76-$(CONFIG_PCI) += pci.o
12+
1113 mt76-usb-y := usb.o usb_trace.o
1214
1315 CFLAGS_trace.o := -I$(src)
drivers/net/wireless/mediatek/mt76/dma.c+4−2
@@ -53,8 +53,10 @@ mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q, · 52 unmodified lines
5353 u32 ctrl;
5454 int i, idx = -1;
5555
56− if (txwi)
56+ if (txwi) {
5757 q->entry[q->head].txwi = DMA_DUMMY_DATA;
58+ q->entry[q->head].skip_buf0 = true;
59+ }
5860
5961 for (i = 0; i < nbufs; i += 2, buf += 2) {
6062 u32 buf0 = buf[0].addr, buf1 = 0;
@@ -97,7 +99,7 @@ mt76_dma_tx_cleanup_idx(struct mt76_dev *dev, struct mt76_queue *q, int idx, · 36 unmodified lines
9799 __le32 __ctrl = READ_ONCE(q->desc[idx].ctrl);
98100 u32 ctrl = le32_to_cpu(__ctrl);
99101
100− if (!e->txwi || !e->skb) {
102+ if (!e->skip_buf0) {
101103 __le32 addr = READ_ONCE(q->desc[idx].buf0);
102104 u32 len = FIELD_GET(MT_DMA_CTL_SD_LEN0, ctrl);
103105
drivers/net/wireless/mediatek/mt76/mt76.h+4−2
@@ -93,8 +93,9 @@ struct mt76_queue_entry { · 92 unmodified lines
9393 struct urb *urb;
9494 };
9595 enum mt76_txq_id qid;
96− bool schedule;
97− bool done;
96+ bool skip_buf0:1;
97+ bool schedule:1;
98+ bool done:1;
9899 };
99100
100101 struct mt76_queue_regs {
@@ -578,6 +579,7 @@ bool __mt76_poll_msec(struct mt76_dev *dev, u32 offset, u32 mask, u32 val, · 477 unmodified lines
578579 #define mt76_poll_msec(dev, ...) __mt76_poll_msec(&((dev)->mt76), __VA_ARGS__)
579580
580581 void mt76_mmio_init(struct mt76_dev *dev, void __iomem *regs);
582+void mt76_pci_disable_aspm(struct pci_dev *pdev);
581583
582584 static inline u16 mt76_chip(struct mt76_dev *dev)
583585 {
drivers/net/wireless/mediatek/mt76/mt76x2/pci.c+2−0
@@ -81,6 +81,8 @@ mt76pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 80 unmodified lines
8181 /* RG_SSUSB_CDR_BR_PE1D = 0x3 */
8282 mt76_rmw_field(dev, 0x15c58, 0x3 << 6, 0x3);
8383
84+ mt76_pci_disable_aspm(pdev);
85+
8486 return 0;
8587
8688 error:
drivers/net/wireless/mediatek/mt76/pci.c+46−0
@@ -0,0 +1,46 @@
1+// SPDX-License-Identifier: ISC
2+/*
3+ * Copyright (C) 2019 Lorenzo Bianconi <lorenzo@kernel.org>
4+ */
5+
6+#include <linux/pci.h>
7+
8+void mt76_pci_disable_aspm(struct pci_dev *pdev)
9+{
10+ struct pci_dev *parent = pdev->bus->self;
11+ u16 aspm_conf, parent_aspm_conf = 0;
12+
13+ pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &aspm_conf);
14+ aspm_conf &= PCI_EXP_LNKCTL_ASPMC;
15+ if (parent) {
16+ pcie_capability_read_word(parent, PCI_EXP_LNKCTL,
17+ &parent_aspm_conf);
18+ parent_aspm_conf &= PCI_EXP_LNKCTL_ASPMC;
19+ }
20+
21+ if (!aspm_conf && (!parent || !parent_aspm_conf)) {
22+ /* aspm already disabled */
23+ return;
24+ }
25+
26+ dev_info(&pdev->dev, "disabling ASPM %s %s\n",
27+ (aspm_conf & PCI_EXP_LNKCTL_ASPM_L0S) ? "L0s" : "",
28+ (aspm_conf & PCI_EXP_LNKCTL_ASPM_L1) ? "L1" : "");
29+
30+ if (IS_ENABLED(CONFIG_PCIEASPM)) {
31+ int err;
32+
33+ err = pci_disable_link_state(pdev, aspm_conf);
34+ if (!err)
35+ return;
36+ }
37+
38+ /* both device and parent should have the same ASPM setting.
39+ * disable ASPM in downstream component first and then upstream.
40+ */
41+ pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL, aspm_conf);
42+ if (parent)
43+ pcie_capability_clear_word(parent, PCI_EXP_LNKCTL,
44+ aspm_conf);
45+}
46+EXPORT_SYMBOL_GPL(mt76_pci_disable_aspm);
drivers/net/wireless/realtek/rtlwifi/pci.c+2−1
@@ -822,7 +822,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) · 821 unmodified lines
822822 hdr = rtl_get_hdr(skb);
823823 fc = rtl_get_fc(skb);
824824
825− if (!stats.crc && !stats.hwerror) {
825+ if (!stats.crc && !stats.hwerror && (skb->len > FCS_LEN)) {
826826 memcpy(IEEE80211_SKB_RXCB(skb), &rx_status,
827827 sizeof(rx_status));
828828
@@ -859,6 +859,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) · 30 unmodified lines
859859 _rtl_pci_rx_to_mac80211(hw, skb, rx_status);
860860 }
861861 } else {
862+ /* drop packets with errors or those too short */
862863 dev_kfree_skb_any(skb);
863864 }
864865 new_trx_end:
drivers/net/wireless/realtek/rtlwifi/ps.c+6−0
@@ -754,6 +754,9 @@ static void rtl_p2p_noa_ie(struct ieee80211_hw *hw, void *data, · 753 unmodified lines
754754 return;
755755 } else {
756756 noa_num = (noa_len - 2) / 13;
757+ if (noa_num > P2P_MAX_NOA_NUM)
758+ noa_num = P2P_MAX_NOA_NUM;
759+
757760 }
758761 noa_index = ie[3];
759762 if (rtlpriv->psc.p2p_ps_info.p2p_ps_mode ==
@@ -848,6 +851,9 @@ static void rtl_p2p_action_ie(struct ieee80211_hw *hw, void *data, · 88 unmodified lines
848851 return;
849852 } else {
850853 noa_num = (noa_len - 2) / 13;
854+ if (noa_num > P2P_MAX_NOA_NUM)
855+ noa_num = P2P_MAX_NOA_NUM;
856+
851857 }
852858 noa_index = ie[3];
853859 if (rtlpriv->psc.p2p_ps_info.p2p_ps_mode ==
drivers/net/wireless/virt_wifi.c+52−2
@@ -548,6 +548,7 @@ static int virt_wifi_newlink(struct net *src_net, struct net_device *dev, · 547 unmodified lines
548548 priv->is_connected = false;
549549 priv->is_up = false;
550550 INIT_DELAYED_WORK(&priv->connect, virt_wifi_connect_complete);
551+ __module_get(THIS_MODULE);
551552
552553 return 0;
553554 unregister_netdev:
@@ -578,6 +579,7 @@ static void virt_wifi_dellink(struct net_device *dev, · 24 unmodified lines
578579 netdev_upper_dev_unlink(priv->lowerdev, dev);
579580
580581 unregister_netdevice_queue(dev, head);
582+ module_put(THIS_MODULE);
581583
582584 /* Deleting the wiphy is handled in the module destructor. */
583585 }
@@ -590,6 +592,42 @@ static struct rtnl_link_ops virt_wifi_link_ops = { · 6 unmodified lines
590592 .priv_size = sizeof(struct virt_wifi_netdev_priv),
591593 };
592594
595+static bool netif_is_virt_wifi_dev(const struct net_device *dev)
596+{
597+ return rcu_access_pointer(dev->rx_handler) == virt_wifi_rx_handler;
598+}
599+
600+static int virt_wifi_event(struct notifier_block *this, unsigned long event,
601+ void *ptr)
602+{
603+ struct net_device *lower_dev = netdev_notifier_info_to_dev(ptr);
604+ struct virt_wifi_netdev_priv *priv;
605+ struct net_device *upper_dev;
606+ LIST_HEAD(list_kill);
607+
608+ if (!netif_is_virt_wifi_dev(lower_dev))
609+ return NOTIFY_DONE;
610+
611+ switch (event) {
612+ case NETDEV_UNREGISTER:
613+ priv = rtnl_dereference(lower_dev->rx_handler_data);
614+ if (!priv)
615+ return NOTIFY_DONE;
616+
617+ upper_dev = priv->upperdev;
618+
619+ upper_dev->rtnl_link_ops->dellink(upper_dev, &list_kill);
620+ unregister_netdevice_many(&list_kill);
621+ break;
622+ }
623+
624+ return NOTIFY_DONE;
625+}
626+
627+static struct notifier_block virt_wifi_notifier = {
628+ .notifier_call = virt_wifi_event,
629+};
630+
593631 /* Acquires and releases the rtnl lock. */
594632 static int __init virt_wifi_init_module(void)
595633 {
@@ -598,14 +636,25 @@ static int __init virt_wifi_init_module(void) · 2 unmodified lines
598636 /* Guaranteed to be locallly-administered and not multicast. */
599637 eth_random_addr(fake_router_bssid);
600638
639+ err = register_netdevice_notifier(&virt_wifi_notifier);
640+ if (err)
641+ return err;
642+
643+ err = -ENOMEM;
601644 common_wiphy = virt_wifi_make_wiphy();
602645 if (!common_wiphy)
603− return -ENOMEM;
646+ goto notifier;
604647
605648 err = rtnl_link_register(&virt_wifi_link_ops);
606649 if (err)
607− virt_wifi_destroy_wiphy(common_wiphy);
650+ goto destroy_wiphy;
608651
652+ return 0;
653+
654+destroy_wiphy:
655+ virt_wifi_destroy_wiphy(common_wiphy);
656+notifier:
657+ unregister_netdevice_notifier(&virt_wifi_notifier);
609658 return err;
610659 }
611660
@@ -615,6 +664,7 @@ static void __exit virt_wifi_cleanup_module(void) · 3 unmodified lines
615664 /* Will delete any devices that depend on the wiphy. */
616665 rtnl_link_unregister(&virt_wifi_link_ops);
617666 virt_wifi_destroy_wiphy(common_wiphy);
667+ unregister_netdevice_notifier(&virt_wifi_notifier);
618668 }
619669
620670 module_init(virt_wifi_init_module);
drivers/nfc/fdp/i2c.c+1−1
@@ -259,7 +259,7 @@ static void fdp_nci_i2c_read_device_properties(struct device *dev, · 258 unmodified lines
259259 *fw_vsc_cfg, len);
260260
261261 if (r) {
262− devm_kfree(dev, fw_vsc_cfg);
262+ devm_kfree(dev, *fw_vsc_cfg);
263263 goto vsc_read_err;
264264 }
265265 } else {
drivers/nfc/st21nfca/core.c+1−0
@@ -708,6 +708,7 @@ static int st21nfca_hci_complete_target_discovered(struct nfc_hci_dev *hdev, · 707 unmodified lines
708708 NFC_PROTO_FELICA_MASK;
709709 } else {
710710 kfree_skb(nfcid_skb);
711+ nfcid_skb = NULL;
711712 /* P2P in type A */
712713 r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_F_GATE,
713714 ST21NFCA_RF_READER_F_NFCID1,
drivers/nvme/host/multipath.c+6−5
@@ -158,9 +158,11 @@ void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl) · 157 unmodified lines
158158 struct nvme_ns *ns;
159159
160160 mutex_lock(&ctrl->scan_lock);
161+ down_read(&ctrl->namespaces_rwsem);
161162 list_for_each_entry(ns, &ctrl->namespaces, list)
162163 if (nvme_mpath_clear_current_path(ns))
163164 kblockd_schedule_work(&ns->head->requeue_work);
165+ up_read(&ctrl->namespaces_rwsem);
164166 mutex_unlock(&ctrl->scan_lock);
165167 }
166168
@@ -522,14 +524,13 @@ static int nvme_update_ana_state(struct nvme_ctrl *ctrl, · 355 unmodified lines
522524 return 0;
523525 }
524526
525−static int nvme_read_ana_log(struct nvme_ctrl *ctrl, bool groups_only)
527+static int nvme_read_ana_log(struct nvme_ctrl *ctrl)
526528 {
527529 u32 nr_change_groups = 0;
528530 int error;
529531
530532 mutex_lock(&ctrl->ana_lock);
531− error = nvme_get_log(ctrl, NVME_NSID_ALL, NVME_LOG_ANA,
532− groups_only ? NVME_ANA_LOG_RGO : 0,
533+ error = nvme_get_log(ctrl, NVME_NSID_ALL, NVME_LOG_ANA, 0,
533534 ctrl->ana_log_buf, ctrl->ana_log_size, 0);
534535 if (error) {
535536 dev_warn(ctrl->device, "Failed to get ANA log: %d\n", error);
@@ -565,7 +566,7 @@ static void nvme_ana_work(struct work_struct *work) · 29 unmodified lines
565566 {
566567 struct nvme_ctrl *ctrl = container_of(work, struct nvme_ctrl, ana_work);
567568
568− nvme_read_ana_log(ctrl, false);
569+ nvme_read_ana_log(ctrl);
569570 }
570571
571572 static void nvme_anatt_timeout(struct timer_list *t)
@@ -715,7 +716,7 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) · 143 unmodified lines
715716 goto out;
716717 }
717718
718− error = nvme_read_ana_log(ctrl, true);
719+ error = nvme_read_ana_log(ctrl);
719720 if (error)
720721 goto out_free_ana_log_buf;
721722 return 0;
drivers/nvme/host/rdma.c+8−0
@@ -2133,8 +2133,16 @@ err_unreg_client: · 2132 unmodified lines
21332133
21342134 static void __exit nvme_rdma_cleanup_module(void)
21352135 {
2136+ struct nvme_rdma_ctrl *ctrl;
2137+
21362138 nvmf_unregister_transport(&nvme_rdma_transport);
21372139 ib_unregister_client(&nvme_rdma_ib_client);
2140+
2141+ mutex_lock(&nvme_rdma_ctrl_mutex);
2142+ list_for_each_entry(ctrl, &nvme_rdma_ctrl_list, list)
2143+ nvme_delete_ctrl(&ctrl->ctrl);
2144+ mutex_unlock(&nvme_rdma_ctrl_mutex);
2145+ flush_workqueue(nvme_delete_wq);
21382146 }
21392147
21402148 module_init(nvme_rdma_init_module);
drivers/nvme/host/tcp.c+1−1
@@ -2219,7 +2219,7 @@ static int nvme_tcp_poll(struct blk_mq_hw_ctx *hctx) · 2218 unmodified lines
22192219 struct nvme_tcp_queue *queue = hctx->driver_data;
22202220 struct sock *sk = queue->sock->sk;
22212221
2222− if (sk_can_busy_loop(sk) && skb_queue_empty(&sk->sk_receive_queue))
2222+ if (sk_can_busy_loop(sk) && skb_queue_empty_lockless(&sk->sk_receive_queue))
22232223 sk_busy_loop(sk, true);
22242224 nvme_tcp_try_recv(queue);
22252225 return queue->nr_cqe;
drivers/pinctrl/intel/pinctrl-cherryview.c+13−13
@@ -147,6 +147,7 @@ struct chv_pin_context { · 146 unmodified lines
147147 * @pctldesc: Pin controller description
148148 * @pctldev: Pointer to the pin controller device
149149 * @chip: GPIO chip in this pin controller
150+ * @irqchip: IRQ chip in this pin controller
150151 * @regs: MMIO registers
151152 * @intr_lines: Stores mapping between 16 HW interrupt wires and GPIO
152153 * offset (in GPIO number space)
@@ -162,6 +163,7 @@ struct chv_pinctrl { · 9 unmodified lines
162163 struct pinctrl_desc pctldesc;
163164 struct pinctrl_dev *pctldev;
164165 struct gpio_chip chip;
166+ struct irq_chip irqchip;
165167 void __iomem *regs;
166168 unsigned intr_lines[16];
167169 const struct chv_community *community;
@@ -1466,16 +1468,6 @@ static int chv_gpio_irq_type(struct irq_data *d, unsigned int type) · 1298 unmodified lines
14661468 return 0;
14671469 }
14681470
1469−static struct irq_chip chv_gpio_irqchip = {
1470− .name = "chv-gpio",
1471− .irq_startup = chv_gpio_irq_startup,
1472− .irq_ack = chv_gpio_irq_ack,
1473− .irq_mask = chv_gpio_irq_mask,
1474− .irq_unmask = chv_gpio_irq_unmask,
1475− .irq_set_type = chv_gpio_irq_type,
1476− .flags = IRQCHIP_SKIP_SET_WAKE,
1477−};
1478−
14791471 static void chv_gpio_irq_handler(struct irq_desc *desc)
14801472 {
14811473 struct gpio_chip *gc = irq_desc_get_handler_data(desc);
@@ -1559,7 +1551,7 @@ static void chv_init_irq_valid_mask(struct gpio_chip *chip, · 77 unmodified lines
15591551 intsel >>= CHV_PADCTRL0_INTSEL_SHIFT;
15601552
15611553 if (intsel >= community->nirqs)
1562− clear_bit(i, valid_mask);
1554+ clear_bit(desc->number, valid_mask);
15631555 }
15641556 }
15651557
@@ -1625,7 +1617,15 @@ static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq) · 59 unmodified lines
16251617 }
16261618 }
16271619
1628− ret = gpiochip_irqchip_add(chip, &chv_gpio_irqchip, 0,
1620+ pctrl->irqchip.name = "chv-gpio";
1621+ pctrl->irqchip.irq_startup = chv_gpio_irq_startup;
1622+ pctrl->irqchip.irq_ack = chv_gpio_irq_ack;
1623+ pctrl->irqchip.irq_mask = chv_gpio_irq_mask;
1624+ pctrl->irqchip.irq_unmask = chv_gpio_irq_unmask;
1625+ pctrl->irqchip.irq_set_type = chv_gpio_irq_type;
1626+ pctrl->irqchip.flags = IRQCHIP_SKIP_SET_WAKE;
1627+
1628+ ret = gpiochip_irqchip_add(chip, &pctrl->irqchip, 0,
16291629 handle_bad_irq, IRQ_TYPE_NONE);
16301630 if (ret) {
16311631 dev_err(pctrl->dev, "failed to add IRQ chip\n");
@@ -1642,7 +1642,7 @@ static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq) · 10 unmodified lines
16421642 }
16431643 }
16441644
1645− gpiochip_set_chained_irqchip(chip, &chv_gpio_irqchip, irq,
1645+ gpiochip_set_chained_irqchip(chip, &pctrl->irqchip, irq,
16461646 chv_gpio_irq_handler);
16471647 return 0;
16481648 }
drivers/pinctrl/intel/pinctrl-intel.c+20−1
@@ -52,6 +52,7 @@ · 51 unmodified lines
5252 #define PADCFG0_GPIROUTNMI BIT(17)
5353 #define PADCFG0_PMODE_SHIFT 10
5454 #define PADCFG0_PMODE_MASK GENMASK(13, 10)
55+#define PADCFG0_PMODE_GPIO 0
5556 #define PADCFG0_GPIORXDIS BIT(9)
5657 #define PADCFG0_GPIOTXDIS BIT(8)
5758 #define PADCFG0_GPIORXSTATE BIT(1)
@@ -332,7 +333,7 @@ static void intel_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, · 274 unmodified lines
332333 cfg1 = readl(intel_get_padcfg(pctrl, pin, PADCFG1));
333334
334335 mode = (cfg0 & PADCFG0_PMODE_MASK) >> PADCFG0_PMODE_SHIFT;
335− if (!mode)
336+ if (mode == PADCFG0_PMODE_GPIO)
336337 seq_puts(s, "GPIO ");
337338 else
338339 seq_printf(s, "mode %d ", mode);
@@ -458,6 +459,11 @@ static void __intel_gpio_set_direction(void __iomem *padcfg0, bool input) · 119 unmodified lines
458459 writel(value, padcfg0);
459460 }
460461
462+static int intel_gpio_get_gpio_mode(void __iomem *padcfg0)
463+{
464+ return (readl(padcfg0) & PADCFG0_PMODE_MASK) >> PADCFG0_PMODE_SHIFT;
465+}
466+
461467 static void intel_gpio_set_gpio_mode(void __iomem *padcfg0)
462468 {
463469 u32 value;
@@ -491,7 +497,20 @@ static int intel_gpio_request_enable(struct pinctrl_dev *pctldev, · 27 unmodified lines
491497 }
492498
493499 padcfg0 = intel_get_padcfg(pctrl, pin, PADCFG0);
500+
501+ /*
502+ * If pin is already configured in GPIO mode, we assume that
503+ * firmware provides correct settings. In such case we avoid
504+ * potential glitches on the pin. Otherwise, for the pin in
505+ * alternative mode, consumer has to supply respective flags.
506+ */
507+ if (intel_gpio_get_gpio_mode(padcfg0) == PADCFG0_PMODE_GPIO) {
508+ raw_spin_unlock_irqrestore(&pctrl->lock, flags);
509+ return 0;
510+ }
511+
494512 intel_gpio_set_gpio_mode(padcfg0);
513+
495514 /* Disable TX buffer and enable RX (this will be input) */
496515 __intel_gpio_set_direction(padcfg0, true);
497516
drivers/pinctrl/pinctrl-stmfx.c+0−14
@@ -585,19 +585,6 @@ static int stmfx_pinctrl_gpio_function_enable(struct stmfx_pinctrl *pctl) · 584 unmodified lines
585585 return stmfx_function_enable(pctl->stmfx, func);
586586 }
587587
588−static int stmfx_pinctrl_gpio_init_valid_mask(struct gpio_chip *gc,
589− unsigned long *valid_mask,
590− unsigned int ngpios)
591−{
592− struct stmfx_pinctrl *pctl = gpiochip_get_data(gc);
593− u32 n;
594−
595− for_each_clear_bit(n, &pctl->gpio_valid_mask, ngpios)
596− clear_bit(n, valid_mask);
597−
598− return 0;
599−}
600−
601588 static int stmfx_pinctrl_probe(struct platform_device *pdev)
602589 {
603590 struct stmfx *stmfx = dev_get_drvdata(pdev->dev.parent);
@@ -660,7 +647,6 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev) · 56 unmodified lines
660647 pctl->gpio_chip.ngpio = pctl->pctl_desc.npins;
661648 pctl->gpio_chip.can_sleep = true;
662649 pctl->gpio_chip.of_node = np;
663− pctl->gpio_chip.init_valid_mask = stmfx_pinctrl_gpio_init_valid_mask;
664650
665651 ret = devm_gpiochip_add_data(pctl->dev, &pctl->gpio_chip, pctl);
666652 if (ret) {
drivers/pwm/core.c+1−8
@@ -472,14 +472,7 @@ int pwm_apply_state(struct pwm_device *pwm, const struct pwm_state *state) · 471 unmodified lines
472472 if (err)
473473 return err;
474474
475− /*
476− * .apply might have to round some values in *state, if possible
477− * read the actually implemented value back.
478− */
479− if (chip->ops->get_state)
480− chip->ops->get_state(chip, pwm, &pwm->state);
481− else
482− pwm->state = *state;
475+ pwm->state = *state;
483476 } else {
484477 /*
485478 * FIXME: restore the initial state in case of error.
drivers/pwm/pwm-bcm-iproc.c+1−0
@@ -187,6 +187,7 @@ static int iproc_pwmc_apply(struct pwm_chip *chip, struct pwm_device *pwm, · 186 unmodified lines
187187 static const struct pwm_ops iproc_pwm_ops = {
188188 .apply = iproc_pwmc_apply,
189189 .get_state = iproc_pwmc_get_state,
190+ .owner = THIS_MODULE,
190191 };
191192
192193 static int iproc_pwmc_probe(struct platform_device *pdev)
drivers/reset/core.c+3−2
@@ -76,7 +76,6 @@ static const char *rcdev_name(struct reset_controller_dev *rcdev) · 75 unmodified lines
7676 * of_reset_simple_xlate - translate reset_spec to the reset line number
7777 * @rcdev: a pointer to the reset controller device
7878 * @reset_spec: reset line specifier as found in the device tree
79− * @flags: a flags pointer to fill in (optional)
8079 *
8180 * This simple translation function should be used for reset controllers
8281 * with 1:1 mapping, where reset lines can be indexed by number without gaps.
@@ -748,6 +747,7 @@ static void reset_control_array_put(struct reset_control_array *resets) · 665 unmodified lines
748747 for (i = 0; i < resets->num_rstcs; i++)
749748 __reset_control_put_internal(resets->rstc[i]);
750749 mutex_unlock(&reset_list_mutex);
750+ kfree(resets);
751751 }
752752
753753 /**
@@ -825,9 +825,10 @@ int __device_reset(struct device *dev, bool optional) · 71 unmodified lines
825825 }
826826 EXPORT_SYMBOL_GPL(__device_reset);
827827
828−/**
828+/*
829829 * APIs to manage an array of reset controls.
830830 */
831+
831832 /**
832833 * of_reset_control_get_count - Count number of resets available with a device
833834 *
drivers/scsi/lpfc/lpfc_nportdisc.c+2−2
@@ -851,9 +851,9 @@ lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 850 unmodified lines
851851
852852 if (!(vport->fc_flag & FC_PT2PT)) {
853853 /* Check config parameter use-adisc or FCP-2 */
854− if ((vport->cfg_use_adisc && (vport->fc_flag & FC_RSCN_MODE)) ||
854+ if (vport->cfg_use_adisc && ((vport->fc_flag & FC_RSCN_MODE) ||
855855 ((ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) &&
856− (ndlp->nlp_type & NLP_FCP_TARGET))) {
856+ (ndlp->nlp_type & NLP_FCP_TARGET)))) {
857857 spin_lock_irq(shost->host_lock);
858858 ndlp->nlp_flag |= NLP_NPR_ADISC;
859859 spin_unlock_irq(shost->host_lock);
drivers/scsi/lpfc/lpfc_sli.c+1−1
@@ -7866,7 +7866,7 @@ lpfc_sli4_process_missed_mbox_completions(struct lpfc_hba *phba) · 7865 unmodified lines
78667866 if (sli4_hba->hdwq) {
78677867 for (eqidx = 0; eqidx < phba->cfg_irq_chann; eqidx++) {
78687868 eq = phba->sli4_hba.hba_eq_hdl[eqidx].eq;
7869− if (eq->queue_id == sli4_hba->mbx_cq->assoc_qid) {
7869+ if (eq && eq->queue_id == sli4_hba->mbx_cq->assoc_qid) {
78707870 fpeq = eq;
78717871 break;
78727872 }
drivers/scsi/qla2xxx/qla_attr.c+3−4
@@ -440,9 +440,6 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, · 439 unmodified lines
440440 valid = 0;
441441 if (ha->optrom_size == OPTROM_SIZE_2300 && start == 0)
442442 valid = 1;
443− else if (start == (ha->flt_region_boot * 4) ||
444− start == (ha->flt_region_fw * 4))
445− valid = 1;
446443 else if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha))
447444 valid = 1;
448445 if (!valid) {
@@ -489,8 +486,10 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, · 40 unmodified lines
489486 "Writing flash region -- 0x%x/0x%x.\n",
490487 ha->optrom_region_start, ha->optrom_region_size);
491488
492− ha->isp_ops->write_optrom(vha, ha->optrom_buffer,
489+ rval = ha->isp_ops->write_optrom(vha, ha->optrom_buffer,
493490 ha->optrom_region_start, ha->optrom_region_size);
491+ if (rval)
492+ rval = -EIO;
494493 break;
495494 default:
496495 rval = -EINVAL;
drivers/scsi/qla2xxx/qla_bsg.c+3−3
@@ -253,7 +253,7 @@ qla2x00_process_els(struct bsg_job *bsg_job) · 252 unmodified lines
253253 srb_t *sp;
254254 const char *type;
255255 int req_sg_cnt, rsp_sg_cnt;
256− int rval = (DRIVER_ERROR << 16);
256+ int rval = (DID_ERROR << 16);
257257 uint16_t nextlid = 0;
258258
259259 if (bsg_request->msgcode == FC_BSG_RPT_ELS) {
@@ -432,7 +432,7 @@ qla2x00_process_ct(struct bsg_job *bsg_job) · 172 unmodified lines
432432 struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
433433 scsi_qla_host_t *vha = shost_priv(host);
434434 struct qla_hw_data *ha = vha->hw;
435− int rval = (DRIVER_ERROR << 16);
435+ int rval = (DID_ERROR << 16);
436436 int req_sg_cnt, rsp_sg_cnt;
437437 uint16_t loop_id;
438438 struct fc_port *fcport;
@@ -1950,7 +1950,7 @@ qlafx00_mgmt_cmd(struct bsg_job *bsg_job) · 1511 unmodified lines
19501950 struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
19511951 scsi_qla_host_t *vha = shost_priv(host);
19521952 struct qla_hw_data *ha = vha->hw;
1953− int rval = (DRIVER_ERROR << 16);
1953+ int rval = (DID_ERROR << 16);
19541954 struct qla_mt_iocb_rqst_fx00 *piocb_rqst;
19551955 srb_t *sp;
19561956 int req_sg_cnt = 0, rsp_sg_cnt = 0;
drivers/scsi/qla2xxx/qla_mbx.c+2−1
@@ -702,6 +702,7 @@ qla2x00_execute_fw(scsi_qla_host_t *vha, uint32_t risc_addr) · 701 unmodified lines
702702 mcp->mb[2] = LSW(risc_addr);
703703 mcp->mb[3] = 0;
704704 mcp->mb[4] = 0;
705+ mcp->mb[11] = 0;
705706 ha->flags.using_lr_setting = 0;
706707 if (IS_QLA25XX(ha) || IS_QLA81XX(ha) || IS_QLA83XX(ha) ||
707708 IS_QLA27XX(ha) || IS_QLA28XX(ha)) {
@@ -746,7 +747,7 @@ qla2x00_execute_fw(scsi_qla_host_t *vha, uint32_t risc_addr) · 38 unmodified lines
746747 if (ha->flags.exchoffld_enabled)
747748 mcp->mb[4] |= ENABLE_EXCHANGE_OFFLD;
748749
749− mcp->out_mb |= MBX_4|MBX_3|MBX_2|MBX_1;
750+ mcp->out_mb |= MBX_4 | MBX_3 | MBX_2 | MBX_1 | MBX_11;
750751 mcp->in_mb |= MBX_3 | MBX_2 | MBX_1;
751752 } else {
752753 mcp->mb[1] = LSW(risc_addr);
drivers/scsi/qla2xxx/qla_os.c+4−0
@@ -3535,6 +3535,10 @@ qla2x00_shutdown(struct pci_dev *pdev) · 3534 unmodified lines
35353535 qla2x00_try_to_stop_firmware(vha);
35363536 }
35373537
3538+ /* Disable timer */
3539+ if (vha->timer_active)
3540+ qla2x00_stop_timer(vha);
3541+
35383542 /* Turn adapter off line */
35393543 vha->flags.online = 0;
35403544
drivers/scsi/sd.c+2−1
@@ -1166,11 +1166,12 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd) · 1165 unmodified lines
11661166 sector_t lba = sectors_to_logical(sdp, blk_rq_pos(rq));
11671167 sector_t threshold;
11681168 unsigned int nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq));
1169− bool dif, dix;
11701169 unsigned int mask = logical_to_sectors(sdp, 1) - 1;
11711170 bool write = rq_data_dir(rq) == WRITE;
11721171 unsigned char protect, fua;
11731172 blk_status_t ret;
1173+ unsigned int dif;
1174+ bool dix;
11741175
11751176 ret = scsi_init_io(cmd);
11761177 if (ret != BLK_STS_OK)
drivers/scsi/ufs/ufs_bsg.c+4−0
@@ -98,6 +98,8 @@ static int ufs_bsg_request(struct bsg_job *job) · 97 unmodified lines
9898
9999 bsg_reply->reply_payload_rcv_len = 0;
100100
101+ pm_runtime_get_sync(hba->dev);
102+
101103 msgcode = bsg_request->msgcode;
102104 switch (msgcode) {
103105 case UPIU_TRANSACTION_QUERY_REQ:
@@ -135,6 +137,8 @@ static int ufs_bsg_request(struct bsg_job *job) · 31 unmodified lines
135137 break;
136138 }
137139
140+ pm_runtime_put_sync(hba->dev);
141+
138142 if (!desc_buff)
139143 goto out;
140144
drivers/soc/imx/gpc.c+4−4
@@ -249,13 +249,13 @@ static struct genpd_power_state imx6_pm_domain_pu_state = { · 248 unmodified lines
249249 };
250250
251251 static struct imx_pm_domain imx_gpc_domains[] = {
252− [GPC_PGC_DOMAIN_ARM] {
252+ [GPC_PGC_DOMAIN_ARM] = {
253253 .base = {
254254 .name = "ARM",
255255 .flags = GENPD_FLAG_ALWAYS_ON,
256256 },
257257 },
258− [GPC_PGC_DOMAIN_PU] {
258+ [GPC_PGC_DOMAIN_PU] = {
259259 .base = {
260260 .name = "PU",
261261 .power_off = imx6_pm_domain_power_off,
@@ -266,7 +266,7 @@ static struct imx_pm_domain imx_gpc_domains[] = { · 4 unmodified lines
266266 .reg_offs = 0x260,
267267 .cntr_pdn_bit = 0,
268268 },
269− [GPC_PGC_DOMAIN_DISPLAY] {
269+ [GPC_PGC_DOMAIN_DISPLAY] = {
270270 .base = {
271271 .name = "DISPLAY",
272272 .power_off = imx6_pm_domain_power_off,
@@ -275,7 +275,7 @@ static struct imx_pm_domain imx_gpc_domains[] = { · 2 unmodified lines
275275 .reg_offs = 0x240,
276276 .cntr_pdn_bit = 4,
277277 },
278− [GPC_PGC_DOMAIN_PCI] {
278+ [GPC_PGC_DOMAIN_PCI] = {
279279 .base = {
280280 .name = "PCI",
281281 .power_off = imx6_pm_domain_power_off,
drivers/soundwire/Kconfig+1−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
55
66 menuconfig SOUNDWIRE
77 tristate "SoundWire support"
8+ depends on ACPI || OF
89 help
910 SoundWire is a 2-Pin interface with data and clock line ratified
1011 by the MIPI Alliance. SoundWire is used for transporting data
drivers/soundwire/intel.c+2−2
@@ -900,7 +900,7 @@ static int intel_register_dai(struct sdw_intel *sdw) · 899 unmodified lines
900900 /* Create PCM DAIs */
901901 stream = &cdns->pcm;
902902
903− ret = intel_create_dai(cdns, dais, INTEL_PDI_IN, stream->num_in,
903+ ret = intel_create_dai(cdns, dais, INTEL_PDI_IN, cdns->pcm.num_in,
904904 off, stream->num_ch_in, true);
905905 if (ret)
906906 return ret;
@@ -931,7 +931,7 @@ static int intel_register_dai(struct sdw_intel *sdw) · 24 unmodified lines
931931 if (ret)
932932 return ret;
933933
934− off += cdns->pdm.num_bd;
934+ off += cdns->pdm.num_out;
935935 ret = intel_create_dai(cdns, dais, INTEL_PDI_BD, cdns->pdm.num_bd,
936936 off, stream->num_ch_bd, false);
937937 if (ret)
drivers/soundwire/slave.c+2−1
@@ -128,7 +128,8 @@ int sdw_of_find_slaves(struct sdw_bus *bus) · 127 unmodified lines
128128 struct device_node *node;
129129
130130 for_each_child_of_node(bus->dev->of_node, node) {
131− int link_id, sdw_version, ret, len;
131+ int link_id, ret, len;
132+ unsigned int sdw_version;
132133 const char *compat = NULL;
133134 struct sdw_slave_id id;
134135 const __be32 *addr;
drivers/staging/Kconfig+2−0
@@ -125,4 +125,6 @@ source "drivers/staging/exfat/Kconfig" · 124 unmodified lines
125125
126126 source "drivers/staging/qlge/Kconfig"
127127
128+source "drivers/staging/vboxsf/Kconfig"
129+
128130 endif # STAGING
drivers/staging/Makefile+1−0
@@ -53,3 +53,4 @@ obj-$(CONFIG_UWB) += uwb/ · 52 unmodified lines
5353 obj-$(CONFIG_USB_WUSB) += wusbcore/
5454 obj-$(CONFIG_EXFAT_FS) += exfat/
5555 obj-$(CONFIG_QLGE) += qlge/
56+obj-$(CONFIG_VBOXSF_FS) += vboxsf/
drivers/staging/vboxsf/Kconfig+10−0
@@ -0,0 +1,10 @@
1+config VBOXSF_FS
2+ tristate "VirtualBox guest shared folder (vboxsf) support"
3+ depends on X86 && VBOXGUEST
4+ select NLS
5+ help
6+ VirtualBox hosts can share folders with guests, this driver
7+ implements the Linux-guest side of this allowing folders exported
8+ by the host to be mounted under Linux.
9+
10+ If you want to use shared folders in VirtualBox guests, answer Y or M.
drivers/staging/vboxsf/Makefile+5−0
@@ -0,0 +1,5 @@
1+# SPDX-License-Identifier: MIT
2+
3+obj-$(CONFIG_VBOXSF_FS) += vboxsf.o
4+
5+vboxsf-y := dir.o file.o utils.o vboxsf_wrappers.o super.o
drivers/staging/vboxsf/TODO+7−0
@@ -0,0 +1,7 @@
1+TODO:
2+- Find a file-system developer to review this and give their Reviewed-By
3+- Address any items coming up during review
4+- Move to fs/vboxfs
5+
6+Please send any patches to Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7+and Hans de Goede <hdegoede@redhat.com>
drivers/staging/vboxsf/dir.c+418−0
@@ -0,0 +1,418 @@
1+// SPDX-License-Identifier: MIT
2+/*
3+ * VirtualBox Guest Shared Folders support: Directory inode and file operations
4+ *
5+ * Copyright (C) 2006-2018 Oracle Corporation
6+ */
7+
8+#include <linux/namei.h>
9+#include <linux/vbox_utils.h>
10+#include "vfsmod.h"
11+
12+static int vboxsf_dir_open(struct inode *inode, struct file *file)
13+{
14+ struct vboxsf_sbi *sbi = VBOXSF_SBI(inode->i_sb);
15+ struct shfl_createparms params = {};
16+ struct vboxsf_dir_info *sf_d;
17+ int err;
18+
19+ sf_d = vboxsf_dir_info_alloc();
20+ if (!sf_d)
21+ return -ENOMEM;
22+
23+ params.handle = SHFL_HANDLE_NIL;
24+ params.create_flags = SHFL_CF_DIRECTORY | SHFL_CF_ACT_OPEN_IF_EXISTS |
25+ SHFL_CF_ACT_FAIL_IF_NEW | SHFL_CF_ACCESS_READ;
26+
27+ err = vboxsf_create_at_dentry(file_dentry(file), &params);
28+ if (err)
29+ goto err_free_dir_info;
30+
31+ if (params.result != SHFL_FILE_EXISTS) {
32+ err = -ENOENT;
33+ goto err_close;
34+ }
35+
36+ err = vboxsf_dir_read_all(sbi, sf_d, params.handle);
37+ if (err)
38+ goto err_close;
39+
40+ vboxsf_close(sbi->root, params.handle);
41+ file->private_data = sf_d;
42+ return 0;
43+
44+err_close:
45+ vboxsf_close(sbi->root, params.handle);
46+err_free_dir_info:
47+ vboxsf_dir_info_free(sf_d);
48+ return err;
49+}
50+
51+static int vboxsf_dir_release(struct inode *inode, struct file *file)
52+{
53+ if (file->private_data)
54+ vboxsf_dir_info_free(file->private_data);
55+
56+ return 0;
57+}
58+
59+static unsigned int vboxsf_get_d_type(u32 mode)
60+{
61+ unsigned int d_type;
62+
63+ switch (mode & SHFL_TYPE_MASK) {
64+ case SHFL_TYPE_FIFO:
65+ d_type = DT_FIFO;
66+ break;
67+ case SHFL_TYPE_DEV_CHAR:
68+ d_type = DT_CHR;
69+ break;
70+ case SHFL_TYPE_DIRECTORY:
71+ d_type = DT_DIR;
72+ break;
73+ case SHFL_TYPE_DEV_BLOCK:
74+ d_type = DT_BLK;
75+ break;
76+ case SHFL_TYPE_FILE:
77+ d_type = DT_REG;
78+ break;
79+ case SHFL_TYPE_SYMLINK:
80+ d_type = DT_LNK;
81+ break;
82+ case SHFL_TYPE_SOCKET:
83+ d_type = DT_SOCK;
84+ break;
85+ case SHFL_TYPE_WHITEOUT:
86+ d_type = DT_WHT;
87+ break;
88+ default:
89+ d_type = DT_UNKNOWN;
90+ break;
91+ }
92+ return d_type;
93+}
94+
95+static bool vboxsf_dir_emit(struct file *dir, struct dir_context *ctx)
96+{
97+ struct vboxsf_sbi *sbi = VBOXSF_SBI(file_inode(dir)->i_sb);
98+ struct vboxsf_dir_info *sf_d = dir->private_data;
99+ struct shfl_dirinfo *info;
100+ struct vboxsf_dir_buf *b;
101+ unsigned int d_type;
102+ loff_t i, cur = 0;
103+ ino_t fake_ino;
104+ size_t size;
105+ int err;
106+
107+ list_for_each_entry(b, &sf_d->info_list, head) {
108+try_next_entry:
109+ if (ctx->pos >= cur + b->entries) {
110+ cur += b->entries;
111+ continue;
112+ }
113+
114+ /*
115+ * Note the vboxsf_dir_info objects we are iterating over here
116+ * are variable sized, so the info pointer may end up being
117+ * unaligned. This is how we get the data from the host.
118+ * Since vboxsf is only supported on x86 machines this is not
119+ * a problem.
120+ */
121+ for (i = 0, info = b->buf; i < ctx->pos - cur; i++) {
122+ size = offsetof(struct shfl_dirinfo, name.string) +
123+ info->name.size;
124+ info = (struct shfl_dirinfo *)((uintptr_t)info + size);
125+ }
126+
127+ /* Info now points to the right entry, emit it. */
128+ d_type = vboxsf_get_d_type(info->info.attr.mode);
129+
130+ /*
131+ * On 32 bit systems pos is 64 signed, while ino is 32 bit
132+ * unsigned so fake_ino may overflow, check for this.
133+ */
134+ if ((ino_t)(ctx->pos + 1) != (u64)(ctx->pos + 1)) {
135+ vbg_err("vboxsf: fake ino overflow, truncating dir\n");
136+ return false;
137+ }
138+ fake_ino = ctx->pos + 1;
139+
140+ if (sbi->nls) {
141+ char d_name[NAME_MAX];
142+
143+ err = vboxsf_nlscpy(sbi, d_name, NAME_MAX,
144+ info->name.string.utf8,
145+ info->name.length);
146+ if (err) {
147+ /* skip erroneous entry and proceed */
148+ ctx->pos += 1;
149+ goto try_next_entry;
150+ }
151+
152+ return dir_emit(ctx, d_name, strlen(d_name),
153+ fake_ino, d_type);
154+ }
155+
156+ return dir_emit(ctx, info->name.string.utf8, info->name.length,
157+ fake_ino, d_type);
158+ }
159+
160+ return false;
161+}
162+
163+static int vboxsf_dir_iterate(struct file *dir, struct dir_context *ctx)
164+{
165+ bool keep_iterating;
166+
167+ for (keep_iterating = true; keep_iterating; ctx->pos += 1)
168+ keep_iterating = vboxsf_dir_emit(dir, ctx);
169+
170+ return 0;
171+}
172+
173+const struct file_operations vboxsf_dir_fops = {
174+ .open = vboxsf_dir_open,
175+ .iterate = vboxsf_dir_iterate,
176+ .release = vboxsf_dir_release,
177+ .read = generic_read_dir,
178+ .llseek = generic_file_llseek,
179+};
180+
181+/*
182+ * This is called during name resolution/lookup to check if the @dentry in
183+ * the cache is still valid. the job is handled by vboxsf_inode_revalidate.
184+ */
185+static int vboxsf_dentry_revalidate(struct dentry *dentry, unsigned int flags)
186+{
187+ if (flags & LOOKUP_RCU)
188+ return -ECHILD;
189+
190+ if (d_really_is_positive(dentry))
191+ return vboxsf_inode_revalidate(dentry) == 0;
192+ else
193+ return vboxsf_stat_dentry(dentry, NULL) == -ENOENT;
194+}
195+
196+const struct dentry_operations vboxsf_dentry_ops = {
197+ .d_revalidate = vboxsf_dentry_revalidate
198+};
199+
200+/* iops */
201+
202+static struct dentry *vboxsf_dir_lookup(struct inode *parent,
203+ struct dentry *dentry,
204+ unsigned int flags)
205+{
206+ struct vboxsf_sbi *sbi = VBOXSF_SBI(parent->i_sb);
207+ struct shfl_fsobjinfo fsinfo;
208+ struct inode *inode;
209+ int err;
210+
211+ dentry->d_time = jiffies;
212+
213+ err = vboxsf_stat_dentry(dentry, &fsinfo);
214+ if (err) {
215+ inode = (err == -ENOENT) ? NULL : ERR_PTR(err);
216+ } else {
217+ inode = vboxsf_new_inode(parent->i_sb);
218+ if (!IS_ERR(inode))
219+ vboxsf_init_inode(sbi, inode, &fsinfo);
220+ }
221+
222+ return d_splice_alias(inode, dentry);
223+}
224+
225+static int vboxsf_dir_instantiate(struct inode *parent, struct dentry *dentry,
226+ struct shfl_fsobjinfo *info)
227+{
228+ struct vboxsf_sbi *sbi = VBOXSF_SBI(parent->i_sb);
229+ struct vboxsf_inode *sf_i;
230+ struct inode *inode;
231+
232+ inode = vboxsf_new_inode(parent->i_sb);
233+ if (IS_ERR(inode))
234+ return PTR_ERR(inode);
235+
236+ sf_i = VBOXSF_I(inode);
237+ /* The host may have given us different attr then requested */
238+ sf_i->force_restat = 1;
239+ vboxsf_init_inode(sbi, inode, info);
240+
241+ d_instantiate(dentry, inode);
242+
243+ return 0;
244+}
245+
246+static int vboxsf_dir_create(struct inode *parent, struct dentry *dentry,
247+ umode_t mode, int is_dir)
248+{
249+ struct vboxsf_inode *sf_parent_i = VBOXSF_I(parent);
250+ struct vboxsf_sbi *sbi = VBOXSF_SBI(parent->i_sb);
251+ struct shfl_createparms params = {};
252+ int err;
253+
254+ params.handle = SHFL_HANDLE_NIL;
255+ params.create_flags = SHFL_CF_ACT_CREATE_IF_NEW |
256+ SHFL_CF_ACT_FAIL_IF_EXISTS |
257+ SHFL_CF_ACCESS_READWRITE |
258+ (is_dir ? SHFL_CF_DIRECTORY : 0);
259+ params.info.attr.mode = (mode & 0777) |
260+ (is_dir ? SHFL_TYPE_DIRECTORY : SHFL_TYPE_FILE);
261+ params.info.attr.additional = SHFLFSOBJATTRADD_NOTHING;
262+
263+ err = vboxsf_create_at_dentry(dentry, &params);
264+ if (err)
265+ return err;
266+
267+ if (params.result != SHFL_FILE_CREATED)
268+ return -EPERM;
269+
270+ vboxsf_close(sbi->root, params.handle);
271+
272+ err = vboxsf_dir_instantiate(parent, dentry, &params.info);
273+ if (err)
274+ return err;
275+
276+ /* parent directory access/change time changed */
277+ sf_parent_i->force_restat = 1;
278+
279+ return 0;
280+}
281+
282+static int vboxsf_dir_mkfile(struct inode *parent, struct dentry *dentry,
283+ umode_t mode, bool excl)
284+{
285+ return vboxsf_dir_create(parent, dentry, mode, 0);
286+}
287+
288+static int vboxsf_dir_mkdir(struct inode *parent, struct dentry *dentry,
289+ umode_t mode)
290+{
291+ return vboxsf_dir_create(parent, dentry, mode, 1);
292+}
293+
294+static int vboxsf_dir_unlink(struct inode *parent, struct dentry *dentry)
295+{
296+ struct vboxsf_sbi *sbi = VBOXSF_SBI(parent->i_sb);
297+ struct vboxsf_inode *sf_parent_i = VBOXSF_I(parent);
298+ struct inode *inode = d_inode(dentry);
299+ struct shfl_string *path;
300+ u32 flags;
301+ int err;
302+
303+ if (S_ISDIR(inode->i_mode))
304+ flags = SHFL_REMOVE_DIR;
305+ else
306+ flags = SHFL_REMOVE_FILE;
307+
308+ if (S_ISLNK(inode->i_mode))
309+ flags |= SHFL_REMOVE_SYMLINK;
310+
311+ path = vboxsf_path_from_dentry(sbi, dentry);
312+ if (IS_ERR(path))
313+ return PTR_ERR(path);
314+
315+ err = vboxsf_remove(sbi->root, path, flags);
316+ __putname(path);
317+ if (err)
318+ return err;
319+
320+ /* parent directory access/change time changed */
321+ sf_parent_i->force_restat = 1;
322+
323+ return 0;
324+}
325+
326+static int vboxsf_dir_rename(struct inode *old_parent,
327+ struct dentry *old_dentry,
328+ struct inode *new_parent,
329+ struct dentry *new_dentry,
330+ unsigned int flags)
331+{
332+ struct vboxsf_sbi *sbi = VBOXSF_SBI(old_parent->i_sb);
333+ struct vboxsf_inode *sf_old_parent_i = VBOXSF_I(old_parent);
334+ struct vboxsf_inode *sf_new_parent_i = VBOXSF_I(new_parent);
335+ u32 shfl_flags = SHFL_RENAME_FILE | SHFL_RENAME_REPLACE_IF_EXISTS;
336+ struct shfl_string *old_path, *new_path;
337+ int err;
338+
339+ if (flags)
340+ return -EINVAL;
341+
342+ old_path = vboxsf_path_from_dentry(sbi, old_dentry);
343+ if (IS_ERR(old_path))
344+ return PTR_ERR(old_path);
345+
346+ new_path = vboxsf_path_from_dentry(sbi, new_dentry);
347+ if (IS_ERR(new_path)) {
348+ err = PTR_ERR(new_path);
349+ goto err_put_old_path;
350+ }
351+
352+ if (d_inode(old_dentry)->i_mode & S_IFDIR)
353+ shfl_flags = 0;
354+
355+ err = vboxsf_rename(sbi->root, old_path, new_path, shfl_flags);
356+ if (err == 0) {
357+ /* parent directories access/change time changed */
358+ sf_new_parent_i->force_restat = 1;
359+ sf_old_parent_i->force_restat = 1;
360+ }
361+
362+ __putname(new_path);
363+err_put_old_path:
364+ __putname(old_path);
365+ return err;
366+}
367+
368+static int vboxsf_dir_symlink(struct inode *parent, struct dentry *dentry,
369+ const char *symname)
370+{
371+ struct vboxsf_inode *sf_parent_i = VBOXSF_I(parent);
372+ struct vboxsf_sbi *sbi = VBOXSF_SBI(parent->i_sb);
373+ int symname_size = strlen(symname) + 1;
374+ struct shfl_string *path, *ssymname;
375+ struct shfl_fsobjinfo info;
376+ int err;
377+
378+ path = vboxsf_path_from_dentry(sbi, dentry);
379+ if (IS_ERR(path))
380+ return PTR_ERR(path);
381+
382+ ssymname = kmalloc(SHFLSTRING_HEADER_SIZE + symname_size, GFP_KERNEL);
383+ if (!ssymname) {
384+ __putname(path);
385+ return -ENOMEM;
386+ }
387+ ssymname->length = symname_size - 1;
388+ ssymname->size = symname_size;
389+ memcpy(ssymname->string.utf8, symname, symname_size);
390+
391+ err = vboxsf_symlink(sbi->root, path, ssymname, &info);
392+ kfree(ssymname);
393+ __putname(path);
394+ if (err) {
395+ /* -EROFS means symlinks are note support -> -EPERM */
396+ return (err == -EROFS) ? -EPERM : err;
397+ }
398+
399+ err = vboxsf_dir_instantiate(parent, dentry, &info);
400+ if (err)
401+ return err;
402+
403+ /* parent directory access/change time changed */
404+ sf_parent_i->force_restat = 1;
405+ return 0;
406+}
407+
408+const struct inode_operations vboxsf_dir_iops = {
409+ .lookup = vboxsf_dir_lookup,
410+ .create = vboxsf_dir_mkfile,
411+ .mkdir = vboxsf_dir_mkdir,
412+ .rmdir = vboxsf_dir_unlink,
413+ .unlink = vboxsf_dir_unlink,
414+ .rename = vboxsf_dir_rename,
415+ .symlink = vboxsf_dir_symlink,
416+ .getattr = vboxsf_getattr,
417+ .setattr = vboxsf_setattr,
418+};
drivers/staging/vboxsf/file.c+370−0
@@ -0,0 +1,370 @@
1+// SPDX-License-Identifier: MIT
2+/*
3+ * VirtualBox Guest Shared Folders support: Regular file inode and file ops.
4+ *
5+ * Copyright (C) 2006-2018 Oracle Corporation
6+ */
7+
8+#include <linux/mm.h>
9+#include <linux/page-flags.h>
10+#include <linux/pagemap.h>
11+#include <linux/highmem.h>
12+#include <linux/sizes.h>
13+#include "vfsmod.h"
14+
15+struct vboxsf_handle {
16+ u64 handle;
17+ u32 root;
18+ u32 access_flags;
19+ struct kref refcount;
20+ struct list_head head;
21+};
22+
23+static int vboxsf_file_open(struct inode *inode, struct file *file)
24+{
25+ struct vboxsf_inode *sf_i = VBOXSF_I(inode);
26+ struct shfl_createparms params = {};
27+ struct vboxsf_handle *sf_handle;
28+ u32 access_flags = 0;
29+ int err;
30+
31+ sf_handle = kmalloc(sizeof(*sf_handle), GFP_KERNEL);
32+ if (!sf_handle)
33+ return -ENOMEM;
34+
35+ /*
36+ * We check the value of params.handle afterwards to find out if
37+ * the call succeeded or failed, as the API does not seem to cleanly
38+ * distinguish error and informational messages.
39+ *
40+ * Furthermore, we must set params.handle to SHFL_HANDLE_NIL to
41+ * make the shared folders host service use our mode parameter.
42+ */
43+ params.handle = SHFL_HANDLE_NIL;
44+ if (file->f_flags & O_CREAT) {
45+ params.create_flags |= SHFL_CF_ACT_CREATE_IF_NEW;
46+ /*
47+ * We ignore O_EXCL, as the Linux kernel seems to call create
48+ * beforehand itself, so O_EXCL should always fail.
49+ */
50+ if (file->f_flags & O_TRUNC)
51+ params.create_flags |= SHFL_CF_ACT_OVERWRITE_IF_EXISTS;
52+ else
53+ params.create_flags |= SHFL_CF_ACT_OPEN_IF_EXISTS;
54+ } else {
55+ params.create_flags |= SHFL_CF_ACT_FAIL_IF_NEW;
56+ if (file->f_flags & O_TRUNC)
57+ params.create_flags |= SHFL_CF_ACT_OVERWRITE_IF_EXISTS;
58+ }
59+
60+ switch (file->f_flags & O_ACCMODE) {
61+ case O_RDONLY:
62+ access_flags |= SHFL_CF_ACCESS_READ;
63+ break;
64+
65+ case O_WRONLY:
66+ access_flags |= SHFL_CF_ACCESS_WRITE;
67+ break;
68+
69+ case O_RDWR:
70+ access_flags |= SHFL_CF_ACCESS_READWRITE;
71+ break;
72+
73+ default:
74+ WARN_ON(1);
75+ }
76+
77+ if (file->f_flags & O_APPEND)
78+ access_flags |= SHFL_CF_ACCESS_APPEND;
79+
80+ params.create_flags |= access_flags;
81+ params.info.attr.mode = inode->i_mode;
82+
83+ err = vboxsf_create_at_dentry(file_dentry(file), &params);
84+ if (err == 0 && params.handle == SHFL_HANDLE_NIL)
85+ err = (params.result == SHFL_FILE_EXISTS) ? -EEXIST : -ENOENT;
86+ if (err) {
87+ kfree(sf_handle);
88+ return err;
89+ }
90+
91+ /* the host may have given us different attr then requested */
92+ sf_i->force_restat = 1;
93+
94+ /* init our handle struct and add it to the inode's handles list */
95+ sf_handle->handle = params.handle;
96+ sf_handle->root = VBOXSF_SBI(inode->i_sb)->root;
97+ sf_handle->access_flags = access_flags;
98+ kref_init(&sf_handle->refcount);
99+
100+ mutex_lock(&sf_i->handle_list_mutex);
101+ list_add(&sf_handle->head, &sf_i->handle_list);
102+ mutex_unlock(&sf_i->handle_list_mutex);
103+
104+ file->private_data = sf_handle;
105+ return 0;
106+}
107+
108+static void vboxsf_handle_release(struct kref *refcount)
109+{
110+ struct vboxsf_handle *sf_handle =
111+ container_of(refcount, struct vboxsf_handle, refcount);
112+
113+ vboxsf_close(sf_handle->root, sf_handle->handle);
114+ kfree(sf_handle);
115+}
116+
117+static int vboxsf_file_release(struct inode *inode, struct file *file)
118+{
119+ struct vboxsf_inode *sf_i = VBOXSF_I(inode);
120+ struct vboxsf_handle *sf_handle = file->private_data;
121+
122+ /*
123+ * When a file is closed on our (the guest) side, we want any subsequent
124+ * accesses done on the host side to see all changes done from our side.
125+ */
126+ filemap_write_and_wait(inode->i_mapping);
127+
128+ mutex_lock(&sf_i->handle_list_mutex);
129+ list_del(&sf_handle->head);
130+ mutex_unlock(&sf_i->handle_list_mutex);
131+
132+ kref_put(&sf_handle->refcount, vboxsf_handle_release);
133+ return 0;
134+}
135+
136+/*
137+ * Write back dirty pages now, because there may not be any suitable
138+ * open files later
139+ */
140+static void vboxsf_vma_close(struct vm_area_struct *vma)
141+{
142+ filemap_write_and_wait(vma->vm_file->f_mapping);
143+}
144+
145+static const struct vm_operations_struct vboxsf_file_vm_ops = {
146+ .close = vboxsf_vma_close,
147+ .fault = filemap_fault,
148+ .map_pages = filemap_map_pages,
149+};
150+
151+static int vboxsf_file_mmap(struct file *file, struct vm_area_struct *vma)
152+{
153+ int err;
154+
155+ err = generic_file_mmap(file, vma);
156+ if (!err)
157+ vma->vm_ops = &vboxsf_file_vm_ops;
158+
159+ return err;
160+}
161+
162+/*
163+ * Note that since we are accessing files on the host's filesystem, files
164+ * may always be changed underneath us by the host!
165+ *
166+ * The vboxsf API between the guest and the host does not offer any functions
167+ * to deal with this. There is no inode-generation to check for changes, no
168+ * events / callback on changes and no way to lock files.
169+ *
170+ * To avoid returning stale data when a file gets *opened* on our (the guest)
171+ * side, we do a "stat" on the host side, then compare the mtime with the
172+ * last known mtime and invalidate the page-cache if they differ.
173+ * This is done from vboxsf_inode_revalidate().
174+ *
175+ * When reads are done through the read_iter fop, it is possible to do
176+ * further cache revalidation then, there are 3 options to deal with this:
177+ *
178+ * 1) Rely solely on the revalidation done at open time
179+ * 2) Do another "stat" and compare mtime again. Unfortunately the vboxsf
180+ * host API does not allow stat on handles, so we would need to use
181+ * file->f_path.dentry and the stat will then fail if the file was unlinked
182+ * or renamed (and there is no thing like NFS' silly-rename). So we get:
183+ * 2a) "stat" and compare mtime, on stat failure invalidate the cache
184+ * 2b) "stat" and compare mtime, on stat failure do nothing
185+ * 3) Simply always call invalidate_inode_pages2_range on the range of the read
186+ *
187+ * Currently we are keeping things KISS and using option 1. this allows
188+ * directly using generic_file_read_iter without wrapping it.
189+ *
190+ * This means that only data written on the host side before open() on
191+ * the guest side is guaranteed to be seen by the guest. If necessary
192+ * we may provide other read-cache strategies in the future and make this
193+ * configurable through a mount option.
194+ */
195+const struct file_operations vboxsf_reg_fops = {
196+ .llseek = generic_file_llseek,
197+ .read_iter = generic_file_read_iter,
198+ .write_iter = generic_file_write_iter,
199+ .mmap = vboxsf_file_mmap,
200+ .open = vboxsf_file_open,
201+ .release = vboxsf_file_release,
202+ .fsync = noop_fsync,
203+ .splice_read = generic_file_splice_read,
204+};
205+
206+const struct inode_operations vboxsf_reg_iops = {
207+ .getattr = vboxsf_getattr,
208+ .setattr = vboxsf_setattr
209+};
210+
211+static int vboxsf_readpage(struct file *file, struct page *page)
212+{
213+ struct vboxsf_handle *sf_handle = file->private_data;
214+ loff_t off = page_offset(page);
215+ u32 nread = PAGE_SIZE;
216+ u8 *buf;
217+ int err;
218+
219+ buf = kmap(page);
220+
221+ err = vboxsf_read(sf_handle->root, sf_handle->handle, off, &nread, buf);
222+ if (err == 0) {
223+ memset(&buf[nread], 0, PAGE_SIZE - nread);
224+ flush_dcache_page(page);
225+ SetPageUptodate(page);
226+ } else {
227+ SetPageError(page);
228+ }
229+
230+ kunmap(page);
231+ unlock_page(page);
232+ return err;
233+}
234+
235+static struct vboxsf_handle *vboxsf_get_write_handle(struct vboxsf_inode *sf_i)
236+{
237+ struct vboxsf_handle *h, *sf_handle = NULL;
238+
239+ mutex_lock(&sf_i->handle_list_mutex);
240+ list_for_each_entry(h, &sf_i->handle_list, head) {
241+ if (h->access_flags == SHFL_CF_ACCESS_WRITE ||
242+ h->access_flags == SHFL_CF_ACCESS_READWRITE) {
243+ kref_get(&h->refcount);
244+ sf_handle = h;
245+ break;
246+ }
247+ }
248+ mutex_unlock(&sf_i->handle_list_mutex);
249+
250+ return sf_handle;
251+}
252+
253+static int vboxsf_writepage(struct page *page, struct writeback_control *wbc)
254+{
255+ struct inode *inode = page->mapping->host;
256+ struct vboxsf_inode *sf_i = VBOXSF_I(inode);
257+ struct vboxsf_handle *sf_handle;
258+ loff_t off = page_offset(page);
259+ loff_t size = i_size_read(inode);
260+ u32 nwrite = PAGE_SIZE;
261+ u8 *buf;
262+ int err;
263+
264+ if (off + PAGE_SIZE > size)
265+ nwrite = size & ~PAGE_MASK;
266+
267+ sf_handle = vboxsf_get_write_handle(sf_i);
268+ if (!sf_handle)
269+ return -EBADF;
270+
271+ buf = kmap(page);
272+ err = vboxsf_write(sf_handle->root, sf_handle->handle,
273+ off, &nwrite, buf);
274+ kunmap(page);
275+
276+ kref_put(&sf_handle->refcount, vboxsf_handle_release);
277+
278+ if (err == 0) {
279+ ClearPageError(page);
280+ /* mtime changed */
281+ sf_i->force_restat = 1;
282+ } else {
283+ ClearPageUptodate(page);
284+ }
285+
286+ unlock_page(page);
287+ return err;
288+}
289+
290+static int vboxsf_write_end(struct file *file, struct address_space *mapping,
291+ loff_t pos, unsigned int len, unsigned int copied,
292+ struct page *page, void *fsdata)
293+{
294+ struct inode *inode = mapping->host;
295+ struct vboxsf_handle *sf_handle = file->private_data;
296+ unsigned int from = pos & ~PAGE_MASK;
297+ u32 nwritten = len;
298+ u8 *buf;
299+ int err;
300+
301+ buf = kmap(page);
302+ err = vboxsf_write(sf_handle->root, sf_handle->handle,
303+ pos, &nwritten, buf + from);
304+ kunmap(page);
305+
306+ if (err) {
307+ nwritten = 0;
308+ goto out;
309+ }
310+
311+ /* mtime changed */
312+ VBOXSF_I(inode)->force_restat = 1;
313+
314+ if (!PageUptodate(page) && nwritten == PAGE_SIZE)
315+ SetPageUptodate(page);
316+
317+ pos += nwritten;
318+ if (pos > inode->i_size)
319+ i_size_write(inode, pos);
320+
321+out:
322+ unlock_page(page);
323+ put_page(page);
324+
325+ return nwritten;
326+}
327+
328+const struct address_space_operations vboxsf_reg_aops = {
329+ .readpage = vboxsf_readpage,
330+ .writepage = vboxsf_writepage,
331+ .set_page_dirty = __set_page_dirty_nobuffers,
332+ .write_begin = simple_write_begin,
333+ .write_end = vboxsf_write_end,
334+};
335+
336+static const char *vboxsf_get_link(struct dentry *dentry, struct inode *inode,
337+ struct delayed_call *done)
338+{
339+ struct vboxsf_sbi *sbi = VBOXSF_SBI(inode->i_sb);
340+ struct shfl_string *path;
341+ char *link;
342+ int err;
343+
344+ if (!dentry)
345+ return ERR_PTR(-ECHILD);
346+
347+ path = vboxsf_path_from_dentry(sbi, dentry);
348+ if (IS_ERR(path))
349+ return (char *)path;
350+
351+ link = kzalloc(PATH_MAX, GFP_KERNEL);
352+ if (!link) {
353+ __putname(path);
354+ return ERR_PTR(-ENOMEM);
355+ }
356+
357+ err = vboxsf_readlink(sbi->root, path, PATH_MAX, link);
358+ __putname(path);
359+ if (err) {
360+ kfree(link);
361+ return ERR_PTR(err);
362+ }
363+
364+ set_delayed_call(done, kfree_link, link);
365+ return link;
366+}
367+
368+const struct inode_operations vboxsf_lnk_iops = {
369+ .get_link = vboxsf_get_link
370+};
drivers/staging/vboxsf/shfl_hostintf.h+901−0
@@ -0,0 +1,901 @@
1+/* SPDX-License-Identifier: MIT */
2+/*
3+ * VirtualBox Shared Folders: host interface definition.
4+ *
5+ * Copyright (C) 2006-2018 Oracle Corporation
6+ */
7+
8+#ifndef SHFL_HOSTINTF_H
9+#define SHFL_HOSTINTF_H
10+
11+#include <linux/vbox_vmmdev_types.h>
12+
13+/* The max in/out buffer size for a FN_READ or FN_WRITE call */
14+#define SHFL_MAX_RW_COUNT (16 * SZ_1M)
15+
16+/*
17+ * Structures shared between guest and the service
18+ * can be relocated and use offsets to point to variable
19+ * length parts.
20+ *
21+ * Shared folders protocol works with handles.
22+ * Before doing any action on a file system object,
23+ * one have to obtain the object handle via a SHFL_FN_CREATE
24+ * request. A handle must be closed with SHFL_FN_CLOSE.
25+ */
26+
27+enum {
28+ SHFL_FN_QUERY_MAPPINGS = 1, /* Query mappings changes. */
29+ SHFL_FN_QUERY_MAP_NAME = 2, /* Query map name. */
30+ SHFL_FN_CREATE = 3, /* Open/create object. */
31+ SHFL_FN_CLOSE = 4, /* Close object handle. */
32+ SHFL_FN_READ = 5, /* Read object content. */
33+ SHFL_FN_WRITE = 6, /* Write new object content. */
34+ SHFL_FN_LOCK = 7, /* Lock/unlock a range in the object. */
35+ SHFL_FN_LIST = 8, /* List object content. */
36+ SHFL_FN_INFORMATION = 9, /* Query/set object information. */
37+ /* Note function number 10 is not used! */
38+ SHFL_FN_REMOVE = 11, /* Remove object */
39+ SHFL_FN_MAP_FOLDER_OLD = 12, /* Map folder (legacy) */
40+ SHFL_FN_UNMAP_FOLDER = 13, /* Unmap folder */
41+ SHFL_FN_RENAME = 14, /* Rename object */
42+ SHFL_FN_FLUSH = 15, /* Flush file */
43+ SHFL_FN_SET_UTF8 = 16, /* Select UTF8 filename encoding */
44+ SHFL_FN_MAP_FOLDER = 17, /* Map folder */
45+ SHFL_FN_READLINK = 18, /* Read symlink dest (as of VBox 4.0) */
46+ SHFL_FN_SYMLINK = 19, /* Create symlink (as of VBox 4.0) */
47+ SHFL_FN_SET_SYMLINKS = 20, /* Ask host to show symlinks (4.0+) */
48+};
49+
50+/* Root handles for a mapping are of type u32, Root handles are unique. */
51+#define SHFL_ROOT_NIL UINT_MAX
52+
53+/* Shared folders handle for an opened object are of type u64. */
54+#define SHFL_HANDLE_NIL ULLONG_MAX
55+
56+/* Hardcoded maximum length (in chars) of a shared folder name. */
57+#define SHFL_MAX_LEN (256)
58+/* Hardcoded maximum number of shared folder mapping available to the guest. */
59+#define SHFL_MAX_MAPPINGS (64)
60+
61+/** Shared folder string buffer structure. */
62+struct shfl_string {
63+ /** Allocated size of the string member in bytes. */
64+ u16 size;
65+
66+ /** Length of string without trailing nul in bytes. */
67+ u16 length;
68+
69+ /** UTF-8 or UTF-16 string. Nul terminated. */
70+ union {
71+ u8 utf8[2];
72+ u16 utf16[1];
73+ u16 ucs2[1]; /* misnomer, use utf16. */
74+ } string;
75+};
76+VMMDEV_ASSERT_SIZE(shfl_string, 6);
77+
78+/* The size of shfl_string w/o the string part. */
79+#define SHFLSTRING_HEADER_SIZE 4
80+
81+/* Calculate size of the string. */
82+static inline u32 shfl_string_buf_size(const struct shfl_string *string)
83+{
84+ return string ? SHFLSTRING_HEADER_SIZE + string->size : 0;
85+}
86+
87+/* Set user id on execution (S_ISUID). */
88+#define SHFL_UNIX_ISUID 0004000U
89+/* Set group id on execution (S_ISGID). */
90+#define SHFL_UNIX_ISGID 0002000U
91+/* Sticky bit (S_ISVTX / S_ISTXT). */
92+#define SHFL_UNIX_ISTXT 0001000U
93+
94+/* Owner readable (S_IRUSR). */
95+#define SHFL_UNIX_IRUSR 0000400U
96+/* Owner writable (S_IWUSR). */
97+#define SHFL_UNIX_IWUSR 0000200U
98+/* Owner executable (S_IXUSR). */
99+#define SHFL_UNIX_IXUSR 0000100U
100+
101+/* Group readable (S_IRGRP). */
102+#define SHFL_UNIX_IRGRP 0000040U
103+/* Group writable (S_IWGRP). */
104+#define SHFL_UNIX_IWGRP 0000020U
105+/* Group executable (S_IXGRP). */
106+#define SHFL_UNIX_IXGRP 0000010U
107+
108+/* Other readable (S_IROTH). */
109+#define SHFL_UNIX_IROTH 0000004U
110+/* Other writable (S_IWOTH). */
111+#define SHFL_UNIX_IWOTH 0000002U
112+/* Other executable (S_IXOTH). */
113+#define SHFL_UNIX_IXOTH 0000001U
114+
115+/* Named pipe (fifo) (S_IFIFO). */
116+#define SHFL_TYPE_FIFO 0010000U
117+/* Character device (S_IFCHR). */
118+#define SHFL_TYPE_DEV_CHAR 0020000U
119+/* Directory (S_IFDIR). */
120+#define SHFL_TYPE_DIRECTORY 0040000U
121+/* Block device (S_IFBLK). */
122+#define SHFL_TYPE_DEV_BLOCK 0060000U
123+/* Regular file (S_IFREG). */
124+#define SHFL_TYPE_FILE 0100000U
125+/* Symbolic link (S_IFLNK). */
126+#define SHFL_TYPE_SYMLINK 0120000U
127+/* Socket (S_IFSOCK). */
128+#define SHFL_TYPE_SOCKET 0140000U
129+/* Whiteout (S_IFWHT). */
130+#define SHFL_TYPE_WHITEOUT 0160000U
131+/* Type mask (S_IFMT). */
132+#define SHFL_TYPE_MASK 0170000U
133+
134+/* Checks the mode flags indicate a directory (S_ISDIR). */
135+#define SHFL_IS_DIRECTORY(m) (((m) & SHFL_TYPE_MASK) == SHFL_TYPE_DIRECTORY)
136+/* Checks the mode flags indicate a symbolic link (S_ISLNK). */
137+#define SHFL_IS_SYMLINK(m) (((m) & SHFL_TYPE_MASK) == SHFL_TYPE_SYMLINK)
138+
139+/** The available additional information in a shfl_fsobjattr object. */
140+enum shfl_fsobjattr_add {
141+ /** No additional information is available / requested. */
142+ SHFLFSOBJATTRADD_NOTHING = 1,
143+ /**
144+ * The additional unix attributes (shfl_fsobjattr::u::unix_attr) are
145+ * available / requested.
146+ */
147+ SHFLFSOBJATTRADD_UNIX,
148+ /**
149+ * The additional extended attribute size (shfl_fsobjattr::u::size) is
150+ * available / requested.
151+ */
152+ SHFLFSOBJATTRADD_EASIZE,
153+ /**
154+ * The last valid item (inclusive).
155+ * The valid range is SHFLFSOBJATTRADD_NOTHING thru
156+ * SHFLFSOBJATTRADD_LAST.
157+ */
158+ SHFLFSOBJATTRADD_LAST = SHFLFSOBJATTRADD_EASIZE,
159+
160+ /** The usual 32-bit hack. */
161+ SHFLFSOBJATTRADD_32BIT_SIZE_HACK = 0x7fffffff
162+};
163+
164+/**
165+ * Additional unix Attributes, these are available when
166+ * shfl_fsobjattr.additional == SHFLFSOBJATTRADD_UNIX.
167+ */
168+struct shfl_fsobjattr_unix {
169+ /**
170+ * The user owning the filesystem object (st_uid).
171+ * This field is ~0U if not supported.
172+ */
173+ u32 uid;
174+
175+ /**
176+ * The group the filesystem object is assigned (st_gid).
177+ * This field is ~0U if not supported.
178+ */
179+ u32 gid;
180+
181+ /**
182+ * Number of hard links to this filesystem object (st_nlink).
183+ * This field is 1 if the filesystem doesn't support hardlinking or
184+ * the information isn't available.
185+ */
186+ u32 hardlinks;
187+
188+ /**
189+ * The device number of the device which this filesystem object resides
190+ * on (st_dev). This field is 0 if this information is not available.
191+ */
192+ u32 inode_id_device;
193+
194+ /**
195+ * The unique identifier (within the filesystem) of this filesystem
196+ * object (st_ino). Together with inode_id_device, this field can be
197+ * used as a OS wide unique id, when both their values are not 0.
198+ * This field is 0 if the information is not available.
199+ */
200+ u64 inode_id;
201+
202+ /**
203+ * User flags (st_flags).
204+ * This field is 0 if this information is not available.
205+ */
206+ u32 flags;
207+
208+ /**
209+ * The current generation number (st_gen).
210+ * This field is 0 if this information is not available.
211+ */
212+ u32 generation_id;
213+
214+ /**
215+ * The device number of a char. or block device type object (st_rdev).
216+ * This field is 0 if the file isn't a char. or block device or when
217+ * the OS doesn't use the major+minor device idenfication scheme.
218+ */
219+ u32 device;
220+} __packed;
221+
222+/** Extended attribute size. */
223+struct shfl_fsobjattr_easize {
224+ /** Size of EAs. */
225+ s64 cb;
226+} __packed;
227+
228+/** Shared folder filesystem object attributes. */
229+struct shfl_fsobjattr {
230+ /** Mode flags (st_mode). SHFL_UNIX_*, SHFL_TYPE_*, and SHFL_DOS_*. */
231+ u32 mode;
232+
233+ /** The additional attributes available. */
234+ enum shfl_fsobjattr_add additional;
235+
236+ /**
237+ * Additional attributes.
238+ *
239+ * Unless explicitly specified to an API, the API can provide additional
240+ * data as it is provided by the underlying OS.
241+ */
242+ union {
243+ struct shfl_fsobjattr_unix unix_attr;
244+ struct shfl_fsobjattr_easize size;
245+ } __packed u;
246+} __packed;
247+VMMDEV_ASSERT_SIZE(shfl_fsobjattr, 44);
248+
249+struct shfl_timespec {
250+ s64 ns_relative_to_unix_epoch;
251+};
252+
253+/** Filesystem object information structure. */
254+struct shfl_fsobjinfo {
255+ /**
256+ * Logical size (st_size).
257+ * For normal files this is the size of the file.
258+ * For symbolic links, this is the length of the path name contained
259+ * in the symbolic link.
260+ * For other objects this fields needs to be specified.
261+ */
262+ s64 size;
263+
264+ /** Disk allocation size (st_blocks * DEV_BSIZE). */
265+ s64 allocated;
266+
267+ /** Time of last access (st_atime). */
268+ struct shfl_timespec access_time;
269+
270+ /** Time of last data modification (st_mtime). */
271+ struct shfl_timespec modification_time;
272+
273+ /**
274+ * Time of last status change (st_ctime).
275+ * If not available this is set to modification_time.
276+ */
277+ struct shfl_timespec change_time;
278+
279+ /**
280+ * Time of file birth (st_birthtime).
281+ * If not available this is set to change_time.
282+ */
283+ struct shfl_timespec birth_time;
284+
285+ /** Attributes. */
286+ struct shfl_fsobjattr attr;
287+
288+} __packed;
289+VMMDEV_ASSERT_SIZE(shfl_fsobjinfo, 92);
290+
291+/**
292+ * result of an open/create request.
293+ * Along with handle value the result code
294+ * identifies what has happened while
295+ * trying to open the object.
296+ */
297+enum shfl_create_result {
298+ SHFL_NO_RESULT,
299+ /** Specified path does not exist. */
300+ SHFL_PATH_NOT_FOUND,
301+ /** Path to file exists, but the last component does not. */
302+ SHFL_FILE_NOT_FOUND,
303+ /** File already exists and either has been opened or not. */
304+ SHFL_FILE_EXISTS,
305+ /** New file was created. */
306+ SHFL_FILE_CREATED,
307+ /** Existing file was replaced or overwritten. */
308+ SHFL_FILE_REPLACED
309+};
310+
311+/* No flags. Initialization value. */
312+#define SHFL_CF_NONE (0x00000000)
313+
314+/*
315+ * Only lookup the object, do not return a handle. When this is set all other
316+ * flags are ignored.
317+ */
318+#define SHFL_CF_LOOKUP (0x00000001)
319+
320+/*
321+ * Open parent directory of specified object.
322+ * Useful for the corresponding Windows FSD flag
323+ * and for opening paths like \\dir\\*.* to search the 'dir'.
324+ */
325+#define SHFL_CF_OPEN_TARGET_DIRECTORY (0x00000002)
326+
327+/* Create/open a directory. */
328+#define SHFL_CF_DIRECTORY (0x00000004)
329+
330+/*
331+ * Open/create action to do if object exists
332+ * and if the object does not exists.
333+ * REPLACE file means atomically DELETE and CREATE.
334+ * OVERWRITE file means truncating the file to 0 and
335+ * setting new size.
336+ * When opening an existing directory REPLACE and OVERWRITE
337+ * actions are considered invalid, and cause returning
338+ * FILE_EXISTS with NIL handle.
339+ */
340+#define SHFL_CF_ACT_MASK_IF_EXISTS (0x000000f0)
341+#define SHFL_CF_ACT_MASK_IF_NEW (0x00000f00)
342+
343+/* What to do if object exists. */
344+#define SHFL_CF_ACT_OPEN_IF_EXISTS (0x00000000)
345+#define SHFL_CF_ACT_FAIL_IF_EXISTS (0x00000010)
346+#define SHFL_CF_ACT_REPLACE_IF_EXISTS (0x00000020)
347+#define SHFL_CF_ACT_OVERWRITE_IF_EXISTS (0x00000030)
348+
349+/* What to do if object does not exist. */
350+#define SHFL_CF_ACT_CREATE_IF_NEW (0x00000000)
351+#define SHFL_CF_ACT_FAIL_IF_NEW (0x00000100)
352+
353+/* Read/write requested access for the object. */
354+#define SHFL_CF_ACCESS_MASK_RW (0x00003000)
355+
356+/* No access requested. */
357+#define SHFL_CF_ACCESS_NONE (0x00000000)
358+/* Read access requested. */
359+#define SHFL_CF_ACCESS_READ (0x00001000)
360+/* Write access requested. */
361+#define SHFL_CF_ACCESS_WRITE (0x00002000)
362+/* Read/Write access requested. */
363+#define SHFL_CF_ACCESS_READWRITE (0x00003000)
364+
365+/* Requested share access for the object. */
366+#define SHFL_CF_ACCESS_MASK_DENY (0x0000c000)
367+
368+/* Allow any access. */
369+#define SHFL_CF_ACCESS_DENYNONE (0x00000000)
370+/* Do not allow read. */
371+#define SHFL_CF_ACCESS_DENYREAD (0x00004000)
372+/* Do not allow write. */
373+#define SHFL_CF_ACCESS_DENYWRITE (0x00008000)
374+/* Do not allow access. */
375+#define SHFL_CF_ACCESS_DENYALL (0x0000c000)
376+
377+/* Requested access to attributes of the object. */
378+#define SHFL_CF_ACCESS_MASK_ATTR (0x00030000)
379+
380+/* No access requested. */
381+#define SHFL_CF_ACCESS_ATTR_NONE (0x00000000)
382+/* Read access requested. */
383+#define SHFL_CF_ACCESS_ATTR_READ (0x00010000)
384+/* Write access requested. */
385+#define SHFL_CF_ACCESS_ATTR_WRITE (0x00020000)
386+/* Read/Write access requested. */
387+#define SHFL_CF_ACCESS_ATTR_READWRITE (0x00030000)
388+
389+/*
390+ * The file is opened in append mode.
391+ * Ignored if SHFL_CF_ACCESS_WRITE is not set.
392+ */
393+#define SHFL_CF_ACCESS_APPEND (0x00040000)
394+
395+/** Create parameters buffer struct for SHFL_FN_CREATE call */
396+struct shfl_createparms {
397+ /** Returned handle of opened object. */
398+ u64 handle;
399+
400+ /** Returned result of the operation */
401+ enum shfl_create_result result;
402+
403+ /** SHFL_CF_* */
404+ u32 create_flags;
405+
406+ /**
407+ * Attributes of object to create and
408+ * returned actual attributes of opened/created object.
409+ */
410+ struct shfl_fsobjinfo info;
411+} __packed;
412+
413+/** Shared Folder directory information */
414+struct shfl_dirinfo {
415+ /** Full information about the object. */
416+ struct shfl_fsobjinfo info;
417+ /**
418+ * The length of the short field (number of UTF16 chars).
419+ * It is 16-bit for reasons of alignment.
420+ */
421+ u16 short_name_len;
422+ /**
423+ * The short name for 8.3 compatibility.
424+ * Empty string if not available.
425+ */
426+ u16 short_name[14];
427+ struct shfl_string name;
428+};
429+
430+/** Shared folder filesystem properties. */
431+struct shfl_fsproperties {
432+ /**
433+ * The maximum size of a filesystem object name.
434+ * This does not include the '\\0'.
435+ */
436+ u32 max_component_len;
437+
438+ /**
439+ * True if the filesystem is remote.
440+ * False if the filesystem is local.
441+ */
442+ bool remote;
443+
444+ /**
445+ * True if the filesystem is case sensitive.
446+ * False if the filesystem is case insensitive.
447+ */
448+ bool case_sensitive;
449+
450+ /**
451+ * True if the filesystem is mounted read only.
452+ * False if the filesystem is mounted read write.
453+ */
454+ bool read_only;
455+
456+ /**
457+ * True if the filesystem can encode unicode object names.
458+ * False if it can't.
459+ */
460+ bool supports_unicode;
461+
462+ /**
463+ * True if the filesystem is compresses.
464+ * False if it isn't or we don't know.
465+ */
466+ bool compressed;
467+
468+ /**
469+ * True if the filesystem compresses of individual files.
470+ * False if it doesn't or we don't know.
471+ */
472+ bool file_compression;
473+};
474+VMMDEV_ASSERT_SIZE(shfl_fsproperties, 12);
475+
476+struct shfl_volinfo {
477+ s64 total_allocation_bytes;
478+ s64 available_allocation_bytes;
479+ u32 bytes_per_allocation_unit;
480+ u32 bytes_per_sector;
481+ u32 serial;
482+ struct shfl_fsproperties properties;
483+};
484+
485+
486+/** SHFL_FN_MAP_FOLDER Parameters structure. */
487+struct shfl_map_folder {
488+ /**
489+ * pointer, in:
490+ * Points to struct shfl_string buffer.
491+ */
492+ struct vmmdev_hgcm_function_parameter path;
493+
494+ /**
495+ * pointer, out: SHFLROOT (u32)
496+ * Root handle of the mapping which name is queried.
497+ */
498+ struct vmmdev_hgcm_function_parameter root;
499+
500+ /**
501+ * pointer, in: UTF16
502+ * Path delimiter
503+ */
504+ struct vmmdev_hgcm_function_parameter delimiter;
505+
506+ /**
507+ * pointer, in: SHFLROOT (u32)
508+ * Case senstive flag
509+ */
510+ struct vmmdev_hgcm_function_parameter case_sensitive;
511+
512+};
513+
514+/* Number of parameters */
515+#define SHFL_CPARMS_MAP_FOLDER (4)
516+
517+
518+/** SHFL_FN_UNMAP_FOLDER Parameters structure. */
519+struct shfl_unmap_folder {
520+ /**
521+ * pointer, in: SHFLROOT (u32)
522+ * Root handle of the mapping which name is queried.
523+ */
524+ struct vmmdev_hgcm_function_parameter root;
525+
526+};
527+
528+/* Number of parameters */
529+#define SHFL_CPARMS_UNMAP_FOLDER (1)
530+
531+
532+/** SHFL_FN_CREATE Parameters structure. */
533+struct shfl_create {
534+ /**
535+ * pointer, in: SHFLROOT (u32)
536+ * Root handle of the mapping which name is queried.
537+ */
538+ struct vmmdev_hgcm_function_parameter root;
539+
540+ /**
541+ * pointer, in:
542+ * Points to struct shfl_string buffer.
543+ */
544+ struct vmmdev_hgcm_function_parameter path;
545+
546+ /**
547+ * pointer, in/out:
548+ * Points to struct shfl_createparms buffer.
549+ */
550+ struct vmmdev_hgcm_function_parameter parms;
551+
552+};
553+
554+/* Number of parameters */
555+#define SHFL_CPARMS_CREATE (3)
556+
557+
558+/** SHFL_FN_CLOSE Parameters structure. */
559+struct shfl_close {
560+ /**
561+ * pointer, in: SHFLROOT (u32)
562+ * Root handle of the mapping which name is queried.
563+ */
564+ struct vmmdev_hgcm_function_parameter root;
565+
566+ /**
567+ * value64, in:
568+ * SHFLHANDLE (u64) of object to close.
569+ */
570+ struct vmmdev_hgcm_function_parameter handle;
571+
572+};
573+
574+/* Number of parameters */
575+#define SHFL_CPARMS_CLOSE (2)
576+
577+
578+/** SHFL_FN_READ Parameters structure. */
579+struct shfl_read {
580+ /**
581+ * pointer, in: SHFLROOT (u32)
582+ * Root handle of the mapping which name is queried.
583+ */
584+ struct vmmdev_hgcm_function_parameter root;
585+
586+ /**
587+ * value64, in:
588+ * SHFLHANDLE (u64) of object to read from.
589+ */
590+ struct vmmdev_hgcm_function_parameter handle;
591+
592+ /**
593+ * value64, in:
594+ * Offset to read from.
595+ */
596+ struct vmmdev_hgcm_function_parameter offset;
597+
598+ /**
599+ * value64, in/out:
600+ * Bytes to read/How many were read.
601+ */
602+ struct vmmdev_hgcm_function_parameter cb;
603+
604+ /**
605+ * pointer, out:
606+ * Buffer to place data to.
607+ */
608+ struct vmmdev_hgcm_function_parameter buffer;
609+
610+};
611+
612+/* Number of parameters */
613+#define SHFL_CPARMS_READ (5)
614+
615+
616+/** SHFL_FN_WRITE Parameters structure. */
617+struct shfl_write {
618+ /**
619+ * pointer, in: SHFLROOT (u32)
620+ * Root handle of the mapping which name is queried.
621+ */
622+ struct vmmdev_hgcm_function_parameter root;
623+
624+ /**
625+ * value64, in:
626+ * SHFLHANDLE (u64) of object to write to.
627+ */
628+ struct vmmdev_hgcm_function_parameter handle;
629+
630+ /**
631+ * value64, in:
632+ * Offset to write to.
633+ */
634+ struct vmmdev_hgcm_function_parameter offset;
635+
636+ /**
637+ * value64, in/out:
638+ * Bytes to write/How many were written.
639+ */
640+ struct vmmdev_hgcm_function_parameter cb;
641+
642+ /**
643+ * pointer, in:
644+ * Data to write.
645+ */
646+ struct vmmdev_hgcm_function_parameter buffer;
647+
648+};
649+
650+/* Number of parameters */
651+#define SHFL_CPARMS_WRITE (5)
652+
653+
654+/*
655+ * SHFL_FN_LIST
656+ * Listing information includes variable length RTDIRENTRY[EX] structures.
657+ */
658+
659+#define SHFL_LIST_NONE 0
660+#define SHFL_LIST_RETURN_ONE 1
661+
662+/** SHFL_FN_LIST Parameters structure. */
663+struct shfl_list {
664+ /**
665+ * pointer, in: SHFLROOT (u32)
666+ * Root handle of the mapping which name is queried.
667+ */
668+ struct vmmdev_hgcm_function_parameter root;
669+
670+ /**
671+ * value64, in:
672+ * SHFLHANDLE (u64) of object to be listed.
673+ */
674+ struct vmmdev_hgcm_function_parameter handle;
675+
676+ /**
677+ * value32, in:
678+ * List flags SHFL_LIST_*.
679+ */
680+ struct vmmdev_hgcm_function_parameter flags;
681+
682+ /**
683+ * value32, in/out:
684+ * Bytes to be used for listing information/How many bytes were used.
685+ */
686+ struct vmmdev_hgcm_function_parameter cb;
687+
688+ /**
689+ * pointer, in/optional
690+ * Points to struct shfl_string buffer that specifies a search path.
691+ */
692+ struct vmmdev_hgcm_function_parameter path;
693+
694+ /**
695+ * pointer, out:
696+ * Buffer to place listing information to. (struct shfl_dirinfo)
697+ */
698+ struct vmmdev_hgcm_function_parameter buffer;
699+
700+ /**
701+ * value32, in/out:
702+ * Indicates a key where the listing must be resumed.
703+ * in: 0 means start from begin of object.
704+ * out: 0 means listing completed.
705+ */
706+ struct vmmdev_hgcm_function_parameter resume_point;
707+
708+ /**
709+ * pointer, out:
710+ * Number of files returned
711+ */
712+ struct vmmdev_hgcm_function_parameter file_count;
713+};
714+
715+/* Number of parameters */
716+#define SHFL_CPARMS_LIST (8)
717+
718+
719+/** SHFL_FN_READLINK Parameters structure. */
720+struct shfl_readLink {
721+ /**
722+ * pointer, in: SHFLROOT (u32)
723+ * Root handle of the mapping which name is queried.
724+ */
725+ struct vmmdev_hgcm_function_parameter root;
726+
727+ /**
728+ * pointer, in:
729+ * Points to struct shfl_string buffer.
730+ */
731+ struct vmmdev_hgcm_function_parameter path;
732+
733+ /**
734+ * pointer, out:
735+ * Buffer to place data to.
736+ */
737+ struct vmmdev_hgcm_function_parameter buffer;
738+
739+};
740+
741+/* Number of parameters */
742+#define SHFL_CPARMS_READLINK (3)
743+
744+
745+/* SHFL_FN_INFORMATION */
746+
747+/* Mask of Set/Get bit. */
748+#define SHFL_INFO_MODE_MASK (0x1)
749+/* Get information */
750+#define SHFL_INFO_GET (0x0)
751+/* Set information */
752+#define SHFL_INFO_SET (0x1)
753+
754+/* Get name of the object. */
755+#define SHFL_INFO_NAME (0x2)
756+/* Set size of object (extend/trucate); only applies to file objects */
757+#define SHFL_INFO_SIZE (0x4)
758+/* Get/Set file object info. */
759+#define SHFL_INFO_FILE (0x8)
760+/* Get volume information. */
761+#define SHFL_INFO_VOLUME (0x10)
762+
763+/** SHFL_FN_INFORMATION Parameters structure. */
764+struct shfl_information {
765+ /**
766+ * pointer, in: SHFLROOT (u32)
767+ * Root handle of the mapping which name is queried.
768+ */
769+ struct vmmdev_hgcm_function_parameter root;
770+
771+ /**
772+ * value64, in:
773+ * SHFLHANDLE (u64) of object to be listed.
774+ */
775+ struct vmmdev_hgcm_function_parameter handle;
776+
777+ /**
778+ * value32, in:
779+ * SHFL_INFO_*
780+ */
781+ struct vmmdev_hgcm_function_parameter flags;
782+
783+ /**
784+ * value32, in/out:
785+ * Bytes to be used for information/How many bytes were used.
786+ */
787+ struct vmmdev_hgcm_function_parameter cb;
788+
789+ /**
790+ * pointer, in/out:
791+ * Information to be set/get (shfl_fsobjinfo or shfl_string). Do not
792+ * forget to set the shfl_fsobjinfo::attr::additional for a get
793+ * operation as well.
794+ */
795+ struct vmmdev_hgcm_function_parameter info;
796+
797+};
798+
799+/* Number of parameters */
800+#define SHFL_CPARMS_INFORMATION (5)
801+
802+
803+/* SHFL_FN_REMOVE */
804+
805+#define SHFL_REMOVE_FILE (0x1)
806+#define SHFL_REMOVE_DIR (0x2)
807+#define SHFL_REMOVE_SYMLINK (0x4)
808+
809+/** SHFL_FN_REMOVE Parameters structure. */
810+struct shfl_remove {
811+ /**
812+ * pointer, in: SHFLROOT (u32)
813+ * Root handle of the mapping which name is queried.
814+ */
815+ struct vmmdev_hgcm_function_parameter root;
816+
817+ /**
818+ * pointer, in:
819+ * Points to struct shfl_string buffer.
820+ */
821+ struct vmmdev_hgcm_function_parameter path;
822+
823+ /**
824+ * value32, in:
825+ * remove flags (file/directory)
826+ */
827+ struct vmmdev_hgcm_function_parameter flags;
828+
829+};
830+
831+#define SHFL_CPARMS_REMOVE (3)
832+
833+
834+/* SHFL_FN_RENAME */
835+
836+#define SHFL_RENAME_FILE (0x1)
837+#define SHFL_RENAME_DIR (0x2)
838+#define SHFL_RENAME_REPLACE_IF_EXISTS (0x4)
839+
840+/** SHFL_FN_RENAME Parameters structure. */
841+struct shfl_rename {
842+ /**
843+ * pointer, in: SHFLROOT (u32)
844+ * Root handle of the mapping which name is queried.
845+ */
846+ struct vmmdev_hgcm_function_parameter root;
847+
848+ /**
849+ * pointer, in:
850+ * Points to struct shfl_string src.
851+ */
852+ struct vmmdev_hgcm_function_parameter src;
853+
854+ /**
855+ * pointer, in:
856+ * Points to struct shfl_string dest.
857+ */
858+ struct vmmdev_hgcm_function_parameter dest;
859+
860+ /**
861+ * value32, in:
862+ * rename flags (file/directory)
863+ */
864+ struct vmmdev_hgcm_function_parameter flags;
865+
866+};
867+
868+#define SHFL_CPARMS_RENAME (4)
869+
870+
871+/** SHFL_FN_SYMLINK Parameters structure. */
872+struct shfl_symlink {
873+ /**
874+ * pointer, in: SHFLROOT (u32)
875+ * Root handle of the mapping which name is queried.
876+ */
877+ struct vmmdev_hgcm_function_parameter root;
878+
879+ /**
880+ * pointer, in:
881+ * Points to struct shfl_string of path for the new symlink.
882+ */
883+ struct vmmdev_hgcm_function_parameter new_path;
884+
885+ /**
886+ * pointer, in:
887+ * Points to struct shfl_string of destination for symlink.
888+ */
889+ struct vmmdev_hgcm_function_parameter old_path;
890+
891+ /**
892+ * pointer, out:
893+ * Information about created symlink.
894+ */
895+ struct vmmdev_hgcm_function_parameter info;
896+
897+};
898+
899+#define SHFL_CPARMS_SYMLINK (4)
900+
901+#endif
drivers/staging/vboxsf/super.c+501−0
@@ -0,0 +1,501 @@
1+// SPDX-License-Identifier: MIT
2+/*
3+ * VirtualBox Guest Shared Folders support: Virtual File System.
4+ *
5+ * Module initialization/finalization
6+ * File system registration/deregistration
7+ * Superblock reading
8+ * Few utility functions
9+ *
10+ * Copyright (C) 2006-2018 Oracle Corporation
11+ */
12+
13+#include <linux/idr.h>
14+#include <linux/fs_parser.h>
15+#include <linux/magic.h>
16+#include <linux/module.h>
17+#include <linux/nls.h>
18+#include <linux/statfs.h>
19+#include <linux/vbox_utils.h>
20+#include "vfsmod.h"
21+
22+#define VBOXSF_SUPER_MAGIC 0x786f4256 /* 'VBox' little endian */
23+
24+#define VBSF_MOUNT_SIGNATURE_BYTE_0 ('\000')
25+#define VBSF_MOUNT_SIGNATURE_BYTE_1 ('\377')
26+#define VBSF_MOUNT_SIGNATURE_BYTE_2 ('\376')
27+#define VBSF_MOUNT_SIGNATURE_BYTE_3 ('\375')
28+
29+static int follow_symlinks;
30+module_param(follow_symlinks, int, 0444);
31+MODULE_PARM_DESC(follow_symlinks,
32+ "Let host resolve symlinks rather than showing them");
33+
34+static DEFINE_IDA(vboxsf_bdi_ida);
35+static DEFINE_MUTEX(vboxsf_setup_mutex);
36+static bool vboxsf_setup_done;
37+static struct super_operations vboxsf_super_ops; /* forward declaration */
38+static struct kmem_cache *vboxsf_inode_cachep;
39+
40+static char * const vboxsf_default_nls = CONFIG_NLS_DEFAULT;
41+
42+enum { opt_nls, opt_uid, opt_gid, opt_ttl, opt_dmode, opt_fmode,
43+ opt_dmask, opt_fmask };
44+
45+static const struct fs_parameter_spec vboxsf_param_specs[] = {
46+ fsparam_string ("nls", opt_nls),
47+ fsparam_u32 ("uid", opt_uid),
48+ fsparam_u32 ("gid", opt_gid),
49+ fsparam_u32 ("ttl", opt_ttl),
50+ fsparam_u32oct ("dmode", opt_dmode),
51+ fsparam_u32oct ("fmode", opt_fmode),
52+ fsparam_u32oct ("dmask", opt_dmask),
53+ fsparam_u32oct ("fmask", opt_fmask),
54+ {}
55+};
56+
57+static const struct fs_parameter_description vboxsf_fs_parameters = {
58+ .name = "vboxsf",
59+ .specs = vboxsf_param_specs,
60+};
61+
62+static int vboxsf_parse_param(struct fs_context *fc, struct fs_parameter *param)
63+{
64+ struct vboxsf_fs_context *ctx = fc->fs_private;
65+ struct fs_parse_result result;
66+ kuid_t uid;
67+ kgid_t gid;
68+ int opt;
69+
70+ opt = fs_parse(fc, &vboxsf_fs_parameters, param, &result);
71+ if (opt < 0)
72+ return opt;
73+
74+ switch (opt) {
75+ case opt_nls:
76+ if (fc->purpose != FS_CONTEXT_FOR_MOUNT) {
77+ vbg_err("vboxsf: Cannot reconfigure nls option\n");
78+ return -EINVAL;
79+ }
80+ ctx->nls_name = param->string;
81+ param->string = NULL;
82+ break;
83+ case opt_uid:
84+ uid = make_kuid(current_user_ns(), result.uint_32);
85+ if (!uid_valid(uid))
86+ return -EINVAL;
87+ ctx->o.uid = uid;
88+ break;
89+ case opt_gid:
90+ gid = make_kgid(current_user_ns(), result.uint_32);
91+ if (!gid_valid(gid))
92+ return -EINVAL;
93+ ctx->o.gid = gid;
94+ break;
95+ case opt_ttl:
96+ ctx->o.ttl = msecs_to_jiffies(result.uint_32);
97+ break;
98+ case opt_dmode:
99+ if (result.uint_32 & ~0777)
100+ return -EINVAL;
101+ ctx->o.dmode = result.uint_32;
102+ ctx->o.dmode_set = true;
103+ break;
104+ case opt_fmode:
105+ if (result.uint_32 & ~0777)
106+ return -EINVAL;
107+ ctx->o.fmode = result.uint_32;
108+ ctx->o.fmode_set = true;
109+ break;
110+ case opt_dmask:
111+ if (result.uint_32 & ~07777)
112+ return -EINVAL;
113+ ctx->o.dmask = result.uint_32;
114+ break;
115+ case opt_fmask:
116+ if (result.uint_32 & ~07777)
117+ return -EINVAL;
118+ ctx->o.fmask = result.uint_32;
119+ break;
120+ default:
121+ return -EINVAL;
122+ }
123+
124+ return 0;
125+}
126+
127+static int vboxsf_fill_super(struct super_block *sb, struct fs_context *fc)
128+{
129+ struct vboxsf_fs_context *ctx = fc->fs_private;
130+ struct shfl_string *folder_name, root_path;
131+ struct vboxsf_sbi *sbi;
132+ struct dentry *droot;
133+ struct inode *iroot;
134+ char *nls_name;
135+ size_t size;
136+ int err;
137+
138+ if (!fc->source)
139+ return -EINVAL;
140+
141+ sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
142+ if (!sbi)
143+ return -ENOMEM;
144+
145+ sbi->o = ctx->o;
146+ idr_init(&sbi->ino_idr);
147+ spin_lock_init(&sbi->ino_idr_lock);
148+ sbi->next_generation = 1;
149+ sbi->bdi_id = -1;
150+
151+ /* Load nls if not utf8 */
152+ nls_name = ctx->nls_name ? ctx->nls_name : vboxsf_default_nls;
153+ if (strcmp(nls_name, "utf8") != 0) {
154+ if (nls_name == vboxsf_default_nls)
155+ sbi->nls = load_nls_default();
156+ else
157+ sbi->nls = load_nls(nls_name);
158+
159+ if (!sbi->nls) {
160+ vbg_err("vboxsf: Count not load '%s' nls\n", nls_name);
161+ err = -EINVAL;
162+ goto fail_free;
163+ }
164+ }
165+
166+ sbi->bdi_id = ida_simple_get(&vboxsf_bdi_ida, 0, 0, GFP_KERNEL);
167+ if (sbi->bdi_id < 0) {
168+ err = sbi->bdi_id;
169+ goto fail_free;
170+ }
171+
172+ err = super_setup_bdi_name(sb, "vboxsf-%s.%d", fc->source, sbi->bdi_id);
173+ if (err)
174+ goto fail_free;
175+
176+ /* Turn source into a shfl_string and map the folder */
177+ size = strlen(fc->source) + 1;
178+ folder_name = kmalloc(SHFLSTRING_HEADER_SIZE + size, GFP_KERNEL);
179+ if (!folder_name) {
180+ err = -ENOMEM;
181+ goto fail_free;
182+ }
183+ folder_name->size = size;
184+ folder_name->length = size - 1;
185+ strlcpy(folder_name->string.utf8, fc->source, size);
186+ err = vboxsf_map_folder(folder_name, &sbi->root);
187+ kfree(folder_name);
188+ if (err) {
189+ vbg_err("vboxsf: Host rejected mount of '%s' with error %d\n",
190+ fc->source, err);
191+ goto fail_free;
192+ }
193+
194+ root_path.length = 1;
195+ root_path.size = 2;
196+ root_path.string.utf8[0] = '/';
197+ root_path.string.utf8[1] = 0;
198+ err = vboxsf_stat(sbi, &root_path, &sbi->root_info);
199+ if (err)
200+ goto fail_unmap;
201+
202+ sb->s_magic = VBOXSF_SUPER_MAGIC;
203+ sb->s_blocksize = 1024;
204+ sb->s_maxbytes = MAX_LFS_FILESIZE;
205+ sb->s_op = &vboxsf_super_ops;
206+ sb->s_d_op = &vboxsf_dentry_ops;
207+
208+ iroot = iget_locked(sb, 0);
209+ if (!iroot) {
210+ err = -ENOMEM;
211+ goto fail_unmap;
212+ }
213+ vboxsf_init_inode(sbi, iroot, &sbi->root_info);
214+ unlock_new_inode(iroot);
215+
216+ droot = d_make_root(iroot);
217+ if (!droot) {
218+ err = -ENOMEM;
219+ goto fail_unmap;
220+ }
221+
222+ sb->s_root = droot;
223+ sb->s_fs_info = sbi;
224+ return 0;
225+
226+fail_unmap:
227+ vboxsf_unmap_folder(sbi->root);
228+fail_free:
229+ if (sbi->bdi_id >= 0)
230+ ida_simple_remove(&vboxsf_bdi_ida, sbi->bdi_id);
231+ if (sbi->nls)
232+ unload_nls(sbi->nls);
233+ idr_destroy(&sbi->ino_idr);
234+ kfree(sbi);
235+ return err;
236+}
237+
238+static void vboxsf_inode_init_once(void *data)
239+{
240+ struct vboxsf_inode *sf_i = data;
241+
242+ mutex_init(&sf_i->handle_list_mutex);
243+ inode_init_once(&sf_i->vfs_inode);
244+}
245+
246+static struct inode *vboxsf_alloc_inode(struct super_block *sb)
247+{
248+ struct vboxsf_inode *sf_i;
249+
250+ sf_i = kmem_cache_alloc(vboxsf_inode_cachep, GFP_NOFS);
251+ if (!sf_i)
252+ return NULL;
253+
254+ sf_i->force_restat = 0;
255+ INIT_LIST_HEAD(&sf_i->handle_list);
256+
257+ return &sf_i->vfs_inode;
258+}
259+
260+static void vboxsf_free_inode(struct inode *inode)
261+{
262+ struct vboxsf_sbi *sbi = VBOXSF_SBI(inode->i_sb);
263+ unsigned long flags;
264+
265+ spin_lock_irqsave(&sbi->ino_idr_lock, flags);
266+ idr_remove(&sbi->ino_idr, inode->i_ino);
267+ spin_unlock_irqrestore(&sbi->ino_idr_lock, flags);
268+ kmem_cache_free(vboxsf_inode_cachep, VBOXSF_I(inode));
269+}
270+
271+static void vboxsf_put_super(struct super_block *sb)
272+{
273+ struct vboxsf_sbi *sbi = VBOXSF_SBI(sb);
274+
275+ vboxsf_unmap_folder(sbi->root);
276+ if (sbi->bdi_id >= 0)
277+ ida_simple_remove(&vboxsf_bdi_ida, sbi->bdi_id);
278+ if (sbi->nls)
279+ unload_nls(sbi->nls);
280+
281+ /*
282+ * vboxsf_free_inode uses the idr, make sure all delayed rcu free
283+ * inodes are flushed.
284+ */
285+ rcu_barrier();
286+ idr_destroy(&sbi->ino_idr);
287+ kfree(sbi);
288+}
289+
290+static int vboxsf_statfs(struct dentry *dentry, struct kstatfs *stat)
291+{
292+ struct super_block *sb = dentry->d_sb;
293+ struct shfl_volinfo shfl_volinfo;
294+ struct vboxsf_sbi *sbi;
295+ u32 buf_len;
296+ int err;
297+
298+ sbi = VBOXSF_SBI(sb);
299+ buf_len = sizeof(shfl_volinfo);
300+ err = vboxsf_fsinfo(sbi->root, 0, SHFL_INFO_GET | SHFL_INFO_VOLUME,
301+ &buf_len, &shfl_volinfo);
302+ if (err)
303+ return err;
304+
305+ stat->f_type = VBOXSF_SUPER_MAGIC;
306+ stat->f_bsize = shfl_volinfo.bytes_per_allocation_unit;
307+
308+ do_div(shfl_volinfo.total_allocation_bytes,
309+ shfl_volinfo.bytes_per_allocation_unit);
310+ stat->f_blocks = shfl_volinfo.total_allocation_bytes;
311+
312+ do_div(shfl_volinfo.available_allocation_bytes,
313+ shfl_volinfo.bytes_per_allocation_unit);
314+ stat->f_bfree = shfl_volinfo.available_allocation_bytes;
315+ stat->f_bavail = shfl_volinfo.available_allocation_bytes;
316+
317+ stat->f_files = 1000;
318+ /*
319+ * Don't return 0 here since the guest may then think that it is not
320+ * possible to create any more files.
321+ */
322+ stat->f_ffree = 1000000;
323+ stat->f_fsid.val[0] = 0;
324+ stat->f_fsid.val[1] = 0;
325+ stat->f_namelen = 255;
326+ return 0;
327+}
328+
329+static struct super_operations vboxsf_super_ops = {
330+ .alloc_inode = vboxsf_alloc_inode,
331+ .free_inode = vboxsf_free_inode,
332+ .put_super = vboxsf_put_super,
333+ .statfs = vboxsf_statfs,
334+};
335+
336+static int vboxsf_setup(void)
337+{
338+ int err;
339+
340+ mutex_lock(&vboxsf_setup_mutex);
341+
342+ if (vboxsf_setup_done)
343+ goto success;
344+
345+ vboxsf_inode_cachep =
346+ kmem_cache_create("vboxsf_inode_cache",
347+ sizeof(struct vboxsf_inode), 0,
348+ (SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD |
349+ SLAB_ACCOUNT),
350+ vboxsf_inode_init_once);
351+ if (!vboxsf_inode_cachep) {
352+ err = -ENOMEM;
353+ goto fail_nomem;
354+ }
355+
356+ err = vboxsf_connect();
357+ if (err) {
358+ vbg_err("vboxsf: err %d connecting to guest PCI-device\n", err);
359+ vbg_err("vboxsf: make sure you are inside a VirtualBox VM\n");
360+ vbg_err("vboxsf: and check dmesg for vboxguest errors\n");
361+ goto fail_free_cache;
362+ }
363+
364+ err = vboxsf_set_utf8();
365+ if (err) {
366+ vbg_err("vboxsf_setutf8 error %d\n", err);
367+ goto fail_disconnect;
368+ }
369+
370+ if (!follow_symlinks) {
371+ err = vboxsf_set_symlinks();
372+ if (err)
373+ vbg_warn("vboxsf: Unable to show symlinks: %d\n", err);
374+ }
375+
376+ vboxsf_setup_done = true;
377+success:
378+ mutex_unlock(&vboxsf_setup_mutex);
379+ return 0;
380+
381+fail_disconnect:
382+ vboxsf_disconnect();
383+fail_free_cache:
384+ kmem_cache_destroy(vboxsf_inode_cachep);
385+fail_nomem:
386+ mutex_unlock(&vboxsf_setup_mutex);
387+ return err;
388+}
389+
390+static int vboxsf_parse_monolithic(struct fs_context *fc, void *data)
391+{
392+ char *options = data;
393+
394+ if (options && options[0] == VBSF_MOUNT_SIGNATURE_BYTE_0 &&
395+ options[1] == VBSF_MOUNT_SIGNATURE_BYTE_1 &&
396+ options[2] == VBSF_MOUNT_SIGNATURE_BYTE_2 &&
397+ options[3] == VBSF_MOUNT_SIGNATURE_BYTE_3) {
398+ vbg_err("vboxsf: Old binary mount data not supported, remove obsolete mount.vboxsf and/or update your VBoxService.\n");
399+ return -EINVAL;
400+ }
401+
402+ return generic_parse_monolithic(fc, data);
403+}
404+
405+static int vboxsf_get_tree(struct fs_context *fc)
406+{
407+ int err;
408+
409+ err = vboxsf_setup();
410+ if (err)
411+ return err;
412+
413+ return vfs_get_super(fc, vfs_get_independent_super, vboxsf_fill_super);
414+}
415+
416+static int vboxsf_reconfigure(struct fs_context *fc)
417+{
418+ struct vboxsf_sbi *sbi = VBOXSF_SBI(fc->root->d_sb);
419+ struct vboxsf_fs_context *ctx = fc->fs_private;
420+ struct inode *iroot;
421+
422+ iroot = ilookup(fc->root->d_sb, 0);
423+ if (!iroot)
424+ return -ENOENT;
425+
426+ /* Apply changed options to the root inode */
427+ sbi->o = ctx->o;
428+ vboxsf_init_inode(sbi, iroot, &sbi->root_info);
429+
430+ return 0;
431+}
432+
433+static void vboxsf_free_fc(struct fs_context *fc)
434+{
435+ struct vboxsf_fs_context *ctx = fc->fs_private;
436+
437+ kfree(ctx->nls_name);
438+ kfree(ctx);
439+}
440+
441+static const struct fs_context_operations vboxsf_context_ops = {
442+ .free = vboxsf_free_fc,
443+ .parse_param = vboxsf_parse_param,
444+ .parse_monolithic = vboxsf_parse_monolithic,
445+ .get_tree = vboxsf_get_tree,
446+ .reconfigure = vboxsf_reconfigure,
447+};
448+
449+static int vboxsf_init_fs_context(struct fs_context *fc)
450+{
451+ struct vboxsf_fs_context *ctx;
452+
453+ ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
454+ if (!ctx)
455+ return -ENOMEM;
456+
457+ current_uid_gid(&ctx->o.uid, &ctx->o.gid);
458+
459+ fc->fs_private = ctx;
460+ fc->ops = &vboxsf_context_ops;
461+ return 0;
462+}
463+
464+static struct file_system_type vboxsf_fs_type = {
465+ .owner = THIS_MODULE,
466+ .name = "vboxsf",
467+ .init_fs_context = vboxsf_init_fs_context,
468+ .parameters = &vboxsf_fs_parameters,
469+ .kill_sb = kill_anon_super
470+};
471+
472+/* Module initialization/finalization handlers */
473+static int __init vboxsf_init(void)
474+{
475+ return register_filesystem(&vboxsf_fs_type);
476+}
477+
478+static void __exit vboxsf_fini(void)
479+{
480+ unregister_filesystem(&vboxsf_fs_type);
481+
482+ mutex_lock(&vboxsf_setup_mutex);
483+ if (vboxsf_setup_done) {
484+ vboxsf_disconnect();
485+ /*
486+ * Make sure all delayed rcu free inodes are flushed
487+ * before we destroy the cache.
488+ */
489+ rcu_barrier();
490+ kmem_cache_destroy(vboxsf_inode_cachep);
491+ }
492+ mutex_unlock(&vboxsf_setup_mutex);
493+}
494+
495+module_init(vboxsf_init);
496+module_exit(vboxsf_fini);
497+
498+MODULE_DESCRIPTION("Oracle VM VirtualBox Module for Host File System Access");
499+MODULE_AUTHOR("Oracle Corporation");
500+MODULE_LICENSE("GPL v2");
501+MODULE_ALIAS_FS("vboxsf");
drivers/staging/vboxsf/utils.c+551−0
@@ -0,0 +1,551 @@
1+// SPDX-License-Identifier: MIT
2+/*
3+ * VirtualBox Guest Shared Folders support: Utility functions.
4+ * Mainly conversion from/to VirtualBox/Linux data structures.
5+ *
6+ * Copyright (C) 2006-2018 Oracle Corporation
7+ */
8+
9+#include <linux/namei.h>
10+#include <linux/nls.h>
11+#include <linux/sizes.h>
12+#include <linux/vfs.h>
13+#include "vfsmod.h"
14+
15+struct inode *vboxsf_new_inode(struct super_block *sb)
16+{
17+ struct vboxsf_sbi *sbi = VBOXSF_SBI(sb);
18+ struct inode *inode;
19+ unsigned long flags;
20+ int cursor, ret;
21+ u32 gen;
22+
23+ inode = new_inode(sb);
24+ if (!inode)
25+ return ERR_PTR(-ENOMEM);
26+
27+ idr_preload(GFP_KERNEL);
28+ spin_lock_irqsave(&sbi->ino_idr_lock, flags);
29+ cursor = idr_get_cursor(&sbi->ino_idr);
30+ ret = idr_alloc_cyclic(&sbi->ino_idr, inode, 1, 0, GFP_ATOMIC);
31+ if (ret >= 0 && ret < cursor)
32+ sbi->next_generation++;
33+ gen = sbi->next_generation;
34+ spin_unlock_irqrestore(&sbi->ino_idr_lock, flags);
35+ idr_preload_end();
36+
37+ if (ret < 0) {
38+ iput(inode);
39+ return ERR_PTR(ret);
40+ }
41+
42+ inode->i_ino = ret;
43+ inode->i_generation = gen;
44+ return inode;
45+}
46+
47+/* set [inode] attributes based on [info], uid/gid based on [sbi] */
48+void vboxsf_init_inode(struct vboxsf_sbi *sbi, struct inode *inode,
49+ const struct shfl_fsobjinfo *info)
50+{
51+ const struct shfl_fsobjattr *attr;
52+ s64 allocated;
53+ int mode;
54+
55+ attr = &info->attr;
56+
57+#define mode_set(r) ((attr->mode & (SHFL_UNIX_##r)) ? (S_##r) : 0)
58+
59+ mode = mode_set(IRUSR);
60+ mode |= mode_set(IWUSR);
61+ mode |= mode_set(IXUSR);
62+
63+ mode |= mode_set(IRGRP);
64+ mode |= mode_set(IWGRP);
65+ mode |= mode_set(IXGRP);
66+
67+ mode |= mode_set(IROTH);
68+ mode |= mode_set(IWOTH);
69+ mode |= mode_set(IXOTH);
70+
71+#undef mode_set
72+
73+ /* We use the host-side values for these */
74+ inode->i_flags |= S_NOATIME | S_NOCMTIME;
75+ inode->i_mapping->a_ops = &vboxsf_reg_aops;
76+
77+ if (SHFL_IS_DIRECTORY(attr->mode)) {
78+ inode->i_mode = sbi->o.dmode_set ? sbi->o.dmode : mode;
79+ inode->i_mode &= ~sbi->o.dmask;
80+ inode->i_mode |= S_IFDIR;
81+ inode->i_op = &vboxsf_dir_iops;
82+ inode->i_fop = &vboxsf_dir_fops;
83+ /*
84+ * XXX: this probably should be set to the number of entries
85+ * in the directory plus two (. ..)
86+ */
87+ set_nlink(inode, 1);
88+ } else if (SHFL_IS_SYMLINK(attr->mode)) {
89+ inode->i_mode = sbi->o.fmode_set ? sbi->o.fmode : mode;
90+ inode->i_mode &= ~sbi->o.fmask;
91+ inode->i_mode |= S_IFLNK;
92+ inode->i_op = &vboxsf_lnk_iops;
93+ set_nlink(inode, 1);
94+ } else {
95+ inode->i_mode = sbi->o.fmode_set ? sbi->o.fmode : mode;
96+ inode->i_mode &= ~sbi->o.fmask;
97+ inode->i_mode |= S_IFREG;
98+ inode->i_op = &vboxsf_reg_iops;
99+ inode->i_fop = &vboxsf_reg_fops;
100+ set_nlink(inode, 1);
101+ }
102+
103+ inode->i_uid = sbi->o.uid;
104+ inode->i_gid = sbi->o.gid;
105+
106+ inode->i_size = info->size;
107+ inode->i_blkbits = 12;
108+ /* i_blocks always in units of 512 bytes! */
109+ allocated = info->allocated + 511;
110+ do_div(allocated, 512);
111+ inode->i_blocks = allocated;
112+
113+ inode->i_atime = ns_to_timespec64(
114+ info->access_time.ns_relative_to_unix_epoch);
115+ inode->i_ctime = ns_to_timespec64(
116+ info->change_time.ns_relative_to_unix_epoch);
117+ inode->i_mtime = ns_to_timespec64(
118+ info->modification_time.ns_relative_to_unix_epoch);
119+}
120+
121+int vboxsf_create_at_dentry(struct dentry *dentry,
122+ struct shfl_createparms *params)
123+{
124+ struct vboxsf_sbi *sbi = VBOXSF_SBI(dentry->d_sb);
125+ struct shfl_string *path;
126+ int err;
127+
128+ path = vboxsf_path_from_dentry(sbi, dentry);
129+ if (IS_ERR(path))
130+ return PTR_ERR(path);
131+
132+ err = vboxsf_create(sbi->root, path, params);
133+ __putname(path);
134+
135+ return err;
136+}
137+
138+int vboxsf_stat(struct vboxsf_sbi *sbi, struct shfl_string *path,
139+ struct shfl_fsobjinfo *info)
140+{
141+ struct shfl_createparms params = {};
142+ int err;
143+
144+ params.handle = SHFL_HANDLE_NIL;
145+ params.create_flags = SHFL_CF_LOOKUP | SHFL_CF_ACT_FAIL_IF_NEW;
146+
147+ err = vboxsf_create(sbi->root, path, &params);
148+ if (err)
149+ return err;
150+
151+ if (params.result != SHFL_FILE_EXISTS)
152+ return -ENOENT;
153+
154+ if (info)
155+ *info = params.info;
156+
157+ return 0;
158+}
159+
160+int vboxsf_stat_dentry(struct dentry *dentry, struct shfl_fsobjinfo *info)
161+{
162+ struct vboxsf_sbi *sbi = VBOXSF_SBI(dentry->d_sb);
163+ struct shfl_string *path;
164+ int err;
165+
166+ path = vboxsf_path_from_dentry(sbi, dentry);
167+ if (IS_ERR(path))
168+ return PTR_ERR(path);
169+
170+ err = vboxsf_stat(sbi, path, info);
171+ __putname(path);
172+ return err;
173+}
174+
175+int vboxsf_inode_revalidate(struct dentry *dentry)
176+{
177+ struct vboxsf_sbi *sbi;
178+ struct vboxsf_inode *sf_i;
179+ struct shfl_fsobjinfo info;
180+ struct timespec64 prev_mtime;
181+ struct inode *inode;
182+ int err;
183+
184+ if (!dentry || !d_really_is_positive(dentry))
185+ return -EINVAL;
186+
187+ inode = d_inode(dentry);
188+ prev_mtime = inode->i_mtime;
189+ sf_i = VBOXSF_I(inode);
190+ sbi = VBOXSF_SBI(dentry->d_sb);
191+ if (!sf_i->force_restat) {
192+ if (time_before(jiffies, dentry->d_time + sbi->o.ttl))
193+ return 0;
194+ }
195+
196+ err = vboxsf_stat_dentry(dentry, &info);
197+ if (err)
198+ return err;
199+
200+ dentry->d_time = jiffies;
201+ sf_i->force_restat = 0;
202+ vboxsf_init_inode(sbi, inode, &info);
203+
204+ /*
205+ * If the file was changed on the host side we need to invalidate the
206+ * page-cache for it. Note this also gets triggered by our own writes,
207+ * this is unavoidable.
208+ */
209+ if (timespec64_compare(&inode->i_mtime, &prev_mtime) > 0)
210+ invalidate_inode_pages2(inode->i_mapping);
211+
212+ return 0;
213+}
214+
215+int vboxsf_getattr(const struct path *path, struct kstat *kstat,
216+ u32 request_mask, unsigned int flags)
217+{
218+ int err;
219+ struct dentry *dentry = path->dentry;
220+ struct inode *inode = d_inode(dentry);
221+ struct vboxsf_inode *sf_i = VBOXSF_I(inode);
222+
223+ switch (flags & AT_STATX_SYNC_TYPE) {
224+ case AT_STATX_DONT_SYNC:
225+ err = 0;
226+ break;
227+ case AT_STATX_FORCE_SYNC:
228+ sf_i->force_restat = 1;
229+ /* fall-through */
230+ default:
231+ err = vboxsf_inode_revalidate(dentry);
232+ }
233+ if (err)
234+ return err;
235+
236+ generic_fillattr(d_inode(dentry), kstat);
237+ return 0;
238+}
239+
240+int vboxsf_setattr(struct dentry *dentry, struct iattr *iattr)
241+{
242+ struct vboxsf_inode *sf_i = VBOXSF_I(d_inode(dentry));
243+ struct vboxsf_sbi *sbi = VBOXSF_SBI(dentry->d_sb);
244+ struct shfl_createparms params = {};
245+ struct shfl_fsobjinfo info = {};
246+ u32 buf_len;
247+ int err;
248+
249+ params.handle = SHFL_HANDLE_NIL;
250+ params.create_flags = SHFL_CF_ACT_OPEN_IF_EXISTS |
251+ SHFL_CF_ACT_FAIL_IF_NEW |
252+ SHFL_CF_ACCESS_ATTR_WRITE;
253+
254+ /* this is at least required for Posix hosts */
255+ if (iattr->ia_valid & ATTR_SIZE)
256+ params.create_flags |= SHFL_CF_ACCESS_WRITE;
257+
258+ err = vboxsf_create_at_dentry(dentry, &params);
259+ if (err || params.result != SHFL_FILE_EXISTS)
260+ return err ? err : -ENOENT;
261+
262+#define mode_set(r) ((iattr->ia_mode & (S_##r)) ? SHFL_UNIX_##r : 0)
263+
264+ /*
265+ * Setting the file size and setting the other attributes has to
266+ * be handled separately.
267+ */
268+ if (iattr->ia_valid & (ATTR_MODE | ATTR_ATIME | ATTR_MTIME)) {
269+ if (iattr->ia_valid & ATTR_MODE) {
270+ info.attr.mode = mode_set(IRUSR);
271+ info.attr.mode |= mode_set(IWUSR);
272+ info.attr.mode |= mode_set(IXUSR);
273+ info.attr.mode |= mode_set(IRGRP);
274+ info.attr.mode |= mode_set(IWGRP);
275+ info.attr.mode |= mode_set(IXGRP);
276+ info.attr.mode |= mode_set(IROTH);
277+ info.attr.mode |= mode_set(IWOTH);
278+ info.attr.mode |= mode_set(IXOTH);
279+
280+ if (iattr->ia_mode & S_IFDIR)
281+ info.attr.mode |= SHFL_TYPE_DIRECTORY;
282+ else
283+ info.attr.mode |= SHFL_TYPE_FILE;
284+ }
285+
286+ if (iattr->ia_valid & ATTR_ATIME)
287+ info.access_time.ns_relative_to_unix_epoch =
288+ timespec64_to_ns(&iattr->ia_atime);
289+
290+ if (iattr->ia_valid & ATTR_MTIME)
291+ info.modification_time.ns_relative_to_unix_epoch =
292+ timespec64_to_ns(&iattr->ia_mtime);
293+
294+ /*
295+ * Ignore ctime (inode change time) as it can't be set
296+ * from userland anyway.
297+ */
298+
299+ buf_len = sizeof(info);
300+ err = vboxsf_fsinfo(sbi->root, params.handle,
301+ SHFL_INFO_SET | SHFL_INFO_FILE, &buf_len,
302+ &info);
303+ if (err) {
304+ vboxsf_close(sbi->root, params.handle);
305+ return err;
306+ }
307+
308+ /* the host may have given us different attr then requested */
309+ sf_i->force_restat = 1;
310+ }
311+
312+#undef mode_set
313+
314+ if (iattr->ia_valid & ATTR_SIZE) {
315+ memset(&info, 0, sizeof(info));
316+ info.size = iattr->ia_size;
317+ buf_len = sizeof(info);
318+ err = vboxsf_fsinfo(sbi->root, params.handle,
319+ SHFL_INFO_SET | SHFL_INFO_SIZE, &buf_len,
320+ &info);
321+ if (err) {
322+ vboxsf_close(sbi->root, params.handle);
323+ return err;
324+ }
325+
326+ /* the host may have given us different attr then requested */
327+ sf_i->force_restat = 1;
328+ }
329+
330+ vboxsf_close(sbi->root, params.handle);
331+
332+ /* Update the inode with what the host has actually given us. */
333+ if (sf_i->force_restat)
334+ vboxsf_inode_revalidate(dentry);
335+
336+ return 0;
337+}
338+
339+/*
340+ * [dentry] contains string encoded in coding system that corresponds
341+ * to [sbi]->nls, we must convert it to UTF8 here.
342+ * Returns a shfl_string allocated through __getname (must be freed using
343+ * __putname), or an ERR_PTR on error.
344+ */
345+struct shfl_string *vboxsf_path_from_dentry(struct vboxsf_sbi *sbi,
346+ struct dentry *dentry)
347+{
348+ struct shfl_string *shfl_path;
349+ int path_len, out_len, nb;
350+ char *buf, *path;
351+ wchar_t uni;
352+ u8 *out;
353+
354+ buf = __getname();
355+ if (!buf)
356+ return ERR_PTR(-ENOMEM);
357+
358+ path = dentry_path_raw(dentry, buf, PATH_MAX);
359+ if (IS_ERR(path)) {
360+ __putname(buf);
361+ return (struct shfl_string *)path;
362+ }
363+ path_len = strlen(path);
364+
365+ if (sbi->nls) {
366+ shfl_path = __getname();
367+ if (!shfl_path) {
368+ __putname(buf);
369+ return ERR_PTR(-ENOMEM);
370+ }
371+
372+ out = shfl_path->string.utf8;
373+ out_len = PATH_MAX - SHFLSTRING_HEADER_SIZE - 1;
374+
375+ while (path_len) {
376+ nb = sbi->nls->char2uni(path, path_len, &uni);
377+ if (nb < 0) {
378+ __putname(shfl_path);
379+ __putname(buf);
380+ return ERR_PTR(-EINVAL);
381+ }
382+ path += nb;
383+ path_len -= nb;
384+
385+ nb = utf32_to_utf8(uni, out, out_len);
386+ if (nb < 0) {
387+ __putname(shfl_path);
388+ __putname(buf);
389+ return ERR_PTR(-ENAMETOOLONG);
390+ }
391+ out += nb;
392+ out_len -= nb;
393+ }
394+ *out = 0;
395+ shfl_path->length = out - shfl_path->string.utf8;
396+ shfl_path->size = shfl_path->length + 1;
397+ __putname(buf);
398+ } else {
399+ if ((SHFLSTRING_HEADER_SIZE + path_len + 1) > PATH_MAX) {
400+ __putname(buf);
401+ return ERR_PTR(-ENAMETOOLONG);
402+ }
403+ /*
404+ * dentry_path stores the name at the end of buf, but the
405+ * shfl_string string we return must be properly aligned.
406+ */
407+ shfl_path = (struct shfl_string *)buf;
408+ memmove(shfl_path->string.utf8, path, path_len);
409+ shfl_path->string.utf8[path_len] = 0;
410+ shfl_path->length = path_len;
411+ shfl_path->size = path_len + 1;
412+ }
413+
414+ return shfl_path;
415+}
416+
417+int vboxsf_nlscpy(struct vboxsf_sbi *sbi, char *name, size_t name_bound_len,
418+ const unsigned char *utf8_name, size_t utf8_len)
419+{
420+ const char *in;
421+ char *out;
422+ size_t out_len;
423+ size_t out_bound_len;
424+ size_t in_bound_len;
425+
426+ in = utf8_name;
427+ in_bound_len = utf8_len;
428+
429+ out = name;
430+ out_len = 0;
431+ /* Reserve space for terminating 0 */
432+ out_bound_len = name_bound_len - 1;
433+
434+ while (in_bound_len) {
435+ int nb;
436+ unicode_t uni;
437+
438+ nb = utf8_to_utf32(in, in_bound_len, &uni);
439+ if (nb < 0)
440+ return -EINVAL;
441+
442+ in += nb;
443+ in_bound_len -= nb;
444+
445+ nb = sbi->nls->uni2char(uni, out, out_bound_len);
446+ if (nb < 0)
447+ return nb;
448+
449+ out += nb;
450+ out_bound_len -= nb;
451+ out_len += nb;
452+ }
453+
454+ *out = 0;
455+
456+ return 0;
457+}
458+
459+static struct vboxsf_dir_buf *vboxsf_dir_buf_alloc(struct list_head *list)
460+{
461+ struct vboxsf_dir_buf *b;
462+
463+ b = kmalloc(sizeof(*b), GFP_KERNEL);
464+ if (!b)
465+ return NULL;
466+
467+ b->buf = kmalloc(DIR_BUFFER_SIZE, GFP_KERNEL);
468+ if (!b->buf) {
469+ kfree(b);
470+ return NULL;
471+ }
472+
473+ b->entries = 0;
474+ b->used = 0;
475+ b->free = DIR_BUFFER_SIZE;
476+ list_add(&b->head, list);
477+
478+ return b;
479+}
480+
481+static void vboxsf_dir_buf_free(struct vboxsf_dir_buf *b)
482+{
483+ list_del(&b->head);
484+ kfree(b->buf);
485+ kfree(b);
486+}
487+
488+struct vboxsf_dir_info *vboxsf_dir_info_alloc(void)
489+{
490+ struct vboxsf_dir_info *p;
491+
492+ p = kmalloc(sizeof(*p), GFP_KERNEL);
493+ if (!p)
494+ return NULL;
495+
496+ INIT_LIST_HEAD(&p->info_list);
497+ return p;
498+}
499+
500+void vboxsf_dir_info_free(struct vboxsf_dir_info *p)
501+{
502+ struct list_head *list, *pos, *tmp;
503+
504+ list = &p->info_list;
505+ list_for_each_safe(pos, tmp, list) {
506+ struct vboxsf_dir_buf *b;
507+
508+ b = list_entry(pos, struct vboxsf_dir_buf, head);
509+ vboxsf_dir_buf_free(b);
510+ }
511+ kfree(p);
512+}
513+
514+int vboxsf_dir_read_all(struct vboxsf_sbi *sbi, struct vboxsf_dir_info *sf_d,
515+ u64 handle)
516+{
517+ struct vboxsf_dir_buf *b;
518+ u32 entries, size;
519+ int err = 0;
520+ void *buf;
521+
522+ /* vboxsf_dirinfo returns 1 on end of dir */
523+ while (err == 0) {
524+ b = vboxsf_dir_buf_alloc(&sf_d->info_list);
525+ if (!b) {
526+ err = -ENOMEM;
527+ break;
528+ }
529+
530+ buf = b->buf;
531+ size = b->free;
532+
533+ err = vboxsf_dirinfo(sbi->root, handle, NULL, 0, 0,
534+ &size, buf, &entries);
535+ if (err < 0)
536+ break;
537+
538+ b->entries += entries;
539+ b->free -= size;
540+ b->used += size;
541+ }
542+
543+ if (b && b->used == 0)
544+ vboxsf_dir_buf_free(b);
545+
546+ /* -EILSEQ means the host could not translate a filename, ignore */
547+ if (err > 0 || err == -EILSEQ)
548+ err = 0;
549+
550+ return err;
551+}
drivers/staging/vboxsf/vboxsf_wrappers.c+371−0
@@ -0,0 +1,371 @@
1+// SPDX-License-Identifier: MIT
2+/*
3+ * Wrapper functions for the shfl host calls.
4+ *
5+ * Copyright (C) 2006-2018 Oracle Corporation
6+ */
7+
8+#include <linux/mm.h>
9+#include <linux/slab.h>
10+#include <linux/vbox_err.h>
11+#include <linux/vbox_utils.h>
12+#include "vfsmod.h"
13+
14+#define SHFL_REQUEST \
15+ (VMMDEV_REQUESTOR_KERNEL | VMMDEV_REQUESTOR_USR_DRV_OTHER | \
16+ VMMDEV_REQUESTOR_CON_DONT_KNOW | VMMDEV_REQUESTOR_TRUST_NOT_GIVEN)
17+
18+static u32 vboxsf_client_id;
19+
20+int vboxsf_connect(void)
21+{
22+ struct vbg_dev *gdev;
23+ struct vmmdev_hgcm_service_location loc;
24+ int err, vbox_status;
25+
26+ loc.type = VMMDEV_HGCM_LOC_LOCALHOST_EXISTING;
27+ strcpy(loc.u.localhost.service_name, "VBoxSharedFolders");
28+
29+ gdev = vbg_get_gdev();
30+ if (IS_ERR(gdev))
31+ return -ENODEV; /* No guest-device */
32+
33+ err = vbg_hgcm_connect(gdev, SHFL_REQUEST, &loc,
34+ &vboxsf_client_id, &vbox_status);
35+ vbg_put_gdev(gdev);
36+
37+ return err ? err : vbg_status_code_to_errno(vbox_status);
38+}
39+
40+void vboxsf_disconnect(void)
41+{
42+ struct vbg_dev *gdev;
43+ int vbox_status;
44+
45+ gdev = vbg_get_gdev();
46+ if (IS_ERR(gdev))
47+ return; /* guest-device is gone, already disconnected */
48+
49+ vbg_hgcm_disconnect(gdev, SHFL_REQUEST, vboxsf_client_id, &vbox_status);
50+ vbg_put_gdev(gdev);
51+}
52+
53+static int vboxsf_call(u32 function, void *parms, u32 parm_count, int *status)
54+{
55+ struct vbg_dev *gdev;
56+ int err, vbox_status;
57+
58+ gdev = vbg_get_gdev();
59+ if (IS_ERR(gdev))
60+ return -ESHUTDOWN; /* guest-dev removed underneath us */
61+
62+ err = vbg_hgcm_call(gdev, SHFL_REQUEST, vboxsf_client_id, function,
63+ U32_MAX, parms, parm_count, &vbox_status);
64+ vbg_put_gdev(gdev);
65+
66+ if (err < 0)
67+ return err;
68+
69+ if (status)
70+ *status = vbox_status;
71+
72+ return vbg_status_code_to_errno(vbox_status);
73+}
74+
75+int vboxsf_map_folder(struct shfl_string *folder_name, u32 *root)
76+{
77+ struct shfl_map_folder parms;
78+ int err, status;
79+
80+ parms.path.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL;
81+ parms.path.u.pointer.size = shfl_string_buf_size(folder_name);
82+ parms.path.u.pointer.u.linear_addr = (uintptr_t)folder_name;
83+
84+ parms.root.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
85+ parms.root.u.value32 = 0;
86+
87+ parms.delimiter.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
88+ parms.delimiter.u.value32 = '/';
89+
90+ parms.case_sensitive.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
91+ parms.case_sensitive.u.value32 = 1;
92+
93+ err = vboxsf_call(SHFL_FN_MAP_FOLDER, &parms, SHFL_CPARMS_MAP_FOLDER,
94+ &status);
95+ if (err == -ENOSYS && status == VERR_NOT_IMPLEMENTED)
96+ vbg_err("%s: Error host is too old\n", __func__);
97+
98+ *root = parms.root.u.value32;
99+ return err;
100+}
101+
102+int vboxsf_unmap_folder(u32 root)
103+{
104+ struct shfl_unmap_folder parms;
105+
106+ parms.root.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
107+ parms.root.u.value32 = root;
108+
109+ return vboxsf_call(SHFL_FN_UNMAP_FOLDER, &parms,
110+ SHFL_CPARMS_UNMAP_FOLDER, NULL);
111+}
112+
113+/**
114+ * vboxsf_create - Create a new file or folder
115+ * @root: Root of the shared folder in which to create the file
116+ * @parsed_path: The path of the file or folder relative to the shared folder
117+ * @param: create_parms Parameters for file/folder creation.
118+ *
119+ * Create a new file or folder or open an existing one in a shared folder.
120+ * Note this function always returns 0 / success unless an exceptional condition
121+ * occurs - out of memory, invalid arguments, etc. If the file or folder could
122+ * not be opened or created, create_parms->handle will be set to
123+ * SHFL_HANDLE_NIL on return. In this case the value in create_parms->result
124+ * provides information as to why (e.g. SHFL_FILE_EXISTS), create_parms->result
125+ * is also set on success as additional information.
126+ *
127+ * Returns:
128+ * 0 or negative errno value.
129+ */
130+int vboxsf_create(u32 root, struct shfl_string *parsed_path,
131+ struct shfl_createparms *create_parms)
132+{
133+ struct shfl_create parms;
134+
135+ parms.root.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
136+ parms.root.u.value32 = root;
137+
138+ parms.path.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL;
139+ parms.path.u.pointer.size = shfl_string_buf_size(parsed_path);
140+ parms.path.u.pointer.u.linear_addr = (uintptr_t)parsed_path;
141+
142+ parms.parms.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL;
143+ parms.parms.u.pointer.size = sizeof(struct shfl_createparms);
144+ parms.parms.u.pointer.u.linear_addr = (uintptr_t)create_parms;
145+
146+ return vboxsf_call(SHFL_FN_CREATE, &parms, SHFL_CPARMS_CREATE, NULL);
147+}
148+
149+int vboxsf_close(u32 root, u64 handle)
150+{
151+ struct shfl_close parms;
152+
153+ parms.root.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
154+ parms.root.u.value32 = root;
155+
156+ parms.handle.type = VMMDEV_HGCM_PARM_TYPE_64BIT;
157+ parms.handle.u.value64 = handle;
158+
159+ return vboxsf_call(SHFL_FN_CLOSE, &parms, SHFL_CPARMS_CLOSE, NULL);
160+}
161+
162+int vboxsf_remove(u32 root, struct shfl_string *parsed_path, u32 flags)
163+{
164+ struct shfl_remove parms;
165+
166+ parms.root.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
167+ parms.root.u.value32 = root;
168+
169+ parms.path.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_IN;
170+ parms.path.u.pointer.size = shfl_string_buf_size(parsed_path);
171+ parms.path.u.pointer.u.linear_addr = (uintptr_t)parsed_path;
172+
173+ parms.flags.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
174+ parms.flags.u.value32 = flags;
175+
176+ return vboxsf_call(SHFL_FN_REMOVE, &parms, SHFL_CPARMS_REMOVE, NULL);
177+}
178+
179+int vboxsf_rename(u32 root, struct shfl_string *src_path,
180+ struct shfl_string *dest_path, u32 flags)
181+{
182+ struct shfl_rename parms;
183+
184+ parms.root.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
185+ parms.root.u.value32 = root;
186+
187+ parms.src.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_IN;
188+ parms.src.u.pointer.size = shfl_string_buf_size(src_path);
189+ parms.src.u.pointer.u.linear_addr = (uintptr_t)src_path;
190+
191+ parms.dest.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_IN;
192+ parms.dest.u.pointer.size = shfl_string_buf_size(dest_path);
193+ parms.dest.u.pointer.u.linear_addr = (uintptr_t)dest_path;
194+
195+ parms.flags.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
196+ parms.flags.u.value32 = flags;
197+
198+ return vboxsf_call(SHFL_FN_RENAME, &parms, SHFL_CPARMS_RENAME, NULL);
199+}
200+
201+int vboxsf_read(u32 root, u64 handle, u64 offset, u32 *buf_len, u8 *buf)
202+{
203+ struct shfl_read parms;
204+ int err;
205+
206+ parms.root.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
207+ parms.root.u.value32 = root;
208+
209+ parms.handle.type = VMMDEV_HGCM_PARM_TYPE_64BIT;
210+ parms.handle.u.value64 = handle;
211+ parms.offset.type = VMMDEV_HGCM_PARM_TYPE_64BIT;
212+ parms.offset.u.value64 = offset;
213+ parms.cb.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
214+ parms.cb.u.value32 = *buf_len;
215+ parms.buffer.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_OUT;
216+ parms.buffer.u.pointer.size = *buf_len;
217+ parms.buffer.u.pointer.u.linear_addr = (uintptr_t)buf;
218+
219+ err = vboxsf_call(SHFL_FN_READ, &parms, SHFL_CPARMS_READ, NULL);
220+
221+ *buf_len = parms.cb.u.value32;
222+ return err;
223+}
224+
225+int vboxsf_write(u32 root, u64 handle, u64 offset, u32 *buf_len, u8 *buf)
226+{
227+ struct shfl_write parms;
228+ int err;
229+
230+ parms.root.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
231+ parms.root.u.value32 = root;
232+
233+ parms.handle.type = VMMDEV_HGCM_PARM_TYPE_64BIT;
234+ parms.handle.u.value64 = handle;
235+ parms.offset.type = VMMDEV_HGCM_PARM_TYPE_64BIT;
236+ parms.offset.u.value64 = offset;
237+ parms.cb.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
238+ parms.cb.u.value32 = *buf_len;
239+ parms.buffer.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_IN;
240+ parms.buffer.u.pointer.size = *buf_len;
241+ parms.buffer.u.pointer.u.linear_addr = (uintptr_t)buf;
242+
243+ err = vboxsf_call(SHFL_FN_WRITE, &parms, SHFL_CPARMS_WRITE, NULL);
244+
245+ *buf_len = parms.cb.u.value32;
246+ return err;
247+}
248+
249+/* Returns 0 on success, 1 on end-of-dir, negative errno otherwise */
250+int vboxsf_dirinfo(u32 root, u64 handle,
251+ struct shfl_string *parsed_path, u32 flags, u32 index,
252+ u32 *buf_len, struct shfl_dirinfo *buf, u32 *file_count)
253+{
254+ struct shfl_list parms;
255+ int err, status;
256+
257+ parms.root.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
258+ parms.root.u.value32 = root;
259+
260+ parms.handle.type = VMMDEV_HGCM_PARM_TYPE_64BIT;
261+ parms.handle.u.value64 = handle;
262+ parms.flags.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
263+ parms.flags.u.value32 = flags;
264+ parms.cb.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
265+ parms.cb.u.value32 = *buf_len;
266+ if (parsed_path) {
267+ parms.path.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_IN;
268+ parms.path.u.pointer.size = shfl_string_buf_size(parsed_path);
269+ parms.path.u.pointer.u.linear_addr = (uintptr_t)parsed_path;
270+ } else {
271+ parms.path.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_IN;
272+ parms.path.u.pointer.size = 0;
273+ parms.path.u.pointer.u.linear_addr = 0;
274+ }
275+
276+ parms.buffer.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_OUT;
277+ parms.buffer.u.pointer.size = *buf_len;
278+ parms.buffer.u.pointer.u.linear_addr = (uintptr_t)buf;
279+
280+ parms.resume_point.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
281+ parms.resume_point.u.value32 = index;
282+ parms.file_count.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
283+ parms.file_count.u.value32 = 0; /* out parameter only */
284+
285+ err = vboxsf_call(SHFL_FN_LIST, &parms, SHFL_CPARMS_LIST, &status);
286+ if (err == -ENODATA && status == VERR_NO_MORE_FILES)
287+ err = 1;
288+
289+ *buf_len = parms.cb.u.value32;
290+ *file_count = parms.file_count.u.value32;
291+ return err;
292+}
293+
294+int vboxsf_fsinfo(u32 root, u64 handle, u32 flags,
295+ u32 *buf_len, void *buf)
296+{
297+ struct shfl_information parms;
298+ int err;
299+
300+ parms.root.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
301+ parms.root.u.value32 = root;
302+
303+ parms.handle.type = VMMDEV_HGCM_PARM_TYPE_64BIT;
304+ parms.handle.u.value64 = handle;
305+ parms.flags.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
306+ parms.flags.u.value32 = flags;
307+ parms.cb.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
308+ parms.cb.u.value32 = *buf_len;
309+ parms.info.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL;
310+ parms.info.u.pointer.size = *buf_len;
311+ parms.info.u.pointer.u.linear_addr = (uintptr_t)buf;
312+
313+ err = vboxsf_call(SHFL_FN_INFORMATION, &parms, SHFL_CPARMS_INFORMATION,
314+ NULL);
315+
316+ *buf_len = parms.cb.u.value32;
317+ return err;
318+}
319+
320+int vboxsf_readlink(u32 root, struct shfl_string *parsed_path,
321+ u32 buf_len, u8 *buf)
322+{
323+ struct shfl_readLink parms;
324+
325+ parms.root.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
326+ parms.root.u.value32 = root;
327+
328+ parms.path.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_IN;
329+ parms.path.u.pointer.size = shfl_string_buf_size(parsed_path);
330+ parms.path.u.pointer.u.linear_addr = (uintptr_t)parsed_path;
331+
332+ parms.buffer.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_OUT;
333+ parms.buffer.u.pointer.size = buf_len;
334+ parms.buffer.u.pointer.u.linear_addr = (uintptr_t)buf;
335+
336+ return vboxsf_call(SHFL_FN_READLINK, &parms, SHFL_CPARMS_READLINK,
337+ NULL);
338+}
339+
340+int vboxsf_symlink(u32 root, struct shfl_string *new_path,
341+ struct shfl_string *old_path, struct shfl_fsobjinfo *buf)
342+{
343+ struct shfl_symlink parms;
344+
345+ parms.root.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
346+ parms.root.u.value32 = root;
347+
348+ parms.new_path.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_IN;
349+ parms.new_path.u.pointer.size = shfl_string_buf_size(new_path);
350+ parms.new_path.u.pointer.u.linear_addr = (uintptr_t)new_path;
351+
352+ parms.old_path.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_IN;
353+ parms.old_path.u.pointer.size = shfl_string_buf_size(old_path);
354+ parms.old_path.u.pointer.u.linear_addr = (uintptr_t)old_path;
355+
356+ parms.info.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_OUT;
357+ parms.info.u.pointer.size = sizeof(struct shfl_fsobjinfo);
358+ parms.info.u.pointer.u.linear_addr = (uintptr_t)buf;
359+
360+ return vboxsf_call(SHFL_FN_SYMLINK, &parms, SHFL_CPARMS_SYMLINK, NULL);
361+}
362+
363+int vboxsf_set_utf8(void)
364+{
365+ return vboxsf_call(SHFL_FN_SET_UTF8, NULL, 0, NULL);
366+}
367+
368+int vboxsf_set_symlinks(void)
369+{
370+ return vboxsf_call(SHFL_FN_SET_SYMLINKS, NULL, 0, NULL);
371+}
drivers/staging/vboxsf/vfsmod.h+137−0
@@ -0,0 +1,137 @@
1+/* SPDX-License-Identifier: MIT */
2+/*
3+ * VirtualBox Guest Shared Folders support: module header.
4+ *
5+ * Copyright (C) 2006-2018 Oracle Corporation
6+ */
7+
8+#ifndef VFSMOD_H
9+#define VFSMOD_H
10+
11+#include <linux/backing-dev.h>
12+#include <linux/idr.h>
13+#include "shfl_hostintf.h"
14+
15+#define DIR_BUFFER_SIZE SZ_16K
16+
17+/* The cast is to prevent assignment of void * to pointers of arbitrary type */
18+#define VBOXSF_SBI(sb) ((struct vboxsf_sbi *)(sb)->s_fs_info)
19+#define VBOXSF_I(i) container_of(i, struct vboxsf_inode, vfs_inode)
20+
21+struct vboxsf_options {
22+ unsigned long ttl;
23+ kuid_t uid;
24+ kgid_t gid;
25+ bool dmode_set;
26+ bool fmode_set;
27+ umode_t dmode;
28+ umode_t fmode;
29+ umode_t dmask;
30+ umode_t fmask;
31+};
32+
33+struct vboxsf_fs_context {
34+ struct vboxsf_options o;
35+ char *nls_name;
36+};
37+
38+/* per-shared folder information */
39+struct vboxsf_sbi {
40+ struct vboxsf_options o;
41+ struct shfl_fsobjinfo root_info;
42+ struct idr ino_idr;
43+ spinlock_t ino_idr_lock; /* This protects ino_idr */
44+ struct nls_table *nls;
45+ u32 next_generation;
46+ u32 root;
47+ int bdi_id;
48+};
49+
50+/* per-inode information */
51+struct vboxsf_inode {
52+ /* some information was changed, update data on next revalidate */
53+ int force_restat;
54+ /* list of open handles for this inode + lock protecting it */
55+ struct list_head handle_list;
56+ /* This mutex protects handle_list accesses */
57+ struct mutex handle_list_mutex;
58+ /* The VFS inode struct */
59+ struct inode vfs_inode;
60+};
61+
62+struct vboxsf_dir_info {
63+ struct list_head info_list;
64+};
65+
66+struct vboxsf_dir_buf {
67+ size_t entries;
68+ size_t free;
69+ size_t used;
70+ void *buf;
71+ struct list_head head;
72+};
73+
74+/* globals */
75+extern const struct inode_operations vboxsf_dir_iops;
76+extern const struct inode_operations vboxsf_lnk_iops;
77+extern const struct inode_operations vboxsf_reg_iops;
78+extern const struct file_operations vboxsf_dir_fops;
79+extern const struct file_operations vboxsf_reg_fops;
80+extern const struct address_space_operations vboxsf_reg_aops;
81+extern const struct dentry_operations vboxsf_dentry_ops;
82+
83+/* from utils.c */
84+struct inode *vboxsf_new_inode(struct super_block *sb);
85+void vboxsf_init_inode(struct vboxsf_sbi *sbi, struct inode *inode,
86+ const struct shfl_fsobjinfo *info);
87+int vboxsf_create_at_dentry(struct dentry *dentry,
88+ struct shfl_createparms *params);
89+int vboxsf_stat(struct vboxsf_sbi *sbi, struct shfl_string *path,
90+ struct shfl_fsobjinfo *info);
91+int vboxsf_stat_dentry(struct dentry *dentry, struct shfl_fsobjinfo *info);
92+int vboxsf_inode_revalidate(struct dentry *dentry);
93+int vboxsf_getattr(const struct path *path, struct kstat *kstat,
94+ u32 request_mask, unsigned int query_flags);
95+int vboxsf_setattr(struct dentry *dentry, struct iattr *iattr);
96+struct shfl_string *vboxsf_path_from_dentry(struct vboxsf_sbi *sbi,
97+ struct dentry *dentry);
98+int vboxsf_nlscpy(struct vboxsf_sbi *sbi, char *name, size_t name_bound_len,
99+ const unsigned char *utf8_name, size_t utf8_len);
100+struct vboxsf_dir_info *vboxsf_dir_info_alloc(void);
101+void vboxsf_dir_info_free(struct vboxsf_dir_info *p);
102+int vboxsf_dir_read_all(struct vboxsf_sbi *sbi, struct vboxsf_dir_info *sf_d,
103+ u64 handle);
104+
105+/* from vboxsf_wrappers.c */
106+int vboxsf_connect(void);
107+void vboxsf_disconnect(void);
108+
109+int vboxsf_create(u32 root, struct shfl_string *parsed_path,
110+ struct shfl_createparms *create_parms);
111+
112+int vboxsf_close(u32 root, u64 handle);
113+int vboxsf_remove(u32 root, struct shfl_string *parsed_path, u32 flags);
114+int vboxsf_rename(u32 root, struct shfl_string *src_path,
115+ struct shfl_string *dest_path, u32 flags);
116+
117+int vboxsf_read(u32 root, u64 handle, u64 offset, u32 *buf_len, u8 *buf);
118+int vboxsf_write(u32 root, u64 handle, u64 offset, u32 *buf_len, u8 *buf);
119+
120+int vboxsf_dirinfo(u32 root, u64 handle,
121+ struct shfl_string *parsed_path, u32 flags, u32 index,
122+ u32 *buf_len, struct shfl_dirinfo *buf, u32 *file_count);
123+int vboxsf_fsinfo(u32 root, u64 handle, u32 flags,
124+ u32 *buf_len, void *buf);
125+
126+int vboxsf_map_folder(struct shfl_string *folder_name, u32 *root);
127+int vboxsf_unmap_folder(u32 root);
128+
129+int vboxsf_readlink(u32 root, struct shfl_string *parsed_path,
130+ u32 buf_len, u8 *buf);
131+int vboxsf_symlink(u32 root, struct shfl_string *new_path,
132+ struct shfl_string *old_path, struct shfl_fsobjinfo *buf);
133+
134+int vboxsf_set_utf8(void);
135+int vboxsf_set_symlinks(void);
136+
137+#endif
drivers/target/iscsi/cxgbit/cxgbit_cm.c+2−1
@@ -1831,7 +1831,7 @@ static void cxgbit_fw4_ack(struct cxgbit_sock *csk, struct sk_buff *skb) · 1830 unmodified lines
18311831
18321832 while (credits) {
18331833 struct sk_buff *p = cxgbit_sock_peek_wr(csk);
1834− const u32 csum = (__force u32)p->csum;
1834+ u32 csum;
18351835
18361836 if (unlikely(!p)) {
18371837 pr_err("csk 0x%p,%u, cr %u,%u+%u, empty.\n",
@@ -1840,6 +1840,7 @@ static void cxgbit_fw4_ack(struct cxgbit_sock *csk, struct sk_buff *skb) · 2 unmodified lines
18401840 break;
18411841 }
18421842
1843+ csum = (__force u32)p->csum;
18431844 if (unlikely(credits < csum)) {
18441845 pr_warn("csk 0x%p,%u, cr %u,%u+%u, < %u.\n",
18451846 csk, csk->tid,
drivers/thunderbolt/nhi_ops.c+0−1
@@ -80,7 +80,6 @@ static void icl_nhi_lc_mailbox_cmd(struct tb_nhi *nhi, enum icl_lc_mailbox_cmd c · 79 unmodified lines
8080 {
8181 u32 data;
8282
83− pci_read_config_dword(nhi->pdev, VS_CAP_19, &data);
8483 data = (cmd << VS_CAP_19_CMD_SHIFT) & VS_CAP_19_CMD_MASK;
8584 pci_write_config_dword(nhi->pdev, VS_CAP_19, data | VS_CAP_19_VALID);
8685 }
drivers/thunderbolt/switch.c+11−17
@@ -896,12 +896,13 @@ int tb_dp_port_set_hops(struct tb_port *port, unsigned int video, · 895 unmodified lines
896896 */
897897 bool tb_dp_port_is_enabled(struct tb_port *port)
898898 {
899− u32 data;
899+ u32 data[2];
900900
901− if (tb_port_read(port, &data, TB_CFG_PORT, port->cap_adap, 1))
901+ if (tb_port_read(port, data, TB_CFG_PORT, port->cap_adap,
902+ ARRAY_SIZE(data)))
902903 return false;
903904
904− return !!(data & (TB_DP_VIDEO_EN | TB_DP_AUX_EN));
905+ return !!(data[0] & (TB_DP_VIDEO_EN | TB_DP_AUX_EN));
905906 }
906907
907908 /**
@@ -914,19 +915,21 @@ bool tb_dp_port_is_enabled(struct tb_port *port) · 6 unmodified lines
914915 */
915916 int tb_dp_port_enable(struct tb_port *port, bool enable)
916917 {
917− u32 data;
918+ u32 data[2];
918919 int ret;
919920
920− ret = tb_port_read(port, &data, TB_CFG_PORT, port->cap_adap, 1);
921+ ret = tb_port_read(port, data, TB_CFG_PORT, port->cap_adap,
922+ ARRAY_SIZE(data));
921923 if (ret)
922924 return ret;
923925
924926 if (enable)
925− data |= TB_DP_VIDEO_EN | TB_DP_AUX_EN;
927+ data[0] |= TB_DP_VIDEO_EN | TB_DP_AUX_EN;
926928 else
927− data &= ~(TB_DP_VIDEO_EN | TB_DP_AUX_EN);
929+ data[0] &= ~(TB_DP_VIDEO_EN | TB_DP_AUX_EN);
928930
929− return tb_port_write(port, &data, TB_CFG_PORT, port->cap_adap, 1);
931+ return tb_port_write(port, data, TB_CFG_PORT, port->cap_adap,
932+ ARRAY_SIZE(data));
930933 }
931934
932935 /* switch utility functions */
@@ -1031,13 +1034,6 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val) · 98 unmodified lines
10311034 if (sw->authorized)
10321035 goto unlock;
10331036
1034− /*
1035− * Make sure there is no PCIe rescan ongoing when a new PCIe
1036− * tunnel is created. Otherwise the PCIe rescan code might find
1037− * the new tunnel too early.
1038− */
1039− pci_lock_rescan_remove();
1040−
10411037 switch (val) {
10421038 /* Approve switch */
10431039 case 1:
@@ -1057,8 +1053,6 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val) · 13 unmodified lines
10571053 break;
10581054 }
10591055
1060− pci_unlock_rescan_remove();
1061−
10621056 if (!ret) {
10631057 sw->authorized = val;
10641058 /* Notify status change to the userspace */
drivers/usb/cdns3/gadget.c+28−9
@@ -2329,8 +2329,6 @@ static void cdns3_gadget_config(struct cdns3_device *priv_dev) · 2328 unmodified lines
23292329 writel(USB_CONF_CLK2OFFDS | USB_CONF_L1DS, &regs->usb_conf);
23302330
23312331 cdns3_configure_dmult(priv_dev, NULL);
2332−
2333− cdns3_gadget_pullup(&priv_dev->gadget, 1);
23342332 }
23352333
23362334 /**
@@ -2345,9 +2343,35 @@ static int cdns3_gadget_udc_start(struct usb_gadget *gadget, · 8 unmodified lines
23452343 {
23462344 struct cdns3_device *priv_dev = gadget_to_cdns3_device(gadget);
23472345 unsigned long flags;
2346+ enum usb_device_speed max_speed = driver->max_speed;
23482347
23492348 spin_lock_irqsave(&priv_dev->lock, flags);
23502349 priv_dev->gadget_driver = driver;
2350+
2351+ /* limit speed if necessary */
2352+ max_speed = min(driver->max_speed, gadget->max_speed);
2353+
2354+ switch (max_speed) {
2355+ case USB_SPEED_FULL:
2356+ writel(USB_CONF_SFORCE_FS, &priv_dev->regs->usb_conf);
2357+ writel(USB_CONF_USB3DIS, &priv_dev->regs->usb_conf);
2358+ break;
2359+ case USB_SPEED_HIGH:
2360+ writel(USB_CONF_USB3DIS, &priv_dev->regs->usb_conf);
2361+ break;
2362+ case USB_SPEED_SUPER:
2363+ break;
2364+ default:
2365+ dev_err(priv_dev->dev,
2366+ "invalid maximum_speed parameter %d\n",
2367+ max_speed);
2368+ /* fall through */
2369+ case USB_SPEED_UNKNOWN:
2370+ /* default to superspeed */
2371+ max_speed = USB_SPEED_SUPER;
2372+ break;
2373+ }
2374+
23512375 cdns3_gadget_config(priv_dev);
23522376 spin_unlock_irqrestore(&priv_dev->lock, flags);
23532377 return 0;
@@ -2381,6 +2405,8 @@ static int cdns3_gadget_udc_stop(struct usb_gadget *gadget) · 27 unmodified lines
23812405 writel(EP_CMD_EPRST, &priv_dev->regs->ep_cmd);
23822406 readl_poll_timeout_atomic(&priv_dev->regs->ep_cmd, val,
23832407 !(val & EP_CMD_EPRST), 1, 100);
2408+
2409+ priv_ep->flags &= ~EP_CLAIMED;
23842410 }
23852411
23862412 /* disable interrupt for device */
@@ -2575,12 +2601,7 @@ static int cdns3_gadget_start(struct cdns3 *cdns) · 188 unmodified lines
25752601 /* Check the maximum_speed parameter */
25762602 switch (max_speed) {
25772603 case USB_SPEED_FULL:
2578− writel(USB_CONF_SFORCE_FS, &priv_dev->regs->usb_conf);
2579− writel(USB_CONF_USB3DIS, &priv_dev->regs->usb_conf);
2580− break;
25812604 case USB_SPEED_HIGH:
2582− writel(USB_CONF_USB3DIS, &priv_dev->regs->usb_conf);
2583− break;
25842605 case USB_SPEED_SUPER:
25852606 break;
25862607 default:
@@ -2713,8 +2734,6 @@ static int cdns3_gadget_suspend(struct cdns3 *cdns, bool do_wakeup) · 126 unmodified lines
27132734 /* disable interrupt for device */
27142735 writel(0, &priv_dev->regs->usb_ien);
27152736
2716− cdns3_gadget_pullup(&priv_dev->gadget, 0);
2717−
27182737 return 0;
27192738 }
27202739
drivers/usb/cdns3/host-export.h+0−1
@@ -12,7 +12,6 @@ · 11 unmodified lines
1212 #ifdef CONFIG_USB_CDNS3_HOST
1313
1414 int cdns3_host_init(struct cdns3 *cdns);
15−void cdns3_host_exit(struct cdns3 *cdns);
1615
1716 #else
1817
drivers/usb/cdns3/host.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/platform_device.h>
1313 #include "core.h"
1414 #include "drd.h"
15+#include "host-export.h"
1516
1617 static int __cdns3_host_init(struct cdns3 *cdns)
1718 {
drivers/usb/core/config.c+5−0
@@ -348,6 +348,11 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, · 347 unmodified lines
348348
349349 /* Validate the wMaxPacketSize field */
350350 maxp = usb_endpoint_maxp(&endpoint->desc);
351+ if (maxp == 0) {
352+ dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has wMaxPacketSize 0, skipping\n",
353+ cfgno, inum, asnum, d->bEndpointAddress);
354+ goto skip_to_next_endpoint_or_interface_descriptor;
355+ }
351356
352357 /* Find the highest legal maxpacket size for this endpoint */
353358 i = 0; /* additional transactions per microframe */
drivers/usb/dwc3/Kconfig+1−0
@@ -102,6 +102,7 @@ config USB_DWC3_MESON_G12A · 101 unmodified lines
102102 depends on ARCH_MESON || COMPILE_TEST
103103 default USB_DWC3
104104 select USB_ROLE_SWITCH
105+ select REGMAP_MMIO
105106 help
106107 Support USB2/3 functionality in Amlogic G12A platforms.
107108 Say 'Y' or 'M' if you have one such device.
drivers/usb/dwc3/core.c+1−2
@@ -312,8 +312,7 @@ static void dwc3_frame_length_adjustment(struct dwc3 *dwc) · 311 unmodified lines
312312
313313 reg = dwc3_readl(dwc->regs, DWC3_GFLADJ);
314314 dft = reg & DWC3_GFLADJ_30MHZ_MASK;
315− if (!dev_WARN_ONCE(dwc->dev, dft == dwc->fladj,
316− "request value same as default, ignoring\n")) {
315+ if (dft != dwc->fladj) {
317316 reg &= ~DWC3_GFLADJ_30MHZ_MASK;
318317 reg |= DWC3_GFLADJ_30MHZ_SDBND_SEL | dwc->fladj;
319318 dwc3_writel(dwc->regs, DWC3_GFLADJ, reg);
drivers/usb/dwc3/dwc3-pci.c+1−1
@@ -258,7 +258,7 @@ static int dwc3_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) · 257 unmodified lines
258258
259259 ret = platform_device_add_properties(dwc->dwc3, p);
260260 if (ret < 0)
261− return ret;
261+ goto err;
262262
263263 ret = dwc3_pci_quirks(dwc);
264264 if (ret)
drivers/usb/dwc3/gadget.c+6−0
@@ -707,6 +707,12 @@ static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep) · 706 unmodified lines
707707
708708 dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
709709 }
710+
711+ while (!list_empty(&dep->cancelled_list)) {
712+ req = next_request(&dep->cancelled_list);
713+
714+ dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
715+ }
710716 }
711717
712718 /**
drivers/usb/gadget/composite.c+4−0
@@ -2170,14 +2170,18 @@ void composite_dev_cleanup(struct usb_composite_dev *cdev) · 2169 unmodified lines
21702170 usb_ep_dequeue(cdev->gadget->ep0, cdev->os_desc_req);
21712171
21722172 kfree(cdev->os_desc_req->buf);
2173+ cdev->os_desc_req->buf = NULL;
21732174 usb_ep_free_request(cdev->gadget->ep0, cdev->os_desc_req);
2175+ cdev->os_desc_req = NULL;
21742176 }
21752177 if (cdev->req) {
21762178 if (cdev->setup_pending)
21772179 usb_ep_dequeue(cdev->gadget->ep0, cdev->req);
21782180
21792181 kfree(cdev->req->buf);
2182+ cdev->req->buf = NULL;
21802183 usb_ep_free_request(cdev->gadget->ep0, cdev->req);
2184+ cdev->req = NULL;
21812185 }
21822186 cdev->next_string_id = 0;
21832187 device_remove_file(&cdev->gadget->dev, &dev_attr_suspended);
drivers/usb/gadget/configfs.c+105−5
@@ -61,6 +61,8 @@ struct gadget_info { · 60 unmodified lines
6161 bool use_os_desc;
6262 char b_vendor_code;
6363 char qw_sign[OS_STRING_QW_SIGN_LEN];
64+ spinlock_t spinlock;
65+ bool unbind;
6466 };
6567
6668 static inline struct gadget_info *to_gadget_info(struct config_item *item)
@@ -1244,6 +1246,7 @@ static int configfs_composite_bind(struct usb_gadget *gadget, · 1177 unmodified lines
12441246 int ret;
12451247
12461248 /* the gi->lock is hold by the caller */
1249+ gi->unbind = 0;
12471250 cdev->gadget = gadget;
12481251 set_gadget_data(gadget, cdev);
12491252 ret = composite_dev_prepare(composite, cdev);
@@ -1376,31 +1379,128 @@ static void configfs_composite_unbind(struct usb_gadget *gadget) · 126 unmodified lines
13761379 {
13771380 struct usb_composite_dev *cdev;
13781381 struct gadget_info *gi;
1382+ unsigned long flags;
13791383
13801384 /* the gi->lock is hold by the caller */
13811385
13821386 cdev = get_gadget_data(gadget);
13831387 gi = container_of(cdev, struct gadget_info, cdev);
1388+ spin_lock_irqsave(&gi->spinlock, flags);
1389+ gi->unbind = 1;
1390+ spin_unlock_irqrestore(&gi->spinlock, flags);
13841391
13851392 kfree(otg_desc[0]);
13861393 otg_desc[0] = NULL;
13871394 purge_configs_funcs(gi);
13881395 composite_dev_cleanup(cdev);
13891396 usb_ep_autoconfig_reset(cdev->gadget);
1397+ spin_lock_irqsave(&gi->spinlock, flags);
13901398 cdev->gadget = NULL;
13911399 set_gadget_data(gadget, NULL);
1400+ spin_unlock_irqrestore(&gi->spinlock, flags);
1401+}
1402+
1403+static int configfs_composite_setup(struct usb_gadget *gadget,
1404+ const struct usb_ctrlrequest *ctrl)
1405+{
1406+ struct usb_composite_dev *cdev;
1407+ struct gadget_info *gi;
1408+ unsigned long flags;
1409+ int ret;
1410+
1411+ cdev = get_gadget_data(gadget);
1412+ if (!cdev)
1413+ return 0;
1414+
1415+ gi = container_of(cdev, struct gadget_info, cdev);
1416+ spin_lock_irqsave(&gi->spinlock, flags);
1417+ cdev = get_gadget_data(gadget);
1418+ if (!cdev || gi->unbind) {
1419+ spin_unlock_irqrestore(&gi->spinlock, flags);
1420+ return 0;
1421+ }
1422+
1423+ ret = composite_setup(gadget, ctrl);
1424+ spin_unlock_irqrestore(&gi->spinlock, flags);
1425+ return ret;
1426+}
1427+
1428+static void configfs_composite_disconnect(struct usb_gadget *gadget)
1429+{
1430+ struct usb_composite_dev *cdev;
1431+ struct gadget_info *gi;
1432+ unsigned long flags;
1433+
1434+ cdev = get_gadget_data(gadget);
1435+ if (!cdev)
1436+ return;
1437+
1438+ gi = container_of(cdev, struct gadget_info, cdev);
1439+ spin_lock_irqsave(&gi->spinlock, flags);
1440+ cdev = get_gadget_data(gadget);
1441+ if (!cdev || gi->unbind) {
1442+ spin_unlock_irqrestore(&gi->spinlock, flags);
1443+ return;
1444+ }
1445+
1446+ composite_disconnect(gadget);
1447+ spin_unlock_irqrestore(&gi->spinlock, flags);
1448+}
1449+
1450+static void configfs_composite_suspend(struct usb_gadget *gadget)
1451+{
1452+ struct usb_composite_dev *cdev;
1453+ struct gadget_info *gi;
1454+ unsigned long flags;
1455+
1456+ cdev = get_gadget_data(gadget);
1457+ if (!cdev)
1458+ return;
1459+
1460+ gi = container_of(cdev, struct gadget_info, cdev);
1461+ spin_lock_irqsave(&gi->spinlock, flags);
1462+ cdev = get_gadget_data(gadget);
1463+ if (!cdev || gi->unbind) {
1464+ spin_unlock_irqrestore(&gi->spinlock, flags);
1465+ return;
1466+ }
1467+
1468+ composite_suspend(gadget);
1469+ spin_unlock_irqrestore(&gi->spinlock, flags);
1470+}
1471+
1472+static void configfs_composite_resume(struct usb_gadget *gadget)
1473+{
1474+ struct usb_composite_dev *cdev;
1475+ struct gadget_info *gi;
1476+ unsigned long flags;
1477+
1478+ cdev = get_gadget_data(gadget);
1479+ if (!cdev)
1480+ return;
1481+
1482+ gi = container_of(cdev, struct gadget_info, cdev);
1483+ spin_lock_irqsave(&gi->spinlock, flags);
1484+ cdev = get_gadget_data(gadget);
1485+ if (!cdev || gi->unbind) {
1486+ spin_unlock_irqrestore(&gi->spinlock, flags);
1487+ return;
1488+ }
1489+
1490+ composite_resume(gadget);
1491+ spin_unlock_irqrestore(&gi->spinlock, flags);
13921492 }
13931493
13941494 static const struct usb_gadget_driver configfs_driver_template = {
13951495 .bind = configfs_composite_bind,
13961496 .unbind = configfs_composite_unbind,
13971497
1398− .setup = composite_setup,
1399− .reset = composite_disconnect,
1400− .disconnect = composite_disconnect,
1498+ .setup = configfs_composite_setup,
1499+ .reset = configfs_composite_disconnect,
1500+ .disconnect = configfs_composite_disconnect,
14011501
1402− .suspend = composite_suspend,
1403− .resume = composite_resume,
1502+ .suspend = configfs_composite_suspend,
1503+ .resume = configfs_composite_resume,
14041504
14051505 .max_speed = USB_SPEED_SUPER,
14061506 .driver = {
drivers/usb/gadget/udc/atmel_usba_udc.c+4−2
@@ -449,9 +449,11 @@ static void submit_request(struct usba_ep *ep, struct usba_request *req) · 448 unmodified lines
449449 next_fifo_transaction(ep, req);
450450 if (req->last_transaction) {
451451 usba_ep_writel(ep, CTL_DIS, USBA_TX_PK_RDY);
452− usba_ep_writel(ep, CTL_ENB, USBA_TX_COMPLETE);
452+ if (ep_is_control(ep))
453+ usba_ep_writel(ep, CTL_ENB, USBA_TX_COMPLETE);
453454 } else {
454− usba_ep_writel(ep, CTL_DIS, USBA_TX_COMPLETE);
455+ if (ep_is_control(ep))
456+ usba_ep_writel(ep, CTL_DIS, USBA_TX_COMPLETE);
455457 usba_ep_writel(ep, CTL_ENB, USBA_TX_PK_RDY);
456458 }
457459 }
drivers/usb/gadget/udc/core.c+11−0
@@ -98,6 +98,17 @@ int usb_ep_enable(struct usb_ep *ep) · 97 unmodified lines
9898 if (ep->enabled)
9999 goto out;
100100
101+ /* UDC drivers can't handle endpoints with maxpacket size 0 */
102+ if (usb_endpoint_maxp(ep->desc) == 0) {
103+ /*
104+ * We should log an error message here, but we can't call
105+ * dev_err() because there's no way to find the gadget
106+ * given only ep.
107+ */
108+ ret = -EINVAL;
109+ goto out;
110+ }
111+
101112 ret = ep->ops->enable(ep, ep->desc);
102113 if (ret)
103114 goto out;
drivers/usb/gadget/udc/fsl_udc_core.c+1−1
@@ -2576,7 +2576,7 @@ static int fsl_udc_remove(struct platform_device *pdev) · 2575 unmodified lines
25762576 dma_pool_destroy(udc_controller->td_pool);
25772577 free_irq(udc_controller->irq, udc_controller);
25782578 iounmap(dr_regs);
2579− if (pdata->operating_mode == FSL_USB2_DR_DEVICE)
2579+ if (res && (pdata->operating_mode == FSL_USB2_DR_DEVICE))
25802580 release_mem_region(res->start, resource_size(res));
25812581
25822582 /* free udc --wait for the release() finished */
drivers/usb/gadget/udc/renesas_usb3.c+6−5
@@ -1544,10 +1544,10 @@ static void usb3_set_device_address(struct renesas_usb3 *usb3, u16 addr) · 1543 unmodified lines
15441544 static bool usb3_std_req_set_address(struct renesas_usb3 *usb3,
15451545 struct usb_ctrlrequest *ctrl)
15461546 {
1547− if (ctrl->wValue >= 128)
1547+ if (le16_to_cpu(ctrl->wValue) >= 128)
15481548 return true; /* stall */
15491549
1550− usb3_set_device_address(usb3, ctrl->wValue);
1550+ usb3_set_device_address(usb3, le16_to_cpu(ctrl->wValue));
15511551 usb3_set_p0_con_for_no_data(usb3);
15521552
15531553 return false;
@@ -1582,6 +1582,7 @@ static bool usb3_std_req_get_status(struct renesas_usb3 *usb3, · 28 unmodified lines
15821582 struct renesas_usb3_ep *usb3_ep;
15831583 int num;
15841584 u16 status = 0;
1585+ __le16 tx_data;
15851586
15861587 switch (ctrl->bRequestType & USB_RECIP_MASK) {
15871588 case USB_RECIP_DEVICE:
@@ -1604,10 +1605,10 @@ static bool usb3_std_req_get_status(struct renesas_usb3 *usb3, · 16 unmodified lines
16041605 }
16051606
16061607 if (!stall) {
1607− status = cpu_to_le16(status);
1608+ tx_data = cpu_to_le16(status);
16081609 dev_dbg(usb3_to_dev(usb3), "get_status: req = %p\n",
16091610 usb_req_to_usb3_req(usb3->ep0_req));
1610− usb3_pipe0_internal_xfer(usb3, &status, sizeof(status),
1611+ usb3_pipe0_internal_xfer(usb3, &tx_data, sizeof(tx_data),
16111612 usb3_pipe0_get_status_completion);
16121613 }
16131614
@@ -1772,7 +1773,7 @@ static bool usb3_std_req_set_sel(struct renesas_usb3 *usb3, · 158 unmodified lines
17721773 static bool usb3_std_req_set_configuration(struct renesas_usb3 *usb3,
17731774 struct usb_ctrlrequest *ctrl)
17741775 {
1775− if (ctrl->wValue > 0)
1776+ if (le16_to_cpu(ctrl->wValue) > 0)
17761777 usb3_set_bit(usb3, USB_COM_CON_CONF, USB3_USB_COM_CON);
17771778 else
17781779 usb3_clear_bit(usb3, USB_COM_CON_CONF, USB3_USB_COM_CON);
drivers/usb/host/xhci-debugfs.c+12−12
@@ -202,10 +202,10 @@ static void xhci_ring_dump_segment(struct seq_file *s, · 201 unmodified lines
202202 trb = &seg->trbs[i];
203203 dma = seg->dma + i * sizeof(*trb);
204204 seq_printf(s, "%pad: %s\n", &dma,
205− xhci_decode_trb(trb->generic.field[0],
206− trb->generic.field[1],
207− trb->generic.field[2],
208− trb->generic.field[3]));
205+ xhci_decode_trb(le32_to_cpu(trb->generic.field[0]),
206+ le32_to_cpu(trb->generic.field[1]),
207+ le32_to_cpu(trb->generic.field[2]),
208+ le32_to_cpu(trb->generic.field[3])));
209209 }
210210 }
211211
@@ -263,10 +263,10 @@ static int xhci_slot_context_show(struct seq_file *s, void *unused) · 51 unmodified lines
263263 xhci = hcd_to_xhci(bus_to_hcd(dev->udev->bus));
264264 slot_ctx = xhci_get_slot_ctx(xhci, dev->out_ctx);
265265 seq_printf(s, "%pad: %s\n", &dev->out_ctx->dma,
266− xhci_decode_slot_context(slot_ctx->dev_info,
267− slot_ctx->dev_info2,
268− slot_ctx->tt_info,
269− slot_ctx->dev_state));
266+ xhci_decode_slot_context(le32_to_cpu(slot_ctx->dev_info),
267+ le32_to_cpu(slot_ctx->dev_info2),
268+ le32_to_cpu(slot_ctx->tt_info),
269+ le32_to_cpu(slot_ctx->dev_state)));
270270
271271 return 0;
272272 }
@@ -286,10 +286,10 @@ static int xhci_endpoint_context_show(struct seq_file *s, void *unused) · 13 unmodified lines
286286 ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, dci);
287287 dma = dev->out_ctx->dma + dci * CTX_SIZE(xhci->hcc_params);
288288 seq_printf(s, "%pad: %s\n", &dma,
289− xhci_decode_ep_context(ep_ctx->ep_info,
290− ep_ctx->ep_info2,
291− ep_ctx->deq,
292− ep_ctx->tx_info));
289+ xhci_decode_ep_context(le32_to_cpu(ep_ctx->ep_info),
290+ le32_to_cpu(ep_ctx->ep_info2),
291+ le64_to_cpu(ep_ctx->deq),
292+ le32_to_cpu(ep_ctx->tx_info)));
293293 }
294294
295295 return 0;
drivers/usb/host/xhci-ring.c+2−0
@@ -3330,6 +3330,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, · 3329 unmodified lines
33303330 if (xhci_urb_suitable_for_idt(urb)) {
33313331 memcpy(&send_addr, urb->transfer_buffer,
33323332 trb_buff_len);
3333+ le64_to_cpus(&send_addr);
33333334 field |= TRB_IDT;
33343335 }
33353336 }
@@ -3475,6 +3476,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, · 139 unmodified lines
34753476 if (xhci_urb_suitable_for_idt(urb)) {
34763477 memcpy(&addr, urb->transfer_buffer,
34773478 urb->transfer_buffer_length);
3479+ le64_to_cpus(&addr);
34783480 field |= TRB_IDT;
34793481 } else {
34803482 addr = (u64) urb->transfer_dma;
drivers/usb/host/xhci.c+45−9
@@ -3071,6 +3071,48 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int ep_index, · 3070 unmodified lines
30713071 }
30723072 }
30733073
3074+static void xhci_endpoint_disable(struct usb_hcd *hcd,
3075+ struct usb_host_endpoint *host_ep)
3076+{
3077+ struct xhci_hcd *xhci;
3078+ struct xhci_virt_device *vdev;
3079+ struct xhci_virt_ep *ep;
3080+ struct usb_device *udev;
3081+ unsigned long flags;
3082+ unsigned int ep_index;
3083+
3084+ xhci = hcd_to_xhci(hcd);
3085+rescan:
3086+ spin_lock_irqsave(&xhci->lock, flags);
3087+
3088+ udev = (struct usb_device *)host_ep->hcpriv;
3089+ if (!udev || !udev->slot_id)
3090+ goto done;
3091+
3092+ vdev = xhci->devs[udev->slot_id];
3093+ if (!vdev)
3094+ goto done;
3095+
3096+ ep_index = xhci_get_endpoint_index(&host_ep->desc);
3097+ ep = &vdev->eps[ep_index];
3098+ if (!ep)
3099+ goto done;
3100+
3101+ /* wait for hub_tt_work to finish clearing hub TT */
3102+ if (ep->ep_state & EP_CLEARING_TT) {
3103+ spin_unlock_irqrestore(&xhci->lock, flags);
3104+ schedule_timeout_uninterruptible(1);
3105+ goto rescan;
3106+ }
3107+
3108+ if (ep->ep_state)
3109+ xhci_dbg(xhci, "endpoint disable with ep_state 0x%x\n",
3110+ ep->ep_state);
3111+done:
3112+ host_ep->hcpriv = NULL;
3113+ spin_unlock_irqrestore(&xhci->lock, flags);
3114+}
3115+
30743116 /*
30753117 * Called after usb core issues a clear halt control message.
30763118 * The host side of the halt should already be cleared by a reset endpoint
@@ -5238,20 +5280,13 @@ static void xhci_clear_tt_buffer_complete(struct usb_hcd *hcd, · 2161 unmodified lines
52385280 unsigned int ep_index;
52395281 unsigned long flags;
52405282
5241− /*
5242− * udev might be NULL if tt buffer is cleared during a failed device
5243− * enumeration due to a halted control endpoint. Usb core might
5244− * have allocated a new udev for the next enumeration attempt.
5245− */
5246−
52475283 xhci = hcd_to_xhci(hcd);
5284+
5285+ spin_lock_irqsave(&xhci->lock, flags);
52485286 udev = (struct usb_device *)ep->hcpriv;
5249− if (!udev)
5250− return;
52515287 slot_id = udev->slot_id;
52525288 ep_index = xhci_get_endpoint_index(&ep->desc);
52535289
5254− spin_lock_irqsave(&xhci->lock, flags);
52555290 xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_CLEARING_TT;
52565291 xhci_ring_doorbell_for_active_rings(xhci, slot_id, ep_index);
52575292 spin_unlock_irqrestore(&xhci->lock, flags);
@@ -5288,6 +5323,7 @@ static const struct hc_driver xhci_hc_driver = { · 30 unmodified lines
52885323 .free_streams = xhci_free_streams,
52895324 .add_endpoint = xhci_add_endpoint,
52905325 .drop_endpoint = xhci_drop_endpoint,
5326+ .endpoint_disable = xhci_endpoint_disable,
52915327 .endpoint_reset = xhci_endpoint_reset,
52925328 .check_bandwidth = xhci_check_bandwidth,
52935329 .reset_bandwidth = xhci_reset_bandwidth,
drivers/usb/misc/ldusb.c+7−6
@@ -487,7 +487,7 @@ static ssize_t ld_usb_read(struct file *file, char __user *buffer, size_t count, · 486 unmodified lines
487487 }
488488 bytes_to_read = min(count, *actual_buffer);
489489 if (bytes_to_read < *actual_buffer)
490− dev_warn(&dev->intf->dev, "Read buffer overflow, %zd bytes dropped\n",
490+ dev_warn(&dev->intf->dev, "Read buffer overflow, %zu bytes dropped\n",
491491 *actual_buffer-bytes_to_read);
492492
493493 /* copy one interrupt_in_buffer from ring_buffer into userspace */
@@ -495,11 +495,11 @@ static ssize_t ld_usb_read(struct file *file, char __user *buffer, size_t count, · 1 unmodified line
495495 retval = -EFAULT;
496496 goto unlock_exit;
497497 }
498− dev->ring_tail = (dev->ring_tail+1) % ring_buffer_size;
499−
500498 retval = bytes_to_read;
501499
502500 spin_lock_irq(&dev->rbsl);
501+ dev->ring_tail = (dev->ring_tail + 1) % ring_buffer_size;
502+
503503 if (dev->buffer_overflow) {
504504 dev->buffer_overflow = 0;
505505 spin_unlock_irq(&dev->rbsl);
@@ -562,8 +562,9 @@ static ssize_t ld_usb_write(struct file *file, const char __user *buffer, · 56 unmodified lines
562562 /* write the data into interrupt_out_buffer from userspace */
563563 bytes_to_write = min(count, write_buffer_size*dev->interrupt_out_endpoint_size);
564564 if (bytes_to_write < count)
565− dev_warn(&dev->intf->dev, "Write buffer overflow, %zd bytes dropped\n", count-bytes_to_write);
566− dev_dbg(&dev->intf->dev, "%s: count = %zd, bytes_to_write = %zd\n",
565+ dev_warn(&dev->intf->dev, "Write buffer overflow, %zu bytes dropped\n",
566+ count - bytes_to_write);
567+ dev_dbg(&dev->intf->dev, "%s: count = %zu, bytes_to_write = %zu\n",
567568 __func__, count, bytes_to_write);
568569
569570 if (copy_from_user(dev->interrupt_out_buffer, buffer, bytes_to_write)) {
@@ -580,7 +581,7 @@ static ssize_t ld_usb_write(struct file *file, const char __user *buffer, · 10 unmodified lines
580581 1 << 8, 0,
581582 dev->interrupt_out_buffer,
582583 bytes_to_write,
583− USB_CTRL_SET_TIMEOUT * HZ);
584+ USB_CTRL_SET_TIMEOUT);
584585 if (retval < 0)
585586 dev_err(&dev->intf->dev,
586587 "Couldn't submit HID_REQ_SET_REPORT %d\n",
drivers/usb/mtu3/mtu3_core.c+1−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include <linux/platform_device.h>
1717
1818 #include "mtu3.h"
19+#include "mtu3_dr.h"
1920 #include "mtu3_debug.h"
2021 #include "mtu3_trace.h"
2122
drivers/usb/renesas_usbhs/common.c+6−6
@@ -162,17 +162,17 @@ void usbhs_usbreq_get_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req) · 161 unmodified lines
162162 req->bRequest = (val >> 8) & 0xFF;
163163 req->bRequestType = (val >> 0) & 0xFF;
164164
165− req->wValue = usbhs_read(priv, USBVAL);
166− req->wIndex = usbhs_read(priv, USBINDX);
167− req->wLength = usbhs_read(priv, USBLENG);
165+ req->wValue = cpu_to_le16(usbhs_read(priv, USBVAL));
166+ req->wIndex = cpu_to_le16(usbhs_read(priv, USBINDX));
167+ req->wLength = cpu_to_le16(usbhs_read(priv, USBLENG));
168168 }
169169
170170 void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
171171 {
172172 usbhs_write(priv, USBREQ, (req->bRequest << 8) | req->bRequestType);
173− usbhs_write(priv, USBVAL, req->wValue);
174− usbhs_write(priv, USBINDX, req->wIndex);
175− usbhs_write(priv, USBLENG, req->wLength);
173+ usbhs_write(priv, USBVAL, le16_to_cpu(req->wValue));
174+ usbhs_write(priv, USBINDX, le16_to_cpu(req->wIndex));
175+ usbhs_write(priv, USBLENG, le16_to_cpu(req->wLength));
176176
177177 usbhs_bset(priv, DCPCTR, SUREQ, SUREQ);
178178 }
drivers/usb/renesas_usbhs/mod_gadget.c+2−2
@@ -265,7 +265,7 @@ static int usbhsg_recip_handler_std_set_device(struct usbhs_priv *priv, · 264 unmodified lines
265265 case USB_DEVICE_TEST_MODE:
266266 usbhsg_recip_handler_std_control_done(priv, uep, ctrl);
267267 udelay(100);
268− usbhs_sys_set_test_mode(priv, le16_to_cpu(ctrl->wIndex >> 8));
268+ usbhs_sys_set_test_mode(priv, le16_to_cpu(ctrl->wIndex) >> 8);
269269 break;
270270 default:
271271 usbhsg_recip_handler_std_control_done(priv, uep, ctrl);
@@ -315,7 +315,7 @@ static void __usbhsg_recip_send_status(struct usbhsg_gpriv *gpriv, · 43 unmodified lines
315315 struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(dcp);
316316 struct device *dev = usbhsg_gpriv_to_dev(gpriv);
317317 struct usb_request *req;
318− unsigned short *buf;
318+ __le16 *buf;
319319
320320 /* alloc new usb_request for recip */
321321 req = usb_ep_alloc_request(&dcp->ep, GFP_ATOMIC);
drivers/usb/serial/whiteheat.c+10−3
@@ -559,6 +559,10 @@ static int firm_send_command(struct usb_serial_port *port, __u8 command, · 558 unmodified lines
559559
560560 command_port = port->serial->port[COMMAND_PORT];
561561 command_info = usb_get_serial_port_data(command_port);
562+
563+ if (command_port->bulk_out_size < datasize + 1)
564+ return -EIO;
565+
562566 mutex_lock(&command_info->mutex);
563567 command_info->command_finished = false;
564568
@@ -632,6 +636,7 @@ static void firm_setup_port(struct tty_struct *tty) · 67 unmodified lines
632636 struct device *dev = &port->dev;
633637 struct whiteheat_port_settings port_settings;
634638 unsigned int cflag = tty->termios.c_cflag;
639+ speed_t baud;
635640
636641 port_settings.port = port->port_number + 1;
637642
@@ -692,11 +697,13 @@ static void firm_setup_port(struct tty_struct *tty) · 54 unmodified lines
692697 dev_dbg(dev, "%s - XON = %2x, XOFF = %2x\n", __func__, port_settings.xon, port_settings.xoff);
693698
694699 /* get the baud rate wanted */
695− port_settings.baud = tty_get_baud_rate(tty);
696− dev_dbg(dev, "%s - baud rate = %d\n", __func__, port_settings.baud);
700+ baud = tty_get_baud_rate(tty);
701+ port_settings.baud = cpu_to_le32(baud);
702+ dev_dbg(dev, "%s - baud rate = %u\n", __func__, baud);
697703
698704 /* fixme: should set validated settings */
699− tty_encode_baud_rate(tty, port_settings.baud, port_settings.baud);
705+ tty_encode_baud_rate(tty, baud, baud);
706+
700707 /* handle any settings that aren't specified in the tty structure */
701708 port_settings.lloop = 0;
702709
drivers/usb/serial/whiteheat.h+1−1
@@ -87,7 +87,7 @@ struct whiteheat_simple { · 86 unmodified lines
8787
8888 struct whiteheat_port_settings {
8989 __u8 port; /* port number (1 to N) */
90− __u32 baud; /* any value 7 - 460800, firmware calculates
90+ __le32 baud; /* any value 7 - 460800, firmware calculates
9191 best fit; arrives little endian */
9292 __u8 bits; /* 5, 6, 7, or 8 */
9393 __u8 stop; /* 1 or 2, default 1 (2 = 1.5 if bits = 5) */
drivers/usb/storage/scsiglue.c+0−10
@@ -68,7 +68,6 @@ static const char* host_info(struct Scsi_Host *host) · 67 unmodified lines
6868 static int slave_alloc (struct scsi_device *sdev)
6969 {
7070 struct us_data *us = host_to_us(sdev->host);
71− int maxp;
7271
7372 /*
7473 * Set the INQUIRY transfer length to 36. We don't use any of
@@ -77,15 +76,6 @@ static int slave_alloc (struct scsi_device *sdev) · 2 unmodified lines
7776 */
7877 sdev->inquiry_len = 36;
7978
80− /*
81− * USB has unusual scatter-gather requirements: the length of each
82− * scatterlist element except the last must be divisible by the
83− * Bulk maxpacket value. Fortunately this value is always a
84− * power of 2. Inform the block layer about this requirement.
85− */
86− maxp = usb_maxpacket(us->pusb_dev, us->recv_bulk_pipe, 0);
87− blk_queue_virt_boundary(sdev->request_queue, maxp - 1);
88−
8979 /*
9080 * Some host controllers may have alignment requirements.
9181 * We'll play it safe by requiring 512-byte alignment always.
drivers/usb/storage/uas.c+0−20
@@ -789,29 +789,9 @@ static int uas_slave_alloc(struct scsi_device *sdev) · 788 unmodified lines
789789 {
790790 struct uas_dev_info *devinfo =
791791 (struct uas_dev_info *)sdev->host->hostdata;
792− int maxp;
793792
794793 sdev->hostdata = devinfo;
795794
796− /*
797− * We have two requirements here. We must satisfy the requirements
798− * of the physical HC and the demands of the protocol, as we
799− * definitely want no additional memory allocation in this path
800− * ruling out using bounce buffers.
801− *
802− * For a transmission on USB to continue we must never send
803− * a package that is smaller than maxpacket. Hence the length of each
804− * scatterlist element except the last must be divisible by the
805− * Bulk maxpacket value.
806− * If the HC does not ensure that through SG,
807− * the upper layer must do that. We must assume nothing
808− * about the capabilities off the HC, so we use the most
809− * pessimistic requirement.
810− */
811−
812− maxp = usb_maxpacket(devinfo->udev, devinfo->data_in_pipe, 0);
813− blk_queue_virt_boundary(sdev->request_queue, maxp - 1);
814−
815795 /*
816796 * The protocol has no requirements on alignment in the strict sense.
817797 * Controllers may or may not have alignment restrictions.
drivers/usb/usbip/vhci_tx.c+3−0
@@ -147,7 +147,10 @@ static int vhci_send_cmd_submit(struct vhci_device *vdev) · 146 unmodified lines
147147 }
148148
149149 kfree(iov);
150+ /* This is only for isochronous case */
150151 kfree(iso_buffer);
152+ iso_buffer = NULL;
153+
151154 usbip_dbg_vhci_tx("send txdata\n");
152155
153156 total_size += txsize;
drivers/vhost/vringh.c+7−1
@@ -852,6 +852,12 @@ static inline int xfer_kern(void *src, void *dst, size_t len) · 851 unmodified lines
852852 return 0;
853853 }
854854
855+static inline int kern_xfer(void *dst, void *src, size_t len)
856+{
857+ memcpy(dst, src, len);
858+ return 0;
859+}
860+
855861 /**
856862 * vringh_init_kern - initialize a vringh for a kernelspace vring.
857863 * @vrh: the vringh to initialize.
@@ -958,7 +964,7 @@ EXPORT_SYMBOL(vringh_iov_pull_kern); · 100 unmodified lines
958964 ssize_t vringh_iov_push_kern(struct vringh_kiov *wiov,
959965 const void *src, size_t len)
960966 {
961− return vringh_iov_xfer(wiov, (void *)src, len, xfer_kern);
967+ return vringh_iov_xfer(wiov, (void *)src, len, kern_xfer);
962968 }
963969 EXPORT_SYMBOL(vringh_iov_push_kern);
964970
drivers/video/fbdev/c2p_core.h+4−4
@@ -29,7 +29,7 @@ static inline void _transp(u32 d[], unsigned int i1, unsigned int i2, · 28 unmodified lines
2929
3030 extern void c2p_unsupported(void);
3131
32−static inline u32 get_mask(unsigned int n)
32+static __always_inline u32 get_mask(unsigned int n)
3333 {
3434 switch (n) {
3535 case 1:
@@ -57,7 +57,7 @@ static inline u32 get_mask(unsigned int n) · 21 unmodified lines
5757 * Transpose operations on 8 32-bit words
5858 */
5959
60−static inline void transp8(u32 d[], unsigned int n, unsigned int m)
60+static __always_inline void transp8(u32 d[], unsigned int n, unsigned int m)
6161 {
6262 u32 mask = get_mask(n);
6363
@@ -99,7 +99,7 @@ static inline void transp8(u32 d[], unsigned int n, unsigned int m) · 35 unmodified lines
9999 * Transpose operations on 4 32-bit words
100100 */
101101
102−static inline void transp4(u32 d[], unsigned int n, unsigned int m)
102+static __always_inline void transp4(u32 d[], unsigned int n, unsigned int m)
103103 {
104104 u32 mask = get_mask(n);
105105
@@ -126,7 +126,7 @@ static inline void transp4(u32 d[], unsigned int n, unsigned int m) · 20 unmodified lines
126126 * Transpose operations on 4 32-bit words (reverse order)
127127 */
128128
129−static inline void transp4x(u32 d[], unsigned int n, unsigned int m)
129+static __always_inline void transp4x(u32 d[], unsigned int n, unsigned int m)
130130 {
131131 u32 mask = get_mask(n);
132132
drivers/virtio/virtio_ring.c+3−4
@@ -1499,9 +1499,6 @@ static bool virtqueue_enable_cb_delayed_packed(struct virtqueue *_vq) · 1498 unmodified lines
14991499 * counter first before updating event flags.
15001500 */
15011501 virtio_wmb(vq->weak_barriers);
1502− } else {
1503− used_idx = vq->last_used_idx;
1504− wrap_counter = vq->packed.used_wrap_counter;
15051502 }
15061503
15071504 if (vq->packed.event_flags_shadow == VRING_PACKED_EVENT_FLAG_DISABLE) {
@@ -1518,7 +1515,9 @@ static bool virtqueue_enable_cb_delayed_packed(struct virtqueue *_vq) · 10 unmodified lines
15181515 */
15191516 virtio_mb(vq->weak_barriers);
15201517
1521− if (is_used_desc_packed(vq, used_idx, wrap_counter)) {
1518+ if (is_used_desc_packed(vq,
1519+ vq->last_used_idx,
1520+ vq->packed.used_wrap_counter)) {
15221521 END_USE(vq);
15231522 return false;
15241523 }
drivers/watchdog/bd70528_wdt.c+1−0
@@ -288,3 +288,4 @@ module_platform_driver(bd70528_wdt); · 287 unmodified lines
288288 MODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>");
289289 MODULE_DESCRIPTION("BD70528 watchdog driver");
290290 MODULE_LICENSE("GPL");
291+MODULE_ALIAS("platform:bd70528-wdt");
drivers/watchdog/cpwd.c+7−1
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include <linux/interrupt.h>
2727 #include <linux/ioport.h>
2828 #include <linux/timer.h>
29+#include <linux/compat.h>
2930 #include <linux/slab.h>
3031 #include <linux/mutex.h>
3132 #include <linux/io.h>
@@ -473,6 +474,11 @@ static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · 441 unmodified lines
473474 return 0;
474475 }
475476
477+static long cpwd_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
478+{
479+ return cpwd_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
480+}
481+
476482 static ssize_t cpwd_write(struct file *file, const char __user *buf,
477483 size_t count, loff_t *ppos)
478484 {
@@ -497,7 +503,7 @@ static ssize_t cpwd_read(struct file *file, char __user *buffer, · 18 unmodified lines
497503 static const struct file_operations cpwd_fops = {
498504 .owner = THIS_MODULE,
499505 .unlocked_ioctl = cpwd_ioctl,
500− .compat_ioctl = compat_ptr_ioctl,
506+ .compat_ioctl = cpwd_compat_ioctl,
501507 .open = cpwd_open,
502508 .write = cpwd_write,
503509 .read = cpwd_read,
drivers/watchdog/imx_sc_wdt.c+7−1
@@ -99,8 +99,14 @@ static int imx_sc_wdt_set_pretimeout(struct watchdog_device *wdog, · 98 unmodified lines
9999 {
100100 struct arm_smccc_res res;
101101
102+ /*
103+ * SCU firmware calculates pretimeout based on current time
104+ * stamp instead of watchdog timeout stamp, need to convert
105+ * the pretimeout to SCU firmware's timeout value.
106+ */
102107 arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_PRETIME_WDOG,
103− pretimeout * 1000, 0, 0, 0, 0, 0, &res);
108+ (wdog->timeout - pretimeout) * 1000, 0, 0, 0,
109+ 0, 0, &res);
104110 if (res.a0)
105111 return -EACCES;
106112
drivers/watchdog/meson_gxbb_wdt.c+2−2
@@ -89,8 +89,8 @@ static unsigned int meson_gxbb_wdt_get_timeleft(struct watchdog_device *wdt_dev) · 88 unmodified lines
8989
9090 reg = readl(data->reg_base + GXBB_WDT_TCNT_REG);
9191
92− return ((reg >> GXBB_WDT_TCNT_CNT_SHIFT) -
93− (reg & GXBB_WDT_TCNT_SETUP_MASK)) / 1000;
92+ return ((reg & GXBB_WDT_TCNT_SETUP_MASK) -
93+ (reg >> GXBB_WDT_TCNT_CNT_SHIFT)) / 1000;
9494 }
9595
9696 static const struct watchdog_ops meson_gxbb_wdt_ops = {
drivers/watchdog/pm8916_wdt.c+11−4
@@ -163,9 +163,17 @@ static int pm8916_wdt_probe(struct platform_device *pdev) · 162 unmodified lines
163163
164164 irq = platform_get_irq(pdev, 0);
165165 if (irq > 0) {
166− if (devm_request_irq(dev, irq, pm8916_wdt_isr, 0, "pm8916_wdt",
167− wdt))
168− irq = 0;
166+ err = devm_request_irq(dev, irq, pm8916_wdt_isr, 0,
167+ "pm8916_wdt", wdt);
168+ if (err)
169+ return err;
170+
171+ wdt->wdev.info = &pm8916_wdt_pt_ident;
172+ } else {
173+ if (irq == -EPROBE_DEFER)
174+ return -EPROBE_DEFER;
175+
176+ wdt->wdev.info = &pm8916_wdt_ident;
169177 }
170178
171179 /* Configure watchdog to hard-reset mode */
@@ -177,7 +185,6 @@ static int pm8916_wdt_probe(struct platform_device *pdev) · 5 unmodified lines
177185 return err;
178186 }
179187
180− wdt->wdev.info = (irq > 0) ? &pm8916_wdt_pt_ident : &pm8916_wdt_ident,
181188 wdt->wdev.ops = &pm8916_wdt_ops,
182189 wdt->wdev.parent = dev;
183190 wdt->wdev.min_timeout = PM8916_WDT_MIN_TIMEOUT;
fs/btrfs/inode.c+14−1
@@ -474,6 +474,7 @@ static noinline int compress_file_range(struct async_chunk *async_chunk) · 473 unmodified lines
474474 u64 start = async_chunk->start;
475475 u64 end = async_chunk->end;
476476 u64 actual_end;
477+ u64 i_size;
477478 int ret = 0;
478479 struct page **pages = NULL;
479480 unsigned long nr_pages;
@@ -488,7 +489,19 @@ static noinline int compress_file_range(struct async_chunk *async_chunk) · 8 unmodified lines
488489 inode_should_defrag(BTRFS_I(inode), start, end, end - start + 1,
489490 SZ_16K);
490491
491− actual_end = min_t(u64, i_size_read(inode), end + 1);
492+ /*
493+ * We need to save i_size before now because it could change in between
494+ * us evaluating the size and assigning it. This is because we lock and
495+ * unlock the page in truncate and fallocate, and then modify the i_size
496+ * later on.
497+ *
498+ * The barriers are to emulate READ_ONCE, remove that once i_size_read
499+ * does that for us.
500+ */
501+ barrier();
502+ i_size = i_size_read(inode);
503+ barrier();
504+ actual_end = min_t(u64, i_size, end + 1);
492505 again:
493506 will_compress = 0;
494507 nr_pages = (end >> PAGE_SHIFT) - (start >> PAGE_SHIFT) + 1;
fs/btrfs/ioctl.c+0−6
@@ -4195,9 +4195,6 @@ static noinline long btrfs_ioctl_start_sync(struct btrfs_root *root, · 4194 unmodified lines
41954195 u64 transid;
41964196 int ret;
41974197
4198− btrfs_warn(root->fs_info,
4199− "START_SYNC ioctl is deprecated and will be removed in kernel 5.7");
4200−
42014198 trans = btrfs_attach_transaction_barrier(root);
42024199 if (IS_ERR(trans)) {
42034200 if (PTR_ERR(trans) != -ENOENT)
@@ -4225,9 +4222,6 @@ static noinline long btrfs_ioctl_wait_sync(struct btrfs_fs_info *fs_info, · 21 unmodified lines
42254222 {
42264223 u64 transid;
42274224
4228− btrfs_warn(fs_info,
4229− "WAIT_SYNC ioctl is deprecated and will be removed in kernel 5.7");
4230−
42314225 if (argp) {
42324226 if (copy_from_user(&transid, argp, sizeof(transid)))
42334227 return -EFAULT;
fs/btrfs/space-info.c+21−0
@@ -893,6 +893,15 @@ static void wait_reserve_ticket(struct btrfs_fs_info *fs_info, · 892 unmodified lines
893893 while (ticket->bytes > 0 && ticket->error == 0) {
894894 ret = prepare_to_wait_event(&ticket->wait, &wait, TASK_KILLABLE);
895895 if (ret) {
896+ /*
897+ * Delete us from the list. After we unlock the space
898+ * info, we don't want the async reclaim job to reserve
899+ * space for this ticket. If that would happen, then the
900+ * ticket's task would not known that space was reserved
901+ * despite getting an error, resulting in a space leak
902+ * (bytes_may_use counter of our space_info).
903+ */
904+ list_del_init(&ticket->list);
896905 ticket->error = -EINTR;
897906 break;
898907 }
@@ -945,12 +954,24 @@ static int handle_reserve_ticket(struct btrfs_fs_info *fs_info, · 46 unmodified lines
945954 spin_lock(&space_info->lock);
946955 ret = ticket->error;
947956 if (ticket->bytes || ticket->error) {
957+ /*
958+ * Need to delete here for priority tickets. For regular tickets
959+ * either the async reclaim job deletes the ticket from the list
960+ * or we delete it ourselves at wait_reserve_ticket().
961+ */
948962 list_del_init(&ticket->list);
949963 if (!ret)
950964 ret = -ENOSPC;
951965 }
952966 spin_unlock(&space_info->lock);
953967 ASSERT(list_empty(&ticket->list));
968+ /*
969+ * Check that we can't have an error set if the reservation succeeded,
970+ * as that would confuse tasks and lead them to error out without
971+ * releasing reserved space (if an error happens the expectation is that
972+ * space wasn't reserved at all).
973+ */
974+ ASSERT(!(ticket->bytes == 0 && ticket->error));
954975 return ret;
955976 }
956977
fs/btrfs/tree-checker.c+0−8
@@ -686,9 +686,7 @@ static void dev_item_err(const struct extent_buffer *eb, int slot, · 685 unmodified lines
686686 static int check_dev_item(struct extent_buffer *leaf,
687687 struct btrfs_key *key, int slot)
688688 {
689− struct btrfs_fs_info *fs_info = leaf->fs_info;
690689 struct btrfs_dev_item *ditem;
691− u64 max_devid = max(BTRFS_MAX_DEVS(fs_info), BTRFS_MAX_DEVS_SYS_CHUNK);
692690
693691 if (key->objectid != BTRFS_DEV_ITEMS_OBJECTID) {
694692 dev_item_err(leaf, slot,
@@ -696,12 +694,6 @@ static int check_dev_item(struct extent_buffer *leaf, · 1 unmodified line
696694 key->objectid, BTRFS_DEV_ITEMS_OBJECTID);
697695 return -EUCLEAN;
698696 }
699− if (key->offset > max_devid) {
700− dev_item_err(leaf, slot,
701− "invalid devid: has=%llu expect=[0, %llu]",
702− key->offset, max_devid);
703− return -EUCLEAN;
704− }
705697 ditem = btrfs_item_ptr(leaf, slot, struct btrfs_dev_item);
706698 if (btrfs_device_id(leaf, ditem) != key->offset) {
707699 dev_item_err(leaf, slot,
fs/btrfs/volumes.c+1−0
@@ -4967,6 +4967,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, · 4966 unmodified lines
49674967 } else if (type & BTRFS_BLOCK_GROUP_SYSTEM) {
49684968 max_stripe_size = SZ_32M;
49694969 max_chunk_size = 2 * max_stripe_size;
4970+ devs_max = min_t(int, devs_max, BTRFS_MAX_DEVS_SYS_CHUNK);
49704971 } else {
49714972 btrfs_err(info, "invalid chunk type 0x%llx requested",
49724973 type);
fs/ceph/caps.c+5−5
@@ -1058,6 +1058,11 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release) · 1057 unmodified lines
10581058
10591059 dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode);
10601060
1061+ /* remove from inode's cap rbtree, and clear auth cap */
1062+ rb_erase(&cap->ci_node, &ci->i_caps);
1063+ if (ci->i_auth_cap == cap)
1064+ ci->i_auth_cap = NULL;
1065+
10611066 /* remove from session list */
10621067 spin_lock(&session->s_cap_lock);
10631068 if (session->s_cap_iterator == cap) {
@@ -1091,11 +1096,6 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release) · 27 unmodified lines
10911096
10921097 spin_unlock(&session->s_cap_lock);
10931098
1094− /* remove from inode list */
1095− rb_erase(&cap->ci_node, &ci->i_caps);
1096− if (ci->i_auth_cap == cap)
1097− ci->i_auth_cap = NULL;
1098−
10991099 if (removed)
11001100 ceph_put_cap(mdsc, cap);
11011101
fs/ceph/dir.c+8−7
@@ -1553,36 +1553,37 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags) · 1552 unmodified lines
15531553 {
15541554 int valid = 0;
15551555 struct dentry *parent;
1556− struct inode *dir;
1556+ struct inode *dir, *inode;
15571557
15581558 if (flags & LOOKUP_RCU) {
15591559 parent = READ_ONCE(dentry->d_parent);
15601560 dir = d_inode_rcu(parent);
15611561 if (!dir)
15621562 return -ECHILD;
1563+ inode = d_inode_rcu(dentry);
15631564 } else {
15641565 parent = dget_parent(dentry);
15651566 dir = d_inode(parent);
1567+ inode = d_inode(dentry);
15661568 }
15671569
15681570 dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry,
1569− dentry, d_inode(dentry), ceph_dentry(dentry)->offset);
1571+ dentry, inode, ceph_dentry(dentry)->offset);
15701572
15711573 /* always trust cached snapped dentries, snapdir dentry */
15721574 if (ceph_snap(dir) != CEPH_NOSNAP) {
15731575 dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry,
1574− dentry, d_inode(dentry));
1576+ dentry, inode);
15751577 valid = 1;
1576− } else if (d_really_is_positive(dentry) &&
1577− ceph_snap(d_inode(dentry)) == CEPH_SNAPDIR) {
1578+ } else if (inode && ceph_snap(inode) == CEPH_SNAPDIR) {
15781579 valid = 1;
15791580 } else {
15801581 valid = dentry_lease_is_valid(dentry, flags);
15811582 if (valid == -ECHILD)
15821583 return valid;
15831584 if (valid || dir_lease_is_valid(dir, dentry)) {
1584− if (d_really_is_positive(dentry))
1585− valid = ceph_is_any_caps(d_inode(dentry));
1585+ if (inode)
1586+ valid = ceph_is_any_caps(inode);
15861587 else
15871588 valid = 1;
15881589 }
fs/ceph/file.c+13−2
@@ -462,6 +462,9 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry, · 461 unmodified lines
462462 err = ceph_security_init_secctx(dentry, mode, &as_ctx);
463463 if (err < 0)
464464 goto out_ctx;
465+ } else if (!d_in_lookup(dentry)) {
466+ /* If it's not being looked up, it's negative */
467+ return -ENOENT;
465468 }
466469
467470 /* do the open */
@@ -1956,10 +1959,18 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off, · 1488 unmodified lines
19561959 if (ceph_test_mount_opt(src_fsc, NOCOPYFROM))
19571960 return -EOPNOTSUPP;
19581961
1962+ /*
1963+ * Striped file layouts require that we copy partial objects, but the
1964+ * OSD copy-from operation only supports full-object copies. Limit
1965+ * this to non-striped file layouts for now.
1966+ */
19591967 if ((src_ci->i_layout.stripe_unit != dst_ci->i_layout.stripe_unit) ||
1960− (src_ci->i_layout.stripe_count != dst_ci->i_layout.stripe_count) ||
1961− (src_ci->i_layout.object_size != dst_ci->i_layout.object_size))
1968+ (src_ci->i_layout.stripe_count != 1) ||
1969+ (dst_ci->i_layout.stripe_count != 1) ||
1970+ (src_ci->i_layout.object_size != dst_ci->i_layout.object_size)) {
1971+ dout("Invalid src/dst files layout\n");
19621972 return -EOPNOTSUPP;
1973+ }
19631974
19641975 if (len < src_ci->i_layout.object_size)
19651976 return -EOPNOTSUPP; /* no remote copy will be done */
fs/ceph/inode.c+1−0
@@ -1434,6 +1434,7 @@ retry_lookup: · 1433 unmodified lines
14341434 dout(" final dn %p\n", dn);
14351435 } else if ((req->r_op == CEPH_MDS_OP_LOOKUPSNAP ||
14361436 req->r_op == CEPH_MDS_OP_MKSNAP) &&
1437+ test_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags) &&
14371438 !test_bit(CEPH_MDS_R_ABORTED, &req->r_req_flags)) {
14381439 struct inode *dir = req->r_parent;
14391440
fs/ceph/super.c+10−1
@@ -268,6 +268,7 @@ static int parse_fsopt_token(char *c, void *private) · 267 unmodified lines
268268 }
269269 break;
270270 case Opt_fscache_uniq:
271+#ifdef CONFIG_CEPH_FSCACHE
271272 kfree(fsopt->fscache_uniq);
272273 fsopt->fscache_uniq = kstrndup(argstr[0].from,
273274 argstr[0].to-argstr[0].from,
@@ -276,7 +277,10 @@ static int parse_fsopt_token(char *c, void *private) · 2 unmodified lines
276277 return -ENOMEM;
277278 fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE;
278279 break;
279− /* misc */
280+#else
281+ pr_err("fscache support is disabled\n");
282+ return -EINVAL;
283+#endif
280284 case Opt_wsize:
281285 if (intval < (int)PAGE_SIZE || intval > CEPH_MAX_WRITE_SIZE)
282286 return -EINVAL;
@@ -353,10 +357,15 @@ static int parse_fsopt_token(char *c, void *private) · 70 unmodified lines
353357 fsopt->flags &= ~CEPH_MOUNT_OPT_INO32;
354358 break;
355359 case Opt_fscache:
360+#ifdef CONFIG_CEPH_FSCACHE
356361 fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE;
357362 kfree(fsopt->fscache_uniq);
358363 fsopt->fscache_uniq = NULL;
359364 break;
365+#else
366+ pr_err("fscache support is disabled\n");
367+ return -EINVAL;
368+#endif
360369 case Opt_nofscache:
361370 fsopt->flags &= ~CEPH_MOUNT_OPT_FSCACHE;
362371 kfree(fsopt->fscache_uniq);
fs/cifs/smb2ops.c+2−1
@@ -4084,6 +4084,7 @@ free_pages: · 4083 unmodified lines
40844084
40854085 kfree(dw->ppages);
40864086 cifs_small_buf_release(dw->buf);
4087+ kfree(dw);
40874088 }
40884089
40894090
@@ -4157,7 +4158,7 @@ receive_encrypted_read(struct TCP_Server_Info *server, struct mid_q_entry **mid, · 67 unmodified lines
41574158 dw->server = server;
41584159 dw->ppages = pages;
41594160 dw->len = len;
4160− queue_work(cifsiod_wq, &dw->decrypt);
4161+ queue_work(decrypt_wq, &dw->decrypt);
41614162 *num_mids = 0; /* worker thread takes care of finding mid */
41624163 return -1;
41634164 }
fs/cifs/smb2pdu.h+1−0
@@ -838,6 +838,7 @@ struct create_durable_handle_reconnect_v2 { · 837 unmodified lines
838838 struct create_context ccontext;
839839 __u8 Name[8];
840840 struct durable_reconnect_context_v2 dcontext;
841+ __u8 Pad[4];
841842 } __packed;
842843
843844 /* See MS-SMB2 2.2.13.2.5 */
fs/configfs/symlink.c+1−1
@@ -101,7 +101,7 @@ static int create_link(struct config_item *parent_item, · 100 unmodified lines
101101 }
102102 target_sd->s_links++;
103103 spin_unlock(&configfs_dirent_lock);
104− ret = configfs_get_target_path(item, item, body);
104+ ret = configfs_get_target_path(parent_item, item, body);
105105 if (!ret)
106106 ret = configfs_create_link(target_sd, parent_item->ci_dentry,
107107 dentry, body);
fs/fs-writeback.c+6−3
@@ -576,10 +576,13 @@ void wbc_attach_and_unlock_inode(struct writeback_control *wbc, · 575 unmodified lines
576576 spin_unlock(&inode->i_lock);
577577
578578 /*
579− * A dying wb indicates that the memcg-blkcg mapping has changed
580− * and a new wb is already serving the memcg. Switch immediately.
579+ * A dying wb indicates that either the blkcg associated with the
580+ * memcg changed or the associated memcg is dying. In the first
581+ * case, a replacement wb should already be available and we should
582+ * refresh the wb immediately. In the second case, trying to
583+ * refresh will keep failing.
581584 */
582− if (unlikely(wb_dying(wbc->wb)))
585+ if (unlikely(wb_dying(wbc->wb) && !css_is_dying(wbc->wb->memcg_css)))
583586 inode_switch_wbs(inode, wbc->wb_id);
584587 }
585588 EXPORT_SYMBOL_GPL(wbc_attach_and_unlock_inode);
fs/fuse/Makefile+2−1
@@ -5,6 +5,7 @@ · 4 unmodified lines
55
66 obj-$(CONFIG_FUSE_FS) += fuse.o
77 obj-$(CONFIG_CUSE) += cuse.o
8−obj-$(CONFIG_VIRTIO_FS) += virtio_fs.o
8+obj-$(CONFIG_VIRTIO_FS) += virtiofs.o
99
1010 fuse-objs := dev.o dir.o file.o inode.o control.o xattr.o acl.o readdir.o
11+virtiofs-y += virtio_fs.o
fs/fuse/dev.c+3−1
@@ -276,10 +276,12 @@ static void flush_bg_queue(struct fuse_conn *fc) · 275 unmodified lines
276276 void fuse_request_end(struct fuse_conn *fc, struct fuse_req *req)
277277 {
278278 struct fuse_iqueue *fiq = &fc->iq;
279− bool async = req->args->end;
279+ bool async;
280280
281281 if (test_and_set_bit(FR_FINISHED, &req->flags))
282282 goto put_request;
283+
284+ async = req->args->end;
283285 /*
284286 * test_and_set_bit() implies smp_mb() between bit
285287 * changing and below intr_entry check. Pairs with
fs/fuse/dir.c+15−1
@@ -405,7 +405,8 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, · 404 unmodified lines
405405 else
406406 fuse_invalidate_entry_cache(entry);
407407
408− fuse_advise_use_readdirplus(dir);
408+ if (inode)
409+ fuse_advise_use_readdirplus(dir);
409410 return newent;
410411
411412 out_iput:
@@ -1521,6 +1522,19 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr, · 1109 unmodified lines
15211522 is_truncate = true;
15221523 }
15231524
1525+ /* Flush dirty data/metadata before non-truncate SETATTR */
1526+ if (is_wb && S_ISREG(inode->i_mode) &&
1527+ attr->ia_valid &
1528+ (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_MTIME_SET |
1529+ ATTR_TIMES_SET)) {
1530+ err = write_inode_now(inode, true);
1531+ if (err)
1532+ return err;
1533+
1534+ fuse_set_nowrite(inode);
1535+ fuse_release_nowrite(inode);
1536+ }
1537+
15241538 if (is_truncate) {
15251539 fuse_set_nowrite(inode);
15261540 set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);
fs/fuse/file.c+8−6
@@ -217,7 +217,7 @@ int fuse_open_common(struct inode *inode, struct file *file, bool isdir) · 216 unmodified lines
217217 {
218218 struct fuse_conn *fc = get_fuse_conn(inode);
219219 int err;
220− bool lock_inode = (file->f_flags & O_TRUNC) &&
220+ bool is_wb_truncate = (file->f_flags & O_TRUNC) &&
221221 fc->atomic_o_trunc &&
222222 fc->writeback_cache;
223223
@@ -225,16 +225,20 @@ int fuse_open_common(struct inode *inode, struct file *file, bool isdir) · 1 unmodified line
225225 if (err)
226226 return err;
227227
228− if (lock_inode)
228+ if (is_wb_truncate) {
229229 inode_lock(inode);
230+ fuse_set_nowrite(inode);
231+ }
230232
231233 err = fuse_do_open(fc, get_node_id(inode), file, isdir);
232234
233235 if (!err)
234236 fuse_finish_open(inode, file);
235237
236− if (lock_inode)
238+ if (is_wb_truncate) {
239+ fuse_release_nowrite(inode);
237240 inode_unlock(inode);
241+ }
238242
239243 return err;
240244 }
@@ -1997,7 +2001,7 @@ static int fuse_writepages_fill(struct page *page, · 1756 unmodified lines
19972001
19982002 if (!data->ff) {
19992003 err = -EIO;
2000− data->ff = fuse_write_file_get(fc, get_fuse_inode(inode));
2004+ data->ff = fuse_write_file_get(fc, fi);
20012005 if (!data->ff)
20022006 goto out_unlock;
20032007 }
@@ -2042,8 +2046,6 @@ static int fuse_writepages_fill(struct page *page, · 38 unmodified lines
20422046 * under writeback, so we can release the page lock.
20432047 */
20442048 if (data->wpa == NULL) {
2045− struct fuse_inode *fi = get_fuse_inode(inode);
2046−
20472049 err = -ENOMEM;
20482050 wpa = fuse_writepage_args_alloc();
20492051 if (!wpa) {
fs/fuse/fuse_i.h+4−0
@@ -479,6 +479,7 @@ struct fuse_fs_context { · 478 unmodified lines
479479 bool destroy:1;
480480 bool no_control:1;
481481 bool no_force_umount:1;
482+ bool no_mount_options:1;
482483 unsigned int max_read;
483484 unsigned int blksize;
484485 const char *subtype;
@@ -713,6 +714,9 @@ struct fuse_conn { · 228 unmodified lines
713714 /** Do not allow MNT_FORCE umount */
714715 unsigned int no_force_umount:1;
715716
717+ /* Do not show mount options */
718+ unsigned int no_mount_options:1;
719+
716720 /** The number of requests waiting for completion */
717721 atomic_t num_waiting;
718722
fs/fuse/inode.c+4−0
@@ -558,6 +558,9 @@ static int fuse_show_options(struct seq_file *m, struct dentry *root) · 557 unmodified lines
558558 struct super_block *sb = root->d_sb;
559559 struct fuse_conn *fc = get_fuse_conn_super(sb);
560560
561+ if (fc->no_mount_options)
562+ return 0;
563+
561564 seq_printf(m, ",user_id=%u", from_kuid_munged(fc->user_ns, fc->user_id));
562565 seq_printf(m, ",group_id=%u", from_kgid_munged(fc->user_ns, fc->group_id));
563566 if (fc->default_permissions)
@@ -1180,6 +1183,7 @@ int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx) · 616 unmodified lines
11801183 fc->destroy = ctx->destroy;
11811184 fc->no_control = ctx->no_control;
11821185 fc->no_force_umount = ctx->no_force_umount;
1186+ fc->no_mount_options = ctx->no_mount_options;
11831187
11841188 err = -ENOMEM;
11851189 root = fuse_get_root_inode(sb, ctx->rootmode);
fs/fuse/virtio_fs.c+113−56
@@ -30,6 +30,7 @@ struct virtio_fs_vq { · 29 unmodified lines
3030 struct virtqueue *vq; /* protected by ->lock */
3131 struct work_struct done_work;
3232 struct list_head queued_reqs;
33+ struct list_head end_reqs; /* End these requests */
3334 struct delayed_work dispatch_work;
3435 struct fuse_dev *fud;
3536 bool connected;
@@ -54,6 +55,9 @@ struct virtio_fs_forget { · 18 unmodified lines
5455 struct list_head list;
5556 };
5657
58+static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq,
59+ struct fuse_req *req, bool in_flight);
60+
5761 static inline struct virtio_fs_vq *vq_to_fsvq(struct virtqueue *vq)
5862 {
5963 struct virtio_fs *fs = vq->vdev->priv;
@@ -66,6 +70,19 @@ static inline struct fuse_pqueue *vq_to_fpq(struct virtqueue *vq) · 6 unmodified lines
6670 return &vq_to_fsvq(vq)->fud->pq;
6771 }
6872
73+/* Should be called with fsvq->lock held. */
74+static inline void inc_in_flight_req(struct virtio_fs_vq *fsvq)
75+{
76+ fsvq->in_flight++;
77+}
78+
79+/* Should be called with fsvq->lock held. */
80+static inline void dec_in_flight_req(struct virtio_fs_vq *fsvq)
81+{
82+ WARN_ON(fsvq->in_flight <= 0);
83+ fsvq->in_flight--;
84+}
85+
6986 static void release_virtio_fs_obj(struct kref *ref)
7087 {
7188 struct virtio_fs *vfs = container_of(ref, struct virtio_fs, refcount);
@@ -109,22 +126,6 @@ static void virtio_fs_drain_queue(struct virtio_fs_vq *fsvq) · 37 unmodified lines
109126 flush_delayed_work(&fsvq->dispatch_work);
110127 }
111128
112−static inline void drain_hiprio_queued_reqs(struct virtio_fs_vq *fsvq)
113−{
114− struct virtio_fs_forget *forget;
115−
116− spin_lock(&fsvq->lock);
117− while (1) {
118− forget = list_first_entry_or_null(&fsvq->queued_reqs,
119− struct virtio_fs_forget, list);
120− if (!forget)
121− break;
122− list_del(&forget->list);
123− kfree(forget);
124− }
125− spin_unlock(&fsvq->lock);
126−}
127−
128129 static void virtio_fs_drain_all_queues(struct virtio_fs *fs)
129130 {
130131 struct virtio_fs_vq *fsvq;
@@ -132,9 +133,6 @@ static void virtio_fs_drain_all_queues(struct virtio_fs *fs) · 1 unmodified line
132133
133134 for (i = 0; i < fs->nvqs; i++) {
134135 fsvq = &fs->vqs[i];
135− if (i == VQ_HIPRIO)
136− drain_hiprio_queued_reqs(fsvq);
137−
138136 virtio_fs_drain_queue(fsvq);
139137 }
140138 }
@@ -253,14 +251,66 @@ static void virtio_fs_hiprio_done_work(struct work_struct *work) · 112 unmodified lines
253251
254252 while ((req = virtqueue_get_buf(vq, &len)) != NULL) {
255253 kfree(req);
256− fsvq->in_flight--;
254+ dec_in_flight_req(fsvq);
257255 }
258256 } while (!virtqueue_enable_cb(vq) && likely(!virtqueue_is_broken(vq)));
259257 spin_unlock(&fsvq->lock);
260258 }
261259
262−static void virtio_fs_dummy_dispatch_work(struct work_struct *work)
260+static void virtio_fs_request_dispatch_work(struct work_struct *work)
263261 {
262+ struct fuse_req *req;
263+ struct virtio_fs_vq *fsvq = container_of(work, struct virtio_fs_vq,
264+ dispatch_work.work);
265+ struct fuse_conn *fc = fsvq->fud->fc;
266+ int ret;
267+
268+ pr_debug("virtio-fs: worker %s called.\n", __func__);
269+ while (1) {
270+ spin_lock(&fsvq->lock);
271+ req = list_first_entry_or_null(&fsvq->end_reqs, struct fuse_req,
272+ list);
273+ if (!req) {
274+ spin_unlock(&fsvq->lock);
275+ break;
276+ }
277+
278+ list_del_init(&req->list);
279+ spin_unlock(&fsvq->lock);
280+ fuse_request_end(fc, req);
281+ }
282+
283+ /* Dispatch pending requests */
284+ while (1) {
285+ spin_lock(&fsvq->lock);
286+ req = list_first_entry_or_null(&fsvq->queued_reqs,
287+ struct fuse_req, list);
288+ if (!req) {
289+ spin_unlock(&fsvq->lock);
290+ return;
291+ }
292+ list_del_init(&req->list);
293+ spin_unlock(&fsvq->lock);
294+
295+ ret = virtio_fs_enqueue_req(fsvq, req, true);
296+ if (ret < 0) {
297+ if (ret == -ENOMEM || ret == -ENOSPC) {
298+ spin_lock(&fsvq->lock);
299+ list_add_tail(&req->list, &fsvq->queued_reqs);
300+ schedule_delayed_work(&fsvq->dispatch_work,
301+ msecs_to_jiffies(1));
302+ spin_unlock(&fsvq->lock);
303+ return;
304+ }
305+ req->out.h.error = ret;
306+ spin_lock(&fsvq->lock);
307+ dec_in_flight_req(fsvq);
308+ spin_unlock(&fsvq->lock);
309+ pr_err("virtio-fs: virtio_fs_enqueue_req() failed %d\n",
310+ ret);
311+ fuse_request_end(fc, req);
312+ }
313+ }
264314 }
265315
266316 static void virtio_fs_hiprio_dispatch_work(struct work_struct *work)
@@ -286,6 +336,7 @@ static void virtio_fs_hiprio_dispatch_work(struct work_struct *work) · 19 unmodified lines
286336
287337 list_del(&forget->list);
288338 if (!fsvq->connected) {
339+ dec_in_flight_req(fsvq);
289340 spin_unlock(&fsvq->lock);
290341 kfree(forget);
291342 continue;
@@ -307,13 +358,13 @@ static void virtio_fs_hiprio_dispatch_work(struct work_struct *work) · 15 unmodified lines
307358 } else {
308359 pr_debug("virtio-fs: Could not queue FORGET: err=%d. Dropping it.\n",
309360 ret);
361+ dec_in_flight_req(fsvq);
310362 kfree(forget);
311363 }
312364 spin_unlock(&fsvq->lock);
313365 return;
314366 }
315367
316− fsvq->in_flight++;
317368 notify = virtqueue_kick_prepare(vq);
318369 spin_unlock(&fsvq->lock);
319370
@@ -452,7 +503,7 @@ static void virtio_fs_requests_done_work(struct work_struct *work) · 132 unmodified lines
452503
453504 fuse_request_end(fc, req);
454505 spin_lock(&fsvq->lock);
455− fsvq->in_flight--;
506+ dec_in_flight_req(fsvq);
456507 spin_unlock(&fsvq->lock);
457508 }
458509 }
@@ -502,6 +553,7 @@ static int virtio_fs_setup_vqs(struct virtio_device *vdev, · 43 unmodified lines
502553 names[VQ_HIPRIO] = fs->vqs[VQ_HIPRIO].name;
503554 INIT_WORK(&fs->vqs[VQ_HIPRIO].done_work, virtio_fs_hiprio_done_work);
504555 INIT_LIST_HEAD(&fs->vqs[VQ_HIPRIO].queued_reqs);
556+ INIT_LIST_HEAD(&fs->vqs[VQ_HIPRIO].end_reqs);
505557 INIT_DELAYED_WORK(&fs->vqs[VQ_HIPRIO].dispatch_work,
506558 virtio_fs_hiprio_dispatch_work);
507559 spin_lock_init(&fs->vqs[VQ_HIPRIO].lock);
@@ -511,8 +563,9 @@ static int virtio_fs_setup_vqs(struct virtio_device *vdev, · 3 unmodified lines
511563 spin_lock_init(&fs->vqs[i].lock);
512564 INIT_WORK(&fs->vqs[i].done_work, virtio_fs_requests_done_work);
513565 INIT_DELAYED_WORK(&fs->vqs[i].dispatch_work,
514− virtio_fs_dummy_dispatch_work);
566+ virtio_fs_request_dispatch_work);
515567 INIT_LIST_HEAD(&fs->vqs[i].queued_reqs);
568+ INIT_LIST_HEAD(&fs->vqs[i].end_reqs);
516569 snprintf(fs->vqs[i].name, sizeof(fs->vqs[i].name),
517570 "requests.%u", i - VQ_REQUEST);
518571 callbacks[i] = virtio_fs_vq_done;
@@ -708,6 +761,7 @@ __releases(fiq->lock) · 189 unmodified lines
708761 list_add_tail(&forget->list, &fsvq->queued_reqs);
709762 schedule_delayed_work(&fsvq->dispatch_work,
710763 msecs_to_jiffies(1));
764+ inc_in_flight_req(fsvq);
711765 } else {
712766 pr_debug("virtio-fs: Could not queue FORGET: err=%d. Dropping it.\n",
713767 ret);
@@ -717,7 +771,7 @@ __releases(fiq->lock) · 3 unmodified lines
717771 goto out;
718772 }
719773
720− fsvq->in_flight++;
774+ inc_in_flight_req(fsvq);
721775 notify = virtqueue_kick_prepare(vq);
722776
723777 spin_unlock(&fsvq->lock);
@@ -819,7 +873,7 @@ static unsigned int sg_init_fuse_args(struct scatterlist *sg, · 95 unmodified lines
819873
820874 /* Add a request to a virtqueue and kick the device */
821875 static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq,
822− struct fuse_req *req)
876+ struct fuse_req *req, bool in_flight)
823877 {
824878 /* requests need at least 4 elements */
825879 struct scatterlist *stack_sgs[6];
@@ -835,6 +889,7 @@ static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq, · 9 unmodified lines
835889 unsigned int i;
836890 int ret;
837891 bool notify;
892+ struct fuse_pqueue *fpq;
838893
839894 /* Does the sglist fit on the stack? */
840895 total_sgs = sg_count_fuse_req(req);
@@ -889,7 +944,17 @@ static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq, · 48 unmodified lines
889944 goto out;
890945 }
891946
892− fsvq->in_flight++;
947+ /* Request successfully sent. */
948+ fpq = &fsvq->fud->pq;
949+ spin_lock(&fpq->lock);
950+ list_add_tail(&req->list, fpq->processing);
951+ spin_unlock(&fpq->lock);
952+ set_bit(FR_SENT, &req->flags);
953+ /* matches barrier in request_wait_answer() */
954+ smp_mb__after_atomic();
955+
956+ if (!in_flight)
957+ inc_in_flight_req(fsvq);
893958 notify = virtqueue_kick_prepare(vq);
894959
895960 spin_unlock(&fsvq->lock);
@@ -915,9 +980,8 @@ __releases(fiq->lock) · 19 unmodified lines
915980 {
916981 unsigned int queue_id = VQ_REQUEST; /* TODO multiqueue */
917982 struct virtio_fs *fs;
918− struct fuse_conn *fc;
919983 struct fuse_req *req;
920− struct fuse_pqueue *fpq;
984+ struct virtio_fs_vq *fsvq;
921985 int ret;
922986
923987 WARN_ON(list_empty(&fiq->pending));
@@ -928,44 +992,36 @@ __releases(fiq->lock) · 4 unmodified lines
928992 spin_unlock(&fiq->lock);
929993
930994 fs = fiq->priv;
931− fc = fs->vqs[queue_id].fud->fc;
932995
933996 pr_debug("%s: opcode %u unique %#llx nodeid %#llx in.len %u out.len %u\n",
934997 __func__, req->in.h.opcode, req->in.h.unique,
935998 req->in.h.nodeid, req->in.h.len,
936999 fuse_len_args(req->args->out_numargs, req->args->out_args));
9371000
938− fpq = &fs->vqs[queue_id].fud->pq;
939− spin_lock(&fpq->lock);
940− if (!fpq->connected) {
941− spin_unlock(&fpq->lock);
942− req->out.h.error = -ENODEV;
943− pr_err("virtio-fs: %s disconnected\n", __func__);
944− fuse_request_end(fc, req);
945− return;
946− }
947− list_add_tail(&req->list, fpq->processing);
948− spin_unlock(&fpq->lock);
949− set_bit(FR_SENT, &req->flags);
950− /* matches barrier in request_wait_answer() */
951− smp_mb__after_atomic();
952−
953−retry:
954− ret = virtio_fs_enqueue_req(&fs->vqs[queue_id], req);
1001+ fsvq = &fs->vqs[queue_id];
1002+ ret = virtio_fs_enqueue_req(fsvq, req, false);
9551003 if (ret < 0) {
9561004 if (ret == -ENOMEM || ret == -ENOSPC) {
957− /* Virtqueue full. Retry submission */
958− /* TODO use completion instead of timeout */
959− usleep_range(20, 30);
960− goto retry;
1005+ /*
1006+ * Virtqueue full. Retry submission from worker
1007+ * context as we might be holding fc->bg_lock.
1008+ */
1009+ spin_lock(&fsvq->lock);
1010+ list_add_tail(&req->list, &fsvq->queued_reqs);
1011+ inc_in_flight_req(fsvq);
1012+ schedule_delayed_work(&fsvq->dispatch_work,
1013+ msecs_to_jiffies(1));
1014+ spin_unlock(&fsvq->lock);
1015+ return;
9611016 }
9621017 req->out.h.error = ret;
9631018 pr_err("virtio-fs: virtio_fs_enqueue_req() failed %d\n", ret);
964− spin_lock(&fpq->lock);
965− clear_bit(FR_SENT, &req->flags);
966− list_del_init(&req->list);
967− spin_unlock(&fpq->lock);
968− fuse_request_end(fc, req);
1019+
1020+ /* Can't end request in submission context. Use a worker */
1021+ spin_lock(&fsvq->lock);
1022+ list_add_tail(&req->list, &fsvq->end_reqs);
1023+ schedule_delayed_work(&fsvq->dispatch_work, 0);
1024+ spin_unlock(&fsvq->lock);
9691025 return;
9701026 }
9711027 }
@@ -992,6 +1048,7 @@ static int virtio_fs_fill_super(struct super_block *sb) · 20 unmodified lines
9921048 .destroy = true,
9931049 .no_control = true,
9941050 .no_force_umount = true,
1051+ .no_mount_options = true,
9951052 };
9961053
9971054 mutex_lock(&virtio_fs_mutex);
fs/gfs2/ops_fstype.c+13−7
@@ -1540,17 +1540,23 @@ static int gfs2_init_fs_context(struct fs_context *fc) · 1539 unmodified lines
15401540 {
15411541 struct gfs2_args *args;
15421542
1543− args = kzalloc(sizeof(*args), GFP_KERNEL);
1543+ args = kmalloc(sizeof(*args), GFP_KERNEL);
15441544 if (args == NULL)
15451545 return -ENOMEM;
15461546
1547− args->ar_quota = GFS2_QUOTA_DEFAULT;
1548− args->ar_data = GFS2_DATA_DEFAULT;
1549− args->ar_commit = 30;
1550− args->ar_statfs_quantum = 30;
1551− args->ar_quota_quantum = 60;
1552− args->ar_errors = GFS2_ERRORS_DEFAULT;
1547+ if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) {
1548+ struct gfs2_sbd *sdp = fc->root->d_sb->s_fs_info;
15531549
1550+ *args = sdp->sd_args;
1551+ } else {
1552+ memset(args, 0, sizeof(*args));
1553+ args->ar_quota = GFS2_QUOTA_DEFAULT;
1554+ args->ar_data = GFS2_DATA_DEFAULT;
1555+ args->ar_commit = 30;
1556+ args->ar_statfs_quantum = 30;
1557+ args->ar_quota_quantum = 60;
1558+ args->ar_errors = GFS2_ERRORS_DEFAULT;
1559+ }
15541560 fc->fs_private = args;
15551561 fc->ops = &gfs2_context_ops;
15561562 return 0;
fs/io_uring.c+10−4
@@ -1124,6 +1124,7 @@ static int io_prep_rw(struct io_kiocb *req, const struct sqe_submit *s, · 1123 unmodified lines
11241124
11251125 kiocb->ki_flags |= IOCB_HIPRI;
11261126 kiocb->ki_complete = io_complete_rw_iopoll;
1127+ req->result = 0;
11271128 } else {
11281129 if (kiocb->ki_flags & IOCB_HIPRI)
11291130 return -EINVAL;
@@ -2413,6 +2414,7 @@ static int io_queue_link_head(struct io_ring_ctx *ctx, struct io_kiocb *req, · 1283 unmodified lines
24132414 if (ret) {
24142415 if (ret != -EIOCBQUEUED) {
24152416 io_free_req(req);
2417+ __io_free_req(shadow);
24162418 io_cqring_add_event(ctx, s->sqe->user_data, ret);
24172419 return 0;
24182420 }
@@ -3828,10 +3830,6 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p) · 1409 unmodified lines
38283830 if (ret)
38293831 goto err;
38303832
3831− ret = io_uring_get_fd(ctx);
3832− if (ret < 0)
3833− goto err;
3834−
38353833 memset(&p->sq_off, 0, sizeof(p->sq_off));
38363834 p->sq_off.head = offsetof(struct io_rings, sq.head);
38373835 p->sq_off.tail = offsetof(struct io_rings, sq.tail);
@@ -3849,6 +3847,14 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p) · 11 unmodified lines
38493847 p->cq_off.overflow = offsetof(struct io_rings, cq_overflow);
38503848 p->cq_off.cqes = offsetof(struct io_rings, cqes);
38513849
3850+ /*
3851+ * Install ring fd as the very last thing, so we don't risk someone
3852+ * having closed it before we finish setup
3853+ */
3854+ ret = io_uring_get_fd(ctx);
3855+ if (ret < 0)
3856+ goto err;
3857+
38523858 p->features = IORING_FEAT_SINGLE_MMAP;
38533859 return ret;
38543860 err:
fs/nfs/delegation.c+11−1
@@ -53,6 +53,16 @@ nfs4_is_valid_delegation(const struct nfs_delegation *delegation, · 52 unmodified lines
5353 return false;
5454 }
5555
56+struct nfs_delegation *nfs4_get_valid_delegation(const struct inode *inode)
57+{
58+ struct nfs_delegation *delegation;
59+
60+ delegation = rcu_dereference(NFS_I(inode)->delegation);
61+ if (nfs4_is_valid_delegation(delegation, 0))
62+ return delegation;
63+ return NULL;
64+}
65+
5666 static int
5767 nfs4_do_check_delegation(struct inode *inode, fmode_t flags, bool mark)
5868 {
@@ -1181,7 +1191,7 @@ bool nfs4_refresh_delegation_stateid(nfs4_stateid *dst, struct inode *inode) · 1122 unmodified lines
11811191 if (delegation != NULL &&
11821192 nfs4_stateid_match_other(dst, &delegation->stateid)) {
11831193 dst->seqid = delegation->stateid.seqid;
1184− return ret;
1194+ ret = true;
11851195 }
11861196 rcu_read_unlock();
11871197 out:
fs/nfs/delegation.h+1−0
@@ -68,6 +68,7 @@ int nfs4_lock_delegation_recall(struct file_lock *fl, struct nfs4_state *state, · 67 unmodified lines
6868 bool nfs4_copy_delegation_stateid(struct inode *inode, fmode_t flags, nfs4_stateid *dst, const struct cred **cred);
6969 bool nfs4_refresh_delegation_stateid(nfs4_stateid *dst, struct inode *inode);
7070
71+struct nfs_delegation *nfs4_get_valid_delegation(const struct inode *inode);
7172 void nfs_mark_delegation_referenced(struct nfs_delegation *delegation);
7273 int nfs4_have_delegation(struct inode *inode, fmode_t flags);
7374 int nfs4_check_delegation(struct inode *inode, fmode_t flags);
fs/nfs/nfs4proc.c+2−5
@@ -1440,8 +1440,6 @@ static int can_open_delegated(struct nfs_delegation *delegation, fmode_t fmode, · 1439 unmodified lines
14401440 return 0;
14411441 if ((delegation->type & fmode) != fmode)
14421442 return 0;
1443− if (test_bit(NFS_DELEGATION_RETURNING, &delegation->flags))
1444− return 0;
14451443 switch (claim) {
14461444 case NFS4_OPEN_CLAIM_NULL:
14471445 case NFS4_OPEN_CLAIM_FH:
@@ -1810,7 +1808,6 @@ static void nfs4_return_incompatible_delegation(struct inode *inode, fmode_t fmo · 362 unmodified lines
18101808 static struct nfs4_state *nfs4_try_open_cached(struct nfs4_opendata *opendata)
18111809 {
18121810 struct nfs4_state *state = opendata->state;
1813− struct nfs_inode *nfsi = NFS_I(state->inode);
18141811 struct nfs_delegation *delegation;
18151812 int open_mode = opendata->o_arg.open_flags;
18161813 fmode_t fmode = opendata->o_arg.fmode;
@@ -1827,7 +1824,7 @@ static struct nfs4_state *nfs4_try_open_cached(struct nfs4_opendata *opendata) · 10 unmodified lines
18271824 }
18281825 spin_unlock(&state->owner->so_lock);
18291826 rcu_read_lock();
1830− delegation = rcu_dereference(nfsi->delegation);
1827+ delegation = nfs4_get_valid_delegation(state->inode);
18311828 if (!can_open_delegated(delegation, fmode, claim)) {
18321829 rcu_read_unlock();
18331830 break;
@@ -2371,7 +2368,7 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata) · 537 unmodified lines
23712368 data->o_arg.open_flags, claim))
23722369 goto out_no_action;
23732370 rcu_read_lock();
2374− delegation = rcu_dereference(NFS_I(data->state->inode)->delegation);
2371+ delegation = nfs4_get_valid_delegation(data->state->inode);
23752372 if (can_open_delegated(delegation, data->o_arg.fmode, claim))
23762373 goto unlock_no_action;
23772374 rcu_read_unlock();
fs/ocfs2/file.c+90−44
@@ -2098,53 +2098,89 @@ static int ocfs2_is_io_unaligned(struct inode *inode, size_t count, loff_t pos) · 2097 unmodified lines
20982098 return 0;
20992099 }
21002100
2101−static int ocfs2_prepare_inode_for_refcount(struct inode *inode,
2102− struct file *file,
2103− loff_t pos, size_t count,
2104− int *meta_level)
2101+static int ocfs2_inode_lock_for_extent_tree(struct inode *inode,
2102+ struct buffer_head **di_bh,
2103+ int meta_level,
2104+ int overwrite_io,
2105+ int write_sem,
2106+ int wait)
21052107 {
2106− int ret;
2107− struct buffer_head *di_bh = NULL;
2108− u32 cpos = pos >> OCFS2_SB(inode->i_sb)->s_clustersize_bits;
2109− u32 clusters =
2110− ocfs2_clusters_for_bytes(inode->i_sb, pos + count) - cpos;
2108+ int ret = 0;
21112109
2112− ret = ocfs2_inode_lock(inode, &di_bh, 1);
2113− if (ret) {
2114− mlog_errno(ret);
2110+ if (wait)
2111+ ret = ocfs2_inode_lock(inode, NULL, meta_level);
2112+ else
2113+ ret = ocfs2_try_inode_lock(inode,
2114+ overwrite_io ? NULL : di_bh, meta_level);
2115+ if (ret < 0)
21152116 goto out;
2117+
2118+ if (wait) {
2119+ if (write_sem)
2120+ down_write(&OCFS2_I(inode)->ip_alloc_sem);
2121+ else
2122+ down_read(&OCFS2_I(inode)->ip_alloc_sem);
2123+ } else {
2124+ if (write_sem)
2125+ ret = down_write_trylock(&OCFS2_I(inode)->ip_alloc_sem);
2126+ else
2127+ ret = down_read_trylock(&OCFS2_I(inode)->ip_alloc_sem);
2128+
2129+ if (!ret) {
2130+ ret = -EAGAIN;
2131+ goto out_unlock;
2132+ }
21162133 }
21172134
2118− *meta_level = 1;
2135+ return ret;
21192136
2120− ret = ocfs2_refcount_cow(inode, di_bh, cpos, clusters, UINT_MAX);
2121− if (ret)
2122− mlog_errno(ret);
2137+out_unlock:
2138+ brelse(*di_bh);
2139+ ocfs2_inode_unlock(inode, meta_level);
21232140 out:
2124− brelse(di_bh);
21252141 return ret;
21262142 }
21272143
2144+static void ocfs2_inode_unlock_for_extent_tree(struct inode *inode,
2145+ struct buffer_head **di_bh,
2146+ int meta_level,
2147+ int write_sem)
2148+{
2149+ if (write_sem)
2150+ up_write(&OCFS2_I(inode)->ip_alloc_sem);
2151+ else
2152+ up_read(&OCFS2_I(inode)->ip_alloc_sem);
2153+
2154+ brelse(*di_bh);
2155+ *di_bh = NULL;
2156+
2157+ if (meta_level >= 0)
2158+ ocfs2_inode_unlock(inode, meta_level);
2159+}
2160+
21282161 static int ocfs2_prepare_inode_for_write(struct file *file,
21292162 loff_t pos, size_t count, int wait)
21302163 {
21312164 int ret = 0, meta_level = 0, overwrite_io = 0;
2165+ int write_sem = 0;
21322166 struct dentry *dentry = file->f_path.dentry;
21332167 struct inode *inode = d_inode(dentry);
21342168 struct buffer_head *di_bh = NULL;
2169+ u32 cpos;
2170+ u32 clusters;
21352171
21362172 /*
21372173 * We start with a read level meta lock and only jump to an ex
21382174 * if we need to make modifications here.
21392175 */
21402176 for(;;) {
2141− if (wait)
2142− ret = ocfs2_inode_lock(inode, NULL, meta_level);
2143− else
2144− ret = ocfs2_try_inode_lock(inode,
2145− overwrite_io ? NULL : &di_bh, meta_level);
2177+ ret = ocfs2_inode_lock_for_extent_tree(inode,
2178+ &di_bh,
2179+ meta_level,
2180+ overwrite_io,
2181+ write_sem,
2182+ wait);
21462183 if (ret < 0) {
2147− meta_level = -1;
21482184 if (ret != -EAGAIN)
21492185 mlog_errno(ret);
21502186 goto out;
@@ -2156,15 +2192,8 @@ static int ocfs2_prepare_inode_for_write(struct file *file, · 5 unmodified lines
21562192 */
21572193 if (!wait && !overwrite_io) {
21582194 overwrite_io = 1;
2159− if (!down_read_trylock(&OCFS2_I(inode)->ip_alloc_sem)) {
2160− ret = -EAGAIN;
2161− goto out_unlock;
2162− }
21632195
21642196 ret = ocfs2_overwrite_io(inode, di_bh, pos, count);
2165− brelse(di_bh);
2166− di_bh = NULL;
2167− up_read(&OCFS2_I(inode)->ip_alloc_sem);
21682197 if (ret < 0) {
21692198 if (ret != -EAGAIN)
21702199 mlog_errno(ret);
@@ -2183,7 +2212,10 @@ static int ocfs2_prepare_inode_for_write(struct file *file, · 12 unmodified lines
21832212 * set inode->i_size at the end of a write. */
21842213 if (should_remove_suid(dentry)) {
21852214 if (meta_level == 0) {
2186− ocfs2_inode_unlock(inode, meta_level);
2215+ ocfs2_inode_unlock_for_extent_tree(inode,
2216+ &di_bh,
2217+ meta_level,
2218+ write_sem);
21872219 meta_level = 1;
21882220 continue;
21892221 }
@@ -2197,18 +2229,32 @@ static int ocfs2_prepare_inode_for_write(struct file *file, · 7 unmodified lines
21972229
21982230 ret = ocfs2_check_range_for_refcount(inode, pos, count);
21992231 if (ret == 1) {
2200− ocfs2_inode_unlock(inode, meta_level);
2201− meta_level = -1;
2202−
2203− ret = ocfs2_prepare_inode_for_refcount(inode,
2204− file,
2205− pos,
2206− count,
2207− &meta_level);
2232+ ocfs2_inode_unlock_for_extent_tree(inode,
2233+ &di_bh,
2234+ meta_level,
2235+ write_sem);
2236+ ret = ocfs2_inode_lock_for_extent_tree(inode,
2237+ &di_bh,
2238+ meta_level,
2239+ overwrite_io,
2240+ 1,
2241+ wait);
2242+ write_sem = 1;
2243+ if (ret < 0) {
2244+ if (ret != -EAGAIN)
2245+ mlog_errno(ret);
2246+ goto out;
2247+ }
2248+
2249+ cpos = pos >> OCFS2_SB(inode->i_sb)->s_clustersize_bits;
2250+ clusters =
2251+ ocfs2_clusters_for_bytes(inode->i_sb, pos + count) - cpos;
2252+ ret = ocfs2_refcount_cow(inode, di_bh, cpos, clusters, UINT_MAX);
22082253 }
22092254
22102255 if (ret < 0) {
2211− mlog_errno(ret);
2256+ if (ret != -EAGAIN)
2257+ mlog_errno(ret);
22122258 goto out_unlock;
22132259 }
22142260
@@ -2219,10 +2265,10 @@ out_unlock: · 4 unmodified lines
22192265 trace_ocfs2_prepare_inode_for_write(OCFS2_I(inode)->ip_blkno,
22202266 pos, count, wait);
22212267
2222− brelse(di_bh);
2223−
2224− if (meta_level >= 0)
2225− ocfs2_inode_unlock(inode, meta_level);
2268+ ocfs2_inode_unlock_for_extent_tree(inode,
2269+ &di_bh,
2270+ meta_level,
2271+ write_sem);
22262272
22272273 out:
22282274 return ret;
include/asm-generic/vdso/vsyscall.h+0−7
@@ -25,13 +25,6 @@ static __always_inline int __arch_get_clock_mode(struct timekeeper *tk) · 24 unmodified lines
2525 }
2626 #endif /* __arch_get_clock_mode */
2727
28−#ifndef __arch_use_vsyscall
29−static __always_inline int __arch_use_vsyscall(struct vdso_data *vdata)
30−{
31− return 1;
32−}
33−#endif /* __arch_use_vsyscall */
34−
3528 #ifndef __arch_update_vsyscall
3629 static __always_inline void __arch_update_vsyscall(struct vdso_data *vdata,
3730 struct timekeeper *tk)
include/drm/drm_gem_shmem_helper.h+13−0
@@ -44,7 +44,20 @@ struct drm_gem_shmem_object { · 43 unmodified lines
4444 */
4545 unsigned int pages_use_count;
4646
47+ /**
48+ * @madv: State for madvise
49+ *
50+ * 0 is active/inuse.
51+ * A negative value is the object is purged.
52+ * Positive values are driver specific and not used by the helpers.
53+ */
4754 int madv;
55+
56+ /**
57+ * @madv_list: List entry for madvise tracking
58+ *
59+ * Typically used by drivers to track purgeable objects
60+ */
4861 struct list_head madv_list;
4962
5063 /**
include/drm/drm_self_refresh_helper.h+2−1
@@ -13,7 +13,8 @@ struct drm_crtc; · 12 unmodified lines
1313
1414 void drm_self_refresh_helper_alter_state(struct drm_atomic_state *state);
1515 void drm_self_refresh_helper_update_avg_times(struct drm_atomic_state *state,
16− unsigned int commit_time_ms);
16+ unsigned int commit_time_ms,
17+ unsigned int new_self_refresh_mask);
1718
1819 int drm_self_refresh_helper_init(struct drm_crtc *crtc);
1920 void drm_self_refresh_helper_cleanup(struct drm_crtc *crtc);
include/linux/bpf.h+2−2
@@ -656,11 +656,11 @@ void bpf_map_put_with_uref(struct bpf_map *map); · 655 unmodified lines
656656 void bpf_map_put(struct bpf_map *map);
657657 int bpf_map_charge_memlock(struct bpf_map *map, u32 pages);
658658 void bpf_map_uncharge_memlock(struct bpf_map *map, u32 pages);
659−int bpf_map_charge_init(struct bpf_map_memory *mem, size_t size);
659+int bpf_map_charge_init(struct bpf_map_memory *mem, u64 size);
660660 void bpf_map_charge_finish(struct bpf_map_memory *mem);
661661 void bpf_map_charge_move(struct bpf_map_memory *dst,
662662 struct bpf_map_memory *src);
663−void *bpf_map_area_alloc(size_t size, int numa_node);
663+void *bpf_map_area_alloc(u64 size, int numa_node);
664664 void bpf_map_area_free(void *base);
665665 void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr);
666666
include/linux/dynamic_debug.h+6−0
@@ -204,6 +204,12 @@ static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, · 203 unmodified lines
204204 do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0)
205205 #define dynamic_dev_dbg(dev, fmt, ...) \
206206 do { if (0) dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); } while (0)
207+#define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
208+ groupsize, buf, len, ascii) \
209+ do { if (0) \
210+ print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, \
211+ rowsize, groupsize, buf, len, ascii); \
212+ } while (0)
207213 #endif
208214
209215 #endif
include/linux/efi.h+16−2
@@ -1579,9 +1579,22 @@ char *efi_convert_cmdline(efi_system_table_t *sys_table_arg, · 1578 unmodified lines
15791579 efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg,
15801580 struct efi_boot_memmap *map);
15811581
1582+efi_status_t efi_low_alloc_above(efi_system_table_t *sys_table_arg,
1583+ unsigned long size, unsigned long align,
1584+ unsigned long *addr, unsigned long min);
1585+
1586+static inline
15821587 efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,
15831588 unsigned long size, unsigned long align,
1584− unsigned long *addr);
1589+ unsigned long *addr)
1590+{
1591+ /*
1592+ * Don't allocate at 0x0. It will confuse code that
1593+ * checks pointers against NULL. Skip the first 8
1594+ * bytes so we start at a nice even number.
1595+ */
1596+ return efi_low_alloc_above(sys_table_arg, size, align, addr, 0x8);
1597+}
15851598
15861599 efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg,
15871600 unsigned long size, unsigned long align,
@@ -1592,7 +1605,8 @@ efi_status_t efi_relocate_kernel(efi_system_table_t *sys_table_arg, · 4 unmodified lines
15921605 unsigned long image_size,
15931606 unsigned long alloc_size,
15941607 unsigned long preferred_addr,
1595− unsigned long alignment);
1608+ unsigned long alignment,
1609+ unsigned long min_addr);
15961610
15971611 efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
15981612 efi_loaded_image_t *image,
include/linux/filter.h+0−1
@@ -1099,7 +1099,6 @@ static inline void bpf_get_prog_name(const struct bpf_prog *prog, char *sym) · 1098 unmodified lines
10991099
11001100 #endif /* CONFIG_BPF_JIT */
11011101
1102−void bpf_prog_kallsyms_del_subprogs(struct bpf_prog *fp);
11031102 void bpf_prog_kallsyms_del_all(struct bpf_prog *fp);
11041103
11051104 #define BPF_ANC BIT(15)
include/linux/gfp.h+23−0
@@ -325,6 +325,29 @@ static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags) · 324 unmodified lines
325325 return !!(gfp_flags & __GFP_DIRECT_RECLAIM);
326326 }
327327
328+/**
329+ * gfpflags_normal_context - is gfp_flags a normal sleepable context?
330+ * @gfp_flags: gfp_flags to test
331+ *
332+ * Test whether @gfp_flags indicates that the allocation is from the
333+ * %current context and allowed to sleep.
334+ *
335+ * An allocation being allowed to block doesn't mean it owns the %current
336+ * context. When direct reclaim path tries to allocate memory, the
337+ * allocation context is nested inside whatever %current was doing at the
338+ * time of the original allocation. The nested allocation may be allowed
339+ * to block but modifying anything %current owns can corrupt the outer
340+ * context's expectations.
341+ *
342+ * %true result from this function indicates that the allocation context
343+ * can sleep and use anything that's associated with %current.
344+ */
345+static inline bool gfpflags_normal_context(const gfp_t gfp_flags)
346+{
347+ return (gfp_flags & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC)) ==
348+ __GFP_DIRECT_RECLAIM;
349+}
350+
328351 #ifdef CONFIG_HIGHMEM
329352 #define OPT_ZONE_HIGHMEM ZONE_HIGHMEM
330353 #else
include/linux/idr.h+1−1
@@ -185,7 +185,7 @@ static inline void idr_preload_end(void) · 184 unmodified lines
185185 * is convenient for a "not found" value.
186186 */
187187 #define idr_for_each_entry(idr, entry, id) \
188− for (id = 0; ((entry) = idr_get_next(idr, &(id))) != NULL; ++id)
188+ for (id = 0; ((entry) = idr_get_next(idr, &(id))) != NULL; id += 1U)
189189
190190 /**
191191 * idr_for_each_entry_ul() - Iterate over an IDR's elements of a given type.
include/linux/if_macvlan.h+0−1
@@ -29,7 +29,6 @@ struct macvlan_dev { · 28 unmodified lines
2929 netdev_features_t set_features;
3030 enum macvlan_mode mode;
3131 u16 flags;
32− int nest_level;
3332 unsigned int macaddr_count;
3433 #ifdef CONFIG_NET_POLL_CONTROLLER
3534 struct netpoll *netpoll;
include/linux/if_team.h+1−0
@@ -223,6 +223,7 @@ struct team { · 222 unmodified lines
223223 atomic_t count_pending;
224224 struct delayed_work dw;
225225 } mcast_rejoin;
226+ struct lock_class_key team_lock_key;
226227 long mode_priv[TEAM_MODE_PRIV_LONGS];
227228 };
228229
include/linux/if_vlan.h+0−11
@@ -182,7 +182,6 @@ struct vlan_dev_priv { · 181 unmodified lines
182182 #ifdef CONFIG_NET_POLL_CONTROLLER
183183 struct netpoll *netpoll;
184184 #endif
185− unsigned int nest_level;
186185 };
187186
188187 static inline struct vlan_dev_priv *vlan_dev_priv(const struct net_device *dev)
@@ -221,11 +220,6 @@ extern void vlan_vids_del_by_dev(struct net_device *dev, · 32 unmodified lines
221220
222221 extern bool vlan_uses_dev(const struct net_device *dev);
223222
224−static inline int vlan_get_encap_level(struct net_device *dev)
225−{
226− BUG_ON(!is_vlan_dev(dev));
227− return vlan_dev_priv(dev)->nest_level;
228−}
229223 #else
230224 static inline struct net_device *
231225 __vlan_find_dev_deep_rcu(struct net_device *real_dev,
@@ -295,11 +289,6 @@ static inline bool vlan_uses_dev(const struct net_device *dev) · 63 unmodified lines
295289 {
296290 return false;
297291 }
298−static inline int vlan_get_encap_level(struct net_device *dev)
299−{
300− BUG();
301− return 0;
302−}
303292 #endif
304293
305294 /**
include/linux/mlx5/mlx5_ifc.h+1−2
@@ -1545,9 +1545,8 @@ struct mlx5_ifc_extended_dest_format_bits { · 1544 unmodified lines
15451545 };
15461546
15471547 union mlx5_ifc_dest_format_struct_flow_counter_list_auto_bits {
1548− struct mlx5_ifc_dest_format_struct_bits dest_format_struct;
1548+ struct mlx5_ifc_extended_dest_format_bits extended_dest_format;
15491549 struct mlx5_ifc_flow_counter_list_bits flow_counter_list;
1550− u8 reserved_at_0[0x40];
15511550 };
15521551
15531552 struct mlx5_ifc_fte_match_param_bits {
include/linux/mm.h+0−5
@@ -695,11 +695,6 @@ static inline void *kvcalloc(size_t n, size_t size, gfp_t flags) · 694 unmodified lines
695695
696696 extern void kvfree(const void *addr);
697697
698−static inline atomic_t *compound_mapcount_ptr(struct page *page)
699−{
700− return &page[1].compound_mapcount;
701−}
702−
703698 static inline int compound_mapcount(struct page *page)
704699 {
705700 VM_BUG_ON_PAGE(!PageCompound(page), page);
include/linux/mm_types.h+5−0
@@ -221,6 +221,11 @@ struct page { · 220 unmodified lines
221221 #endif
222222 } _struct_page_alignment;
223223
224+static inline atomic_t *compound_mapcount_ptr(struct page *page)
225+{
226+ return &page[1].compound_mapcount;
227+}
228+
224229 /*
225230 * Used for sizing the vmemmap region on some architectures
226231 */
include/linux/netdevice.h+27−34
@@ -925,6 +925,7 @@ struct dev_ifalias { · 924 unmodified lines
925925 struct devlink;
926926 struct tlsdev_ops;
927927
928+
928929 /*
929930 * This structure defines the management hooks for network devices.
930931 * The following hooks can be defined; unless noted otherwise, they are
@@ -1421,7 +1422,6 @@ struct net_device_ops { · 490 unmodified lines
14211422 void (*ndo_dfwd_del_station)(struct net_device *pdev,
14221423 void *priv);
14231424
1424− int (*ndo_get_lock_subclass)(struct net_device *dev);
14251425 int (*ndo_set_tx_maxrate)(struct net_device *dev,
14261426 int queue_index,
14271427 u32 maxrate);
@@ -1649,6 +1649,8 @@ enum netdev_priv_flags { · 221 unmodified lines
16491649 * @perm_addr: Permanent hw address
16501650 * @addr_assign_type: Hw address assignment type
16511651 * @addr_len: Hardware address length
1652+ * @upper_level: Maximum depth level of upper devices.
1653+ * @lower_level: Maximum depth level of lower devices.
16521654 * @neigh_priv_len: Used in neigh_alloc()
16531655 * @dev_id: Used to differentiate devices that share
16541656 * the same link layer address
@@ -1758,9 +1760,13 @@ enum netdev_priv_flags { · 103 unmodified lines
17581760 * @phydev: Physical device may attach itself
17591761 * for hardware timestamping
17601762 * @sfp_bus: attached &struct sfp_bus structure.
1761− *
1762− * @qdisc_tx_busylock: lockdep class annotating Qdisc->busylock spinlock
1763− * @qdisc_running_key: lockdep class annotating Qdisc->running seqcount
1763+ * @qdisc_tx_busylock_key: lockdep class annotating Qdisc->busylock
1764+ spinlock
1765+ * @qdisc_running_key: lockdep class annotating Qdisc->running seqcount
1766+ * @qdisc_xmit_lock_key: lockdep class annotating
1767+ * netdev_queue->_xmit_lock spinlock
1768+ * @addr_list_lock_key: lockdep class annotating
1769+ * net_device->addr_list_lock spinlock
17641770 *
17651771 * @proto_down: protocol port state information can be sent to the
17661772 * switch driver and used to set the phys state of the
@@ -1875,6 +1881,8 @@ struct net_device { · 108 unmodified lines
18751881 unsigned char perm_addr[MAX_ADDR_LEN];
18761882 unsigned char addr_assign_type;
18771883 unsigned char addr_len;
1884+ unsigned char upper_level;
1885+ unsigned char lower_level;
18781886 unsigned short neigh_priv_len;
18791887 unsigned short dev_id;
18801888 unsigned short dev_port;
@@ -2045,8 +2053,10 @@ struct net_device { · 164 unmodified lines
20452053 #endif
20462054 struct phy_device *phydev;
20472055 struct sfp_bus *sfp_bus;
2048− struct lock_class_key *qdisc_tx_busylock;
2049− struct lock_class_key *qdisc_running_key;
2056+ struct lock_class_key qdisc_tx_busylock_key;
2057+ struct lock_class_key qdisc_running_key;
2058+ struct lock_class_key qdisc_xmit_lock_key;
2059+ struct lock_class_key addr_list_lock_key;
20502060 bool proto_down;
20512061 unsigned wol_enabled:1;
20522062 };
@@ -2124,23 +2134,6 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev, · 71 unmodified lines
21242134 f(dev, &dev->_tx[i], arg);
21252135 }
21262136
2127−#define netdev_lockdep_set_classes(dev) \
2128−{ \
2129− static struct lock_class_key qdisc_tx_busylock_key; \
2130− static struct lock_class_key qdisc_running_key; \
2131− static struct lock_class_key qdisc_xmit_lock_key; \
2132− static struct lock_class_key dev_addr_list_lock_key; \
2133− unsigned int i; \
2134− \
2135− (dev)->qdisc_tx_busylock = &qdisc_tx_busylock_key; \
2136− (dev)->qdisc_running_key = &qdisc_running_key; \
2137− lockdep_set_class(&(dev)->addr_list_lock, \
2138− &dev_addr_list_lock_key); \
2139− for (i = 0; i < (dev)->num_tx_queues; i++) \
2140− lockdep_set_class(&(dev)->_tx[i]._xmit_lock, \
2141− &qdisc_xmit_lock_key); \
2142−}
2143−
21442137 u16 netdev_pick_tx(struct net_device *dev, struct sk_buff *skb,
21452138 struct net_device *sb_dev);
21462139 struct netdev_queue *netdev_core_pick_tx(struct net_device *dev,
@@ -3139,6 +3132,7 @@ static inline void netif_stop_queue(struct net_device *dev) · 992 unmodified lines
31393132 }
31403133
31413134 void netif_tx_stop_all_queues(struct net_device *dev);
3135+void netdev_update_lockdep_key(struct net_device *dev);
31423136
31433137 static inline bool netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
31443138 {
@@ -4056,16 +4050,6 @@ static inline void netif_addr_lock(struct net_device *dev) · 911 unmodified lines
40564050 spin_lock(&dev->addr_list_lock);
40574051 }
40584052
4059−static inline void netif_addr_lock_nested(struct net_device *dev)
4060−{
4061− int subclass = SINGLE_DEPTH_NESTING;
4062−
4063− if (dev->netdev_ops->ndo_get_lock_subclass)
4064− subclass = dev->netdev_ops->ndo_get_lock_subclass(dev);
4065−
4066− spin_lock_nested(&dev->addr_list_lock, subclass);
4067−}
4068−
40694053 static inline void netif_addr_lock_bh(struct net_device *dev)
40704054 {
40714055 spin_lock_bh(&dev->addr_list_lock);
@@ -4329,6 +4313,16 @@ int netdev_master_upper_dev_link(struct net_device *dev, · 257 unmodified lines
43294313 struct netlink_ext_ack *extack);
43304314 void netdev_upper_dev_unlink(struct net_device *dev,
43314315 struct net_device *upper_dev);
4316+int netdev_adjacent_change_prepare(struct net_device *old_dev,
4317+ struct net_device *new_dev,
4318+ struct net_device *dev,
4319+ struct netlink_ext_ack *extack);
4320+void netdev_adjacent_change_commit(struct net_device *old_dev,
4321+ struct net_device *new_dev,
4322+ struct net_device *dev);
4323+void netdev_adjacent_change_abort(struct net_device *old_dev,
4324+ struct net_device *new_dev,
4325+ struct net_device *dev);
43324326 void netdev_adjacent_rename_links(struct net_device *dev, char *oldname);
43334327 void *netdev_lower_dev_get_private(struct net_device *dev,
43344328 struct net_device *lower_dev);
@@ -4340,7 +4334,6 @@ void netdev_lower_state_changed(struct net_device *lower_dev, · 5 unmodified lines
43404334 extern u8 netdev_rss_key[NETDEV_RSS_KEY_LEN] __read_mostly;
43414335 void netdev_rss_key_fill(void *buffer, size_t len);
43424336
4343−int dev_get_nest_level(struct net_device *dev);
43444337 int skb_checksum_help(struct sk_buff *skb);
43454338 int skb_crc32c_csum_help(struct sk_buff *skb);
43464339 int skb_csum_hwoffload_help(struct sk_buff *skb,
include/linux/page-flags.h+18−2
@@ -622,12 +622,28 @@ static inline int PageTransCompound(struct page *page) · 621 unmodified lines
622622 *
623623 * Unlike PageTransCompound, this is safe to be called only while
624624 * split_huge_pmd() cannot run from under us, like if protected by the
625− * MMU notifier, otherwise it may result in page->_mapcount < 0 false
625+ * MMU notifier, otherwise it may result in page->_mapcount check false
626626 * positives.
627+ *
628+ * We have to treat page cache THP differently since every subpage of it
629+ * would get _mapcount inc'ed once it is PMD mapped. But, it may be PTE
630+ * mapped in the current process so comparing subpage's _mapcount to
631+ * compound_mapcount to filter out PTE mapped case.
627632 */
628633 static inline int PageTransCompoundMap(struct page *page)
629634 {
630− return PageTransCompound(page) && atomic_read(&page->_mapcount) < 0;
635+ struct page *head;
636+
637+ if (!PageTransCompound(page))
638+ return 0;
639+
640+ if (PageAnon(page))
641+ return atomic_read(&page->_mapcount) < 0;
642+
643+ head = compound_head(page);
644+ /* File THP is PMD mapped and not PTE mapped */
645+ return atomic_read(&page->_mapcount) ==
646+ atomic_read(compound_mapcount_ptr(head));
631647 }
632648
633649 /*
include/linux/platform_data/dma-imx-sdma.h+3−0
@@ -51,7 +51,10 @@ struct sdma_script_start_addrs { · 50 unmodified lines
5151 /* End of v2 array */
5252 s32 zcanfd_2_mcu_addr;
5353 s32 zqspi_2_mcu_addr;
54+ s32 mcu_2_ecspi_addr;
5455 /* End of v3 array */
56+ s32 mcu_2_zqspi_addr;
57+ /* End of v4 array */
5558 };
5659
5760 /**
include/linux/radix-tree.h+0−18
@@ -315,24 +315,6 @@ radix_tree_iter_lookup(const struct radix_tree_root *root, · 314 unmodified lines
315315 return radix_tree_next_chunk(root, iter, RADIX_TREE_ITER_CONTIG);
316316 }
317317
318−/**
319− * radix_tree_iter_find - find a present entry
320− * @root: radix tree root
321− * @iter: iterator state
322− * @index: start location
323− *
324− * This function returns the slot containing the entry with the lowest index
325− * which is at least @index. If @index is larger than any present entry, this
326− * function returns NULL. The @iter is updated to describe the entry found.
327− */
328−static inline void __rcu **
329−radix_tree_iter_find(const struct radix_tree_root *root,
330− struct radix_tree_iter *iter, unsigned long index)
331−{
332− radix_tree_iter_init(iter, index);
333− return radix_tree_next_chunk(root, iter, 0);
334−}
335−
336318 /**
337319 * radix_tree_iter_retry - retry this chunk of the iteration
338320 * @iter: iterator state
include/linux/reset-controller.h+2−2
@@ -7,7 +7,7 @@ · 6 unmodified lines
77 struct reset_controller_dev;
88
99 /**
10− * struct reset_control_ops
10+ * struct reset_control_ops - reset controller driver callbacks
1111 *
1212 * @reset: for self-deasserting resets, does all necessary
1313 * things to reset the device
@@ -33,7 +33,7 @@ struct of_phandle_args; · 19 unmodified lines
3333 * @provider: name of the reset controller device controlling this reset line
3434 * @index: ID of the reset controller in the reset controller device
3535 * @dev_id: name of the device associated with this reset line
36− * @con_id name of the reset line (can be NULL)
36+ * @con_id: name of the reset line (can be NULL)
3737 */
3838 struct reset_control_lookup {
3939 struct list_head list;
include/linux/reset.h+1−1
@@ -143,7 +143,7 @@ static inline int device_reset_optional(struct device *dev) · 142 unmodified lines
143143 * If this function is called more than once for the same reset_control it will
144144 * return -EBUSY.
145145 *
146− * See reset_control_get_shared for details on shared references to
146+ * See reset_control_get_shared() for details on shared references to
147147 * reset-controls.
148148 *
149149 * Use of id names is optional.
include/linux/security.h+1−0
@@ -105,6 +105,7 @@ enum lockdown_reason { · 104 unmodified lines
105105 LOCKDOWN_NONE,
106106 LOCKDOWN_MODULE_SIGNATURE,
107107 LOCKDOWN_DEV_MEM,
108+ LOCKDOWN_EFI_TEST,
108109 LOCKDOWN_KEXEC,
109110 LOCKDOWN_HIBERNATION,
110111 LOCKDOWN_PCI_ACCESS,
include/linux/skbuff.h+26−10
@@ -1354,7 +1354,8 @@ static inline __u32 skb_get_hash_flowi6(struct sk_buff *skb, const struct flowi6 · 1353 unmodified lines
13541354 return skb->hash;
13551355 }
13561356
1357−__u32 skb_get_hash_perturb(const struct sk_buff *skb, u32 perturb);
1357+__u32 skb_get_hash_perturb(const struct sk_buff *skb,
1358+ const siphash_key_t *perturb);
13581359
13591360 static inline __u32 skb_get_hash_raw(const struct sk_buff *skb)
13601361 {
@@ -1494,6 +1495,19 @@ static inline int skb_queue_empty(const struct sk_buff_head *list) · 133 unmodified lines
14941495 return list->next == (const struct sk_buff *) list;
14951496 }
14961497
1498+/**
1499+ * skb_queue_empty_lockless - check if a queue is empty
1500+ * @list: queue head
1501+ *
1502+ * Returns true if the queue is empty, false otherwise.
1503+ * This variant can be used in lockless contexts.
1504+ */
1505+static inline bool skb_queue_empty_lockless(const struct sk_buff_head *list)
1506+{
1507+ return READ_ONCE(list->next) == (const struct sk_buff *) list;
1508+}
1509+
1510+
14971511 /**
14981512 * skb_queue_is_last - check if skb is the last entry in the queue
14991513 * @list: queue head
@@ -1847,9 +1861,11 @@ static inline void __skb_insert(struct sk_buff *newsk, · 347 unmodified lines
18471861 struct sk_buff *prev, struct sk_buff *next,
18481862 struct sk_buff_head *list)
18491863 {
1850− newsk->next = next;
1851− newsk->prev = prev;
1852− next->prev = prev->next = newsk;
1864+ /* see skb_queue_empty_lockless() for the opposite READ_ONCE() */
1865+ WRITE_ONCE(newsk->next, next);
1866+ WRITE_ONCE(newsk->prev, prev);
1867+ WRITE_ONCE(next->prev, newsk);
1868+ WRITE_ONCE(prev->next, newsk);
18531869 list->qlen++;
18541870 }
18551871
@@ -1860,11 +1876,11 @@ static inline void __skb_queue_splice(const struct sk_buff_head *list, · 4 unmodified lines
18601876 struct sk_buff *first = list->next;
18611877 struct sk_buff *last = list->prev;
18621878
1863− first->prev = prev;
1864− prev->next = first;
1879+ WRITE_ONCE(first->prev, prev);
1880+ WRITE_ONCE(prev->next, first);
18651881
1866− last->next = next;
1867− next->prev = last;
1882+ WRITE_ONCE(last->next, next);
1883+ WRITE_ONCE(next->prev, last);
18681884 }
18691885
18701886 /**
@@ -2005,8 +2021,8 @@ static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) · 134 unmodified lines
20052021 next = skb->next;
20062022 prev = skb->prev;
20072023 skb->next = skb->prev = NULL;
2008− next->prev = prev;
2009− prev->next = next;
2024+ WRITE_ONCE(next->prev, prev);
2025+ WRITE_ONCE(prev->next, next);
20102026 }
20112027
20122028 /**
include/linux/skmsg.h+6−3
@@ -139,6 +139,11 @@ static inline void sk_msg_apply_bytes(struct sk_psock *psock, u32 bytes) · 138 unmodified lines
139139 }
140140 }
141141
142+static inline u32 sk_msg_iter_dist(u32 start, u32 end)
143+{
144+ return end >= start ? end - start : end + (MAX_MSG_FRAGS - start);
145+}
146+
142147 #define sk_msg_iter_var_prev(var) \
143148 do { \
144149 if (var == 0) \
@@ -198,9 +203,7 @@ static inline u32 sk_msg_elem_used(const struct sk_msg *msg) · 53 unmodified lines
198203 if (sk_msg_full(msg))
199204 return MAX_MSG_FRAGS;
200205
201− return msg->sg.end >= msg->sg.start ?
202− msg->sg.end - msg->sg.start :
203− msg->sg.end + (MAX_MSG_FRAGS - msg->sg.start);
206+ return sk_msg_iter_dist(msg->sg.start, msg->sg.end);
204207 }
205208
206209 static inline struct scatterlist *sk_msg_elem(struct sk_msg *msg, int which)
include/linux/socket.h+1−1
@@ -263,7 +263,7 @@ struct ucred { · 262 unmodified lines
263263 #define PF_MAX AF_MAX
264264
265265 /* Maximum queue length specifiable by listen. */
266−#define SOMAXCONN 128
266+#define SOMAXCONN 4096
267267
268268 /* Flags we can use with send/ and recv.
269269 Added those for 1003.1g not all are supported yet
include/linux/sunrpc/bc_xprt.h+5−0
@@ -64,6 +64,11 @@ static inline int xprt_setup_backchannel(struct rpc_xprt *xprt, · 63 unmodified lines
6464 return 0;
6565 }
6666
67+static inline void xprt_destroy_backchannel(struct rpc_xprt *xprt,
68+ unsigned int max_reqs)
69+{
70+}
71+
6772 static inline bool svc_is_backchannel(const struct svc_rqst *rqstp)
6873 {
6974 return false;
include/linux/virtio_vsock.h+0−1
@@ -48,7 +48,6 @@ struct virtio_vsock_sock { · 47 unmodified lines
4848
4949 struct virtio_vsock_pkt {
5050 struct virtio_vsock_hdr hdr;
51− struct work_struct work;
5251 struct list_head list;
5352 /* socket refcnt not held, only use for cancellation */
5453 struct vsock_sock *vsk;
include/net/bonding.h+2−3
@@ -159,7 +159,6 @@ struct slave { · 158 unmodified lines
159159 unsigned long target_last_arp_rx[BOND_MAX_ARP_TARGETS];
160160 s8 link; /* one of BOND_LINK_XXXX */
161161 s8 link_new_state; /* one of BOND_LINK_XXXX */
162− s8 new_link;
163162 u8 backup:1, /* indicates backup slave. Value corresponds with
164163 BOND_STATE_ACTIVE and BOND_STATE_BACKUP */
165164 inactive:1, /* indicates inactive slave */
@@ -203,7 +202,6 @@ struct bonding { · 37 unmodified lines
203202 struct slave __rcu *primary_slave;
204203 struct bond_up_slave __rcu *slave_arr; /* Array of usable slaves */
205204 bool force_primary;
206− u32 nest_level;
207205 s32 slave_cnt; /* never change this value outside the attach/detach wrappers */
208206 int (*recv_probe)(const struct sk_buff *, struct bonding *,
209207 struct slave *);
@@ -239,6 +237,7 @@ struct bonding { · 29 unmodified lines
239237 struct dentry *debug_dir;
240238 #endif /* CONFIG_DEBUG_FS */
241239 struct rtnl_link_stats64 bond_stats;
240+ struct lock_class_key stats_lock_key;
242241 };
243242
244243 #define bond_slave_get_rcu(dev) \
@@ -549,7 +548,7 @@ static inline void bond_propose_link_state(struct slave *slave, int state) · 304 unmodified lines
549548
550549 static inline void bond_commit_link_state(struct slave *slave, bool notify)
551550 {
552− if (slave->link == slave->link_new_state)
551+ if (slave->link_new_state == BOND_LINK_NOCHANGE)
553552 return;
554553
555554 slave->link = slave->link_new_state;
include/net/busy_poll.h+3−3
@@ -122,7 +122,7 @@ static inline void skb_mark_napi_id(struct sk_buff *skb, · 121 unmodified lines
122122 static inline void sk_mark_napi_id(struct sock *sk, const struct sk_buff *skb)
123123 {
124124 #ifdef CONFIG_NET_RX_BUSY_POLL
125− sk->sk_napi_id = skb->napi_id;
125+ WRITE_ONCE(sk->sk_napi_id, skb->napi_id);
126126 #endif
127127 sk_rx_queue_set(sk, skb);
128128 }
@@ -132,8 +132,8 @@ static inline void sk_mark_napi_id_once(struct sock *sk, · 3 unmodified lines
132132 const struct sk_buff *skb)
133133 {
134134 #ifdef CONFIG_NET_RX_BUSY_POLL
135− if (!sk->sk_napi_id)
136− sk->sk_napi_id = skb->napi_id;
135+ if (!READ_ONCE(sk->sk_napi_id))
136+ WRITE_ONCE(sk->sk_napi_id, skb->napi_id);
137137 #endif
138138 }
139139
include/net/flow_dissector.h+2−1
@@ -4,6 +4,7 @@ · 3 unmodified lines
44
55 #include <linux/types.h>
66 #include <linux/in6.h>
7+#include <linux/siphash.h>
78 #include <uapi/linux/if_ether.h>
89
910 /**
@@ -276,7 +277,7 @@ struct flow_keys_basic { · 266 unmodified lines
276277 struct flow_keys {
277278 struct flow_dissector_key_control control;
278279 #define FLOW_KEYS_HASH_START_FIELD basic
279− struct flow_dissector_key_basic basic;
280+ struct flow_dissector_key_basic basic __aligned(SIPHASH_ALIGNMENT);
280281 struct flow_dissector_key_tags tags;
281282 struct flow_dissector_key_vlan vlan;
282283 struct flow_dissector_key_vlan cvlan;
include/net/fq.h+1−1
@@ -69,7 +69,7 @@ struct fq { · 68 unmodified lines
6969 struct list_head backlogs;
7070 spinlock_t lock;
7171 u32 flows_cnt;
72− u32 perturbation;
72+ siphash_key_t perturbation;
7373 u32 limit;
7474 u32 memory_limit;
7575 u32 memory_usage;
include/net/fq_impl.h+4−4
@@ -108,7 +108,7 @@ begin: · 107 unmodified lines
108108
109109 static u32 fq_flow_idx(struct fq *fq, struct sk_buff *skb)
110110 {
111− u32 hash = skb_get_hash_perturb(skb, fq->perturbation);
111+ u32 hash = skb_get_hash_perturb(skb, &fq->perturbation);
112112
113113 return reciprocal_scale(hash, fq->flows_cnt);
114114 }
@@ -308,12 +308,12 @@ static int fq_init(struct fq *fq, int flows_cnt) · 193 unmodified lines
308308 INIT_LIST_HEAD(&fq->backlogs);
309309 spin_lock_init(&fq->lock);
310310 fq->flows_cnt = max_t(u32, flows_cnt, 1);
311− fq->perturbation = prandom_u32();
311+ get_random_bytes(&fq->perturbation, sizeof(fq->perturbation));
312312 fq->quantum = 300;
313313 fq->limit = 8192;
314314 fq->memory_limit = 16 << 20; /* 16 MBytes */
315315
316− fq->flows = kcalloc(fq->flows_cnt, sizeof(fq->flows[0]), GFP_KERNEL);
316+ fq->flows = kvcalloc(fq->flows_cnt, sizeof(fq->flows[0]), GFP_KERNEL);
317317 if (!fq->flows)
318318 return -ENOMEM;
319319
@@ -331,7 +331,7 @@ static void fq_reset(struct fq *fq, · 11 unmodified lines
331331 for (i = 0; i < fq->flows_cnt; i++)
332332 fq_flow_reset(fq, &fq->flows[i], free_func);
333333
334− kfree(fq->flows);
334+ kvfree(fq->flows);
335335 fq->flows = NULL;
336336 }
337337
include/net/hwbm.h+7−3
@@ -21,9 +21,13 @@ void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf); · 20 unmodified lines
2121 int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp);
2222 int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num);
2323 #else
24−void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
25−int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; }
26−int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num)
24+static inline void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
25+
26+static inline int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp)
27+{ return 0; }
28+
29+static inline int hwbm_pool_add(struct hwbm_pool *bm_pool,
30+ unsigned int buf_num)
2731 { return 0; }
2832 #endif /* CONFIG_HWBM */
2933 #endif /* _HWBM_H */
include/net/ip.h+2−2
@@ -185,7 +185,7 @@ static inline struct sk_buff *ip_fraglist_next(struct ip_fraglist_iter *iter) · 184 unmodified lines
185185 }
186186
187187 struct ip_frag_state {
188− struct iphdr *iph;
188+ bool DF;
189189 unsigned int hlen;
190190 unsigned int ll_rs;
191191 unsigned int mtu;
@@ -196,7 +196,7 @@ struct ip_frag_state { · 4 unmodified lines
196196 };
197197
198198 void ip_frag_init(struct sk_buff *skb, unsigned int hlen, unsigned int ll_rs,
199− unsigned int mtu, struct ip_frag_state *state);
199+ unsigned int mtu, bool DF, struct ip_frag_state *state);
200200 struct sk_buff *ip_frag_next(struct sk_buff *skb,
201201 struct ip_frag_state *state);
202202
include/net/ip_vs.h+1−0
@@ -889,6 +889,7 @@ struct netns_ipvs { · 888 unmodified lines
889889 struct delayed_work defense_work; /* Work handler */
890890 int drop_rate;
891891 int drop_counter;
892+ int old_secure_tcp;
892893 atomic_t dropentry;
893894 /* locks in ctl.c */
894895 spinlock_t dropentry_lock; /* drop entry handling */
include/net/neighbour.h+2−2
@@ -439,8 +439,8 @@ static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) · 438 unmodified lines
439439 {
440440 unsigned long now = jiffies;
441441
442− if (neigh->used != now)
443− neigh->used = now;
442+ if (READ_ONCE(neigh->used) != now)
443+ WRITE_ONCE(neigh->used, now);
444444 if (!(neigh->nud_state&(NUD_CONNECTED|NUD_DELAY|NUD_PROBE)))
445445 return __neigh_event_send(neigh, skb);
446446 return 0;
include/net/net_namespace.h+1−1
@@ -342,7 +342,7 @@ static inline struct net *read_pnet(const possible_net_t *pnet) · 341 unmodified lines
342342 #define __net_initconst __initconst
343343 #endif
344344
345−int peernet2id_alloc(struct net *net, struct net *peer);
345+int peernet2id_alloc(struct net *net, struct net *peer, gfp_t gfp);
346346 int peernet2id(struct net *net, struct net *peer);
347347 bool peernet_has_id(struct net *net, struct net *peer);
348348 struct net *get_net_ns_by_id(struct net *net, int id);
include/net/netfilter/nf_tables.h+2−1
@@ -820,7 +820,8 @@ struct nft_expr_ops { · 819 unmodified lines
820820 */
821821 struct nft_expr {
822822 const struct nft_expr_ops *ops;
823− unsigned char data[];
823+ unsigned char data[]
824+ __attribute__((aligned(__alignof__(u64))));
824825 };
825826
826827 static inline void *nft_expr_priv(const struct nft_expr *expr)
include/net/sch_generic.h+4−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <linux/mutex.h>
1616 #include <linux/rwsem.h>
1717 #include <linux/atomic.h>
18+#include <linux/hashtable.h>
1819 #include <net/gen_stats.h>
1920 #include <net/rtnetlink.h>
2021 #include <net/flow_offload.h>
@@ -362,6 +363,7 @@ struct tcf_proto { · 341 unmodified lines
362363 bool deleting;
363364 refcount_t refcnt;
364365 struct rcu_head rcu;
366+ struct hlist_node destroy_ht_node;
365367 };
366368
367369 struct qdisc_skb_cb {
@@ -414,6 +416,8 @@ struct tcf_block { · 46 unmodified lines
414416 struct list_head filter_chain_list;
415417 } chain0;
416418 struct rcu_head rcu;
419+ DECLARE_HASHTABLE(proto_destroy_ht, 7);
420+ struct mutex proto_destroy_lock; /* Lock for proto_destroy hashtable. */
417421 };
418422
419423 #ifdef CONFIG_PROVE_LOCKING
include/net/sock.h+12−7
@@ -954,8 +954,8 @@ static inline void sk_incoming_cpu_update(struct sock *sk) · 953 unmodified lines
954954 {
955955 int cpu = raw_smp_processor_id();
956956
957− if (unlikely(sk->sk_incoming_cpu != cpu))
958− sk->sk_incoming_cpu = cpu;
957+ if (unlikely(READ_ONCE(sk->sk_incoming_cpu) != cpu))
958+ WRITE_ONCE(sk->sk_incoming_cpu, cpu);
959959 }
960960
961961 static inline void sock_rps_record_flow_hash(__u32 hash)
@@ -2242,12 +2242,17 @@ struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp, · 1280 unmodified lines
22422242 * sk_page_frag - return an appropriate page_frag
22432243 * @sk: socket
22442244 *
2245− * If socket allocation mode allows current thread to sleep, it means its
2246− * safe to use the per task page_frag instead of the per socket one.
2245+ * Use the per task page_frag instead of the per socket one for
2246+ * optimization when we know that we're in the normal context and owns
2247+ * everything that's associated with %current.
2248+ *
2249+ * gfpflags_allow_blocking() isn't enough here as direct reclaim may nest
2250+ * inside other socket operations and end up recursing into sk_page_frag()
2251+ * while it's already in use.
22472252 */
22482253 static inline struct page_frag *sk_page_frag(struct sock *sk)
22492254 {
2250− if (gfpflags_allow_blocking(sk->sk_allocation))
2255+ if (gfpflags_normal_context(sk->sk_allocation))
22512256 return &current->task_frag;
22522257
22532258 return &sk->sk_frag;
@@ -2337,7 +2342,7 @@ static inline ktime_t sock_read_timestamp(struct sock *sk) · 83 unmodified lines
23372342
23382343 return kt;
23392344 #else
2340− return sk->sk_stamp;
2345+ return READ_ONCE(sk->sk_stamp);
23412346 #endif
23422347 }
23432348
@@ -2348,7 +2353,7 @@ static inline void sock_write_timestamp(struct sock *sk, ktime_t kt) · 4 unmodified lines
23482353 sk->sk_stamp = kt;
23492354 write_sequnlock(&sk->sk_stamp_seq);
23502355 #else
2351− sk->sk_stamp = kt;
2356+ WRITE_ONCE(sk->sk_stamp, kt);
23522357 #endif
23532358 }
23542359
include/net/tls.h+5−0
@@ -40,6 +40,7 @@ · 39 unmodified lines
4040 #include <linux/socket.h>
4141 #include <linux/tcp.h>
4242 #include <linux/skmsg.h>
43+#include <linux/mutex.h>
4344 #include <linux/netdevice.h>
4445 #include <linux/rcupdate.h>
4546
@@ -269,6 +270,10 @@ struct tls_context { · 223 unmodified lines
269270
270271 bool in_tcp_sendpages;
271272 bool pending_open_record_frags;
273+
274+ struct mutex tx_lock; /* protects partially_sent_* fields and
275+ * per-type TX fields
276+ */
272277 unsigned long flags;
273278
274279 /* cache cold stuff */
include/net/vxlan.h+1−0
@@ -197,6 +197,7 @@ struct vxlan_rdst { · 196 unmodified lines
197197 u8 offloaded:1;
198198 __be32 remote_vni;
199199 u32 remote_ifindex;
200+ struct net_device *remote_dev;
200201 struct list_head list;
201202 struct rcu_head rcu;
202203 struct dst_cache dst_cache;
include/rdma/ib_verbs.h+1−1
@@ -366,7 +366,7 @@ struct ib_tm_caps { · 365 unmodified lines
366366
367367 struct ib_cq_init_attr {
368368 unsigned int cqe;
369− int comp_vector;
369+ u32 comp_vector;
370370 u32 flags;
371371 };
372372
include/uapi/linux/can.h+1−1
@@ -1,4 +1,4 @@
1−/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
1+/* SPDX-License-Identifier: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) */
22 /*
33 * linux/can.h
44 *
include/uapi/linux/can/bcm.h+1−1
@@ -1,4 +1,4 @@
1−/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
1+/* SPDX-License-Identifier: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) */
22 /*
33 * linux/can/bcm.h
44 *
include/uapi/linux/can/error.h+1−1
@@ -1,4 +1,4 @@
1−/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
1+/* SPDX-License-Identifier: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) */
22 /*
33 * linux/can/error.h
44 *
include/uapi/linux/can/gw.h+1−1
@@ -1,4 +1,4 @@
1−/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
1+/* SPDX-License-Identifier: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) */
22 /*
33 * linux/can/gw.h
44 *
include/uapi/linux/can/j1939.h+1−1
@@ -1,4 +1,4 @@
1−/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
1+/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
22 /*
33 * j1939.h
44 *
include/uapi/linux/can/netlink.h+1−1
@@ -1,4 +1,4 @@
1−/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
1+/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
22 /*
33 * linux/can/netlink.h
44 *
include/uapi/linux/can/raw.h+1−1
@@ -1,4 +1,4 @@
1−/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
1+/* SPDX-License-Identifier: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) */
22 /*
33 * linux/can/raw.h
44 *
include/uapi/linux/can/vxcan.h+1−1
@@ -1,4 +1,4 @@
1−/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
1+/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
22 #ifndef _UAPI_CAN_VXCAN_H
33 #define _UAPI_CAN_VXCAN_H
44
include/uapi/linux/fuse.h+37−0
@@ -38,6 +38,43 @@ · 37 unmodified lines
3838 *
3939 * Protocol changelog:
4040 *
41+ * 7.1:
42+ * - add the following messages:
43+ * FUSE_SETATTR, FUSE_SYMLINK, FUSE_MKNOD, FUSE_MKDIR, FUSE_UNLINK,
44+ * FUSE_RMDIR, FUSE_RENAME, FUSE_LINK, FUSE_OPEN, FUSE_READ, FUSE_WRITE,
45+ * FUSE_RELEASE, FUSE_FSYNC, FUSE_FLUSH, FUSE_SETXATTR, FUSE_GETXATTR,
46+ * FUSE_LISTXATTR, FUSE_REMOVEXATTR, FUSE_OPENDIR, FUSE_READDIR,
47+ * FUSE_RELEASEDIR
48+ * - add padding to messages to accommodate 32-bit servers on 64-bit kernels
49+ *
50+ * 7.2:
51+ * - add FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE flags
52+ * - add FUSE_FSYNCDIR message
53+ *
54+ * 7.3:
55+ * - add FUSE_ACCESS message
56+ * - add FUSE_CREATE message
57+ * - add filehandle to fuse_setattr_in
58+ *
59+ * 7.4:
60+ * - add frsize to fuse_kstatfs
61+ * - clean up request size limit checking
62+ *
63+ * 7.5:
64+ * - add flags and max_write to fuse_init_out
65+ *
66+ * 7.6:
67+ * - add max_readahead to fuse_init_in and fuse_init_out
68+ *
69+ * 7.7:
70+ * - add FUSE_INTERRUPT message
71+ * - add POSIX file lock support
72+ *
73+ * 7.8:
74+ * - add lock_owner and flags fields to fuse_release_in
75+ * - add FUSE_BMAP message
76+ * - add FUSE_DESTROY message
77+ *
4178 * 7.9:
4279 * - new fuse_getattr_in input argument of GETATTR
4380 * - add lk_flags in fuse_lk_in
include/uapi/linux/nvme_ioctl.h+1−0
@@ -63,6 +63,7 @@ struct nvme_passthru_cmd64 { · 62 unmodified lines
6363 __u32 cdw14;
6464 __u32 cdw15;
6565 __u32 timeout_ms;
66+ __u32 rsvd2;
6667 __u64 result;
6768 };
6869
include/uapi/linux/sched.h+4−0
@@ -51,6 +51,10 @@ · 50 unmodified lines
5151 * sent when the child exits.
5252 * @stack: Specify the location of the stack for the
5353 * child process.
54+ * Note, @stack is expected to point to the
55+ * lowest address. The stack direction will be
56+ * determined by the kernel and set up
57+ * appropriately based on @stack_size.
5458 * @stack_size: The size of the stack for the child process.
5559 * @tls: If CLONE_SETTLS is set, the tls descriptor
5660 * is set to tls.
kernel/bpf/cgroup.c+2−2
@@ -1311,12 +1311,12 @@ static bool sysctl_is_valid_access(int off, int size, enum bpf_access_type type, · 1310 unmodified lines
13111311 return false;
13121312
13131313 switch (off) {
1314− case offsetof(struct bpf_sysctl, write):
1314+ case bpf_ctx_range(struct bpf_sysctl, write):
13151315 if (type != BPF_READ)
13161316 return false;
13171317 bpf_ctx_record_field_size(info, size_default);
13181318 return bpf_ctx_narrow_access_ok(off, size, size_default);
1319− case offsetof(struct bpf_sysctl, file_pos):
1319+ case bpf_ctx_range(struct bpf_sysctl, file_pos):
13201320 if (type == BPF_READ) {
13211321 bpf_ctx_record_field_size(info, size_default);
13221322 return bpf_ctx_narrow_access_ok(off, size, size_default);
kernel/bpf/core.c+1−1
@@ -502,7 +502,7 @@ int bpf_remove_insns(struct bpf_prog *prog, u32 off, u32 cnt) · 501 unmodified lines
502502 return WARN_ON_ONCE(bpf_adj_branches(prog, off, off + cnt, off, false));
503503 }
504504
505−void bpf_prog_kallsyms_del_subprogs(struct bpf_prog *fp)
505+static void bpf_prog_kallsyms_del_subprogs(struct bpf_prog *fp)
506506 {
507507 int i;
508508
kernel/bpf/devmap.c+32−1
@@ -128,7 +128,7 @@ static int dev_map_init_map(struct bpf_dtab *dtab, union bpf_attr *attr) · 127 unmodified lines
128128
129129 if (!dtab->n_buckets) /* Overflow check */
130130 return -EINVAL;
131− cost += sizeof(struct hlist_head) * dtab->n_buckets;
131+ cost += (u64) sizeof(struct hlist_head) * dtab->n_buckets;
132132 }
133133
134134 /* if map size is larger than memlock limit, reject it */
@@ -719,6 +719,32 @@ const struct bpf_map_ops dev_map_hash_ops = { · 584 unmodified lines
719719 .map_check_btf = map_check_no_btf,
720720 };
721721
722+static void dev_map_hash_remove_netdev(struct bpf_dtab *dtab,
723+ struct net_device *netdev)
724+{
725+ unsigned long flags;
726+ u32 i;
727+
728+ spin_lock_irqsave(&dtab->index_lock, flags);
729+ for (i = 0; i < dtab->n_buckets; i++) {
730+ struct bpf_dtab_netdev *dev;
731+ struct hlist_head *head;
732+ struct hlist_node *next;
733+
734+ head = dev_map_index_hash(dtab, i);
735+
736+ hlist_for_each_entry_safe(dev, next, head, index_hlist) {
737+ if (netdev != dev->dev)
738+ continue;
739+
740+ dtab->items--;
741+ hlist_del_rcu(&dev->index_hlist);
742+ call_rcu(&dev->rcu, __dev_map_entry_free);
743+ }
744+ }
745+ spin_unlock_irqrestore(&dtab->index_lock, flags);
746+}
747+
722748 static int dev_map_notification(struct notifier_block *notifier,
723749 ulong event, void *ptr)
724750 {
@@ -735,6 +761,11 @@ static int dev_map_notification(struct notifier_block *notifier, · 10 unmodified lines
735761 */
736762 rcu_read_lock();
737763 list_for_each_entry_rcu(dtab, &dev_map_list, list) {
764+ if (dtab->map.map_type == BPF_MAP_TYPE_DEVMAP_HASH) {
765+ dev_map_hash_remove_netdev(dtab, netdev);
766+ continue;
767+ }
768+
738769 for (i = 0; i < dtab->map.max_entries; i++) {
739770 struct bpf_dtab_netdev *dev, *odev;
740771
kernel/bpf/syscall.c+25−13
@@ -126,7 +126,7 @@ static struct bpf_map *find_and_alloc_map(union bpf_attr *attr) · 125 unmodified lines
126126 return map;
127127 }
128128
129−void *bpf_map_area_alloc(size_t size, int numa_node)
129+void *bpf_map_area_alloc(u64 size, int numa_node)
130130 {
131131 /* We really just want to fail instead of triggering OOM killer
132132 * under memory pressure, therefore we set __GFP_NORETRY to kmalloc,
@@ -141,6 +141,9 @@ void *bpf_map_area_alloc(size_t size, int numa_node) · 8 unmodified lines
141141 const gfp_t flags = __GFP_NOWARN | __GFP_ZERO;
142142 void *area;
143143
144+ if (size >= SIZE_MAX)
145+ return NULL;
146+
144147 if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) {
145148 area = kmalloc_node(size, GFP_USER | __GFP_NORETRY | flags,
146149 numa_node);
@@ -197,7 +200,7 @@ static void bpf_uncharge_memlock(struct user_struct *user, u32 pages) · 50 unmodified lines
197200 atomic_long_sub(pages, &user->locked_vm);
198201 }
199202
200−int bpf_map_charge_init(struct bpf_map_memory *mem, size_t size)
203+int bpf_map_charge_init(struct bpf_map_memory *mem, u64 size)
201204 {
202205 u32 pages = round_up(size, PAGE_SIZE) >> PAGE_SHIFT;
203206 struct user_struct *user;
@@ -1326,24 +1329,32 @@ static void __bpf_prog_put_rcu(struct rcu_head *rcu) · 1122 unmodified lines
13261329 {
13271330 struct bpf_prog_aux *aux = container_of(rcu, struct bpf_prog_aux, rcu);
13281331
1332+ kvfree(aux->func_info);
13291333 free_used_maps(aux);
13301334 bpf_prog_uncharge_memlock(aux->prog);
13311335 security_bpf_prog_free(aux);
13321336 bpf_prog_free(aux->prog);
13331337 }
13341338
1339+static void __bpf_prog_put_noref(struct bpf_prog *prog, bool deferred)
1340+{
1341+ bpf_prog_kallsyms_del_all(prog);
1342+ btf_put(prog->aux->btf);
1343+ bpf_prog_free_linfo(prog);
1344+
1345+ if (deferred)
1346+ call_rcu(&prog->aux->rcu, __bpf_prog_put_rcu);
1347+ else
1348+ __bpf_prog_put_rcu(&prog->aux->rcu);
1349+}
1350+
13351351 static void __bpf_prog_put(struct bpf_prog *prog, bool do_idr_lock)
13361352 {
13371353 if (atomic_dec_and_test(&prog->aux->refcnt)) {
13381354 perf_event_bpf_event(prog, PERF_BPF_EVENT_PROG_UNLOAD, 0);
13391355 /* bpf_prog_free_id() must be called first */
13401356 bpf_prog_free_id(prog, do_idr_lock);
1341− bpf_prog_kallsyms_del_all(prog);
1342− btf_put(prog->aux->btf);
1343− kvfree(prog->aux->func_info);
1344− bpf_prog_free_linfo(prog);
1345−
1346− call_rcu(&prog->aux->rcu, __bpf_prog_put_rcu);
1357+ __bpf_prog_put_noref(prog, true);
13471358 }
13481359 }
13491360
@@ -1741,11 +1752,12 @@ static int bpf_prog_load(union bpf_attr *attr, union bpf_attr __user *uattr) · 391 unmodified lines
17411752 return err;
17421753
17431754 free_used_maps:
1744− bpf_prog_free_linfo(prog);
1745− kvfree(prog->aux->func_info);
1746− btf_put(prog->aux->btf);
1747− bpf_prog_kallsyms_del_subprogs(prog);
1748− free_used_maps(prog->aux);
1755+ /* In case we have subprogs, we need to wait for a grace
1756+ * period before we can tear down JIT memory since symbols
1757+ * are already exposed under kallsyms.
1758+ */
1759+ __bpf_prog_put_noref(prog, prog->aux->func_cnt);
1760+ return err;
17491761 free_prog:
17501762 bpf_prog_uncharge_memlock(prog);
17511763 free_prog_sec:
kernel/cgroup/cpuset.c+2−1
@@ -798,7 +798,8 @@ static int generate_sched_domains(cpumask_var_t **domains, · 797 unmodified lines
798798 cpumask_subset(cp->cpus_allowed, top_cpuset.effective_cpus))
799799 continue;
800800
801− if (is_sched_load_balance(cp))
801+ if (is_sched_load_balance(cp) &&
802+ !cpumask_empty(cp->effective_cpus))
802803 csa[csn++] = cp;
803804
804805 /* skip @cp's subtree if not a partition root */
kernel/fork.c+32−1
@@ -2561,7 +2561,35 @@ noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs, · 2560 unmodified lines
25612561 return 0;
25622562 }
25632563
2564−static bool clone3_args_valid(const struct kernel_clone_args *kargs)
2564+/**
2565+ * clone3_stack_valid - check and prepare stack
2566+ * @kargs: kernel clone args
2567+ *
2568+ * Verify that the stack arguments userspace gave us are sane.
2569+ * In addition, set the stack direction for userspace since it's easy for us to
2570+ * determine.
2571+ */
2572+static inline bool clone3_stack_valid(struct kernel_clone_args *kargs)
2573+{
2574+ if (kargs->stack == 0) {
2575+ if (kargs->stack_size > 0)
2576+ return false;
2577+ } else {
2578+ if (kargs->stack_size == 0)
2579+ return false;
2580+
2581+ if (!access_ok((void __user *)kargs->stack, kargs->stack_size))
2582+ return false;
2583+
2584+#if !defined(CONFIG_STACK_GROWSUP) && !defined(CONFIG_IA64)
2585+ kargs->stack += kargs->stack_size;
2586+#endif
2587+ }
2588+
2589+ return true;
2590+}
2591+
2592+static bool clone3_args_valid(struct kernel_clone_args *kargs)
25652593 {
25662594 /*
25672595 * All lower bits of the flag word are taken.
@@ -2581,6 +2609,9 @@ static bool clone3_args_valid(const struct kernel_clone_args *kargs) · 13 unmodified lines
25812609 kargs->exit_signal)
25822610 return false;
25832611
2612+ if (!clone3_stack_valid(kargs))
2613+ return false;
2614+
25842615 return true;
25852616 }
25862617
kernel/irq/irqdomain.c+1−1
@@ -51,7 +51,7 @@ EXPORT_SYMBOL_GPL(irqchip_fwnode_ops); · 50 unmodified lines
5151 * @type: Type of irqchip_fwnode. See linux/irqdomain.h
5252 * @name: Optional user provided domain name
5353 * @id: Optional user provided id if name != NULL
54− * @data: Optional user-provided data
54+ * @pa: Optional user-provided physical address
5555 *
5656 * Allocate a struct irqchip_fwid, and return a poiner to the embedded
5757 * fwnode_handle (or NULL on failure).
kernel/sched/core.c+16−7
@@ -1073,6 +1073,7 @@ uclamp_update_active(struct task_struct *p, enum uclamp_id clamp_id) · 1072 unmodified lines
10731073 task_rq_unlock(rq, p, &rf);
10741074 }
10751075
1076+#ifdef CONFIG_UCLAMP_TASK_GROUP
10761077 static inline void
10771078 uclamp_update_active_tasks(struct cgroup_subsys_state *css,
10781079 unsigned int clamps)
@@ -1091,7 +1092,6 @@ uclamp_update_active_tasks(struct cgroup_subsys_state *css, · 12 unmodified lines
10911092 css_task_iter_end(&it);
10921093 }
10931094
1094−#ifdef CONFIG_UCLAMP_TASK_GROUP
10951095 static void cpu_util_update_eff(struct cgroup_subsys_state *css);
10961096 static void uclamp_update_root_tg(void)
10971097 {
@@ -3929,13 +3929,22 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) · 2831 unmodified lines
39293929 }
39303930
39313931 restart:
3932+#ifdef CONFIG_SMP
39323933 /*
3933− * Ensure that we put DL/RT tasks before the pick loop, such that they
3934− * can PULL higher prio tasks when we lower the RQ 'priority'.
3934+ * We must do the balancing pass before put_next_task(), such
3935+ * that when we release the rq->lock the task is in the same
3936+ * state as before we took rq->lock.
3937+ *
3938+ * We can terminate the balance pass as soon as we know there is
3939+ * a runnable task of @class priority or higher.
39353940 */
3936− prev->sched_class->put_prev_task(rq, prev, rf);
3937− if (!rq->nr_running)
3938− newidle_balance(rq, rf);
3941+ for_class_range(class, prev->sched_class, &idle_sched_class) {
3942+ if (class->balance(rq, prev, rf))
3943+ break;
3944+ }
3945+#endif
3946+
3947+ put_prev_task(rq, prev);
39393948
39403949 for_each_class(class) {
39413950 p = class->pick_next_task(rq, NULL, NULL);
@@ -6201,7 +6210,7 @@ static struct task_struct *__pick_migrate_task(struct rq *rq) · 2259 unmodified lines
62016210 for_each_class(class) {
62026211 next = class->pick_next_task(rq, NULL, NULL);
62036212 if (next) {
6204− next->sched_class->put_prev_task(rq, next, NULL);
6213+ next->sched_class->put_prev_task(rq, next);
62056214 return next;
62066215 }
62076216 }
kernel/sched/deadline.c+20−20
@@ -1691,6 +1691,22 @@ static void check_preempt_equal_dl(struct rq *rq, struct task_struct *p) · 1690 unmodified lines
16911691 resched_curr(rq);
16921692 }
16931693
1694+static int balance_dl(struct rq *rq, struct task_struct *p, struct rq_flags *rf)
1695+{
1696+ if (!on_dl_rq(&p->dl) && need_pull_dl_task(rq, p)) {
1697+ /*
1698+ * This is OK, because current is on_cpu, which avoids it being
1699+ * picked for load-balance and preemption/IRQs are still
1700+ * disabled avoiding further scheduler activity on it and we've
1701+ * not yet started the picking loop.
1702+ */
1703+ rq_unpin_lock(rq, rf);
1704+ pull_dl_task(rq);
1705+ rq_repin_lock(rq, rf);
1706+ }
1707+
1708+ return sched_stop_runnable(rq) || sched_dl_runnable(rq);
1709+}
16941710 #endif /* CONFIG_SMP */
16951711
16961712 /*
@@ -1758,45 +1774,28 @@ static struct task_struct * · 61 unmodified lines
17581774 pick_next_task_dl(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
17591775 {
17601776 struct sched_dl_entity *dl_se;
1777+ struct dl_rq *dl_rq = &rq->dl;
17611778 struct task_struct *p;
1762− struct dl_rq *dl_rq;
17631779
17641780 WARN_ON_ONCE(prev || rf);
17651781
1766− dl_rq = &rq->dl;
1767−
1768− if (unlikely(!dl_rq->dl_nr_running))
1782+ if (!sched_dl_runnable(rq))
17691783 return NULL;
17701784
17711785 dl_se = pick_next_dl_entity(rq, dl_rq);
17721786 BUG_ON(!dl_se);
1773−
17741787 p = dl_task_of(dl_se);
1775−
17761788 set_next_task_dl(rq, p);
1777−
17781789 return p;
17791790 }
17801791
1781−static void put_prev_task_dl(struct rq *rq, struct task_struct *p, struct rq_flags *rf)
1792+static void put_prev_task_dl(struct rq *rq, struct task_struct *p)
17821793 {
17831794 update_curr_dl(rq);
17841795
17851796 update_dl_rq_load_avg(rq_clock_pelt(rq), rq, 1);
17861797 if (on_dl_rq(&p->dl) && p->nr_cpus_allowed > 1)
17871798 enqueue_pushable_dl_task(rq, p);
1788−
1789− if (rf && !on_dl_rq(&p->dl) && need_pull_dl_task(rq, p)) {
1790− /*
1791− * This is OK, because current is on_cpu, which avoids it being
1792− * picked for load-balance and preemption/IRQs are still
1793− * disabled avoiding further scheduler activity on it and we've
1794− * not yet started the picking loop.
1795− */
1796− rq_unpin_lock(rq, rf);
1797− pull_dl_task(rq);
1798− rq_repin_lock(rq, rf);
1799− }
18001799 }
18011800
18021801 /*
@@ -2442,6 +2441,7 @@ const struct sched_class dl_sched_class = { · 639 unmodified lines
24422441 .set_next_task = set_next_task_dl,
24432442
24442443 #ifdef CONFIG_SMP
2444+ .balance = balance_dl,
24452445 .select_task_rq = select_task_rq_dl,
24462446 .migrate_task_rq = migrate_task_rq_dl,
24472447 .set_cpus_allowed = set_cpus_allowed_dl,
kernel/sched/fair.c+12−3
@@ -6570,6 +6570,15 @@ static void task_dead_fair(struct task_struct *p) · 6569 unmodified lines
65706570 {
65716571 remove_entity_load_avg(&p->se);
65726572 }
6573+
6574+static int
6575+balance_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
6576+{
6577+ if (rq->nr_running)
6578+ return 1;
6579+
6580+ return newidle_balance(rq, rf) != 0;
6581+}
65736582 #endif /* CONFIG_SMP */
65746583
65756584 static unsigned long wakeup_gran(struct sched_entity *se)
@@ -6746,7 +6755,7 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf · 170 unmodified lines
67466755 int new_tasks;
67476756
67486757 again:
6749− if (!cfs_rq->nr_running)
6758+ if (!sched_fair_runnable(rq))
67506759 goto idle;
67516760
67526761 #ifdef CONFIG_FAIR_GROUP_SCHED
@@ -6884,7 +6893,7 @@ idle: · 131 unmodified lines
68846893 /*
68856894 * Account for a descheduled task:
68866895 */
6887−static void put_prev_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
6896+static void put_prev_task_fair(struct rq *rq, struct task_struct *prev)
68886897 {
68896898 struct sched_entity *se = &prev->se;
68906899 struct cfs_rq *cfs_rq;
@@ -10414,11 +10423,11 @@ const struct sched_class fair_sched_class = { · 3523 unmodified lines
1041410423 .check_preempt_curr = check_preempt_wakeup,
1041510424
1041610425 .pick_next_task = pick_next_task_fair,
10417−
1041810426 .put_prev_task = put_prev_task_fair,
1041910427 .set_next_task = set_next_task_fair,
1042010428
1042110429 #ifdef CONFIG_SMP
10430+ .balance = balance_fair,
1042210431 .select_task_rq = select_task_rq_fair,
1042310432 .migrate_task_rq = migrate_task_rq_fair,
1042410433
kernel/sched/idle.c+8−1
@@ -365,6 +365,12 @@ select_task_rq_idle(struct task_struct *p, int cpu, int sd_flag, int flags) · 364 unmodified lines
365365 {
366366 return task_cpu(p); /* IDLE tasks as never migrated */
367367 }
368+
369+static int
370+balance_idle(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
371+{
372+ return WARN_ON_ONCE(1);
373+}
368374 #endif
369375
370376 /*
@@ -375,7 +381,7 @@ static void check_preempt_curr_idle(struct rq *rq, struct task_struct *p, int fl · 4 unmodified lines
375381 resched_curr(rq);
376382 }
377383
378−static void put_prev_task_idle(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
384+static void put_prev_task_idle(struct rq *rq, struct task_struct *prev)
379385 {
380386 }
381387
@@ -460,6 +466,7 @@ const struct sched_class idle_sched_class = { · 78 unmodified lines
460466 .set_next_task = set_next_task_idle,
461467
462468 #ifdef CONFIG_SMP
469+ .balance = balance_idle,
463470 .select_task_rq = select_task_rq_idle,
464471 .set_cpus_allowed = set_cpus_allowed_common,
465472 #endif
kernel/sched/rt.c+19−18
@@ -1469,6 +1469,22 @@ static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p) · 1468 unmodified lines
14691469 resched_curr(rq);
14701470 }
14711471
1472+static int balance_rt(struct rq *rq, struct task_struct *p, struct rq_flags *rf)
1473+{
1474+ if (!on_rt_rq(&p->rt) && need_pull_rt_task(rq, p)) {
1475+ /*
1476+ * This is OK, because current is on_cpu, which avoids it being
1477+ * picked for load-balance and preemption/IRQs are still
1478+ * disabled avoiding further scheduler activity on it and we've
1479+ * not yet started the picking loop.
1480+ */
1481+ rq_unpin_lock(rq, rf);
1482+ pull_rt_task(rq);
1483+ rq_repin_lock(rq, rf);
1484+ }
1485+
1486+ return sched_stop_runnable(rq) || sched_dl_runnable(rq) || sched_rt_runnable(rq);
1487+}
14721488 #endif /* CONFIG_SMP */
14731489
14741490 /*
@@ -1552,21 +1568,18 @@ static struct task_struct * · 77 unmodified lines
15521568 pick_next_task_rt(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
15531569 {
15541570 struct task_struct *p;
1555− struct rt_rq *rt_rq = &rq->rt;
15561571
15571572 WARN_ON_ONCE(prev || rf);
15581573
1559− if (!rt_rq->rt_queued)
1574+ if (!sched_rt_runnable(rq))
15601575 return NULL;
15611576
15621577 p = _pick_next_task_rt(rq);
1563−
15641578 set_next_task_rt(rq, p);
1565−
15661579 return p;
15671580 }
15681581
1569−static void put_prev_task_rt(struct rq *rq, struct task_struct *p, struct rq_flags *rf)
1582+static void put_prev_task_rt(struct rq *rq, struct task_struct *p)
15701583 {
15711584 update_curr_rt(rq);
15721585
@@ -1578,18 +1591,6 @@ static void put_prev_task_rt(struct rq *rq, struct task_struct *p, struct rq_fla · 5 unmodified lines
15781591 */
15791592 if (on_rt_rq(&p->rt) && p->nr_cpus_allowed > 1)
15801593 enqueue_pushable_task(rq, p);
1581−
1582− if (rf && !on_rt_rq(&p->rt) && need_pull_rt_task(rq, p)) {
1583− /*
1584− * This is OK, because current is on_cpu, which avoids it being
1585− * picked for load-balance and preemption/IRQs are still
1586− * disabled avoiding further scheduler activity on it and we've
1587− * not yet started the picking loop.
1588− */
1589− rq_unpin_lock(rq, rf);
1590− pull_rt_task(rq);
1591− rq_repin_lock(rq, rf);
1592− }
15931594 }
15941595
15951596 #ifdef CONFIG_SMP
@@ -2366,8 +2367,8 @@ const struct sched_class rt_sched_class = { · 770 unmodified lines
23662367 .set_next_task = set_next_task_rt,
23672368
23682369 #ifdef CONFIG_SMP
2370+ .balance = balance_rt,
23692371 .select_task_rq = select_task_rq_rt,
2370−
23712372 .set_cpus_allowed = set_cpus_allowed_common,
23722373 .rq_online = rq_online_rt,
23732374 .rq_offline = rq_offline_rt,
kernel/sched/sched.h+27−3
@@ -1727,10 +1727,11 @@ struct sched_class { · 1726 unmodified lines
17271727 struct task_struct * (*pick_next_task)(struct rq *rq,
17281728 struct task_struct *prev,
17291729 struct rq_flags *rf);
1730− void (*put_prev_task)(struct rq *rq, struct task_struct *p, struct rq_flags *rf);
1730+ void (*put_prev_task)(struct rq *rq, struct task_struct *p);
17311731 void (*set_next_task)(struct rq *rq, struct task_struct *p);
17321732
17331733 #ifdef CONFIG_SMP
1734+ int (*balance)(struct rq *rq, struct task_struct *prev, struct rq_flags *rf);
17341735 int (*select_task_rq)(struct task_struct *p, int task_cpu, int sd_flag, int flags);
17351736 void (*migrate_task_rq)(struct task_struct *p, int new_cpu);
17361737
@@ -1773,7 +1774,7 @@ struct sched_class { · 36 unmodified lines
17731774 static inline void put_prev_task(struct rq *rq, struct task_struct *prev)
17741775 {
17751776 WARN_ON_ONCE(rq->curr != prev);
1776− prev->sched_class->put_prev_task(rq, prev, NULL);
1777+ prev->sched_class->put_prev_task(rq, prev);
17771778 }
17781779
17791780 static inline void set_next_task(struct rq *rq, struct task_struct *next)
@@ -1787,8 +1788,12 @@ static inline void set_next_task(struct rq *rq, struct task_struct *next) · 7 unmodified lines
17871788 #else
17881789 #define sched_class_highest (&dl_sched_class)
17891790 #endif
1791+
1792+#define for_class_range(class, _from, _to) \
1793+ for (class = (_from); class != (_to); class = class->next)
1794+
17901795 #define for_each_class(class) \
1791− for (class = sched_class_highest; class; class = class->next)
1796+ for_class_range(class, sched_class_highest, NULL)
17921797
17931798 extern const struct sched_class stop_sched_class;
17941799 extern const struct sched_class dl_sched_class;
@@ -1796,6 +1801,25 @@ extern const struct sched_class rt_sched_class; · 1 unmodified line
17961801 extern const struct sched_class fair_sched_class;
17971802 extern const struct sched_class idle_sched_class;
17981803
1804+static inline bool sched_stop_runnable(struct rq *rq)
1805+{
1806+ return rq->stop && task_on_rq_queued(rq->stop);
1807+}
1808+
1809+static inline bool sched_dl_runnable(struct rq *rq)
1810+{
1811+ return rq->dl.dl_nr_running > 0;
1812+}
1813+
1814+static inline bool sched_rt_runnable(struct rq *rq)
1815+{
1816+ return rq->rt.rt_queued > 0;
1817+}
1818+
1819+static inline bool sched_fair_runnable(struct rq *rq)
1820+{
1821+ return rq->cfs.nr_running > 0;
1822+}
17991823
18001824 #ifdef CONFIG_SMP
18011825
kernel/sched/stop_task.c+11−7
@@ -15,6 +15,12 @@ select_task_rq_stop(struct task_struct *p, int cpu, int sd_flag, int flags) · 14 unmodified lines
1515 {
1616 return task_cpu(p); /* stop tasks as never migrate */
1717 }
18+
19+static int
20+balance_stop(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
21+{
22+ return sched_stop_runnable(rq);
23+}
1824 #endif /* CONFIG_SMP */
1925
2026 static void
@@ -31,16 +37,13 @@ static void set_next_task_stop(struct rq *rq, struct task_struct *stop) · 10 unmodified lines
3137 static struct task_struct *
3238 pick_next_task_stop(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
3339 {
34− struct task_struct *stop = rq->stop;
35−
3640 WARN_ON_ONCE(prev || rf);
3741
38− if (!stop || !task_on_rq_queued(stop))
42+ if (!sched_stop_runnable(rq))
3943 return NULL;
4044
41− set_next_task_stop(rq, stop);
42−
43− return stop;
45+ set_next_task_stop(rq, rq->stop);
46+ return rq->stop;
4447 }
4548
4649 static void
@@ -60,7 +63,7 @@ static void yield_task_stop(struct rq *rq) · 13 unmodified lines
6063 BUG(); /* the stop task should never yield, its pointless. */
6164 }
6265
63−static void put_prev_task_stop(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
66+static void put_prev_task_stop(struct rq *rq, struct task_struct *prev)
6467 {
6568 struct task_struct *curr = rq->curr;
6669 u64 delta_exec;
@@ -129,6 +132,7 @@ const struct sched_class stop_sched_class = { · 62 unmodified lines
129132 .set_next_task = set_next_task_stop,
130133
131134 #ifdef CONFIG_SMP
135+ .balance = balance_stop,
132136 .select_task_rq = select_task_rq_stop,
133137 .set_cpus_allowed = set_cpus_allowed_common,
134138 #endif
kernel/sched/topology.c+9−2
@@ -1948,7 +1948,7 @@ next_level: · 1947 unmodified lines
19481948 static int
19491949 build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *attr)
19501950 {
1951− enum s_alloc alloc_state;
1951+ enum s_alloc alloc_state = sa_none;
19521952 struct sched_domain *sd;
19531953 struct s_data d;
19541954 struct rq *rq = NULL;
@@ -1956,6 +1956,9 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att · 1 unmodified line
19561956 struct sched_domain_topology_level *tl_asym;
19571957 bool has_asym = false;
19581958
1959+ if (WARN_ON(cpumask_empty(cpu_map)))
1960+ goto error;
1961+
19591962 alloc_state = __visit_domain_allocation_hell(&d, cpu_map);
19601963 if (alloc_state != sa_rootdomain)
19611964 goto error;
@@ -2026,7 +2029,7 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att · 64 unmodified lines
20262029 rcu_read_unlock();
20272030
20282031 if (has_asym)
2029− static_branch_enable_cpuslocked(&sched_asym_cpucapacity);
2032+ static_branch_inc_cpuslocked(&sched_asym_cpucapacity);
20302033
20312034 if (rq && sched_debug_enabled) {
20322035 pr_info("root domain span: %*pbl (max cpu_capacity = %lu)\n",
@@ -2121,8 +2124,12 @@ int sched_init_domains(const struct cpumask *cpu_map) · 88 unmodified lines
21212124 */
21222125 static void detach_destroy_domains(const struct cpumask *cpu_map)
21232126 {
2127+ unsigned int cpu = cpumask_any(cpu_map);
21242128 int i;
21252129
2130+ if (rcu_access_pointer(per_cpu(sd_asym_cpucapacity, cpu)))
2131+ static_branch_dec_cpuslocked(&sched_asym_cpucapacity);
2132+
21262133 rcu_read_lock();
21272134 for_each_cpu(i, cpu_map)
21282135 cpu_attach_domain(NULL, &def_root_domain, i);
kernel/stacktrace.c+4−2
@@ -141,7 +141,8 @@ unsigned int stack_trace_save_tsk(struct task_struct *tsk, unsigned long *store, · 140 unmodified lines
141141 struct stacktrace_cookie c = {
142142 .store = store,
143143 .size = size,
144− .skip = skipnr + 1,
144+ /* skip this function if they are tracing us */
145+ .skip = skipnr + !!(current == tsk),
145146 };
146147
147148 if (!try_get_task_stack(tsk))
@@ -298,7 +299,8 @@ unsigned int stack_trace_save_tsk(struct task_struct *task, · 150 unmodified lines
298299 struct stack_trace trace = {
299300 .entries = store,
300301 .max_entries = size,
301− .skip = skipnr + 1,
302+ /* skip this function if they are tracing us */
303+ .skip = skipnr + !!(current == task),
302304 };
303305
304306 save_stack_trace_tsk(task, &trace);
kernel/time/vsyscall.c+3−6
@@ -110,8 +110,7 @@ void update_vsyscall(struct timekeeper *tk) · 109 unmodified lines
110110 nsec = nsec + tk->wall_to_monotonic.tv_nsec;
111111 vdso_ts->sec += __iter_div_u64_rem(nsec, NSEC_PER_SEC, &vdso_ts->nsec);
112112
113− if (__arch_use_vsyscall(vdata))
114− update_vdso_data(vdata, tk);
113+ update_vdso_data(vdata, tk);
115114
116115 __arch_update_vsyscall(vdata, tk);
117116
@@ -124,10 +123,8 @@ void update_vsyscall_tz(void) · 6 unmodified lines
124123 {
125124 struct vdso_data *vdata = __arch_get_k_vdso_data();
126125
127− if (__arch_use_vsyscall(vdata)) {
128− vdata[CS_HRES_COARSE].tz_minuteswest = sys_tz.tz_minuteswest;
129− vdata[CS_HRES_COARSE].tz_dsttime = sys_tz.tz_dsttime;
130− }
126+ vdata[CS_HRES_COARSE].tz_minuteswest = sys_tz.tz_minuteswest;
127+ vdata[CS_HRES_COARSE].tz_dsttime = sys_tz.tz_dsttime;
131128
132129 __arch_sync_vdso_data(vdata);
133130 }
lib/Kconfig+0−1
@@ -447,7 +447,6 @@ config ASSOCIATIVE_ARRAY · 446 unmodified lines
447447 config HAS_IOMEM
448448 bool
449449 depends on !NO_IOMEM
450− select GENERIC_IO
451450 default y
452451
453452 config HAS_IOPORT_MAP
lib/dump_stack.c+6−1
@@ -106,7 +106,12 @@ retry: · 105 unmodified lines
106106 was_locked = 1;
107107 } else {
108108 local_irq_restore(flags);
109− cpu_relax();
109+ /*
110+ * Wait for the lock to release before jumping to
111+ * atomic_cmpxchg() in order to mitigate the thundering herd
112+ * problem.
113+ */
114+ do { cpu_relax(); } while (atomic_read(&dump_lock) != -1);
110115 goto retry;
111116 }
112117
lib/idr.c+11−20
@@ -215,7 +215,7 @@ int idr_for_each(const struct idr *idr, · 214 unmodified lines
215215 EXPORT_SYMBOL(idr_for_each);
216216
217217 /**
218− * idr_get_next() - Find next populated entry.
218+ * idr_get_next_ul() - Find next populated entry.
219219 * @idr: IDR handle.
220220 * @nextid: Pointer to an ID.
221221 *
@@ -224,7 +224,7 @@ EXPORT_SYMBOL(idr_for_each); · 2 unmodified lines
224224 * to the ID of the found value. To use in a loop, the value pointed to by
225225 * nextid must be incremented by the user.
226226 */
227−void *idr_get_next(struct idr *idr, int *nextid)
227+void *idr_get_next_ul(struct idr *idr, unsigned long *nextid)
228228 {
229229 struct radix_tree_iter iter;
230230 void __rcu **slot;
@@ -245,18 +245,14 @@ void *idr_get_next(struct idr *idr, int *nextid) · 14 unmodified lines
245245 }
246246 if (!slot)
247247 return NULL;
248− id = iter.index + base;
249−
250− if (WARN_ON_ONCE(id > INT_MAX))
251− return NULL;
252248
253− *nextid = id;
249+ *nextid = iter.index + base;
254250 return entry;
255251 }
256−EXPORT_SYMBOL(idr_get_next);
252+EXPORT_SYMBOL(idr_get_next_ul);
257253
258254 /**
259− * idr_get_next_ul() - Find next populated entry.
255+ * idr_get_next() - Find next populated entry.
260256 * @idr: IDR handle.
261257 * @nextid: Pointer to an ID.
262258 *
@@ -265,22 +261,17 @@ EXPORT_SYMBOL(idr_get_next); · 2 unmodified lines
265261 * to the ID of the found value. To use in a loop, the value pointed to by
266262 * nextid must be incremented by the user.
267263 */
268−void *idr_get_next_ul(struct idr *idr, unsigned long *nextid)
264+void *idr_get_next(struct idr *idr, int *nextid)
269265 {
270− struct radix_tree_iter iter;
271− void __rcu **slot;
272− unsigned long base = idr->idr_base;
273266 unsigned long id = *nextid;
267+ void *entry = idr_get_next_ul(idr, &id);
274268
275− id = (id < base) ? 0 : id - base;
276− slot = radix_tree_iter_find(&idr->idr_rt, &iter, id);
277− if (!slot)
269+ if (WARN_ON_ONCE(id > INT_MAX))
278270 return NULL;
279−
280− *nextid = iter.index + base;
281− return rcu_dereference_raw(*slot);
271+ *nextid = id;
272+ return entry;
282273 }
283−EXPORT_SYMBOL(idr_get_next_ul);
274+EXPORT_SYMBOL(idr_get_next);
284275
285276 /**
286277 * idr_replace() - replace pointer for given ID.
lib/radix-tree.c+1−1
@@ -1529,7 +1529,7 @@ void __rcu **idr_get_free(struct radix_tree_root *root, · 1528 unmodified lines
15291529 offset = radix_tree_find_next_bit(node, IDR_FREE,
15301530 offset + 1);
15311531 start = next_index(start, node, offset);
1532− if (start > max)
1532+ if (start > max || start == 0)
15331533 return ERR_PTR(-ENOSPC);
15341534 while (offset == RADIX_TREE_MAP_SIZE) {
15351535 offset = node->offset + 1;
lib/test_xarray.c+24−0
@@ -1110,6 +1110,28 @@ static noinline void check_find_entry(struct xarray *xa) · 1109 unmodified lines
11101110 XA_BUG_ON(xa, !xa_empty(xa));
11111111 }
11121112
1113+static noinline void check_move_tiny(struct xarray *xa)
1114+{
1115+ XA_STATE(xas, xa, 0);
1116+
1117+ XA_BUG_ON(xa, !xa_empty(xa));
1118+ rcu_read_lock();
1119+ XA_BUG_ON(xa, xas_next(&xas) != NULL);
1120+ XA_BUG_ON(xa, xas_next(&xas) != NULL);
1121+ rcu_read_unlock();
1122+ xa_store_index(xa, 0, GFP_KERNEL);
1123+ rcu_read_lock();
1124+ xas_set(&xas, 0);
1125+ XA_BUG_ON(xa, xas_next(&xas) != xa_mk_index(0));
1126+ XA_BUG_ON(xa, xas_next(&xas) != NULL);
1127+ xas_set(&xas, 0);
1128+ XA_BUG_ON(xa, xas_prev(&xas) != xa_mk_index(0));
1129+ XA_BUG_ON(xa, xas_prev(&xas) != NULL);
1130+ rcu_read_unlock();
1131+ xa_erase_index(xa, 0);
1132+ XA_BUG_ON(xa, !xa_empty(xa));
1133+}
1134+
11131135 static noinline void check_move_small(struct xarray *xa, unsigned long idx)
11141136 {
11151137 XA_STATE(xas, xa, 0);
@@ -1217,6 +1239,8 @@ static noinline void check_move(struct xarray *xa) · 101 unmodified lines
12171239
12181240 xa_destroy(xa);
12191241
1242+ check_move_tiny(xa);
1243+
12201244 for (i = 0; i < 16; i++)
12211245 check_move_small(xa, 1UL << i);
12221246
lib/xarray.c+4−0
@@ -994,6 +994,8 @@ void *__xas_prev(struct xa_state *xas) · 993 unmodified lines
994994
995995 if (!xas_frozen(xas->xa_node))
996996 xas->xa_index--;
997+ if (!xas->xa_node)
998+ return set_bounds(xas);
997999 if (xas_not_node(xas->xa_node))
9981000 return xas_load(xas);
9991001
@@ -1031,6 +1033,8 @@ void *__xas_next(struct xa_state *xas) · 31 unmodified lines
10311033
10321034 if (!xas_frozen(xas->xa_node))
10331035 xas->xa_index++;
1036+ if (!xas->xa_node)
1037+ return set_bounds(xas);
10341038 if (xas_not_node(xas->xa_node))
10351039 return xas_load(xas);
10361040
mm/khugepaged.c+4−3
@@ -1028,12 +1028,13 @@ static void collapse_huge_page(struct mm_struct *mm, · 1027 unmodified lines
10281028
10291029 anon_vma_lock_write(vma->anon_vma);
10301030
1031− pte = pte_offset_map(pmd, address);
1032− pte_ptl = pte_lockptr(mm, pmd);
1033−
10341031 mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, NULL, mm,
10351032 address, address + HPAGE_PMD_SIZE);
10361033 mmu_notifier_invalidate_range_start(&range);
1034+
1035+ pte = pte_offset_map(pmd, address);
1036+ pte_ptl = pte_lockptr(mm, pmd);
1037+
10371038 pmd_ptl = pmd_lock(mm, pmd); /* probably unnecessary */
10381039 /*
10391040 * After this gup_fast can't run anymore. This also removes
mm/memcontrol.c+16−7
@@ -484,7 +484,7 @@ ino_t page_cgroup_ino(struct page *page) · 483 unmodified lines
484484 unsigned long ino = 0;
485485
486486 rcu_read_lock();
487− if (PageHead(page) && PageSlab(page))
487+ if (PageSlab(page) && !PageTail(page))
488488 memcg = memcg_from_slab_page(page);
489489 else
490490 memcg = READ_ONCE(page->mem_cgroup);
@@ -2534,6 +2534,15 @@ retry: · 2043 unmodified lines
25342534 goto retry;
25352535 }
25362536
2537+ /*
2538+ * Memcg doesn't have a dedicated reserve for atomic
2539+ * allocations. But like the global atomic pool, we need to
2540+ * put the burden of reclaim on regular allocation requests
2541+ * and let these go through as privileged allocations.
2542+ */
2543+ if (gfp_mask & __GFP_ATOMIC)
2544+ goto force;
2545+
25372546 /*
25382547 * Unlike in global OOM situations, memcg is not in a physical
25392548 * memory shortage. Allow dying and OOM-killed tasks to
@@ -5014,12 +5023,6 @@ static void __mem_cgroup_free(struct mem_cgroup *memcg) · 2474 unmodified lines
50145023 {
50155024 int node;
50165025
5017− /*
5018− * Flush percpu vmstats and vmevents to guarantee the value correctness
5019− * on parent's and all ancestor levels.
5020− */
5021− memcg_flush_percpu_vmstats(memcg, false);
5022− memcg_flush_percpu_vmevents(memcg);
50235026 for_each_node(node)
50245027 free_mem_cgroup_per_node_info(memcg, node);
50255028 free_percpu(memcg->vmstats_percpu);
@@ -5030,6 +5033,12 @@ static void __mem_cgroup_free(struct mem_cgroup *memcg) · 4 unmodified lines
50305033 static void mem_cgroup_free(struct mem_cgroup *memcg)
50315034 {
50325035 memcg_wb_domain_exit(memcg);
5036+ /*
5037+ * Flush percpu vmstats and vmevents to guarantee the value correctness
5038+ * on parent's and all ancestor levels.
5039+ */
5040+ memcg_flush_percpu_vmstats(memcg, false);
5041+ memcg_flush_percpu_vmevents(memcg);
50335042 __mem_cgroup_free(memcg);
50345043 }
50355044
mm/memory_hotplug.c+8−0
@@ -447,6 +447,14 @@ static void update_pgdat_span(struct pglist_data *pgdat) · 446 unmodified lines
447447 zone->spanned_pages;
448448
449449 /* No need to lock the zones, they can't change. */
450+ if (!zone->spanned_pages)
451+ continue;
452+ if (!node_end_pfn) {
453+ node_start_pfn = zone->zone_start_pfn;
454+ node_end_pfn = zone_end_pfn;
455+ continue;
456+ }
457+
450458 if (zone_end_pfn > node_end_pfn)
451459 node_end_pfn = zone_end_pfn;
452460 if (zone->zone_start_pfn < node_start_pfn)
mm/mmu_notifier.c+1−1
@@ -180,7 +180,7 @@ int __mmu_notifier_invalidate_range_start(struct mmu_notifier_range *range) · 179 unmodified lines
180180 mn->ops->invalidate_range_start, _ret,
181181 !mmu_notifier_range_blockable(range) ? "non-" : "");
182182 WARN_ON(mmu_notifier_range_blockable(range) ||
183− ret != -EAGAIN);
183+ _ret != -EAGAIN);
184184 ret = _ret;
185185 }
186186 }
mm/page_alloc.c+9−8
@@ -1947,6 +1947,14 @@ void __init page_alloc_init_late(void) · 1946 unmodified lines
19471947 /* Block until all are initialised */
19481948 wait_for_completion(&pgdat_init_all_done_comp);
19491949
1950+ /*
1951+ * The number of managed pages has changed due to the initialisation
1952+ * so the pcpu batch and high limits needs to be updated or the limits
1953+ * will be artificially small.
1954+ */
1955+ for_each_populated_zone(zone)
1956+ zone_pcp_update(zone);
1957+
19501958 /*
19511959 * We initialized the rest of the deferred pages. Permanently disable
19521960 * on-demand struct page initialization.
@@ -3720,10 +3728,6 @@ try_this_zone: · 1767 unmodified lines
37203728 static void warn_alloc_show_mem(gfp_t gfp_mask, nodemask_t *nodemask)
37213729 {
37223730 unsigned int filter = SHOW_MEM_FILTER_NODES;
3723− static DEFINE_RATELIMIT_STATE(show_mem_rs, HZ, 1);
3724−
3725− if (!__ratelimit(&show_mem_rs))
3726− return;
37273731
37283732 /*
37293733 * This documents exceptions given to allocations in certain
@@ -3744,8 +3748,7 @@ void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...) · 14 unmodified lines
37443748 {
37453749 struct va_format vaf;
37463750 va_list args;
3747− static DEFINE_RATELIMIT_STATE(nopage_rs, DEFAULT_RATELIMIT_INTERVAL,
3748− DEFAULT_RATELIMIT_BURST);
3751+ static DEFINE_RATELIMIT_STATE(nopage_rs, 10*HZ, 1);
37493752
37503753 if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs))
37513754 return;
@@ -8514,7 +8517,6 @@ void free_contig_range(unsigned long pfn, unsigned int nr_pages) · 4762 unmodified lines
85148517 WARN(count != 0, "%d pages are still in use!\n", count);
85158518 }
85168519
8517−#ifdef CONFIG_MEMORY_HOTPLUG
85188520 /*
85198521 * The zone indicated has a new number of managed_pages; batch sizes and percpu
85208522 * page high values need to be recalulated.
@@ -8528,7 +8530,6 @@ void __meminit zone_pcp_update(struct zone *zone) · 7 unmodified lines
85288530 per_cpu_ptr(zone->pageset, cpu));
85298531 mutex_unlock(&pcp_batch_high_lock);
85308532 }
8531−#endif
85328533
85338534 void zone_pcp_reset(struct zone *zone)
85348535 {
mm/slab.h+2−2
@@ -323,8 +323,8 @@ static inline struct kmem_cache *memcg_root_cache(struct kmem_cache *s) · 322 unmodified lines
323323 * Expects a pointer to a slab page. Please note, that PageSlab() check
324324 * isn't sufficient, as it returns true also for tail compound slab pages,
325325 * which do not have slab_cache pointer set.
326− * So this function assumes that the page can pass PageHead() and PageSlab()
327− * checks.
326+ * So this function assumes that the page can pass PageSlab() && !PageTail()
327+ * check.
328328 *
329329 * The kmem_cache can be reparented asynchronously. The caller must ensure
330330 * the memcg lifetime, e.g. by taking rcu_read_lock() or cgroup_mutex.
mm/vmstat.c+21−4
@@ -1383,12 +1383,29 @@ static void pagetypeinfo_showfree_print(struct seq_file *m, · 1382 unmodified lines
13831383 unsigned long freecount = 0;
13841384 struct free_area *area;
13851385 struct list_head *curr;
1386+ bool overflow = false;
13861387
13871388 area = &(zone->free_area[order]);
13881389
1389− list_for_each(curr, &area->free_list[mtype])
1390− freecount++;
1391− seq_printf(m, "%6lu ", freecount);
1390+ list_for_each(curr, &area->free_list[mtype]) {
1391+ /*
1392+ * Cap the free_list iteration because it might
1393+ * be really large and we are under a spinlock
1394+ * so a long time spent here could trigger a
1395+ * hard lockup detector. Anyway this is a
1396+ * debugging tool so knowing there is a handful
1397+ * of pages of this order should be more than
1398+ * sufficient.
1399+ */
1400+ if (++freecount >= 100000) {
1401+ overflow = true;
1402+ break;
1403+ }
1404+ }
1405+ seq_printf(m, "%s%6lu ", overflow ? ">" : "", freecount);
1406+ spin_unlock_irq(&zone->lock);
1407+ cond_resched();
1408+ spin_lock_irq(&zone->lock);
13921409 }
13931410 seq_putc(m, '\n');
13941411 }
@@ -1972,7 +1989,7 @@ void __init init_mm_internals(void) · 577 unmodified lines
19721989 #endif
19731990 #ifdef CONFIG_PROC_FS
19741991 proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op);
1975− proc_create_seq("pagetypeinfo", 0444, NULL, &pagetypeinfo_op);
1992+ proc_create_seq("pagetypeinfo", 0400, NULL, &pagetypeinfo_op);
19761993 proc_create_seq("vmstat", 0444, NULL, &vmstat_op);
19771994 proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op);
19781995 #endif
net/8021q/vlan.c+0−1
@@ -172,7 +172,6 @@ int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack) · 171 unmodified lines
172172 if (err < 0)
173173 goto out_uninit_mvrp;
174174
175− vlan->nest_level = dev_get_nest_level(real_dev) + 1;
176175 err = register_netdevice(dev);
177176 if (err < 0)
178177 goto out_uninit_mvrp;
net/8021q/vlan_dev.c+0−33
@@ -489,36 +489,6 @@ static void vlan_dev_set_rx_mode(struct net_device *vlan_dev) · 488 unmodified lines
489489 dev_uc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev);
490490 }
491491
492−/*
493− * vlan network devices have devices nesting below it, and are a special
494− * "super class" of normal network devices; split their locks off into a
495− * separate class since they always nest.
496− */
497−static struct lock_class_key vlan_netdev_xmit_lock_key;
498−static struct lock_class_key vlan_netdev_addr_lock_key;
499−
500−static void vlan_dev_set_lockdep_one(struct net_device *dev,
501− struct netdev_queue *txq,
502− void *_subclass)
503−{
504− lockdep_set_class_and_subclass(&txq->_xmit_lock,
505− &vlan_netdev_xmit_lock_key,
506− *(int *)_subclass);
507−}
508−
509−static void vlan_dev_set_lockdep_class(struct net_device *dev, int subclass)
510−{
511− lockdep_set_class_and_subclass(&dev->addr_list_lock,
512− &vlan_netdev_addr_lock_key,
513− subclass);
514− netdev_for_each_tx_queue(dev, vlan_dev_set_lockdep_one, &subclass);
515−}
516−
517−static int vlan_dev_get_lock_subclass(struct net_device *dev)
518−{
519− return vlan_dev_priv(dev)->nest_level;
520−}
521−
522492 static const struct header_ops vlan_header_ops = {
523493 .create = vlan_dev_hard_header,
524494 .parse = eth_header_parse,
@@ -609,8 +579,6 @@ static int vlan_dev_init(struct net_device *dev) · 84 unmodified lines
609579
610580 SET_NETDEV_DEVTYPE(dev, &vlan_type);
611581
612− vlan_dev_set_lockdep_class(dev, vlan_dev_get_lock_subclass(dev));
613−
614582 vlan->vlan_pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats);
615583 if (!vlan->vlan_pcpu_stats)
616584 return -ENOMEM;
@@ -812,7 +780,6 @@ static const struct net_device_ops vlan_netdev_ops = { · 195 unmodified lines
812780 .ndo_netpoll_cleanup = vlan_dev_netpoll_cleanup,
813781 #endif
814782 .ndo_fix_features = vlan_dev_fix_features,
815− .ndo_get_lock_subclass = vlan_dev_get_lock_subclass,
816783 .ndo_get_iflink = vlan_dev_get_iflink,
817784 };
818785
net/atm/common.c+1−1
@@ -668,7 +668,7 @@ __poll_t vcc_poll(struct file *file, struct socket *sock, poll_table *wait) · 667 unmodified lines
668668 mask |= EPOLLHUP;
669669
670670 /* readable? */
671− if (!skb_queue_empty(&sk->sk_receive_queue))
671+ if (!skb_queue_empty_lockless(&sk->sk_receive_queue))
672672 mask |= EPOLLIN | EPOLLRDNORM;
673673
674674 /* writable? */
net/batman-adv/bat_iv_ogm.c+52−9
@@ -22,6 +22,8 @@ · 21 unmodified lines
2222 #include <linux/kernel.h>
2323 #include <linux/kref.h>
2424 #include <linux/list.h>
25+#include <linux/lockdep.h>
26+#include <linux/mutex.h>
2527 #include <linux/netdevice.h>
2628 #include <linux/netlink.h>
2729 #include <linux/pkt_sched.h>
@@ -193,14 +195,18 @@ static int batadv_iv_ogm_iface_enable(struct batadv_hard_iface *hard_iface) · 165 unmodified lines
193195 unsigned char *ogm_buff;
194196 u32 random_seqno;
195197
198+ mutex_lock(&hard_iface->bat_iv.ogm_buff_mutex);
199+
196200 /* randomize initial seqno to avoid collision */
197201 get_random_bytes(&random_seqno, sizeof(random_seqno));
198202 atomic_set(&hard_iface->bat_iv.ogm_seqno, random_seqno);
199203
200204 hard_iface->bat_iv.ogm_buff_len = BATADV_OGM_HLEN;
201205 ogm_buff = kmalloc(hard_iface->bat_iv.ogm_buff_len, GFP_ATOMIC);
202− if (!ogm_buff)
206+ if (!ogm_buff) {
207+ mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex);
203208 return -ENOMEM;
209+ }
204210
205211 hard_iface->bat_iv.ogm_buff = ogm_buff;
206212
@@ -212,35 +218,59 @@ static int batadv_iv_ogm_iface_enable(struct batadv_hard_iface *hard_iface) · 5 unmodified lines
212218 batadv_ogm_packet->reserved = 0;
213219 batadv_ogm_packet->tq = BATADV_TQ_MAX_VALUE;
214220
221+ mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex);
222+
215223 return 0;
216224 }
217225
218226 static void batadv_iv_ogm_iface_disable(struct batadv_hard_iface *hard_iface)
219227 {
228+ mutex_lock(&hard_iface->bat_iv.ogm_buff_mutex);
229+
220230 kfree(hard_iface->bat_iv.ogm_buff);
221231 hard_iface->bat_iv.ogm_buff = NULL;
232+
233+ mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex);
222234 }
223235
224236 static void batadv_iv_ogm_iface_update_mac(struct batadv_hard_iface *hard_iface)
225237 {
226238 struct batadv_ogm_packet *batadv_ogm_packet;
227− unsigned char *ogm_buff = hard_iface->bat_iv.ogm_buff;
239+ void *ogm_buff;
228240
229− batadv_ogm_packet = (struct batadv_ogm_packet *)ogm_buff;
241+ mutex_lock(&hard_iface->bat_iv.ogm_buff_mutex);
242+
243+ ogm_buff = hard_iface->bat_iv.ogm_buff;
244+ if (!ogm_buff)
245+ goto unlock;
246+
247+ batadv_ogm_packet = ogm_buff;
230248 ether_addr_copy(batadv_ogm_packet->orig,
231249 hard_iface->net_dev->dev_addr);
232250 ether_addr_copy(batadv_ogm_packet->prev_sender,
233251 hard_iface->net_dev->dev_addr);
252+
253+unlock:
254+ mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex);
234255 }
235256
236257 static void
237258 batadv_iv_ogm_primary_iface_set(struct batadv_hard_iface *hard_iface)
238259 {
239260 struct batadv_ogm_packet *batadv_ogm_packet;
240− unsigned char *ogm_buff = hard_iface->bat_iv.ogm_buff;
261+ void *ogm_buff;
241262
242− batadv_ogm_packet = (struct batadv_ogm_packet *)ogm_buff;
263+ mutex_lock(&hard_iface->bat_iv.ogm_buff_mutex);
264+
265+ ogm_buff = hard_iface->bat_iv.ogm_buff;
266+ if (!ogm_buff)
267+ goto unlock;
268+
269+ batadv_ogm_packet = ogm_buff;
243270 batadv_ogm_packet->ttl = BATADV_TTL;
271+
272+unlock:
273+ mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex);
244274 }
245275
246276 /* when do we schedule our own ogm to be sent */
@@ -742,7 +772,11 @@ batadv_iv_ogm_slide_own_bcast_window(struct batadv_hard_iface *hard_iface) · 495 unmodified lines
742772 }
743773 }
744774
745−static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface)
775+/**
776+ * batadv_iv_ogm_schedule_buff() - schedule submission of hardif ogm buffer
777+ * @hard_iface: interface whose ogm buffer should be transmitted
778+ */
779+static void batadv_iv_ogm_schedule_buff(struct batadv_hard_iface *hard_iface)
746780 {
747781 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
748782 unsigned char **ogm_buff = &hard_iface->bat_iv.ogm_buff;
@@ -753,9 +787,7 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) · 4 unmodified lines
753787 u16 tvlv_len = 0;
754788 unsigned long send_time;
755789
756− if (hard_iface->if_status == BATADV_IF_NOT_IN_USE ||
757− hard_iface->if_status == BATADV_IF_TO_BE_REMOVED)
758− return;
790+ lockdep_assert_held(&hard_iface->bat_iv.ogm_buff_mutex);
759791
760792 /* the interface gets activated here to avoid race conditions between
761793 * the moment of activating the interface in
@@ -823,6 +855,17 @@ out: · 61 unmodified lines
823855 batadv_hardif_put(primary_if);
824856 }
825857
858+static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface)
859+{
860+ if (hard_iface->if_status == BATADV_IF_NOT_IN_USE ||
861+ hard_iface->if_status == BATADV_IF_TO_BE_REMOVED)
862+ return;
863+
864+ mutex_lock(&hard_iface->bat_iv.ogm_buff_mutex);
865+ batadv_iv_ogm_schedule_buff(hard_iface);
866+ mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex);
867+}
868+
826869 /**
827870 * batadv_iv_orig_ifinfo_sum() - Get bcast_own sum for originator over iterface
828871 * @orig_node: originator which reproadcasted the OGMs directly
net/batman-adv/bat_v_ogm.c+33−8
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <linux/kref.h>
1919 #include <linux/list.h>
2020 #include <linux/lockdep.h>
21+#include <linux/mutex.h>
2122 #include <linux/netdevice.h>
2223 #include <linux/random.h>
2324 #include <linux/rculist.h>
@@ -256,14 +257,12 @@ static void batadv_v_ogm_queue_on_if(struct sk_buff *skb, · 232 unmodified lines
256257 }
257258
258259 /**
259− * batadv_v_ogm_send() - periodic worker broadcasting the own OGM
260− * @work: work queue item
260+ * batadv_v_ogm_send_softif() - periodic worker broadcasting the own OGM
261+ * @bat_priv: the bat priv with all the soft interface information
261262 */
262−static void batadv_v_ogm_send(struct work_struct *work)
263+static void batadv_v_ogm_send_softif(struct batadv_priv *bat_priv)
263264 {
264265 struct batadv_hard_iface *hard_iface;
265− struct batadv_priv_bat_v *bat_v;
266− struct batadv_priv *bat_priv;
267266 struct batadv_ogm2_packet *ogm_packet;
268267 struct sk_buff *skb, *skb_tmp;
269268 unsigned char *ogm_buff;
@@ -271,8 +270,7 @@ static void batadv_v_ogm_send(struct work_struct *work) · 1 unmodified line
271270 u16 tvlv_len = 0;
272271 int ret;
273272
274− bat_v = container_of(work, struct batadv_priv_bat_v, ogm_wq.work);
275− bat_priv = container_of(bat_v, struct batadv_priv, bat_v);
273+ lockdep_assert_held(&bat_priv->bat_v.ogm_buff_mutex);
276274
277275 if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_DEACTIVATING)
278276 goto out;
@@ -363,6 +361,23 @@ out: · 84 unmodified lines
363361 return;
364362 }
365363
364+/**
365+ * batadv_v_ogm_send() - periodic worker broadcasting the own OGM
366+ * @work: work queue item
367+ */
368+static void batadv_v_ogm_send(struct work_struct *work)
369+{
370+ struct batadv_priv_bat_v *bat_v;
371+ struct batadv_priv *bat_priv;
372+
373+ bat_v = container_of(work, struct batadv_priv_bat_v, ogm_wq.work);
374+ bat_priv = container_of(bat_v, struct batadv_priv, bat_v);
375+
376+ mutex_lock(&bat_priv->bat_v.ogm_buff_mutex);
377+ batadv_v_ogm_send_softif(bat_priv);
378+ mutex_unlock(&bat_priv->bat_v.ogm_buff_mutex);
379+}
380+
366381 /**
367382 * batadv_v_ogm_aggr_work() - OGM queue periodic task per interface
368383 * @work: work queue item
@@ -424,11 +439,15 @@ void batadv_v_ogm_primary_iface_set(struct batadv_hard_iface *primary_iface) · 55 unmodified lines
424439 struct batadv_priv *bat_priv = netdev_priv(primary_iface->soft_iface);
425440 struct batadv_ogm2_packet *ogm_packet;
426441
442+ mutex_lock(&bat_priv->bat_v.ogm_buff_mutex);
427443 if (!bat_priv->bat_v.ogm_buff)
428− return;
444+ goto unlock;
429445
430446 ogm_packet = (struct batadv_ogm2_packet *)bat_priv->bat_v.ogm_buff;
431447 ether_addr_copy(ogm_packet->orig, primary_iface->net_dev->dev_addr);
448+
449+unlock:
450+ mutex_unlock(&bat_priv->bat_v.ogm_buff_mutex);
432451 }
433452
434453 /**
@@ -1050,6 +1069,8 @@ int batadv_v_ogm_init(struct batadv_priv *bat_priv) · 615 unmodified lines
10501069 atomic_set(&bat_priv->bat_v.ogm_seqno, random_seqno);
10511070 INIT_DELAYED_WORK(&bat_priv->bat_v.ogm_wq, batadv_v_ogm_send);
10521071
1072+ mutex_init(&bat_priv->bat_v.ogm_buff_mutex);
1073+
10531074 return 0;
10541075 }
10551076
@@ -1061,7 +1082,11 @@ void batadv_v_ogm_free(struct batadv_priv *bat_priv) · 5 unmodified lines
10611082 {
10621083 cancel_delayed_work_sync(&bat_priv->bat_v.ogm_wq);
10631084
1085+ mutex_lock(&bat_priv->bat_v.ogm_buff_mutex);
1086+
10641087 kfree(bat_priv->bat_v.ogm_buff);
10651088 bat_priv->bat_v.ogm_buff = NULL;
10661089 bat_priv->bat_v.ogm_buff_len = 0;
1090+
1091+ mutex_unlock(&bat_priv->bat_v.ogm_buff_mutex);
10671092 }
net/batman-adv/hard-interface.c+2−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <linux/kref.h>
1919 #include <linux/limits.h>
2020 #include <linux/list.h>
21+#include <linux/mutex.h>
2122 #include <linux/netdevice.h>
2223 #include <linux/printk.h>
2324 #include <linux/rculist.h>
@@ -929,6 +930,7 @@ batadv_hardif_add_interface(struct net_device *net_dev) · 905 unmodified lines
929930 INIT_LIST_HEAD(&hard_iface->list);
930931 INIT_HLIST_HEAD(&hard_iface->neigh_list);
931932
933+ mutex_init(&hard_iface->bat_iv.ogm_buff_mutex);
932934 spin_lock_init(&hard_iface->neigh_list_lock);
933935 kref_init(&hard_iface->refcount);
934936
net/batman-adv/soft-interface.c+0−32
@@ -740,36 +740,6 @@ static int batadv_interface_kill_vid(struct net_device *dev, __be16 proto, · 739 unmodified lines
740740 return 0;
741741 }
742742
743−/* batman-adv network devices have devices nesting below it and are a special
744− * "super class" of normal network devices; split their locks off into a
745− * separate class since they always nest.
746− */
747−static struct lock_class_key batadv_netdev_xmit_lock_key;
748−static struct lock_class_key batadv_netdev_addr_lock_key;
749−
750−/**
751− * batadv_set_lockdep_class_one() - Set lockdep class for a single tx queue
752− * @dev: device which owns the tx queue
753− * @txq: tx queue to modify
754− * @_unused: always NULL
755− */
756−static void batadv_set_lockdep_class_one(struct net_device *dev,
757− struct netdev_queue *txq,
758− void *_unused)
759−{
760− lockdep_set_class(&txq->_xmit_lock, &batadv_netdev_xmit_lock_key);
761−}
762−
763−/**
764− * batadv_set_lockdep_class() - Set txq and addr_list lockdep class
765− * @dev: network device to modify
766− */
767−static void batadv_set_lockdep_class(struct net_device *dev)
768−{
769− lockdep_set_class(&dev->addr_list_lock, &batadv_netdev_addr_lock_key);
770− netdev_for_each_tx_queue(dev, batadv_set_lockdep_class_one, NULL);
771−}
772−
773743 /**
774744 * batadv_softif_init_late() - late stage initialization of soft interface
775745 * @dev: registered network device to modify
@@ -783,8 +753,6 @@ static int batadv_softif_init_late(struct net_device *dev) · 7 unmodified lines
783753 int ret;
784754 size_t cnt_len = sizeof(u64) * BATADV_CNT_NUM;
785755
786− batadv_set_lockdep_class(dev);
787−
788756 bat_priv = netdev_priv(dev);
789757 bat_priv->soft_iface = dev;
790758
net/batman-adv/types.h+7−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/if.h>
1818 #include <linux/if_ether.h>

25 more lines aren’t shown here.

net/bluetooth/6lowpan.c+0−8

This diff is large: its 16 lines aren’t shown here.

net/bluetooth/af_bluetooth.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/bridge/br_device.c+0−8

This diff is large: its 29 lines aren’t shown here.

net/bridge/netfilter/ebt_dnat.c+15−4

This diff is large: its 34 lines aren’t shown here.

net/bridge/netfilter/nf_conntrack_bridge.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/caif/caif_socket.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/can/j1939/socket.c+7−2

This diff is large: its 32 lines aren’t shown here.

net/can/j1939/transport.c+19−1

This diff is large: its 37 lines aren’t shown here.

net/core/datagram.c+4−4

This diff is large: its 36 lines aren’t shown here.

net/core/dev.c+467−156

This diff is large: its 827 lines aren’t shown here.

net/core/dev_addr_lists.c+6−6

This diff is large: its 54 lines aren’t shown here.

net/core/ethtool.c+3−1

This diff is large: its 15 lines aren’t shown here.

net/core/flow_dissector.c+16−22

This diff is large: its 105 lines aren’t shown here.

net/core/lwt_bpf.c+6−1

This diff is large: its 18 lines aren’t shown here.

net/core/net_namespace.c+10−8

This diff is large: its 77 lines aren’t shown here.

net/core/rtnetlink.c+9−8

This diff is large: its 80 lines aren’t shown here.

net/core/skmsg.c+15−5

This diff is large: its 34 lines aren’t shown here.

net/core/sock.c+3−3

This diff is large: its 27 lines aren’t shown here.

net/dccp/ipv4.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/decnet/af_decnet.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/dsa/master.c+0−5

This diff is large: its 19 lines aren’t shown here.

net/dsa/slave.c+0−12

This diff is large: its 26 lines aren’t shown here.

net/ieee802154/6lowpan/core.c+0−8

This diff is large: its 22 lines aren’t shown here.

net/ipv4/datagram.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/ipv4/fib_frontend.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/ipv4/fib_semantics.c+1−1

This diff is large: its 10 lines aren’t shown here.

net/ipv4/inet_hashtables.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/ipv4/ip_gre.c+2−2

This diff is large: its 12 lines aren’t shown here.

net/ipv4/ip_output.c+6−5

This diff is large: its 43 lines aren’t shown here.

net/ipv4/tcp.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/ipv4/tcp_ipv4.c+3−3

This diff is large: its 27 lines aren’t shown here.

net/ipv4/udp.c+20−9

This diff is large: its 78 lines aren’t shown here.

net/ipv6/addrconf_core.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/ipv6/inet6_hashtables.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/ipv6/ip6_gre.c+2−2

This diff is large: its 12 lines aren’t shown here.

net/ipv6/route.c+10−3

This diff is large: its 45 lines aren’t shown here.

net/ipv6/udp.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/l2tp/l2tp_eth.c+0−1

This diff is large: its 8 lines aren’t shown here.

net/mac80211/main.c+1−1

This diff is large: its 10 lines aren’t shown here.

net/mac80211/sta_info.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/netfilter/ipset/ip_set_core.c+33−16

This diff is large: its 133 lines aren’t shown here.

net/netfilter/ipset/ip_set_hash_ipmac.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/netfilter/ipset/ip_set_hash_net.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/netfilter/ipset/ip_set_hash_netnet.c+1−0

This diff is large: its 8 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_app.c+10−2

This diff is large: its 32 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_ctl.c+11−18

This diff is large: its 98 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_pe.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_sched.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/netfilter/ipvs/ip_vs_sync.c+10−3

This diff is large: its 39 lines aren’t shown here.

net/netfilter/nf_flow_table_core.c+2−1

This diff is large: its 17 lines aren’t shown here.

net/netfilter/nf_tables_api.c+3−4

This diff is large: its 28 lines aren’t shown here.

net/netfilter/nf_tables_offload.c+3−2

This diff is large: its 19 lines aren’t shown here.

net/netfilter/nft_bitwise.c+3−2

This diff is large: its 16 lines aren’t shown here.

net/netfilter/nft_cmp.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/netfilter/nft_payload.c+38−0

This diff is large: its 104 lines aren’t shown here.

net/netrom/af_netrom.c+0−23

This diff is large: its 37 lines aren’t shown here.

net/nfc/llcp_sock.c+2−2

This diff is large: its 14 lines aren’t shown here.

net/nfc/netlink.c+0−2

This diff is large: its 16 lines aren’t shown here.

net/openvswitch/datapath.c+11−9

This diff is large: its 79 lines aren’t shown here.

net/openvswitch/vport-internal_dev.c+4−7

This diff is large: its 40 lines aren’t shown here.

net/phonet/socket.c+2−2

This diff is large: its 12 lines aren’t shown here.

net/rose/af_rose.c+0−23

This diff is large: its 37 lines aren’t shown here.

net/rxrpc/ar-internal.h+1−0

This diff is large: its 8 lines aren’t shown here.

net/rxrpc/recvmsg.c+13−5

This diff is large: its 90 lines aren’t shown here.

net/sched/cls_api.c+79−4

This diff is large: its 164 lines aren’t shown here.

net/sched/cls_bpf.c+6−2

This diff is large: its 23 lines aren’t shown here.

net/sched/sch_generic.c+8−11

This diff is large: its 50 lines aren’t shown here.

net/sched/sch_hhf.c+4−4

This diff is large: its 40 lines aren’t shown here.

net/sched/sch_sfb.c+7−6

This diff is large: its 49 lines aren’t shown here.

net/sched/sch_sfq.c+8−6

This diff is large: its 58 lines aren’t shown here.

net/sched/sch_taprio.c+4−3

This diff is large: its 28 lines aren’t shown here.

net/sctp/socket.c+4−4

This diff is large: its 36 lines aren’t shown here.

net/smc/af_smc.c+10−3

This diff is large: its 49 lines aren’t shown here.

net/smc/smc_core.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/smc/smc_pnet.c+1−3

This diff is large: its 18 lines aren’t shown here.

net/sunrpc/backchannel_rqst.c+4−3

This diff is large: its 36 lines aren’t shown here.

net/sunrpc/xprt.c+5−0

This diff is large: its 12 lines aren’t shown here.

net/sunrpc/xprtrdma/backchannel.c+2−0

This diff is large: its 16 lines aren’t shown here.

net/tipc/socket.c+2−2

This diff is large: its 18 lines aren’t shown here.

net/tls/tls_device.c+9−1

This diff is large: its 55 lines aren’t shown here.

net/tls/tls_main.c+2−0

This diff is large: its 16 lines aren’t shown here.

net/tls/tls_sw.c+10−20

This diff is large: its 86 lines aren’t shown here.

net/unix/af_unix.c+3−3

This diff is large: its 27 lines aren’t shown here.

net/vmw_vsock/af_vsock.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/vmw_vsock/virtio_transport_common.c+5−3

This diff is large: its 15 lines aren’t shown here.

net/wireless/chan.c+5−0

This diff is large: its 12 lines aren’t shown here.

net/wireless/nl80211.c+1−1

This diff is large: its 9 lines aren’t shown here.

net/wireless/util.c+2−1

This diff is large: its 10 lines aren’t shown here.

net/xdp/xdp_umem.c+6−0

This diff is large: its 20 lines aren’t shown here.

scripts/gdb/linux/symbols.py+2−1

This diff is large: its 10 lines aren’t shown here.

scripts/nsdeps+3−3

This diff is large: its 16 lines aren’t shown here.

security/lockdown/lockdown.c+1−0

This diff is large: its 8 lines aren’t shown here.

sound/core/compress_offload.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/core/timer.c+20−10

This diff is large: its 107 lines aren’t shown here.

sound/firewire/bebob/bebob_focusrite.c+3−0

This diff is large: its 17 lines aren’t shown here.

sound/firewire/bebob/bebob_stream.c+1−2

This diff is large: its 10 lines aren’t shown here.

sound/hda/hdac_controller.c+0−2

This diff is large: its 9 lines aren’t shown here.

sound/pci/hda/hda_intel.c+1−1

This diff is large: its 11 lines aren’t shown here.

sound/pci/hda/patch_ca0132.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/pci/hda/patch_hdmi.c+19−4

This diff is large: its 79 lines aren’t shown here.

sound/pci/hda/patch_realtek.c+11−0

This diff is large: its 53 lines aren’t shown here.

sound/soc/codecs/hdac_hda.c+1−1

This diff is large: its 10 lines aren’t shown here.

sound/soc/codecs/hdmi-codec.c+5−7

This diff is large: its 47 lines aren’t shown here.

sound/soc/codecs/max98373.c+2−2

This diff is large: its 14 lines aren’t shown here.

sound/soc/codecs/msm8916-wcd-analog.c+2−2

This diff is large: its 18 lines aren’t shown here.

sound/soc/kirkwood/kirkwood-i2s.c+6−5

This diff is large: its 39 lines aren’t shown here.

sound/soc/rockchip/rockchip_max98090.c+5−2

This diff is large: its 16 lines aren’t shown here.

sound/soc/sh/rcar/dma.c+2−2

This diff is large: its 13 lines aren’t shown here.

sound/soc/sof/debug.c+4−2

This diff is large: its 13 lines aren’t shown here.

sound/soc/sof/intel/hda-stream.c+2−2

This diff is large: its 18 lines aren’t shown here.

sound/soc/sof/ipc.c+3−1

This diff is large: its 12 lines aren’t shown here.

sound/soc/sof/topology.c+6−5

This diff is large: its 22 lines aren’t shown here.

sound/soc/stm/stm32_sai_sub.c+11−1

This diff is large: its 26 lines aren’t shown here.

sound/soc/ti/sdma-pcm.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/usb/quirks.c+1−0

This diff is large: its 8 lines aren’t shown here.

tools/gpio/Makefile+5−1

This diff is large: its 13 lines aren’t shown here.

tools/perf/util/hist.c+1−1

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/bpf/test_offload.py+5−0

This diff is large: its 20 lines aren’t shown here.

tools/testing/selftests/bpf/test_sysctl.c+7−1

This diff is large: its 24 lines aren’t shown here.

tools/testing/selftests/bpf/test_tc_edt.sh+1−1

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/net/fib_tests.sh+21−0

This diff is large: its 28 lines aren’t shown here.

tools/testing/selftests/net/l2tp.sh+0−0

File mode changed from 100644 to 100755.

tools/testing/selftests/net/reuseport_dualstack.c+2−1

This diff is large: its 17 lines aren’t shown here.

tools/testing/selftests/net/tls.c+108−0

This diff is large: its 115 lines aren’t shown here.

tools/testing/selftests/vm/gup_benchmark.c+1−1

This diff is large: its 9 lines aren’t shown here.

tools/usb/usbip/libsrc/usbip_device_driver.c+4−2

This diff is large: its 21 lines aren’t shown here.

virt/kvm/kvm_main.c+26−22

This diff is large: its 88 lines aren’t shown here.

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