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
108Jason Gunthorpe <jgg@ziepe.ca> <jgunthorpe@obsidianresearch.com>108Jason Gunthorpe <jgg@ziepe.ca> <jgunthorpe@obsidianresearch.com>
109Javi Merino <javi.merino@kernel.org> <javi.merino@arm.com>109Javi Merino <javi.merino@kernel.org> <javi.merino@arm.com>
110<javier@osg.samsung.com> <javier.martinez@collabora.co.uk>110<javier@osg.samsung.com> <javier.martinez@collabora.co.uk>
111Jayachandran C <c.jayachandran@gmail.com> <jayachandranc@netlogicmicro.com>
112Jayachandran C <c.jayachandran@gmail.com> <jchandra@broadcom.com>
113Jayachandran C <c.jayachandran@gmail.com> <jchandra@digeo.com>
114Jayachandran C <c.jayachandran@gmail.com> <jnair@caviumnetworks.com>
111Jean Tourrilhes <jt@hpl.hp.com>115Jean Tourrilhes <jt@hpl.hp.com>
112<jean-philippe@linaro.org> <jean-philippe.brucker@arm.com>116<jean-philippe@linaro.org> <jean-philippe.brucker@arm.com>
113Jeff Garzik <jgarzik@pretzel.yyz.us>117Jeff Garzik <jgarzik@pretzel.yyz.us>
Documentation/arm64/silicon-errata.rst+6−1
@@ -91,6 +91,11 @@ stable kernels. · 90 unmodified lines
91| ARM | MMU-500 | #841119,826419 | N/A |91| ARM | MMU-500 | #841119,826419 | N/A |
92+----------------+-----------------+-----------------+-----------------------------+92+----------------+-----------------+-----------------+-----------------------------+
93+----------------+-----------------+-----------------+-----------------------------+93+----------------+-----------------+-----------------+-----------------------------+
94| Broadcom | Brahma-B53 | N/A | ARM64_ERRATUM_845719 |
95+----------------+-----------------+-----------------+-----------------------------+
96| Broadcom | Brahma-B53 | N/A | ARM64_ERRATUM_843419 |
97+----------------+-----------------+-----------------+-----------------------------+
98+----------------+-----------------+-----------------+-----------------------------+
94| Cavium | ThunderX ITS | #22375,24313 | CAVIUM_ERRATUM_22375 |99| Cavium | ThunderX ITS | #22375,24313 | CAVIUM_ERRATUM_22375 |
95+----------------+-----------------+-----------------+-----------------------------+100+----------------+-----------------+-----------------+-----------------------------+
96| Cavium | ThunderX ITS | #23144 | CAVIUM_ERRATUM_23144 |101| Cavium | ThunderX ITS | #23144 | CAVIUM_ERRATUM_23144 |
@@ -126,7 +131,7 @@ stable kernels. · 29 unmodified lines
126+----------------+-----------------+-----------------+-----------------------------+131+----------------+-----------------+-----------------+-----------------------------+
127| Qualcomm Tech. | Kryo/Falkor v1 | E1003 | QCOM_FALKOR_ERRATUM_1003 |132| Qualcomm Tech. | Kryo/Falkor v1 | E1003 | QCOM_FALKOR_ERRATUM_1003 |
128+----------------+-----------------+-----------------+-----------------------------+133+----------------+-----------------+-----------------+-----------------------------+
129| Qualcomm Tech. | Falkor v1 | E1009 | QCOM_FALKOR_ERRATUM_1009 |134| Qualcomm Tech. | Kryo/Falkor v1 | E1009 | QCOM_FALKOR_ERRATUM_1009 |
130+----------------+-----------------+-----------------+-----------------------------+135+----------------+-----------------+-----------------+-----------------------------+
131| Qualcomm Tech. | QDF2400 ITS | E0065 | QCOM_QDF2400_ERRATUM_0065 |136| Qualcomm Tech. | QDF2400 ITS | E0065 | QCOM_QDF2400_ERRATUM_0065 |
132+----------------+-----------------+-----------------+-----------------------------+137+----------------+-----------------+-----------------+-----------------------------+
Documentation/networking/device_drivers/intel/e100.rst+7−7
@@ -1,8 +1,8 @@
1.. SPDX-License-Identifier: GPL-2.0+1.. SPDX-License-Identifier: GPL-2.0+
2 2
3==============================================================3=============================================================
4Linux* Base Driver for the Intel(R) PRO/100 Family of Adapters4Linux Base Driver for the Intel(R) PRO/100 Family of Adapters
5==============================================================5=============================================================
6 6
7June 1, 20187June 1, 2018
8 8
@@ -21,7 +21,7 @@ Contents · 12 unmodified lines
21In This Release21In This Release
22===============22===============
23 23
24This file describes the Linux* Base Driver for the Intel(R) PRO/100 Family of24This file describes the Linux Base Driver for the Intel(R) PRO/100 Family of
25Adapters. This driver includes support for Itanium(R)2-based systems.25Adapters. This driver includes support for Itanium(R)2-based systems.
26 26
27For questions related to hardware requirements, refer to the documentation27For 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
138The latest release of ethtool can be found from138The latest release of ethtool can be found from
139https://www.kernel.org/pub/software/network/ethtool/139https://www.kernel.org/pub/software/network/ethtool/
140 140
141Enabling Wake on LAN* (WoL)141Enabling Wake on LAN (WoL)
142---------------------------142--------------------------
143WoL is provided through the ethtool* utility. For instructions on143WoL is provided through the ethtool utility. For instructions on
144enabling WoL with ethtool, refer to the ethtool man page. WoL will be144enabling WoL with ethtool, refer to the ethtool man page. WoL will be
145enabled on the system during the next shut down or reboot. For this145enabled on the system during the next shut down or reboot. For this
146driver version, in order to enable WoL, the e100 driver must be loaded146driver 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 @@
1.. SPDX-License-Identifier: GPL-2.0+1.. SPDX-License-Identifier: GPL-2.0+
2 2
3===========================================================3==========================================================
4Linux* Base Driver for Intel(R) Ethernet Network Connection4Linux Base Driver for Intel(R) Ethernet Network Connection
5===========================================================5==========================================================
6 6
7Intel Gigabit Linux driver.7Intel Gigabit Linux driver.
8Copyright(c) 1999 - 2013 Intel Corporation.8Copyright(c) 1999 - 2013 Intel Corporation.
@@ -438,10 +438,10 @@ ethtool · 429 unmodified lines
438 The latest release of ethtool can be found from438 The latest release of ethtool can be found from
439 https://www.kernel.org/pub/software/network/ethtool/439 https://www.kernel.org/pub/software/network/ethtool/
440 440
441Enabling Wake on LAN* (WoL)441Enabling Wake on LAN (WoL)
442---------------------------442--------------------------
443 443
444 WoL is configured through the ethtool* utility.444 WoL is configured through the ethtool utility.
445 445
446 WoL will be enabled on the system during the next shut down or reboot.446 WoL will be enabled on the system during the next shut down or reboot.
447 For this driver version, in order to enable WoL, the e1000 driver must be447 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 @@
1.. SPDX-License-Identifier: GPL-2.0+1.. SPDX-License-Identifier: GPL-2.0+
2 2
3======================================================3=====================================================
4Linux* Driver for Intel(R) Ethernet Network Connection4Linux Driver for Intel(R) Ethernet Network Connection
5======================================================5=====================================================
6 6
7Intel Gigabit Linux driver.7Intel Gigabit Linux driver.
8Copyright(c) 2008-2018 Intel Corporation.8Copyright(c) 2008-2018 Intel Corporation.
@@ -338,7 +338,7 @@ and higher cannot be forced. Use the autonegotiation advertising setting to · 329 unmodified lines
338manually set devices for 1 Gbps and higher.338manually set devices for 1 Gbps and higher.
339 339
340Speed, duplex, and autonegotiation advertising are configured through the340Speed, duplex, and autonegotiation advertising are configured through the
341ethtool* utility.341ethtool utility.
342 342
343Caution: Only experienced network administrators should force speed and duplex343Caution: Only experienced network administrators should force speed and duplex
344or change autonegotiation advertising manually. The settings at the switch must344or 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
351operate only in full duplex and only at their native speed.351operate only in full duplex and only at their native speed.
352 352
353 353
354Enabling Wake on LAN* (WoL)354Enabling Wake on LAN (WoL)
355---------------------------355--------------------------
356WoL is configured through the ethtool* utility.356WoL is configured through the ethtool utility.
357 357
358WoL will be enabled on the system during the next shut down or reboot. For358WoL will be enabled on the system during the next shut down or reboot. For
359this driver version, in order to enable WoL, the e1000e driver must be loaded359this 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 @@
1.. SPDX-License-Identifier: GPL-2.0+1.. SPDX-License-Identifier: GPL-2.0+
2 2
3==============================================================3=============================================================
4Linux* Base Driver for Intel(R) Ethernet Multi-host Controller4Linux Base Driver for Intel(R) Ethernet Multi-host Controller
5==============================================================5=============================================================
6 6
7August 20, 20187August 20, 2018
8Copyright(c) 2015-2018 Intel Corporation.8Copyright(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
120Known Issues/Troubleshooting120Known Issues/Troubleshooting
121============================121============================
122 122
123Enabling SR-IOV in a 64-bit Microsoft* Windows Server* 2012/R2 guest OS under Linux KVM123Enabling SR-IOV in a 64-bit Microsoft Windows Server 2012/R2 guest OS under Linux KVM
124---------------------------------------------------------------------------------------124-------------------------------------------------------------------------------------
125KVM Hypervisor/VMM supports direct assignment of a PCIe device to a VM. This125KVM Hypervisor/VMM supports direct assignment of a PCIe device to a VM. This
126includes traditional PCIe devices, as well as SR-IOV-capable devices based on126includes traditional PCIe devices, as well as SR-IOV-capable devices based on
127the Intel Ethernet Controller XL710.127the Intel Ethernet Controller XL710.
Documentation/networking/device_drivers/intel/i40e.rst+4−4
@@ -1,8 +1,8 @@
1.. SPDX-License-Identifier: GPL-2.0+1.. SPDX-License-Identifier: GPL-2.0+
2 2
3==================================================================3=================================================================
4Linux* Base Driver for the Intel(R) Ethernet Controller 700 Series4Linux Base Driver for the Intel(R) Ethernet Controller 700 Series
5==================================================================5=================================================================
6 6
7Intel 40 Gigabit Linux driver.7Intel 40 Gigabit Linux driver.
8Copyright(c) 1999-2018 Intel Corporation.8Copyright(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
384Network Adapter XXV710 based devices.384Network Adapter XXV710 based devices.
385 385
386Speed, duplex, and autonegotiation advertising are configured through the386Speed, duplex, and autonegotiation advertising are configured through the
387ethtool* utility.387ethtool utility.
388 388
389Caution: Only experienced network administrators should force speed and duplex389Caution: Only experienced network administrators should force speed and duplex
390or change autonegotiation advertising manually. The settings at the switch must390or change autonegotiation advertising manually. The settings at the switch must
Documentation/networking/device_drivers/intel/iavf.rst+4−4
@@ -1,8 +1,8 @@
1.. SPDX-License-Identifier: GPL-2.0+1.. SPDX-License-Identifier: GPL-2.0+
2 2
3==================================================================3=================================================================
4Linux* Base Driver for Intel(R) Ethernet Adaptive Virtual Function4Linux Base Driver for Intel(R) Ethernet Adaptive Virtual Function
5==================================================================5=================================================================
6 6
7Intel Ethernet Adaptive Virtual Function Linux driver.7Intel Ethernet Adaptive Virtual Function Linux driver.
8Copyright(c) 2013-2018 Intel Corporation.8Copyright(c) 2013-2018 Intel Corporation.
@@ -19,7 +19,7 @@ Contents · 10 unmodified lines
19Overview19Overview
20========20========
21 21
22This file describes the iavf Linux* Base Driver. This driver was formerly22This file describes the iavf Linux Base Driver. This driver was formerly
23called i40evf.23called i40evf.
24 24
25The iavf driver supports the below mentioned virtual function devices and25The iavf driver supports the below mentioned virtual function devices and
Documentation/networking/device_drivers/intel/ice.rst+3−3
@@ -1,8 +1,8 @@
1.. SPDX-License-Identifier: GPL-2.0+1.. SPDX-License-Identifier: GPL-2.0+
2 2
3===================================================================3==================================================================
4Linux* Base Driver for the Intel(R) Ethernet Connection E800 Series4Linux Base Driver for the Intel(R) Ethernet Connection E800 Series
5===================================================================5==================================================================
6 6
7Intel ice Linux driver.7Intel ice Linux driver.
8Copyright(c) 2018 Intel Corporation.8Copyright(c) 2018 Intel Corporation.
Documentation/networking/device_drivers/intel/igb.rst+6−6
@@ -1,8 +1,8 @@
1.. SPDX-License-Identifier: GPL-2.0+1.. SPDX-License-Identifier: GPL-2.0+
2 2
3===========================================================3==========================================================
4Linux* Base Driver for Intel(R) Ethernet Network Connection4Linux Base Driver for Intel(R) Ethernet Network Connection
5===========================================================5==========================================================
6 6
7Intel Gigabit Linux driver.7Intel Gigabit Linux driver.
8Copyright(c) 1999-2018 Intel Corporation.8Copyright(c) 1999-2018 Intel Corporation.
@@ -129,9 +129,9 @@ version is required for this functionality. Download it at: · 120 unmodified lines
129https://www.kernel.org/pub/software/network/ethtool/129https://www.kernel.org/pub/software/network/ethtool/
130 130
131 131
132Enabling Wake on LAN* (WoL)132Enabling Wake on LAN (WoL)
133---------------------------133--------------------------
134WoL is configured through the ethtool* utility.134WoL is configured through the ethtool utility.
135 135
136WoL will be enabled on the system during the next shut down or reboot. For136WoL will be enabled on the system during the next shut down or reboot. For
137this driver version, in order to enable WoL, the igb driver must be loaded137this 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 @@
1.. SPDX-License-Identifier: GPL-2.0+1.. SPDX-License-Identifier: GPL-2.0+
2 2
3============================================================3===========================================================
4Linux* Base Virtual Function Driver for Intel(R) 1G Ethernet4Linux Base Virtual Function Driver for Intel(R) 1G Ethernet
5============================================================5===========================================================
6 6
7Intel Gigabit Virtual Function Linux driver.7Intel Gigabit Virtual Function Linux driver.
8Copyright(c) 1999-2018 Intel Corporation.8Copyright(c) 1999-2018 Intel Corporation.
Documentation/networking/device_drivers/intel/ixgbe.rst+5−5
@@ -1,8 +1,8 @@
1.. SPDX-License-Identifier: GPL-2.0+1.. SPDX-License-Identifier: GPL-2.0+
2 2
3=============================================================================3===========================================================================
4Linux* Base Driver for the Intel(R) Ethernet 10 Gigabit PCI Express Adapters4Linux Base Driver for the Intel(R) Ethernet 10 Gigabit PCI Express Adapters
5=============================================================================5===========================================================================
6 6
7Intel 10 Gigabit Linux driver.7Intel 10 Gigabit Linux driver.
8Copyright(c) 1999-2018 Intel Corporation.8Copyright(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
519Known Issues/Troubleshooting519Known Issues/Troubleshooting
520============================520============================
521 521
522Enabling SR-IOV in a 64-bit Microsoft* Windows Server* 2012/R2 guest OS522Enabling SR-IOV in a 64-bit Microsoft Windows Server 2012/R2 guest OS
523-----------------------------------------------------------------------523---------------------------------------------------------------------
524Linux KVM Hypervisor/VMM supports direct assignment of a PCIe device to a VM.524Linux KVM Hypervisor/VMM supports direct assignment of a PCIe device to a VM.
525This includes traditional PCIe devices, as well as SR-IOV-capable devices based525This includes traditional PCIe devices, as well as SR-IOV-capable devices based
526on the Intel Ethernet Controller XL710.526on the Intel Ethernet Controller XL710.
Documentation/networking/device_drivers/intel/ixgbevf.rst+3−3
@@ -1,8 +1,8 @@
1.. SPDX-License-Identifier: GPL-2.0+1.. SPDX-License-Identifier: GPL-2.0+
2 2
3=============================================================3============================================================
4Linux* Base Virtual Function Driver for Intel(R) 10G Ethernet4Linux Base Virtual Function Driver for Intel(R) 10G Ethernet
5=============================================================5============================================================
6 6
7Intel 10 Gigabit Virtual Function Linux driver.7Intel 10 Gigabit Virtual Function Linux driver.
8Copyright(c) 1999-2018 Intel Corporation.8Copyright(c) 1999-2018 Intel Corporation.
Documentation/networking/device_drivers/pensando/ionic.rst+3−3
@@ -1,8 +1,8 @@
1.. SPDX-License-Identifier: GPL-2.0+1.. SPDX-License-Identifier: GPL-2.0+
2 2
3==========================================================3========================================================
4Linux* Driver for the Pensando(R) Ethernet adapter family4Linux Driver for the Pensando(R) Ethernet adapter family
5==========================================================5========================================================
6 6
7Pensando Linux Ethernet driver.7Pensando Linux Ethernet driver.
8Copyright(c) 2019 Pensando Systems, Inc8Copyright(c) 2019 Pensando Systems, Inc
Documentation/networking/ip-sysctl.txt+7−4
@@ -207,8 +207,8 @@ TCP variables: · 206 unmodified lines
207 207
208somaxconn - INTEGER208somaxconn - INTEGER
209 Limit of socket listen() backlog, known in userspace as SOMAXCONN.209 Limit of socket listen() backlog, known in userspace as SOMAXCONN.
210 Defaults to 128. See also tcp_max_syn_backlog for additional tuning210 Defaults to 4096. (Was 128 before linux-5.4)
211 for TCP sockets.211 See also tcp_max_syn_backlog for additional tuning for TCP sockets.
212 212
213tcp_abort_on_overflow - BOOLEAN213tcp_abort_on_overflow - BOOLEAN
214 If listening service is too slow to accept new connections,214 If listening service is too slow to accept new connections,
@@ -408,11 +408,14 @@ tcp_max_orphans - INTEGER · 193 unmodified lines
408 up to ~64K of unswappable memory.408 up to ~64K of unswappable memory.
409 409
410tcp_max_syn_backlog - INTEGER410tcp_max_syn_backlog - INTEGER
411 Maximal number of remembered connection requests, which have not411 Maximal number of remembered connection requests (SYN_RECV),
412 received an acknowledgment from connecting client.412 which have not received an acknowledgment from connecting client.
413 This is a per-listener limit.
413 The minimal value is 128 for low memory machines, and it will414 The minimal value is 128 for low memory machines, and it will
414 increase in proportion to the memory of machine.415 increase in proportion to the memory of machine.
415 If server suffers from overload, try increasing this number.416 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.
416 419
417tcp_max_tw_buckets - INTEGER420tcp_max_tw_buckets - INTEGER
418 Maximal number of timewait sockets held by system simultaneously.421 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
436 encryption.436 encryption.
437 * ``tx_tls_ooo`` - number of TX packets which were part of a TLS stream437 * ``tx_tls_ooo`` - number of TX packets which were part of a TLS stream
438 but did not arrive in the expected order.438 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.
439 * ``tx_tls_drop_no_sync_data`` - number of TX packets which were part of443 * ``tx_tls_drop_no_sync_data`` - number of TX packets which were part of
440 a TLS stream dropped, because they arrived out of order and associated444 a TLS stream dropped, because they arrived out of order and associated
441 record could not be found.445 record could not be found.
MAINTAINERS+15−5
@@ -3053,6 +3053,7 @@ M: Daniel Borkmann <daniel@iogearbox.net> · 3052 unmodified lines
3053R: Martin KaFai Lau <kafai@fb.com>3053R: Martin KaFai Lau <kafai@fb.com>
3054R: Song Liu <songliubraving@fb.com>3054R: Song Liu <songliubraving@fb.com>
3055R: Yonghong Song <yhs@fb.com>3055R: Yonghong Song <yhs@fb.com>
3056R: Andrii Nakryiko <andriin@fb.com>
3056L: netdev@vger.kernel.org3057L: netdev@vger.kernel.org
3057L: bpf@vger.kernel.org3058L: bpf@vger.kernel.org
3058T: git git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git3059T: 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
3737 3738
3738CAVIUM THUNDERX2 ARM64 SOC3739CAVIUM THUNDERX2 ARM64 SOC
3739M: Robert Richter <rrichter@cavium.com>3740M: Robert Richter <rrichter@cavium.com>
3740M: Jayachandran C <jnair@caviumnetworks.com>
3741L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)3741L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
3742S: Maintained3742S: Maintained
3743F: arch/arm64/boot/dts/cavium/thunder2-99xx*3743F: arch/arm64/boot/dts/cavium/thunder2-99xx*
@@ -10519,8 +10519,12 @@ F: mm/memblock.c · 6775 unmodified lines
10519F: Documentation/core-api/boot-time-mm.rst10519F: Documentation/core-api/boot-time-mm.rst
10520 10520
10521MEMORY MANAGEMENT10521MEMORY MANAGEMENT
10522M: Andrew Morton <akpm@linux-foundation.org>
10522L: linux-mm@kvack.org10523L: linux-mm@kvack.org
10523W: http://www.linux-mm.org10524W: http://www.linux-mm.org
10525T: quilt https://ozlabs.org/~akpm/mmotm/
10526T: quilt https://ozlabs.org/~akpm/mmots/
10527T: git git://github.com/hnaz/linux-mm.git
10524S: Maintained10528S: Maintained
10525F: include/linux/mm.h10529F: include/linux/mm.h
10526F: include/linux/gfp.h10530F: include/linux/gfp.h
@@ -11408,7 +11412,6 @@ F: include/trace/events/tcp.h · 881 unmodified lines
11408NETWORKING [TLS]11412NETWORKING [TLS]
11409M: Boris Pismenny <borisp@mellanox.com>11413M: Boris Pismenny <borisp@mellanox.com>
11410M: Aviad Yehezkel <aviadye@mellanox.com>11414M: Aviad Yehezkel <aviadye@mellanox.com>
11411M: Dave Watson <davejwatson@fb.com>
11412M: John Fastabend <john.fastabend@gmail.com>11415M: John Fastabend <john.fastabend@gmail.com>
11413M: Daniel Borkmann <daniel@iogearbox.net>11416M: Daniel Borkmann <daniel@iogearbox.net>
11414M: Jakub Kicinski <jakub.kicinski@netronome.com>11417M: Jakub Kicinski <jakub.kicinski@netronome.com>
@@ -13913,7 +13916,7 @@ F: drivers/mtd/nand/raw/r852.h · 2498 unmodified lines
13913 13916
13914RISC-V ARCHITECTURE13917RISC-V ARCHITECTURE
13915M: Paul Walmsley <paul.walmsley@sifive.com>13918M: Paul Walmsley <paul.walmsley@sifive.com>
13916M: Palmer Dabbelt <palmer@sifive.com>13919M: Palmer Dabbelt <palmer@dabbelt.com>
13917M: Albert Ou <aou@eecs.berkeley.edu>13920M: Albert Ou <aou@eecs.berkeley.edu>
13918L: linux-riscv@lists.infradead.org13921L: linux-riscv@lists.infradead.org
13919T: git git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git13922T: 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
14790F: drivers/media/mmc/siano/14793F: drivers/media/mmc/siano/
14791 14794
14792SIFIVE DRIVERS14795SIFIVE DRIVERS
14793M: Palmer Dabbelt <palmer@sifive.com>14796M: Palmer Dabbelt <palmer@dabbelt.com>
14794M: Paul Walmsley <paul.walmsley@sifive.com>14797M: Paul Walmsley <paul.walmsley@sifive.com>
14795L: linux-riscv@lists.infradead.org14798L: linux-riscv@lists.infradead.org
14796T: git git://github.com/sifive/riscv-linux.git14799T: git git://github.com/sifive/riscv-linux.git
@@ -14800,7 +14803,7 @@ N: sifive · 3 unmodified lines
14800 14803
14801SIFIVE FU540 SYSTEM-ON-CHIP14804SIFIVE FU540 SYSTEM-ON-CHIP
14802M: Paul Walmsley <paul.walmsley@sifive.com>14805M: Paul Walmsley <paul.walmsley@sifive.com>
14803M: Palmer Dabbelt <palmer@sifive.com>14806M: Palmer Dabbelt <palmer@dabbelt.com>
14804L: linux-riscv@lists.infradead.org14807L: linux-riscv@lists.infradead.org
14805T: git git://git.kernel.org/pub/scm/linux/kernel/git/pjw/sifive.git14808T: git git://git.kernel.org/pub/scm/linux/kernel/git/pjw/sifive.git
14806S: Supported14809S: Supported
@@ -17342,6 +17345,12 @@ F: include/linux/vbox_utils.h · 2535 unmodified lines
17342F: include/uapi/linux/vbox*.h17345F: include/uapi/linux/vbox*.h
17343F: drivers/virt/vboxguest/17346F: drivers/virt/vboxguest/
17344 17347
17348VIRTUAL BOX SHARED FOLDER VFS DRIVER:
17349M: Hans de Goede <hdegoede@redhat.com>
17350L: linux-fsdevel@vger.kernel.org
17351S: Maintained
17352F: drivers/staging/vboxsf/*
17353
17345VIRTUAL SERIO DEVICE DRIVER17354VIRTUAL SERIO DEVICE DRIVER
17346M: Stephen Chandler Paul <thatslyude@gmail.com>17355M: Stephen Chandler Paul <thatslyude@gmail.com>
17347S: Maintained17356S: Maintained
@@ -18042,6 +18051,7 @@ F: Documentation/vm/zsmalloc.rst · 694 unmodified lines
18042ZSWAP COMPRESSED SWAP CACHING18051ZSWAP COMPRESSED SWAP CACHING
18043M: Seth Jennings <sjenning@redhat.com>18052M: Seth Jennings <sjenning@redhat.com>
18044M: Dan Streetman <ddstreet@ieee.org>18053M: Dan Streetman <ddstreet@ieee.org>
18054M: Vitaly Wool <vitaly.wool@konsulko.com>
18045L: linux-mm@kvack.org18055L: linux-mm@kvack.org
18046S: Maintained18056S: Maintained
18047F: mm/zswap.c18057F: mm/zswap.c
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
2VERSION = 52VERSION = 5
3PATCHLEVEL = 43PATCHLEVEL = 4
4SUBLEVEL = 04SUBLEVEL = 0
5EXTRAVERSION = -rc55EXTRAVERSION = -rc7
6NAME = Kleptomaniac Octopus6NAME = Kleptomaniac Octopus
7 7
8# *DOCUMENTATION*8# *DOCUMENTATION*
arch/arc/boot/dts/hsdk.dts+23−0
@@ -65,6 +65,14 @@ · 64 unmodified lines
65 clock-frequency = <33333333>;65 clock-frequency = <33333333>;
66 };66 };
67 67
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
68 cpu_intc: cpu-interrupt-controller {76 cpu_intc: cpu-interrupt-controller {
69 compatible = "snps,archs-intc";77 compatible = "snps,archs-intc";
70 interrupt-controller;78 interrupt-controller;
@@ -264,6 +272,21 @@ · 193 unmodified lines
264 clocks = <&input_clk>;272 clocks = <&input_clk>;
265 cs-gpios = <&creg_gpio 0 GPIO_ACTIVE_LOW>,273 cs-gpios = <&creg_gpio 0 GPIO_ACTIVE_LOW>,
266 <&creg_gpio 1 GPIO_ACTIVE_LOW>;274 <&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 };
267 };290 };
268 291
269 creg_gpio: gpio@14b0 {292 creg_gpio: gpio@14b0 {
arch/arc/configs/hsdk_defconfig+6−0
@@ -32,6 +32,8 @@ CONFIG_INET=y · 31 unmodified lines
32CONFIG_DEVTMPFS=y32CONFIG_DEVTMPFS=y
33# CONFIG_STANDALONE is not set33# CONFIG_STANDALONE is not set
34# CONFIG_PREVENT_FIRMWARE_BUILD is not set34# CONFIG_PREVENT_FIRMWARE_BUILD is not set
35CONFIG_MTD=y
36CONFIG_MTD_SPI_NOR=y
35CONFIG_SCSI=y37CONFIG_SCSI=y
36CONFIG_BLK_DEV_SD=y38CONFIG_BLK_DEV_SD=y
37CONFIG_NETDEVICES=y39CONFIG_NETDEVICES=y
@@ -55,6 +57,8 @@ CONFIG_GPIO_SYSFS=y · 17 unmodified lines
55CONFIG_GPIO_DWAPB=y57CONFIG_GPIO_DWAPB=y
56CONFIG_GPIO_SNPS_CREG=y58CONFIG_GPIO_SNPS_CREG=y
57# CONFIG_HWMON is not set59# CONFIG_HWMON is not set
60CONFIG_REGULATOR=y
61CONFIG_REGULATOR_FIXED_VOLTAGE=y
58CONFIG_DRM=y62CONFIG_DRM=y
59# CONFIG_DRM_FBDEV_EMULATION is not set63# CONFIG_DRM_FBDEV_EMULATION is not set
60CONFIG_DRM_UDL=y64CONFIG_DRM_UDL=y
@@ -72,6 +76,8 @@ CONFIG_MMC_SDHCI_PLTFM=y · 11 unmodified lines
72CONFIG_MMC_DW=y76CONFIG_MMC_DW=y
73CONFIG_DMADEVICES=y77CONFIG_DMADEVICES=y
74CONFIG_DW_AXI_DMAC=y78CONFIG_DW_AXI_DMAC=y
79CONFIG_IIO=y
80CONFIG_TI_ADC108S102=y
75CONFIG_EXT3_FS=y81CONFIG_EXT3_FS=y
76CONFIG_VFAT_FS=y82CONFIG_VFAT_FS=y
77CONFIG_TMPFS=y83CONFIG_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
614 /* loop thru all available h/w condition indexes */614 /* loop thru all available h/w condition indexes */
615 for (i = 0; i < cc_bcr.c; i++) {615 for (i = 0; i < cc_bcr.c; i++) {
616 write_aux_reg(ARC_REG_CC_INDEX, i);616 write_aux_reg(ARC_REG_CC_INDEX, i);
617 cc_name.indiv.word0 = read_aux_reg(ARC_REG_CC_NAME0);617 cc_name.indiv.word0 = le32_to_cpu(read_aux_reg(ARC_REG_CC_NAME0));
618 cc_name.indiv.word1 = read_aux_reg(ARC_REG_CC_NAME1);618 cc_name.indiv.word1 = le32_to_cpu(read_aux_reg(ARC_REG_CC_NAME1));
619 619
620 arc_pmu_map_hw_event(i, cc_name.str);620 arc_pmu_map_hw_event(i, cc_name.str);
621 arc_pmu_add_raw_event_attr(i, cc_name.str);621 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
328 pinctrl-0 = <&pinctrl_pwm3>;328 pinctrl-0 = <&pinctrl_pwm3>;
329};329};
330 330
331&snvs_pwrkey {
332 status = "okay";
333};
334
331&ssi2 {335&ssi2 {
332 status = "okay";336 status = "okay";
333};337};
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi+8−0
@@ -230,6 +230,8 @@ · 229 unmodified lines
230 accelerometer@1c {230 accelerometer@1c {
231 compatible = "fsl,mma8451";231 compatible = "fsl,mma8451";
232 reg = <0x1c>;232 reg = <0x1c>;
233 pinctrl-names = "default";
234 pinctrl-0 = <&pinctrl_mma8451_int>;
233 interrupt-parent = <&gpio6>;235 interrupt-parent = <&gpio6>;
234 interrupts = <31 IRQ_TYPE_LEVEL_LOW>;236 interrupts = <31 IRQ_TYPE_LEVEL_LOW>;
235 };237 };
@@ -628,6 +630,12 @@ · 392 unmodified lines
628 >;630 >;
629 };631 };
630 632
633 pinctrl_mma8451_int: mma8451intgrp {
634 fsl,pins = <
635 MX6QDL_PAD_EIM_BCLK__GPIO6_IO31 0xb0b1
636 >;
637 };
638
631 pinctrl_pwm3: pwm1grp {639 pinctrl_pwm3: pwm1grp {
632 fsl,pins = <640 fsl,pins = <
633 MX6QDL_PAD_SD4_DAT1__PWM3_OUT 0x1b0b1641 MX6QDL_PAD_SD4_DAT1__PWM3_OUT 0x1b0b1
arch/arm/boot/dts/stm32mp157c-ev1.dts+2−11
@@ -183,14 +183,12 @@ · 182 unmodified lines
183 183
184 ov5640: camera@3c {184 ov5640: camera@3c {
185 compatible = "ovti,ov5640";185 compatible = "ovti,ov5640";
186 pinctrl-names = "default";
187 pinctrl-0 = <&ov5640_pins>;
188 reg = <0x3c>;186 reg = <0x3c>;
189 clocks = <&clk_ext_camera>;187 clocks = <&clk_ext_camera>;
190 clock-names = "xclk";188 clock-names = "xclk";
191 DOVDD-supply = <&v2v8>;189 DOVDD-supply = <&v2v8>;
192 powerdown-gpios = <&stmfx_pinctrl 18 GPIO_ACTIVE_HIGH>;190 powerdown-gpios = <&stmfx_pinctrl 18 (GPIO_ACTIVE_HIGH | GPIO_PUSH_PULL)>;
193 reset-gpios = <&stmfx_pinctrl 19 GPIO_ACTIVE_LOW>;191 reset-gpios = <&stmfx_pinctrl 19 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
194 rotation = <180>;192 rotation = <180>;
195 status = "okay";193 status = "okay";
196 194
@@ -223,15 +221,8 @@ · 26 unmodified lines
223 221
224 joystick_pins: joystick {222 joystick_pins: joystick {
225 pins = "gpio0", "gpio1", "gpio2", "gpio3", "gpio4";223 pins = "gpio0", "gpio1", "gpio2", "gpio3", "gpio4";
226 drive-push-pull;
227 bias-pull-down;224 bias-pull-down;
228 };225 };
229
230 ov5640_pins: camera {
231 pins = "agpio2", "agpio3"; /* stmfx pins 18 & 19 */
232 drive-push-pull;
233 output-low;
234 };
235 };226 };
236 };227 };
237};228};
arch/arm/boot/dts/stm32mp157c.dtsi+2−2
@@ -932,7 +932,7 @@ · 931 unmodified lines
932 interrupt-names = "int0", "int1";932 interrupt-names = "int0", "int1";
933 clocks = <&rcc CK_HSE>, <&rcc FDCAN_K>;933 clocks = <&rcc CK_HSE>, <&rcc FDCAN_K>;
934 clock-names = "hclk", "cclk";934 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>;
936 status = "disabled";936 status = "disabled";
937 };937 };
938 938
@@ -945,7 +945,7 @@ · 6 unmodified lines
945 interrupt-names = "int0", "int1";945 interrupt-names = "int0", "int1";
946 clocks = <&rcc CK_HSE>, <&rcc FDCAN_K>;946 clocks = <&rcc CK_HSE>, <&rcc FDCAN_K>;
947 clock-names = "hclk", "cclk";947 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>;
949 status = "disabled";949 status = "disabled";
950 };950 };
951 951
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts+1−0
@@ -192,6 +192,7 @@ · 191 unmodified lines
192 vqmmc-supply = <&reg_dldo1>;192 vqmmc-supply = <&reg_dldo1>;
193 non-removable;193 non-removable;
194 wakeup-source;194 wakeup-source;
195 keep-power-in-suspend;
195 status = "okay";196 status = "okay";
196 197
197 brcmf: wifi@1 {198 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
481static int sunxi_cpu_powerdown(unsigned int cpu, unsigned int cluster)481static int sunxi_cpu_powerdown(unsigned int cpu, unsigned int cluster)
482{482{
483 u32 reg;483 u32 reg;
484 int gating_bit = cpu;
484 485
485 pr_debug("%s: cluster %u cpu %u\n", __func__, cluster, cpu);486 pr_debug("%s: cluster %u cpu %u\n", __func__, cluster, cpu);
486 if (cpu >= SUNXI_CPUS_PER_CLUSTER || cluster >= SUNXI_NR_CLUSTERS)487 if (cpu >= SUNXI_CPUS_PER_CLUSTER || cluster >= SUNXI_NR_CLUSTERS)
487 return -EINVAL;488 return -EINVAL;
488 489
490 if (is_a83t && cpu == 0)
491 gating_bit = 4;
492
489 /* gate processor power */493 /* gate processor power */
490 reg = readl(prcm_base + PRCM_PWROFF_GATING_REG(cluster));494 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);
492 writel(reg, prcm_base + PRCM_PWROFF_GATING_REG(cluster));496 writel(reg, prcm_base + PRCM_PWROFF_GATING_REG(cluster));
493 udelay(20);497 udelay(20);
494 498
arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts+1−1
@@ -127,7 +127,7 @@ · 126 unmodified lines
127 status = "okay";127 status = "okay";
128 128
129 i2c-mux@77 {129 i2c-mux@77 {
130 compatible = "nxp,pca9847";130 compatible = "nxp,pca9547";
131 reg = <0x77>;131 reg = <0x77>;
132 #address-cells = <1>;132 #address-cells = <1>;
133 #size-cells = <0>;133 #size-cells = <0>;
arch/arm64/boot/dts/freescale/imx8mm.dtsi+3−3
@@ -394,7 +394,7 @@ · 393 unmodified lines
394 };394 };
395 395
396 sdma2: dma-controller@302c0000 {396 sdma2: dma-controller@302c0000 {
397 compatible = "fsl,imx8mm-sdma", "fsl,imx7d-sdma";397 compatible = "fsl,imx8mm-sdma", "fsl,imx8mq-sdma";
398 reg = <0x302c0000 0x10000>;398 reg = <0x302c0000 0x10000>;
399 interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;399 interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
400 clocks = <&clk IMX8MM_CLK_SDMA2_ROOT>,400 clocks = <&clk IMX8MM_CLK_SDMA2_ROOT>,
@@ -405,7 +405,7 @@ · 4 unmodified lines
405 };405 };
406 406
407 sdma3: dma-controller@302b0000 {407 sdma3: dma-controller@302b0000 {
408 compatible = "fsl,imx8mm-sdma", "fsl,imx7d-sdma";408 compatible = "fsl,imx8mm-sdma", "fsl,imx8mq-sdma";
409 reg = <0x302b0000 0x10000>;409 reg = <0x302b0000 0x10000>;
410 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;410 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
411 clocks = <&clk IMX8MM_CLK_SDMA3_ROOT>,411 clocks = <&clk IMX8MM_CLK_SDMA3_ROOT>,
@@ -737,7 +737,7 @@ · 325 unmodified lines
737 };737 };
738 738
739 sdma1: dma-controller@30bd0000 {739 sdma1: dma-controller@30bd0000 {
740 compatible = "fsl,imx8mm-sdma", "fsl,imx7d-sdma";740 compatible = "fsl,imx8mm-sdma", "fsl,imx8mq-sdma";
741 reg = <0x30bd0000 0x10000>;741 reg = <0x30bd0000 0x10000>;
742 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;742 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
743 clocks = <&clk IMX8MM_CLK_SDMA1_ROOT>,743 clocks = <&clk IMX8MM_CLK_SDMA1_ROOT>,
arch/arm64/boot/dts/freescale/imx8mn.dtsi+3−3
@@ -288,7 +288,7 @@ · 287 unmodified lines
288 };288 };
289 289
290 sdma3: dma-controller@302b0000 {290 sdma3: dma-controller@302b0000 {
291 compatible = "fsl,imx8mn-sdma", "fsl,imx7d-sdma";291 compatible = "fsl,imx8mn-sdma", "fsl,imx8mq-sdma";
292 reg = <0x302b0000 0x10000>;292 reg = <0x302b0000 0x10000>;
293 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;293 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
294 clocks = <&clk IMX8MN_CLK_SDMA3_ROOT>,294 clocks = <&clk IMX8MN_CLK_SDMA3_ROOT>,
@@ -299,7 +299,7 @@ · 4 unmodified lines
299 };299 };
300 300
301 sdma2: dma-controller@302c0000 {301 sdma2: dma-controller@302c0000 {
302 compatible = "fsl,imx8mn-sdma", "fsl,imx7d-sdma";302 compatible = "fsl,imx8mn-sdma", "fsl,imx8mq-sdma";
303 reg = <0x302c0000 0x10000>;303 reg = <0x302c0000 0x10000>;
304 interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;304 interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
305 clocks = <&clk IMX8MN_CLK_SDMA2_ROOT>,305 clocks = <&clk IMX8MN_CLK_SDMA2_ROOT>,
@@ -612,7 +612,7 @@ · 306 unmodified lines
612 };612 };
613 613
614 sdma1: dma-controller@30bd0000 {614 sdma1: dma-controller@30bd0000 {
615 compatible = "fsl,imx8mn-sdma", "fsl,imx7d-sdma";615 compatible = "fsl,imx8mn-sdma", "fsl,imx8mq-sdma";
616 reg = <0x30bd0000 0x10000>;616 reg = <0x30bd0000 0x10000>;
617 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;617 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
618 clocks = <&clk IMX8MN_CLK_SDMA1_ROOT>,618 clocks = <&clk IMX8MN_CLK_SDMA1_ROOT>,
arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi+1−1
@@ -88,7 +88,7 @@ · 87 unmodified lines
88 regulator-name = "0V9_ARM";88 regulator-name = "0V9_ARM";
89 regulator-min-microvolt = <900000>;89 regulator-min-microvolt = <900000>;
90 regulator-max-microvolt = <1000000>;90 regulator-max-microvolt = <1000000>;
91 gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;91 gpios = <&gpio3 16 GPIO_ACTIVE_HIGH>;
92 states = <1000000 0x192 states = <1000000 0x1
93 900000 0x0>;93 900000 0x0>;
94 regulator-always-on;94 regulator-always-on;
arch/arm64/include/asm/cputype.h+2−0
@@ -79,6 +79,7 @@ · 78 unmodified lines
79#define CAVIUM_CPU_PART_THUNDERX_83XX 0x0A379#define CAVIUM_CPU_PART_THUNDERX_83XX 0x0A3
80#define CAVIUM_CPU_PART_THUNDERX2 0x0AF80#define CAVIUM_CPU_PART_THUNDERX2 0x0AF
81 81
82#define BRCM_CPU_PART_BRAHMA_B53 0x100
82#define BRCM_CPU_PART_VULCAN 0x51683#define BRCM_CPU_PART_VULCAN 0x516
83 84
84#define QCOM_CPU_PART_FALKOR_V1 0x80085#define QCOM_CPU_PART_FALKOR_V1 0x800
@@ -105,6 +106,7 @@ · 20 unmodified lines
105#define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX)106#define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX)
106#define MIDR_THUNDERX_83XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_83XX)107#define MIDR_THUNDERX_83XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_83XX)
107#define MIDR_CAVIUM_THUNDERX2 MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX2)108#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)
108#define MIDR_BRCM_VULCAN MIDR_CPU_MODEL(ARM_CPU_IMP_BRCM, BRCM_CPU_PART_VULCAN)110#define MIDR_BRCM_VULCAN MIDR_CPU_MODEL(ARM_CPU_IMP_BRCM, BRCM_CPU_PART_VULCAN)
109#define MIDR_QCOM_FALKOR_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_FALKOR_V1)111#define MIDR_QCOM_FALKOR_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_FALKOR_V1)
110#define MIDR_QCOM_FALKOR MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_FALKOR)112#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
32#define PROT_DEFAULT (_PROT_DEFAULT | PTE_MAYBE_NG)32#define PROT_DEFAULT (_PROT_DEFAULT | PTE_MAYBE_NG)
33#define PROT_SECT_DEFAULT (_PROT_SECT_DEFAULT | PMD_MAYBE_NG)33#define PROT_SECT_DEFAULT (_PROT_SECT_DEFAULT | PMD_MAYBE_NG)
34 34
35#define PROT_DEVICE_nGnRnE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_DEVICE_nGnRnE))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_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_DEVICE_nGnRE))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_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_NC))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_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_WT))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_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL))39#define PROT_NORMAL (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL))
40 40
41#define PROT_SECT_DEVICE_nGnRE (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PMD_ATTRINDX(MT_DEVICE_nGnRE))41#define PROT_SECT_DEVICE_nGnRE (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PMD_ATTRINDX(MT_DEVICE_nGnRE))
42#define PROT_SECT_NORMAL (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PMD_ATTRINDX(MT_NORMAL))42#define PROT_SECT_NORMAL (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PMD_ATTRINDX(MT_NORMAL))
@@ -80,8 +80,9 @@ · 37 unmodified lines
80#define PAGE_S2_DEVICE __pgprot(_PROT_DEFAULT | PAGE_S2_MEMATTR(DEVICE_nGnRE) | PTE_S2_RDONLY | PTE_S2_XN)80#define PAGE_S2_DEVICE __pgprot(_PROT_DEFAULT | PAGE_S2_MEMATTR(DEVICE_nGnRE) | PTE_S2_RDONLY | PTE_S2_XN)
81 81
82#define PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_VALID) | PTE_PROT_NONE | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN)82#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)83/* shared+writable pages are clean by default, hence PTE_RDONLY|PTE_WRITE */
84#define PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | 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)
85#define PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN)86#define PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN)
86#define PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN)87#define PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN)
87#define PAGE_EXECONLY __pgprot(_PAGE_DEFAULT | PTE_RDONLY | PTE_NG | PTE_PXN)88#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
283 set_pte(ptep, pte);283 set_pte(ptep, pte);
284}284}
285 285
286#define __HAVE_ARCH_PTE_SAME
287static 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
303/*286/*
304 * Huge pte definitions.287 * Huge pte definitions.
305 */288 */
arch/arm64/include/asm/vdso/vsyscall.h+0−7
@@ -30,13 +30,6 @@ int __arm64_get_clock_mode(struct timekeeper *tk) · 29 unmodified lines
30}30}
31#define __arch_get_clock_mode __arm64_get_clock_mode31#define __arch_get_clock_mode __arm64_get_clock_mode
32 32
33static __always_inline
34int __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
40static __always_inline33static __always_inline
41void __arm64_update_vsyscall(struct vdso_data *vdata, struct timekeeper *tk)34void __arm64_update_vsyscall(struct vdso_data *vdata, struct timekeeper *tk)
42{35{
arch/arm64/kernel/cpu_errata.c+48−11
@@ -489,6 +489,7 @@ static const struct midr_range arm64_ssb_cpus[] = { · 488 unmodified lines
489 MIDR_ALL_VERSIONS(MIDR_CORTEX_A35),489 MIDR_ALL_VERSIONS(MIDR_CORTEX_A35),
490 MIDR_ALL_VERSIONS(MIDR_CORTEX_A53),490 MIDR_ALL_VERSIONS(MIDR_CORTEX_A53),
491 MIDR_ALL_VERSIONS(MIDR_CORTEX_A55),491 MIDR_ALL_VERSIONS(MIDR_CORTEX_A55),
492 MIDR_ALL_VERSIONS(MIDR_BRAHMA_B53),
492 {},493 {},
493};494};
494 495
@@ -573,6 +574,7 @@ static const struct midr_range spectre_v2_safe_list[] = { · 78 unmodified lines
573 MIDR_ALL_VERSIONS(MIDR_CORTEX_A35),574 MIDR_ALL_VERSIONS(MIDR_CORTEX_A35),
574 MIDR_ALL_VERSIONS(MIDR_CORTEX_A53),575 MIDR_ALL_VERSIONS(MIDR_CORTEX_A53),
575 MIDR_ALL_VERSIONS(MIDR_CORTEX_A55),576 MIDR_ALL_VERSIONS(MIDR_CORTEX_A55),
577 MIDR_ALL_VERSIONS(MIDR_BRAHMA_B53),
576 { /* sentinel */ }578 { /* sentinel */ }
577};579};
578 580
@@ -659,17 +661,23 @@ static const struct midr_range arm64_harden_el2_vectors[] = { · 80 unmodified lines
659#endif661#endif
660 662
661#ifdef CONFIG_ARM64_WORKAROUND_REPEAT_TLBI663#ifdef CONFIG_ARM64_WORKAROUND_REPEAT_TLBI
662 664static const struct arm64_cpu_capabilities arm64_repeat_tlbi_list[] = {
663static const struct midr_range arm64_repeat_tlbi_cpus[] = {
664#ifdef CONFIG_QCOM_FALKOR_ERRATUM_1009665#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 },
666#endif673#endif
667#ifdef CONFIG_ARM64_ERRATUM_1286807674#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 },
669#endif678#endif
670 {},679 {},
671};680};
672
673#endif681#endif
674 682
675#ifdef CONFIG_CAVIUM_ERRATUM_27456683#ifdef CONFIG_CAVIUM_ERRATUM_27456
@@ -737,6 +745,33 @@ static const struct midr_range erratum_1418040_list[] = { · 61 unmodified lines
737};745};
738#endif746#endif
739 747
748#ifdef CONFIG_ARM64_ERRATUM_845719
749static 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
759static 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
740const struct arm64_cpu_capabilities arm64_errata[] = {775const struct arm64_cpu_capabilities arm64_errata[] = {
741#ifdef CONFIG_ARM64_WORKAROUND_CLEAN_CACHE776#ifdef CONFIG_ARM64_WORKAROUND_CLEAN_CACHE
742 {777 {
@@ -768,19 +803,18 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 25 unmodified lines
768#endif803#endif
769#ifdef CONFIG_ARM64_ERRATUM_843419804#ifdef CONFIG_ARM64_ERRATUM_843419
770 {805 {
771 /* Cortex-A53 r0p[01234] */
772 .desc = "ARM erratum 843419",806 .desc = "ARM erratum 843419",
773 .capability = ARM64_WORKAROUND_843419,807 .capability = ARM64_WORKAROUND_843419,
774 ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 4),808 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
775 MIDR_FIXED(0x4, BIT(8)),809 .matches = cpucap_multi_entry_cap_matches,
810 .match_list = erratum_843419_list,
776 },811 },
777#endif812#endif
778#ifdef CONFIG_ARM64_ERRATUM_845719813#ifdef CONFIG_ARM64_ERRATUM_845719
779 {814 {
780 /* Cortex-A53 r0p[01234] */
781 .desc = "ARM erratum 845719",815 .desc = "ARM erratum 845719",
782 .capability = ARM64_WORKAROUND_845719,816 .capability = ARM64_WORKAROUND_845719,
783 ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 4),817 ERRATA_MIDR_RANGE_LIST(erratum_845719_list),
784 },818 },
785#endif819#endif
786#ifdef CONFIG_CAVIUM_ERRATUM_23154820#ifdef CONFIG_CAVIUM_ERRATUM_23154
@@ -816,6 +850,7 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 29 unmodified lines
816 {850 {
817 .desc = "Qualcomm Technologies Falkor/Kryo erratum 1003",851 .desc = "Qualcomm Technologies Falkor/Kryo erratum 1003",
818 .capability = ARM64_WORKAROUND_QCOM_FALKOR_E1003,852 .capability = ARM64_WORKAROUND_QCOM_FALKOR_E1003,
853 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
819 .matches = cpucap_multi_entry_cap_matches,854 .matches = cpucap_multi_entry_cap_matches,
820 .match_list = qcom_erratum_1003_list,855 .match_list = qcom_erratum_1003_list,
821 },856 },
@@ -824,7 +859,9 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 2 unmodified lines
824 {859 {
825 .desc = "Qualcomm erratum 1009, ARM erratum 1286807",860 .desc = "Qualcomm erratum 1009, ARM erratum 1286807",
826 .capability = ARM64_WORKAROUND_REPEAT_TLBI,861 .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,
828 },865 },
829#endif866#endif
830#ifdef CONFIG_ARM64_ERRATUM_858921867#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
28}28}
29#define __arch_get_clock_mode __mips_get_clock_mode29#define __arch_get_clock_mode __mips_get_clock_mode
30 30
31static __always_inline
32int __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
38/* The asm-generic header needs to be included after the definitions above */31/* The asm-generic header needs to be included after the definitions above */
39#include <asm-generic/vdso/vsyscall.h>32#include <asm-generic/vdso/vsyscall.h>
40 33
arch/parisc/kernel/entry.S+1−1
@@ -2125,7 +2125,7 @@ ftrace_regs_caller: · 2124 unmodified lines
2125 copy %rp, %r262125 copy %rp, %r26
2126 LDREG -FTRACE_FRAME_SIZE-PT_SZ_ALGN(%sp), %r252126 LDREG -FTRACE_FRAME_SIZE-PT_SZ_ALGN(%sp), %r25
2127 ldo -8(%r25), %r252127 ldo -8(%r25), %r25
2128 copy %r3, %arg22128 ldo -FTRACE_FRAME_SIZE(%r1), %arg2
2129 b,l ftrace_function_trampoline, %rp2129 b,l ftrace_function_trampoline, %rp
2130 copy %r1, %arg3 /* struct pt_regs */2130 copy %r1, %arg3 /* struct pt_regs */
2131 2131
arch/powerpc/include/asm/book3s/32/kup.h+1−0
@@ -91,6 +91,7 @@ · 90 unmodified lines
91 91
92static inline void kuap_update_sr(u32 sr, u32 addr, u32 end)92static inline void kuap_update_sr(u32 sr, u32 addr, u32 end)
93{93{
94 addr &= 0xf0000000; /* align addr to start of segment */
94 barrier(); /* make sure thread.kuap is updated before playing with SRs */95 barrier(); /* make sure thread.kuap is updated before playing with SRs */
95 while (addr < end) {96 while (addr < end) {
96 mtsrin(sr, addr);97 mtsrin(sr, addr);
arch/powerpc/include/asm/elf.h+3−0
@@ -175,4 +175,7 @@ do { \ · 174 unmodified lines
175 ARCH_DLINFO_CACHE_GEOMETRY; \175 ARCH_DLINFO_CACHE_GEOMETRY; \
176} while (0)176} while (0)
177 177
178/* Relocate the kernel image to @final_address */
179void relocate(unsigned long final_address);
180
178#endif /* _ASM_POWERPC_ELF_H */181#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
3249 /* Switch to secure mode. */3249 /* Switch to secure mode. */
3250 prom_printf("Switching to secure mode.\n");3250 prom_printf("Switching to secure mode.\n");
3251 3251
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
3252 ret = enter_secure_mode(kbase, fdt);3260 ret = enter_secure_mode(kbase, fdt);
3261
3262 /* Relocate the kernel again. */
3263 if (IS_ENABLED(CONFIG_RELOCATABLE))
3264 relocate(kbase);
3265
3253 if (ret != U_SUCCESS) {3266 if (ret != U_SUCCESS) {
3254 prom_printf("Returned %d from switching to secure mode.\n", ret);3267 prom_printf("Returned %d from switching to secure mode.\n", ret);
3255 prom_rtas_os_term("Switch to secure mode failed.\n");3268 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
26__secondary_hold_acknowledge __secondary_hold_spinloop __start26__secondary_hold_acknowledge __secondary_hold_spinloop __start
27logo_linux_clut224 btext_prepare_BAT27logo_linux_clut224 btext_prepare_BAT
28reloc_got2 kernstart_addr memstart_addr linux_banner _stext28reloc_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.
30relocate"
30 31
31NM="$1"32NM="$1"
32OBJ="$2"33OBJ="$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
1141 goto out_addrs;1141 goto out_addrs;
1142 }1142 }
1143 1143
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
1144 /*1157 /*
1145 * Pretend to build prologue, given the features we've seen. This will1158 * Pretend to build prologue, given the features we've seen. This will
1146 * update ctgtx.idx as it pretends to output instructions, then we can1159 * 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
42{42{
43 struct pci_dn *pdn = pci_get_pdn(pdev);43 struct pci_dn *pdn = pci_get_pdn(pdev);
44 44
45 if (eeh_has_flag(EEH_FORCE_DISABLED))45 if (!pdn || eeh_has_flag(EEH_FORCE_DISABLED))
46 return;46 return;
47 47
48 dev_dbg(&pdev->dev, "EEH: Setting up device\n");48 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
146 return 0;146 return 0;
147}147}
148 148
149static 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
149static void pnv_smp_cpu_kill_self(void)161static void pnv_smp_cpu_kill_self(void)
150{162{
163 unsigned long srr1, unexpected_mask, wmask;
151 unsigned int cpu;164 unsigned int cpu;
152 unsigned long srr1, wmask;
153 u64 lpcr_val;165 u64 lpcr_val;
154 166
155 /* Standard hot unplug procedure */167 /* 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());
163 168
164 idle_task_exit();169 idle_task_exit();
165 current->active_mm = NULL; /* for sanity */170 current->active_mm = NULL; /* for sanity */
@@ -172,6 +177,27 @@ static void pnv_smp_cpu_kill_self(void) · 6 unmodified lines
172 if (cpu_has_feature(CPU_FTR_ARCH_207S))177 if (cpu_has_feature(CPU_FTR_ARCH_207S))
173 wmask = SRR1_WAKEMASK_P8;178 wmask = SRR1_WAKEMASK_P8;
174 179
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
175 /*201 /*
176 * We don't want to take decrementer interrupts while we are202 * We don't want to take decrementer interrupts while we are
177 * offline, so clear LPCR:PECE1. We keep PECE2 (and203 * offline, so clear LPCR:PECE1. We keep PECE2 (and
@@ -197,6 +223,7 @@ static void pnv_smp_cpu_kill_self(void) · 19 unmodified lines
197 223
198 srr1 = pnv_cpu_offline(cpu);224 srr1 = pnv_cpu_offline(cpu);
199 225
226 WARN_ON_ONCE(!irqs_disabled());
200 WARN_ON(lazy_irq_pending());227 WARN_ON(lazy_irq_pending());
201 228
202 /*229 /*
@@ -212,13 +239,7 @@ static void pnv_smp_cpu_kill_self(void) · 9 unmodified lines
212 */239 */
213 if (((srr1 & wmask) == SRR1_WAKEEE) ||240 if (((srr1 & wmask) == SRR1_WAKEEE) ||
214 ((srr1 & wmask) == SRR1_WAKEHVI)) {241 ((srr1 & wmask) == SRR1_WAKEHVI)) {
215 if (cpu_has_feature(CPU_FTR_ARCH_300)) {242 pnv_flush_interrupts();
216 if (xive_enabled())
217 xive_flush_interrupt();
218 else
219 icp_opal_flush_interrupt();
220 } else
221 icp_native_flush_interrupt();
222 } else if ((srr1 & wmask) == SRR1_WAKEHDBELL) {243 } else if ((srr1 & wmask) == SRR1_WAKEHDBELL) {
223 unsigned long msg = PPC_DBELL_TYPE(PPC_DBELL_SERVER);244 unsigned long msg = PPC_DBELL_TYPE(PPC_DBELL_SERVER);
224 asm volatile(PPC_MSGCLR(%0) : : "r" (msg));245 asm volatile(PPC_MSGCLR(%0) : : "r" (msg));
@@ -266,7 +287,7 @@ static void pnv_smp_cpu_kill_self(void) · 41 unmodified lines
266 */287 */
267 lpcr_val = mfspr(SPRN_LPCR) | (u64)LPCR_PECE1;288 lpcr_val = mfspr(SPRN_LPCR) | (u64)LPCR_PECE1;
268 pnv_program_cpu_hotplug_lpcr(cpu, lpcr_val);289 pnv_program_cpu_hotplug_lpcr(cpu, lpcr_val);
269 290out:
270 DBG("CPU%d coming online...\n", cpu);291 DBG("CPU%d coming online...\n", cpu);
271}292}
272 293
arch/riscv/include/asm/io.h+7−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
13 13
14#include <linux/types.h>14#include <linux/types.h>
15#include <asm/mmiowb.h>15#include <asm/mmiowb.h>
16#include <asm/pgtable.h>
16 17
17extern void __iomem *ioremap(phys_addr_t offset, unsigned long size);18extern void __iomem *ioremap(phys_addr_t offset, unsigned long size);
18 19
@@ -161,6 +162,12 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) · 142 unmodified lines
161#define writeq(v,c) ({ __io_bw(); writeq_cpu((v),(c)); __io_aw(); })162#define writeq(v,c) ({ __io_bw(); writeq_cpu((v),(c)); __io_aw(); })
162#endif163#endif
163 164
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
164/*171/*
165 * Emulation routines for the port-mapped IO space used by some PCI drivers.172 * Emulation routines for the port-mapped IO space used by some PCI drivers.
166 * These are defined as being "fully synchronous", but also "not guaranteed to173 * 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
7#ifndef _ASM_RISCV_IRQ_H7#ifndef _ASM_RISCV_IRQ_H
8#define _ASM_RISCV_IRQ_H8#define _ASM_RISCV_IRQ_H
9 9
10#include <linux/interrupt.h>
11#include <linux/linkage.h>
12
10#define NR_IRQS 013#define NR_IRQS 0
11 14
12void riscv_timer_interrupt(void);15void riscv_timer_interrupt(void);
arch/riscv/include/asm/pgtable.h+6−1
@@ -7,6 +7,7 @@ · 6 unmodified lines
7#define _ASM_RISCV_PGTABLE_H7#define _ASM_RISCV_PGTABLE_H
8 8
9#include <linux/mmzone.h>9#include <linux/mmzone.h>
10#include <linux/sizes.h>
10 11
11#include <asm/pgtable-bits.h>12#include <asm/pgtable-bits.h>
12 13
@@ -86,6 +87,7 @@ extern pgd_t swapper_pg_dir[]; · 73 unmodified lines
86#define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1)87#define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1)
87#define VMALLOC_END (PAGE_OFFSET - 1)88#define VMALLOC_END (PAGE_OFFSET - 1)
88#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)89#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
90#define PCI_IO_SIZE SZ_16M
89 91
90/*92/*
91 * Roughly size the vmemmap space to be large enough to fit enough93 * 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
100 102
101#define vmemmap ((struct page *)VMEMMAP_START)103#define vmemmap ((struct page *)VMEMMAP_START)
102 104
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
104#ifdef CONFIG_64BIT109#ifdef CONFIG_64BIT
105#define FIXADDR_SIZE PMD_SIZE110#define FIXADDR_SIZE PMD_SIZE
106#else111#else
arch/riscv/include/asm/switch_to.h+1−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
6#ifndef _ASM_RISCV_SWITCH_TO_H6#ifndef _ASM_RISCV_SWITCH_TO_H
7#define _ASM_RISCV_SWITCH_TO_H7#define _ASM_RISCV_SWITCH_TO_H
8 8
9#include <linux/sched/task_stack.h>
9#include <asm/processor.h>10#include <asm/processor.h>
10#include <asm/ptrace.h>11#include <asm/ptrace.h>
11#include <asm/csr.h>12#include <asm/csr.h>
arch/riscv/kernel/cpufeature.c+1−0
@@ -10,6 +10,7 @@ · 9 unmodified lines
10#include <asm/processor.h>10#include <asm/processor.h>
11#include <asm/hwcap.h>11#include <asm/hwcap.h>
12#include <asm/smp.h>12#include <asm/smp.h>
13#include <asm/switch_to.h>
13 14
14unsigned long elf_hwcap __read_mostly;15unsigned long elf_hwcap __read_mostly;
15#ifdef CONFIG_FPU16#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
11extern atomic_t hart_lottery;
12
13asmlinkage void do_page_fault(struct pt_regs *regs);
14asmlinkage void __init setup_vm(uintptr_t dtb_pa);
15
16extern void *__cpu_up_stack_pointer[];
17extern void *__cpu_up_task_pointer[];
18
19void __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
24 return 0;24 return 0;
25}25}
26 26
27asmlinkage void __irq_entry do_IRQ(struct pt_regs *regs)27asmlinkage __visible void __irq_entry do_IRQ(struct pt_regs *regs)
28{28{
29 struct pt_regs *old_regs = set_irq_regs(regs);29 struct pt_regs *old_regs = set_irq_regs(regs);
30 30
arch/riscv/kernel/module-sections.c+1−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
8#include <linux/elf.h>8#include <linux/elf.h>
9#include <linux/kernel.h>9#include <linux/kernel.h>
10#include <linux/module.h>10#include <linux/module.h>
11#include <linux/moduleloader.h>
11 12
12unsigned long module_emit_got_entry(struct module *mod, unsigned long val)13unsigned long module_emit_got_entry(struct module *mod, unsigned long val)
13{14{
arch/riscv/kernel/process.c+2−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
7 * Copyright (C) 2017 SiFive7 * Copyright (C) 2017 SiFive
8 */8 */
9 9
10#include <linux/cpu.h>
10#include <linux/kernel.h>11#include <linux/kernel.h>
11#include <linux/sched.h>12#include <linux/sched.h>
12#include <linux/sched/task_stack.h>13#include <linux/sched/task_stack.h>
@@ -19,6 +20,7 @@ · 6 unmodified lines
19#include <asm/csr.h>20#include <asm/csr.h>
20#include <asm/string.h>21#include <asm/string.h>
21#include <asm/switch_to.h>22#include <asm/switch_to.h>
23#include <asm/thread_info.h>
22 24
23extern asmlinkage void ret_from_fork(void);25extern asmlinkage void ret_from_fork(void);
24extern asmlinkage void ret_from_kernel_thread(void);26extern 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
148 * Allows PTRACE_SYSCALL to work. These are called from entry.S in148 * Allows PTRACE_SYSCALL to work. These are called from entry.S in
149 * {handle,ret_from}_syscall.149 * {handle,ret_from}_syscall.
150 */150 */
151void do_syscall_trace_enter(struct pt_regs *regs)151__visible void do_syscall_trace_enter(struct pt_regs *regs)
152{152{
153 if (test_thread_flag(TIF_SYSCALL_TRACE))153 if (test_thread_flag(TIF_SYSCALL_TRACE))
154 if (tracehook_report_syscall_entry(regs))154 if (tracehook_report_syscall_entry(regs))
@@ -162,7 +162,7 @@ void do_syscall_trace_enter(struct pt_regs *regs) · 7 unmodified lines
162 audit_syscall_entry(regs->a7, regs->a0, regs->a1, regs->a2, regs->a3);162 audit_syscall_entry(regs->a7, regs->a0, regs->a1, regs->a2, regs->a3);
163}163}
164 164
165void do_syscall_trace_exit(struct pt_regs *regs)165__visible void do_syscall_trace_exit(struct pt_regs *regs)
166{166{
167 audit_syscall_exit(regs);167 audit_syscall_exit(regs);
168 168
arch/riscv/kernel/reset.c+1−0
@@ -4,6 +4,7 @@ · 3 unmodified lines
4 */4 */
5 5
6#include <linux/reboot.h>6#include <linux/reboot.h>
7#include <linux/pm.h>
7#include <asm/sbi.h>8#include <asm/sbi.h>
8 9
9static void default_power_off(void)10static void default_power_off(void)
arch/riscv/kernel/setup.c+2−0
@@ -24,6 +24,8 @@ · 23 unmodified lines
24#include <asm/tlbflush.h>24#include <asm/tlbflush.h>
25#include <asm/thread_info.h>25#include <asm/thread_info.h>
26 26
27#include "head.h"
28
27#ifdef CONFIG_DUMMY_CONSOLE29#ifdef CONFIG_DUMMY_CONSOLE
28struct screen_info screen_info = {30struct screen_info screen_info = {
29 .orig_video_lines = 30,31 .orig_video_lines = 30,
arch/riscv/kernel/signal.c+4−4
@@ -26,7 +26,7 @@ struct rt_sigframe { · 25 unmodified lines
26 26
27#ifdef CONFIG_FPU27#ifdef CONFIG_FPU
28static long restore_fp_state(struct pt_regs *regs,28static long restore_fp_state(struct pt_regs *regs,
29 union __riscv_fp_state *sc_fpregs)29 union __riscv_fp_state __user *sc_fpregs)
30{30{
31 long err;31 long err;
32 struct __riscv_d_ext_state __user *state = &sc_fpregs->d;32 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
53}53}
54 54
55static long save_fp_state(struct pt_regs *regs,55static long save_fp_state(struct pt_regs *regs,
56 union __riscv_fp_state *sc_fpregs)56 union __riscv_fp_state __user *sc_fpregs)
57{57{
58 long err;58 long err;
59 struct __riscv_d_ext_state __user *state = &sc_fpregs->d;59 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
292 * notification of userspace execution resumption292 * notification of userspace execution resumption
293 * - triggered by the _TIF_WORK_MASK flags293 * - triggered by the _TIF_WORK_MASK flags
294 */294 */
295asmlinkage void do_notify_resume(struct pt_regs *regs,295asmlinkage __visible void do_notify_resume(struct pt_regs *regs,
296 unsigned long thread_info_flags)296 unsigned long thread_info_flags)
297{297{
298 /* Handle pending signal delivery */298 /* Handle pending signal delivery */
299 if (thread_info_flags & _TIF_SIGPENDING)299 if (thread_info_flags & _TIF_SIGPENDING)
arch/riscv/kernel/smp.c+2−0
@@ -8,7 +8,9 @@ · 7 unmodified lines
8 * Copyright (C) 2017 SiFive8 * Copyright (C) 2017 SiFive
9 */9 */
10 10
11#include <linux/cpu.h>
11#include <linux/interrupt.h>12#include <linux/interrupt.h>
13#include <linux/profile.h>
12#include <linux/smp.h>14#include <linux/smp.h>
13#include <linux/sched.h>15#include <linux/sched.h>
14#include <linux/seq_file.h>16#include <linux/seq_file.h>
arch/riscv/kernel/smpboot.c+4−1
@@ -29,6 +29,9 @@ · 28 unmodified lines
29#include <asm/tlbflush.h>29#include <asm/tlbflush.h>
30#include <asm/sections.h>30#include <asm/sections.h>
31#include <asm/sbi.h>31#include <asm/sbi.h>
32#include <asm/smp.h>
33
34#include "head.h"
32 35
33void *__cpu_up_stack_pointer[NR_CPUS];36void *__cpu_up_stack_pointer[NR_CPUS];
34void *__cpu_up_task_pointer[NR_CPUS];37void *__cpu_up_task_pointer[NR_CPUS];
@@ -130,7 +133,7 @@ void __init smp_cpus_done(unsigned int max_cpus) · 95 unmodified lines
130/*133/*
131 * C entry point for a secondary processor.134 * C entry point for a secondary processor.
132 */135 */
133asmlinkage void __init smp_callin(void)136asmlinkage __visible void __init smp_callin(void)
134{137{
135 struct mm_struct *mm = &init_mm;138 struct mm_struct *mm = &init_mm;
136 139
arch/riscv/kernel/syscall_table.c+1−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
8#include <linux/syscalls.h>8#include <linux/syscalls.h>
9#include <asm-generic/syscalls.h>9#include <asm-generic/syscalls.h>
10#include <asm/vdso.h>10#include <asm/vdso.h>
11#include <asm/syscall.h>
11 12
12#undef __SYSCALL13#undef __SYSCALL
13#define __SYSCALL(nr, call) [nr] = (call),14#define __SYSCALL(nr, call) [nr] = (call),
arch/riscv/kernel/time.c+1−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
7#include <linux/clocksource.h>7#include <linux/clocksource.h>
8#include <linux/delay.h>8#include <linux/delay.h>
9#include <asm/sbi.h>9#include <asm/sbi.h>
10#include <asm/processor.h>
10 11
11unsigned long riscv_timebase;12unsigned long riscv_timebase;
12EXPORT_SYMBOL_GPL(riscv_timebase);13EXPORT_SYMBOL_GPL(riscv_timebase);
arch/riscv/kernel/traps.c+3−2
@@ -3,6 +3,7 @@ · 2 unmodified lines
3 * Copyright (C) 2012 Regents of the University of California3 * Copyright (C) 2012 Regents of the University of California
4 */4 */
5 5
6#include <linux/cpu.h>
6#include <linux/kernel.h>7#include <linux/kernel.h>
7#include <linux/init.h>8#include <linux/init.h>
8#include <linux/sched.h>9#include <linux/sched.h>
@@ -83,7 +84,7 @@ static void do_trap_error(struct pt_regs *regs, int signo, int code, · 74 unmodified lines
83}84}
84 85
85#define DO_ERROR_INFO(name, signo, code, str) \86#define DO_ERROR_INFO(name, signo, code, str) \
86asmlinkage void name(struct pt_regs *regs) \87asmlinkage __visible void name(struct pt_regs *regs) \
87{ \88{ \
88 do_trap_error(regs, signo, code, regs->sepc, "Oops - " str); \89 do_trap_error(regs, signo, code, regs->sepc, "Oops - " str); \
89}90}
@@ -120,7 +121,7 @@ static inline unsigned long get_break_insn_length(unsigned long pc) · 30 unmodified lines
120 return (((insn & __INSN_LENGTH_MASK) == __INSN_LENGTH_32) ? 4UL : 2UL);121 return (((insn & __INSN_LENGTH_MASK) == __INSN_LENGTH_32) ? 4UL : 2UL);
121}122}
122 123
123asmlinkage void do_trap_break(struct pt_regs *regs)124asmlinkage __visible void do_trap_break(struct pt_regs *regs)
124{125{
125 if (user_mode(regs))126 if (user_mode(regs))
126 force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->sepc);127 force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->sepc);
arch/riscv/kernel/vdso.c+2−1
@@ -6,6 +6,7 @@ · 5 unmodified lines
6 * Copyright (C) 2015 Regents of the University of California6 * Copyright (C) 2015 Regents of the University of California
7 */7 */
8 8
9#include <linux/elf.h>
9#include <linux/mm.h>10#include <linux/mm.h>
10#include <linux/slab.h>11#include <linux/slab.h>
11#include <linux/binfmts.h>12#include <linux/binfmts.h>
@@ -25,7 +26,7 @@ static union { · 13 unmodified lines
25 struct vdso_data data;26 struct vdso_data data;
26 u8 page[PAGE_SIZE];27 u8 page[PAGE_SIZE];
27} vdso_data_store __page_aligned_data;28} vdso_data_store __page_aligned_data;
28struct vdso_data *vdso_data = &vdso_data_store.data;29static struct vdso_data *vdso_data = &vdso_data_store.data;
29 30
30static int __init vdso_init(void)31static int __init vdso_init(void)
31{32{
arch/riscv/mm/context.c+1−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
7#include <linux/mm.h>7#include <linux/mm.h>
8#include <asm/tlbflush.h>8#include <asm/tlbflush.h>
9#include <asm/cacheflush.h>9#include <asm/cacheflush.h>
10#include <asm/mmu_context.h>
10 11
11/*12/*
12 * When necessary, performs a deferred icache flush for the given MM context,13 * 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
18#include <asm/ptrace.h>18#include <asm/ptrace.h>
19#include <asm/tlbflush.h>19#include <asm/tlbflush.h>
20 20
21#include "../kernel/head.h"
22
21/*23/*
22 * This routine handles page faults. It determines the address and the24 * This routine handles page faults. It determines the address and the
23 * problem, and then passes it off to one of the appropriate routines.25 * 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
19#include <asm/pgtable.h>19#include <asm/pgtable.h>
20#include <asm/io.h>20#include <asm/io.h>
21 21
22#include "../kernel/head.h"
23
22unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]24unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]
23 __page_aligned_bss;25 __page_aligned_bss;
24EXPORT_SYMBOL(empty_zero_page);26EXPORT_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
337 */339 */
338 340
339#ifndef __riscv_cmodel_medany341#ifndef __riscv_cmodel_medany
340#error "setup_vm() is called from head.S before relocate so it should "342#error "setup_vm() is called from head.S before relocate so it should not use absolute addressing."
341 "not use absolute addressing."
342#endif343#endif
343 344
344asmlinkage void __init setup_vm(uintptr_t dtb_pa)345asmlinkage 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
142 return IRQ_HANDLED;142 return IRQ_HANDLED;
143}143}
144 144
145int __init sifive_l2_init(void)145static int __init sifive_l2_init(void)
146{146{
147 struct device_node *np;147 struct device_node *np;
148 struct resource res;148 struct resource res;
arch/s390/include/asm/unwind.h+1−0
@@ -35,6 +35,7 @@ struct unwind_state { · 34 unmodified lines
35 struct task_struct *task;35 struct task_struct *task;
36 struct pt_regs *regs;36 struct pt_regs *regs;
37 unsigned long sp, ip;37 unsigned long sp, ip;
38 bool reuse_sp;
38 int graph_idx;39 int graph_idx;
39 bool reliable;40 bool reliable;
40 bool error;41 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
69static ssize_t show_idle_time(struct device *dev,69static ssize_t show_idle_time(struct device *dev,
70 struct device_attribute *attr, char *buf)70 struct device_attribute *attr, char *buf)
71{71{
72 unsigned long long now, idle_time, idle_enter, idle_exit, in_idle;
72 struct s390_idle_data *idle = &per_cpu(s390_idle, dev->id);73 struct s390_idle_data *idle = &per_cpu(s390_idle, dev->id);
73 unsigned long long now, idle_time, idle_enter, idle_exit;
74 unsigned int seq;74 unsigned int seq;
75 75
76 do {76 do {
77 now = get_tod_clock();
78 seq = read_seqcount_begin(&idle->seqcount);77 seq = read_seqcount_begin(&idle->seqcount);
79 idle_time = READ_ONCE(idle->idle_time);78 idle_time = READ_ONCE(idle->idle_time);
80 idle_enter = READ_ONCE(idle->clock_idle_enter);79 idle_enter = READ_ONCE(idle->clock_idle_enter);
81 idle_exit = READ_ONCE(idle->clock_idle_exit);80 idle_exit = READ_ONCE(idle->clock_idle_exit);
82 } while (read_seqcount_retry(&idle->seqcount, seq));81 } 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;
84 return sprintf(buf, "%llu\n", idle_time >> 12);92 return sprintf(buf, "%llu\n", idle_time >> 12);
85}93}
86DEVICE_ATTR(idle_time_us, 0444, show_idle_time, NULL);94DEVICE_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
88u64 arch_cpu_idle_time(int cpu)96u64 arch_cpu_idle_time(int cpu)
89{97{
90 struct s390_idle_data *idle = &per_cpu(s390_idle, cpu);98 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;
92 unsigned int seq;100 unsigned int seq;
93 101
94 do {102 do {
95 now = get_tod_clock();
96 seq = read_seqcount_begin(&idle->seqcount);103 seq = read_seqcount_begin(&idle->seqcount);
97 idle_enter = READ_ONCE(idle->clock_idle_enter);104 idle_enter = READ_ONCE(idle->clock_idle_enter);
98 idle_exit = READ_ONCE(idle->clock_idle_exit);105 idle_exit = READ_ONCE(idle->clock_idle_exit);
99 } while (read_seqcount_retry(&idle->seqcount, seq));106 } while (read_seqcount_retry(&idle->seqcount, seq));
100 107 in_idle = 0;
101 return cputime_to_nsecs(idle_enter ? ((idle_exit ?: now) - idle_enter) : 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);
102}117}
103 118
104void arch_cpu_idle_enter(void)119void 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
46 46
47 regs = state->regs;47 regs = state->regs;
48 if (unlikely(regs)) {48 if (unlikely(regs)) {
49 sp = READ_ONCE_NOCHECK(regs->gprs[15]);49 if (state->reuse_sp) {
50 if (unlikely(outside_of_stack(state, sp))) {50 sp = state->sp;
51 if (!update_stack_info(state, sp))51 state->reuse_sp = false;
52 goto out_err;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 }
53 }58 }
54 sf = (struct stack_frame *) sp;59 sf = (struct stack_frame *) sp;
55 ip = READ_ONCE_NOCHECK(sf->gprs[8]);60 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
107{112{
108 struct stack_info *info = &state->stack_info;113 struct stack_info *info = &state->stack_info;
109 unsigned long *mask = &state->stack_mask;114 unsigned long *mask = &state->stack_mask;
115 bool reliable, reuse_sp;
110 struct stack_frame *sf;116 struct stack_frame *sf;
111 unsigned long ip;117 unsigned long ip;
112 bool reliable;
113 118
114 memset(state, 0, sizeof(*state));119 memset(state, 0, sizeof(*state));
115 state->task = task;120 state->task = task;
@@ -134,10 +139,12 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task, · 18 unmodified lines
134 if (regs) {139 if (regs) {
135 ip = READ_ONCE_NOCHECK(regs->psw.addr);140 ip = READ_ONCE_NOCHECK(regs->psw.addr);
136 reliable = true;141 reliable = true;
142 reuse_sp = true;
137 } else {143 } else {
138 sf = (struct stack_frame *) sp;144 sf = (struct stack_frame *) sp;
139 ip = READ_ONCE_NOCHECK(sf->gprs[8]);145 ip = READ_ONCE_NOCHECK(sf->gprs[8]);
140 reliable = false;146 reliable = false;
147 reuse_sp = false;
141 }148 }
142 149
143#ifdef CONFIG_FUNCTION_GRAPH_TRACER150#ifdef CONFIG_FUNCTION_GRAPH_TRACER
@@ -151,5 +158,6 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task, · 7 unmodified lines
151 state->sp = sp;158 state->sp = sp;
152 state->ip = ip;159 state->ip = ip;
153 state->reliable = reliable;160 state->reliable = reliable;
161 state->reuse_sp = reuse_sp;
154}162}
155EXPORT_SYMBOL_GPL(__unwind_start);163EXPORT_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
298 }298 }
299 299
300 if (write) {300 if (write) {
301 len = *lenp;301 len = min(*lenp, sizeof(buf));
302 if (copy_from_user(buf, buffer,302 if (copy_from_user(buf, buffer, len))
303 len > sizeof(buf) ? sizeof(buf) : len))
304 return -EFAULT;303 return -EFAULT;
305 buf[sizeof(buf) - 1] = '\0';304 buf[len - 1] = '\0';
306 cmm_skip_blanks(buf, &p);305 cmm_skip_blanks(buf, &p);
307 nr = simple_strtoul(p, &p, 0);306 nr = simple_strtoul(p, &p, 0);
308 cmm_skip_blanks(p, &p);307 cmm_skip_blanks(p, &p);
309 seconds = simple_strtoul(p, &p, 0);308 seconds = simple_strtoul(p, &p, 0);
310 cmm_set_timeout(nr, seconds);309 cmm_set_timeout(nr, seconds);
310 *ppos += *lenp;
311 } else {311 } else {
312 len = sprintf(buf, "%ld %ld\n",312 len = sprintf(buf, "%ld %ld\n",
313 cmm_timeout_pages, cmm_timeout_seconds);313 cmm_timeout_pages, cmm_timeout_seconds);
@@ -315,9 +315,9 @@ static int cmm_timeout_handler(struct ctl_table *ctl, int write, · 1 unmodified line
315 len = *lenp;315 len = *lenp;
316 if (copy_to_user(buffer, buf, len))316 if (copy_to_user(buffer, buf, len))
317 return -EFAULT;317 return -EFAULT;
318 *lenp = len;
319 *ppos += len;
318 }320 }
319 *lenp = len;
320 *ppos += len;
321 return 0;321 return 0;
322}322}
323 323
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
1403 1403
1404 spin_unlock_irq(&ubd_dev->lock);1404 spin_unlock_irq(&ubd_dev->lock);
1405 1405
1406 if (ret < 0)1406 if (ret < 0) {
1407 blk_mq_requeue_request(req, true);1407 if (ret == -ENOMEM)
1408 res = BLK_STS_RESOURCE;
1409 else
1410 res = BLK_STS_DEV_RESOURCE;
1411 }
1408 1412
1409 return res;1413 return res;
1410}1414}
arch/x86/boot/compressed/eboot.c+3−1
@@ -13,6 +13,7 @@ · 12 unmodified lines
13#include <asm/e820/types.h>13#include <asm/e820/types.h>
14#include <asm/setup.h>14#include <asm/setup.h>
15#include <asm/desc.h>15#include <asm/desc.h>
16#include <asm/boot.h>
16 17
17#include "../string.h"18#include "../string.h"
18#include "eboot.h"19#include "eboot.h"
@@ -813,7 +814,8 @@ efi_main(struct efi_config *c, struct boot_params *boot_params) · 794 unmodified lines
813 status = efi_relocate_kernel(sys_table, &bzimage_addr,814 status = efi_relocate_kernel(sys_table, &bzimage_addr,
814 hdr->init_size, hdr->init_size,815 hdr->init_size, hdr->init_size,
815 hdr->pref_address,816 hdr->pref_address,
816 hdr->kernel_alignment);817 hdr->kernel_alignment,
818 LOAD_PHYSICAL_ADDR);
817 if (status != EFI_SUCCESS) {819 if (status != EFI_SUCCESS) {
818 efi_printk(sys_table, "efi_relocate_kernel() failed!\n");820 efi_printk(sys_table, "efi_relocate_kernel() failed!\n");
819 goto fail;821 goto fail;
arch/x86/kernel/apic/apic.c+15−13
@@ -1586,9 +1586,6 @@ static void setup_local_APIC(void) · 1585 unmodified lines
1586{1586{
1587 int cpu = smp_processor_id();1587 int cpu = smp_processor_id();
1588 unsigned int value;1588 unsigned int value;
1589#ifdef CONFIG_X86_32
1590 int logical_apicid, ldr_apicid;
1591#endif
1592 1589
1593 if (disable_apic) {1590 if (disable_apic) {
1594 disable_ioapic_support();1591 disable_ioapic_support();
@@ -1626,16 +1623,21 @@ static void setup_local_APIC(void) · 31 unmodified lines
1626 apic->init_apic_ldr();1623 apic->init_apic_ldr();
1627 1624
1628#ifdef CONFIG_X86_321625#ifdef CONFIG_X86_32
1629 /*1626 if (apic->dest_logical) {
1630 * APIC LDR is initialized. If logical_apicid mapping was1627 int logical_apicid, ldr_apicid;
1631 * initialized during get_smp_config(), make sure it matches the1628
1632 * actual value.1629 /*
1633 */1630 * APIC LDR is initialized. If logical_apicid mapping was
1634 logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);1631 * initialized during get_smp_config(), make sure it matches
1635 ldr_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));1632 * the actual value.
1636 WARN_ON(logical_apicid != BAD_APICID && logical_apicid != ldr_apicid);1633 */
1637 /* always use the value from LDR */1634 logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
1638 early_per_cpu(x86_cpu_to_logical_apicid, cpu) = ldr_apicid;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 }
1639#endif1641#endif
1640 1642
1641 /*1643 /*
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
522 int ret = 0;522 int ret = 0;
523 523
524 rdtgrp = rdtgroup_kn_lock_live(of->kn);524 rdtgrp = rdtgroup_kn_lock_live(of->kn);
525 if (!rdtgrp) {
526 ret = -ENOENT;
527 goto out;
528 }
525 529
526 md.priv = of->kn->priv;530 md.priv = of->kn->priv;
527 resid = md.u.rid;531 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
94 BUILD_BUG_ON(N_EXCEPTION_STACKS != 6);94 BUILD_BUG_ON(N_EXCEPTION_STACKS != 6);
95 95
96 begin = (unsigned long)__this_cpu_read(cea_exception_stacks);96 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
97 end = begin + sizeof(struct cea_exception_stacks);104 end = begin + sizeof(struct cea_exception_stacks);
98 /* Bail if @stack is outside the exception stack area. */105 /* Bail if @stack is outside the exception stack area. */
99 if (stk < begin || stk >= end)106 if (stk < begin || stk >= end)
arch/x86/kernel/tsc.c+3−0
@@ -1505,6 +1505,9 @@ void __init tsc_init(void) · 1504 unmodified lines
1505 return;1505 return;
1506 }1506 }
1507 1507
1508 if (tsc_clocksource_reliable || no_tsc_watchdog)
1509 clocksource_tsc_early.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
1510
1508 clocksource_register_khz(&clocksource_tsc_early, tsc_khz);1511 clocksource_register_khz(&clocksource_tsc_early, tsc_khz);
1509 detect_art();1512 detect_art();
1510}1513}
arch/x86/kvm/svm.c+8−2
@@ -734,8 +734,14 @@ static int get_npt_level(struct kvm_vcpu *vcpu) · 733 unmodified lines
734static void svm_set_efer(struct kvm_vcpu *vcpu, u64 efer)734static void svm_set_efer(struct kvm_vcpu *vcpu, u64 efer)
735{735{
736 vcpu->arch.efer = efer;736 vcpu->arch.efer = efer;
737 if (!npt_enabled && !(efer & EFER_LMA))737
738 efer &= ~EFER_LME;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 }
739 745
740 to_svm(vcpu)->vmcb->save.efer = efer | EFER_SVME;746 to_svm(vcpu)->vmcb->save.efer = efer | EFER_SVME;
741 mark_dirty(to_svm(vcpu)->vmcb, VMCB_CR);747 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
969 u64 guest_efer = vmx->vcpu.arch.efer;969 u64 guest_efer = vmx->vcpu.arch.efer;
970 u64 ignore_bits = 0;970 u64 ignore_bits = 0;
971 971
972 if (!enable_ept) {972 /* Shadow paging assumes NX to be available. */
973 /*973 if (!enable_ept)
974 * NX is needed to handle CR0.WP=1, CR4.SMEP=1. Testing974 guest_efer |= EFER_NX;
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 }
983 975
984 /*976 /*
985 * LMA and LME handled by hardware; SCE meaningless outside long mode.977 * 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
934 int i;934 int i;
935 bool has_stats = false;935 bool has_stats = false;
936 936
937 spin_lock_irq(&blkg->q->queue_lock);
938
939 if (!blkg->online)
940 goto skip;
941
937 dname = blkg_dev_name(blkg);942 dname = blkg_dev_name(blkg);
938 if (!dname)943 if (!dname)
939 continue;944 goto skip;
940 945
941 /*946 /*
942 * Hooray string manipulation, count is the size written NOT947 * 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
946 */951 */
947 off += scnprintf(buf+off, size-off, "%s ", dname);952 off += scnprintf(buf+off, size-off, "%s ", dname);
948 953
949 spin_lock_irq(&blkg->q->queue_lock);
950
951 blkg_rwstat_recursive_sum(blkg, NULL,954 blkg_rwstat_recursive_sum(blkg, NULL,
952 offsetof(struct blkcg_gq, stat_bytes), &rwstat);955 offsetof(struct blkcg_gq, stat_bytes), &rwstat);
953 rbytes = rwstat.cnt[BLKG_RWSTAT_READ];956 rbytes = rwstat.cnt[BLKG_RWSTAT_READ];
@@ -960,8 +963,6 @@ static int blkcg_print_stat(struct seq_file *sf, void *v) · 6 unmodified lines
960 wios = rwstat.cnt[BLKG_RWSTAT_WRITE];963 wios = rwstat.cnt[BLKG_RWSTAT_WRITE];
961 dios = rwstat.cnt[BLKG_RWSTAT_DISCARD];964 dios = rwstat.cnt[BLKG_RWSTAT_DISCARD];
962 965
963 spin_unlock_irq(&blkg->q->queue_lock);
964
965 if (rbytes || wbytes || rios || wios) {966 if (rbytes || wbytes || rios || wios) {
966 has_stats = true;967 has_stats = true;
967 off += scnprintf(buf+off, size-off,968 off += scnprintf(buf+off, size-off,
@@ -999,6 +1000,8 @@ static int blkcg_print_stat(struct seq_file *sf, void *v) · 31 unmodified lines
999 seq_commit(sf, -1);1000 seq_commit(sf, -1);
1000 }1001 }
1001 }1002 }
1003 skip:
1004 spin_unlock_irq(&blkg->q->queue_lock);
1002 }1005 }
1003 1006
1004 rcu_read_unlock();1007 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
2110 goto einval;2110 goto einval;
2111 }2111 }
2112 2112
2113 spin_lock_irq(&iocg->ioc->lock);2113 spin_lock(&iocg->ioc->lock);
2114 iocg->cfg_weight = v;2114 iocg->cfg_weight = v;
2115 weight_updated(iocg);2115 weight_updated(iocg);
2116 spin_unlock_irq(&iocg->ioc->lock);2116 spin_unlock(&iocg->ioc->lock);
2117 2117
2118 blkg_conf_finish(&ctx);2118 blkg_conf_finish(&ctx);
2119 return nbytes;2119 return nbytes;
drivers/acpi/processor_perflib.c+21−13
@@ -159,26 +159,34 @@ void acpi_processor_ignore_ppc_init(void) · 158 unmodified lines
159 159
160void acpi_processor_ppc_init(struct cpufreq_policy *policy)160void acpi_processor_ppc_init(struct cpufreq_policy *policy)
161{161{
162 int cpu = policy->cpu;162 unsigned int cpu;
163 struct acpi_processor *pr = per_cpu(processors, cpu);
164 int ret;
165 163
166 if (!pr)164 for_each_cpu(cpu, policy->related_cpus) {
167 return;165 struct acpi_processor *pr = per_cpu(processors, cpu);
166 int ret;
167
168 if (!pr)
169 continue;
168 170
169 ret = freq_qos_add_request(&policy->constraints, &pr->perflib_req,171 ret = freq_qos_add_request(&policy->constraints,
170 FREQ_QOS_MAX, INT_MAX);172 &pr->perflib_req,
171 if (ret < 0)173 FREQ_QOS_MAX, INT_MAX);
172 pr_err("Failed to add freq constraint for CPU%d (%d)\n", cpu,174 if (ret < 0)
173 ret);175 pr_err("Failed to add freq constraint for CPU%d (%d)\n",
176 cpu, ret);
177 }
174}178}
175 179
176void acpi_processor_ppc_exit(struct cpufreq_policy *policy)180void acpi_processor_ppc_exit(struct cpufreq_policy *policy)
177{181{
178 struct acpi_processor *pr = per_cpu(processors, policy->cpu);182 unsigned int cpu;
179 183
180 if (pr)184 for_each_cpu(cpu, policy->related_cpus) {
181 freq_qos_remove_request(&pr->perflib_req);185 struct acpi_processor *pr = per_cpu(processors, cpu);
186
187 if (pr)
188 freq_qos_remove_request(&pr->perflib_req);
189 }
182}190}
183 191
184static int acpi_processor_get_performance_control(struct acpi_processor *pr)192static 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
127 127
128void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy)128void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy)
129{129{
130 int cpu = policy->cpu;130 unsigned int cpu;
131 struct acpi_processor *pr = per_cpu(processors, cpu);
132 int ret;
133 131
134 if (!pr)132 for_each_cpu(cpu, policy->related_cpus) {
135 return;133 struct acpi_processor *pr = per_cpu(processors, cpu);
134 int ret;
135
136 if (!pr)
137 continue;
136 138
137 ret = freq_qos_add_request(&policy->constraints, &pr->thermal_req,139 ret = freq_qos_add_request(&policy->constraints,
138 FREQ_QOS_MAX, INT_MAX);140 &pr->thermal_req,
139 if (ret < 0)141 FREQ_QOS_MAX, INT_MAX);
140 pr_err("Failed to add freq constraint for CPU%d (%d)\n", cpu,142 if (ret < 0)
141 ret);143 pr_err("Failed to add freq constraint for CPU%d (%d)\n",
144 cpu, ret);
145 }
142}146}
143 147
144void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy)148void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy)
145{149{
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);
147 154
148 if (pr)155 if (pr)
149 freq_qos_remove_request(&pr->thermal_req);156 freq_qos_remove_request(&pr->thermal_req);
157 }
150}158}
151#else /* ! CONFIG_CPU_FREQ */159#else /* ! CONFIG_CPU_FREQ */
152static int cpufreq_get_max_state(unsigned int cpu)160static 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
786 786
787 if (nc->tentative && connection->agreed_pro_version < 92) {787 if (nc->tentative && connection->agreed_pro_version < 92) {
788 rcu_read_unlock();788 rcu_read_unlock();
789 mutex_unlock(&sock->mutex);
790 drbd_err(connection, "--dry-run is not supported by peer");789 drbd_err(connection, "--dry-run is not supported by peer");
791 return -EOPNOTSUPP;790 return -EOPNOTSUPP;
792 }791 }
drivers/clk/at91/clk-main.c+4−1
@@ -297,7 +297,10 @@ static int clk_main_probe_frequency(struct regmap *regmap) · 296 unmodified lines
297 regmap_read(regmap, AT91_CKGR_MCFR, &mcfr);297 regmap_read(regmap, AT91_CKGR_MCFR, &mcfr);
298 if (mcfr & AT91_PMC_MAINRDY)298 if (mcfr & AT91_PMC_MAINRDY)
299 return 0;299 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);
301 } while (time_before(prep_time, timeout));304 } while (time_before(prep_time, timeout));
302 305
303 return -ETIMEDOUT;306 return -ETIMEDOUT;
drivers/clk/at91/sam9x60.c+1−0
@@ -43,6 +43,7 @@ static const struct clk_pll_characteristics upll_characteristics = { · 42 unmodified lines
43};43};
44 44
45static const struct clk_programmable_layout sam9x60_programmable_layout = {45static const struct clk_programmable_layout sam9x60_programmable_layout = {
46 .pres_mask = 0xff,
46 .pres_shift = 8,47 .pres_shift = 8,
47 .css_mask = 0x1f,48 .css_mask = 0x1f,
48 .have_slck_mck = 0,49 .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
76 76
77 writel(tmp | osc->bits->cr_osc32en, sckcr);77 writel(tmp | osc->bits->cr_osc32en, sckcr);
78 78
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);
80 83
81 return 0;84 return 0;
82}85}
@@ -187,7 +190,10 @@ static int clk_slow_rc_osc_prepare(struct clk_hw *hw) · 104 unmodified lines
187 190
188 writel(readl(sckcr) | osc->bits->cr_rcen, sckcr);191 writel(readl(sckcr) | osc->bits->cr_rcen, sckcr);
189 192
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);
191 197
192 return 0;198 return 0;
193}199}
@@ -288,7 +294,10 @@ static int clk_sam9x5_slow_set_parent(struct clk_hw *hw, u8 index) · 94 unmodified lines
288 294
289 writel(tmp, sckcr);295 writel(tmp, sckcr);
290 296
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);
292 301
293 return 0;302 return 0;
294}303}
@@ -533,7 +542,10 @@ static int clk_sama5d4_slow_osc_prepare(struct clk_hw *hw) · 238 unmodified lines
533 return 0;542 return 0;
534 }543 }
535 544
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);
537 osc->prepared = true;549 osc->prepared = true;
538 550
539 return 0;551 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
266 266
267 /* Enable clock */267 /* Enable clock */
268 if (gate->flags & CLK_GATE_SET_TO_DISABLE) {268 if (gate->flags & CLK_GATE_SET_TO_DISABLE) {
269 regmap_write(gate->map, get_clock_reg(gate), clk);269 /* Clock is clear to enable, so use set to clear register */
270 } else {
271 /* Use set to clear register */
272 regmap_write(gate->map, get_clock_reg(gate) + 0x04, clk);270 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);
273 }274 }
274 275
275 if (gate->reset_idx >= 0) {276 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
638 clks[IMX8MM_CLK_A53_DIV],638 clks[IMX8MM_CLK_A53_DIV],
639 clks[IMX8MM_CLK_A53_SRC],639 clks[IMX8MM_CLK_A53_SRC],
640 clks[IMX8MM_ARM_PLL_OUT],640 clks[IMX8MM_ARM_PLL_OUT],
641 clks[IMX8MM_CLK_24M]);641 clks[IMX8MM_SYS_PLL1_800M]);
642 642
643 imx_check_clocks(clks, ARRAY_SIZE(clks));643 imx_check_clocks(clks, ARRAY_SIZE(clks));
644 644
drivers/clk/imx/clk-imx8mn.c+1−1
@@ -610,7 +610,7 @@ static int imx8mn_clocks_probe(struct platform_device *pdev) · 609 unmodified lines
610 clks[IMX8MN_CLK_A53_DIV],610 clks[IMX8MN_CLK_A53_DIV],
611 clks[IMX8MN_CLK_A53_SRC],611 clks[IMX8MN_CLK_A53_SRC],
612 clks[IMX8MN_ARM_PLL_OUT],612 clks[IMX8MN_ARM_PLL_OUT],
613 clks[IMX8MN_CLK_24M]);613 clks[IMX8MN_SYS_PLL1_800M]);
614 614
615 imx_check_clocks(clks, ARRAY_SIZE(clks));615 imx_check_clocks(clks, ARRAY_SIZE(clks));
616 616
drivers/clk/meson/g12a.c+11−2
@@ -343,6 +343,7 @@ static struct clk_regmap g12a_cpu_clk_premux0 = { · 342 unmodified lines
343 .offset = HHI_SYS_CPU_CLK_CNTL0,343 .offset = HHI_SYS_CPU_CLK_CNTL0,
344 .mask = 0x3,344 .mask = 0x3,
345 .shift = 0,345 .shift = 0,
346 .flags = CLK_MUX_ROUND_CLOSEST,
346 },347 },
347 .hw.init = &(struct clk_init_data){348 .hw.init = &(struct clk_init_data){
348 .name = "cpu_clk_dyn0_sel",349 .name = "cpu_clk_dyn0_sel",
@@ -353,8 +354,7 @@ static struct clk_regmap g12a_cpu_clk_premux0 = { · 4 unmodified lines
353 { .hw = &g12a_fclk_div3.hw },354 { .hw = &g12a_fclk_div3.hw },
354 },355 },
355 .num_parents = 3,356 .num_parents = 3,
356 /* This sub-tree is used a parking clock */357 .flags = CLK_SET_RATE_PARENT,
357 .flags = CLK_SET_RATE_NO_REPARENT,
358 },358 },
359};359};
360 360
@@ -410,6 +410,7 @@ static struct clk_regmap g12a_cpu_clk_postmux0 = { · 49 unmodified lines
410 .offset = HHI_SYS_CPU_CLK_CNTL0,410 .offset = HHI_SYS_CPU_CLK_CNTL0,
411 .mask = 0x1,411 .mask = 0x1,
412 .shift = 2,412 .shift = 2,
413 .flags = CLK_MUX_ROUND_CLOSEST,
413 },414 },
414 .hw.init = &(struct clk_init_data){415 .hw.init = &(struct clk_init_data){
415 .name = "cpu_clk_dyn0",416 .name = "cpu_clk_dyn0",
@@ -466,6 +467,7 @@ static struct clk_regmap g12a_cpu_clk_dyn = { · 50 unmodified lines
466 .offset = HHI_SYS_CPU_CLK_CNTL0,467 .offset = HHI_SYS_CPU_CLK_CNTL0,
467 .mask = 0x1,468 .mask = 0x1,
468 .shift = 10,469 .shift = 10,
470 .flags = CLK_MUX_ROUND_CLOSEST,
469 },471 },
470 .hw.init = &(struct clk_init_data){472 .hw.init = &(struct clk_init_data){
471 .name = "cpu_clk_dyn",473 .name = "cpu_clk_dyn",
@@ -485,6 +487,7 @@ static struct clk_regmap g12a_cpu_clk = { · 13 unmodified lines
485 .offset = HHI_SYS_CPU_CLK_CNTL0,487 .offset = HHI_SYS_CPU_CLK_CNTL0,
486 .mask = 0x1,488 .mask = 0x1,
487 .shift = 11,489 .shift = 11,
490 .flags = CLK_MUX_ROUND_CLOSEST,
488 },491 },
489 .hw.init = &(struct clk_init_data){492 .hw.init = &(struct clk_init_data){
490 .name = "cpu_clk",493 .name = "cpu_clk",
@@ -504,6 +507,7 @@ static struct clk_regmap g12b_cpu_clk = { · 13 unmodified lines
504 .offset = HHI_SYS_CPU_CLK_CNTL0,507 .offset = HHI_SYS_CPU_CLK_CNTL0,
505 .mask = 0x1,508 .mask = 0x1,
506 .shift = 11,509 .shift = 11,
510 .flags = CLK_MUX_ROUND_CLOSEST,
507 },511 },
508 .hw.init = &(struct clk_init_data){512 .hw.init = &(struct clk_init_data){
509 .name = "cpu_clk",513 .name = "cpu_clk",
@@ -523,6 +527,7 @@ static struct clk_regmap g12b_cpub_clk_premux0 = { · 13 unmodified lines
523 .offset = HHI_SYS_CPUB_CLK_CNTL,527 .offset = HHI_SYS_CPUB_CLK_CNTL,
524 .mask = 0x3,528 .mask = 0x3,
525 .shift = 0,529 .shift = 0,
530 .flags = CLK_MUX_ROUND_CLOSEST,
526 },531 },
527 .hw.init = &(struct clk_init_data){532 .hw.init = &(struct clk_init_data){
528 .name = "cpub_clk_dyn0_sel",533 .name = "cpub_clk_dyn0_sel",
@@ -533,6 +538,7 @@ static struct clk_regmap g12b_cpub_clk_premux0 = { · 4 unmodified lines
533 { .hw = &g12a_fclk_div3.hw },538 { .hw = &g12a_fclk_div3.hw },
534 },539 },
535 .num_parents = 3,540 .num_parents = 3,
541 .flags = CLK_SET_RATE_PARENT,
536 },542 },
537};543};
538 544
@@ -567,6 +573,7 @@ static struct clk_regmap g12b_cpub_clk_postmux0 = { · 28 unmodified lines
567 .offset = HHI_SYS_CPUB_CLK_CNTL,573 .offset = HHI_SYS_CPUB_CLK_CNTL,
568 .mask = 0x1,574 .mask = 0x1,
569 .shift = 2,575 .shift = 2,
576 .flags = CLK_MUX_ROUND_CLOSEST,
570 },577 },
571 .hw.init = &(struct clk_init_data){578 .hw.init = &(struct clk_init_data){
572 .name = "cpub_clk_dyn0",579 .name = "cpub_clk_dyn0",
@@ -644,6 +651,7 @@ static struct clk_regmap g12b_cpub_clk_dyn = { · 71 unmodified lines
644 .offset = HHI_SYS_CPUB_CLK_CNTL,651 .offset = HHI_SYS_CPUB_CLK_CNTL,
645 .mask = 0x1,652 .mask = 0x1,
646 .shift = 10,653 .shift = 10,
654 .flags = CLK_MUX_ROUND_CLOSEST,
647 },655 },
648 .hw.init = &(struct clk_init_data){656 .hw.init = &(struct clk_init_data){
649 .name = "cpub_clk_dyn",657 .name = "cpub_clk_dyn",
@@ -663,6 +671,7 @@ static struct clk_regmap g12b_cpub_clk = { · 13 unmodified lines
663 .offset = HHI_SYS_CPUB_CLK_CNTL,671 .offset = HHI_SYS_CPUB_CLK_CNTL,
664 .mask = 0x1,672 .mask = 0x1,
665 .shift = 11,673 .shift = 11,
674 .flags = CLK_MUX_ROUND_CLOSEST,
666 },675 },
667 .hw.init = &(struct clk_init_data){676 .hw.init = &(struct clk_init_data){
668 .name = "cpub_clk",677 .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
935 &gxbb_sar_adc_clk_sel.hw935 &gxbb_sar_adc_clk_sel.hw
936 },936 },
937 .num_parents = 1,937 .num_parents = 1,
938 .flags = CLK_SET_RATE_PARENT,
938 },939 },
939};940};
940 941
drivers/clk/samsung/clk-exynos5420.c+25−2
@@ -165,12 +165,18 @@ static const unsigned long exynos5x_clk_regs[] __initconst = { · 164 unmodified lines
165 GATE_BUS_CPU,165 GATE_BUS_CPU,
166 GATE_SCLK_CPU,166 GATE_SCLK_CPU,
167 CLKOUT_CMU_CPU,167 CLKOUT_CMU_CPU,
168 CPLL_CON0,
169 DPLL_CON0,
168 EPLL_CON0,170 EPLL_CON0,
169 EPLL_CON1,171 EPLL_CON1,
170 EPLL_CON2,172 EPLL_CON2,
171 RPLL_CON0,173 RPLL_CON0,
172 RPLL_CON1,174 RPLL_CON1,
173 RPLL_CON2,175 RPLL_CON2,
176 IPLL_CON0,
177 SPLL_CON0,
178 VPLL_CON0,
179 MPLL_CON0,
174 SRC_TOP0,180 SRC_TOP0,
175 SRC_TOP1,181 SRC_TOP1,
176 SRC_TOP2,182 SRC_TOP2,
@@ -1172,8 +1178,6 @@ static const struct samsung_gate_clock exynos5x_gate_clks[] __initconst = { · 995 unmodified lines
1172 GATE(CLK_SCLK_ISP_SENSOR2, "sclk_isp_sensor2", "dout_isp_sensor2",1178 GATE(CLK_SCLK_ISP_SENSOR2, "sclk_isp_sensor2", "dout_isp_sensor2",
1173 GATE_TOP_SCLK_ISP, 12, CLK_SET_RATE_PARENT, 0),1179 GATE_TOP_SCLK_ISP, 12, CLK_SET_RATE_PARENT, 0),
1174 1180
1175 GATE(CLK_G3D, "g3d", "mout_user_aclk_g3d", GATE_IP_G3D, 9, 0, 0),
1176
1177 /* CDREX */1181 /* CDREX */
1178 GATE(CLK_CLKM_PHY0, "clkm_phy0", "dout_sclk_cdrex",1182 GATE(CLK_CLKM_PHY0, "clkm_phy0", "dout_sclk_cdrex",
1179 GATE_BUS_CDREX0, 0, 0, 0),1183 GATE_BUS_CDREX0, 0, 0, 0),
@@ -1248,6 +1252,15 @@ static struct exynos5_subcmu_reg_dump exynos5x_gsc_suspend_regs[] = { · 68 unmodified lines
1248 { DIV2_RATIO0, 0, 0x30 }, /* DIV dout_gscl_blk_300 */1252 { DIV2_RATIO0, 0, 0x30 }, /* DIV dout_gscl_blk_300 */
1249};1253};
1250 1254
1255static 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
1259static 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
1251static const struct samsung_div_clock exynos5x_mfc_div_clks[] __initconst = {1264static const struct samsung_div_clock exynos5x_mfc_div_clks[] __initconst = {
1252 DIV(0, "dout_mfc_blk", "mout_user_aclk333", DIV4_RATIO, 0, 2),1265 DIV(0, "dout_mfc_blk", "mout_user_aclk333", DIV4_RATIO, 0, 2),
1253};1266};
@@ -1320,6 +1333,14 @@ static const struct exynos5_subcmu_info exynos5x_gsc_subcmu = { · 66 unmodified lines
1320 .pd_name = "GSC",1333 .pd_name = "GSC",
1321};1334};
1322 1335
1336static 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
1323static const struct exynos5_subcmu_info exynos5x_mfc_subcmu = {1344static const struct exynos5_subcmu_info exynos5x_mfc_subcmu = {
1324 .div_clks = exynos5x_mfc_div_clks,1345 .div_clks = exynos5x_mfc_div_clks,
1325 .nr_div_clks = ARRAY_SIZE(exynos5x_mfc_div_clks),1346 .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
1351static const struct exynos5_subcmu_info *exynos5x_subcmus[] = {1372static const struct exynos5_subcmu_info *exynos5x_subcmus[] = {
1352 &exynos5x_disp_subcmu,1373 &exynos5x_disp_subcmu,
1353 &exynos5x_gsc_subcmu,1374 &exynos5x_gsc_subcmu,
1375 &exynos5x_g3d_subcmu,
1354 &exynos5x_mfc_subcmu,1376 &exynos5x_mfc_subcmu,
1355 &exynos5x_mscl_subcmu,1377 &exynos5x_mscl_subcmu,
1356};1378};
@@ -1358,6 +1380,7 @@ static const struct exynos5_subcmu_info *exynos5x_subcmus[] = { · 1 unmodified line
1358static const struct exynos5_subcmu_info *exynos5800_subcmus[] = {1380static const struct exynos5_subcmu_info *exynos5800_subcmus[] = {
1359 &exynos5x_disp_subcmu,1381 &exynos5x_disp_subcmu,
1360 &exynos5x_gsc_subcmu,1382 &exynos5x_gsc_subcmu,
1383 &exynos5x_g3d_subcmu,
1361 &exynos5x_mfc_subcmu,1384 &exynos5x_mfc_subcmu,
1362 &exynos5x_mscl_subcmu,1385 &exynos5x_mscl_subcmu,
1363 &exynos5800_mau_subcmu,1386 &exynos5800_mau_subcmu,
drivers/clk/samsung/clk-exynos5433.c+12−2
@@ -13,6 +13,7 @@ · 12 unmodified lines
13#include <linux/of_device.h>13#include <linux/of_device.h>
14#include <linux/platform_device.h>14#include <linux/platform_device.h>
15#include <linux/pm_runtime.h>15#include <linux/pm_runtime.h>
16#include <linux/slab.h>
16 17
17#include <dt-bindings/clock/exynos5433.h>18#include <dt-bindings/clock/exynos5433.h>
18 19
@@ -5584,6 +5585,8 @@ static int __init exynos5433_cmu_probe(struct platform_device *pdev) · 5565 unmodified lines
5584 5585
5585 data->clk_save = samsung_clk_alloc_reg_dump(info->clk_regs,5586 data->clk_save = samsung_clk_alloc_reg_dump(info->clk_regs,
5586 info->nr_clk_regs);5587 info->nr_clk_regs);
5588 if (!data->clk_save)
5589 return -ENOMEM;
5587 data->nr_clk_save = info->nr_clk_regs;5590 data->nr_clk_save = info->nr_clk_regs;
5588 data->clk_suspend = info->suspend_regs;5591 data->clk_suspend = info->suspend_regs;
5589 data->nr_clk_suspend = info->nr_suspend_regs;5592 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
5592 if (data->nr_pclks > 0) {5595 if (data->nr_pclks > 0) {
5593 data->pclks = devm_kcalloc(dev, sizeof(struct clk *),5596 data->pclks = devm_kcalloc(dev, sizeof(struct clk *),
5594 data->nr_pclks, GFP_KERNEL);5597 data->nr_pclks, GFP_KERNEL);
5595 5598 if (!data->pclks) {
5599 kfree(data->clk_save);
5600 return -ENOMEM;
5601 }
5596 for (i = 0; i < data->nr_pclks; i++) {5602 for (i = 0; i < data->nr_pclks; i++) {
5597 struct clk *clk = of_clk_get(dev->of_node, i);5603 struct clk *clk = of_clk_get(dev->of_node, i);
5598 5604
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]);
5600 return PTR_ERR(clk);5609 return PTR_ERR(clk);
5610 }
5601 data->pclks[i] = clk;5611 data->pclks[i] = clk;
5602 }5612 }
5603 }5613 }
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
1224 1224
1225 /* Enforce d1 = 0, d2 = 0 for Audio PLL */1225 /* Enforce d1 = 0, d2 = 0 for Audio PLL */
1226 val = readl(reg + SUN9I_A80_PLL_AUDIO_REG);1226 val = readl(reg + SUN9I_A80_PLL_AUDIO_REG);
1227 val &= (BIT(16) & BIT(18));1227 val &= ~(BIT(16) | BIT(18));
1228 writel(val, reg + SUN9I_A80_PLL_AUDIO_REG);1228 writel(val, reg + SUN9I_A80_PLL_AUDIO_REG);
1229 1229
1230 /* Enforce P = 1 for both CPU cluster PLLs */1230 /* 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
1080 rate_hw, rate_ops,1080 rate_hw, rate_ops,
1081 gate_hw, &clk_gate_ops,1081 gate_hw, &clk_gate_ops,
1082 clkflags |1082 clkflags |
1083 data->div[i].critical ?1083 (data->div[i].critical ?
1084 CLK_IS_CRITICAL : 0);1084 CLK_IS_CRITICAL : 0));
1085 1085
1086 WARN_ON(IS_ERR(clk_data->clks[i]));1086 WARN_ON(IS_ERR(clk_data->clks[i]));
1087 }1087 }
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
174 struct clk_init_data init = { NULL };174 struct clk_init_data init = { NULL };
175 const char **parent_names = NULL;175 const char **parent_names = NULL;
176 struct clk *clk;176 struct clk *clk;
177 int ret;
178 177
179 clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);178 clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
180 if (!clk_hw) {179 if (!clk_hw) {
@@ -207,11 +206,6 @@ static void __init of_dra7_atl_clock_setup(struct device_node *node) · 26 unmodified lines
207 clk = ti_clk_register(NULL, &clk_hw->hw, node->name);206 clk = ti_clk_register(NULL, &clk_hw->hw, node->name);
208 207
209 if (!IS_ERR(clk)) {208 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 }
215 of_clk_add_provider(node, of_clk_src_simple_get, clk);209 of_clk_add_provider(node, of_clk_src_simple_get, clk);
216 kfree(parent_names);210 kfree(parent_names);
217 return;211 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
100 * can be from a timer that requires pm_runtime access, which100 * can be from a timer that requires pm_runtime access, which
101 * will eventually bring us here with timekeeping_suspended,101 * will eventually bring us here with timekeeping_suspended,
102 * during both suspend entry and resume paths. This happens102 * 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.
104 */105 */
105 if (unlikely(_early_timeout || timekeeping_suspended)) {106 if (unlikely(_early_timeout || timekeeping_suspended)) {
106 if (time->cycles++ < timeout) {107 if (time->cycles++ < timeout) {
107 udelay(1);108 udelay(1 * 2);
108 return false;109 return false;
109 }110 }
110 } else {111 } 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
328 return 0;328 return 0;
329}329}
330 330
331static const unsigned int sh_mtu2_channel_offsets[] = {
332 0x300, 0x380, 0x000,
333};
334
331static int sh_mtu2_setup_channel(struct sh_mtu2_channel *ch, unsigned int index,335static int sh_mtu2_setup_channel(struct sh_mtu2_channel *ch, unsigned int index,
332 struct sh_mtu2_device *mtu)336 struct sh_mtu2_device *mtu)
333{337{
334 static const unsigned int channel_offsets[] = {
335 0x300, 0x380, 0x000,
336 };
337 char name[6];338 char name[6];
338 int irq;339 int irq;
339 int ret;340 int ret;
@@ -356,7 +357,7 @@ static int sh_mtu2_setup_channel(struct sh_mtu2_channel *ch, unsigned int index, · 16 unmodified lines
356 return ret;357 return ret;
357 }358 }
358 359
359 ch->base = mtu->mapbase + channel_offsets[index];360 ch->base = mtu->mapbase + sh_mtu2_channel_offsets[index];
360 ch->index = index;361 ch->index = index;
361 362
362 return sh_mtu2_register(ch, dev_name(&mtu->pdev->dev));363 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
408 }409 }
409 410
410 /* Allocate and setup the channels. */411 /* 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));
412 418
413 mtu->channels = kcalloc(mtu->num_channels, sizeof(*mtu->channels),419 mtu->channels = kcalloc(mtu->num_channels, sizeof(*mtu->channels),
414 GFP_KERNEL);420 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
268 268
269 ret = timer_of_init(node, &to);269 ret = timer_of_init(node, &to);
270 if (ret)270 if (ret)
271 goto err;271 return ret;
272 272
273 clockevents_config_and_register(&to.clkevt, timer_of_rate(&to),273 clockevents_config_and_register(&to.clkevt, timer_of_rate(&to),
274 TIMER_SYNC_TICKS, 0xffffffff);274 TIMER_SYNC_TICKS, 0xffffffff);
275 275
276 return 0;276 return 0;
277err:
278 timer_of_cleanup(&to);
279 return ret;
280}277}
281 278
282static int __init mtk_gpt_init(struct device_node *node)279static 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
293 290
294 ret = timer_of_init(node, &to);291 ret = timer_of_init(node, &to);
295 if (ret)292 if (ret)
296 goto err;293 return ret;
297 294
298 /* Configure clock source */295 /* Configure clock source */
299 mtk_gpt_setup(&to, TIMER_CLK_SRC, GPT_CTRL_OP_FREERUN);296 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
311 mtk_gpt_enable_irq(&to, TIMER_CLK_EVT);308 mtk_gpt_enable_irq(&to, TIMER_CLK_EVT);
312 309
313 return 0;310 return 0;
314err:
315 timer_of_cleanup(&to);
316 return ret;
317}311}
318TIMER_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_gpt_init);312TIMER_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_gpt_init);
319TIMER_OF_DECLARE(mtk_mt6765, "mediatek,mt6765-timer", mtk_syst_init);313TIMER_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
847 value |= HWP_MAX_PERF(min_perf);847 value |= HWP_MAX_PERF(min_perf);
848 value |= HWP_MIN_PERF(min_perf);848 value |= HWP_MIN_PERF(min_perf);
849 849
850 /* Set EPP/EPB to min */850 /* Set EPP to min */
851 if (boot_cpu_has(X86_FEATURE_HWP_EPP))851 if (boot_cpu_has(X86_FEATURE_HWP_EPP))
852 value |= HWP_ENERGY_PERF_PREFERENCE(HWP_EPP_POWERSAVE);852 value |= HWP_ENERGY_PERF_PREFERENCE(HWP_EPP_POWERSAVE);
853 else
854 intel_pstate_set_epb(cpu, HWP_EPP_BALANCE_POWERSAVE);
855 853
856 wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value);854 wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value);
857}855}
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
1297 tp->write_seq = snd_isn;1297 tp->write_seq = snd_isn;
1298 tp->snd_nxt = snd_isn;1298 tp->snd_nxt = snd_isn;
1299 tp->snd_una = snd_isn;1299 tp->snd_una = snd_isn;
1300 inet_sk(sk)->inet_id = tp->write_seq ^ jiffies;1300 inet_sk(sk)->inet_id = prandom_u32();
1301 assign_rxopt(sk, opt);1301 assign_rxopt(sk, opt);
1302 1302
1303 if (tp->rcv_wnd > (RCV_BUFSIZ_M << 10))1303 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
1702 return peekmsg(sk, msg, len, nonblock, flags);1702 return peekmsg(sk, msg, len, nonblock, flags);
1703 1703
1704 if (sk_can_busy_loop(sk) &&1704 if (sk_can_busy_loop(sk) &&
1705 skb_queue_empty(&sk->sk_receive_queue) &&1705 skb_queue_empty_lockless(&sk->sk_receive_queue) &&
1706 sk->sk_state == TCP_ESTABLISHED)1706 sk->sk_state == TCP_ESTABLISHED)
1707 sk_busy_loop(sk, nonblock);1707 sk_busy_loop(sk, nonblock);
1708 1708
drivers/dma/imx-sdma.c+8−0
@@ -1707,6 +1707,14 @@ static void sdma_add_scripts(struct sdma_engine *sdma, · 1706 unmodified lines
1707 if (!sdma->script_number)1707 if (!sdma->script_number)
1708 sdma->script_number = SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1;1708 sdma->script_number = SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1;
1709 1709
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
1710 for (i = 0; i < sdma->script_number; i++)1718 for (i = 0; i < sdma->script_number; i++)
1711 if (addr_arr[i] > 0)1719 if (addr_arr[i] > 0)
1712 saddr_arr[i] = addr_arr[i];1720 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
694 694
695 /* remove all transactions, including active transaction */695 /* remove all transactions, including active transaction */
696 spin_lock_irqsave(&bchan->vc.lock, flag);696 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
697 list_for_each_entry_safe(async_desc, tmp,716 list_for_each_entry_safe(async_desc, tmp,
698 &bchan->desc_list, desc_node) {717 &bchan->desc_list, desc_node) {
699 list_add(&async_desc->vd.node, &bchan->vc.desc_issued);718 list_add(&async_desc->vd.node, &bchan->vc.desc_issued);
drivers/dma/sprd-dma.c+25−2
@@ -134,6 +134,10 @@ · 133 unmodified lines
134#define SPRD_DMA_SRC_TRSF_STEP_OFFSET 0134#define SPRD_DMA_SRC_TRSF_STEP_OFFSET 0
135#define SPRD_DMA_TRSF_STEP_MASK GENMASK(15, 0)135#define SPRD_DMA_TRSF_STEP_MASK GENMASK(15, 0)
136 136
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
137/* define DMA channel mode & trigger mode mask */141/* define DMA channel mode & trigger mode mask */
138#define SPRD_DMA_CHN_MODE_MASK GENMASK(7, 0)142#define SPRD_DMA_CHN_MODE_MASK GENMASK(7, 0)
139#define SPRD_DMA_TRG_MODE_MASK GENMASK(7, 0)143#define SPRD_DMA_TRG_MODE_MASK GENMASK(7, 0)
@@ -208,6 +212,7 @@ struct sprd_dma_dev { · 68 unmodified lines
208 struct sprd_dma_chn channels[0];212 struct sprd_dma_chn channels[0];
209};213};
210 214
215static void sprd_dma_free_desc(struct virt_dma_desc *vd);
211static bool sprd_dma_filter_fn(struct dma_chan *chan, void *param);216static bool sprd_dma_filter_fn(struct dma_chan *chan, void *param);
212static struct of_dma_filter_info sprd_dma_info = {217static struct of_dma_filter_info sprd_dma_info = {
213 .filter_fn = sprd_dma_filter_fn,218 .filter_fn = sprd_dma_filter_fn,
@@ -609,12 +614,19 @@ static int sprd_dma_alloc_chan_resources(struct dma_chan *chan) · 395 unmodified lines
609static void sprd_dma_free_chan_resources(struct dma_chan *chan)614static void sprd_dma_free_chan_resources(struct dma_chan *chan)
610{615{
611 struct sprd_dma_chn *schan = to_sprd_dma_chan(chan);616 struct sprd_dma_chn *schan = to_sprd_dma_chan(chan);
617 struct virt_dma_desc *cur_vd = NULL;
612 unsigned long flags;618 unsigned long flags;
613 619
614 spin_lock_irqsave(&schan->vc.lock, flags);620 spin_lock_irqsave(&schan->vc.lock, flags);
621 if (schan->cur_desc)
622 cur_vd = &schan->cur_desc->vd;
623
615 sprd_dma_stop(schan);624 sprd_dma_stop(schan);
616 spin_unlock_irqrestore(&schan->vc.lock, flags);625 spin_unlock_irqrestore(&schan->vc.lock, flags);
617 626
627 if (cur_vd)
628 sprd_dma_free_desc(cur_vd);
629
618 vchan_free_chan_resources(&schan->vc);630 vchan_free_chan_resources(&schan->vc);
619 pm_runtime_put(chan->device->dev);631 pm_runtime_put(chan->device->dev);
620}632}
@@ -717,6 +729,7 @@ static int sprd_dma_fill_desc(struct dma_chan *chan, · 96 unmodified lines
717 u32 int_mode = flags & SPRD_DMA_INT_MASK;729 u32 int_mode = flags & SPRD_DMA_INT_MASK;
718 int src_datawidth, dst_datawidth, src_step, dst_step;730 int src_datawidth, dst_datawidth, src_step, dst_step;
719 u32 temp, fix_mode = 0, fix_en = 0;731 u32 temp, fix_mode = 0, fix_en = 0;
732 phys_addr_t llist_ptr;
720 733
721 if (dir == DMA_MEM_TO_DEV) {734 if (dir == DMA_MEM_TO_DEV) {
722 src_step = sprd_dma_get_step(slave_cfg->src_addr_width);735 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
814 * Set the link-list pointer point to next link-list827 * Set the link-list pointer point to next link-list
815 * configuration's physical address.828 * configuration's physical address.
816 */829 */
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;
818 } else {834 } else {
819 hw->llist_ptr = 0;835 hw->llist_ptr = 0;
836 hw->src_blk_step = 0;
820 }837 }
821 838
822 hw->frg_step = 0;839 hw->frg_step = 0;
823 hw->src_blk_step = 0;
824 hw->des_blk_step = 0;840 hw->des_blk_step = 0;
825 return 0;841 return 0;
826}842}
@@ -1023,15 +1039,22 @@ static int sprd_dma_resume(struct dma_chan *chan) · 196 unmodified lines
1023static int sprd_dma_terminate_all(struct dma_chan *chan)1039static int sprd_dma_terminate_all(struct dma_chan *chan)
1024{1040{
1025 struct sprd_dma_chn *schan = to_sprd_dma_chan(chan);1041 struct sprd_dma_chn *schan = to_sprd_dma_chan(chan);
1042 struct virt_dma_desc *cur_vd = NULL;
1026 unsigned long flags;1043 unsigned long flags;
1027 LIST_HEAD(head);1044 LIST_HEAD(head);
1028 1045
1029 spin_lock_irqsave(&schan->vc.lock, flags);1046 spin_lock_irqsave(&schan->vc.lock, flags);
1047 if (schan->cur_desc)
1048 cur_vd = &schan->cur_desc->vd;
1049
1030 sprd_dma_stop(schan);1050 sprd_dma_stop(schan);
1031 1051
1032 vchan_get_all_descriptors(&schan->vc, &head);1052 vchan_get_all_descriptors(&schan->vc, &head);
1033 spin_unlock_irqrestore(&schan->vc.lock, flags);1053 spin_unlock_irqrestore(&schan->vc.lock, flags);
1034 1054
1055 if (cur_vd)
1056 sprd_dma_free_desc(cur_vd);
1057
1035 vchan_dma_desc_free_list(&schan->vc, &head);1058 vchan_dma_desc_free_list(&schan->vc, &head);
1036 return 0;1059 return 0;
1037}1060}
drivers/dma/tegra210-adma.c+7−0
@@ -40,6 +40,7 @@ · 39 unmodified lines
40#define ADMA_CH_CONFIG_MAX_BURST_SIZE 1640#define ADMA_CH_CONFIG_MAX_BURST_SIZE 16
41#define ADMA_CH_CONFIG_WEIGHT_FOR_WRR(val) ((val) & 0xf)41#define ADMA_CH_CONFIG_WEIGHT_FOR_WRR(val) ((val) & 0xf)
42#define ADMA_CH_CONFIG_MAX_BUFS 842#define ADMA_CH_CONFIG_MAX_BUFS 8
43#define TEGRA186_ADMA_CH_CONFIG_OUTSTANDING_REQS(reqs) (reqs << 4)
43 44
44#define ADMA_CH_FIFO_CTRL 0x2c45#define ADMA_CH_FIFO_CTRL 0x2c
45#define TEGRA210_ADMA_CH_FIFO_CTRL_TXSIZE(val) (((val) & 0xf) << 8)46#define TEGRA210_ADMA_CH_FIFO_CTRL_TXSIZE(val) (((val) & 0xf) << 8)
@@ -77,6 +78,7 @@ struct tegra_adma; · 31 unmodified lines
77 * @ch_req_tx_shift: Register offset for AHUB transmit channel select.78 * @ch_req_tx_shift: Register offset for AHUB transmit channel select.
78 * @ch_req_rx_shift: Register offset for AHUB receive channel select.79 * @ch_req_rx_shift: Register offset for AHUB receive channel select.
79 * @ch_base_offset: Register offset of DMA channel registers.80 * @ch_base_offset: Register offset of DMA channel registers.
81 * @has_outstanding_reqs: If DMA channel can have outstanding requests.
80 * @ch_fifo_ctrl: Default value for channel FIFO CTRL register.82 * @ch_fifo_ctrl: Default value for channel FIFO CTRL register.
81 * @ch_req_mask: Mask for Tx or Rx channel select.83 * @ch_req_mask: Mask for Tx or Rx channel select.
82 * @ch_req_max: Maximum number of Tx or Rx channels available.84 * @ch_req_max: Maximum number of Tx or Rx channels available.
@@ -95,6 +97,7 @@ struct tegra_adma_chip_data { · 12 unmodified lines
95 unsigned int ch_req_max;97 unsigned int ch_req_max;
96 unsigned int ch_reg_size;98 unsigned int ch_reg_size;
97 unsigned int nr_channels;99 unsigned int nr_channels;
100 bool has_outstanding_reqs;
98};101};
99 102
100/*103/*
@@ -594,6 +597,8 @@ static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc, · 493 unmodified lines
594 ADMA_CH_CTRL_FLOWCTRL_EN;597 ADMA_CH_CTRL_FLOWCTRL_EN;
595 ch_regs->config |= cdata->adma_get_burst_config(burst_size);598 ch_regs->config |= cdata->adma_get_burst_config(burst_size);
596 ch_regs->config |= ADMA_CH_CONFIG_WEIGHT_FOR_WRR(1);599 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);
597 ch_regs->fifo_ctrl = cdata->ch_fifo_ctrl;602 ch_regs->fifo_ctrl = cdata->ch_fifo_ctrl;
598 ch_regs->tc = desc->period_len & ADMA_CH_TC_COUNT_MASK;603 ch_regs->tc = desc->period_len & ADMA_CH_TC_COUNT_MASK;
599 604
@@ -778,6 +783,7 @@ static const struct tegra_adma_chip_data tegra210_chip_data = { · 178 unmodified lines
778 .ch_req_tx_shift = 28,783 .ch_req_tx_shift = 28,
779 .ch_req_rx_shift = 24,784 .ch_req_rx_shift = 24,
780 .ch_base_offset = 0,785 .ch_base_offset = 0,
786 .has_outstanding_reqs = false,
781 .ch_fifo_ctrl = TEGRA210_FIFO_CTRL_DEFAULT,787 .ch_fifo_ctrl = TEGRA210_FIFO_CTRL_DEFAULT,
782 .ch_req_mask = 0xf,788 .ch_req_mask = 0xf,
783 .ch_req_max = 10,789 .ch_req_max = 10,
@@ -792,6 +798,7 @@ static const struct tegra_adma_chip_data tegra186_chip_data = { · 8 unmodified lines
792 .ch_req_tx_shift = 27,798 .ch_req_tx_shift = 27,
793 .ch_req_rx_shift = 22,799 .ch_req_rx_shift = 22,
794 .ch_base_offset = 0x10000,800 .ch_base_offset = 0x10000,
801 .has_outstanding_reqs = true,
795 .ch_fifo_ctrl = TEGRA186_FIFO_CTRL_DEFAULT,802 .ch_fifo_ctrl = TEGRA186_FIFO_CTRL_DEFAULT,
796 .ch_req_mask = 0x1f,803 .ch_req_mask = 0x1f,
797 .ch_req_max = 20,804 .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
586 enum dma_transfer_direction dir, unsigned long tx_flags, void *context)586 enum dma_transfer_direction dir, unsigned long tx_flags, void *context)
587{587{
588 struct cppi41_channel *c = to_cpp41_chan(chan);588 struct cppi41_channel *c = to_cpp41_chan(chan);
589 struct dma_async_tx_descriptor *txd = NULL;
590 struct cppi41_dd *cdd = c->cdd;
589 struct cppi41_desc *d;591 struct cppi41_desc *d;
590 struct scatterlist *sg;592 struct scatterlist *sg;
591 unsigned int i;593 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;
592 605
593 d = c->desc;606 d = c->desc;
594 for_each_sg(sgl, sg, sg_len, i) {607 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
611 d++;624 d++;
612 }625 }
613 626
614 return &c->txd;627 txd = &c->txd;
628
629err_out_not_ready:
630 pm_runtime_mark_last_busy(cdd->ddev.dev);
631 pm_runtime_put_autosuspend(cdd->ddev.dev);
632
633 return txd;
615}634}
616 635
617static void cppi41_compute_td_desc(struct cppi41_desc *d)636static void cppi41_compute_td_desc(struct cppi41_desc *d)
drivers/dma/xilinx/xilinx_dma.c+9−1
@@ -68,6 +68,9 @@ · 67 unmodified lines
68#define XILINX_DMA_DMACR_CIRC_EN BIT(1)68#define XILINX_DMA_DMACR_CIRC_EN BIT(1)
69#define XILINX_DMA_DMACR_RUNSTOP BIT(0)69#define XILINX_DMA_DMACR_RUNSTOP BIT(0)
70#define XILINX_DMA_DMACR_FSYNCSRC_MASK GENMASK(6, 5)70#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)
71 74
72#define XILINX_DMA_REG_DMASR 0x000475#define XILINX_DMA_REG_DMASR 0x0004
73#define XILINX_DMA_DMASR_EOL_LATE_ERR BIT(15)76#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
1354 node);1357 node);
1355 hw = &segment->hw;1358 hw = &segment->hw;
1356 1359
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));
1358 1362
1359 /* Start the transfer */1363 /* Start the transfer */
1360 dma_ctrl_write(chan, XILINX_DMA_REG_BTT,1364 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
2117 chan->config.gen_lock = cfg->gen_lock;2121 chan->config.gen_lock = cfg->gen_lock;
2118 chan->config.master = cfg->master;2122 chan->config.master = cfg->master;
2119 2123
2124 dmacr &= ~XILINX_DMA_DMACR_GENLOCK_EN;
2120 if (cfg->gen_lock && chan->genlock) {2125 if (cfg->gen_lock && chan->genlock) {
2121 dmacr |= XILINX_DMA_DMACR_GENLOCK_EN;2126 dmacr |= XILINX_DMA_DMACR_GENLOCK_EN;
2127 dmacr &= ~XILINX_DMA_DMACR_MASTER_MASK;
2122 dmacr |= cfg->master << XILINX_DMA_DMACR_MASTER_SHIFT;2128 dmacr |= cfg->master << XILINX_DMA_DMACR_MASTER_SHIFT;
2123 }2129 }
2124 2130
@@ -2134,11 +2140,13 @@ int xilinx_vdma_channel_set_config(struct dma_chan *dchan, · 9 unmodified lines
2134 chan->config.delay = cfg->delay;2140 chan->config.delay = cfg->delay;
2135 2141
2136 if (cfg->coalesc <= XILINX_DMA_DMACR_FRAME_COUNT_MAX) {2142 if (cfg->coalesc <= XILINX_DMA_DMACR_FRAME_COUNT_MAX) {
2143 dmacr &= ~XILINX_DMA_DMACR_FRAME_COUNT_MASK;
2137 dmacr |= cfg->coalesc << XILINX_DMA_DMACR_FRAME_COUNT_SHIFT;2144 dmacr |= cfg->coalesc << XILINX_DMA_DMACR_FRAME_COUNT_SHIFT;
2138 chan->config.coalesc = cfg->coalesc;2145 chan->config.coalesc = cfg->coalesc;
2139 }2146 }
2140 2147
2141 if (cfg->delay <= XILINX_DMA_DMACR_DELAY_MAX) {2148 if (cfg->delay <= XILINX_DMA_DMACR_DELAY_MAX) {
2149 dmacr &= ~XILINX_DMA_DMACR_DELAY_MASK;
2142 dmacr |= cfg->delay << XILINX_DMA_DMACR_DELAY_SHIFT;2150 dmacr |= cfg->delay << XILINX_DMA_DMACR_DELAY_SHIFT;
2143 chan->config.delay = cfg->delay;2151 chan->config.delay = cfg->delay;
2144 }2152 }
drivers/firmware/efi/Kconfig+1−0
@@ -182,6 +182,7 @@ config RESET_ATTACK_MITIGATION · 181 unmodified lines
182 182
183config EFI_RCI2_TABLE183config EFI_RCI2_TABLE
184 bool "EFI Runtime Configuration Interface Table Version 2 Support"184 bool "EFI Runtime Configuration Interface Table Version 2 Support"
185 depends on X86 || COMPILE_TEST
185 help186 help
186 Displays the content of the Runtime Configuration Interface187 Displays the content of the Runtime Configuration Interface
187 Table version 2 on Dell EMC PowerEdge systems as a binary188 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
554 sizeof(*seed) + size);554 sizeof(*seed) + size);
555 if (seed != NULL) {555 if (seed != NULL) {
556 pr_notice("seeding entropy pool\n");556 pr_notice("seeding entropy pool\n");
557 add_device_randomness(seed->bits, seed->size);557 add_bootloader_randomness(seed->bits, seed->size);
558 early_memunmap(seed, sizeof(*seed) + size);558 early_memunmap(seed, sizeof(*seed) + size);
559 } else {559 } else {
560 pr_err("Could not map UEFI random seed!\n");560 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
52 52
53lib-$(CONFIG_ARM) += arm32-stub.o53lib-$(CONFIG_ARM) += arm32-stub.o
54lib-$(CONFIG_ARM64) += arm64-stub.o54lib-$(CONFIG_ARM64) += arm64-stub.o
55CFLAGS_arm32-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
55CFLAGS_arm64-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET)56CFLAGS_arm64-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
56 57
57#58#
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
195 unsigned long dram_base,195 unsigned long dram_base,
196 efi_loaded_image_t *image)196 efi_loaded_image_t *image)
197{197{
198 unsigned long kernel_base;
198 efi_status_t status;199 efi_status_t status;
199 200
200 /*201 /*
@@ -204,9 +205,18 @@ efi_status_t handle_kernel_image(efi_system_table_t *sys_table, · 3 unmodified lines
204 * loaded. These assumptions are made by the decompressor,205 * loaded. These assumptions are made by the decompressor,
205 * before any memory map is available.206 * before any memory map is available.
206 */207 */
207 dram_base = round_up(dram_base, SZ_128M);208 kernel_base = round_up(dram_base, SZ_128M);
208 209
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,
210 reserve_size);220 reserve_size);
211 if (status != EFI_SUCCESS) {221 if (status != EFI_SUCCESS) {
212 pr_efi_err(sys_table, "Unable to allocate memory for uncompressed kernel.\n");222 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
220 *image_size = image->image_size;230 *image_size = image->image_size;
221 status = efi_relocate_kernel(sys_table, image_addr, *image_size,231 status = efi_relocate_kernel(sys_table, image_addr, *image_size,
222 *image_size,232 *image_size,
223 dram_base + MAX_UNCOMP_KERNEL_SIZE, 0);233 kernel_base + MAX_UNCOMP_KERNEL_SIZE, 0, 0);
224 if (status != EFI_SUCCESS) {234 if (status != EFI_SUCCESS) {
225 pr_efi_err(sys_table, "Failed to relocate kernel.\n");235 pr_efi_err(sys_table, "Failed to relocate kernel.\n");
226 efi_free(sys_table, *reserve_size, *reserve_addr);236 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
260}260}
261 261
262/*262/*
263 * Allocate at the lowest possible address.263 * Allocate at the lowest possible address that is not below 'min'.
264 */264 */
265efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,265efi_status_t efi_low_alloc_above(efi_system_table_t *sys_table_arg,
266 unsigned long size, unsigned long align,266 unsigned long size, unsigned long align,
267 unsigned long *addr)267 unsigned long *addr, unsigned long min)
268{268{
269 unsigned long map_size, desc_size, buff_size;269 unsigned long map_size, desc_size, buff_size;
270 efi_memory_desc_t *map;270 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
311 start = desc->phys_addr;311 start = desc->phys_addr;
312 end = start + desc->num_pages * EFI_PAGE_SIZE;312 end = start + desc->num_pages * EFI_PAGE_SIZE;
313 313
314 /*314 if (start < min)
315 * Don't allocate at 0x0. It will confuse code that315 start = min;
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;
321 316
322 start = round_up(start, align);317 start = round_up(start, align);
323 if ((start + size) > end)318 if ((start + size) > end)
@@ -698,7 +693,8 @@ efi_status_t efi_relocate_kernel(efi_system_table_t *sys_table_arg, · 374 unmodified lines
698 unsigned long image_size,693 unsigned long image_size,
699 unsigned long alloc_size,694 unsigned long alloc_size,
700 unsigned long preferred_addr,695 unsigned long preferred_addr,
701 unsigned long alignment)696 unsigned long alignment,
697 unsigned long min_addr)
702{698{
703 unsigned long cur_image_addr;699 unsigned long cur_image_addr;
704 unsigned long new_addr = 0;700 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
731 * possible.727 * possible.
732 */728 */
733 if (status != EFI_SUCCESS) {729 if (status != EFI_SUCCESS) {
734 status = efi_low_alloc(sys_table_arg, alloc_size, alignment,730 status = efi_low_alloc_above(sys_table_arg, alloc_size,
735 &new_addr);731 alignment, &new_addr, min_addr);
736 }732 }
737 if (status != EFI_SUCCESS) {733 if (status != EFI_SUCCESS) {
738 pr_efi_err(sys_table_arg, "Failed to allocate usable memory for kernel.\n");734 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
14#include <linux/init.h>14#include <linux/init.h>
15#include <linux/proc_fs.h>15#include <linux/proc_fs.h>
16#include <linux/efi.h>16#include <linux/efi.h>
17#include <linux/security.h>
17#include <linux/slab.h>18#include <linux/slab.h>
18#include <linux/uaccess.h>19#include <linux/uaccess.h>
19 20
@@ -717,6 +718,13 @@ static long efi_test_ioctl(struct file *file, unsigned int cmd, · 697 unmodified lines
717 718
718static int efi_test_open(struct inode *inode, struct file *file)719static int efi_test_open(struct inode *inode, struct file *file)
719{720{
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;
720 /*728 /*
721 * nothing special to do here729 * nothing special to do here
722 * We do accept multiple open files at the same time as we730 * 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
88 88
89 if (tbl_size < 0) {89 if (tbl_size < 0) {
90 pr_err(FW_BUG "Failed to parse event in TPM Final Events Log\n");90 pr_err(FW_BUG "Failed to parse event in TPM Final Events Log\n");
91 ret = -EINVAL;
91 goto out_calc;92 goto out_calc;
92 }93 }
93 94
drivers/gpio/gpio-merrifield.c+13−20
@@ -362,9 +362,8 @@ static void mrfld_irq_handler(struct irq_desc *desc) · 361 unmodified lines
362 chained_irq_exit(irqchip, desc);362 chained_irq_exit(irqchip, desc);
363}363}
364 364
365static int mrfld_irq_init_hw(struct gpio_chip *chip)365static void mrfld_irq_init_hw(struct mrfld_gpio *priv)
366{366{
367 struct mrfld_gpio *priv = gpiochip_get_data(chip);
368 void __iomem *reg;367 void __iomem *reg;
369 unsigned int base;368 unsigned int base;
370 369
@@ -376,8 +375,6 @@ static int mrfld_irq_init_hw(struct gpio_chip *chip) · 5 unmodified lines
376 reg = gpio_reg(&priv->chip, base, GFER);375 reg = gpio_reg(&priv->chip, base, GFER);
377 writel(0, reg);376 writel(0, reg);
378 }377 }
379
380 return 0;
381}378}
382 379
383static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv)380static 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
400{397{
401 const struct mrfld_gpio_pinrange *range;398 const struct mrfld_gpio_pinrange *range;
402 const char *pinctrl_dev_name;399 const char *pinctrl_dev_name;
403 struct gpio_irq_chip *girq;
404 struct mrfld_gpio *priv;400 struct mrfld_gpio *priv;
405 u32 gpio_base, irq_base;401 u32 gpio_base, irq_base;
406 void __iomem *base;402 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
448 444
449 raw_spin_lock_init(&priv->lock);445 raw_spin_lock_init(&priv->lock);
450 446
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
466 pci_set_drvdata(pdev, priv);447 pci_set_drvdata(pdev, priv);
467 retval = devm_gpiochip_add_data(&pdev->dev, &priv->chip, priv);448 retval = devm_gpiochip_add_data(&pdev->dev, &priv->chip, priv);
468 if (retval) {449 if (retval) {
@@ -484,6 +465,18 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id · 15 unmodified lines
484 }465 }
485 }466 }
486 467
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
487 return 0;480 return 0;
488}481}
489 482
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
604 continue;604 continue;
605 }605 }
606 606
607 for (i = 0; i < num_entities; i++)607 for (i = 0; i < num_entities; i++) {
608 mutex_lock(&ctx->adev->lock_reset);
608 drm_sched_entity_fini(&ctx->entities[0][i].entity);609 drm_sched_entity_fini(&ctx->entities[0][i].entity);
610 mutex_unlock(&ctx->adev->lock_reset);
611 }
609 }612 }
610}613}
611 614
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+7−0
@@ -2885,6 +2885,13 @@ fence_driver_init: · 2884 unmodified lines
2885 DRM_INFO("amdgpu: acceleration disabled, skipping benchmarks\n");2885 DRM_INFO("amdgpu: acceleration disabled, skipping benchmarks\n");
2886 }2886 }
2887 2887
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
2888 /* enable clockgating, etc. after ib tests, etc. since some blocks require2895 /* enable clockgating, etc. after ib tests, etc. since some blocks require
2889 * explicit gating rather than handling it automatically.2896 * explicit gating rather than handling it automatically.
2890 */2897 */
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+1−0
@@ -1016,6 +1016,7 @@ static const struct pci_device_id pciidlist[] = { · 1015 unmodified lines
1016 {0x1002, 0x7340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14|AMD_EXP_HW_SUPPORT},1016 {0x1002, 0x7340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14|AMD_EXP_HW_SUPPORT},
1017 {0x1002, 0x7341, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14|AMD_EXP_HW_SUPPORT},1017 {0x1002, 0x7341, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14|AMD_EXP_HW_SUPPORT},
1018 {0x1002, 0x7347, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14|AMD_EXP_HW_SUPPORT},1018 {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},
1019 1020
1020 /* Renoir */1021 /* Renoir */
1021 {0x1002, 0x1636, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU|AMD_EXP_HW_SUPPORT},1022 {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
289 uint32_t mec2_feature_version;289 uint32_t mec2_feature_version;
290 bool mec_fw_write_wait;290 bool mec_fw_write_wait;
291 bool me_fw_write_wait;291 bool me_fw_write_wait;
292 bool cp_fw_write_wait;
292 struct amdgpu_ring gfx_ring[AMDGPU_MAX_GFX_RINGS];293 struct amdgpu_ring gfx_ring[AMDGPU_MAX_GFX_RINGS];
293 unsigned num_gfx_rings;294 unsigned num_gfx_rings;
294 struct amdgpu_ring compute_ring[AMDGPU_MAX_COMPUTE_RINGS];295 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
218 struct amdgpu_ring *ring = to_amdgpu_ring(sched_job->sched);218 struct amdgpu_ring *ring = to_amdgpu_ring(sched_job->sched);
219 struct dma_fence *fence = NULL, *finished;219 struct dma_fence *fence = NULL, *finished;
220 struct amdgpu_job *job;220 struct amdgpu_job *job;
221 int r;221 int r = 0;
222 222
223 job = to_amdgpu_job(sched_job);223 job = to_amdgpu_job(sched_job);
224 finished = &job->base.s_fence->finished;224 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
243 job->fence = dma_fence_get(fence);243 job->fence = dma_fence_get(fence);
244 244
245 amdgpu_job_free_resources(job);245 amdgpu_job_free_resources(job);
246
247 fence = r ? ERR_PTR(r) : fence;
246 return fence;248 return fence;
247}249}
248 250
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
190 pm_runtime_put_autosuspend(dev->dev);190 pm_runtime_put_autosuspend(dev->dev);
191 }191 }
192 192
193 amdgpu_register_gpu_instance(adev);
194out:193out:
195 if (r) {194 if (r) {
196 /* balance pm_runtime_get_sync in amdgpu_driver_unload_kms */195 /* 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
93{93{
94 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x00400014),94 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x00400014),
95 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_CPF_CLK_CTRL, 0xfcff8fff, 0xf8000100),95 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),
97 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQ_CLK_CTRL, 0x60000ff0, 0x60000100),97 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQ_CLK_CTRL, 0x60000ff0, 0x60000100),
98 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQG_CLK_CTRL, 0x40000000, 0x40000100),98 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQG_CLK_CTRL, 0x40000000, 0x40000100),
99 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_VGT_CLK_CTRL, 0xffff8fff, 0xffff8100),99 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
140 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x003c0014),140 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x003c0014),
141 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_GS_NGG_CLK_CTRL, 0xffff8fff, 0xffff8100),141 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_GS_NGG_CLK_CTRL, 0xffff8fff, 0xffff8100),
142 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_IA_CLK_CTRL, 0xffff0fff, 0xffff0100),142 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),
144 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQ_CLK_CTRL, 0xf8ff0fff, 0x60000100),144 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQ_CLK_CTRL, 0xf8ff0fff, 0x60000100),
145 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQG_CLK_CTRL, 0x40000ff0, 0x40000100),145 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQG_CLK_CTRL, 0x40000ff0, 0x40000100),
146 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_VGT_CLK_CTRL, 0xffff8fff, 0xffff8100),146 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
179 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0x003e001f, 0x003c0014),179 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0x003e001f, 0x003c0014),
180 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_GS_NGG_CLK_CTRL, 0xffff8fff, 0xffff8100),180 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_GS_NGG_CLK_CTRL, 0xffff8fff, 0xffff8100),
181 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_IA_CLK_CTRL, 0xffff0fff, 0xffff0100),181 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),
183 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQ_CLK_CTRL, 0xffffcfff, 0x60000100),183 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQ_CLK_CTRL, 0xffffcfff, 0x60000100),
184 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQG_CLK_CTRL, 0xffff0fff, 0x40000100),184 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SQG_CLK_CTRL, 0xffff0fff, 0x40000100),
185 SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_VGT_CLK_CTRL, 0xffff8fff, 0xffff8100),185 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
564 kfree(adev->gfx.rlc.register_list_format);564 kfree(adev->gfx.rlc.register_list_format);
565}565}
566 566
567static 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
567static void gfx_v10_0_init_rlc_ext_microcode(struct amdgpu_device *adev)593static void gfx_v10_0_init_rlc_ext_microcode(struct amdgpu_device *adev)
568{594{
569 const struct rlc_firmware_header_v2_1 *rlc_hdr;595 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
832 }858 }
833 }859 }
834 860
861 gfx_v10_0_check_fw_write_wait(adev);
835out:862out:
836 if (err) {863 if (err) {
837 dev_err(adev->dev,864 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
4765 gfx_v10_0_wait_reg_mem(ring, 0, 0, 0, reg, 0, val, mask, 0x20);4792 gfx_v10_0_wait_reg_mem(ring, 0, 0, 0, reg, 0, val, mask, 0x20);
4766}4793}
4767 4794
4795static 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
4768static void4813static void
4769gfx_v10_0_set_gfx_eop_interrupt_state(struct amdgpu_device *adev,4814gfx_v10_0_set_gfx_eop_interrupt_state(struct amdgpu_device *adev,
4770 uint32_t me, uint32_t pipe,4815 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
5155 .emit_tmz = gfx_v10_0_ring_emit_tmz,5200 .emit_tmz = gfx_v10_0_ring_emit_tmz,
5156 .emit_wreg = gfx_v10_0_ring_emit_wreg,5201 .emit_wreg = gfx_v10_0_ring_emit_wreg,
5157 .emit_reg_wait = gfx_v10_0_ring_emit_reg_wait,5202 .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,
5158};5204};
5159 5205
5160static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = {5206static 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
5188 .pad_ib = amdgpu_ring_generic_pad_ib,5234 .pad_ib = amdgpu_ring_generic_pad_ib,
5189 .emit_wreg = gfx_v10_0_ring_emit_wreg,5235 .emit_wreg = gfx_v10_0_ring_emit_wreg,
5190 .emit_reg_wait = gfx_v10_0_ring_emit_reg_wait,5236 .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,
5191};5238};
5192 5239
5193static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_kiq = {5240static 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
5218 .emit_rreg = gfx_v10_0_ring_emit_rreg,5265 .emit_rreg = gfx_v10_0_ring_emit_rreg,
5219 .emit_wreg = gfx_v10_0_ring_emit_wreg,5266 .emit_wreg = gfx_v10_0_ring_emit_wreg,
5220 .emit_reg_wait = gfx_v10_0_ring_emit_reg_wait,5267 .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,
5221};5269};
5222 5270
5223static void gfx_v10_0_set_ring_funcs(struct amdgpu_device *adev)5271static 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
973 adev->gfx.me_fw_write_wait = false;973 adev->gfx.me_fw_write_wait = false;
974 adev->gfx.mec_fw_write_wait = false;974 adev->gfx.mec_fw_write_wait = false;
975 975
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
976 switch (adev->asic_type) {983 switch (adev->asic_type) {
977 case CHIP_VEGA10:984 case CHIP_VEGA10:
978 if ((adev->gfx.me_fw_version >= 0x0000009c) &&985 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
1039 !adev->gfx.rlc.is_rlc_v2_1))1046 !adev->gfx.rlc.is_rlc_v2_1))
1040 adev->pm.pp_feature &= ~PP_GFXOFF_MASK;1047 adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
1041 1048
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:
1042 if (adev->pm.pp_feature & PP_GFXOFF_MASK)1055 if (adev->pm.pp_feature & PP_GFXOFF_MASK)
1043 adev->pg_flags |= AMD_PG_SUPPORT_GFX_PG |1056 adev->pg_flags |= AMD_PG_SUPPORT_GFX_PG |
1044 AMD_PG_SUPPORT_CP |1057 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
151 WREG32_SOC15(GC, 0, mmGCVM_L2_CNTL2, tmp);151 WREG32_SOC15(GC, 0, mmGCVM_L2_CNTL2, tmp);
152 152
153 tmp = mmGCVM_L2_CNTL3_DEFAULT;153 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 }
154 WREG32_SOC15(GC, 0, mmGCVM_L2_CNTL3, tmp);163 WREG32_SOC15(GC, 0, mmGCVM_L2_CNTL3, tmp);
155 164
156 tmp = mmGCVM_L2_CNTL4_DEFAULT;165 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
309 309
310 job->vm_pd_addr = amdgpu_gmc_pd_addr(adev->gart.bo);310 job->vm_pd_addr = amdgpu_gmc_pd_addr(adev->gart.bo);
311 job->vm_needs_flush = true;311 job->vm_needs_flush = true;
312 job->ibs->ptr[job->ibs->length_dw++] = ring->funcs->nop;
312 amdgpu_ring_pad_ib(ring, &job->ibs[0]);313 amdgpu_ring_pad_ib(ring, &job->ibs[0]);
313 r = amdgpu_job_submit(job, &adev->mman.entity,314 r = amdgpu_job_submit(job, &adev->mman.entity,
314 AMDGPU_FENCE_OWNER_UNDEFINED, &fence);315 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
343 amdgpu_ring_emit_wreg(ring, hub->ctx0_ptb_addr_hi32 + (2 * vmid),344 amdgpu_ring_emit_wreg(ring, hub->ctx0_ptb_addr_hi32 + (2 * vmid),
344 upper_32_bits(pd_addr));345 upper_32_bits(pd_addr));
345 346
346 amdgpu_ring_emit_wreg(ring, hub->vm_inv_eng0_req + eng, req);347 amdgpu_ring_emit_reg_write_reg_wait(ring, hub->vm_inv_eng0_req + eng,
347 348 hub->vm_inv_eng0_ack + eng,
348 /* wait for the invalidate to complete */349 req, 1 << vmid);
349 amdgpu_ring_emit_reg_wait(ring, hub->vm_inv_eng0_ack + eng,
350 1 << vmid, 1 << vmid);
351 350
352 return pd_addr;351 return pd_addr;
353}352}
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
137 WREG32_SOC15(MMHUB, 0, mmMMVM_L2_CNTL2, tmp);137 WREG32_SOC15(MMHUB, 0, mmMMVM_L2_CNTL2, tmp);
138 138
139 tmp = mmMMVM_L2_CNTL3_DEFAULT;139 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 }
140 WREG32_SOC15(MMHUB, 0, mmMMVM_L2_CNTL3, tmp);149 WREG32_SOC15(MMHUB, 0, mmMMVM_L2_CNTL3, tmp);
141 150
142 tmp = mmMMVM_L2_CNTL4_DEFAULT;151 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
219 hubid * MMHUB_INSTANCE_REGISTER_OFFSET, tmp);219 hubid * MMHUB_INSTANCE_REGISTER_OFFSET, tmp);
220 220
221 tmp = mmVML2PF0_VM_L2_CNTL3_DEFAULT;221 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 }
222 WREG32_SOC15_OFFSET(MMHUB, 0, mmVML2PF0_VM_L2_CNTL3,231 WREG32_SOC15_OFFSET(MMHUB, 0, mmVML2PF0_VM_L2_CNTL3,
223 hubid * MMHUB_INSTANCE_REGISTER_OFFSET, tmp);232 hubid * MMHUB_INSTANCE_REGISTER_OFFSET, tmp);
224 233
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
254 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC0_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),254 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC0_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
255 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC1_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),255 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC1_RB_WPTR_POLL_CNTL, 0xfffffff7, 0x00403000),
256 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_PAGE, 0x000003ff, 0x000003c0),256 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_PAGE, 0x000003ff, 0x000003c0),
257 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_WATERMK, 0xfc000000, 0x00000000)
257};258};
258 259
259static u32 sdma_v4_0_get_reg_offset(struct amdgpu_device *adev,260static 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
1173 SDMA_PKT_POLL_REGMEM_DW5_INTERVAL(10));1173 SDMA_PKT_POLL_REGMEM_DW5_INTERVAL(10));
1174}1174}
1175 1175
1176static 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
1176static int sdma_v5_0_early_init(void *handle)1186static int sdma_v5_0_early_init(void *handle)
1177{1187{
1178 struct amdgpu_device *adev = (struct amdgpu_device *)handle;1188 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
1588 6 + /* sdma_v5_0_ring_emit_pipeline_sync */1598 6 + /* sdma_v5_0_ring_emit_pipeline_sync */
1589 /* sdma_v5_0_ring_emit_vm_flush */1599 /* sdma_v5_0_ring_emit_vm_flush */
1590 SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +1600 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 +
1592 10 + 10 + 10, /* sdma_v5_0_ring_emit_fence x3 for user fence, vm fence */1602 10 + 10 + 10, /* sdma_v5_0_ring_emit_fence x3 for user fence, vm fence */
1593 .emit_ib_size = 7 + 6, /* sdma_v5_0_ring_emit_ib */1603 .emit_ib_size = 7 + 6, /* sdma_v5_0_ring_emit_ib */
1594 .emit_ib = sdma_v5_0_ring_emit_ib,1604 .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
1602 .pad_ib = sdma_v5_0_ring_pad_ib,1612 .pad_ib = sdma_v5_0_ring_pad_ib,
1603 .emit_wreg = sdma_v5_0_ring_emit_wreg,1613 .emit_wreg = sdma_v5_0_ring_emit_wreg,
1604 .emit_reg_wait = sdma_v5_0_ring_emit_reg_wait,1614 .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,
1605 .init_cond_exec = sdma_v5_0_ring_init_cond_exec,1616 .init_cond_exec = sdma_v5_0_ring_init_cond_exec,
1606 .patch_cond_exec = sdma_v5_0_ring_patch_cond_exec,1617 .patch_cond_exec = sdma_v5_0_ring_patch_cond_exec,
1607 .preempt_ib = sdma_v5_0_ring_preempt_ib,1618 .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
1186 AMD_PG_SUPPORT_VCN |1186 AMD_PG_SUPPORT_VCN |
1187 AMD_PG_SUPPORT_VCN_DPG;1187 AMD_PG_SUPPORT_VCN_DPG;
1188 adev->external_rev_id = adev->rev_id + 0x91;1188 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;
1194 break;1189 break;
1195 default:1190 default:
1196 /* FIXME: not supported yet */1191 /* FIXME: not supported yet */
drivers/gpu/drm/amd/display/dc/calcs/Makefile+12−7
@@ -24,15 +24,20 @@ · 23 unmodified lines
24# It calculates Bandwidth and Watermarks values for HW programming24# It calculates Bandwidth and Watermarks values for HW programming
25#25#
26 26
27ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)27calcs_ccflags := -mhard-float -msse
28 cc_stack_align := -mpreferred-stack-boundary=4
29else ifneq ($(call cc-option, -mstack-alignment=16),)
30 cc_stack_align := -mstack-alignment=16
31endif
32 28
33calcs_ccflags := -mhard-float -msse $(cc_stack_align)29ifdef CONFIG_CC_IS_GCC
30ifeq ($(call cc-ifversion, -lt, 0701, y), y)
31IS_OLD_GCC = 1
32endif
33endif
34 34
35ifdef CONFIG_CC_IS_CLANG35ifdef 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).
39calcs_ccflags += -mpreferred-stack-boundary=4
40else
36calcs_ccflags += -msse241calcs_ccflags += -msse2
37endif42endif
38 43
drivers/gpu/drm/amd/display/dc/core/dc.c+4−0
@@ -580,6 +580,10 @@ static bool construct(struct dc *dc, · 579 unmodified lines
580#ifdef CONFIG_DRM_AMD_DC_DCN2_0580#ifdef CONFIG_DRM_AMD_DC_DCN2_0
581 // Allocate memory for the vm_helper581 // Allocate memory for the vm_helper
582 dc->vm_helper = kzalloc(sizeof(struct vm_helper), GFP_KERNEL);582 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 }
583 587
584#endif588#endif
585 memcpy(&dc->bb_overrides, &init_params->bb_overrides, sizeof(dc->bb_overrides));589 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
374 enum display_dongle_type *dongle = &sink_cap->dongle_type;374 enum display_dongle_type *dongle = &sink_cap->dongle_type;
375 uint8_t type2_dongle_buf[DP_ADAPTOR_TYPE2_SIZE];375 uint8_t type2_dongle_buf[DP_ADAPTOR_TYPE2_SIZE];
376 bool is_type2_dongle = false;376 bool is_type2_dongle = false;
377 int retry_count = 2;
377 struct dp_hdmi_dongle_signature_data *dongle_signature;378 struct dp_hdmi_dongle_signature_data *dongle_signature;
378 379
379 /* Assume we have no valid DP passive dongle connected */380 /* 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
386 DP_HDMI_DONGLE_ADDRESS,387 DP_HDMI_DONGLE_ADDRESS,
387 type2_dongle_buf,388 type2_dongle_buf,
388 sizeof(type2_dongle_buf))) {389 sizeof(type2_dongle_buf))) {
389 *dongle = DISPLAY_DONGLE_DP_DVI_DONGLE;390 /* Passive HDMI dongles can sometimes fail here without retrying*/
390 sink_cap->max_hdmi_pixel_clock = DP_ADAPTOR_DVI_MAX_TMDS_CLK;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;
391 402
392 CONN_DATA_DETECT(ddc->link, type2_dongle_buf, sizeof(type2_dongle_buf),403 CONN_DATA_DETECT(ddc->link, type2_dongle_buf, sizeof(type2_dongle_buf),
393 "DP-DVI passive dongle %dMhz: ",404 "DP-DVI passive dongle %dMhz: ",
394 DP_ADAPTOR_DVI_MAX_TMDS_CLK / 1000);405 DP_ADAPTOR_DVI_MAX_TMDS_CLK / 1000);
395 return;406 return;
407 }
396 }408 }
397 409
398 /* Check if Type 2 dongle.*/410 /* 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
404 if (stream1->view_format != stream2->view_format)404 if (stream1->view_format != stream2->view_format)
405 return false;405 return false;
406 406
407 if (stream1->ignore_msa_timing_param || stream2->ignore_msa_timing_param)
408 return false;
409
407 return true;410 return true;
408}411}
409static bool is_dp_and_hdmi_sharable(412static bool is_dp_and_hdmi_sharable(
@@ -1540,6 +1543,9 @@ bool dc_is_stream_unchanged( · 1130 unmodified lines
1540 if (!are_stream_backends_same(old_stream, stream))1543 if (!are_stream_backends_same(old_stream, stream))
1541 return false;1544 return false;
1542 1545
1546 if (old_stream->ignore_msa_timing_param != stream->ignore_msa_timing_param)
1547 return false;
1548
1543 return true;1549 return true;
1544}1550}
1545 1551
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
393 rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index];393 rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index];
394 rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index];394 rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index];
395 395
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
396 // All 3 color channels have same x400 // All 3 color channels have same x
397 corner_points[0].red.x = dc_fixpt_pow(dc_fixpt_from_int(2),401 corner_points[0].red.x = dc_fixpt_pow(dc_fixpt_from_int(2),
398 dc_fixpt_from_int(region_start));402 dc_fixpt_from_int(region_start));
@@ -464,13 +468,6 @@ bool cm_helper_translate_curve_to_hw_format( · 65 unmodified lines
464 468
465 i = 1;469 i = 1;
466 while (i != hw_points + 1) {470 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
474 rgb->delta_red = dc_fixpt_sub(rgb_plus_1->red, rgb->red);471 rgb->delta_red = dc_fixpt_sub(rgb_plus_1->red, rgb->red);
475 rgb->delta_green = dc_fixpt_sub(rgb_plus_1->green, rgb->green);472 rgb->delta_green = dc_fixpt_sub(rgb_plus_1->green, rgb->green);
476 rgb->delta_blue = dc_fixpt_sub(rgb_plus_1->blue, rgb->blue);473 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
562 rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index];559 rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index];
563 rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index];560 rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index];
564 561
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
565 corner_points[0].red.x = dc_fixpt_pow(dc_fixpt_from_int(2),566 corner_points[0].red.x = dc_fixpt_pow(dc_fixpt_from_int(2),
566 dc_fixpt_from_int(region_start));567 dc_fixpt_from_int(region_start));
567 corner_points[0].green.x = corner_points[0].red.x;568 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
624 625
625 i = 1;626 i = 1;
626 while (i != hw_points + 1) {627 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
634 rgb->delta_red = dc_fixpt_sub(rgb_plus_1->red, rgb->red);628 rgb->delta_red = dc_fixpt_sub(rgb_plus_1->red, rgb->red);
635 rgb->delta_green = dc_fixpt_sub(rgb_plus_1->green, rgb->green);629 rgb->delta_green = dc_fixpt_sub(rgb_plus_1->green, rgb->green);
636 rgb->delta_blue = dc_fixpt_sub(rgb_plus_1->blue, rgb->blue);630 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
10DCN20 += dcn20_dsc.o10DCN20 += dcn20_dsc.o
11endif11endif
12 12
13ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)13CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse
14 cc_stack_align := -mpreferred-stack-boundary=4
15else ifneq ($(call cc-option, -mstack-alignment=16),)
16 cc_stack_align := -mstack-alignment=16
17endif
18 14
19CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse $(cc_stack_align)15ifdef CONFIG_CC_IS_GCC
16ifeq ($(call cc-ifversion, -lt, 0701, y), y)
17IS_OLD_GCC = 1
18endif
19endif
20 20
21ifdef CONFIG_CC_IS_CLANG21ifdef 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).
25CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -mpreferred-stack-boundary=4
26else
22CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse227CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2
23endif28endif
24 29
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
814 .num_audio = 6,814 .num_audio = 6,
815 .num_stream_encoder = 5,815 .num_stream_encoder = 5,
816 .num_pll = 5,816 .num_pll = 5,
817 .num_dwb = 0,817 .num_dwb = 1,
818 .num_ddc = 5,818 .num_ddc = 5,
819};819};
820 820
@@ -1107,6 +1107,11 @@ struct stream_encoder *dcn20_stream_encoder_create( · 286 unmodified lines
1107 if (!enc1)1107 if (!enc1)
1108 return NULL;1108 return NULL;
1109 1109
1110 if (ASICREV_IS_NAVI14_M(ctx->asic_id.hw_internal_rev)) {
1111 if (eng_id >= ENGINE_ID_DIGD)
1112 eng_id++;
1113 }
1114
1110 dcn20_stream_encoder_construct(enc1, ctx, ctx->dc_bios, eng_id,1115 dcn20_stream_encoder_construct(enc1, ctx, ctx->dc_bios, eng_id,
1111 &stream_enc_regs[eng_id],1116 &stream_enc_regs[eng_id],
1112 &se_shift, &se_mask);1117 &se_shift, &se_mask);
drivers/gpu/drm/amd/display/dc/dcn21/Makefile+12−7
@@ -3,15 +3,20 @@ · 2 unmodified lines
3 3
4DCN21 = dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o4DCN21 = dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o
5 5
6ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)6CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse
7 cc_stack_align := -mpreferred-stack-boundary=4
8else ifneq ($(call cc-option, -mstack-alignment=16),)
9 cc_stack_align := -mstack-alignment=16
10endif
11 7
12CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse $(cc_stack_align)8ifdef CONFIG_CC_IS_GCC
9ifeq ($(call cc-ifversion, -lt, 0701, y), y)
10IS_OLD_GCC = 1
11endif
12endif
13 13
14ifdef CONFIG_CC_IS_CLANG14ifdef 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).
18CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -mpreferred-stack-boundary=4
19else
15CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse220CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2
16endif21endif
17 22
drivers/gpu/drm/amd/display/dc/dml/Makefile+12−7
@@ -24,15 +24,20 @@ · 23 unmodified lines
24# It provides the general basic services required by other DAL24# It provides the general basic services required by other DAL
25# subcomponents.25# subcomponents.
26 26
27ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)27dml_ccflags := -mhard-float -msse
28 cc_stack_align := -mpreferred-stack-boundary=4
29else ifneq ($(call cc-option, -mstack-alignment=16),)
30 cc_stack_align := -mstack-alignment=16
31endif
32 28
33dml_ccflags := -mhard-float -msse $(cc_stack_align)29ifdef CONFIG_CC_IS_GCC
30ifeq ($(call cc-ifversion, -lt, 0701, y), y)
31IS_OLD_GCC = 1
32endif
33endif
34 34
35ifdef CONFIG_CC_IS_CLANG35ifdef 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).
39dml_ccflags += -mpreferred-stack-boundary=4
40else
36dml_ccflags += -msse241dml_ccflags += -msse2
37endif42endif
38 43
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
2577 mode_lib->vba.MinActiveDRAMClockChangeMargin2577 mode_lib->vba.MinActiveDRAMClockChangeMargin
2578 + mode_lib->vba.DRAMClockChangeLatency;2578 + mode_lib->vba.DRAMClockChangeLatency;
2579 2579
2580 if (mode_lib->vba.MinActiveDRAMClockChangeMargin > 0) {2580 if (mode_lib->vba.MinActiveDRAMClockChangeMargin > 50) {
2581 mode_lib->vba.DRAMClockChangeWatermark += 25;
2581 mode_lib->vba.DRAMClockChangeSupport[0][0] = dm_dram_clock_change_vactive;2582 mode_lib->vba.DRAMClockChangeSupport[0][0] = dm_dram_clock_change_vactive;
2582 } else {2583 } else {
2583 if (mode_lib->vba.SynchronizedVBlank || mode_lib->vba.NumberOfActivePlanes == 1) {2584 if (mode_lib->vba.SynchronizedVBlank || mode_lib->vba.NumberOfActivePlanes == 1) {
drivers/gpu/drm/amd/display/dc/dsc/Makefile+12−7
@@ -1,15 +1,20 @@
1#1#
2# Makefile for the 'dsc' sub-component of DAL.2# Makefile for the 'dsc' sub-component of DAL.
3 3
4ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)4dsc_ccflags := -mhard-float -msse
5 cc_stack_align := -mpreferred-stack-boundary=4
6else ifneq ($(call cc-option, -mstack-alignment=16),)
7 cc_stack_align := -mstack-alignment=16
8endif
9 5
10dsc_ccflags := -mhard-float -msse $(cc_stack_align)6ifdef CONFIG_CC_IS_GCC
7ifeq ($(call cc-ifversion, -lt, 0701, y), y)
8IS_OLD_GCC = 1
9endif
10endif
11 11
12ifdef CONFIG_CC_IS_CLANG12ifdef 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).
16dsc_ccflags += -mpreferred-stack-boundary=4
17else
13dsc_ccflags += -msse218dsc_ccflags += -msse2
14endif19endif
15 20
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
5098 5098
5099 if (type == PP_OD_EDIT_SCLK_VDDC_TABLE) {5099 if (type == PP_OD_EDIT_SCLK_VDDC_TABLE) {
5100 podn_vdd_dep = &data->odn_dpm_table.vdd_dep_on_sclk;5100 podn_vdd_dep = &data->odn_dpm_table.vdd_dep_on_sclk;
5101 for (i = 0; i < podn_vdd_dep->count - 1; i++)5101 for (i = 0; i < podn_vdd_dep->count; 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)
5104 od_vddc_lookup_table->entries[i].us_vdd = podn_vdd_dep->entries[i].vddc;5102 od_vddc_lookup_table->entries[i].us_vdd = podn_vdd_dep->entries[i].vddc;
5105 } else if (type == PP_OD_EDIT_MCLK_VDDC_TABLE) {5103 } else if (type == PP_OD_EDIT_MCLK_VDDC_TABLE) {
5106 podn_vdd_dep = &data->odn_dpm_table.vdd_dep_on_mclk;5104 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
205 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_POWERSAVING, WORKLOAD_PPLIB_POWER_SAVING_BIT),205 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_POWERSAVING, WORKLOAD_PPLIB_POWER_SAVING_BIT),
206 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VIDEO, WORKLOAD_PPLIB_VIDEO_BIT),206 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VIDEO, WORKLOAD_PPLIB_VIDEO_BIT),
207 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VR, WORKLOAD_PPLIB_VR_BIT),207 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),
209 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_CUSTOM, WORKLOAD_PPLIB_CUSTOM_BIT),209 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_CUSTOM, WORKLOAD_PPLIB_CUSTOM_BIT),
210};210};
211 211
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
219 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_POWERSAVING, WORKLOAD_PPLIB_POWER_SAVING_BIT),219 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_POWERSAVING, WORKLOAD_PPLIB_POWER_SAVING_BIT),
220 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VIDEO, WORKLOAD_PPLIB_VIDEO_BIT),220 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VIDEO, WORKLOAD_PPLIB_VIDEO_BIT),
221 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VR, WORKLOAD_PPLIB_VR_BIT),221 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),
223 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_CUSTOM, WORKLOAD_PPLIB_CUSTOM_BIT),223 WORKLOAD_MAP(PP_SMC_POWER_PROFILE_CUSTOM, WORKLOAD_PPLIB_CUSTOM_BIT),
224};224};
225 225
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
1581{1581{
1582 struct drm_device *dev = old_state->dev;1582 struct drm_device *dev = old_state->dev;
1583 const struct drm_mode_config_helper_funcs *funcs;1583 const struct drm_mode_config_helper_funcs *funcs;
1584 struct drm_crtc_state *new_crtc_state;
1585 struct drm_crtc *crtc;
1584 ktime_t start;1586 ktime_t start;
1585 s64 commit_time_ms;1587 s64 commit_time_ms;
1588 unsigned int i, new_self_refresh_mask = 0;
1586 1589
1587 funcs = dev->mode_config.helper_private;1590 funcs = dev->mode_config.helper_private;
1588 1591
@@ -1602,6 +1605,15 @@ static void commit_tail(struct drm_atomic_state *old_state) · 13 unmodified lines
1602 1605
1603 drm_atomic_helper_wait_for_dependencies(old_state);1606 drm_atomic_helper_wait_for_dependencies(old_state);
1604 1607
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
1605 if (funcs && funcs->atomic_commit_tail)1617 if (funcs && funcs->atomic_commit_tail)
1606 funcs->atomic_commit_tail(old_state);1618 funcs->atomic_commit_tail(old_state);
1607 else1619 else
@@ -1610,7 +1622,8 @@ static void commit_tail(struct drm_atomic_state *old_state) · 2 unmodified lines
1610 commit_time_ms = ktime_ms_delta(ktime_get(), start);1622 commit_time_ms = ktime_ms_delta(ktime_get(), start);
1611 if (commit_time_ms > 0)1623 if (commit_time_ms > 0)
1612 drm_self_refresh_helper_update_avg_times(old_state,1624 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);
1614 1627
1615 drm_atomic_helper_commit_cleanup_done(old_state);1628 drm_atomic_helper_commit_cleanup_done(old_state);
1616 1629
drivers/gpu/drm/drm_self_refresh_helper.c+11−7
@@ -133,29 +133,33 @@ out_drop_locks: · 132 unmodified lines
133 * drm_self_refresh_helper_update_avg_times - Updates a crtc's SR time averages133 * drm_self_refresh_helper_update_avg_times - Updates a crtc's SR time averages
134 * @state: the state which has just been applied to hardware134 * @state: the state which has just been applied to hardware
135 * @commit_time_ms: the amount of time in ms that this commit took to complete135 * @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
136 *138 *
137 * Called after &drm_mode_config_funcs.atomic_commit_tail, this function will139 * Called after &drm_mode_config_funcs.atomic_commit_tail, this function will
138 * update the average entry/exit self refresh times on self refresh transitions.140 * update the average entry/exit self refresh times on self refresh transitions.
139 * These averages will be used when calculating how long to delay before141 * These averages will be used when calculating how long to delay before
140 * entering self refresh mode after activity.142 * entering self refresh mode after activity.
141 */143 */
142void drm_self_refresh_helper_update_avg_times(struct drm_atomic_state *state,144void
143 unsigned int commit_time_ms)145drm_self_refresh_helper_update_avg_times(struct drm_atomic_state *state,
146 unsigned int commit_time_ms,
147 unsigned int new_self_refresh_mask)
144{148{
145 struct drm_crtc *crtc;149 struct drm_crtc *crtc;
146 struct drm_crtc_state *old_crtc_state, *new_crtc_state;150 struct drm_crtc_state *old_crtc_state;
147 int i;151 int i;
148 152
149 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,153 for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) {
150 new_crtc_state, i) {154 bool new_self_refresh_active = new_self_refresh_mask & BIT(i);
151 struct drm_self_refresh_data *sr_data = crtc->self_refresh_data;155 struct drm_self_refresh_data *sr_data = crtc->self_refresh_data;
152 struct ewma_psr_time *time;156 struct ewma_psr_time *time;
153 157
154 if (old_crtc_state->self_refresh_active ==158 if (old_crtc_state->self_refresh_active ==
155 new_crtc_state->self_refresh_active)159 new_self_refresh_active)
156 continue;160 continue;
157 161
158 if (new_crtc_state->self_refresh_active)162 if (new_self_refresh_active)
159 time = &sr_data->entry_avg_ms;163 time = &sr_data->entry_avg_ms;
160 else164 else
161 time = &sr_data->exit_avg_ms;165 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
180 etnaviv_cmdbuf_get_va(&submit->cmdbuf,180 etnaviv_cmdbuf_get_va(&submit->cmdbuf,
181 &gpu->mmu_context->cmdbuf_mapping));181 &gpu->mmu_context->cmdbuf_mapping));
182 182
183 mutex_unlock(&gpu->mmu_context->lock);
184
183 /* Reserve space for the bomap */185 /* Reserve space for the bomap */
184 if (n_bomap_pages) {186 if (n_bomap_pages) {
185 bomap_start = bomap = iter.data;187 bomap_start = bomap = iter.data;
@@ -221,8 +223,6 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit) · 35 unmodified lines
221 obj->base.size);223 obj->base.size);
222 }224 }
223 225
224 mutex_unlock(&gpu->mmu_context->lock);
225
226 etnaviv_core_dump_header(&iter, ETDUMP_BUF_END, iter.data);226 etnaviv_core_dump_header(&iter, ETDUMP_BUF_END, iter.data);
227 227
228 dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, GFP_KERNEL);228 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
155 155
156 memcpy(buf, v2_context->mtlb_cpu, SZ_4K);156 memcpy(buf, v2_context->mtlb_cpu, SZ_4K);
157 buf += SZ_4K;157 buf += SZ_4K;
158 for (i = 0; i < MMUv2_MAX_STLB_ENTRIES; i++, buf += SZ_4K)158 for (i = 0; i < MMUv2_MAX_STLB_ENTRIES; i++)
159 if (v2_context->mtlb_cpu[i] & MMUv2_PTE_PRESENT)159 if (v2_context->mtlb_cpu[i] & MMUv2_PTE_PRESENT) {
160 memcpy(buf, v2_context->stlb_cpu[i], SZ_4K);160 memcpy(buf, v2_context->stlb_cpu[i], SZ_4K);
161 buf += SZ_4K;
162 }
161}163}
162 164
163static void etnaviv_iommuv2_restore_nonsec(struct etnaviv_gpu *gpu,165static 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
328 328
329 ret = etnaviv_cmdbuf_suballoc_map(suballoc, ctx, &ctx->cmdbuf_mapping,329 ret = etnaviv_cmdbuf_suballoc_map(suballoc, ctx, &ctx->cmdbuf_mapping,
330 global->memory_base);330 global->memory_base);
331 if (ret) {331 if (ret)
332 global->ops->free(ctx);332 goto out_free;
333 return NULL;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;
334 }339 }
335 340
336 return ctx;341 return ctx;
342
343out_unmap:
344 etnaviv_cmdbuf_suballoc_unmap(ctx, &ctx->cmdbuf_mapping);
345out_free:
346 global->ops->free(ctx);
347 return NULL;
337}348}
338 349
339void etnaviv_iommu_restore(struct etnaviv_gpu *gpu,350void 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
864 864
865out:865out:
866 intel_display_power_put(dev_priv, intel_encoder->power_domain, wakeref);866 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
867 return status;874 return status;
868}875}
869 876
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
9315static void lpt_init_pch_refclk(struct drm_i915_private *dev_priv)9315static void lpt_init_pch_refclk(struct drm_i915_private *dev_priv)
9316{9316{
9317 struct intel_encoder *encoder;9317 struct intel_encoder *encoder;
9318 bool pch_ssc_in_use = false;
9319 bool has_fdi = false;9318 bool has_fdi = false;
9320 9319
9321 for_each_intel_encoder(&dev_priv->drm, encoder) {9320 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
9343 * clock hierarchy. That would also allow us to do9342 * clock hierarchy. That would also allow us to do
9344 * clock bending finally.9343 * clock bending finally.
9345 */9344 */
9345 dev_priv->pch_ssc_use = 0;
9346
9346 if (spll_uses_pch_ssc(dev_priv)) {9347 if (spll_uses_pch_ssc(dev_priv)) {
9347 DRM_DEBUG_KMS("SPLL using PCH SSC\n");9348 DRM_DEBUG_KMS("SPLL using PCH SSC\n");
9348 pch_ssc_in_use = true;9349 dev_priv->pch_ssc_use |= BIT(DPLL_ID_SPLL);
9349 }9350 }
9350 9351
9351 if (wrpll_uses_pch_ssc(dev_priv, DPLL_ID_WRPLL1)) {9352 if (wrpll_uses_pch_ssc(dev_priv, DPLL_ID_WRPLL1)) {
9352 DRM_DEBUG_KMS("WRPLL1 using PCH SSC\n");9353 DRM_DEBUG_KMS("WRPLL1 using PCH SSC\n");
9353 pch_ssc_in_use = true;9354 dev_priv->pch_ssc_use |= BIT(DPLL_ID_WRPLL1);
9354 }9355 }
9355 9356
9356 if (wrpll_uses_pch_ssc(dev_priv, DPLL_ID_WRPLL2)) {9357 if (wrpll_uses_pch_ssc(dev_priv, DPLL_ID_WRPLL2)) {
9357 DRM_DEBUG_KMS("WRPLL2 using PCH SSC\n");9358 DRM_DEBUG_KMS("WRPLL2 using PCH SSC\n");
9358 pch_ssc_in_use = true;9359 dev_priv->pch_ssc_use |= BIT(DPLL_ID_WRPLL2);
9359 }9360 }
9360 9361
9361 if (pch_ssc_in_use)9362 if (dev_priv->pch_ssc_use)
9362 return;9363 return;
9363 9364
9364 if (has_fdi) {9365 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
1256 u32 unused)1256 u32 unused)
1257{1257{
1258 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);1258 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);
1259 u32 ret;1262 u32 ret;
1260 1263
1261 ret = DP_AUX_CH_CTL_SEND_BUSY |1264 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
1268 DP_AUX_CH_CTL_FW_SYNC_PULSE_SKL(32) |1271 DP_AUX_CH_CTL_FW_SYNC_PULSE_SKL(32) |
1269 DP_AUX_CH_CTL_SYNC_PULSE_SKL(32);1272 DP_AUX_CH_CTL_SYNC_PULSE_SKL(32);
1270 1273
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)
1272 ret |= DP_AUX_CH_CTL_TBT_IO;1276 ret |= DP_AUX_CH_CTL_TBT_IO;
1273 1277
1274 return ret;1278 return ret;
@@ -5436,6 +5440,12 @@ out: · 4161 unmodified lines
5436 if (status != connector_status_connected && !intel_dp->is_mst)5440 if (status != connector_status_connected && !intel_dp->is_mst)
5437 intel_dp_unset_edid(intel_dp);5441 intel_dp_unset_edid(intel_dp);
5438 5442
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
5439 return status;5449 return status;
5440}5450}
5441 5451
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
525 val = I915_READ(WRPLL_CTL(id));525 val = I915_READ(WRPLL_CTL(id));
526 I915_WRITE(WRPLL_CTL(id), val & ~WRPLL_PLL_ENABLE);526 I915_WRITE(WRPLL_CTL(id), val & ~WRPLL_PLL_ENABLE);
527 POSTING_READ(WRPLL_CTL(id));527 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);
528}535}
529 536
530static void hsw_ddi_spll_disable(struct drm_i915_private *dev_priv,537static void hsw_ddi_spll_disable(struct drm_i915_private *dev_priv,
531 struct intel_shared_dpll *pll)538 struct intel_shared_dpll *pll)
532{539{
540 enum intel_dpll_id id = pll->info->id;
533 u32 val;541 u32 val;
534 542
535 val = I915_READ(SPLL_CTL);543 val = I915_READ(SPLL_CTL);
536 I915_WRITE(SPLL_CTL, val & ~SPLL_PLL_ENABLE);544 I915_WRITE(SPLL_CTL, val & ~SPLL_PLL_ENABLE);
537 POSTING_READ(SPLL_CTL);545 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);
538}553}
539 554
540static bool hsw_ddi_wrpll_get_hw_state(struct drm_i915_private *dev_priv,555static 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
147 */147 */
148 DPLL_ID_ICL_MGPLL4 = 6,148 DPLL_ID_ICL_MGPLL4 = 6,
149 /**149 /**
150 * @DPLL_ID_TGL_TCPLL5: TGL TC PLL port 5 (TC5)150 * @DPLL_ID_TGL_MGPLL5: TGL TC PLL port 5 (TC5)
151 */151 */
152 DPLL_ID_TGL_MGPLL5 = 7,152 DPLL_ID_TGL_MGPLL5 = 7,
153 /**153 /**
154 * @DPLL_ID_TGL_TCPLL6: TGL TC PLL port 6 (TC6)154 * @DPLL_ID_TGL_MGPLL6: TGL TC PLL port 6 (TC6)
155 */155 */
156 DPLL_ID_TGL_MGPLL6 = 8,156 DPLL_ID_TGL_MGPLL6 = 8,
157};157};
drivers/gpu/drm/i915/display/intel_hdmi.c+6−0
@@ -2565,6 +2565,12 @@ out: · 2564 unmodified lines
2565 if (status != connector_status_connected)2565 if (status != connector_status_connected)
2566 cec_notifier_phys_addr_invalidate(intel_hdmi->cec_notifier);2566 cec_notifier_phys_addr_invalidate(intel_hdmi->cec_notifier);
2567 2567
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
2568 return status;2574 return status;
2569}2575}
2570 2576
drivers/gpu/drm/i915/i915_drv.h+2−0
@@ -1723,6 +1723,8 @@ struct drm_i915_private { · 1722 unmodified lines
1723 struct work_struct idle_work;1723 struct work_struct idle_work;
1724 } gem;1724 } gem;
1725 1725
1726 u8 pch_ssc_use;
1727
1726 /* For i945gm vblank irq vs. C3 workaround */1728 /* For i945gm vblank irq vs. C3 workaround */
1727 struct {1729 struct {
1728 struct work_struct work;1730 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
556 return 0;556 return 0;
557 557
558err_out2:558err_out2:
559 pm_runtime_disable(pfdev->dev);
559 panfrost_devfreq_fini(pfdev);560 panfrost_devfreq_fini(pfdev);
560err_out1:561err_out1:
561 panfrost_device_fini(pfdev);562 panfrost_device_fini(pfdev);
562err_out0:563err_out0:
563 pm_runtime_disable(pfdev->dev);
564 drm_dev_put(ddev);564 drm_dev_put(ddev);
565 return err;565 return err;
566}566}
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
224 return SZ_2M;224 return SZ_2M;
225}225}
226 226
227void panfrost_mmu_flush_range(struct panfrost_device *pfdev,227static void panfrost_mmu_flush_range(struct panfrost_device *pfdev,
228 struct panfrost_mmu *mmu,228 struct panfrost_mmu *mmu,
229 u64 iova, size_t size)229 u64 iova, size_t size)
230{230{
231 if (mmu->as < 0)231 if (mmu->as < 0)
232 return;232 return;
@@ -406,11 +406,11 @@ addr_to_drm_mm_node(struct panfrost_device *pfdev, int as, u64 addr) · 173 unmodified lines
406 spin_lock(&pfdev->as_lock);406 spin_lock(&pfdev->as_lock);
407 list_for_each_entry(mmu, &pfdev->as_lru_list, list) {407 list_for_each_entry(mmu, &pfdev->as_lru_list, list) {
408 if (as == mmu->as)408 if (as == mmu->as)
409 break;409 goto found_mmu;
410 }410 }
411 if (as != mmu->as)411 goto out;
412 goto out;
413 412
413found_mmu:
414 priv = container_of(mmu, struct panfrost_file_priv, mmu);414 priv = container_of(mmu, struct panfrost_file_priv, mmu);
415 415
416 spin_lock(&priv->mm_lock);416 spin_lock(&priv->mm_lock);
@@ -432,7 +432,8 @@ out: · 15 unmodified lines
432 432
433#define NUM_FAULT_PAGES (SZ_2M / PAGE_SIZE)433#define NUM_FAULT_PAGES (SZ_2M / PAGE_SIZE)
434 434
435int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, u64 addr)435static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as,
436 u64 addr)
436{437{
437 int ret, i;438 int ret, i;
438 struct panfrost_gem_object *bo;439 struct panfrost_gem_object *bo;
drivers/gpu/drm/panfrost/panfrost_perfcnt.c+1−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
16#include "panfrost_issues.h"16#include "panfrost_issues.h"
17#include "panfrost_job.h"17#include "panfrost_job.h"
18#include "panfrost_mmu.h"18#include "panfrost_mmu.h"
19#include "panfrost_perfcnt.h"
19#include "panfrost_regs.h"20#include "panfrost_regs.h"
20 21
21#define COUNTERS_PER_BLOCK 6422#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
379static void379static void
380radeon_pci_shutdown(struct pci_dev *pdev)380radeon_pci_shutdown(struct pci_dev *pdev)
381{381{
382#ifdef CONFIG_PPC64
383 struct drm_device *ddev = pci_get_drvdata(pdev);
384#endif
385
382 /* if we are running in a VM, make sure the device386 /* if we are running in a VM, make sure the device
383 * torn down properly on reboot/shutdown387 * torn down properly on reboot/shutdown
384 */388 */
385 if (radeon_device_is_virtual())389 if (radeon_device_is_virtual())
386 radeon_pci_remove(pdev);390 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
387}401}
388 402
389static int radeon_pmops_suspend(struct device *dev)403static 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
1958 case 0x682C:1958 case 0x682C:
1959 si_pi->cac_weights = cac_weights_cape_verde_pro;1959 si_pi->cac_weights = cac_weights_cape_verde_pro;
1960 si_pi->dte_data = dte_data_sun_xt;1960 si_pi->dte_data = dte_data_sun_xt;
1961 update_dte_from_pl2 = true;
1961 break;1962 break;
1962 case 0x6825:1963 case 0x6825:
1963 case 0x6827:1964 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
479 struct drm_sched_job *s_job, *tmp;479 struct drm_sched_job *s_job, *tmp;
480 uint64_t guilty_context;480 uint64_t guilty_context;
481 bool found_guilty = false;481 bool found_guilty = false;
482 struct dma_fence *fence;
482 483
483 list_for_each_entry_safe(s_job, tmp, &sched->ring_mirror_list, node) {484 list_for_each_entry_safe(s_job, tmp, &sched->ring_mirror_list, node) {
484 struct drm_sched_fence *s_fence = s_job->s_fence;485 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
492 dma_fence_set_error(&s_fence->finished, -ECANCELED);493 dma_fence_set_error(&s_fence->finished, -ECANCELED);
493 494
494 dma_fence_put(s_job->s_fence->parent);495 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
496 }506 }
497}507}
498EXPORT_SYMBOL(drm_sched_resubmit_jobs);508EXPORT_SYMBOL(drm_sched_resubmit_jobs);
@@ -720,7 +730,7 @@ static int drm_sched_main(void *param) · 221 unmodified lines
720 fence = sched->ops->run_job(sched_job);730 fence = sched->ops->run_job(sched_job);
721 drm_sched_fence_scheduled(s_fence);731 drm_sched_fence_scheduled(s_fence);
722 732
723 if (fence) {733 if (!IS_ERR_OR_NULL(fence)) {
724 s_fence->parent = dma_fence_get(fence);734 s_fence->parent = dma_fence_get(fence);
725 r = dma_fence_add_callback(fence, &sched_job->cb,735 r = dma_fence_add_callback(fence, &sched_job->cb,
726 drm_sched_process_job);736 drm_sched_process_job);
@@ -730,8 +740,11 @@ static int drm_sched_main(void *param) · 3 unmodified lines
730 DRM_ERROR("fence add callback failed (%d)\n",740 DRM_ERROR("fence add callback failed (%d)\n",
731 r);741 r);
732 dma_fence_put(fence);742 dma_fence_put(fence);
733 } else743 } else {
744
745 dma_fence_set_error(&s_fence->finished, PTR_ERR(fence));
734 drm_sched_process_job(NULL, &sched_job->cb);746 drm_sched_process_job(NULL, &sched_job->cb);
747 }
735 748
736 wake_up(&sched->job_scheduled);749 wake_up(&sched->job_scheduled);
737 }750 }
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
557 557
558 if (args->bcl_start != args->bcl_end) {558 if (args->bcl_start != args->bcl_end) {
559 bin = kcalloc(1, sizeof(*bin), GFP_KERNEL);559 bin = kcalloc(1, sizeof(*bin), GFP_KERNEL);
560 if (!bin)560 if (!bin) {
561 v3d_job_put(&render->base);
561 return -ENOMEM;562 return -ENOMEM;
563 }
562 564
563 ret = v3d_job_init(v3d, file_priv, &bin->base,565 ret = v3d_job_init(v3d, file_priv, &bin->base,
564 v3d_job_free, args->in_sync_bcl);566 v3d_job_free, args->in_sync_bcl);
565 if (ret) {567 if (ret) {
566 v3d_job_put(&render->base);568 v3d_job_put(&render->base);
569 kfree(bin);
567 return ret;570 return ret;
568 }571 }
569 572
drivers/hid/hid-axff.c+9−2
@@ -63,13 +63,20 @@ static int axff_init(struct hid_device *hid) · 62 unmodified lines
63{63{
64 struct axff_device *axff;64 struct axff_device *axff;
65 struct hid_report *report;65 struct hid_report *report;
66 struct hid_input *hidinput = list_first_entry(&hid->inputs, struct hid_input, list);66 struct hid_input *hidinput;
67 struct list_head *report_list =&hid->report_enum[HID_OUTPUT_REPORT].report_list;67 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;
69 int field_count = 0;69 int field_count = 0;
70 int i, j;70 int i, j;
71 int error;71 int error;
72 72
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
73 if (list_empty(report_list)) {80 if (list_empty(report_list)) {
74 hid_err(hid, "no output reports found\n");81 hid_err(hid, "no output reports found\n");
75 return -ENODEV;82 return -ENODEV;
drivers/hid/hid-core.c+5−2
@@ -1139,6 +1139,7 @@ int hid_open_report(struct hid_device *device) · 1138 unmodified lines
1139 __u8 *start;1139 __u8 *start;
1140 __u8 *buf;1140 __u8 *buf;
1141 __u8 *end;1141 __u8 *end;
1142 __u8 *next;
1142 int ret;1143 int ret;
1143 static int (*dispatch_type[])(struct hid_parser *parser,1144 static int (*dispatch_type[])(struct hid_parser *parser,
1144 struct hid_item *item) = {1145 struct hid_item *item) = {
@@ -1192,7 +1193,8 @@ int hid_open_report(struct hid_device *device) · 47 unmodified lines
1192 device->collection_size = HID_DEFAULT_NUM_COLLECTIONS;1193 device->collection_size = HID_DEFAULT_NUM_COLLECTIONS;
1193 1194
1194 ret = -EINVAL;1195 ret = -EINVAL;
1195 while ((start = fetch_item(start, end, &item)) != NULL) {1196 while ((next = fetch_item(start, end, &item)) != NULL) {
1197 start = next;
1196 1198
1197 if (item.format != HID_ITEM_FORMAT_SHORT) {1199 if (item.format != HID_ITEM_FORMAT_SHORT) {
1198 hid_err(device, "unexpected long global item\n");1200 hid_err(device, "unexpected long global item\n");
@@ -1230,7 +1232,8 @@ int hid_open_report(struct hid_device *device) · 31 unmodified lines
1230 }1232 }
1231 }1233 }
1232 1234
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);
1234err:1237err:
1235 kfree(parser->collection_stack);1238 kfree(parser->collection_stack);
1236alloc_err:1239alloc_err:
drivers/hid/hid-dr.c+9−3
@@ -75,13 +75,19 @@ static int drff_init(struct hid_device *hid) · 74 unmodified lines
75{75{
76 struct drff_device *drff;76 struct drff_device *drff;
77 struct hid_report *report;77 struct hid_report *report;
78 struct hid_input *hidinput = list_first_entry(&hid->inputs,78 struct hid_input *hidinput;
79 struct hid_input, list);
80 struct list_head *report_list =79 struct list_head *report_list =
81 &hid->report_enum[HID_OUTPUT_REPORT].report_list;80 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
82 struct input_dev *dev = hidinput->input;81 struct input_dev *dev;
83 int error;82 int error;
84 83
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
85 if (list_empty(report_list)) {91 if (list_empty(report_list)) {
86 hid_err(hid, "no output reports found\n");92 hid_err(hid, "no output reports found\n");
87 return -ENODEV;93 return -ENODEV;
drivers/hid/hid-emsff.c+9−3
@@ -47,13 +47,19 @@ static int emsff_init(struct hid_device *hid) · 46 unmodified lines
47{47{
48 struct emsff_device *emsff;48 struct emsff_device *emsff;
49 struct hid_report *report;49 struct hid_report *report;
50 struct hid_input *hidinput = list_first_entry(&hid->inputs,50 struct hid_input *hidinput;
51 struct hid_input, list);
52 struct list_head *report_list =51 struct list_head *report_list =
53 &hid->report_enum[HID_OUTPUT_REPORT].report_list;52 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
54 struct input_dev *dev = hidinput->input;53 struct input_dev *dev;
55 int error;54 int error;
56 55
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
57 if (list_empty(report_list)) {63 if (list_empty(report_list)) {
58 hid_err(hid, "no output reports found\n");64 hid_err(hid, "no output reports found\n");
59 return -ENODEV;65 return -ENODEV;
drivers/hid/hid-gaff.c+9−3
@@ -64,14 +64,20 @@ static int gaff_init(struct hid_device *hid) · 63 unmodified lines
64{64{
65 struct gaff_device *gaff;65 struct gaff_device *gaff;
66 struct hid_report *report;66 struct hid_report *report;
67 struct hid_input *hidinput = list_entry(hid->inputs.next,67 struct hid_input *hidinput;
68 struct hid_input, list);
69 struct list_head *report_list =68 struct list_head *report_list =
70 &hid->report_enum[HID_OUTPUT_REPORT].report_list;69 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
71 struct list_head *report_ptr = report_list;70 struct list_head *report_ptr = report_list;
72 struct input_dev *dev = hidinput->input;71 struct input_dev *dev;
73 int error;72 int error;
74 73
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
75 if (list_empty(report_list)) {81 if (list_empty(report_list)) {
76 hid_err(hid, "no output reports found\n");82 hid_err(hid, "no output reports found\n");
77 return -ENODEV;83 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
469static const struct hid_device_id hammer_devices[] = {469static const struct hid_device_id hammer_devices[] = {
470 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,470 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
471 USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_HAMMER) },471 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) },
472 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,476 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
473 USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_STAFF) },477 USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_STAFF) },
474 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,478 { 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
124{124{
125 struct holtekff_device *holtekff;125 struct holtekff_device *holtekff;
126 struct hid_report *report;126 struct hid_report *report;
127 struct hid_input *hidinput = list_entry(hid->inputs.next,127 struct hid_input *hidinput;
128 struct hid_input, list);
129 struct list_head *report_list =128 struct list_head *report_list =
130 &hid->report_enum[HID_OUTPUT_REPORT].report_list;129 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
131 struct input_dev *dev = hidinput->input;130 struct input_dev *dev;
132 int error;131 int error;
133 132
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
134 if (list_empty(report_list)) {140 if (list_empty(report_list)) {
135 hid_err(hid, "no output report found\n");141 hid_err(hid, "no output report found\n");
136 return -ENODEV;142 return -ENODEV;
drivers/hid/hid-ids.h+2−0
@@ -476,6 +476,8 @@ · 475 unmodified lines
476#define USB_DEVICE_ID_GOOGLE_STAFF 0x502b476#define USB_DEVICE_ID_GOOGLE_STAFF 0x502b
477#define USB_DEVICE_ID_GOOGLE_WAND 0x502d477#define USB_DEVICE_ID_GOOGLE_WAND 0x502d
478#define USB_DEVICE_ID_GOOGLE_WHISKERS 0x5030478#define USB_DEVICE_ID_GOOGLE_WHISKERS 0x5030
479#define USB_DEVICE_ID_GOOGLE_MASTERBALL 0x503c
480#define USB_DEVICE_ID_GOOGLE_MAGNEMITE 0x503d
479 481
480#define USB_VENDOR_ID_GOTOP 0x08f2482#define USB_VENDOR_ID_GOTOP 0x08f2
481#define USB_DEVICE_ID_SUPER_Q2 0x007f483#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
50{50{
51 struct lg2ff_device *lg2ff;51 struct lg2ff_device *lg2ff;
52 struct hid_report *report;52 struct hid_report *report;
53 struct hid_input *hidinput = list_entry(hid->inputs.next,53 struct hid_input *hidinput;
54 struct hid_input, list);54 struct input_dev *dev;
55 struct input_dev *dev = hidinput->input;
56 int error;55 int error;
57 56
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
58 /* Check that the report looks ok */64 /* Check that the report looks ok */
59 report = hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 7);65 report = hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 7);
60 if (!report)66 if (!report)
drivers/hid/hid-lg3ff.c+9−2
@@ -117,12 +117,19 @@ static const signed short ff3_joystick_ac[] = { · 116 unmodified lines
117 117
118int lg3ff_init(struct hid_device *hid)118int lg3ff_init(struct hid_device *hid)
119{119{
120 struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list);120 struct hid_input *hidinput;
121 struct input_dev *dev = hidinput->input;121 struct input_dev *dev;
122 const signed short *ff_bits = ff3_joystick_ac;122 const signed short *ff_bits = ff3_joystick_ac;
123 int error;123 int error;
124 int i;124 int i;
125 125
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
126 /* Check that the report looks ok */133 /* Check that the report looks ok */
127 if (!hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 35))134 if (!hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 35))
128 return -ENODEV;135 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
1253 1253
1254int lg4ff_init(struct hid_device *hid)1254int lg4ff_init(struct hid_device *hid)
1255{1255{
1256 struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list);1256 struct hid_input *hidinput;
1257 struct input_dev *dev = hidinput->input;1257 struct input_dev *dev;
1258 struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;1258 struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;
1259 struct hid_report *report = list_entry(report_list->next, struct hid_report, list);1259 struct hid_report *report = list_entry(report_list->next, struct hid_report, list);
1260 const struct usb_device_descriptor *udesc = &(hid_to_usb_dev(hid)->descriptor);1260 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
1266 int mmode_ret, mmode_idx = -1;1266 int mmode_ret, mmode_idx = -1;
1267 u16 real_product_id;1267 u16 real_product_id;
1268 1268
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
1269 /* Check that the report looks ok */1276 /* Check that the report looks ok */
1270 if (!hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 7))1277 if (!hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 7))
1271 return -1;1278 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
115 115
116int lgff_init(struct hid_device* hid)116int lgff_init(struct hid_device* hid)
117{117{
118 struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list);118 struct hid_input *hidinput;
119 struct input_dev *dev = hidinput->input;119 struct input_dev *dev;
120 const signed short *ff_bits = ff_joystick;120 const signed short *ff_bits = ff_joystick;
121 int error;121 int error;
122 int i;122 int i;
123 123
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
124 /* Check that the report looks ok */131 /* Check that the report looks ok */
125 if (!hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 7))132 if (!hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 7))
126 return -ENODEV;133 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
1669 1669
1670#define HIDPP_FF_EFFECTID_NONE -11670#define HIDPP_FF_EFFECTID_NONE -1
1671#define HIDPP_FF_EFFECTID_AUTOCENTER -21671#define HIDPP_FF_EFFECTID_AUTOCENTER -2
1672#define HIDPP_AUTOCENTER_PARAMS_LENGTH 18
1672 1673
1673#define HIDPP_FF_MAX_PARAMS 201674#define HIDPP_FF_MAX_PARAMS 20
1674#define HIDPP_FF_RESERVED_SLOTS 11675#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
2009static void hidpp_ff_set_autocenter(struct input_dev *dev, u16 magnitude)2010static void hidpp_ff_set_autocenter(struct input_dev *dev, u16 magnitude)
2010{2011{
2011 struct hidpp_ff_private_data *data = dev->ff->private;2012 struct hidpp_ff_private_data *data = dev->ff->private;
2012 u8 params[18];2013 u8 params[HIDPP_AUTOCENTER_PARAMS_LENGTH];
2013 2014
2014 dbg_hid("Setting autocenter to %d.\n", magnitude);2015 dbg_hid("Setting autocenter to %d.\n", magnitude);
2015 2016
@@ -2077,23 +2078,34 @@ static DEVICE_ATTR(range, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH, hidpp · 61 unmodified lines
2077static void hidpp_ff_destroy(struct ff_device *ff)2078static void hidpp_ff_destroy(struct ff_device *ff)
2078{2079{
2079 struct hidpp_ff_private_data *data = ff->private;2080 struct hidpp_ff_private_data *data = ff->private;
2081 struct hid_device *hid = data->hidpp->hid_dev;
2080 2082
2083 hid_info(hid, "Unloading HID++ force feedback.\n");
2084
2085 device_remove_file(&hid->dev, &dev_attr_range);
2086 destroy_workqueue(data->wq);
2081 kfree(data->effect_ids);2087 kfree(data->effect_ids);
2082}2088}
2083 2089
2084static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index)2090static int hidpp_ff_init(struct hidpp_device *hidpp,
2091 struct hidpp_ff_private_data *data)
2085{2092{
2086 struct hid_device *hid = hidpp->hid_dev;2093 struct hid_device *hid = hidpp->hid_dev;
2087 struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list);2094 struct hid_input *hidinput;
2088 struct input_dev *dev = hidinput->input;2095 struct input_dev *dev;
2089 const struct usb_device_descriptor *udesc = &(hid_to_usb_dev(hid)->descriptor);2096 const struct usb_device_descriptor *udesc = &(hid_to_usb_dev(hid)->descriptor);
2090 const u16 bcdDevice = le16_to_cpu(udesc->bcdDevice);2097 const u16 bcdDevice = le16_to_cpu(udesc->bcdDevice);
2091 struct ff_device *ff;2098 struct ff_device *ff;
2092 struct hidpp_report response;2099 int error, j, num_slots = data->num_effects;
2093 struct hidpp_ff_private_data *data;
2094 int error, j, num_slots;
2095 u8 version;2100 u8 version;
2096 2101
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
2097 if (!dev) {2109 if (!dev) {
2098 hid_err(hid, "Struct input_dev not set!\n");2110 hid_err(hid, "Struct input_dev not set!\n");
2099 return -EINVAL;2111 return -EINVAL;
@@ -2109,27 +2121,17 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index) · 9 unmodified lines
2109 for (j = 0; hidpp_ff_effects_v2[j] >= 0; j++)2121 for (j = 0; hidpp_ff_effects_v2[j] >= 0; j++)
2110 set_bit(hidpp_ff_effects_v2[j], dev->ffbit);2122 set_bit(hidpp_ff_effects_v2[j], dev->ffbit);
2111 2123
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
2125 error = input_ff_create(dev, num_slots);2124 error = input_ff_create(dev, num_slots);
2126 2125
2127 if (error) {2126 if (error) {
2128 hid_err(dev, "Failed to create FF device!\n");2127 hid_err(dev, "Failed to create FF device!\n");
2129 return error;2128 return error;
2130 }2129 }
2131 2130 /*
2132 data = kzalloc(sizeof(*data), GFP_KERNEL);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);
2133 if (!data)2135 if (!data)
2134 return -ENOMEM;2136 return -ENOMEM;
2135 data->effect_ids = kcalloc(num_slots, sizeof(int), GFP_KERNEL);2137 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
2145 }2147 }
2146 2148
2147 data->hidpp = hidpp;2149 data->hidpp = hidpp;
2148 data->feature_index = feature_index;
2149 data->version = version;2150 data->version = version;
2150 data->slot_autocenter = 0;
2151 data->num_effects = num_slots;
2152 for (j = 0; j < num_slots; j++)2151 for (j = 0; j < num_slots; j++)
2153 data->effect_ids[j] = -1;2152 data->effect_ids[j] = -1;
2154 2153
@@ -2162,68 +2161,20 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index) · 7 unmodified lines
2162 ff->set_autocenter = hidpp_ff_set_autocenter;2161 ff->set_autocenter = hidpp_ff_set_autocenter;
2163 ff->destroy = hidpp_ff_destroy;2162 ff->destroy = hidpp_ff_destroy;
2164 2163
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
2177 /* Create sysfs interface */2164 /* Create sysfs interface */
2178 error = device_create_file(&(hidpp->hid_dev->dev), &dev_attr_range);2165 error = device_create_file(&(hidpp->hid_dev->dev), &dev_attr_range);
2179 if (error)2166 if (error)
2180 hid_warn(hidpp->hid_dev, "Unable to create sysfs interface for \"range\", errno %d!\n", error);2167 hid_warn(hidpp->hid_dev, "Unable to create sysfs interface for \"range\", errno %d!\n", error);
2181 2168
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
2190 /* init the hardware command queue */2169 /* init the hardware command queue */
2191 atomic_set(&data->workqueue_size, 0);2170 atomic_set(&data->workqueue_size, 0);
2192 2171
2193 /* initialize with zero autocenter to get wheel in usable state */
2194 hidpp_ff_set_autocenter(dev, 0);
2195
2196 hid_info(hid, "Force feedback support loaded (firmware release %d).\n",2172 hid_info(hid, "Force feedback support loaded (firmware release %d).\n",
2197 version);2173 version);
2198 2174
2199 return 0;2175 return 0;
2200}2176}
2201 2177
2202static 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
2227/* ************************************************************************** */2178/* ************************************************************************** */
2228/* */2179/* */
2229/* Device Support */2180/* Device Support */
@@ -2725,24 +2676,93 @@ static int k400_connect(struct hid_device *hdev, bool connected) · 495 unmodified lines
2725 2676
2726#define HIDPP_PAGE_G920_FORCE_FEEDBACK 0x81232677#define HIDPP_PAGE_G920_FORCE_FEEDBACK 0x8123
2727 2678
2728static int g920_get_config(struct hidpp_device *hidpp)2679static int g920_ff_set_autocenter(struct hidpp_device *hidpp,
2680 struct hidpp_ff_private_data *data)
2729{2681{
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
2703static int g920_get_config(struct hidpp_device *hidpp,
2704 struct hidpp_ff_private_data *data)
2705{
2706 struct hidpp_report response;
2730 u8 feature_type;2707 u8 feature_type;
2731 u8 feature_index;
2732 int ret;2708 int ret;
2733 2709
2710 memset(data, 0, sizeof(*data));
2711
2734 /* Find feature and store for later use */2712 /* Find feature and store for later use */
2735 ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_G920_FORCE_FEEDBACK,2713 ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_G920_FORCE_FEEDBACK,
2736 &feature_index, &feature_type);2714 &data->feature_index, &feature_type);
2737 if (ret)2715 if (ret)
2738 return ret;2716 return ret;
2739 2717
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);
2741 if (ret)2738 if (ret)
2742 hid_warn(hidpp->hid_dev, "Unable to initialize force feedback support, errno %d\n",2739 hid_warn(hidpp->hid_dev, "Failed to reset all forces!\n");
2743 ret);
2744 2740
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);
2746}2766}
2747 2767
2748/* -------------------------------------------------------------------------- */2768/* -------------------------------------------------------------------------- */
@@ -3458,34 +3478,45 @@ static int hidpp_get_report_length(struct hid_device *hdev, int id) · 709 unmodified lines
3458 return report->field[0]->report_count + 1;3478 return report->field[0]->report_count + 1;
3459}3479}
3460 3480
3461static bool hidpp_validate_report(struct hid_device *hdev, int id,3481static bool hidpp_validate_device(struct hid_device *hdev)
3462 int expected_length, bool optional)
3463{3482{
3464 int report_length;3483 struct hidpp_device *hidpp = hid_get_drvdata(hdev);
3484 int id, report_length, supported_reports = 0;
3465 3485
3466 if (id >= HID_MAX_IDS || id < 0) {3486 id = REPORT_ID_HIDPP_SHORT;
3467 hid_err(hdev, "invalid HID report id %u\n", id);3487 report_length = hidpp_get_report_length(hdev, id);
3468 return false;3488 if (report_length) {
3489 if (report_length < HIDPP_REPORT_SHORT_LENGTH)
3490 goto bad_device;
3491
3492 supported_reports++;
3469 }3493 }
3470 3494
3495 id = REPORT_ID_HIDPP_LONG;
3471 report_length = hidpp_get_report_length(hdev, id);3496 report_length = hidpp_get_report_length(hdev, id);
3472 if (!report_length)3497 if (report_length) {
3473 return optional;3498 if (report_length < HIDPP_REPORT_LONG_LENGTH)
3499 goto bad_device;
3474 3500
3475 if (report_length < expected_length) {3501 supported_reports++;
3476 hid_warn(hdev, "not enough values in hidpp report %d\n", id);
3477 return false;
3478 }3502 }
3479 3503
3480 return true;3504 id = REPORT_ID_HIDPP_VERY_LONG;
3481}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;
3482 3510
3483static bool hidpp_validate_device(struct hid_device *hdev)3511 supported_reports++;
3484{3512 hidpp->very_long_report_length = report_length;
3485 return hidpp_validate_report(hdev, REPORT_ID_HIDPP_SHORT,3513 }
3486 HIDPP_REPORT_SHORT_LENGTH, false) &&3514
3487 hidpp_validate_report(hdev, REPORT_ID_HIDPP_LONG,3515 return supported_reports;
3488 HIDPP_REPORT_LONG_LENGTH, true);3516
3517bad_device:
3518 hid_warn(hdev, "not enough values in hidpp report %d\n", id);
3519 return false;
3489}3520}
3490 3521
3491static bool hidpp_application_equals(struct hid_device *hdev,3522static 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
3505 int ret;3536 int ret;
3506 bool connected;3537 bool connected;
3507 unsigned int connect_mask = HID_CONNECT_DEFAULT;3538 unsigned int connect_mask = HID_CONNECT_DEFAULT;
3539 struct hidpp_ff_private_data data;
3508 3540
3509 /* report_fixup needs drvdata to be set before we call hid_parse */3541 /* report_fixup needs drvdata to be set before we call hid_parse */
3510 hidpp = devm_kzalloc(&hdev->dev, sizeof(*hidpp), GFP_KERNEL);3542 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
3531 return hid_hw_start(hdev, HID_CONNECT_DEFAULT);3563 return hid_hw_start(hdev, HID_CONNECT_DEFAULT);
3532 }3564 }
3533 3565
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
3539 if (id->group == HID_GROUP_LOGITECH_DJ_DEVICE)3566 if (id->group == HID_GROUP_LOGITECH_DJ_DEVICE)
3540 hidpp->quirks |= HIDPP_QUIRK_UNIFYING;3567 hidpp->quirks |= HIDPP_QUIRK_UNIFYING;
3541 3568
@@ -3614,7 +3641,7 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) · 72 unmodified lines
3614 if (ret)3641 if (ret)
3615 goto hid_hw_init_fail;3642 goto hid_hw_init_fail;
3616 } else if (connected && (hidpp->quirks & HIDPP_QUIRK_CLASS_G920)) {3643 } else if (connected && (hidpp->quirks & HIDPP_QUIRK_CLASS_G920)) {
3617 ret = g920_get_config(hidpp);3644 ret = g920_get_config(hidpp, &data);
3618 if (ret)3645 if (ret)
3619 goto hid_hw_init_fail;3646 goto hid_hw_init_fail;
3620 }3647 }
@@ -3636,6 +3663,14 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) · 15 unmodified lines
3636 goto hid_hw_start_fail;3663 goto hid_hw_start_fail;
3637 }3664 }
3638 3665
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
3639 return ret;3674 return ret;
3640 3675
3641hid_hw_init_fail:3676hid_hw_init_fail:
@@ -3658,9 +3693,6 @@ static void hidpp_remove(struct hid_device *hdev) · 16 unmodified lines
3658 3693
3659 sysfs_remove_group(&hdev->dev.kobj, &ps_attribute_group);3694 sysfs_remove_group(&hdev->dev.kobj, &ps_attribute_group);
3660 3695
3661 if (hidpp->quirks & HIDPP_QUIRK_CLASS_G920)
3662 hidpp_ff_deinit(hdev);
3663
3664 hid_hw_stop(hdev);3696 hid_hw_stop(hdev);
3665 cancel_work_sync(&hidpp->work);3697 cancel_work_sync(&hidpp->work);
3666 mutex_destroy(&hidpp->send_mutex);3698 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
328 328
329static int ms_init_ff(struct hid_device *hdev)329static int ms_init_ff(struct hid_device *hdev)
330{330{
331 struct hid_input *hidinput = list_entry(hdev->inputs.next,331 struct hid_input *hidinput;
332 struct hid_input, list);332 struct input_dev *input_dev;
333 struct input_dev *input_dev = hidinput->input;
334 struct ms_data *ms = hid_get_drvdata(hdev);333 struct ms_data *ms = hid_get_drvdata(hdev);
335 334
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
336 if (!(ms->quirks & MS_QUIRK_FF))342 if (!(ms->quirks & MS_QUIRK_FF))
337 return 0;343 return 0;
338 344
drivers/hid/hid-prodikeys.c+2−2
@@ -516,7 +516,7 @@ static void pcmidi_setup_extra_keys( · 515 unmodified lines
516 MY PICTURES => KEY_WORDPROCESSOR516 MY PICTURES => KEY_WORDPROCESSOR
517 MY MUSIC=> KEY_SPREADSHEET517 MY MUSIC=> KEY_SPREADSHEET
518 */518 */
519 unsigned int keys[] = {519 static const unsigned int keys[] = {
520 KEY_FN,520 KEY_FN,
521 KEY_MESSENGER, KEY_CALENDAR,521 KEY_MESSENGER, KEY_CALENDAR,
522 KEY_ADDRESSBOOK, KEY_DOCUMENTS,522 KEY_ADDRESSBOOK, KEY_DOCUMENTS,
@@ -532,7 +532,7 @@ static void pcmidi_setup_extra_keys( · 9 unmodified lines
532 0532 0
533 };533 };
534 534
535 unsigned int *pkeys = &keys[0];535 const unsigned int *pkeys = &keys[0];
536 unsigned short i;536 unsigned short i;
537 537
538 if (pm->ifnum != 1) /* only set up ONCE for interace 1 */538 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
2254 2254
2255static int sony_init_ff(struct sony_sc *sc)2255static int sony_init_ff(struct sony_sc *sc)
2256{2256{
2257 struct hid_input *hidinput = list_entry(sc->hdev->inputs.next,2257 struct hid_input *hidinput;
2258 struct hid_input, list);2258 struct input_dev *input_dev;
2259 struct input_dev *input_dev = hidinput->input;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;
2260 2266
2261 input_set_capability(input_dev, EV_FF, FF_RUMBLE);2267 input_set_capability(input_dev, EV_FF, FF_RUMBLE);
2262 return input_ff_create_memless(input_dev, NULL, sony_play_effect);2268 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
124 struct tmff_device *tmff;124 struct tmff_device *tmff;
125 struct hid_report *report;125 struct hid_report *report;
126 struct list_head *report_list;126 struct list_head *report_list;
127 struct hid_input *hidinput = list_entry(hid->inputs.next,127 struct hid_input *hidinput;
128 struct hid_input, list);128 struct input_dev *input_dev;
129 struct input_dev *input_dev = hidinput->input;
130 int error;129 int error;
131 int i;130 int i;
132 131
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
133 tmff = kzalloc(sizeof(struct tmff_device), GFP_KERNEL);139 tmff = kzalloc(sizeof(struct tmff_device), GFP_KERNEL);
134 if (!tmff)140 if (!tmff)
135 return -ENOMEM;141 return -ENOMEM;
drivers/hid/hid-zpff.c+9−3
@@ -54,11 +54,17 @@ static int zpff_init(struct hid_device *hid) · 53 unmodified lines
54{54{
55 struct zpff_device *zpff;55 struct zpff_device *zpff;
56 struct hid_report *report;56 struct hid_report *report;
57 struct hid_input *hidinput = list_entry(hid->inputs.next,57 struct hid_input *hidinput;
58 struct hid_input, list);58 struct input_dev *dev;
59 struct input_dev *dev = hidinput->input;
60 int i, error;59 int i, error;
61 60
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
62 for (i = 0; i < 4; i++) {68 for (i = 0; i < 4; i++) {
63 report = hid_validate_values(hid, HID_OUTPUT_REPORT, 0, i, 1);69 report = hid_validate_values(hid, HID_OUTPUT_REPORT, 0, i, 1);
64 if (!report)70 if (!report)
drivers/hid/i2c-hid/i2c-hid-core.c+11−111
@@ -26,7 +26,6 @@ · 25 unmodified lines
26#include <linux/delay.h>26#include <linux/delay.h>
27#include <linux/slab.h>27#include <linux/slab.h>
28#include <linux/pm.h>28#include <linux/pm.h>
29#include <linux/pm_runtime.h>
30#include <linux/device.h>29#include <linux/device.h>
31#include <linux/wait.h>30#include <linux/wait.h>
32#include <linux/err.h>31#include <linux/err.h>
@@ -48,8 +47,6 @@ · 15 unmodified lines
48/* quirks to control the device */47/* quirks to control the device */
49#define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0)48#define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0)
50#define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1)49#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)
53#define I2C_HID_QUIRK_BOGUS_IRQ BIT(4)50#define I2C_HID_QUIRK_BOGUS_IRQ BIT(4)
54 51
55/* flags */52/* flags */
@@ -172,14 +169,7 @@ static const struct i2c_hid_quirks { · 116 unmodified lines
172 { USB_VENDOR_ID_WEIDA, HID_ANY_ID,169 { USB_VENDOR_ID_WEIDA, HID_ANY_ID,
173 I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV },170 I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV },
174 { I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288,171 { I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288,
175 I2C_HID_QUIRK_NO_IRQ_AFTER_RESET |172 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 },
183 { USB_VENDOR_ID_ELAN, HID_ANY_ID,173 { USB_VENDOR_ID_ELAN, HID_ANY_ID,
184 I2C_HID_QUIRK_BOGUS_IRQ },174 I2C_HID_QUIRK_BOGUS_IRQ },
185 { 0, 0 }175 { 0, 0 }
@@ -397,7 +387,6 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state) · 211 unmodified lines
397{387{
398 struct i2c_hid *ihid = i2c_get_clientdata(client);388 struct i2c_hid *ihid = i2c_get_clientdata(client);
399 int ret;389 int ret;
400 unsigned long now, delay;
401 390
402 i2c_hid_dbg(ihid, "%s\n", __func__);391 i2c_hid_dbg(ihid, "%s\n", __func__);
403 392
@@ -415,22 +404,9 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state) · 11 unmodified lines
415 goto set_pwr_exit;404 goto set_pwr_exit;
416 }405 }
417 406
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
427 ret = __i2c_hid_command(client, &hid_set_power_cmd, power_state,407 ret = __i2c_hid_command(client, &hid_set_power_cmd, power_state,
428 0, NULL, 0, NULL, 0);408 0, NULL, 0, NULL, 0);
429 409
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
434 if (ret)410 if (ret)
435 dev_err(&client->dev, "failed to change power setting.\n");411 dev_err(&client->dev, "failed to change power setting.\n");
436 412
@@ -471,8 +447,12 @@ static int i2c_hid_hwreset(struct i2c_client *client) · 34 unmodified lines
471 if (ret) {447 if (ret) {
472 dev_err(&client->dev, "failed to reset device.\n");448 dev_err(&client->dev, "failed to reset device.\n");
473 i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);449 i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
450 goto out_unlock;
474 }451 }
475 452
453 /* At least some SIS devices need this after reset */
454 ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
455
476out_unlock:456out_unlock:
477 mutex_unlock(&ihid->reset_lock);457 mutex_unlock(&ihid->reset_lock);
478 return ret;458 return ret;
@@ -791,11 +771,6 @@ static int i2c_hid_open(struct hid_device *hid) · 312 unmodified lines
791{771{
792 struct i2c_client *client = hid->driver_data;772 struct i2c_client *client = hid->driver_data;
793 struct i2c_hid *ihid = i2c_get_clientdata(client);773 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;
799 774
800 set_bit(I2C_HID_STARTED, &ihid->flags);775 set_bit(I2C_HID_STARTED, &ihid->flags);
801 return 0;776 return 0;
@@ -807,27 +782,6 @@ static void i2c_hid_close(struct hid_device *hid) · 5 unmodified lines
807 struct i2c_hid *ihid = i2c_get_clientdata(client);782 struct i2c_hid *ihid = i2c_get_clientdata(client);
808 783
809 clear_bit(I2C_HID_STARTED, &ihid->flags);784 clear_bit(I2C_HID_STARTED, &ihid->flags);
810
811 /* Save some power */
812 pm_runtime_put(&client->dev);
813}
814
815static 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;
831}785}
832 786
833struct hid_ll_driver i2c_hid_ll_driver = {787struct hid_ll_driver i2c_hid_ll_driver = {
@@ -836,7 +790,6 @@ struct hid_ll_driver i2c_hid_ll_driver = { · 2 unmodified lines
836 .stop = i2c_hid_stop,790 .stop = i2c_hid_stop,
837 .open = i2c_hid_open,791 .open = i2c_hid_open,
838 .close = i2c_hid_close,792 .close = i2c_hid_close,
839 .power = i2c_hid_power,
840 .output_report = i2c_hid_output_report,793 .output_report = i2c_hid_output_report,
841 .raw_request = i2c_hid_raw_request,794 .raw_request = i2c_hid_raw_request,
842};795};
@@ -1104,9 +1057,6 @@ static int i2c_hid_probe(struct i2c_client *client, · 261 unmodified lines
1104 1057
1105 i2c_hid_acpi_fix_up_power(&client->dev);1058 i2c_hid_acpi_fix_up_power(&client->dev);
1106 1059
1107 pm_runtime_get_noresume(&client->dev);
1108 pm_runtime_set_active(&client->dev);
1109 pm_runtime_enable(&client->dev);
1110 device_enable_async_suspend(&client->dev);1060 device_enable_async_suspend(&client->dev);
1111 1061
1112 /* Make sure there is something at this address */1062 /* Make sure there is something at this address */
@@ -1114,16 +1064,16 @@ static int i2c_hid_probe(struct i2c_client *client, · 1 unmodified line
1114 if (ret < 0) {1064 if (ret < 0) {
1115 dev_dbg(&client->dev, "nothing at this address: %d\n", ret);1065 dev_dbg(&client->dev, "nothing at this address: %d\n", ret);
1116 ret = -ENXIO;1066 ret = -ENXIO;
1117 goto err_pm;1067 goto err_regulator;
1118 }1068 }
1119 1069
1120 ret = i2c_hid_fetch_hid_descriptor(ihid);1070 ret = i2c_hid_fetch_hid_descriptor(ihid);
1121 if (ret < 0)1071 if (ret < 0)
1122 goto err_pm;1072 goto err_regulator;
1123 1073
1124 ret = i2c_hid_init_irq(client);1074 ret = i2c_hid_init_irq(client);
1125 if (ret < 0)1075 if (ret < 0)
1126 goto err_pm;1076 goto err_regulator;
1127 1077
1128 hid = hid_allocate_device();1078 hid = hid_allocate_device();
1129 if (IS_ERR(hid)) {1079 if (IS_ERR(hid)) {
@@ -1154,9 +1104,6 @@ static int i2c_hid_probe(struct i2c_client *client, · 24 unmodified lines
1154 goto err_mem_free;1104 goto err_mem_free;
1155 }1105 }
1156 1106
1157 if (!(ihid->quirks & I2C_HID_QUIRK_NO_RUNTIME_PM))
1158 pm_runtime_put(&client->dev);
1159
1160 return 0;1107 return 0;
1161 1108
1162err_mem_free:1109err_mem_free:
@@ -1165,10 +1112,6 @@ err_mem_free: · 2 unmodified lines
1165err_irq:1112err_irq:
1166 free_irq(client->irq, ihid);1113 free_irq(client->irq, ihid);
1167 1114
1168err_pm:
1169 pm_runtime_put_noidle(&client->dev);
1170 pm_runtime_disable(&client->dev);
1171
1172err_regulator:1115err_regulator:
1173 regulator_bulk_disable(ARRAY_SIZE(ihid->pdata.supplies),1116 regulator_bulk_disable(ARRAY_SIZE(ihid->pdata.supplies),
1174 ihid->pdata.supplies);1117 ihid->pdata.supplies);
@@ -1181,12 +1124,6 @@ static int i2c_hid_remove(struct i2c_client *client) · 6 unmodified lines
1181 struct i2c_hid *ihid = i2c_get_clientdata(client);1124 struct i2c_hid *ihid = i2c_get_clientdata(client);
1182 struct hid_device *hid;1125 struct hid_device *hid;
1183 1126
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
1190 hid = ihid->hid;1127 hid = ihid->hid;
1191 hid_destroy_device(hid);1128 hid_destroy_device(hid);
1192 1129
@@ -1219,25 +1156,15 @@ static int i2c_hid_suspend(struct device *dev) · 26 unmodified lines
1219 int wake_status;1156 int wake_status;
1220 1157
1221 if (hid->driver && hid->driver->suspend) {1158 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
1230 ret = hid->driver->suspend(hid, PMSG_SUSPEND);1159 ret = hid->driver->suspend(hid, PMSG_SUSPEND);
1231 if (ret < 0)1160 if (ret < 0)
1232 return ret;1161 return ret;
1233 }1162 }
1234 1163
1235 if (!pm_runtime_suspended(dev)) {1164 /* Save some power */
1236 /* Save some power */1165 i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
1237 i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
1238 1166
1239 disable_irq(client->irq);1167 disable_irq(client->irq);
1240 }
1241 1168
1242 if (device_may_wakeup(&client->dev)) {1169 if (device_may_wakeup(&client->dev)) {
1243 wake_status = enable_irq_wake(client->irq);1170 wake_status = enable_irq_wake(client->irq);
@@ -1279,11 +1206,6 @@ static int i2c_hid_resume(struct device *dev) · 35 unmodified lines
1279 wake_status);1206 wake_status);
1280 }1207 }
1281 1208
1282 /* We'll resume to full power */
1283 pm_runtime_disable(dev);
1284 pm_runtime_set_active(dev);
1285 pm_runtime_enable(dev);
1286
1287 enable_irq(client->irq);1209 enable_irq(client->irq);
1288 1210
1289 /* Instead of resetting device, simply powers the device on. This1211 /* 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
1304}1226}
1305#endif1227#endif
1306 1228
1307#ifdef CONFIG_PM
1308static 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
1317static 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
1327static const struct dev_pm_ops i2c_hid_pm = {1229static const struct dev_pm_ops i2c_hid_pm = {
1328 SET_SYSTEM_SLEEP_PM_OPS(i2c_hid_suspend, i2c_hid_resume)1230 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)
1331};1231};
1332 1232
1333static const struct i2c_device_id i2c_hid_id_table[] = {1233static 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
322 },322 },
323 .driver_data = (void *)&sipodev_desc323 .driver_data = (void *)&sipodev_desc
324 },324 },
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 },
325 {344 {
326 .ident = "Direkt-Tek DTLAPY116-2",345 .ident = "Direkt-Tek DTLAPY116-2",
327 .matches = {346 .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
84 return 0;84 return 0;
85out:85out:
86 dev_err(&cl->device->dev, "error in allocating Tx pool\n");86 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);
88 return -ENOMEM;88 return -ENOMEM;
89}89}
90 90
drivers/hid/wacom.h+15−0
@@ -202,6 +202,21 @@ static inline void wacom_schedule_work(struct wacom_wac *wacom_wac, · 201 unmodified lines
202 }202 }
203}203}
204 204
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 */
210static 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
205extern const struct hid_device_id wacom_ids[];220extern const struct hid_device_id wacom_ids[];
206 221
207void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len);222void 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
2303 case HID_DG_TOOLSERIALNUMBER:2303 case HID_DG_TOOLSERIALNUMBER:
2304 if (value) {2304 if (value) {
2305 wacom_wac->serial[0] = (wacom_wac->serial[0] & ~0xFFFFFFFFULL);2305 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);
2307 }2307 }
2308 return;2308 return;
2309 case HID_DG_TWIST:2309 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
2319 return;2319 return;
2320 case WACOM_HID_WD_SERIALHI:2320 case WACOM_HID_WD_SERIALHI:
2321 if (value) {2321 if (value) {
2322 __u32 raw_value = wacom_s32tou(value, field->report_size);
2323
2322 wacom_wac->serial[0] = (wacom_wac->serial[0] & 0xFFFFFFFF);2324 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;
2324 /*2326 /*
2325 * Non-USI EMR devices may contain additional tool type2327 * Non-USI EMR devices may contain additional tool type
2326 * information here. See WACOM_HID_WD_TOOLTYPE case for2328 * information here. See WACOM_HID_WD_TOOLTYPE case for
2327 * more details.2329 * more details.
2328 */2330 */
2329 if (value >> 20 == 1) {2331 if (value >> 20 == 1) {
2330 wacom_wac->id[0] |= value & 0xFFFFF;2332 wacom_wac->id[0] |= raw_value & 0xFFFFF;
2331 }2333 }
2332 }2334 }
2333 return;2335 return;
@@ -2339,7 +2341,7 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field · 5 unmodified lines
2339 * bitwise OR so the complete value can be built2341 * bitwise OR so the complete value can be built
2340 * up over time :(2342 * up over time :(
2341 */2343 */
2342 wacom_wac->id[0] |= value;2344 wacom_wac->id[0] |= wacom_s32tou(value, field->report_size);
2343 return;2345 return;
2344 case WACOM_HID_WD_OFFSETLEFT:2346 case WACOM_HID_WD_OFFSETLEFT:
2345 if (features->offset_left && value != features->offset_left)2347 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
170 170
171 /* Polling the CVRF bit to make sure read data is ready */171 /* Polling the CVRF bit to make sure read data is ready */
172 return regmap_field_read_poll_timeout(ina->fields[F_CVRF],172 return regmap_field_read_poll_timeout(ina->fields[F_CVRF],
173 cvrf, cvrf, wait, 100000);173 cvrf, cvrf, wait, wait * 2);
174}174}
175 175
176static int ina3221_read_value(struct ina3221_data *ina, unsigned int reg,176static int ina3221_read_value(struct ina3221_data *ina, unsigned int reg,
drivers/hwmon/nct7904.c+12−3
@@ -82,6 +82,10 @@ · 81 unmodified lines
82#define FANCTL1_FMR_REG 0x00 /* Bank 3; 1 reg per channel */82#define FANCTL1_FMR_REG 0x00 /* Bank 3; 1 reg per channel */
83#define FANCTL1_OUT_REG 0x10 /* Bank 3; 1 reg per channel */83#define FANCTL1_OUT_REG 0x10 /* Bank 3; 1 reg per channel */
84 84
85#define VOLT_MONITOR_MODE 0x0
86#define THERMAL_DIODE_MODE 0x1
87#define THERMISTOR_MODE 0x3
88
85#define ENABLE_TSI BIT(1)89#define ENABLE_TSI BIT(1)
86 90
87static const unsigned short normal_i2c[] = {91static const unsigned short normal_i2c[] = {
@@ -935,11 +939,16 @@ static int nct7904_probe(struct i2c_client *client, · 847 unmodified lines
935 for (i = 0; i < 4; i++) {939 for (i = 0; i < 4; i++) {
936 val = (ret >> (i * 2)) & 0x03;940 val = (ret >> (i * 2)) & 0x03;
937 bit = (1 << i);941 bit = (1 << i);
938 if (val == 0) {942 if (val == VOLT_MONITOR_MODE) {
939 data->tcpu_mask &= ~bit;943 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));
940 } else {949 } else {
941 if (val == 0x1 || val == 0x2)950 /* Reserved */
942 data->temp_mode |= bit;951 data->tcpu_mask &= ~bit;
943 data->vsen_mask &= ~(0x06 << (i * 2));952 data->vsen_mask &= ~(0x06 << (i * 2));
944 }953 }
945 }954 }
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
626 if (!count)626 if (!count)
627 dev_dbg(&thdev->dev, "timeout waiting for CTS Trigger\n");627 dev_dbg(&thdev->dev, "timeout waiting for CTS Trigger\n");
628 628
629 /* De-assert the trigger */
630 iowrite32(0, gth->base + REG_CTS_CTL);
631
629 intel_th_gth_stop(gth, output, false);632 intel_th_gth_stop(gth, output, false);
630 intel_th_gth_start(gth, output);633 intel_th_gth_start(gth, output);
631}634}
drivers/hwtracing/intel_th/msu.c+8−3
@@ -164,7 +164,7 @@ struct msc { · 163 unmodified lines
164};164};
165 165
166static LIST_HEAD(msu_buffer_list);166static LIST_HEAD(msu_buffer_list);
167static struct mutex msu_buffer_mutex;167static DEFINE_MUTEX(msu_buffer_mutex);
168 168
169/**169/**
170 * struct msu_buffer_entry - internal MSU buffer bookkeeping170 * 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
327 struct msc_block_desc *bdesc = sg_virt(sg);327 struct msc_block_desc *bdesc = sg_virt(sg);
328 328
329 if (msc_block_wrapped(bdesc))329 if (msc_block_wrapped(bdesc))
330 return win->nr_blocks << PAGE_SHIFT;330 return (size_t)win->nr_blocks << PAGE_SHIFT;
331 331
332 size += msc_total_sz(bdesc);332 size += msc_total_sz(bdesc);
333 if (msc_block_last_written(bdesc))333 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
1848 len = cp - buf;1848 len = cp - buf;
1849 1849
1850 mode = kstrndup(buf, len, GFP_KERNEL);1850 mode = kstrndup(buf, len, GFP_KERNEL);
1851 if (!mode)
1852 return -ENOMEM;
1853
1851 i = match_string(msc_mode, ARRAY_SIZE(msc_mode), mode);1854 i = match_string(msc_mode, ARRAY_SIZE(msc_mode), mode);
1852 if (i >= 0)1855 if (i >= 0) {
1856 kfree(mode);
1853 goto found;1857 goto found;
1858 }
1854 1859
1855 /* Buffer sinks only work with a usable IRQ */1860 /* Buffer sinks only work with a usable IRQ */
1856 if (!msc->do_irq) {1861 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
199 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x02a6),199 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x02a6),
200 .driver_data = (kernel_ulong_t)&intel_th_2x,200 .driver_data = (kernel_ulong_t)&intel_th_2x,
201 },201 },
202 {
203 /* Comet Lake PCH */
204 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x06a6),
205 .driver_data = (kernel_ulong_t)&intel_th_2x,
206 },
202 {207 {
203 /* Ice Lake NNPI */208 /* Ice Lake NNPI */
204 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x45c5),209 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
209 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa0a6),214 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa0a6),
210 .driver_data = (kernel_ulong_t)&intel_th_2x,215 .driver_data = (kernel_ulong_t)&intel_th_2x,
211 },216 },
217 {
218 /* Jasper Lake PCH */
219 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4da6),
220 .driver_data = (kernel_ulong_t)&intel_th_2x,
221 },
212 { 0 },222 { 0 },
213};223};
214 224
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
1399 cookie = dmaengine_submit(desc);1399 cookie = dmaengine_submit(desc);
1400 ret = dma_submit_error(cookie);1400 ret = dma_submit_error(cookie);
1401 if (ret) {1401 if (ret) {
1402 dmaengine_terminate_all(adc->dma_chan);1402 dmaengine_terminate_sync(adc->dma_chan);
1403 return ret;1403 return ret;
1404 }1404 }
1405 1405
@@ -1477,7 +1477,7 @@ static void __stm32_adc_buffer_predisable(struct iio_dev *indio_dev) · 71 unmodified lines
1477 stm32_adc_conv_irq_disable(adc);1477 stm32_adc_conv_irq_disable(adc);
1478 1478
1479 if (adc->dma_chan)1479 if (adc->dma_chan)
1480 dmaengine_terminate_all(adc->dma_chan);1480 dmaengine_terminate_sync(adc->dma_chan);
1481 1481
1482 if (stm32_adc_set_trig(indio_dev, NULL))1482 if (stm32_adc_set_trig(indio_dev, NULL))
1483 dev_err(&indio_dev->dev, "Can't clear trigger\n");1483 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
317 struct adis16480 *st = iio_priv(indio_dev);317 struct adis16480 *st = iio_priv(indio_dev);
318 unsigned int t, reg;318 unsigned int t, reg;
319 319
320 if (val < 0 || val2 < 0)
321 return -EINVAL;
322
320 t = val * 1000 + val2 / 1000;323 t = val * 1000 + val2 / 1000;
321 if (t <= 0)324 if (t == 0)
322 return -EINVAL;325 return -EINVAL;
323 326
324 /*327 /*
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
114 .name = "MPU6050",114 .name = "MPU6050",
115 .reg = &reg_set_6050,115 .reg = &reg_set_6050,
116 .config = &chip_config_6050,116 .config = &chip_config_6050,
117 .fifo_size = 1024,
117 },118 },
118 {119 {
119 .whoami = INV_MPU6500_WHOAMI_VALUE,120 .whoami = INV_MPU6500_WHOAMI_VALUE,
120 .name = "MPU6500",121 .name = "MPU6500",
121 .reg = &reg_set_6500,122 .reg = &reg_set_6500,
122 .config = &chip_config_6050,123 .config = &chip_config_6050,
124 .fifo_size = 512,
123 },125 },
124 {126 {
125 .whoami = INV_MPU6515_WHOAMI_VALUE,127 .whoami = INV_MPU6515_WHOAMI_VALUE,
126 .name = "MPU6515",128 .name = "MPU6515",
127 .reg = &reg_set_6500,129 .reg = &reg_set_6500,
128 .config = &chip_config_6050,130 .config = &chip_config_6050,
131 .fifo_size = 512,
129 },132 },
130 {133 {
131 .whoami = INV_MPU6000_WHOAMI_VALUE,134 .whoami = INV_MPU6000_WHOAMI_VALUE,
132 .name = "MPU6000",135 .name = "MPU6000",
133 .reg = &reg_set_6050,136 .reg = &reg_set_6050,
134 .config = &chip_config_6050,137 .config = &chip_config_6050,
138 .fifo_size = 1024,
135 },139 },
136 {140 {
137 .whoami = INV_MPU9150_WHOAMI_VALUE,141 .whoami = INV_MPU9150_WHOAMI_VALUE,
138 .name = "MPU9150",142 .name = "MPU9150",
139 .reg = &reg_set_6050,143 .reg = &reg_set_6050,
140 .config = &chip_config_6050,144 .config = &chip_config_6050,
145 .fifo_size = 1024,
141 },146 },
142 {147 {
143 .whoami = INV_MPU9250_WHOAMI_VALUE,148 .whoami = INV_MPU9250_WHOAMI_VALUE,
144 .name = "MPU9250",149 .name = "MPU9250",
145 .reg = &reg_set_6500,150 .reg = &reg_set_6500,
146 .config = &chip_config_6050,151 .config = &chip_config_6050,
152 .fifo_size = 512,
147 },153 },
148 {154 {
149 .whoami = INV_MPU9255_WHOAMI_VALUE,155 .whoami = INV_MPU9255_WHOAMI_VALUE,
150 .name = "MPU9255",156 .name = "MPU9255",
151 .reg = &reg_set_6500,157 .reg = &reg_set_6500,
152 .config = &chip_config_6050,158 .config = &chip_config_6050,
159 .fifo_size = 512,
153 },160 },
154 {161 {
155 .whoami = INV_ICM20608_WHOAMI_VALUE,162 .whoami = INV_ICM20608_WHOAMI_VALUE,
156 .name = "ICM20608",163 .name = "ICM20608",
157 .reg = &reg_set_6500,164 .reg = &reg_set_6500,
158 .config = &chip_config_6050,165 .config = &chip_config_6050,
166 .fifo_size = 512,
159 },167 },
160 {168 {
161 .whoami = INV_ICM20602_WHOAMI_VALUE,169 .whoami = INV_ICM20602_WHOAMI_VALUE,
162 .name = "ICM20602",170 .name = "ICM20602",
163 .reg = &reg_set_icm20602,171 .reg = &reg_set_icm20602,
164 .config = &chip_config_6050,172 .config = &chip_config_6050,
173 .fifo_size = 1008,
165 },174 },
166};175};
167 176
drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h+2−0
@@ -100,12 +100,14 @@ struct inv_mpu6050_chip_config { · 99 unmodified lines
100 * @name: name of the chip.100 * @name: name of the chip.
101 * @reg: register map of the chip.101 * @reg: register map of the chip.
102 * @config: configuration of the chip.102 * @config: configuration of the chip.
103 * @fifo_size: size of the FIFO in bytes.
103 */104 */
104struct inv_mpu6050_hw {105struct inv_mpu6050_hw {
105 u8 whoami;106 u8 whoami;
106 u8 *name;107 u8 *name;
107 const struct inv_mpu6050_reg_map *reg;108 const struct inv_mpu6050_reg_map *reg;
108 const struct inv_mpu6050_chip_config *config;109 const struct inv_mpu6050_chip_config *config;
110 size_t fifo_size;
109};111};
110 112
111/*113/*
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
180 "failed to ack interrupt\n");180 "failed to ack interrupt\n");
181 goto flush_fifo;181 goto flush_fifo;
182 }182 }
183 /* handle fifo overflow by reseting fifo */
184 if (int_status & INV_MPU6050_BIT_FIFO_OVERFLOW_INT)
185 goto flush_fifo;
186 if (!(int_status & INV_MPU6050_BIT_RAW_DATA_RDY_INT)) {183 if (!(int_status & INV_MPU6050_BIT_RAW_DATA_RDY_INT)) {
187 dev_warn(regmap_get_device(st->map),184 dev_warn(regmap_get_device(st->map),
188 "spurious interrupt with status 0x%x\n", int_status);185 "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
211 if (result)208 if (result)
212 goto end_session;209 goto end_session;
213 fifo_count = get_unaligned_be16(&data[0]);210 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
214 /* compute and process all complete datum */223 /* compute and process all complete datum */
215 nb = fifo_count / bytes_per_datum;224 nb = fifo_count / bytes_per_datum;
216 inv_mpu6050_update_period(st, pf->timestamp, nb);225 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
110 udelay(data->cfg->trigger_pulse_us);110 udelay(data->cfg->trigger_pulse_us);
111 gpiod_set_value(data->gpiod_trig, 0);111 gpiod_set_value(data->gpiod_trig, 0);
112 112
113 /* it cannot take more than 20 ms */113 /* it should not take more than 20 ms until echo is rising */
114 ret = wait_for_completion_killable_timeout(&data->rising, HZ/50);114 ret = wait_for_completion_killable_timeout(&data->rising, HZ/50);
115 if (ret < 0) {115 if (ret < 0) {
116 mutex_unlock(&data->lock);116 mutex_unlock(&data->lock);
@@ -120,7 +120,8 @@ static int srf04_read(struct srf04_data *data) · 3 unmodified lines
120 return -ETIMEDOUT;120 return -ETIMEDOUT;
121 }121 }
122 122
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);
124 if (ret < 0) {125 if (ret < 0) {
125 mutex_unlock(&data->lock);126 mutex_unlock(&data->lock);
126 return ret;127 return ret;
@@ -135,19 +136,19 @@ static int srf04_read(struct srf04_data *data) · 8 unmodified lines
135 136
136 dt_ns = ktime_to_ns(ktime_dt);137 dt_ns = ktime_to_ns(ktime_dt);
137 /*138 /*
138 * measuring more than 3 meters is beyond the capabilities of139 * measuring more than 6,45 meters is beyond the capabilities of
139 * the sensor140 * the supported sensors
140 * ==> filter out invalid results for not measuring echos of141 * ==> filter out invalid results for not measuring echos of
141 * another us sensor142 * another us sensor
142 *143 *
143 * formula:144 * formula:
144 * distance 3 m145 * distance 6,45 * 2 m
145 * time = ---------- = --------- = 9404389 ns146 * time = ---------- = ------------ = 40438871 ns
146 * speed 319 m/s147 * speed 319 m/s
147 *148 *
148 * using a minimum speed at -20 °C of 319 m/s149 * using a minimum speed at -20 °C of 319 m/s
149 */150 */
150 if (dt_ns > 9404389)151 if (dt_ns > 40438871)
151 return -EIO;152 return -EIO;
152 153
153 time_ns = dt_ns;154 time_ns = dt_ns;
@@ -159,20 +160,20 @@ static int srf04_read(struct srf04_data *data) · 5 unmodified lines
159 * with Temp in °C160 * with Temp in °C
160 * and speed in m/s161 * and speed in m/s
161 *162 *
162 * use 343 m/s as ultrasonic speed at 20 °C here in absence of the163 * use 343,5 m/s as ultrasonic speed at 20 °C here in absence of the
163 * temperature164 * temperature
164 *165 *
165 * therefore:166 * therefore:
166 * time 343167 * time 343,5 time * 106
167 * distance = ------ * -----168 * distance = ------ * ------- = ------------
168 * 10^6 2169 * 10^6 2 617176
169 * with time in ns170 * with time in ns
170 * and distance in mm (one way)171 * and distance in mm (one way)
171 *172 *
172 * because we limit to 3 meters the multiplication with 343 just173 * because we limit to 6,45 meters the multiplication with 106 just
173 * fits into 32 bit174 * fits into 32 bit
174 */175 */
175 distance_mm = time_ns * 343 / 2000000;176 distance_mm = time_ns * 106 / 617176;
176 177
177 return distance_mm;178 return distance_mm;
178}179}
drivers/infiniband/core/core_priv.h+1−0
@@ -199,6 +199,7 @@ void ib_mad_cleanup(void); · 198 unmodified lines
199int ib_sa_init(void);199int ib_sa_init(void);
200void ib_sa_cleanup(void);200void ib_sa_cleanup(void);
201 201
202void rdma_nl_init(void);
202void rdma_nl_exit(void);203void rdma_nl_exit(void);
203 204
204int ib_nl_handle_resolve_resp(struct sk_buff *skb,205int 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
2716 goto err_comp_unbound;2716 goto err_comp_unbound;
2717 }2717 }
2718 2718
2719 rdma_nl_init();
2720
2719 ret = addr_init();2721 ret = addr_init();
2720 if (ret) {2722 if (ret) {
2721 pr_warn("Could't init IB address resolution\n");2723 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
372static void destroy_cm_id(struct iw_cm_id *cm_id)372static void destroy_cm_id(struct iw_cm_id *cm_id)
373{373{
374 struct iwcm_id_private *cm_id_priv;374 struct iwcm_id_private *cm_id_priv;
375 struct ib_qp *qp;
375 unsigned long flags;376 unsigned long flags;
376 377
377 cm_id_priv = container_of(cm_id, struct iwcm_id_private, id);378 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
389 set_bit(IWCM_F_DROP_EVENTS, &cm_id_priv->flags);390 set_bit(IWCM_F_DROP_EVENTS, &cm_id_priv->flags);
390 391
391 spin_lock_irqsave(&cm_id_priv->lock, flags);392 spin_lock_irqsave(&cm_id_priv->lock, flags);
393 qp = cm_id_priv->qp;
394 cm_id_priv->qp = NULL;
395
392 switch (cm_id_priv->state) {396 switch (cm_id_priv->state) {
393 case IW_CM_STATE_LISTEN:397 case IW_CM_STATE_LISTEN:
394 cm_id_priv->state = IW_CM_STATE_DESTROYING;398 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
401 cm_id_priv->state = IW_CM_STATE_DESTROYING;405 cm_id_priv->state = IW_CM_STATE_DESTROYING;
402 spin_unlock_irqrestore(&cm_id_priv->lock, flags);406 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
403 /* Abrupt close of the connection */407 /* Abrupt close of the connection */
404 (void)iwcm_modify_qp_err(cm_id_priv->qp);408 (void)iwcm_modify_qp_err(qp);
405 spin_lock_irqsave(&cm_id_priv->lock, flags);409 spin_lock_irqsave(&cm_id_priv->lock, flags);
406 break;410 break;
407 case IW_CM_STATE_IDLE:411 case IW_CM_STATE_IDLE:
@@ -426,11 +430,9 @@ static void destroy_cm_id(struct iw_cm_id *cm_id) · 18 unmodified lines
426 BUG();430 BUG();
427 break;431 break;
428 }432 }
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 }
433 spin_unlock_irqrestore(&cm_id_priv->lock, flags);433 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
434 if (qp)
435 cm_id_priv->id.device->ops.iw_rem_ref(qp);
434 436
435 if (cm_id->mapped) {437 if (cm_id->mapped) {
436 iwpm_remove_mapinfo(&cm_id->local_addr, &cm_id->m_local_addr);438 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
671 BUG_ON(cm_id_priv->state != IW_CM_STATE_CONN_RECV);673 BUG_ON(cm_id_priv->state != IW_CM_STATE_CONN_RECV);
672 cm_id_priv->state = IW_CM_STATE_IDLE;674 cm_id_priv->state = IW_CM_STATE_IDLE;
673 spin_lock_irqsave(&cm_id_priv->lock, flags);675 spin_lock_irqsave(&cm_id_priv->lock, flags);
674 if (cm_id_priv->qp) {676 qp = cm_id_priv->qp;
675 cm_id->device->ops.iw_rem_ref(qp);677 cm_id_priv->qp = NULL;
676 cm_id_priv->qp = NULL;
677 }
678 spin_unlock_irqrestore(&cm_id_priv->lock, flags);678 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
679 if (qp)
680 cm_id->device->ops.iw_rem_ref(qp);
679 clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags);681 clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags);
680 wake_up_all(&cm_id_priv->connect_wait);682 wake_up_all(&cm_id_priv->connect_wait);
681 }683 }
@@ -696,7 +698,7 @@ int iw_cm_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param) · 14 unmodified lines
696 struct iwcm_id_private *cm_id_priv;698 struct iwcm_id_private *cm_id_priv;
697 int ret;699 int ret;
698 unsigned long flags;700 unsigned long flags;
699 struct ib_qp *qp;701 struct ib_qp *qp = NULL;
700 702
701 cm_id_priv = container_of(cm_id, struct iwcm_id_private, id);703 cm_id_priv = container_of(cm_id, struct iwcm_id_private, id);
702 704
@@ -730,13 +732,13 @@ int iw_cm_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param) · 27 unmodified lines
730 return 0; /* success */732 return 0; /* success */
731 733
732 spin_lock_irqsave(&cm_id_priv->lock, flags);734 spin_lock_irqsave(&cm_id_priv->lock, flags);
733 if (cm_id_priv->qp) {735 qp = cm_id_priv->qp;
734 cm_id->device->ops.iw_rem_ref(qp);736 cm_id_priv->qp = NULL;
735 cm_id_priv->qp = NULL;
736 }
737 cm_id_priv->state = IW_CM_STATE_IDLE;737 cm_id_priv->state = IW_CM_STATE_IDLE;
738err:738err:
739 spin_unlock_irqrestore(&cm_id_priv->lock, flags);739 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
740 if (qp)
741 cm_id->device->ops.iw_rem_ref(qp);
740 clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags);742 clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags);
741 wake_up_all(&cm_id_priv->connect_wait);743 wake_up_all(&cm_id_priv->connect_wait);
742 return ret;744 return ret;
@@ -878,6 +880,7 @@ static int cm_conn_est_handler(struct iwcm_id_private *cm_id_priv, · 135 unmodified lines
878static int cm_conn_rep_handler(struct iwcm_id_private *cm_id_priv,880static int cm_conn_rep_handler(struct iwcm_id_private *cm_id_priv,
879 struct iw_cm_event *iw_event)881 struct iw_cm_event *iw_event)
880{882{
883 struct ib_qp *qp = NULL;
881 unsigned long flags;884 unsigned long flags;
882 int ret;885 int ret;
883 886
@@ -896,11 +899,13 @@ static int cm_conn_rep_handler(struct iwcm_id_private *cm_id_priv, · 12 unmodified lines
896 cm_id_priv->state = IW_CM_STATE_ESTABLISHED;899 cm_id_priv->state = IW_CM_STATE_ESTABLISHED;
897 } else {900 } else {
898 /* REJECTED or RESET */901 /* REJECTED or RESET */
899 cm_id_priv->id.device->ops.iw_rem_ref(cm_id_priv->qp);902 qp = cm_id_priv->qp;
900 cm_id_priv->qp = NULL;903 cm_id_priv->qp = NULL;
901 cm_id_priv->state = IW_CM_STATE_IDLE;904 cm_id_priv->state = IW_CM_STATE_IDLE;
902 }905 }
903 spin_unlock_irqrestore(&cm_id_priv->lock, flags);906 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
907 if (qp)
908 cm_id_priv->id.device->ops.iw_rem_ref(qp);
904 ret = cm_id_priv->id.cm_handler(&cm_id_priv->id, iw_event);909 ret = cm_id_priv->id.cm_handler(&cm_id_priv->id, iw_event);
905 910
906 if (iw_event->private_data_len)911 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
942static int cm_close_handler(struct iwcm_id_private *cm_id_priv,947static int cm_close_handler(struct iwcm_id_private *cm_id_priv,
943 struct iw_cm_event *iw_event)948 struct iw_cm_event *iw_event)
944{949{
950 struct ib_qp *qp;
945 unsigned long flags;951 unsigned long flags;
946 int ret = 0;952 int ret = 0, notify_event = 0;
947 spin_lock_irqsave(&cm_id_priv->lock, flags);953 spin_lock_irqsave(&cm_id_priv->lock, flags);
954 qp = cm_id_priv->qp;
955 cm_id_priv->qp = NULL;
948 956
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 }
953 switch (cm_id_priv->state) {957 switch (cm_id_priv->state) {
954 case IW_CM_STATE_ESTABLISHED:958 case IW_CM_STATE_ESTABLISHED:
955 case IW_CM_STATE_CLOSING:959 case IW_CM_STATE_CLOSING:
956 cm_id_priv->state = IW_CM_STATE_IDLE;960 cm_id_priv->state = IW_CM_STATE_IDLE;
957 spin_unlock_irqrestore(&cm_id_priv->lock, flags);961 notify_event = 1;
958 ret = cm_id_priv->id.cm_handler(&cm_id_priv->id, iw_event);
959 spin_lock_irqsave(&cm_id_priv->lock, flags);
960 break;962 break;
961 case IW_CM_STATE_DESTROYING:963 case IW_CM_STATE_DESTROYING:
962 break;964 break;
@@ -965,6 +967,10 @@ static int cm_close_handler(struct iwcm_id_private *cm_id_priv, · 2 unmodified lines
965 }967 }
966 spin_unlock_irqrestore(&cm_id_priv->lock, flags);968 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
967 969
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);
968 return ret;974 return ret;
969}975}
970 976
drivers/infiniband/core/netlink.c+53−54
@@ -42,9 +42,12 @@ · 41 unmodified lines
42#include <linux/module.h>42#include <linux/module.h>
43#include "core_priv.h"43#include "core_priv.h"
44 44
45static DEFINE_MUTEX(rdma_nl_mutex);
46static struct {45static 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;
48} rdma_nl_types[RDMA_NL_NUM_CLIENTS];51} rdma_nl_types[RDMA_NL_NUM_CLIENTS];
49 52
50bool rdma_nl_chk_listeners(unsigned int group)53bool 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
75 return (op < max_num_ops[type]) ? true : false;78 return (op < max_num_ops[type]) ? true : false;
76}79}
77 80
78static bool81static const struct rdma_nl_cbs *
79is_nl_valid(const struct sk_buff *skb, unsigned int type, unsigned int op)82get_cb_table(const struct sk_buff *skb, unsigned int type, unsigned int op)
80{83{
81 const struct rdma_nl_cbs *cb_table;84 const struct rdma_nl_cbs *cb_table;
82 85
83 if (!is_nl_msg_valid(type, op))
84 return false;
85
86 /*86 /*
87 * Currently only NLDEV client is supporting netlink commands in87 * Currently only NLDEV client is supporting netlink commands in
88 * non init_net net namespace.88 * non init_net net namespace.
89 */89 */
90 if (sock_net(skb->sk) != &init_net && type != RDMA_NL_NLDEV)90 if (sock_net(skb->sk) != &init_net && type != RDMA_NL_NLDEV)
91 return false;91 return NULL;
92 92
93 if (!rdma_nl_types[type].cb_table) {93 cb_table = READ_ONCE(rdma_nl_types[type].cb_table);
94 mutex_unlock(&rdma_nl_mutex);94 if (!cb_table) {
95 request_module("rdma-netlink-subsys-%d", type);95 /*
96 mutex_lock(&rdma_nl_mutex);96 * Didn't get valid reference of the table, attempt module
97 }97 * load once.
98 */
99 up_read(&rdma_nl_types[type].sem);
98 100
99 cb_table = rdma_nl_types[type].cb_table;101 request_module("rdma-netlink-subsys-%d", type);
100 102
103 down_read(&rdma_nl_types[type].sem);
104 cb_table = READ_ONCE(rdma_nl_types[type].cb_table);
105 }
101 if (!cb_table || (!cb_table[op].dump && !cb_table[op].doit))106 if (!cb_table || (!cb_table[op].dump && !cb_table[op].doit))
102 return false;107 return NULL;
103 return true;108 return cb_table;
104}109}
105 110
106void rdma_nl_register(unsigned int index,111void rdma_nl_register(unsigned int index,
107 const struct rdma_nl_cbs cb_table[])112 const struct rdma_nl_cbs cb_table[])
108{113{
109 mutex_lock(&rdma_nl_mutex);114 if (WARN_ON(!is_nl_msg_valid(index, 0)) ||
110 if (!is_nl_msg_valid(index, 0)) {115 WARN_ON(READ_ONCE(rdma_nl_types[index].cb_table)))
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);
121 return;116 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 }
131 117
132 rdma_nl_types[index].cb_table = cb_table;118 /* Pairs with the READ_ONCE in is_nl_valid() */
133 mutex_unlock(&rdma_nl_mutex);119 smp_store_release(&rdma_nl_types[index].cb_table, cb_table);
134}120}
135EXPORT_SYMBOL(rdma_nl_register);121EXPORT_SYMBOL(rdma_nl_register);
136 122
137void rdma_nl_unregister(unsigned int index)123void rdma_nl_unregister(unsigned int index)
138{124{
139 mutex_lock(&rdma_nl_mutex);125 down_write(&rdma_nl_types[index].sem);
140 rdma_nl_types[index].cb_table = NULL;126 rdma_nl_types[index].cb_table = NULL;
141 mutex_unlock(&rdma_nl_mutex);127 up_write(&rdma_nl_types[index].sem);
142}128}
143EXPORT_SYMBOL(rdma_nl_unregister);129EXPORT_SYMBOL(rdma_nl_unregister);
144 130
@@ -170,15 +156,21 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, · 25 unmodified lines
170 unsigned int index = RDMA_NL_GET_CLIENT(type);156 unsigned int index = RDMA_NL_GET_CLIENT(type);
171 unsigned int op = RDMA_NL_GET_OP(type);157 unsigned int op = RDMA_NL_GET_OP(type);
172 const struct rdma_nl_cbs *cb_table;158 const struct rdma_nl_cbs *cb_table;
159 int err = -EINVAL;
173 160
174 if (!is_nl_valid(skb, index, op))161 if (!is_nl_msg_valid(index, op))
175 return -EINVAL;162 return -EINVAL;
176 163
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;
178 168
179 if ((cb_table[op].flags & RDMA_NL_ADMIN_PERM) &&169 if ((cb_table[op].flags & RDMA_NL_ADMIN_PERM) &&
180 !netlink_capable(skb, CAP_NET_ADMIN))170 !netlink_capable(skb, CAP_NET_ADMIN)) {
181 return -EPERM;171 err = -EPERM;
172 goto done;
173 }
182 174
183 /*175 /*
184 * LS responses overload the 0x100 (NLM_F_ROOT) flag. Don't176 * 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
186 */178 */
187 if (index == RDMA_NL_LS) {179 if (index == RDMA_NL_LS) {
188 if (cb_table[op].doit)180 if (cb_table[op].doit)
189 return cb_table[op].doit(skb, nlh, extack);181 err = cb_table[op].doit(skb, nlh, extack);
190 return -EINVAL;182 goto done;
191 }183 }
192 /* FIXME: Convert IWCM to properly handle doit callbacks */184 /* FIXME: Convert IWCM to properly handle doit callbacks */
193 if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_IWCM) {185 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
195 .dump = cb_table[op].dump,187 .dump = cb_table[op].dump,
196 };188 };
197 if (c.dump)189 if (c.dump)
198 return netlink_dump_start(skb->sk, skb, nlh, &c);190 err = netlink_dump_start(skb->sk, skb, nlh, &c);
199 return -EINVAL;191 goto done;
200 }192 }
201 193
202 if (cb_table[op].doit)194 if (cb_table[op].doit)
203 return cb_table[op].doit(skb, nlh, extack);195 err = cb_table[op].doit(skb, nlh, extack);
204 196done:
205 return 0;197 up_read(&rdma_nl_types[index].sem);
198 return err;
206}199}
207 200
208/*201/*
@@ -263,9 +256,7 @@ skip: · 54 unmodified lines
263 256
264static void rdma_nl_rcv(struct sk_buff *skb)257static void rdma_nl_rcv(struct sk_buff *skb)
265{258{
266 mutex_lock(&rdma_nl_mutex);
267 rdma_nl_rcv_skb(skb, &rdma_nl_rcv_msg);259 rdma_nl_rcv_skb(skb, &rdma_nl_rcv_msg);
268 mutex_unlock(&rdma_nl_mutex);
269}260}
270 261
271int rdma_nl_unicast(struct net *net, struct sk_buff *skb, u32 pid)262int 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
297}288}
298EXPORT_SYMBOL(rdma_nl_multicast);289EXPORT_SYMBOL(rdma_nl_multicast);
299 290
291void 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
300void rdma_nl_exit(void)299void rdma_nl_exit(void)
301{300{
302 int idx;301 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
778 container_of(res, struct rdma_counter, res);778 container_of(res, struct rdma_counter, res);
779 779
780 if (port && port != counter->port)780 if (port && port != counter->port)
781 return 0;781 return -EAGAIN;
782 782
783 /* Dump it even query failed */783 /* Dump it even query failed */
784 rdma_counter_query_stats(counter);784 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
98 98
99struct ib_uverbs_device {99struct ib_uverbs_device {
100 atomic_t refcount;100 atomic_t refcount;
101 int num_comp_vectors;101 u32 num_comp_vectors;
102 struct completion comp;102 struct completion comp;
103 struct device dev;103 struct device dev;
104 /* First group for device attributes, NULL terminated array */104 /* 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
662 void *context)662 void *context)
663{663{
664 struct find_gid_index_context *ctx = context;664 struct find_gid_index_context *ctx = context;
665 u16 vlan_id = 0xffff;
666 int ret;
665 667
666 if (ctx->gid_type != gid_attr->gid_type)668 if (ctx->gid_type != gid_attr->gid_type)
667 return false;669 return false;
668 670
669 if ((!!(ctx->vlan_id != 0xffff) == !is_vlan_dev(gid_attr->ndev)) ||671 ret = rdma_read_gid_l2_fields(gid_attr, &vlan_id, NULL);
670 (is_vlan_dev(gid_attr->ndev) &&672 if (ret)
671 vlan_dev_vlan_id(gid_attr->ndev) != ctx->vlan_id))
672 return false;673 return false;
673 674
674 return true;675 return ctx->vlan_id == vlan_id;
675}676}
676 677
677static const struct ib_gid_attr *678static 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
495 495
496 ep = *((struct c4iw_ep **)(skb->cb + 2 * sizeof(void *)));496 ep = *((struct c4iw_ep **)(skb->cb + 2 * sizeof(void *)));
497 release_ep_resources(ep);497 release_ep_resources(ep);
498 kfree_skb(skb);
499 return 0;498 return 0;
500}499}
501 500
@@ -506,7 +505,6 @@ static int _put_pass_ep_safe(struct c4iw_dev *dev, struct sk_buff *skb) · 4 unmodified lines
506 ep = *((struct c4iw_ep **)(skb->cb + 2 * sizeof(void *)));505 ep = *((struct c4iw_ep **)(skb->cb + 2 * sizeof(void *)));
507 c4iw_put_ep(&ep->parent_ep->com);506 c4iw_put_ep(&ep->parent_ep->com);
508 release_ep_resources(ep);507 release_ep_resources(ep);
509 kfree_skb(skb);
510 return 0;508 return 0;
511}509}
512 510
@@ -2424,20 +2422,6 @@ static int accept_cr(struct c4iw_ep *ep, struct sk_buff *skb, · 1911 unmodified lines
2424 enum chip_type adapter_type = ep->com.dev->rdev.lldi.adapter_type;2422 enum chip_type adapter_type = ep->com.dev->rdev.lldi.adapter_type;
2425 2423
2426 pr_debug("ep %p tid %u\n", ep, ep->hwtid);2424 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
2441 cxgb_best_mtu(ep->com.dev->rdev.lldi.mtus, ep->mtu, &mtu_idx,2425 cxgb_best_mtu(ep->com.dev->rdev.lldi.mtus, ep->mtu, &mtu_idx,
2442 enable_tcp_timestamps && req->tcpopt.tstamp,2426 enable_tcp_timestamps && req->tcpopt.tstamp,
2443 (ep->com.remote_addr.ss_family == AF_INET) ? 0 : 1);2427 (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
2483 if (tcph->ece && tcph->cwr)2467 if (tcph->ece && tcph->cwr)
2484 opt2 |= CCTRL_ECN_V(1);2468 opt2 |= CCTRL_ECN_V(1);
2485 }2469 }
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
2486 if (CHELSIO_CHIP_VERSION(adapter_type) > CHELSIO_T4) {2484 if (CHELSIO_CHIP_VERSION(adapter_type) > CHELSIO_T4) {
2487 u32 isn = (prandom_u32() & ~7UL) - 1;2485 u32 isn = (prandom_u32() & ~7UL) - 1;
2488 opt2 |= T5_OPT_2_VALID_F;2486 opt2 |= T5_OPT_2_VALID_F;
drivers/infiniband/hw/hfi1/sdma.c+3−2
@@ -65,6 +65,7 @@ · 64 unmodified lines
65#define SDMA_DESCQ_CNT 204865#define SDMA_DESCQ_CNT 2048
66#define SDMA_DESC_INTR 6466#define SDMA_DESC_INTR 64
67#define INVALID_TAIL 0xffff67#define INVALID_TAIL 0xffff
68#define SDMA_PAD max_t(size_t, MAX_16B_PADDING, sizeof(u32))
68 69
69static uint sdma_descq_cnt = SDMA_DESCQ_CNT;70static uint sdma_descq_cnt = SDMA_DESCQ_CNT;
70module_param(sdma_descq_cnt, uint, S_IRUGO);71module_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
1296 struct sdma_engine *sde;1297 struct sdma_engine *sde;
1297 1298
1298 if (dd->sdma_pad_dma) {1299 if (dd->sdma_pad_dma) {
1299 dma_free_coherent(&dd->pcidev->dev, 4,1300 dma_free_coherent(&dd->pcidev->dev, SDMA_PAD,
1300 (void *)dd->sdma_pad_dma,1301 (void *)dd->sdma_pad_dma,
1301 dd->sdma_pad_phys);1302 dd->sdma_pad_phys);
1302 dd->sdma_pad_dma = NULL;1303 dd->sdma_pad_dma = NULL;
@@ -1491,7 +1492,7 @@ int sdma_init(struct hfi1_devdata *dd, u8 port) · 188 unmodified lines
1491 }1492 }
1492 1493
1493 /* Allocate memory for pad */1494 /* 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,
1495 &dd->sdma_pad_phys, GFP_KERNEL);1496 &dd->sdma_pad_phys, GFP_KERNEL);
1496 if (!dd->sdma_pad_dma) {1497 if (!dd->sdma_pad_dma) {
1497 dd_dev_err(dd, "failed to allocate SendDMA pad memory\n");1498 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
2736 diff = cmp_psn(psn,2736 diff = cmp_psn(psn,
2737 flow->flow_state.r_next_psn);2737 flow->flow_state.r_next_psn);
2738 if (diff > 0) {2738 if (diff > 0) {
2739 if (!(qp->r_flags & RVT_R_RDMAR_SEQ))
2740 restart_tid_rdma_read_req(rcd,
2741 qp,
2742 wqe);
2743
2744 /* Drop the packet.*/2739 /* Drop the packet.*/
2745 goto s_unlock;2740 goto s_unlock;
2746 } else if (diff < 0) {2741 } 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
147/* Length of buffer to create verbs txreq cache name */147/* Length of buffer to create verbs txreq cache name */
148#define TXREQ_NAME_LEN 24148#define TXREQ_NAME_LEN 24
149 149
150/* 16B trailing buffer */
151static const u8 trail_buf[MAX_16B_PADDING];
152
153static uint wss_threshold = 80;150static uint wss_threshold = 80;
154module_param(wss_threshold, uint, S_IRUGO);151module_param(wss_threshold, uint, S_IRUGO);
155MODULE_PARM_DESC(wss_threshold, "Percentage (1-100) of LLC to use as a threshold for a cacheless copy");152MODULE_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
820 817
821 /* add icrc, lt byte, and padding to flit */818 /* add icrc, lt byte, and padding to flit */
822 if (extra_bytes)819 if (extra_bytes)
823 ret = sdma_txadd_kvaddr(sde->dd, &tx->txreq,820 ret = sdma_txadd_daddr(sde->dd, &tx->txreq,
824 (void *)trail_buf, extra_bytes);821 sde->dd->sdma_pad_phys, extra_bytes);
825 822
826bail_txadd:823bail_txadd:
827 return ret;824 return ret;
@@ -1089,7 +1086,8 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps, · 261 unmodified lines
1089 }1086 }
1090 /* add icrc, lt byte, and padding to flit */1087 /* add icrc, lt byte, and padding to flit */
1091 if (extra_bytes)1088 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);
1093 1091
1094 seg_pio_copy_end(pbuf);1092 seg_pio_copy_end(pbuf);
1095 }1093 }
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
5389 return;5389 return;
5390 }5390 }
5391 5391
5392 if (eq->buf_list)5392 dma_free_coherent(hr_dev->dev, buf_chk_sz, eq->buf_list->buf,
5393 dma_free_coherent(hr_dev->dev, buf_chk_sz,5393 eq->buf_list->map);
5394 eq->buf_list->buf, eq->buf_list->map);5394 kfree(eq->buf_list);
5395}5395}
5396 5396
5397static void hns_roce_config_eqc(struct hns_roce_dev *hr_dev,5397static 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
1967 int err;1967 int err;
1968 1968
1969 if (IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING)) {1969 if (IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING)) {
1970 xa_erase(&dev->mdev->priv.mkey_table,1970 xa_erase_irq(&dev->mdev->priv.mkey_table,
1971 mlx5_base_mkey(mmw->mmkey.key));1971 mlx5_base_mkey(mmw->mmkey.key));
1972 /*1972 /*
1973 * pagefault_single_data_segment() may be accessing mmw under1973 * pagefault_single_data_segment() may be accessing mmw under
1974 * SRCU if the user bound an ODP MR to this MW.1974 * 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
3249 }3249 }
3250 3250
3251 /* Only remove the old rate after new rate was set */3251 /* Only remove the old rate after new rate was set */
3252 if ((old_rl.rate &&3252 if ((old_rl.rate && !mlx5_rl_are_equal(&old_rl, &new_rl)) ||
3253 !mlx5_rl_are_equal(&old_rl, &new_rl)) ||3253 (new_state != MLX5_SQC_STATE_RDY)) {
3254 (new_state != MLX5_SQC_STATE_RDY))
3255 mlx5_rl_remove_rate(dev, &old_rl);3254 mlx5_rl_remove_rate(dev, &old_rl);
3255 if (new_state != MLX5_SQC_STATE_RDY)
3256 memset(&new_rl, 0, sizeof(new_rl));
3257 }
3256 3258
3257 ibqp->rl = new_rl;3259 ibqp->rl = new_rl;
3258 sq->state = new_state;3260 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
76 struct qedr_dev *qedr = get_qedr_dev(ibdev);76 struct qedr_dev *qedr = get_qedr_dev(ibdev);
77 u32 fw_ver = (u32)qedr->attr.fw_ver;77 u32 fw_ver = (u32)qedr->attr.fw_ver;
78 78
79 snprintf(str, IB_FW_VERSION_NAME_MAX, "%d. %d. %d. %d",79 snprintf(str, IB_FW_VERSION_NAME_MAX, "%d.%d.%d.%d",
80 (fw_ver >> 24) & 0xFF, (fw_ver >> 16) & 0xFF,80 (fw_ver >> 24) & 0xFF, (fw_ver >> 16) & 0xFF,
81 (fw_ver >> 8) & 0xFF, fw_ver & 0xFF);81 (fw_ver >> 8) & 0xFF, fw_ver & 0xFF);
82}82}
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
1312void siw_free_qp(struct kref *ref)1312void siw_free_qp(struct kref *ref)
1313{1313{
1314 struct siw_qp *found, *qp = container_of(ref, struct siw_qp, ref);1314 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);
1315 struct siw_device *sdev = qp->sdev;1316 struct siw_device *sdev = qp->sdev;
1316 unsigned long flags;1317 unsigned long flags;
1317 1318
@@ -1334,4 +1335,5 @@ void siw_free_qp(struct kref *ref) · 16 unmodified lines
1334 atomic_dec(&sdev->num_qp);1335 atomic_dec(&sdev->num_qp);
1335 siw_dbg_qp(qp, "free QP\n");1336 siw_dbg_qp(qp, "free QP\n");
1336 kfree_rcu(qp, rcu);1337 kfree_rcu(qp, rcu);
1338 kfree(siw_base_qp);
1337}1339}
drivers/infiniband/sw/siw/siw_verbs.c+0−2
@@ -604,7 +604,6 @@ out: · 603 unmodified lines
604int siw_destroy_qp(struct ib_qp *base_qp, struct ib_udata *udata)604int siw_destroy_qp(struct ib_qp *base_qp, struct ib_udata *udata)
605{605{
606 struct siw_qp *qp = to_siw_qp(base_qp);606 struct siw_qp *qp = to_siw_qp(base_qp);
607 struct siw_base_qp *siw_base_qp = to_siw_base_qp(base_qp);
608 struct siw_ucontext *uctx =607 struct siw_ucontext *uctx =
609 rdma_udata_to_drv_context(udata, struct siw_ucontext,608 rdma_udata_to_drv_context(udata, struct siw_ucontext,
610 base_ucontext);609 base_ucontext);
@@ -641,7 +640,6 @@ int siw_destroy_qp(struct ib_qp *base_qp, struct ib_udata *udata) · 30 unmodified lines
641 qp->scq = qp->rcq = NULL;640 qp->scq = qp->rcq = NULL;
642 641
643 siw_qp_put(qp);642 siw_qp_put(qp);
644 kfree(siw_base_qp);
645 643
646 return 0;644 return 0;
647}645}
drivers/interconnect/core.c+4−0
@@ -405,8 +405,12 @@ void icc_set_tag(struct icc_path *path, u32 tag) · 404 unmodified lines
405 if (!path)405 if (!path)
406 return;406 return;
407 407
408 mutex_lock(&icc_lock);
409
408 for (i = 0; i < path->num_nodes; i++)410 for (i = 0; i < path->num_nodes; i++)
409 path->reqs[i].tag = tag;411 path->reqs[i].tag = tag;
412
413 mutex_unlock(&icc_lock);
410}414}
411EXPORT_SYMBOL_GPL(icc_set_tag);415EXPORT_SYMBOL_GPL(icc_set_tag);
412 416
drivers/interconnect/qcom/qcs404.c+2−1
@@ -433,7 +433,8 @@ static int qnoc_probe(struct platform_device *pdev) · 432 unmodified lines
433 if (!qp)433 if (!qp)
434 return -ENOMEM;434 return -ENOMEM;
435 435
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);
437 if (!data)438 if (!data)
438 return -ENOMEM;439 return -ENOMEM;
439 440
drivers/interconnect/qcom/sdm845.c+2−1
@@ -790,7 +790,8 @@ static int qnoc_probe(struct platform_device *pdev) · 789 unmodified lines
790 if (!qp)790 if (!qp)
791 return -ENOMEM;791 return -ENOMEM;
792 792
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);
794 if (!data)795 if (!data)
795 return -ENOMEM;796 return -ENOMEM;
796 797
drivers/iommu/amd_iommu_quirks.c+13−0
@@ -73,6 +73,19 @@ static const struct dmi_system_id ivrs_quirks[] __initconst = { · 72 unmodified lines
73 },73 },
74 .driver_data = (void *)&ivrs_ioapic_quirks[DELL_LATITUDE_5495],74 .driver_data = (void *)&ivrs_ioapic_quirks[DELL_LATITUDE_5495],
75 },75 },
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 },
76 {89 {
77 .callback = ivrs_ioapic_quirk_cb,90 .callback = ivrs_ioapic_quirk_cb,
78 .ident = "Lenovo ideapad 330S-15ARR",91 .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
2794 struct device_domain_info *info;2794 struct device_domain_info *info;
2795 2795
2796 info = dev->archdata.iommu;2796 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)
2798 return (info->domain == si_domain);2798 return (info->domain == si_domain);
2799 2799
2800 return 0;2800 return 0;
drivers/iommu/ipmmu-vmsa.c+1−3
@@ -1105,10 +1105,8 @@ static int ipmmu_probe(struct platform_device *pdev) · 1104 unmodified lines
1105 /* Root devices have mandatory IRQs */1105 /* Root devices have mandatory IRQs */
1106 if (ipmmu_is_root(mmu)) {1106 if (ipmmu_is_root(mmu)) {
1107 irq = platform_get_irq(pdev, 0);1107 irq = platform_get_irq(pdev, 0);
1108 if (irq < 0) {1108 if (irq < 0)
1109 dev_err(&pdev->dev, "no IRQ found\n");
1110 return irq;1109 return irq;
1111 }
1112 1110
1113 ret = devm_request_irq(&pdev->dev, irq, ipmmu_irq, 0,1111 ret = devm_request_irq(&pdev->dev, irq, ipmmu_irq, 0,
1114 dev_name(&pdev->dev), mmu);1112 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
744 744
745 poll_wait(file, &(cdev->recvwait), wait);745 poll_wait(file, &(cdev->recvwait), wait);
746 mask = EPOLLOUT | EPOLLWRNORM;746 mask = EPOLLOUT | EPOLLWRNORM;
747 if (!skb_queue_empty(&cdev->recvqueue))747 if (!skb_queue_empty_lockless(&cdev->recvqueue))
748 mask |= EPOLLIN | EPOLLRDNORM;748 mask |= EPOLLIN | EPOLLRDNORM;
749 return mask;749 return mask;
750}750}
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
952 struct bond_vlan_tag *tags;952 struct bond_vlan_tag *tags;
953 953
954 if (is_vlan_dev(upper) &&954 if (is_vlan_dev(upper) &&
955 bond->nest_level == vlan_get_encap_level(upper) - 1) {955 bond->dev->lower_level == upper->lower_level - 1) {
956 if (upper->addr_assign_type == NET_ADDR_STOLEN) {956 if (upper->addr_assign_type == NET_ADDR_STOLEN) {
957 alb_send_lp_vid(slave, mac_addr,957 alb_send_lp_vid(slave, mac_addr,
958 vlan_dev_vlan_proto(upper),958 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
1733 goto err_upper_unlink;1733 goto err_upper_unlink;
1734 }1734 }
1735 1735
1736 bond->nest_level = dev_get_nest_level(bond_dev) + 1;
1737
1738 /* If the mode uses primary, then the following is handled by1736 /* If the mode uses primary, then the following is handled by
1739 * bond_change_active_slave().1737 * bond_change_active_slave().
1740 */1738 */
@@ -1816,7 +1814,8 @@ err_detach: · 75 unmodified lines
1816 slave_disable_netpoll(new_slave);1814 slave_disable_netpoll(new_slave);
1817 1815
1818err_close:1816err_close:
1819 slave_dev->priv_flags &= ~IFF_BONDING;1817 if (!netif_is_bond_master(slave_dev))
1818 slave_dev->priv_flags &= ~IFF_BONDING;
1820 dev_close(slave_dev);1819 dev_close(slave_dev);
1821 1820
1822err_restore_mac:1821err_restore_mac:
@@ -1956,9 +1955,6 @@ static int __bond_release_one(struct net_device *bond_dev, · 133 unmodified lines
1956 if (!bond_has_slaves(bond)) {1955 if (!bond_has_slaves(bond)) {
1957 bond_set_carrier(bond);1956 bond_set_carrier(bond);
1958 eth_hw_addr_random(bond_dev);1957 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;
1962 }1958 }
1963 1959
1964 unblock_netpoll_tx();1960 unblock_netpoll_tx();
@@ -2017,7 +2013,8 @@ static int __bond_release_one(struct net_device *bond_dev, · 52 unmodified lines
2017 else2013 else
2018 dev_set_mtu(slave_dev, slave->original_mtu);2014 dev_set_mtu(slave_dev, slave->original_mtu);
2019 2015
2020 slave_dev->priv_flags &= ~IFF_BONDING;2016 if (!netif_is_bond_master(slave_dev))
2017 slave_dev->priv_flags &= ~IFF_BONDING;
2021 2018
2022 bond_free_slave(slave);2019 bond_free_slave(slave);
2023 2020
@@ -2086,8 +2083,7 @@ static int bond_miimon_inspect(struct bonding *bond) · 62 unmodified lines
2086 ignore_updelay = !rcu_dereference(bond->curr_active_slave);2083 ignore_updelay = !rcu_dereference(bond->curr_active_slave);
2087 2084
2088 bond_for_each_slave_rcu(bond, slave, iter) {2085 bond_for_each_slave_rcu(bond, slave, iter) {
2089 slave->new_link = BOND_LINK_NOCHANGE;2086 bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
2090 slave->link_new_state = slave->link;
2091 2087
2092 link_state = bond_check_dev_link(bond, slave->dev, 0);2088 link_state = bond_check_dev_link(bond, slave->dev, 0);
2093 2089
@@ -2121,7 +2117,7 @@ static int bond_miimon_inspect(struct bonding *bond) · 27 unmodified lines
2121 }2117 }
2122 2118
2123 if (slave->delay <= 0) {2119 if (slave->delay <= 0) {
2124 slave->new_link = BOND_LINK_DOWN;2120 bond_propose_link_state(slave, BOND_LINK_DOWN);
2125 commit++;2121 commit++;
2126 continue;2122 continue;
2127 }2123 }
@@ -2158,7 +2154,7 @@ static int bond_miimon_inspect(struct bonding *bond) · 30 unmodified lines
2158 slave->delay = 0;2154 slave->delay = 0;
2159 2155
2160 if (slave->delay <= 0) {2156 if (slave->delay <= 0) {
2161 slave->new_link = BOND_LINK_UP;2157 bond_propose_link_state(slave, BOND_LINK_UP);
2162 commit++;2158 commit++;
2163 ignore_updelay = false;2159 ignore_updelay = false;
2164 continue;2160 continue;
@@ -2196,7 +2192,7 @@ static void bond_miimon_commit(struct bonding *bond) · 31 unmodified lines
2196 struct slave *slave, *primary;2192 struct slave *slave, *primary;
2197 2193
2198 bond_for_each_slave(bond, slave, iter) {2194 bond_for_each_slave(bond, slave, iter) {
2199 switch (slave->new_link) {2195 switch (slave->link_new_state) {
2200 case BOND_LINK_NOCHANGE:2196 case BOND_LINK_NOCHANGE:
2201 /* For 802.3ad mode, check current slave speed and2197 /* For 802.3ad mode, check current slave speed and
2202 * duplex again in case its port was disabled after2198 * duplex again in case its port was disabled after
@@ -2268,8 +2264,8 @@ static void bond_miimon_commit(struct bonding *bond) · 65 unmodified lines
2268 2264
2269 default:2265 default:
2270 slave_err(bond->dev, slave->dev, "invalid new link %d on slave\n",2266 slave_err(bond->dev, slave->dev, "invalid new link %d on slave\n",
2271 slave->new_link);2267 slave->link_new_state);
2272 slave->new_link = BOND_LINK_NOCHANGE;2268 bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
2273 2269
2274 continue;2270 continue;
2275 }2271 }
@@ -2677,13 +2673,13 @@ static void bond_loadbalance_arp_mon(struct bonding *bond) · 401 unmodified lines
2677 bond_for_each_slave_rcu(bond, slave, iter) {2673 bond_for_each_slave_rcu(bond, slave, iter) {
2678 unsigned long trans_start = dev_trans_start(slave->dev);2674 unsigned long trans_start = dev_trans_start(slave->dev);
2679 2675
2680 slave->new_link = BOND_LINK_NOCHANGE;2676 bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
2681 2677
2682 if (slave->link != BOND_LINK_UP) {2678 if (slave->link != BOND_LINK_UP) {
2683 if (bond_time_in_interval(bond, trans_start, 1) &&2679 if (bond_time_in_interval(bond, trans_start, 1) &&
2684 bond_time_in_interval(bond, slave->last_rx, 1)) {2680 bond_time_in_interval(bond, slave->last_rx, 1)) {
2685 2681
2686 slave->new_link = BOND_LINK_UP;2682 bond_propose_link_state(slave, BOND_LINK_UP);
2687 slave_state_changed = 1;2683 slave_state_changed = 1;
2688 2684
2689 /* primary_slave has no meaning in round-robin2685 /* primary_slave has no meaning in round-robin
@@ -2708,7 +2704,7 @@ static void bond_loadbalance_arp_mon(struct bonding *bond) · 18 unmodified lines
2708 if (!bond_time_in_interval(bond, trans_start, 2) ||2704 if (!bond_time_in_interval(bond, trans_start, 2) ||
2709 !bond_time_in_interval(bond, slave->last_rx, 2)) {2705 !bond_time_in_interval(bond, slave->last_rx, 2)) {
2710 2706
2711 slave->new_link = BOND_LINK_DOWN;2707 bond_propose_link_state(slave, BOND_LINK_DOWN);
2712 slave_state_changed = 1;2708 slave_state_changed = 1;
2713 2709
2714 if (slave->link_failure_count < UINT_MAX)2710 if (slave->link_failure_count < UINT_MAX)
@@ -2739,8 +2735,8 @@ static void bond_loadbalance_arp_mon(struct bonding *bond) · 24 unmodified lines
2739 goto re_arm;2735 goto re_arm;
2740 2736
2741 bond_for_each_slave(bond, slave, iter) {2737 bond_for_each_slave(bond, slave, iter) {
2742 if (slave->new_link != BOND_LINK_NOCHANGE)2738 if (slave->link_new_state != BOND_LINK_NOCHANGE)
2743 slave->link = slave->new_link;2739 slave->link = slave->link_new_state;
2744 }2740 }
2745 2741
2746 if (slave_state_changed) {2742 if (slave_state_changed) {
@@ -2763,9 +2759,9 @@ re_arm: · 16 unmodified lines
2763}2759}
2764 2760
2765/* Called to inspect slaves for active-backup mode ARP monitor link state2761/* Called to inspect slaves for active-backup mode ARP monitor link state
2766 * changes. Sets new_link in slaves to specify what action should take2762 * changes. Sets proposed link state in slaves to specify what action
2767 * place for the slave. Returns 0 if no changes are found, >0 if changes2763 * should take place for the slave. Returns 0 if no changes are found, >0
2768 * to link states must be committed.2764 * if changes to link states must be committed.
2769 *2765 *
2770 * Called with rcu_read_lock held.2766 * Called with rcu_read_lock held.
2771 */2767 */
@@ -2777,12 +2773,12 @@ static int bond_ab_arp_inspect(struct bonding *bond) · 5 unmodified lines
2777 int commit = 0;2773 int commit = 0;
2778 2774
2779 bond_for_each_slave_rcu(bond, slave, iter) {2775 bond_for_each_slave_rcu(bond, slave, iter) {
2780 slave->new_link = BOND_LINK_NOCHANGE;2776 bond_propose_link_state(slave, BOND_LINK_NOCHANGE);
2781 last_rx = slave_last_rx(bond, slave);2777 last_rx = slave_last_rx(bond, slave);
2782 2778
2783 if (slave->link != BOND_LINK_UP) {2779 if (slave->link != BOND_LINK_UP) {
2784 if (bond_time_in_interval(bond, last_rx, 1)) {2780 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);
2786 commit++;2782 commit++;
2787 }2783 }
2788 continue;2784 continue;
@@ -2810,7 +2806,7 @@ static int bond_ab_arp_inspect(struct bonding *bond) · 21 unmodified lines
2810 if (!bond_is_active_slave(slave) &&2806 if (!bond_is_active_slave(slave) &&
2811 !rcu_access_pointer(bond->current_arp_slave) &&2807 !rcu_access_pointer(bond->current_arp_slave) &&
2812 !bond_time_in_interval(bond, last_rx, 3)) {2808 !bond_time_in_interval(bond, last_rx, 3)) {
2813 slave->new_link = BOND_LINK_DOWN;2809 bond_propose_link_state(slave, BOND_LINK_DOWN);
2814 commit++;2810 commit++;
2815 }2811 }
2816 2812
@@ -2823,7 +2819,7 @@ static int bond_ab_arp_inspect(struct bonding *bond) · 6 unmodified lines
2823 if (bond_is_active_slave(slave) &&2819 if (bond_is_active_slave(slave) &&
2824 (!bond_time_in_interval(bond, trans_start, 2) ||2820 (!bond_time_in_interval(bond, trans_start, 2) ||
2825 !bond_time_in_interval(bond, last_rx, 2))) {2821 !bond_time_in_interval(bond, last_rx, 2))) {
2826 slave->new_link = BOND_LINK_DOWN;2822 bond_propose_link_state(slave, BOND_LINK_DOWN);
2827 commit++;2823 commit++;
2828 }2824 }
2829 }2825 }
@@ -2843,7 +2839,7 @@ static void bond_ab_arp_commit(struct bonding *bond) · 13 unmodified lines
2843 struct slave *slave;2839 struct slave *slave;
2844 2840
2845 bond_for_each_slave(bond, slave, iter) {2841 bond_for_each_slave(bond, slave, iter) {
2846 switch (slave->new_link) {2842 switch (slave->link_new_state) {
2847 case BOND_LINK_NOCHANGE:2843 case BOND_LINK_NOCHANGE:
2848 continue;2844 continue;
2849 2845
@@ -2893,8 +2889,9 @@ static void bond_ab_arp_commit(struct bonding *bond) · 43 unmodified lines
2893 continue;2889 continue;
2894 2890
2895 default:2891 default:
2896 slave_err(bond->dev, slave->dev, "impossible: new_link %d on slave\n",2892 slave_err(bond->dev, slave->dev,
2897 slave->new_link);2893 "impossible: link_new_state %d on slave\n",
2894 slave->link_new_state);
2898 continue;2895 continue;
2899 }2896 }
2900 2897
@@ -3442,13 +3439,6 @@ static void bond_fold_stats(struct rtnl_link_stats64 *_res, · 541 unmodified lines
3442 }3439 }
3443}3440}
3444 3441
3445static 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
3452static void bond_get_stats(struct net_device *bond_dev,3442static void bond_get_stats(struct net_device *bond_dev,
3453 struct rtnl_link_stats64 *stats)3443 struct rtnl_link_stats64 *stats)
3454{3444{
@@ -3457,7 +3447,7 @@ static void bond_get_stats(struct net_device *bond_dev, · 2 unmodified lines
3457 struct list_head *iter;3447 struct list_head *iter;
3458 struct slave *slave;3448 struct slave *slave;
3459 3449
3460 spin_lock_nested(&bond->stats_lock, bond_get_nest_level(bond_dev));3450 spin_lock(&bond->stats_lock);
3461 memcpy(stats, &bond->bond_stats, sizeof(*stats));3451 memcpy(stats, &bond->bond_stats, sizeof(*stats));
3462 3452
3463 rcu_read_lock();3453 rcu_read_lock();
@@ -4268,7 +4258,6 @@ static const struct net_device_ops bond_netdev_ops = { · 804 unmodified lines
4268 .ndo_neigh_setup = bond_neigh_setup,4258 .ndo_neigh_setup = bond_neigh_setup,
4269 .ndo_vlan_rx_add_vid = bond_vlan_rx_add_vid,4259 .ndo_vlan_rx_add_vid = bond_vlan_rx_add_vid,
4270 .ndo_vlan_rx_kill_vid = bond_vlan_rx_kill_vid,4260 .ndo_vlan_rx_kill_vid = bond_vlan_rx_kill_vid,
4271 .ndo_get_lock_subclass = bond_get_nest_level,
4272#ifdef CONFIG_NET_POLL_CONTROLLER4261#ifdef CONFIG_NET_POLL_CONTROLLER
4273 .ndo_netpoll_setup = bond_netpoll_setup,4262 .ndo_netpoll_setup = bond_netpoll_setup,
4274 .ndo_netpoll_cleanup = bond_netpoll_cleanup,4263 .ndo_netpoll_cleanup = bond_netpoll_cleanup,
@@ -4296,7 +4285,6 @@ void bond_setup(struct net_device *bond_dev) · 21 unmodified lines
4296 struct bonding *bond = netdev_priv(bond_dev);4285 struct bonding *bond = netdev_priv(bond_dev);
4297 4286
4298 spin_lock_init(&bond->mode_lock);4287 spin_lock_init(&bond->mode_lock);
4299 spin_lock_init(&bond->stats_lock);
4300 bond->params = bonding_defaults;4288 bond->params = bonding_defaults;
4301 4289
4302 /* Initialize pointers */4290 /* Initialize pointers */
@@ -4365,6 +4353,7 @@ static void bond_uninit(struct net_device *bond_dev) · 62 unmodified lines
4365 4353
4366 list_del(&bond->bond_list);4354 list_del(&bond->bond_list);
4367 4355
4356 lockdep_unregister_key(&bond->stats_lock_key);
4368 bond_debug_unregister(bond);4357 bond_debug_unregister(bond);
4369}4358}
4370 4359
@@ -4768,8 +4757,9 @@ static int bond_init(struct net_device *bond_dev) · 397 unmodified lines
4768 if (!bond->wq)4757 if (!bond->wq)
4769 return -ENOMEM;4758 return -ENOMEM;
4770 4759
4771 bond->nest_level = SINGLE_DEPTH_NESTING;4760 spin_lock_init(&bond->stats_lock);
4772 netdev_lockdep_set_classes(bond_dev);4761 lockdep_register_key(&bond->stats_lock_key);
4762 lockdep_set_class(&bond->stats_lock, &bond->stats_lock_key);
4773 4763
4774 list_add_tail(&bond->bond_list, &bn->dev_list);4764 list_add_tail(&bond->bond_list, &bn->dev_list);
4775 4765
drivers/net/can/c_can/c_can.c+64−7
@@ -52,6 +52,7 @@ · 51 unmodified lines
52#define CONTROL_EX_PDR BIT(8)52#define CONTROL_EX_PDR BIT(8)
53 53
54/* control register */54/* control register */
55#define CONTROL_SWR BIT(15)
55#define CONTROL_TEST BIT(7)56#define CONTROL_TEST BIT(7)
56#define CONTROL_CCE BIT(6)57#define CONTROL_CCE BIT(6)
57#define CONTROL_DISABLE_AR BIT(5)58#define CONTROL_DISABLE_AR BIT(5)
@@ -97,6 +98,9 @@ · 39 unmodified lines
97#define BTR_TSEG2_SHIFT 1298#define BTR_TSEG2_SHIFT 12
98#define BTR_TSEG2_MASK (0x7 << BTR_TSEG2_SHIFT)99#define BTR_TSEG2_MASK (0x7 << BTR_TSEG2_SHIFT)
99 100
101/* interrupt register */
102#define INT_STS_PENDING 0x8000
103
100/* brp extension register */104/* brp extension register */
101#define BRP_EXT_BRPE_MASK 0x0f105#define BRP_EXT_BRPE_MASK 0x0f
102#define BRP_EXT_BRPE_SHIFT 0106#define BRP_EXT_BRPE_SHIFT 0
@@ -569,6 +573,26 @@ static void c_can_configure_msg_objects(struct net_device *dev) · 466 unmodified lines
569 IF_MCONT_RCV_EOB);573 IF_MCONT_RCV_EOB);
570}574}
571 575
576static 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
572/*596/*
573 * Configure C_CAN chip:597 * Configure C_CAN chip:
574 * - enable/disable auto-retransmission598 * - enable/disable auto-retransmission
@@ -578,6 +602,11 @@ static void c_can_configure_msg_objects(struct net_device *dev) · 3 unmodified lines
578static int c_can_chip_config(struct net_device *dev)602static int c_can_chip_config(struct net_device *dev)
579{603{
580 struct c_can_priv *priv = netdev_priv(dev);604 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;
581 610
582 /* enable automatic retransmission */611 /* enable automatic retransmission */
583 priv->write_reg(priv, C_CAN_CTRL_REG, CONTROL_ENABLE_AR);612 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
886 struct can_berr_counter bec;915 struct can_berr_counter bec;
887 916
888 switch (error_type) {917 switch (error_type) {
918 case C_CAN_NO_ERROR:
919 priv->can.state = CAN_STATE_ERROR_ACTIVE;
920 break;
889 case C_CAN_ERROR_WARNING:921 case C_CAN_ERROR_WARNING:
890 /* error warning state */922 /* error warning state */
891 priv->can.can_stats.error_warning++;923 priv->can.can_stats.error_warning++;
@@ -916,6 +948,13 @@ static int c_can_handle_state_change(struct net_device *dev, · 24 unmodified lines
916 ERR_CNT_RP_SHIFT;948 ERR_CNT_RP_SHIFT;
917 949
918 switch (error_type) {950 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;
919 case C_CAN_ERROR_WARNING:958 case C_CAN_ERROR_WARNING:
920 /* error warning state */959 /* error warning state */
921 cf->can_id |= CAN_ERR_CRTL;960 cf->can_id |= CAN_ERR_CRTL;
@@ -1029,10 +1068,16 @@ static int c_can_poll(struct napi_struct *napi, int quota) · 107 unmodified lines
1029 u16 curr, last = priv->last_status;1068 u16 curr, last = priv->last_status;
1030 int work_done = 0;1069 int work_done = 0;
1031 1070
1032 priv->last_status = curr = priv->read_reg(priv, C_CAN_STS_REG);1071 /* Only read the status register if a status interrupt was pending */
1033 /* Ack status on C_CAN. D_CAN is self clearing */1072 if (atomic_xchg(&priv->sie_pending, 0)) {
1034 if (priv->type != BOSCH_D_CAN)1073 priv->last_status = curr = priv->read_reg(priv, C_CAN_STS_REG);
1035 priv->write_reg(priv, C_CAN_STS_REG, LEC_UNUSED);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 }
1036 1081
1037 /* handle state changes */1082 /* handle state changes */
1038 if ((curr & STATUS_EWARN) && (!(last & STATUS_EWARN))) {1083 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
1054 /* handle bus recovery events */1099 /* handle bus recovery events */
1055 if ((!(curr & STATUS_BOFF)) && (last & STATUS_BOFF)) {1100 if ((!(curr & STATUS_BOFF)) && (last & STATUS_BOFF)) {
1056 netdev_dbg(dev, "left bus off state\n");1101 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);
1058 }1103 }
1104
1059 if ((!(curr & STATUS_EPASS)) && (last & STATUS_EPASS)) {1105 if ((!(curr & STATUS_EPASS)) && (last & STATUS_EPASS)) {
1060 netdev_dbg(dev, "left error passive state\n");1106 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);
1062 }1113 }
1063 1114
1064 /* handle lec errors on the bus */1115 /* handle lec errors on the bus */
@@ -1083,10 +1134,16 @@ static irqreturn_t c_can_isr(int irq, void *dev_id) · 18 unmodified lines
1083{1134{
1084 struct net_device *dev = (struct net_device *)dev_id;1135 struct net_device *dev = (struct net_device *)dev_id;
1085 struct c_can_priv *priv = netdev_priv(dev);1136 struct c_can_priv *priv = netdev_priv(dev);
1137 int reg_int;
1086 1138
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)
1088 return IRQ_NONE;1141 return IRQ_NONE;
1089 1142
1143 /* save for later use */
1144 if (reg_int & INT_STS_PENDING)
1145 atomic_set(&priv->sie_pending, 1);
1146
1090 /* disable all interrupts and schedule the NAPI */1147 /* disable all interrupts and schedule the NAPI */
1091 c_can_irq_control(priv, false);1148 c_can_irq_control(priv, false);
1092 napi_schedule(&priv->napi);1149 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
198 struct net_device *dev;198 struct net_device *dev;
199 struct device *device;199 struct device *device;
200 atomic_t tx_active;200 atomic_t tx_active;
201 atomic_t sie_pending;
201 unsigned long tx_dir;202 unsigned long tx_dir;
202 int last_status;203 int last_status;
203 u16 (*read_reg) (const struct c_can_priv *priv, enum reg index);204 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
848 return;848 return;
849 849
850 ret = of_property_read_u32(dn, "max-bitrate", &priv->bitrate_max);850 ret = of_property_read_u32(dn, "max-bitrate", &priv->bitrate_max);
851 of_node_put(dn);
851 if ((ret && ret != -EINVAL) || (!ret && !priv->bitrate_max))852 if ((ret && ret != -EINVAL) || (!ret && !priv->bitrate_max))
852 netdev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit.\n");853 netdev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit.\n");
853}854}
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
677 struct can_frame *cf;677 struct can_frame *cf;
678 bool rx_errors = false, tx_errors = false;678 bool rx_errors = false, tx_errors = false;
679 u32 timestamp;679 u32 timestamp;
680 int err;
680 681
681 timestamp = priv->read(&regs->timer) << 16;682 timestamp = priv->read(&regs->timer) << 16;
682 683
@@ -725,7 +726,9 @@ static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr) · 42 unmodified lines
725 if (tx_errors)726 if (tx_errors)
726 dev->stats.tx_errors++;727 dev->stats.tx_errors++;
727 728
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++;
729}732}
730 733
731static void flexcan_irq_state(struct net_device *dev, u32 reg_esr)734static 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
738 int flt;741 int flt;
739 struct can_berr_counter bec;742 struct can_berr_counter bec;
740 u32 timestamp;743 u32 timestamp;
744 int err;
741 745
742 timestamp = priv->read(&regs->timer) << 16;746 timestamp = priv->read(&regs->timer) << 16;
743 747
@@ -769,7 +773,9 @@ static void flexcan_irq_state(struct net_device *dev, u32 reg_esr) · 25 unmodified lines
769 if (unlikely(new_state == CAN_STATE_BUS_OFF))773 if (unlikely(new_state == CAN_STATE_BUS_OFF))
770 can_bus_off(dev);774 can_bus_off(dev);
771 775
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++;
773}779}
774 780
775static inline struct flexcan_priv *rx_offload_to_priv(struct can_rx_offload *offload)781static 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
1188 reg_mecr = priv->read(&regs->mecr);1194 reg_mecr = priv->read(&regs->mecr);
1189 reg_mecr &= ~FLEXCAN_MECR_ECRWRDIS;1195 reg_mecr &= ~FLEXCAN_MECR_ECRWRDIS;
1190 priv->write(reg_mecr, &regs->mecr);1196 priv->write(reg_mecr, &regs->mecr);
1197 reg_mecr |= FLEXCAN_MECR_ECCDIS;
1191 reg_mecr &= ~(FLEXCAN_MECR_NCEFAFRZ | FLEXCAN_MECR_HANCEI_MSK |1198 reg_mecr &= ~(FLEXCAN_MECR_NCEFAFRZ | FLEXCAN_MECR_HANCEI_MSK |
1192 FLEXCAN_MECR_FANCEI_MSK);1199 FLEXCAN_MECR_FANCEI_MSK);
1193 priv->write(reg_mecr, &regs->mecr);1200 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
107 return cb_b->timestamp - cb_a->timestamp;107 return cb_b->timestamp - cb_a->timestamp;
108}108}
109 109
110static 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 */
131static struct sk_buff *
132can_rx_offload_offload_one(struct can_rx_offload *offload, unsigned int n)
111{133{
112 struct sk_buff *skb = NULL;134 struct sk_buff *skb = NULL, *skb_error = NULL;
113 struct can_rx_offload_cb *cb;135 struct can_rx_offload_cb *cb;
114 struct can_frame *cf;136 struct can_frame *cf;
115 int ret;137 int ret;
116 138
117 /* If queue is full or skb not available, read to discard mailbox */139 if (likely(skb_queue_len(&offload->skb_queue) <
118 if (likely(skb_queue_len(&offload->skb_queue) <=140 offload->skb_queue_len_max)) {
119 offload->skb_queue_len_max))
120 skb = alloc_can_skb(offload->dev, &cf);141 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 }
121 147
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)) {
123 struct can_frame cf_overflow;152 struct can_frame cf_overflow;
124 u32 timestamp;153 u32 timestamp;
125 154
126 ret = offload->mailbox_read(offload, &cf_overflow,155 ret = offload->mailbox_read(offload, &cf_overflow,
127 &timestamp, n);156 &timestamp, n);
128 if (ret)
129 offload->dev->stats.rx_dropped++;
130 157
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;
132 }177 }
133 178
134 cb = can_rx_offload_get_cb(skb);179 cb = can_rx_offload_get_cb(skb);
135 ret = offload->mailbox_read(offload, cf, &cb->timestamp, n);180 ret = offload->mailbox_read(offload, cf, &cb->timestamp, n);
136 if (!ret) {181
182 /* Mailbox was empty. */
183 if (unlikely(!ret)) {
137 kfree_skb(skb);184 kfree_skb(skb);
138 return NULL;185 return NULL;
139 }186 }
140 187
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. */
141 return skb;199 return skb;
142}200}
143 201
@@ -157,8 +215,8 @@ int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, u64 pen · 13 unmodified lines
157 continue;215 continue;
158 216
159 skb = can_rx_offload_offload_one(offload, i);217 skb = can_rx_offload_offload_one(offload, i);
160 if (!skb)218 if (IS_ERR_OR_NULL(skb))
161 break;219 continue;
162 220
163 __skb_queue_add_sort(&skb_queue, skb, can_rx_offload_compare);221 __skb_queue_add_sort(&skb_queue, skb, can_rx_offload_compare);
164 }222 }
@@ -188,7 +246,13 @@ int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload) · 23 unmodified lines
188 struct sk_buff *skb;246 struct sk_buff *skb;
189 int received = 0;247 int received = 0;
190 248
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
192 skb_queue_tail(&offload->skb_queue, skb);256 skb_queue_tail(&offload->skb_queue, skb);
193 received++;257 received++;
194 }258 }
@@ -207,8 +271,10 @@ int can_rx_offload_queue_sorted(struct can_rx_offload *offload, · 12 unmodified lines
207 unsigned long flags;271 unsigned long flags;
208 272
209 if (skb_queue_len(&offload->skb_queue) >273 if (skb_queue_len(&offload->skb_queue) >
210 offload->skb_queue_len_max)274 offload->skb_queue_len_max) {
211 return -ENOMEM;275 kfree_skb(skb);
276 return -ENOBUFS;
277 }
212 278
213 cb = can_rx_offload_get_cb(skb);279 cb = can_rx_offload_get_cb(skb);
214 cb->timestamp = timestamp;280 cb->timestamp = timestamp;
@@ -250,8 +316,10 @@ int can_rx_offload_queue_tail(struct can_rx_offload *offload, · 35 unmodified lines
250 struct sk_buff *skb)316 struct sk_buff *skb)
251{317{
252 if (skb_queue_len(&offload->skb_queue) >318 if (skb_queue_len(&offload->skb_queue) >
253 offload->skb_queue_len_max)319 offload->skb_queue_len_max) {
254 return -ENOMEM;320 kfree_skb(skb);
321 return -ENOBUFS;
322 }
255 323
256 skb_queue_tail(&offload->skb_queue, skb);324 skb_queue_tail(&offload->skb_queue, skb);
257 can_rx_offload_schedule(offload);325 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
717 if (priv->after_suspend) {717 if (priv->after_suspend) {
718 mcp251x_hw_reset(spi);718 mcp251x_hw_reset(spi);
719 mcp251x_setup(net, spi);719 mcp251x_setup(net, spi);
720 priv->force_quit = 0;
720 if (priv->after_suspend & AFTER_SUSPEND_RESTART) {721 if (priv->after_suspend & AFTER_SUSPEND_RESTART) {
721 mcp251x_set_normal_mode(spi);722 mcp251x_set_normal_mode(spi);
722 } else if (priv->after_suspend & AFTER_SUSPEND_UP) {723 } 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
728 mcp251x_hw_sleep(spi);729 mcp251x_hw_sleep(spi);
729 }730 }
730 priv->after_suspend = 0;731 priv->after_suspend = 0;
731 priv->force_quit = 0;
732 }732 }
733 733
734 if (priv->restart_tx) {734 if (priv->restart_tx) {
drivers/net/can/ti_hecc.c+148−84
@@ -73,6 +73,7 @@ MODULE_VERSION(HECC_MODULE_VERSION); · 72 unmodified lines
73 */73 */
74#define HECC_MAX_RX_MBOX (HECC_MAX_MAILBOXES - HECC_MAX_TX_MBOX)74#define HECC_MAX_RX_MBOX (HECC_MAX_MAILBOXES - HECC_MAX_TX_MBOX)
75#define HECC_RX_FIRST_MBOX (HECC_MAX_MAILBOXES - 1)75#define HECC_RX_FIRST_MBOX (HECC_MAX_MAILBOXES - 1)
76#define HECC_RX_LAST_MBOX (HECC_MAX_TX_MBOX)
76 77
77/* TI HECC module registers */78/* TI HECC module registers */
78#define HECC_CANME 0x0 /* Mailbox enable */79#define HECC_CANME 0x0 /* Mailbox enable */
@@ -82,7 +83,7 @@ MODULE_VERSION(HECC_MODULE_VERSION); · 3 unmodified lines
82#define HECC_CANTA 0x10 /* Transmission acknowledge */83#define HECC_CANTA 0x10 /* Transmission acknowledge */
83#define HECC_CANAA 0x14 /* Abort acknowledge */84#define HECC_CANAA 0x14 /* Abort acknowledge */
84#define HECC_CANRMP 0x18 /* Receive message pending */85#define HECC_CANRMP 0x18 /* Receive message pending */
85#define HECC_CANRML 0x1C /* Remote message lost */86#define HECC_CANRML 0x1C /* Receive message lost */
86#define HECC_CANRFP 0x20 /* Remote frame pending */87#define HECC_CANRFP 0x20 /* Remote frame pending */
87#define HECC_CANGAM 0x24 /* SECC only:Global acceptance mask */88#define HECC_CANGAM 0x24 /* SECC only:Global acceptance mask */
88#define HECC_CANMC 0x28 /* Master control */89#define HECC_CANMC 0x28 /* Master control */
@@ -149,6 +150,8 @@ MODULE_VERSION(HECC_MODULE_VERSION); · 60 unmodified lines
149#define HECC_BUS_ERROR (HECC_CANES_FE | HECC_CANES_BE |\150#define HECC_BUS_ERROR (HECC_CANES_FE | HECC_CANES_BE |\
150 HECC_CANES_CRCE | HECC_CANES_SE |\151 HECC_CANES_CRCE | HECC_CANES_SE |\
151 HECC_CANES_ACKE)152 HECC_CANES_ACKE)
153#define HECC_CANES_FLAGS (HECC_BUS_ERROR | HECC_CANES_BO |\
154 HECC_CANES_EP | HECC_CANES_EW)
152 155
153#define HECC_CANMCF_RTR BIT(4) /* Remote transmit request */156#define HECC_CANMCF_RTR BIT(4) /* Remote transmit request */
154 157
@@ -382,8 +385,18 @@ static void ti_hecc_start(struct net_device *ndev) · 227 unmodified lines
382 hecc_set_bit(priv, HECC_CANMIM, mbx_mask);385 hecc_set_bit(priv, HECC_CANMIM, mbx_mask);
383 }386 }
384 387
385 /* Prevent message over-write & Enable interrupts */388 /* Enable tx interrupts */
386 hecc_write(priv, HECC_CANOPC, HECC_SET_REG);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 */
387 if (priv->use_hecc1int) {400 if (priv->use_hecc1int) {
388 hecc_write(priv, HECC_CANMIL, HECC_SET_REG);401 hecc_write(priv, HECC_CANMIL, HECC_SET_REG);
389 hecc_write(priv, HECC_CANGIM, HECC_CANGIM_DEF_MASK |402 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
400{413{
401 struct ti_hecc_priv *priv = netdev_priv(ndev);414 struct ti_hecc_priv *priv = netdev_priv(ndev);
402 415
416 /* Disable the CPK; stop sending, erroring and acking */
417 hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_CCR);
418
403 /* Disable interrupts and disable mailboxes */419 /* Disable interrupts and disable mailboxes */
404 hecc_write(priv, HECC_CANGIM, 0);420 hecc_write(priv, HECC_CANGIM, 0);
405 hecc_write(priv, HECC_CANMIM, 0);421 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
508 hecc_set_bit(priv, HECC_CANME, mbx_mask);524 hecc_set_bit(priv, HECC_CANME, mbx_mask);
509 spin_unlock_irqrestore(&priv->mbx_lock, flags);525 spin_unlock_irqrestore(&priv->mbx_lock, flags);
510 526
511 hecc_clear_bit(priv, HECC_CANMD, mbx_mask);
512 hecc_set_bit(priv, HECC_CANMIM, mbx_mask);
513 hecc_write(priv, HECC_CANTRS, mbx_mask);527 hecc_write(priv, HECC_CANTRS, mbx_mask);
514 528
515 return NETDEV_TX_OK;529 return NETDEV_TX_OK;
@@ -526,8 +540,10 @@ static unsigned int ti_hecc_mailbox_read(struct can_rx_offload *offload, · 10 unmodified lines
526 u32 *timestamp, unsigned int mbxno)540 u32 *timestamp, unsigned int mbxno)
527{541{
528 struct ti_hecc_priv *priv = rx_offload_to_priv(offload);542 struct ti_hecc_priv *priv = rx_offload_to_priv(offload);
529 u32 data;543 u32 data, mbx_mask;
544 int ret = 1;
530 545
546 mbx_mask = BIT(mbxno);
531 data = hecc_read_mbx(priv, mbxno, HECC_CANMID);547 data = hecc_read_mbx(priv, mbxno, HECC_CANMID);
532 if (data & HECC_CANMID_IDE)548 if (data & HECC_CANMID_IDE)
533 cf->can_id = (data & CAN_EFF_MASK) | CAN_EFF_FLAG;549 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
548 564
549 *timestamp = hecc_read_stamp(priv, mbxno);565 *timestamp = hecc_read_stamp(priv, mbxno);
550 566
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;
552}586}
553 587
554static int ti_hecc_error(struct net_device *ndev, int int_status,588static 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
558 struct can_frame *cf;592 struct can_frame *cf;
559 struct sk_buff *skb;593 struct sk_buff *skb;
560 u32 timestamp;594 u32 timestamp;
595 int err;
561 596
562 /* propagate the error condition to the can stack */597 if (err_status & HECC_BUS_ERROR) {
563 skb = alloc_can_err_skb(ndev, &cf);598 /* propagate the error condition to the can stack */
564 if (!skb) {599 skb = alloc_can_err_skb(ndev, &cf);
565 if (printk_ratelimit())600 if (!skb) {
566 netdev_err(priv->ndev,601 if (net_ratelimit())
567 "%s: alloc_can_err_skb() failed\n",602 netdev_err(priv->ndev,
568 __func__);603 "%s: alloc_can_err_skb() failed\n",
569 return -ENOMEM;604 __func__);
570 }605 return -ENOMEM;
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;
596 }606 }
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 }
615 607
616 if (err_status & HECC_BUS_ERROR) {
617 ++priv->can.can_stats.bus_error;608 ++priv->can.can_stats.bus_error;
618 cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;609 cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;
619 if (err_status & HECC_CANES_FE) {610 if (err_status & HECC_CANES_FE)
620 hecc_set_bit(priv, HECC_CANES, HECC_CANES_FE);
621 cf->data[2] |= CAN_ERR_PROT_FORM;611 cf->data[2] |= CAN_ERR_PROT_FORM;
622 }612 if (err_status & HECC_CANES_BE)
623 if (err_status & HECC_CANES_BE) {
624 hecc_set_bit(priv, HECC_CANES, HECC_CANES_BE);
625 cf->data[2] |= CAN_ERR_PROT_BIT;613 cf->data[2] |= CAN_ERR_PROT_BIT;
626 }614 if (err_status & HECC_CANES_SE)
627 if (err_status & HECC_CANES_SE) {
628 hecc_set_bit(priv, HECC_CANES, HECC_CANES_SE);
629 cf->data[2] |= CAN_ERR_PROT_STUFF;615 cf->data[2] |= CAN_ERR_PROT_STUFF;
630 }616 if (err_status & HECC_CANES_CRCE)
631 if (err_status & HECC_CANES_CRCE) {
632 hecc_set_bit(priv, HECC_CANES, HECC_CANES_CRCE);
633 cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;617 cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
634 }618 if (err_status & HECC_CANES_ACKE)
635 if (err_status & HECC_CANES_ACKE) {
636 hecc_set_bit(priv, HECC_CANES, HECC_CANES_ACKE);
637 cf->data[3] = CAN_ERR_PROT_LOC_ACK;619 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++;
639 }626 }
640 627
641 timestamp = hecc_read(priv, HECC_CANLNT);628 hecc_write(priv, HECC_CANES, HECC_CANES_FLAGS);
642 can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);
643 629
644 return 0;630 return 0;
645}631}
646 632
633static 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
647static irqreturn_t ti_hecc_interrupt(int irq, void *dev_id)662static irqreturn_t ti_hecc_interrupt(int irq, void *dev_id)
648{663{
649 struct net_device *ndev = (struct net_device *)dev_id;664 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
651 struct net_device_stats *stats = &ndev->stats;666 struct net_device_stats *stats = &ndev->stats;
652 u32 mbxno, mbx_mask, int_status, err_status, stamp;667 u32 mbxno, mbx_mask, int_status, err_status, stamp;
653 unsigned long flags, rx_pending;668 unsigned long flags, rx_pending;
669 u32 handled = 0;
654 670
655 int_status = hecc_read(priv,671 int_status = hecc_read(priv,
656 priv->use_hecc1int ?672 priv->use_hecc1int ?
@@ -660,17 +676,66 @@ static irqreturn_t ti_hecc_interrupt(int irq, void *dev_id) · 3 unmodified lines
660 return IRQ_NONE;676 return IRQ_NONE;
661 677
662 err_status = hecc_read(priv, HECC_CANES);678 err_status = hecc_read(priv, HECC_CANES);
663 if (err_status & (HECC_BUS_ERROR | HECC_CANES_BO |679 if (unlikely(err_status & HECC_CANES_FLAGS))
664 HECC_CANES_EP | HECC_CANES_EW))
665 ti_hecc_error(ndev, int_status, err_status);680 ti_hecc_error(ndev, int_status, err_status);
666 681
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
667 if (int_status & HECC_CANGIF_GMIF) {733 if (int_status & HECC_CANGIF_GMIF) {
668 while (priv->tx_tail - priv->tx_head > 0) {734 while (priv->tx_tail - priv->tx_head > 0) {
669 mbxno = get_tx_tail_mb(priv);735 mbxno = get_tx_tail_mb(priv);
670 mbx_mask = BIT(mbxno);736 mbx_mask = BIT(mbxno);
671 if (!(mbx_mask & hecc_read(priv, HECC_CANTA)))737 if (!(mbx_mask & hecc_read(priv, HECC_CANTA)))
672 break;738 break;
673 hecc_clear_bit(priv, HECC_CANMIM, mbx_mask);
674 hecc_write(priv, HECC_CANTA, mbx_mask);739 hecc_write(priv, HECC_CANTA, mbx_mask);
675 spin_lock_irqsave(&priv->mbx_lock, flags);740 spin_lock_irqsave(&priv->mbx_lock, flags);
676 hecc_clear_bit(priv, HECC_CANME, mbx_mask);741 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
695 while ((rx_pending = hecc_read(priv, HECC_CANRMP))) {760 while ((rx_pending = hecc_read(priv, HECC_CANRMP))) {
696 can_rx_offload_irq_offload_timestamp(&priv->offload,761 can_rx_offload_irq_offload_timestamp(&priv->offload,
697 rx_pending);762 rx_pending);
698 hecc_write(priv, HECC_CANRMP, rx_pending);
699 }763 }
700 }764 }
701 765
702 /* clear all interrupt conditions - read back to avoid spurious ints */766 /* clear all interrupt conditions - read back to avoid spurious ints */
703 if (priv->use_hecc1int) {767 if (priv->use_hecc1int) {
704 hecc_write(priv, HECC_CANGIF1, HECC_SET_REG);768 hecc_write(priv, HECC_CANGIF1, handled);
705 int_status = hecc_read(priv, HECC_CANGIF1);769 int_status = hecc_read(priv, HECC_CANGIF1);
706 } else {770 } else {
707 hecc_write(priv, HECC_CANGIF0, HECC_SET_REG);771 hecc_write(priv, HECC_CANGIF0, handled);
708 int_status = hecc_read(priv, HECC_CANGIF0);772 int_status = hecc_read(priv, HECC_CANGIF0);
709 }773 }
710 774
@@ -877,7 +941,7 @@ static int ti_hecc_probe(struct platform_device *pdev) · 166 unmodified lines
877 941
878 priv->offload.mailbox_read = ti_hecc_mailbox_read;942 priv->offload.mailbox_read = ti_hecc_mailbox_read;
879 priv->offload.mb_first = HECC_RX_FIRST_MBOX;943 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;
881 err = can_rx_offload_add_timestamp(ndev, &priv->offload);945 err = can_rx_offload_add_timestamp(ndev, &priv->offload);
882 if (err) {946 if (err) {
883 dev_err(&pdev->dev, "can_rx_offload_add_timestamp() failed\n");947 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
623 rc);623 rc);
624 624
625 usb_unanchor_urb(urb);625 usb_unanchor_urb(urb);
626 usb_free_urb(urb);
626 break;627 break;
627 }628 }
628 629
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
876 netdev_info(priv->netdev, "device disconnected\n");876 netdev_info(priv->netdev, "device disconnected\n");
877 877
878 unregister_candev(priv->netdev);878 unregister_candev(priv->netdev);
879 free_candev(priv->netdev);
880
881 mcba_urb_unlink(priv);879 mcba_urb_unlink(priv);
880 free_candev(priv->netdev);
882}881}
883 882
884static struct usb_driver mcba_usb_driver = {883static 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
100 u8 *end;100 u8 *end;
101 u8 rec_cnt;101 u8 rec_cnt;
102 u8 rec_idx;102 u8 rec_idx;
103 u8 rec_data_idx;103 u8 rec_ts_idx;
104 struct net_device *netdev;104 struct net_device *netdev;
105 struct pcan_usb *pdev;105 struct pcan_usb *pdev;
106};106};
@@ -436,8 +436,8 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n, · 329 unmodified lines
436 }436 }
437 if ((n & PCAN_USB_ERROR_BUS_LIGHT) == 0) {437 if ((n & PCAN_USB_ERROR_BUS_LIGHT) == 0) {
438 /* no error (back to active state) */438 /* no error (back to active state) */
439 mc->pdev->dev.can.state = CAN_STATE_ERROR_ACTIVE;439 new_state = CAN_STATE_ERROR_ACTIVE;
440 return 0;440 break;
441 }441 }
442 break;442 break;
443 443
@@ -460,9 +460,9 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n, · 16 unmodified lines
460 }460 }
461 461
462 if ((n & PCAN_USB_ERROR_BUS_HEAVY) == 0) {462 if ((n & PCAN_USB_ERROR_BUS_HEAVY) == 0) {
463 /* no error (back to active state) */463 /* no error (back to warning state) */
464 mc->pdev->dev.can.state = CAN_STATE_ERROR_ACTIVE;464 new_state = CAN_STATE_ERROR_WARNING;
465 return 0;465 break;
466 }466 }
467 break;467 break;
468 468
@@ -501,6 +501,11 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n, · 32 unmodified lines
501 mc->pdev->dev.can.can_stats.error_warning++;501 mc->pdev->dev.can.can_stats.error_warning++;
502 break;502 break;
503 503
504 case CAN_STATE_ERROR_ACTIVE:
505 cf->can_id |= CAN_ERR_CRTL;
506 cf->data[1] = CAN_ERR_CRTL_ACTIVE;
507 break;
508
504 default:509 default:
505 /* CAN_STATE_MAX (trick to handle other errors) */510 /* CAN_STATE_MAX (trick to handle other errors) */
506 cf->can_id |= CAN_ERR_CRTL;511 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
547 mc->ptr += PCAN_USB_CMD_ARGS;552 mc->ptr += PCAN_USB_CMD_ARGS;
548 553
549 if (status_len & PCAN_USB_STATUSLEN_TIMESTAMP) {554 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);
551 556
552 if (err)557 if (err)
553 return err;558 return err;
559
560 /* Next packet in the buffer will have a timestamp on a single
561 * byte
562 */
563 mc->rec_ts_idx++;
554 }564 }
555 565
556 switch (f) {566 switch (f) {
@@ -632,10 +642,13 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len) · 75 unmodified lines
632 642
633 cf->can_dlc = get_can_dlc(rec_len);643 cf->can_dlc = get_can_dlc(rec_len);
634 644
635 /* first data packet timestamp is a word */645 /* Only first packet timestamp is a word */
636 if (pcan_usb_decode_ts(mc, !mc->rec_data_idx))646 if (pcan_usb_decode_ts(mc, !mc->rec_ts_idx))
637 goto decode_failed;647 goto decode_failed;
638 648
649 /* Next packet in the buffer will have a timestamp on a single byte */
650 mc->rec_ts_idx++;
651
639 /* read data */652 /* read data */
640 memset(cf->data, 0x0, sizeof(cf->data));653 memset(cf->data, 0x0, sizeof(cf->data));
641 if (status_len & PCAN_USB_STATUSLEN_RTR) {654 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
688 /* handle normal can frames here */701 /* handle normal can frames here */
689 } else {702 } else {
690 err = pcan_usb_decode_data(&mc, sl);703 err = pcan_usb_decode_data(&mc, sl);
691 mc.rec_data_idx++;
692 }704 }
693 }705 }
694 706
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
750 dev = netdev_priv(netdev);750 dev = netdev_priv(netdev);
751 751
752 /* allocate a buffer large enough to send commands */752 /* 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);
754 if (!dev->cmd_buf) {754 if (!dev->cmd_buf) {
755 err = -ENOMEM;755 err = -ENOMEM;
756 goto lbl_free_candev;756 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
996 netdev_info(priv->netdev, "device disconnected\n");996 netdev_info(priv->netdev, "device disconnected\n");
997 997
998 unregister_netdev(priv->netdev);998 unregister_netdev(priv->netdev);
999 free_candev(priv->netdev);
1000
1001 unlink_all_urbs(priv);999 unlink_all_urbs(priv);
1000 free_candev(priv->netdev);
1002 }1001 }
1003 1002
1004}1003}
drivers/net/can/xilinx_can.c+0−1
@@ -1599,7 +1599,6 @@ static const struct xcan_devtype_data xcan_zynq_data = { · 1598 unmodified lines
1599 1599
1600static const struct xcan_devtype_data xcan_axi_data = {1600static const struct xcan_devtype_data xcan_axi_data = {
1601 .cantype = XAXI_CAN,1601 .cantype = XAXI_CAN,
1602 .flags = XCAN_FLAG_TXFEMP,
1603 .bittiming_const = &xcan_bittiming_const,1602 .bittiming_const = &xcan_bittiming_const,
1604 .btr_ts2_shift = XCAN_BTR_TS2_SHIFT,1603 .btr_ts2_shift = XCAN_BTR_TS2_SHIFT,
1605 .btr_sjw_shift = XCAN_BTR_SJW_SHIFT,1604 .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
37 unsigned int i;37 unsigned int i;
38 u32 reg, offset;38 u32 reg, offset;
39 39
40 if (priv->type == BCM7445_DEVICE_ID)
41 offset = CORE_STS_OVERRIDE_IMP;
42 else
43 offset = CORE_STS_OVERRIDE_IMP2;
44
45 /* Enable the port memories */40 /* Enable the port memories */
46 reg = core_readl(priv, CORE_MEM_PSM_VDD_CTRL);41 reg = core_readl(priv, CORE_MEM_PSM_VDD_CTRL);
47 reg &= ~P_TXQ_PSM_VDD(port);42 reg &= ~P_TXQ_PSM_VDD(port);
48 core_writel(priv, reg, CORE_MEM_PSM_VDD_CTRL);43 core_writel(priv, reg, CORE_MEM_PSM_VDD_CTRL);
49 44
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
56 /* Enable forwarding */45 /* Enable forwarding */
57 core_writel(priv, SW_FWDG_EN, CORE_SWMODE);46 core_writel(priv, SW_FWDG_EN, CORE_SWMODE);
58 47
@@ -71,10 +60,27 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) · 12 unmodified lines
71 60
72 b53_brcm_hdr_setup(ds, port);61 b53_brcm_hdr_setup(ds, port);
73 62
74 /* Force link status for IMP port */63 if (port == 8) {
75 reg = core_readl(priv, offset);64 if (priv->type == BCM7445_DEVICE_ID)
76 reg |= (MII_SW_OR | LINK_STS);65 offset = CORE_STS_OVERRIDE_IMP;
77 core_writel(priv, reg, offset);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 }
78}84}
79 85
80static void bcm_sf2_gphy_enable_set(struct dsa_switch *ds, bool enable)86static 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
1209 struct bcm_sf2_priv *priv = platform_get_drvdata(pdev);1215 struct bcm_sf2_priv *priv = platform_get_drvdata(pdev);
1210 1216
1211 priv->wol_ports_mask = 0;1217 priv->wol_ports_mask = 0;
1218 /* Disable interrupts */
1219 bcm_sf2_intr_disable(priv);
1212 dsa_unregister_switch(priv->dev->ds);1220 dsa_unregister_switch(priv->dev->ds);
1213 bcm_sf2_cfp_exit(priv->dev->ds);1221 bcm_sf2_cfp_exit(priv->dev->ds);
1214 /* Disable all ports and interrupts */
1215 bcm_sf2_sw_suspend(priv->dev->ds);
1216 bcm_sf2_mdio_unregister(priv);1222 bcm_sf2_mdio_unregister(priv);
1217 1223
1218 return 0;1224 return 0;
drivers/net/dsa/sja1105/Kconfig+2−2
@@ -26,8 +26,8 @@ config NET_DSA_SJA1105_PTP · 25 unmodified lines
26 26
27config NET_DSA_SJA1105_TAS27config NET_DSA_SJA1105_TAS
28 bool "Support for the Time-Aware Scheduler on NXP SJA1105"28 bool "Support for the Time-Aware Scheduler on NXP SJA1105"
29 depends on NET_DSA_SJA110529 depends on NET_DSA_SJA1105 && NET_SCH_TAPRIO
30 depends on NET_SCH_TAPRIO30 depends on NET_SCH_TAPRIO=y || NET_DSA_SJA1105=m
31 help31 help
32 This enables support for the TTEthernet-based egress scheduling32 This enables support for the TTEthernet-based egress scheduling
33 engine in the SJA1105 DSA driver, which is controlled using a33 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
256 if (priv->regulator)256 if (priv->regulator)
257 regulator_disable(priv->regulator);257 regulator_disable(priv->regulator);
258 258
259 if (priv->soc_data->need_div_macclk)
260 clk_disable_unprepare(priv->macclk);
261
259 free_netdev(ndev);262 free_netdev(ndev);
260 return err;263 return err;
261}264}
drivers/net/ethernet/broadcom/bnxt/bnxt.c+4−6
@@ -10382,7 +10382,8 @@ static void bnxt_cleanup_pci(struct bnxt *bp) · 10381 unmodified lines
10382{10382{
10383 bnxt_unmap_bars(bp, bp->pdev);10383 bnxt_unmap_bars(bp, bp->pdev);
10384 pci_release_regions(bp->pdev);10384 pci_release_regions(bp->pdev);
10385 pci_disable_device(bp->pdev);10385 if (pci_is_enabled(bp->pdev))
10386 pci_disable_device(bp->pdev);
10386}10387}
10387 10388
10388static void bnxt_init_dflt_coal(struct bnxt *bp)10389static 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
10669 bp->fw_reset_state = BNXT_FW_RESET_STATE_RESET_FW;10670 bp->fw_reset_state = BNXT_FW_RESET_STATE_RESET_FW;
10670 }10671 }
10671 /* fall through */10672 /* fall through */
10672 case BNXT_FW_RESET_STATE_RESET_FW: {10673 case BNXT_FW_RESET_STATE_RESET_FW:
10673 u32 wait_dsecs = bp->fw_health->post_reset_wait_dsecs;
10674
10675 bnxt_reset_all(bp);10674 bnxt_reset_all(bp);
10676 bp->fw_reset_state = BNXT_FW_RESET_STATE_ENABLE_DEV;10675 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);
10678 return;10677 return;
10679 }
10680 case BNXT_FW_RESET_STATE_ENABLE_DEV:10678 case BNXT_FW_RESET_STATE_ENABLE_DEV:
10681 if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state) &&10679 if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state) &&
10682 bp->fw_health) {10680 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
29 val = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG);29 val = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG);
30 health_status = val & 0xffff;30 health_status = val & 0xffff;
31 31
32 if (health_status == BNXT_FW_STATUS_HEALTHY) {32 if (health_status < BNXT_FW_STATUS_HEALTHY) {
33 rc = devlink_fmsg_string_pair_put(fmsg, "FW status",33 rc = devlink_fmsg_string_pair_put(fmsg, "Description",
34 "Healthy;");34 "Not yet completed initialization");
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;");
40 if (rc)35 if (rc)
41 return rc;36 return rc;
42 } else if (health_status > BNXT_FW_STATUS_HEALTHY) {37 } else if (health_status > BNXT_FW_STATUS_HEALTHY) {
43 rc = devlink_fmsg_string_pair_put(fmsg, "FW status",38 rc = devlink_fmsg_string_pair_put(fmsg, "Description",
44 "Encountered fatal error and cannot recover;");39 "Encountered fatal error and cannot recover");
45 if (rc)40 if (rc)
46 return rc;41 return rc;
47 }42 }
48 43
49 if (val >> 16) {44 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);
51 if (rc)46 if (rc)
52 return rc;47 return rc;
53 }48 }
@@ -215,25 +210,68 @@ enum bnxt_dl_param_id { · 161 unmodified lines
215 210
216static const struct bnxt_dl_nvm_param nvm_params[] = {211static const struct bnxt_dl_nvm_param nvm_params[] = {
217 {DEVLINK_PARAM_GENERIC_ID_ENABLE_SRIOV, NVM_OFF_ENABLE_SRIOV,212 {DEVLINK_PARAM_GENERIC_ID_ENABLE_SRIOV, NVM_OFF_ENABLE_SRIOV,
218 BNXT_NVM_SHARED_CFG, 1},213 BNXT_NVM_SHARED_CFG, 1, 1},
219 {DEVLINK_PARAM_GENERIC_ID_IGNORE_ARI, NVM_OFF_IGNORE_ARI,214 {DEVLINK_PARAM_GENERIC_ID_IGNORE_ARI, NVM_OFF_IGNORE_ARI,
220 BNXT_NVM_SHARED_CFG, 1},215 BNXT_NVM_SHARED_CFG, 1, 1},
221 {DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MAX,216 {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},
223 {DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN,218 {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},
225 {BNXT_DEVLINK_PARAM_ID_GRE_VER_CHECK, NVM_OFF_DIS_GRE_VER_CHECK,220 {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},
227};222};
228 223
224union bnxt_nvm_data {
225 u8 val8;
226 __le32 val32;
227};
228
229static 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
248static 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
229static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg,267static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg,
230 int msg_len, union devlink_param_value *val)268 int msg_len, union devlink_param_value *val)
231{269{
232 struct hwrm_nvm_get_variable_input *req = msg;270 struct hwrm_nvm_get_variable_input *req = msg;
233 void *data_addr = NULL, *buf = NULL;
234 struct bnxt_dl_nvm_param nvm_param;271 struct bnxt_dl_nvm_param nvm_param;
235 int bytesize, idx = 0, rc, i;272 union bnxt_nvm_data *data;
236 dma_addr_t data_dma_addr;273 dma_addr_t data_dma_addr;
274 int idx = 0, rc, i;
237 275
238 /* Get/Set NVM CFG parameter is supported only on PFs */276 /* Get/Set NVM CFG parameter is supported only on PFs */
239 if (BNXT_VF(bp))277 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
254 else if (nvm_param.dir_type == BNXT_NVM_FUNC_CFG)292 else if (nvm_param.dir_type == BNXT_NVM_FUNC_CFG)
255 idx = bp->pf.fw_fid - BNXT_FIRST_PF_FID;293 idx = bp->pf.fw_fid - BNXT_FIRST_PF_FID;
256 294
257 bytesize = roundup(nvm_param.num_bits, BITS_PER_BYTE) / BITS_PER_BYTE;295 data = dma_alloc_coherent(&bp->pdev->dev, sizeof(*data),
258 switch (bytesize) {296 &data_dma_addr, GFP_KERNEL);
259 case 1:297 if (!data)
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)
278 return -ENOMEM;298 return -ENOMEM;
279 299
280 req->dest_data_addr = cpu_to_le64(data_dma_addr);300 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);
282 req->option_num = cpu_to_le16(nvm_param.offset);302 req->option_num = cpu_to_le16(nvm_param.offset);
283 req->index_0 = cpu_to_le16(idx);303 req->index_0 = cpu_to_le16(idx);
284 if (idx)304 if (idx)
285 req->dimensions = cpu_to_le16(1);305 req->dimensions = cpu_to_le16(1);
286 306
287 if (req->req_type == cpu_to_le16(HWRM_NVM_SET_VARIABLE)) {307 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);
289 rc = hwrm_send_message(bp, msg, msg_len, HWRM_CMD_TIMEOUT);310 rc = hwrm_send_message(bp, msg, msg_len, HWRM_CMD_TIMEOUT);
290 } else {311 } else {
291 rc = hwrm_send_message_silent(bp, msg, msg_len,312 rc = hwrm_send_message_silent(bp, msg, msg_len,
292 HWRM_CMD_TIMEOUT);313 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);
293 }318 }
294 if (!rc && req->req_type == cpu_to_le16(HWRM_NVM_GET_VARIABLE))319 dma_free_coherent(&bp->pdev->dev, sizeof(*data), data, data_dma_addr);
295 memcpy(buf, data_addr, bytesize);
296
297 dma_free_coherent(&bp->pdev->dev, bytesize, data_addr, data_dma_addr);
298 if (rc == -EACCES)320 if (rc == -EACCES)
299 netdev_err(bp->dev, "PF does not have admin privileges to modify NVM config\n");321 netdev_err(bp->dev, "PF does not have admin privileges to modify NVM config\n");
300 return rc;322 return rc;
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h+2−1
@@ -52,7 +52,8 @@ struct bnxt_dl_nvm_param { · 51 unmodified lines
52 u16 id;52 u16 id;
53 u16 offset;53 u16 offset;
54 u16 dir_type;54 u16 dir_type;
55 u16 num_bits;55 u16 nvm_num_bits;
56 u8 dl_num_bytes;
56};57};
57 58
58void bnxt_devlink_health_report(struct bnxt *bp, unsigned long event);59void 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
1996 1996
1997 /* issue soft reset with (rg)mii loopback to ensure a stable rxclk */1997 /* issue soft reset with (rg)mii loopback to ensure a stable rxclk */
1998 bcmgenet_umac_writel(priv, CMD_SW_RESET | CMD_LCL_LOOP_EN, UMAC_CMD);1998 bcmgenet_umac_writel(priv, CMD_SW_RESET | CMD_LCL_LOOP_EN, UMAC_CMD);
1999 udelay(2);
2000 bcmgenet_umac_writel(priv, 0, UMAC_CMD);
2001}1999}
2002 2000
2003static void bcmgenet_intr_disable(struct bcmgenet_priv *priv)2001static void bcmgenet_intr_disable(struct bcmgenet_priv *priv)
@@ -2614,8 +2612,10 @@ static void bcmgenet_irq_task(struct work_struct *work) · 610 unmodified lines
2614 spin_unlock_irq(&priv->lock);2612 spin_unlock_irq(&priv->lock);
2615 2613
2616 if (status & UMAC_IRQ_PHY_DET_R &&2614 if (status & UMAC_IRQ_PHY_DET_R &&
2617 priv->dev->phydev->autoneg != AUTONEG_ENABLE)2615 priv->dev->phydev->autoneg != AUTONEG_ENABLE) {
2618 phy_init_hw(priv->dev->phydev);2616 phy_init_hw(priv->dev->phydev);
2617 genphy_config_aneg(priv->dev->phydev);
2618 }
2619 2619
2620 /* Link UP/DOWN event */2620 /* Link UP/DOWN event */
2621 if (status & UMAC_IRQ_LINK_EVENT)2621 if (status & UMAC_IRQ_LINK_EVENT)
@@ -2879,12 +2879,6 @@ static int bcmgenet_open(struct net_device *dev) · 257 unmodified lines
2879 if (priv->internal_phy)2879 if (priv->internal_phy)
2880 bcmgenet_power_up(priv, GENET_POWER_PASSIVE);2880 bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
2881 2881
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
2888 /* take MAC out of reset */2882 /* take MAC out of reset */
2889 bcmgenet_umac_reset(priv);2883 bcmgenet_umac_reset(priv);
2890 2884
@@ -2894,12 +2888,6 @@ static int bcmgenet_open(struct net_device *dev) · 3 unmodified lines
2894 reg = bcmgenet_umac_readl(priv, UMAC_CMD);2888 reg = bcmgenet_umac_readl(priv, UMAC_CMD);
2895 priv->crc_fwd_en = !!(reg & CMD_CRC_FWD);2889 priv->crc_fwd_en = !!(reg & CMD_CRC_FWD);
2896 2890
2897 ret = bcmgenet_mii_config(dev, true);
2898 if (ret) {
2899 netdev_err(dev, "unsupported PHY\n");
2900 goto err_disconnect_phy;
2901 }
2902
2903 bcmgenet_set_hw_addr(priv, dev->dev_addr);2891 bcmgenet_set_hw_addr(priv, dev->dev_addr);
2904 2892
2905 if (priv->internal_phy) {2893 if (priv->internal_phy) {
@@ -2915,7 +2903,7 @@ static int bcmgenet_open(struct net_device *dev) · 9 unmodified lines
2915 ret = bcmgenet_init_dma(priv);2903 ret = bcmgenet_init_dma(priv);
2916 if (ret) {2904 if (ret) {
2917 netdev_err(dev, "failed to initialize DMA\n");2905 netdev_err(dev, "failed to initialize DMA\n");
2918 goto err_disconnect_phy;2906 goto err_clk_disable;
2919 }2907 }
2920 2908
2921 /* Always enable ring 16 - descriptor ring */2909 /* Always enable ring 16 - descriptor ring */
@@ -2938,19 +2926,25 @@ static int bcmgenet_open(struct net_device *dev) · 16 unmodified lines
2938 goto err_irq0;2926 goto err_irq0;
2939 }2927 }
2940 2928
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
2941 bcmgenet_netif_start(dev);2935 bcmgenet_netif_start(dev);
2942 2936
2943 netif_tx_start_all_queues(dev);2937 netif_tx_start_all_queues(dev);
2944 2938
2945 return 0;2939 return 0;
2946 2940
2941err_irq1:
2942 free_irq(priv->irq1, priv);
2947err_irq0:2943err_irq0:
2948 free_irq(priv->irq0, priv);2944 free_irq(priv->irq0, priv);
2949err_fini_dma:2945err_fini_dma:
2950 bcmgenet_dma_teardown(priv);2946 bcmgenet_dma_teardown(priv);
2951 bcmgenet_fini_dma(priv);2947 bcmgenet_fini_dma(priv);
2952err_disconnect_phy:
2953 phy_disconnect(dev->phydev);
2954err_clk_disable:2948err_clk_disable:
2955 if (priv->internal_phy)2949 if (priv->internal_phy)
2956 bcmgenet_power_down(priv, GENET_POWER_PASSIVE);2950 bcmgenet_power_down(priv, GENET_POWER_PASSIVE);
@@ -3631,8 +3625,6 @@ static int bcmgenet_resume(struct device *d) · 674 unmodified lines
3631 if (priv->internal_phy)3625 if (priv->internal_phy)
3632 bcmgenet_power_up(priv, GENET_POWER_PASSIVE);3626 bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
3633 3627
3634 phy_init_hw(dev->phydev);
3635
3636 bcmgenet_umac_reset(priv);3628 bcmgenet_umac_reset(priv);
3637 3629
3638 init_umac(priv);3630 init_umac(priv);
@@ -3641,7 +3633,10 @@ static int bcmgenet_resume(struct device *d) · 2 unmodified lines
3641 if (priv->wolopts)3633 if (priv->wolopts)
3642 clk_disable_unprepare(priv->clk_wol);3634 clk_disable_unprepare(priv->clk_wol);
3643 3635
3636 phy_init_hw(dev->phydev);
3637
3644 /* Speed settings must be restored */3638 /* Speed settings must be restored */
3639 genphy_config_aneg(dev->phydev);
3645 bcmgenet_mii_config(priv->dev, false);3640 bcmgenet_mii_config(priv->dev, false);
3646 3641
3647 bcmgenet_set_hw_addr(priv, dev->dev_addr);3642 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
720 720
721/* MDIO routines */721/* MDIO routines */
722int bcmgenet_mii_init(struct net_device *dev);722int bcmgenet_mii_init(struct net_device *dev);
723int bcmgenet_mii_connect(struct net_device *dev);
724int bcmgenet_mii_config(struct net_device *dev, bool init);723int bcmgenet_mii_config(struct net_device *dev, bool init);
724int bcmgenet_mii_probe(struct net_device *dev);
725void bcmgenet_mii_exit(struct net_device *dev);725void bcmgenet_mii_exit(struct net_device *dev);
726void bcmgenet_phy_power_set(struct net_device *dev, bool enable);726void bcmgenet_phy_power_set(struct net_device *dev, bool enable);
727void bcmgenet_mii_setup(struct net_device *dev);727void 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
173 bcmgenet_fixed_phy_link_update);173 bcmgenet_fixed_phy_link_update);
174}174}
175 175
176int 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
216int bcmgenet_mii_config(struct net_device *dev, bool init)176int bcmgenet_mii_config(struct net_device *dev, bool init)
217{177{
218 struct bcmgenet_priv *priv = netdev_priv(dev);178 struct bcmgenet_priv *priv = netdev_priv(dev);
@@ -221,8 +181,38 @@ int bcmgenet_mii_config(struct net_device *dev, bool init) · 2 unmodified lines
221 const char *phy_name = NULL;181 const char *phy_name = NULL;
222 u32 id_mode_dis = 0;182 u32 id_mode_dis = 0;
223 u32 port_ctrl;183 u32 port_ctrl;
184 int bmcr = -1;
185 int ret;
224 u32 reg;186 u32 reg;
225 187
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
226 priv->ext_phy = !priv->internal_phy &&216 priv->ext_phy = !priv->internal_phy &&
227 (priv->phy_interface != PHY_INTERFACE_MODE_MOCA);217 (priv->phy_interface != PHY_INTERFACE_MODE_MOCA);
228 218
@@ -254,6 +244,9 @@ int bcmgenet_mii_config(struct net_device *dev, bool init) · 25 unmodified lines
254 phy_set_max_speed(phydev, SPEED_100);244 phy_set_max_speed(phydev, SPEED_100);
255 bcmgenet_sys_writel(priv,245 bcmgenet_sys_writel(priv,
256 PORT_MODE_EXT_EPHY, SYS_PORT_CTRL);246 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);
257 break;250 break;
258 251
259 case PHY_INTERFACE_MODE_REVMII:252 case PHY_INTERFACE_MODE_REVMII:
@@ -306,21 +299,71 @@ int bcmgenet_mii_config(struct net_device *dev, bool init) · 46 unmodified lines
306 bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);299 bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);
307 }300 }
308 301
309 if (init) {302 if (init)
310 linkmode_copy(phydev->advertising, phydev->supported);303 dev_info(kdev, "configuring instance for %s\n", phy_name);
311 304
312 /* The internal PHY has its link interrupts routed to the305 return 0;
313 * Ethernet MAC ISRs. On GENETv5 there is a hardware issue306}
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;
320 307
321 dev_info(kdev, "configuring instance for %s\n", phy_name);308int 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 }
322 }343 }
323 344
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
324 return 0;367 return 0;
325}368}
326 369
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
1499 netdev->ethtool_ops = &octeon_mgmt_ethtool_ops;1499 netdev->ethtool_ops = &octeon_mgmt_ethtool_ops;
1500 1500
1501 netdev->min_mtu = 64 - OCTEON_MGMT_RX_HEADROOM;1501 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;
1503 1503
1504 mac = of_get_mac_address(pdev->dev.of_node);1504 mac = of_get_mac_address(pdev->dev.of_node);
1505 1505
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
695 lld->write_cmpl_support = adap->params.write_cmpl_support;695 lld->write_cmpl_support = adap->params.write_cmpl_support;
696}696}
697 697
698static void uld_attach(struct adapter *adap, unsigned int uld)698static int uld_attach(struct adapter *adap, unsigned int uld)
699{699{
700 void *handle;
701 struct cxgb4_lld_info lli;700 struct cxgb4_lld_info lli;
701 void *handle;
702 702
703 uld_init(adap, &lli);703 uld_init(adap, &lli);
704 uld_queue_init(adap, uld, &lli);704 uld_queue_init(adap, uld, &lli);
@@ -708,7 +708,7 @@ static void uld_attach(struct adapter *adap, unsigned int uld) · 3 unmodified lines
708 dev_warn(adap->pdev_dev,708 dev_warn(adap->pdev_dev,
709 "could not attach to the %s driver, error %ld\n",709 "could not attach to the %s driver, error %ld\n",
710 adap->uld[uld].name, PTR_ERR(handle));710 adap->uld[uld].name, PTR_ERR(handle));
711 return;711 return PTR_ERR(handle);
712 }712 }
713 713
714 adap->uld[uld].handle = handle;714 adap->uld[uld].handle = handle;
@@ -716,22 +716,22 @@ static void uld_attach(struct adapter *adap, unsigned int uld) · 1 unmodified line
716 716
717 if (adap->flags & CXGB4_FULL_INIT_DONE)717 if (adap->flags & CXGB4_FULL_INIT_DONE)
718 adap->uld[uld].state_change(handle, CXGB4_STATE_UP);718 adap->uld[uld].state_change(handle, CXGB4_STATE_UP);
719
720 return 0;
719}721}
720 722
721/**723/* cxgb4_register_uld - register an upper-layer driver
722 * cxgb4_register_uld - register an upper-layer driver724 * @type: the ULD type
723 * @type: the ULD type725 * @p: the ULD methods
724 * @p: the ULD methods
725 *726 *
726 * Registers an upper-layer driver with this driver and notifies the ULD727 * Registers an upper-layer driver with this driver and notifies the ULD
727 * about any presently available devices that support its type. Returns728 * about any presently available devices that support its type.
728 * %-EBUSY if a ULD of the same type is already registered.
729 */729 */
730void cxgb4_register_uld(enum cxgb4_uld type,730void cxgb4_register_uld(enum cxgb4_uld type,
731 const struct cxgb4_uld_info *p)731 const struct cxgb4_uld_info *p)
732{732{
733 int ret = 0;
734 struct adapter *adap;733 struct adapter *adap;
734 int ret = 0;
735 735
736 if (type >= CXGB4_ULD_MAX)736 if (type >= CXGB4_ULD_MAX)
737 return;737 return;
@@ -763,8 +763,12 @@ void cxgb4_register_uld(enum cxgb4_uld type, · 25 unmodified lines
763 if (ret)763 if (ret)
764 goto free_irq;764 goto free_irq;
765 adap->uld[type] = *p;765 adap->uld[type] = *p;
766 uld_attach(adap, type);766 ret = uld_attach(adap, type);
767 if (ret)
768 goto free_txq;
767 continue;769 continue;
770free_txq:
771 release_sge_txq_uld(adap, type);
768free_irq:772free_irq:
769 if (adap->flags & CXGB4_FULL_INIT_DONE)773 if (adap->flags & CXGB4_FULL_INIT_DONE)
770 quiesce_rx_uld(adap, type);774 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
3791 * write the CIDX Updates into the Status Page at the end of the3791 * write the CIDX Updates into the Status Page at the end of the
3792 * TX Queue.3792 * TX Queue.
3793 */3793 */
3794 c.autoequiqe_to_viid = htonl((dbqt3794 c.autoequiqe_to_viid = htonl(FW_EQ_ETH_CMD_AUTOEQUEQE_F |
3795 ? FW_EQ_ETH_CMD_AUTOEQUIQE_F
3796 : FW_EQ_ETH_CMD_AUTOEQUEQE_F) |
3797 FW_EQ_ETH_CMD_VIID_V(pi->viid));3795 FW_EQ_ETH_CMD_VIID_V(pi->viid));
3798 3796
3799 c.fetchszm_to_iqid =3797 c.fetchszm_to_iqid =
3800 htonl(FW_EQ_ETH_CMD_HOSTFCMODE_V(dbqt3798 htonl(FW_EQ_ETH_CMD_HOSTFCMODE_V(HOSTFCMODE_STATUS_PAGE_X) |
3801 ? HOSTFCMODE_INGRESS_QUEUE_X
3802 : HOSTFCMODE_STATUS_PAGE_X) |
3803 FW_EQ_ETH_CMD_PCIECHN_V(pi->tx_chan) |3799 FW_EQ_ETH_CMD_PCIECHN_V(pi->tx_chan) |
3804 FW_EQ_ETH_CMD_FETCHRO_F | FW_EQ_ETH_CMD_IQID_V(iqid));3800 FW_EQ_ETH_CMD_FETCHRO_F | FW_EQ_ETH_CMD_IQID_V(iqid));
3805 3801
drivers/net/ethernet/cortina/gemini.h+1−1
@@ -1,4 +1,4 @@
1// SPDX-License-Identifier: GPL-2.01/* SPDX-License-Identifier: GPL-2.0 */
2/* Register definitions for Gemini GMAC Ethernet device driver2/* Register definitions for Gemini GMAC Ethernet device driver
3 *3 *
4 * Copyright (C) 2006 Storlink, Corp.4 * 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
727 */727 */
728 nfrags = skb_shinfo(skb)->nr_frags;728 nfrags = skb_shinfo(skb)->nr_frags;
729 729
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
730 /* Get header len */742 /* Get header len */
731 len = skb_headlen(skb);743 len = skb_headlen(skb);
732 744
@@ -753,19 +765,6 @@ static netdev_tx_t ftgmac100_hard_start_xmit(struct sk_buff *skb, · 20 unmodified lines
753 if (nfrags == 0)765 if (nfrags == 0)
754 f_ctl_stat |= FTGMAC100_TXDES0_LTS;766 f_ctl_stat |= FTGMAC100_TXDES0_LTS;
755 txdes->txdes3 = cpu_to_le32(map);767 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
769 txdes->txdes1 = cpu_to_le32(csum_vlan);768 txdes->txdes1 = cpu_to_le32(csum_vlan);
770 769
771 /* Next descriptor */770 /* Next descriptor */
drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.h+1−1
@@ -1,4 +1,4 @@
1// SPDX-License-Identifier: GPL-2.01/* SPDX-License-Identifier: GPL-2.0 */
2/*2/*
3 * Copyright 2018 NXP3 * Copyright 2018 NXP
4 */4 */
drivers/net/ethernet/freescale/dpaa2/dprtc-cmd.h+1−1
@@ -1,4 +1,4 @@
1// SPDX-License-Identifier: GPL-2.01/* SPDX-License-Identifier: GPL-2.0 */
2/*2/*
3 * Copyright 2013-2016 Freescale Semiconductor Inc.3 * Copyright 2013-2016 Freescale Semiconductor Inc.
4 * Copyright 2016-2018 NXP4 * Copyright 2016-2018 NXP
drivers/net/ethernet/freescale/dpaa2/dprtc.h+1−1
@@ -1,4 +1,4 @@
1// SPDX-License-Identifier: GPL-2.01/* SPDX-License-Identifier: GPL-2.0 */
2/*2/*
3 * Copyright 2013-2016 Freescale Semiconductor Inc.3 * Copyright 2013-2016 Freescale Semiconductor Inc.
4 * Copyright 2016-2018 NXP4 * 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
3558 3558
3559 for (i = 0; i < irq_cnt; i++) {3559 for (i = 0; i < irq_cnt; i++) {
3560 snprintf(irq_name, sizeof(irq_name), "int%d", i);3560 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);
3562 if (irq < 0)3562 if (irq < 0)
3563 irq = platform_get_irq(pdev, i);3563 irq = platform_get_irq(pdev, i);
3564 if (irq < 0) {3564 if (irq < 0) {
@@ -3645,6 +3645,8 @@ fec_drv_remove(struct platform_device *pdev) · 80 unmodified lines
3645 regulator_disable(fep->reg_phy);3645 regulator_disable(fep->reg_phy);
3646 pm_runtime_put(&pdev->dev);3646 pm_runtime_put(&pdev->dev);
3647 pm_runtime_disable(&pdev->dev);3647 pm_runtime_disable(&pdev->dev);
3648 clk_disable_unprepare(fep->clk_ahb);
3649 clk_disable_unprepare(fep->clk_ipg);
3648 if (of_phy_is_fixed_link(np))3650 if (of_phy_is_fixed_link(np))
3649 of_phy_deregister_fixed_link(np);3651 of_phy_deregister_fixed_link(np);
3650 of_node_put(fep->phy_node);3652 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
600 600
601 INIT_DELAYED_WORK(&fep->time_keep, fec_time_keep);601 INIT_DELAYED_WORK(&fep->time_keep, fec_time_keep);
602 602
603 irq = platform_get_irq_byname(pdev, "pps");603 irq = platform_get_irq_byname_optional(pdev, "pps");
604 if (irq < 0)604 if (irq < 0)
605 irq = platform_get_irq(pdev, irq_idx);605 irq = platform_get_irq_optional(pdev, irq_idx);
606 /* Failure to get an irq is not fatal,606 /* Failure to get an irq is not fatal,
607 * only the PTP_CLOCK_PPS clock events should stop607 * only the PTP_CLOCK_PPS clock events should stop
608 */608 */
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
289 289
290 len = be16_to_cpu(rx_desc->len) - GVE_RX_PAD;290 len = be16_to_cpu(rx_desc->len) - GVE_RX_PAD;
291 page_info = &rx->data.page_info[idx];291 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);
292 294
293 /* gvnic can only receive into registered segments. If the buffer295 /* gvnic can only receive into registered segments. If the buffer
294 * can't be recycled, our only choice is to copy the data out of296 * 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
390 seg_desc->seg.seg_addr = cpu_to_be64(addr);390 seg_desc->seg.seg_addr = cpu_to_be64(addr);
391}391}
392 392
393static int gve_tx_add_skb(struct gve_tx_ring *tx, struct sk_buff *skb)393static 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
406static int gve_tx_add_skb(struct gve_tx_ring *tx, struct sk_buff *skb,
407 struct device *dev)
394{408{
395 int pad_bytes, hlen, hdr_nfrags, payload_nfrags, l4_hdr_offset;409 int pad_bytes, hlen, hdr_nfrags, payload_nfrags, l4_hdr_offset;
396 union gve_tx_desc *pkt_desc, *seg_desc;410 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
432 skb_copy_bits(skb, 0,446 skb_copy_bits(skb, 0,
433 tx->tx_fifo.base + info->iov[hdr_nfrags - 1].iov_offset,447 tx->tx_fifo.base + info->iov[hdr_nfrags - 1].iov_offset,
434 hlen);448 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);
435 copy_offset = hlen;452 copy_offset = hlen;
436 453
437 for (i = payload_iov; i < payload_nfrags + payload_iov; i++) {454 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
445 skb_copy_bits(skb, copy_offset,462 skb_copy_bits(skb, copy_offset,
446 tx->tx_fifo.base + info->iov[i].iov_offset,463 tx->tx_fifo.base + info->iov[i].iov_offset,
447 info->iov[i].iov_len);464 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);
448 copy_offset += info->iov[i].iov_len;468 copy_offset += info->iov[i].iov_len;
449 }469 }
450 470
@@ -473,7 +493,7 @@ netdev_tx_t gve_tx(struct sk_buff *skb, struct net_device *dev) · 22 unmodified lines
473 gve_tx_put_doorbell(priv, tx->q_resources, tx->req);493 gve_tx_put_doorbell(priv, tx->q_resources, tx->req);
474 return NETDEV_TX_BUSY;494 return NETDEV_TX_BUSY;
475 }495 }
476 nsegs = gve_tx_add_skb(tx, skb);496 nsegs = gve_tx_add_skb(tx, skb, &priv->pdev->dev);
477 497
478 netdev_tx_sent_queue(tx->netdev_txq, skb->len);498 netdev_tx_sent_queue(tx->netdev_txq, skb->len);
479 skb_tx_timestamp(skb);499 skb_tx_timestamp(skb);
drivers/net/ethernet/hisilicon/hip04_eth.c+9−7
@@ -237,6 +237,7 @@ struct hip04_priv { · 236 unmodified lines
237 dma_addr_t rx_phys[RX_DESC_NUM];237 dma_addr_t rx_phys[RX_DESC_NUM];
238 unsigned int rx_head;238 unsigned int rx_head;
239 unsigned int rx_buf_size;239 unsigned int rx_buf_size;
240 unsigned int rx_cnt_remaining;
240 241
241 struct device_node *phy_node;242 struct device_node *phy_node;
242 struct phy_device *phy;243 struct phy_device *phy;
@@ -575,7 +576,6 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget) · 332 unmodified lines
575 struct hip04_priv *priv = container_of(napi, struct hip04_priv, napi);576 struct hip04_priv *priv = container_of(napi, struct hip04_priv, napi);
576 struct net_device *ndev = priv->ndev;577 struct net_device *ndev = priv->ndev;
577 struct net_device_stats *stats = &ndev->stats;578 struct net_device_stats *stats = &ndev->stats;
578 unsigned int cnt = hip04_recv_cnt(priv);
579 struct rx_desc *desc;579 struct rx_desc *desc;
580 struct sk_buff *skb;580 struct sk_buff *skb;
581 unsigned char *buf;581 unsigned char *buf;
@@ -588,8 +588,8 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget) · 6 unmodified lines
588 588
589 /* clean up tx descriptors */589 /* clean up tx descriptors */
590 tx_remaining = hip04_tx_reclaim(ndev, false);590 tx_remaining = hip04_tx_reclaim(ndev, false);
591 591 priv->rx_cnt_remaining += hip04_recv_cnt(priv);
592 while (cnt && !last) {592 while (priv->rx_cnt_remaining && !last) {
593 buf = priv->rx_buf[priv->rx_head];593 buf = priv->rx_buf[priv->rx_head];
594 skb = build_skb(buf, priv->rx_buf_size);594 skb = build_skb(buf, priv->rx_buf_size);
595 if (unlikely(!skb)) {595 if (unlikely(!skb)) {
@@ -635,11 +635,13 @@ refill: · 39 unmodified lines
635 hip04_set_recv_desc(priv, phys);635 hip04_set_recv_desc(priv, phys);
636 636
637 priv->rx_head = RX_NEXT(priv->rx_head);637 priv->rx_head = RX_NEXT(priv->rx_head);
638 if (rx >= budget)638 if (rx >= budget) {
639 --priv->rx_cnt_remaining;
639 goto done;640 goto done;
641 }
640 642
641 if (--cnt == 0)643 if (--priv->rx_cnt_remaining == 0)
642 cnt = hip04_recv_cnt(priv);644 priv->rx_cnt_remaining += hip04_recv_cnt(priv);
643 }645 }
644 646
645 if (!(priv->reg_inten & RCV_INT)) {647 if (!(priv->reg_inten & RCV_INT)) {
@@ -724,6 +726,7 @@ static int hip04_mac_open(struct net_device *ndev) · 78 unmodified lines
724 int i;726 int i;
725 727
726 priv->rx_head = 0;728 priv->rx_head = 0;
729 priv->rx_cnt_remaining = 0;
727 priv->tx_head = 0;730 priv->tx_head = 0;
728 priv->tx_tail = 0;731 priv->tx_tail = 0;
729 hip04_reset_ppe(priv);732 hip04_reset_ppe(priv);
@@ -1038,7 +1041,6 @@ static int hip04_remove(struct platform_device *pdev) · 308 unmodified lines
1038 1041
1039 hip04_free_ring(ndev, d);1042 hip04_free_ring(ndev, d);
1040 unregister_netdev(ndev);1043 unregister_netdev(ndev);
1041 free_irq(ndev->irq, ndev);
1042 of_node_put(priv->phy_node);1044 of_node_put(priv->phy_node);
1043 cancel_work_sync(&priv->tx_timeout_task);1045 cancel_work_sync(&priv->tx_timeout_task);
1044 free_netdev(ndev);1046 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
199 199
200 ring->q = q;200 ring->q = q;
201 ring->flags = flags;201 ring->flags = flags;
202 spin_lock_init(&ring->lock);
203 ring->coal_param = q->handle->coal_param;202 ring->coal_param = q->handle->coal_param;
204 assert(!ring->desc && !ring->desc_cb && !ring->desc_dma_addr);203 assert(!ring->desc && !ring->desc_cb && !ring->desc_dma_addr);
205 204
drivers/net/ethernet/hisilicon/hns/hnae.h+0−3
@@ -274,9 +274,6 @@ struct hnae_ring { · 273 unmodified lines
274 /* statistic */274 /* statistic */
275 struct ring_stats stats;275 struct ring_stats stats;
276 276
277 /* ring lock for poll one */
278 spinlock_t lock;
279
280 dma_addr_t desc_dma_addr;277 dma_addr_t desc_dma_addr;
281 u32 buf_size; /* size for hnae_desc->addr, preset by AE */278 u32 buf_size; /* size for hnae_desc->addr, preset by AE */
282 u16 desc_num; /* total number of desc */279 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
943 return u > c ? (h > c && h <= u) : (h > c || h <= u);943 return u > c ? (h > c && h <= u) : (h > c || h <= u);
944}944}
945 945
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
955/* reclaim all desc in one budget946/* reclaim all desc in one budget
956 * return error or number of desc left947 * return error or number of desc left
957 */948 */
@@ -965,21 +956,16 @@ static int hns_nic_tx_poll_one(struct hns_nic_ring_data *ring_data, · 7 unmodified lines
965 int head;956 int head;
966 int bytes, pkts;957 int bytes, pkts;
967 958
968 NETIF_TX_LOCK(ring);
969
970 head = readl_relaxed(ring->io_base + RCB_REG_HEAD);959 head = readl_relaxed(ring->io_base + RCB_REG_HEAD);
971 rmb(); /* make sure head is ready before touch any data */960 rmb(); /* make sure head is ready before touch any data */
972 961
973 if (is_ring_empty(ring) || head == ring->next_to_clean) {962 if (is_ring_empty(ring) || head == ring->next_to_clean)
974 NETIF_TX_UNLOCK(ring);
975 return 0; /* no data to poll */963 return 0; /* no data to poll */
976 }
977 964
978 if (!is_valid_clean_head(ring, head)) {965 if (!is_valid_clean_head(ring, head)) {
979 netdev_err(ndev, "wrong head (%d, %d-%d)\n", head,966 netdev_err(ndev, "wrong head (%d, %d-%d)\n", head,
980 ring->next_to_use, ring->next_to_clean);967 ring->next_to_use, ring->next_to_clean);
981 ring->stats.io_err_cnt++;968 ring->stats.io_err_cnt++;
982 NETIF_TX_UNLOCK(ring);
983 return -EIO;969 return -EIO;
984 }970 }
985 971
@@ -994,8 +980,6 @@ static int hns_nic_tx_poll_one(struct hns_nic_ring_data *ring_data, · 8 unmodified lines
994 ring->stats.tx_pkts += pkts;980 ring->stats.tx_pkts += pkts;
995 ring->stats.tx_bytes += bytes;981 ring->stats.tx_bytes += bytes;
996 982
997 NETIF_TX_UNLOCK(ring);
998
999 dev_queue = netdev_get_tx_queue(ndev, ring_data->queue_index);983 dev_queue = netdev_get_tx_queue(ndev, ring_data->queue_index);
1000 netdev_tx_completed_queue(dev_queue, pkts, bytes);984 netdev_tx_completed_queue(dev_queue, pkts, bytes);
1001 985
@@ -1055,16 +1039,12 @@ static void hns_nic_tx_clr_all_bufs(struct hns_nic_ring_data *ring_data) · 53 unmodified lines
1055 int head;1039 int head;
1056 int bytes, pkts;1040 int bytes, pkts;
1057 1041
1058 NETIF_TX_LOCK(ring);
1059
1060 head = ring->next_to_use; /* ntu :soft setted ring position*/1042 head = ring->next_to_use; /* ntu :soft setted ring position*/
1061 bytes = 0;1043 bytes = 0;
1062 pkts = 0;1044 pkts = 0;
1063 while (head != ring->next_to_clean)1045 while (head != ring->next_to_clean)
1064 hns_nic_reclaim_one_desc(ring, &bytes, &pkts);1046 hns_nic_reclaim_one_desc(ring, &bytes, &pkts);
1065 1047
1066 NETIF_TX_UNLOCK(ring);
1067
1068 dev_queue = netdev_get_tx_queue(ndev, ring_data->queue_index);1048 dev_queue = netdev_get_tx_queue(ndev, ring_data->queue_index);
1069 netdev_tx_reset_queue(dev_queue);1049 netdev_tx_reset_queue(dev_queue);
1070}1050}
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+ */
2// Copyright (c) 2016-2017 Hisilicon Limited.2// Copyright (c) 2016-2017 Hisilicon Limited.
3 3
4#ifndef __HNAE3_H4#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+ */
2// Copyright (c) 2016-2017 Hisilicon Limited.2// Copyright (c) 2016-2017 Hisilicon Limited.
3 3
4#ifndef __HNS3_ENET_H4#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+ */
2// Copyright (c) 2016-2017 Hisilicon Limited.2// Copyright (c) 2016-2017 Hisilicon Limited.
3 3
4#ifndef __HCLGE_CMD_H4#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+ */
2// Copyright (c) 2016-2017 Hisilicon Limited.2// Copyright (c) 2016-2017 Hisilicon Limited.
3 3
4#ifndef __HCLGE_DCB_H__4#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
3587{3587{
3588 struct hclge_pf_rst_done_cmd *req;3588 struct hclge_pf_rst_done_cmd *req;
3589 struct hclge_desc desc;3589 struct hclge_desc desc;
3590 int ret;
3590 3591
3591 req = (struct hclge_pf_rst_done_cmd *)desc.data;3592 req = (struct hclge_pf_rst_done_cmd *)desc.data;
3592 hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_PF_RST_DONE, false);3593 hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_PF_RST_DONE, false);
3593 req->pf_rst_done |= HCLGE_PF_RESET_DONE_BIT;3594 req->pf_rst_done |= HCLGE_PF_RESET_DONE_BIT;
3594 3595
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;
3596}3612}
3597 3613
3598static int hclge_reset_prepare_up(struct hclge_dev *hdev)3614static 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+ */
2// Copyright (c) 2016-2017 Hisilicon Limited.2// Copyright (c) 2016-2017 Hisilicon Limited.
3 3
4#ifndef __HCLGE_MAIN_H4#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+ */
2// Copyright (c) 2016-2017 Hisilicon Limited.2// Copyright (c) 2016-2017 Hisilicon Limited.
3 3
4#ifndef __HCLGE_MDIO_H4#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+ */
2// Copyright (c) 2016-2017 Hisilicon Limited.2// Copyright (c) 2016-2017 Hisilicon Limited.
3 3
4#ifndef __HCLGE_TM_H4#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
607 for (i = 0; i < adapter->num_rx_queues; i++)607 for (i = 0; i < adapter->num_rx_queues; i++)
608 rxdr[i].count = rxdr->count;608 rxdr[i].count = rxdr->count;
609 609
610 err = 0;
610 if (netif_running(adapter->netdev)) {611 if (netif_running(adapter->netdev)) {
611 /* Try to get new resources before deleting old */612 /* Try to get new resources before deleting old */
612 err = e1000_setup_all_rx_resources(adapter);613 err = e1000_setup_all_rx_resources(adapter);
@@ -627,14 +628,13 @@ static int e1000_set_ringparam(struct net_device *netdev, · 14 unmodified lines
627 adapter->rx_ring = rxdr;628 adapter->rx_ring = rxdr;
628 adapter->tx_ring = txdr;629 adapter->tx_ring = txdr;
629 err = e1000_up(adapter);630 err = e1000_up(adapter);
630 if (err)
631 goto err_setup;
632 }631 }
633 kfree(tx_old);632 kfree(tx_old);
634 kfree(rx_old);633 kfree(rx_old);
635 634
636 clear_bit(__E1000_RESETTING, &adapter->flags);635 clear_bit(__E1000_RESETTING, &adapter->flags);
637 return 0;636 return err;
637
638err_setup_tx:638err_setup_tx:
639 e1000_free_all_rx_resources(adapter);639 e1000_free_all_rx_resources(adapter);
640err_setup_rx:640err_setup_rx:
@@ -646,7 +646,6 @@ err_alloc_rx: · 5 unmodified lines
646err_alloc_tx:646err_alloc_tx:
647 if (netif_running(adapter->netdev))647 if (netif_running(adapter->netdev))
648 e1000_up(adapter);648 e1000_up(adapter);
649err_setup:
650 clear_bit(__E1000_RESETTING, &adapter->flags);649 clear_bit(__E1000_RESETTING, &adapter->flags);
651 return err;650 return err;
652}651}
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h+2−0
@@ -20,6 +20,8 @@ · 19 unmodified lines
20 20
21/* API version 1.7 implements additional link and PHY-specific APIs */21/* API version 1.7 implements additional link and PHY-specific APIs */
22#define I40E_MINOR_VER_GET_LINK_INFO_XL710 0x000722#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
23/* API version 1.6 for X722 devices adds ability to stop FW LLDP agent */25/* API version 1.6 for X722 devices adds ability to stop FW LLDP agent */
24#define I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722 0x000626#define I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722 0x0006
25 27
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
1876 hw->aq.fw_min_ver < 40)) && hw_link_info->phy_type == 0xE)1876 hw->aq.fw_min_ver < 40)) && hw_link_info->phy_type == 0xE)
1877 hw_link_info->phy_type = I40E_PHY_TYPE_10GBASE_SFPP_CU;1877 hw_link_info->phy_type = I40E_PHY_TYPE_10GBASE_SFPP_CU;
1878 1878
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) {
1880 __le32 tmp;1881 __le32 tmp;
1881 1882
1882 memcpy(&tmp, resp->link_type, sizeof(tmp));1883 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
157 err = i40e_queue_pair_enable(vsi, qid);157 err = i40e_queue_pair_enable(vsi, qid);
158 if (err)158 if (err)
159 return err;159 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;
165 }160 }
166 161
167 return 0;162 return 0;
@@ -694,8 +689,6 @@ static bool i40e_xmit_zc(struct i40e_ring *xdp_ring, unsigned int budget) · 526 unmodified lines
694 i40e_xdp_ring_update_tail(xdp_ring);689 i40e_xdp_ring_update_tail(xdp_ring);
695 690
696 xsk_umem_consume_tx_done(xdp_ring->xsk_umem);691 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);
699 }692 }
700 693
701 return !!budget && work_done;694 return !!budget && work_done;
@@ -774,12 +767,8 @@ bool i40e_clean_xdp_tx_irq(struct i40e_vsi *vsi, · 72 unmodified lines
774 i40e_update_tx_stats(tx_ring, completed_frames, total_bytes);767 i40e_update_tx_stats(tx_ring, completed_frames, total_bytes);
775 768
776out_xmit:769out_xmit:
777 if (xsk_umem_uses_need_wakeup(tx_ring->xsk_umem)) {770 if (xsk_umem_uses_need_wakeup(tx_ring->xsk_umem))
778 if (tx_ring->next_to_clean == tx_ring->next_to_use)771 xsk_set_tx_need_wakeup(tx_ring->xsk_umem);
779 xsk_set_tx_need_wakeup(tx_ring->xsk_umem);
780 else
781 xsk_clear_tx_need_wakeup(tx_ring->xsk_umem);
782 }
783 772
784 xmit_done = i40e_xmit_zc(tx_ring, budget);773 xmit_done = i40e_xmit_zc(tx_ring, budget);
785 774
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
314 q_vector->rx.target_itr = ITR_TO_REG(rx_ring->itr_setting);314 q_vector->rx.target_itr = ITR_TO_REG(rx_ring->itr_setting);
315 q_vector->ring_mask |= BIT(r_idx);315 q_vector->ring_mask |= BIT(r_idx);
316 wr32(hw, IAVF_VFINT_ITRN1(IAVF_RX_ITR, q_vector->reg_idx),316 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);
318 q_vector->rx.current_itr = q_vector->rx.target_itr;318 q_vector->rx.current_itr = q_vector->rx.target_itr;
319}319}
320 320
@@ -340,7 +340,7 @@ iavf_map_vector_to_txq(struct iavf_adapter *adapter, int v_idx, int t_idx) · 19 unmodified lines
340 q_vector->tx.target_itr = ITR_TO_REG(tx_ring->itr_setting);340 q_vector->tx.target_itr = ITR_TO_REG(tx_ring->itr_setting);
341 q_vector->num_ringpairs++;341 q_vector->num_ringpairs++;
342 wr32(hw, IAVF_VFINT_ITRN1(IAVF_TX_ITR, q_vector->reg_idx),342 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);
344 q_vector->tx.current_itr = q_vector->tx.target_itr;344 q_vector->tx.current_itr = q_vector->tx.target_itr;
345}345}
346 346
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
1036 struct ice_aqc_query_txsched_res_resp *buf;1036 struct ice_aqc_query_txsched_res_resp *buf;
1037 enum ice_status status = 0;1037 enum ice_status status = 0;
1038 __le16 max_sibl;1038 __le16 max_sibl;
1039 u8 i;1039 u16 i;
1040 1040
1041 if (hw->layer_info)1041 if (hw->layer_info)
1042 return status;1042 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
466 ? igb_setup_copper_link_82575466 ? igb_setup_copper_link_82575
467 : igb_setup_serdes_link_82575;467 : igb_setup_serdes_link_82575;
468 468
469 if (mac->type == e1000_82580) {469 if (mac->type == e1000_82580 || mac->type == e1000_i350) {
470 switch (hw->device_id) {470 switch (hw->device_id) {
471 /* feature not supported on these id's */471 /* feature not supported on these id's */
472 case E1000_DEV_ID_DH89XXCC_SGMII:472 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
753 struct net_device *netdev = igb->netdev;753 struct net_device *netdev = igb->netdev;
754 hw->hw_addr = NULL;754 hw->hw_addr = NULL;
755 netdev_err(netdev, "PCIe link lost\n");755 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);
757 }758 }
758 759
759 return value;760 return value;
@@ -2064,7 +2065,8 @@ static void igb_check_swap_media(struct igb_adapter *adapter) · 1304 unmodified lines
2064 if ((hw->phy.media_type == e1000_media_type_copper) &&2065 if ((hw->phy.media_type == e1000_media_type_copper) &&
2065 (!(connsw & E1000_CONNSW_AUTOSENSE_EN))) {2066 (!(connsw & E1000_CONNSW_AUTOSENSE_EN))) {
2066 swap_now = true;2067 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)) {
2068 /* copper signal takes time to appear */2070 /* copper signal takes time to appear */
2069 if (adapter->copper_tries < 4) {2071 if (adapter->copper_tries < 4) {
2070 adapter->copper_tries++;2072 adapter->copper_tries++;
@@ -2370,7 +2372,7 @@ void igb_reset(struct igb_adapter *adapter) · 299 unmodified lines
2370 adapter->ei.get_invariants(hw);2372 adapter->ei.get_invariants(hw);
2371 adapter->flags &= ~IGB_FLAG_MEDIA_RESET;2373 adapter->flags &= ~IGB_FLAG_MEDIA_RESET;
2372 }2374 }
2373 if ((mac->type == e1000_82575) &&2375 if ((mac->type == e1000_82575 || mac->type == e1000_i350) &&
2374 (adapter->flags & IGB_FLAG_MAS_ENABLE)) {2376 (adapter->flags & IGB_FLAG_MAS_ENABLE)) {
2375 igb_enable_mas(adapter);2377 igb_enable_mas(adapter);
2376 }2378 }
@@ -5673,8 +5675,8 @@ static void igb_tx_ctxtdesc(struct igb_ring *tx_ring, · 3296 unmodified lines
5673 * should have been handled by the upper layers.5675 * should have been handled by the upper layers.
5674 */5676 */
5675 if (tx_ring->launchtime_enable) {5677 if (tx_ring->launchtime_enable) {
5676 ts = ns_to_timespec64(first->skb->tstamp);5678 ts = ktime_to_timespec64(first->skb->tstamp);
5677 first->skb->tstamp = 0;5679 first->skb->tstamp = ktime_set(0, 0);
5678 context_desc->seqnum_seed = cpu_to_le32(ts.tv_nsec / 32);5680 context_desc->seqnum_seed = cpu_to_le32(ts.tv_nsec / 32);
5679 } else {5681 } else {
5680 context_desc->seqnum_seed = 0;5682 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
824 * should have been handled by the upper layers.824 * should have been handled by the upper layers.
825 */825 */
826 if (tx_ring->launchtime_enable) {826 if (tx_ring->launchtime_enable) {
827 ts = ns_to_timespec64(first->skb->tstamp);827 ts = ktime_to_timespec64(first->skb->tstamp);
828 first->skb->tstamp = 0;828 first->skb->tstamp = ktime_set(0, 0);
829 context_desc->launch_time = cpu_to_le32(ts.tv_nsec / 32);829 context_desc->launch_time = cpu_to_le32(ts.tv_nsec / 32);
830 } else {830 } else {
831 context_desc->launch_time = 0;831 context_desc->launch_time = 0;
@@ -4047,7 +4047,8 @@ u32 igc_rd32(struct igc_hw *hw, u32 reg) · 3215 unmodified lines
4047 hw->hw_addr = NULL;4047 hw->hw_addr = NULL;
4048 netif_device_detach(netdev);4048 netif_device_detach(netdev);
4049 netdev_err(netdev, "PCIe link lost, device now detached\n");4049 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);
4051 }4052 }
4052 4053
4053 return value;4054 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
4310 if (test_bit(__IXGBE_RX_FCOE, &rx_ring->state))4310 if (test_bit(__IXGBE_RX_FCOE, &rx_ring->state))
4311 set_bit(__IXGBE_RX_3K_BUFFER, &rx_ring->state);4311 set_bit(__IXGBE_RX_3K_BUFFER, &rx_ring->state);
4312 4312
4313 clear_bit(__IXGBE_RX_BUILD_SKB_ENABLED, &rx_ring->state);
4314 if (adapter->flags2 & IXGBE_FLAG2_RX_LEGACY)4313 if (adapter->flags2 & IXGBE_FLAG2_RX_LEGACY)
4315 continue;4314 continue;
4316 4315
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
622 if (tx_desc) {622 if (tx_desc) {
623 ixgbe_xdp_ring_update_tail(xdp_ring);623 ixgbe_xdp_ring_update_tail(xdp_ring);
624 xsk_umem_consume_tx_done(xdp_ring->xsk_umem);624 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);
627 }625 }
628 626
629 return !!budget && work_done;627 return !!budget && work_done;
@@ -691,12 +689,8 @@ bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector, · 61 unmodified lines
691 if (xsk_frames)689 if (xsk_frames)
692 xsk_umem_complete_tx(umem, xsk_frames);690 xsk_umem_complete_tx(umem, xsk_frames);
693 691
694 if (xsk_umem_uses_need_wakeup(tx_ring->xsk_umem)) {692 if (xsk_umem_uses_need_wakeup(tx_ring->xsk_umem))
695 if (tx_ring->next_to_clean == tx_ring->next_to_use)693 xsk_set_tx_need_wakeup(tx_ring->xsk_umem);
696 xsk_set_tx_need_wakeup(tx_ring->xsk_umem);
697 else
698 xsk_clear_tx_need_wakeup(tx_ring->xsk_umem);
699 }
700 694
701 return ixgbe_xmit_zc(tx_ring, q_vector->tx.work_limit);695 return ixgbe_xmit_zc(tx_ring, q_vector->tx.work_limit);
702}696}
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
160 (bm_pool->id << MVNETA_BM_POOL_ACCESS_OFFS));160 (bm_pool->id << MVNETA_BM_POOL_ACCESS_OFFS));
161}161}
162#else162#else
163void mvneta_bm_pool_destroy(struct mvneta_bm *priv,163static inline void mvneta_bm_pool_destroy(struct mvneta_bm *priv,
164 struct mvneta_bm_pool *bm_pool, u8 port_map) {}164 struct mvneta_bm_pool *bm_pool,
165void mvneta_bm_bufs_free(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,165 u8 port_map) {}
166 u8 port_map) {}166static inline void mvneta_bm_bufs_free(struct mvneta_bm *priv,
167int mvneta_bm_construct(struct hwbm_pool *hwbm_pool, void *buf) { return 0; }167 struct mvneta_bm_pool *bm_pool,
168int mvneta_bm_pool_refill(struct mvneta_bm *priv,168 u8 port_map) {}
169 struct mvneta_bm_pool *bm_pool) {return 0; }169static inline int mvneta_bm_construct(struct hwbm_pool *hwbm_pool, void *buf)
170struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,170{ return 0; }
171 enum mvneta_bm_type type, u8 port_id,171static inline int mvneta_bm_pool_refill(struct mvneta_bm *priv,
172 int pkt_size) { return NULL; }172 struct mvneta_bm_pool *bm_pool)
173{ return 0; }
174static 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; }
173 180
174static inline void mvneta_bm_pool_put_bp(struct mvneta_bm *priv,181static inline void mvneta_bm_pool_put_bp(struct mvneta_bm *priv,
175 struct mvneta_bm_pool *bm_pool,182 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
178static inline u32 mvneta_bm_pool_get_bp(struct mvneta_bm *priv,185static inline u32 mvneta_bm_pool_get_bp(struct mvneta_bm *priv,
179 struct mvneta_bm_pool *bm_pool)186 struct mvneta_bm_pool *bm_pool)
180{ return 0; }187{ return 0; }
181struct mvneta_bm *mvneta_bm_get(struct device_node *node) { return NULL; }188static inline struct mvneta_bm *mvneta_bm_get(struct device_node *node)
182void mvneta_bm_put(struct mvneta_bm *priv) {}189{ return NULL; }
190static inline void mvneta_bm_put(struct mvneta_bm *priv) {}
183#endif /* CONFIG_MVNETA_BM */191#endif /* CONFIG_MVNETA_BM */
184#endif192#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
514 dev->caps.max_rq_desc_sz = dev_cap->max_rq_desc_sz;514 dev->caps.max_rq_desc_sz = dev_cap->max_rq_desc_sz;
515 /*515 /*
516 * Subtract 1 from the limit because we need to allocate a516 * Subtract 1 from the limit because we need to allocate a
517 * spare CQE so the HCA HW can tell the difference between an517 * spare CQE to enable resizing the CQ.
518 * empty CQ and a full CQ.
519 */518 */
520 dev->caps.max_cqes = dev_cap->max_cq_sz - 1;519 dev->caps.max_cqes = dev_cap->max_cq_sz - 1;
521 dev->caps.reserved_cqs = dev_cap->reserved_cqs;520 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
471 priv->mfunc.master.res_tracker.res_alloc[RES_MPT].quota[pf];471 priv->mfunc.master.res_tracker.res_alloc[RES_MPT].quota[pf];
472}472}
473 473
474static int get_max_gauranteed_vfs_counter(struct mlx4_dev *dev)474static int
475mlx4_calc_res_counter_guaranteed(struct mlx4_dev *dev,
476 struct resource_allocator *res_alloc,
477 int vf)
475{478{
476 /* reduce the sink counter */479 struct mlx4_active_ports actv_ports;
477 return (dev->caps.max_counters - 1 -480 int ports, counters_guaranteed;
478 (MLX4_PF_COUNTERS_PER_PORT * MLX4_MAX_PORTS))481
479 / MLX4_MAX_PORTS;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;
480}499}
481 500
482int mlx4_init_resource_tracker(struct mlx4_dev *dev)501int mlx4_init_resource_tracker(struct mlx4_dev *dev)
@@ -484,7 +503,6 @@ int mlx4_init_resource_tracker(struct mlx4_dev *dev) · 1 unmodified line
484 struct mlx4_priv *priv = mlx4_priv(dev);503 struct mlx4_priv *priv = mlx4_priv(dev);
485 int i, j;504 int i, j;
486 int t;505 int t;
487 int max_vfs_guarantee_counter = get_max_gauranteed_vfs_counter(dev);
488 506
489 priv->mfunc.master.res_tracker.slave_list =507 priv->mfunc.master.res_tracker.slave_list =
490 kcalloc(dev->num_slaves, sizeof(struct slave_list),508 kcalloc(dev->num_slaves, sizeof(struct slave_list),
@@ -603,16 +621,8 @@ int mlx4_init_resource_tracker(struct mlx4_dev *dev) · 112 unmodified lines
603 break;621 break;
604 case RES_COUNTER:622 case RES_COUNTER:
605 res_alloc->quota[t] = dev->caps.max_counters;623 res_alloc->quota[t] = dev->caps.max_counters;
606 if (t == mlx4_master_func_num(dev))624 res_alloc->guaranteed[t] =
607 res_alloc->guaranteed[t] =625 mlx4_calc_res_counter_guaranteed(dev, res_alloc, 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;
616 break;626 break;
617 default:627 default:
618 break;628 break;
drivers/net/ethernet/mellanox/mlx5/core/en.h+2−1
@@ -345,7 +345,7 @@ struct mlx5e_tx_wqe_info { · 344 unmodified lines
345 u8 num_wqebbs;345 u8 num_wqebbs;
346 u8 num_dma;346 u8 num_dma;
347#ifdef CONFIG_MLX5_EN_TLS347#ifdef CONFIG_MLX5_EN_TLS
348 skb_frag_t *resync_dump_frag;348 struct page *resync_dump_frag_page;
349#endif349#endif
350};350};
351 351
@@ -410,6 +410,7 @@ struct mlx5e_txqsq { · 58 unmodified lines
410 struct device *pdev;410 struct device *pdev;
411 __be32 mkey_be;411 __be32 mkey_be;
412 unsigned long state;412 unsigned long state;
413 unsigned int hw_mtu;
413 struct hwtstamp_config *tstamp;414 struct hwtstamp_config *tstamp;
414 struct mlx5_clock *clock;415 struct mlx5_clock *clock;
415 416
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
141 "Failed to create hv vhca stats agent, err = %ld\n",141 "Failed to create hv vhca stats agent, err = %ld\n",
142 PTR_ERR(agent));142 PTR_ERR(agent));
143 143
144 kfree(priv->stats_agent.buf);144 kvfree(priv->stats_agent.buf);
145 return IS_ERR_OR_NULL(agent);145 return IS_ERR_OR_NULL(agent);
146 }146 }
147 147
@@ -157,5 +157,5 @@ void mlx5e_hv_vhca_stats_destroy(struct mlx5e_priv *priv) · 9 unmodified lines
157 return;157 return;
158 158
159 mlx5_hv_vhca_agent_destroy(priv->stats_agent.agent);159 mlx5_hv_vhca_agent_destroy(priv->stats_agent.agent);
160 kfree(priv->stats_agent.buf);160 kvfree(priv->stats_agent.buf);
161}161}
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
97 if (ret)97 if (ret)
98 return ret;98 return ret;
99 99
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);
101 return -ENETUNREACH;102 return -ENETUNREACH;
103 }
102#else104#else
103 return -EOPNOTSUPP;105 return -EOPNOTSUPP;
104#endif106#endif
105 107
106 ret = get_route_and_out_devs(priv, rt->dst.dev, route_dev, out_dev);108 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);
108 return ret;111 return ret;
112 }
109 113
110 if (!(*out_ttl))114 if (!(*out_ttl))
111 *out_ttl = ip4_dst_hoplimit(&rt->dst);115 *out_ttl = ip4_dst_hoplimit(&rt->dst);
@@ -149,8 +153,10 @@ static int mlx5e_route_lookup_ipv6(struct mlx5e_priv *priv, · 37 unmodified lines
149 *out_ttl = ip6_dst_hoplimit(dst);153 *out_ttl = ip6_dst_hoplimit(dst);
150 154
151 ret = get_route_and_out_devs(priv, dst->dev, route_dev, out_dev);155 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);
153 return ret;158 return ret;
159 }
154#else160#else
155 return -EOPNOTSUPP;161 return -EOPNOTSUPP;
156#endif162#endif
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h+6−7
@@ -15,15 +15,14 @@ · 14 unmodified lines
15#else15#else
16/* TLS offload requires additional stop_room for:16/* TLS offload requires additional stop_room for:
17 * - a resync SKB.17 * - a resync SKB.
18 * kTLS offload requires additional stop_room for:18 * kTLS offload requires fixed additional stop_room for:
19 * - static params WQE,19 * - a static params WQE, and a progress params WQE.
20 * - progress params WQE, and20 * The additional MTU-depending room for the resync DUMP WQEs
21 * - resync DUMP per frag.21 * will be calculated and added in runtime.
22 */22 */
23#define MLX5E_SQ_TLS_ROOM \23#define MLX5E_SQ_TLS_ROOM \
24 (MLX5_SEND_WQE_MAX_WQEBBS + \24 (MLX5_SEND_WQE_MAX_WQEBBS + \
25 MLX5E_KTLS_STATIC_WQEBBS + MLX5E_KTLS_PROGRESS_WQEBBS + \25 MLX5E_KTLS_STATIC_WQEBBS + MLX5E_KTLS_PROGRESS_WQEBBS)
26 MAX_SKB_FRAGS * MLX5E_KTLS_MAX_DUMP_WQEBBS)
27#endif26#endif
28 27
29#define INL_HDR_START_SZ (sizeof(((struct mlx5_wqe_eth_seg *)NULL)->inline_hdr.start))28#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
92 91
93 /* fill sq frag edge with nops to avoid wqe wrapping two pages */92 /* fill sq frag edge with nops to avoid wqe wrapping two pages */
94 for (; wi < edge_wi; wi++) {93 for (; wi < edge_wi; wi++) {
95 wi->skb = NULL;94 memset(wi, 0, sizeof(*wi));
96 wi->num_wqebbs = 1;95 wi->num_wqebbs = 1;
97 mlx5e_post_nop(wq, sq->sqn, &sq->pc);96 mlx5e_post_nop(wq, sq->sqn, &sq->pc);
98 }97 }
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
38 return -ENOMEM;38 return -ENOMEM;
39 39
40 tx_priv->expected_seq = start_offload_tcp_sn;40 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;
42 mlx5e_set_ktls_tx_priv_ctx(tls_ctx, tx_priv);42 mlx5e_set_ktls_tx_priv_ctx(tls_ctx, tx_priv);
43 43
44 /* tc and underlay_qpn values are not in use for tls tis */44 /* 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
21 MLX5_ST_SZ_BYTES(tls_progress_params))21 MLX5_ST_SZ_BYTES(tls_progress_params))
22#define MLX5E_KTLS_PROGRESS_WQEBBS \22#define MLX5E_KTLS_PROGRESS_WQEBBS \
23 (DIV_ROUND_UP(MLX5E_KTLS_PROGRESS_WQE_SZ, MLX5_SEND_WQE_BB))23 (DIV_ROUND_UP(MLX5E_KTLS_PROGRESS_WQE_SZ, MLX5_SEND_WQE_BB))
24#define MLX5E_KTLS_MAX_DUMP_WQEBBS 224
25struct 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))
25 32
26enum {33enum {
27 MLX5E_TLS_PROGRESS_PARAMS_AUTH_STATE_NO_OFFLOAD = 0,34 MLX5E_TLS_PROGRESS_PARAMS_AUTH_STATE_NO_OFFLOAD = 0,
@@ -37,7 +44,7 @@ enum { · 9 unmodified lines
37 44
38struct mlx5e_ktls_offload_context_tx {45struct mlx5e_ktls_offload_context_tx {
39 struct tls_offload_context_tx *tx_ctx;46 struct tls_offload_context_tx *tx_ctx;
40 struct tls_crypto_info *crypto_info;47 struct tls12_crypto_info_aes_gcm_128 crypto_info;
41 u32 expected_seq;48 u32 expected_seq;
42 u32 tisn;49 u32 tisn;
43 u32 key_id;50 u32 key_id;
@@ -86,14 +93,28 @@ struct sk_buff *mlx5e_ktls_handle_tx_skb(struct net_device *netdev, · 42 unmodified lines
86 struct mlx5e_tx_wqe **wqe, u16 *pi);93 struct mlx5e_tx_wqe **wqe, u16 *pi);
87void mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq,94void mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
88 struct mlx5e_tx_wqe_info *wi,95 struct mlx5e_tx_wqe_info *wi,
89 struct mlx5e_sq_dma *dma);96 u32 *dma_fifo_cc);
90 97static inline u8
98mlx5e_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}
91#else107#else
92 108
93static inline void mlx5e_ktls_build_netdev(struct mlx5e_priv *priv)109static inline void mlx5e_ktls_build_netdev(struct mlx5e_priv *priv)
94{110{
95}111}
96 112
113static inline void
114mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
115 struct mlx5e_tx_wqe_info *wi,
116 u32 *dma_fifo_cc) {}
117
97#endif118#endif
98 119
99#endif /* __MLX5E_TLS_H__ */120#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
24static void24static void
25fill_static_params_ctx(void *ctx, struct mlx5e_ktls_offload_context_tx *priv_tx)25fill_static_params_ctx(void *ctx, struct mlx5e_ktls_offload_context_tx *priv_tx)
26{26{
27 struct tls_crypto_info *crypto_info = priv_tx->crypto_info;27 struct tls12_crypto_info_aes_gcm_128 *info = &priv_tx->crypto_info;
28 struct tls12_crypto_info_aes_gcm_128 *info;
29 char *initial_rn, *gcm_iv;28 char *initial_rn, *gcm_iv;
30 u16 salt_sz, rec_seq_sz;29 u16 salt_sz, rec_seq_sz;
31 char *salt, *rec_seq;30 char *salt, *rec_seq;
32 u8 tls_version;31 u8 tls_version;
33 32
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;
38 EXTRACT_INFO_FIELDS;33 EXTRACT_INFO_FIELDS;
39 34
40 gcm_iv = MLX5_ADDR_OF(tls_static_params, ctx, gcm_iv);35 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
108}103}
109 104
110static void tx_fill_wi(struct mlx5e_txqsq *sq,105static void tx_fill_wi(struct mlx5e_txqsq *sq,
111 u16 pi, u8 num_wqebbs,106 u16 pi, u8 num_wqebbs, u32 num_bytes,
112 skb_frag_t *resync_dump_frag,107 struct page *page)
113 u32 num_bytes)
114{108{
115 struct mlx5e_tx_wqe_info *wi = &sq->db.wqe_info[pi];109 struct mlx5e_tx_wqe_info *wi = &sq->db.wqe_info[pi];
116 110
117 wi->skb = NULL;111 memset(wi, 0, sizeof(*wi));
118 wi->num_wqebbs = num_wqebbs;112 wi->num_wqebbs = num_wqebbs;
119 wi->resync_dump_frag = resync_dump_frag;113 wi->num_bytes = num_bytes;
120 wi->num_bytes = num_bytes;114 wi->resync_dump_frag_page = page;
121}115}
122 116
123void mlx5e_ktls_tx_offload_set_pending(struct mlx5e_ktls_offload_context_tx *priv_tx)117void 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
145 139
146 umr_wqe = mlx5e_sq_fetch_wqe(sq, MLX5E_KTLS_STATIC_UMR_WQE_SZ, &pi);140 umr_wqe = mlx5e_sq_fetch_wqe(sq, MLX5E_KTLS_STATIC_UMR_WQE_SZ, &pi);
147 build_static_params(umr_wqe, sq->pc, sq->sqn, priv_tx, fence);141 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);
149 sq->pc += MLX5E_KTLS_STATIC_WQEBBS;143 sq->pc += MLX5E_KTLS_STATIC_WQEBBS;
150}144}
151 145
@@ -159,7 +153,7 @@ post_progress_params(struct mlx5e_txqsq *sq, · 7 unmodified lines
159 153
160 wqe = mlx5e_sq_fetch_wqe(sq, MLX5E_KTLS_PROGRESS_WQE_SZ, &pi);154 wqe = mlx5e_sq_fetch_wqe(sq, MLX5E_KTLS_PROGRESS_WQE_SZ, &pi);
161 build_progress_params(wqe, sq->pc, sq->sqn, priv_tx, fence);155 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);
163 sq->pc += MLX5E_KTLS_PROGRESS_WQEBBS;157 sq->pc += MLX5E_KTLS_PROGRESS_WQEBBS;
164}158}
165 159
@@ -169,6 +163,14 @@ mlx5e_ktls_tx_post_param_wqes(struct mlx5e_txqsq *sq, · 3 unmodified lines
169 bool skip_static_post, bool fence_first_post)163 bool skip_static_post, bool fence_first_post)
170{164{
171 bool progress_fence = skip_static_post || !fence_first_post;165 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);
172 174
173 if (!skip_static_post)175 if (!skip_static_post)
174 post_static_params(sq, priv_tx, fence_first_post);176 post_static_params(sq, priv_tx, fence_first_post);
@@ -180,29 +182,36 @@ struct tx_sync_info { · 5 unmodified lines
180 u64 rcd_sn;182 u64 rcd_sn;
181 s32 sync_len;183 s32 sync_len;
182 int nr_frags;184 int nr_frags;
183 skb_frag_t *frags[MAX_SKB_FRAGS];185 skb_frag_t frags[MAX_SKB_FRAGS];
186};
187
188enum mlx5e_ktls_sync_retval {
189 MLX5E_KTLS_SYNC_DONE,
190 MLX5E_KTLS_SYNC_FAIL,
191 MLX5E_KTLS_SYNC_SKIP_NO_DATA,
184};192};
185 193
186static bool tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,194static enum mlx5e_ktls_sync_retval
187 u32 tcp_seq, struct tx_sync_info *info)195tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
196 u32 tcp_seq, struct tx_sync_info *info)
188{197{
189 struct tls_offload_context_tx *tx_ctx = priv_tx->tx_ctx;198 struct tls_offload_context_tx *tx_ctx = priv_tx->tx_ctx;
199 enum mlx5e_ktls_sync_retval ret = MLX5E_KTLS_SYNC_DONE;
190 struct tls_record_info *record;200 struct tls_record_info *record;
191 int remaining, i = 0;201 int remaining, i = 0;
192 unsigned long flags;202 unsigned long flags;
193 bool ret = true;
194 203
195 spin_lock_irqsave(&tx_ctx->lock, flags);204 spin_lock_irqsave(&tx_ctx->lock, flags);
196 record = tls_get_record(tx_ctx, tcp_seq, &info->rcd_sn);205 record = tls_get_record(tx_ctx, tcp_seq, &info->rcd_sn);
197 206
198 if (unlikely(!record)) {207 if (unlikely(!record)) {
199 ret = false;208 ret = MLX5E_KTLS_SYNC_FAIL;
200 goto out;209 goto out;
201 }210 }
202 211
203 if (unlikely(tcp_seq < tls_record_start_seq(record))) {212 if (unlikely(tcp_seq < tls_record_start_seq(record))) {
204 if (!tls_record_is_start_marker(record))213 ret = tls_record_is_start_marker(record) ?
205 ret = false;214 MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL;
206 goto out;215 goto out;
207 }216 }
208 217
@@ -211,13 +220,13 @@ static bool tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx, · 2 unmodified lines
211 while (remaining > 0) {220 while (remaining > 0) {
212 skb_frag_t *frag = &record->frags[i];221 skb_frag_t *frag = &record->frags[i];
213 222
214 __skb_frag_ref(frag);223 get_page(skb_frag_page(frag));
215 remaining -= skb_frag_size(frag);224 remaining -= skb_frag_size(frag);
216 info->frags[i++] = frag;225 info->frags[i++] = *frag;
217 }226 }
218 /* reduce the part which will be sent with the original SKB */227 /* reduce the part which will be sent with the original SKB */
219 if (remaining < 0)228 if (remaining < 0)
220 skb_frag_size_add(info->frags[i - 1], remaining);229 skb_frag_size_add(&info->frags[i - 1], remaining);
221 info->nr_frags = i;230 info->nr_frags = i;
222out:231out:
223 spin_unlock_irqrestore(&tx_ctx->lock, flags);232 spin_unlock_irqrestore(&tx_ctx->lock, flags);
@@ -229,17 +238,12 @@ tx_post_resync_params(struct mlx5e_txqsq *sq, · 5 unmodified lines
229 struct mlx5e_ktls_offload_context_tx *priv_tx,238 struct mlx5e_ktls_offload_context_tx *priv_tx,
230 u64 rcd_sn)239 u64 rcd_sn)
231{240{
232 struct tls_crypto_info *crypto_info = priv_tx->crypto_info;241 struct tls12_crypto_info_aes_gcm_128 *info = &priv_tx->crypto_info;
233 struct tls12_crypto_info_aes_gcm_128 *info;
234 __be64 rn_be = cpu_to_be64(rcd_sn);242 __be64 rn_be = cpu_to_be64(rcd_sn);
235 bool skip_static_post;243 bool skip_static_post;
236 u16 rec_seq_sz;244 u16 rec_seq_sz;
237 char *rec_seq;245 char *rec_seq;
238 246
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;
243 rec_seq = info->rec_seq;247 rec_seq = info->rec_seq;
244 rec_seq_sz = sizeof(info->rec_seq);248 rec_seq_sz = sizeof(info->rec_seq);
245 249
@@ -250,11 +254,6 @@ tx_post_resync_params(struct mlx5e_txqsq *sq, · 4 unmodified lines
250 mlx5e_ktls_tx_post_param_wqes(sq, priv_tx, skip_static_post, true);254 mlx5e_ktls_tx_post_param_wqes(sq, priv_tx, skip_static_post, true);
251}255}
252 256
253struct mlx5e_dump_wqe {
254 struct mlx5_wqe_ctrl_seg ctrl;
255 struct mlx5_wqe_data_seg data;
256};
257
258static int257static int
259tx_post_resync_dump(struct mlx5e_txqsq *sq, skb_frag_t *frag, u32 tisn, bool first)258tx_post_resync_dump(struct mlx5e_txqsq *sq, skb_frag_t *frag, u32 tisn, bool first)
260{259{
@@ -262,7 +261,6 @@ tx_post_resync_dump(struct mlx5e_txqsq *sq, skb_frag_t *frag, u32 tisn, bool fir · 1 unmodified line
262 struct mlx5_wqe_data_seg *dseg;261 struct mlx5_wqe_data_seg *dseg;
263 struct mlx5e_dump_wqe *wqe;262 struct mlx5e_dump_wqe *wqe;
264 dma_addr_t dma_addr = 0;263 dma_addr_t dma_addr = 0;
265 u8 num_wqebbs;
266 u16 ds_cnt;264 u16 ds_cnt;
267 int fsz;265 int fsz;
268 u16 pi;266 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
270 wqe = mlx5e_sq_fetch_wqe(sq, sizeof(*wqe), &pi);268 wqe = mlx5e_sq_fetch_wqe(sq, sizeof(*wqe), &pi);
271 269
272 ds_cnt = sizeof(*wqe) / MLX5_SEND_WQE_DS;270 ds_cnt = sizeof(*wqe) / MLX5_SEND_WQE_DS;
273 num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS);
274 271
275 cseg = &wqe->ctrl;272 cseg = &wqe->ctrl;
276 dseg = &wqe->data;273 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
291 dseg->byte_count = cpu_to_be32(fsz);288 dseg->byte_count = cpu_to_be32(fsz);
292 mlx5e_dma_push(sq, dma_addr, fsz, MLX5E_DMA_MAP_PAGE);289 mlx5e_dma_push(sq, dma_addr, fsz, MLX5E_DMA_MAP_PAGE);
293 290
294 tx_fill_wi(sq, pi, num_wqebbs, frag, fsz);291 tx_fill_wi(sq, pi, MLX5E_KTLS_DUMP_WQEBBS, fsz, skb_frag_page(frag));
295 sq->pc += num_wqebbs;292 sq->pc += MLX5E_KTLS_DUMP_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);
300 293
301 return 0;294 return 0;
302}295}
303 296
304void mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq,297void mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
305 struct mlx5e_tx_wqe_info *wi,298 struct mlx5e_tx_wqe_info *wi,
306 struct mlx5e_sq_dma *dma)299 u32 *dma_fifo_cc)
307{300{
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;
309 309
310 mlx5e_tx_dma_unmap(sq->pdev, dma);310 mlx5e_tx_dma_unmap(sq->pdev, dma);
311 __skb_frag_unref(wi->resync_dump_frag);311 put_page(wi->resync_dump_frag_page);
312 stats->tls_dump_packets++;312 stats->tls_dump_packets++;
313 stats->tls_dump_bytes += wi->num_bytes;313 stats->tls_dump_bytes += wi->num_bytes;
314}314}
@@ -318,25 +318,31 @@ static void tx_post_fence_nop(struct mlx5e_txqsq *sq) · 3 unmodified lines
318 struct mlx5_wq_cyc *wq = &sq->wq;318 struct mlx5_wq_cyc *wq = &sq->wq;
319 u16 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);319 u16 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
320 320
321 tx_fill_wi(sq, pi, 1, NULL, 0);321 tx_fill_wi(sq, pi, 1, 0, NULL);
322 322
323 mlx5e_post_nop_fence(wq, sq->sqn, &sq->pc);323 mlx5e_post_nop_fence(wq, sq->sqn, &sq->pc);
324}324}
325 325
326static struct sk_buff *326static enum mlx5e_ktls_sync_retval
327mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,327mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,
328 struct mlx5e_txqsq *sq,328 struct mlx5e_txqsq *sq,
329 struct sk_buff *skb,329 int datalen,
330 u32 seq)330 u32 seq)
331{331{
332 struct mlx5e_sq_stats *stats = sq->stats;332 struct mlx5e_sq_stats *stats = sq->stats;
333 struct mlx5_wq_cyc *wq = &sq->wq;333 struct mlx5_wq_cyc *wq = &sq->wq;
334 enum mlx5e_ktls_sync_retval ret;
334 struct tx_sync_info info = {};335 struct tx_sync_info info = {};
335 u16 contig_wqebbs_room, pi;336 u16 contig_wqebbs_room, pi;
336 u8 num_wqebbs;337 u8 num_wqebbs;
337 int i;338 int i = 0;
338 339
339 if (!tx_sync_info_get(priv_tx, seq, &info)) {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 }
340 /* We might get here if a retransmission reaches the driver346 /* We might get here if a retransmission reaches the driver
341 * after the relevant record is acked.347 * after the relevant record is acked.
342 * It should be safe to drop the packet in this case348 * 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
346 }352 }
347 353
348 if (unlikely(info.sync_len < 0)) {354 if (unlikely(info.sync_len < 0)) {
349 u32 payload;355 if (likely(datalen <= -info.sync_len))
350 int headln;356 return MLX5E_KTLS_SYNC_DONE;
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;
356 357
357 stats->tls_drop_bypass_req++;358 stats->tls_drop_bypass_req++;
358 goto err_out;359 goto err_out;
@@ -360,30 +361,62 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx, · 1 unmodified line
360 361
361 stats->tls_ooo++;362 stats->tls_ooo++;
362 363
363 num_wqebbs = MLX5E_KTLS_STATIC_WQEBBS + MLX5E_KTLS_PROGRESS_WQEBBS +364 tx_post_resync_params(sq, priv_tx, info.rcd_sn);
364 (info.nr_frags ? info.nr_frags * MLX5E_KTLS_MAX_DUMP_WQEBBS : 1);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);
365 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);375 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
366 contig_wqebbs_room = mlx5_wq_cyc_get_contig_wqebbs(wq, pi);376 contig_wqebbs_room = mlx5_wq_cyc_get_contig_wqebbs(wq, pi);
377
367 if (unlikely(contig_wqebbs_room < num_wqebbs))378 if (unlikely(contig_wqebbs_room < num_wqebbs))
368 mlx5e_fill_sq_frag_edge(sq, wq, pi, contig_wqebbs_room);379 mlx5e_fill_sq_frag_edge(sq, wq, pi, contig_wqebbs_room);
369 380
370 tx_post_resync_params(sq, priv_tx, info.rcd_sn);381 tx_post_resync_params(sq, priv_tx, info.rcd_sn);
371 382
372 for (i = 0; i < info.nr_frags; i++)383 for (; i < info.nr_frags; i++) {
373 if (tx_post_resync_dump(sq, info.frags[i], priv_tx->tisn, !i))384 unsigned int orig_fsz, frag_offset = 0, n = 0;
374 goto err_out;385 skb_frag_t *f = &info.frags[i];
375 386
376 /* If no dump WQE was sent, we need to have a fence NOP WQE before the387 orig_fsz = skb_frag_size(f);
377 * actual data xmit.
378 */
379 if (!info.nr_frags)
380 tx_post_fence_nop(sq);
381 388
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;
383 409
384err_out:410err_out:
385 dev_kfree_skb_any(skb);411 for (; i < info.nr_frags; i++)
386 return NULL;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;
387}420}
388 421
389struct sk_buff *mlx5e_ktls_handle_tx_skb(struct net_device *netdev,422struct 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
419 452
420 seq = ntohl(tcp_hdr(skb)->seq);453 seq = ntohl(tcp_hdr(skb)->seq);
421 if (unlikely(priv_tx->expected_seq != seq)) {454 if (unlikely(priv_tx->expected_seq != seq)) {
422 skb = mlx5e_ktls_tx_handle_ooo(priv_tx, sq, skb, seq);455 enum mlx5e_ktls_sync_retval ret =
423 if (unlikely(!skb))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 */
424 goto out;463 goto out;
425 *wqe = mlx5e_sq_fetch_wqe(sq, sizeof(**wqe), pi);
426 }464 }
427 465
428 priv_tx->expected_seq = seq + datalen;466 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
1021{1021{
1022#define MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT ETHTOOL_LINK_MODE_50000baseKR_Full_BIT1022#define MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT ETHTOOL_LINK_MODE_50000baseKR_Full_BIT
1023 int size = __ETHTOOL_LINK_MODE_MASK_NBITS - MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT;1023 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,};
1025 1025
1026 bitmap_set(modes, MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT, size);1026 bitmap_set(modes, MLX5E_MIN_PTYS_EXT_LINK_MODE_BIT, size);
1027 return bitmap_intersects(modes, adver, __ETHTOOL_LINK_MODE_MASK_NBITS);1027 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
1128 sq->txq_ix = txq_ix;1128 sq->txq_ix = txq_ix;
1129 sq->uar_map = mdev->mlx5e_res.bfreg.map;1129 sq->uar_map = mdev->mlx5e_res.bfreg.map;
1130 sq->min_inline_mode = params->tx_min_inline_mode;1130 sq->min_inline_mode = params->tx_min_inline_mode;
1131 sq->hw_mtu = MLX5E_SW2HW_MTU(params, params->sw_mtu);
1131 sq->stats = &c->priv->channel_stats[c->ix].sq[tc];1132 sq->stats = &c->priv->channel_stats[c->ix].sq[tc];
1132 sq->stop_room = MLX5E_SQ_STOP_ROOM;1133 sq->stop_room = MLX5E_SQ_STOP_ROOM;
1133 INIT_WORK(&sq->recover_work, mlx5e_tx_err_cqe_work);1134 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
1135 set_bit(MLX5E_SQ_STATE_VLAN_NEED_L2_INLINE, &sq->state);1136 set_bit(MLX5E_SQ_STATE_VLAN_NEED_L2_INLINE, &sq->state);
1136 if (MLX5_IPSEC_DEV(c->priv->mdev))1137 if (MLX5_IPSEC_DEV(c->priv->mdev))
1137 set_bit(MLX5E_SQ_STATE_IPSEC, &sq->state);1138 set_bit(MLX5E_SQ_STATE_IPSEC, &sq->state);
1139#ifdef CONFIG_MLX5_EN_TLS
1138 if (mlx5_accel_is_tls_device(c->priv->mdev)) {1140 if (mlx5_accel_is_tls_device(c->priv->mdev)) {
1139 set_bit(MLX5E_SQ_STATE_TLS, &sq->state);1141 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);
1141 }1145 }
1146#endif
1142 1147
1143 param->wq.db_numa_node = cpu_to_node(c->cpu);1148 param->wq.db_numa_node = cpu_to_node(c->cpu);
1144 err = mlx5_wq_cyc_create(mdev, &param->wq, sqc_wq, wq, &sq->wq_ctrl);1149 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
1349 /* last doorbell out, godspeed .. */1354 /* last doorbell out, godspeed .. */
1350 if (mlx5e_wqc_has_room_for(wq, sq->cc, sq->pc, 1)) {1355 if (mlx5e_wqc_has_room_for(wq, sq->cc, sq->pc, 1)) {
1351 u16 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);1356 u16 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
1357 struct mlx5e_tx_wqe_info *wi;
1352 struct mlx5e_tx_wqe *nop;1358 struct mlx5e_tx_wqe *nop;
1353 1359
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;
1355 nop = mlx5e_post_nop(wq, sq->sqn, &sq->pc);1364 nop = mlx5e_post_nop(wq, sq->sqn, &sq->pc);
1356 mlx5e_notify_hw(wq, sq->pc, sq->uar_map, &nop->ctrl);1365 mlx5e_notify_hw(wq, sq->pc, sq->uar_map, &nop->ctrl);
1357 }1366 }
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
611 611
612 mutex_lock(&esw->offloads.encap_tbl_lock);612 mutex_lock(&esw->offloads.encap_tbl_lock);
613 encap_connected = !!(e->flags & MLX5_ENCAP_ENTRY_VALID);613 encap_connected = !!(e->flags & MLX5_ENCAP_ENTRY_VALID);
614 if (e->compl_result || (encap_connected == neigh_connected &&614 if (e->compl_result < 0 || (encap_connected == neigh_connected &&
615 ether_addr_equal(e->h_dest, ha)))615 ether_addr_equal(e->h_dest, ha)))
616 goto unlock;616 goto unlock;
617 617
618 mlx5e_take_all_encap_flows(e, &flow_list);618 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
1386 if (unlikely(!test_bit(MLX5E_RQ_STATE_ENABLED, &rq->state)))1386 if (unlikely(!test_bit(MLX5E_RQ_STATE_ENABLED, &rq->state)))
1387 return 0;1387 return 0;
1388 1388
1389 if (rq->cqd.left)1389 if (rq->cqd.left) {
1390 work_done += mlx5e_decompress_cqes_cont(rq, cqwq, 0, budget);1390 work_done += mlx5e_decompress_cqes_cont(rq, cqwq, 0, budget);
1391 if (rq->cqd.left || work_done >= budget)
1392 goto out;
1393 }
1391 1394
1392 cqe = mlx5_cqwq_get_cqe(cqwq);1395 cqe = mlx5_cqwq_get_cqe(cqwq);
1393 if (!cqe) {1396 if (!cqe) {
drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c+3−12
@@ -35,6 +35,7 @@ · 34 unmodified lines
35#include <linux/udp.h>35#include <linux/udp.h>
36#include <net/udp.h>36#include <net/udp.h>
37#include "en.h"37#include "en.h"
38#include "en/port.h"
38 39
39enum {40enum {
40 MLX5E_ST_LINK_STATE,41 MLX5E_ST_LINK_STATE,
@@ -80,22 +81,12 @@ static int mlx5e_test_link_state(struct mlx5e_priv *priv) · 39 unmodified lines
80 81
81static int mlx5e_test_link_speed(struct mlx5e_priv *priv)82static int mlx5e_test_link_speed(struct mlx5e_priv *priv)
82{83{
83 u32 out[MLX5_ST_SZ_DW(ptys_reg)];84 u32 speed;
84 u32 eth_proto_oper;
85 int i;
86 85
87 if (!netif_carrier_ok(priv->netdev))86 if (!netif_carrier_ok(priv->netdev))
88 return 1;87 return 1;
89 88
90 if (mlx5_query_port_ptys(priv->mdev, out, sizeof(out), MLX5_PTYS_EN, 1))89 return mlx5e_port_linkspeed(priv->mdev, &speed);
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;
99}90}
100 91
101struct mlx5ehdr {92struct 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
52 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_encrypted_bytes) },52 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_encrypted_bytes) },
53 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_ctx) },53 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_ctx) },
54 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_ooo) },54 { 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) },
55 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_resync_bytes) },57 { 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) },
56 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_drop_no_sync_data) },59 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_drop_no_sync_data) },
57 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_drop_bypass_req) },60 { 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) },
60#endif61#endif
61 62
62 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_packets) },63 { 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
288 s->tx_tls_encrypted_bytes += sq_stats->tls_encrypted_bytes;289 s->tx_tls_encrypted_bytes += sq_stats->tls_encrypted_bytes;
289 s->tx_tls_ctx += sq_stats->tls_ctx;290 s->tx_tls_ctx += sq_stats->tls_ctx;
290 s->tx_tls_ooo += sq_stats->tls_ooo;291 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;
291 s->tx_tls_resync_bytes += sq_stats->tls_resync_bytes;294 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;
292 s->tx_tls_drop_no_sync_data += sq_stats->tls_drop_no_sync_data;296 s->tx_tls_drop_no_sync_data += sq_stats->tls_drop_no_sync_data;
293 s->tx_tls_drop_bypass_req += sq_stats->tls_drop_bypass_req;297 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;
296#endif298#endif
297 s->tx_cqes += sq_stats->cqes;299 s->tx_cqes += sq_stats->cqes;
298 }300 }
@@ -1472,10 +1474,12 @@ static const struct counter_desc sq_stats_desc[] = { · 1173 unmodified lines
1472 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_encrypted_bytes) },1474 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_encrypted_bytes) },
1473 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_ctx) },1475 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_ctx) },
1474 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_ooo) },1476 { 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) },
1477 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_dump_packets) },1477 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_dump_packets) },
1478 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_dump_bytes) },1478 { 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) },
1479#endif1483#endif
1480 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_none) },1484 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_none) },
1481 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, stopped) },1485 { 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
129 u64 tx_tls_encrypted_bytes;129 u64 tx_tls_encrypted_bytes;
130 u64 tx_tls_ctx;130 u64 tx_tls_ctx;
131 u64 tx_tls_ooo;131 u64 tx_tls_ooo;
132 u64 tx_tls_dump_packets;
133 u64 tx_tls_dump_bytes;
132 u64 tx_tls_resync_bytes;134 u64 tx_tls_resync_bytes;
135 u64 tx_tls_skip_no_sync_data;
133 u64 tx_tls_drop_no_sync_data;136 u64 tx_tls_drop_no_sync_data;
134 u64 tx_tls_drop_bypass_req;137 u64 tx_tls_drop_bypass_req;
135 u64 tx_tls_dump_packets;
136 u64 tx_tls_dump_bytes;
137#endif138#endif
138 139
139 u64 rx_xsk_packets;140 u64 rx_xsk_packets;
@@ -273,11 +274,12 @@ struct mlx5e_sq_stats { · 133 unmodified lines
273 u64 tls_encrypted_bytes;274 u64 tls_encrypted_bytes;
274 u64 tls_ctx;275 u64 tls_ctx;
275 u64 tls_ooo;276 u64 tls_ooo;
277 u64 tls_dump_packets;
278 u64 tls_dump_bytes;
276 u64 tls_resync_bytes;279 u64 tls_resync_bytes;
280 u64 tls_skip_no_sync_data;
277 u64 tls_drop_no_sync_data;281 u64 tls_drop_no_sync_data;
278 u64 tls_drop_bypass_req;282 u64 tls_drop_bypass_req;
279 u64 tls_dump_packets;
280 u64 tls_dump_bytes;
281#endif283#endif
282 /* less likely accessed in data path */284 /* less likely accessed in data path */
283 u64 csum_none;285 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
1278 mlx5_eswitch_del_vlan_action(esw, attr);1278 mlx5_eswitch_del_vlan_action(esw, attr);
1279 1279
1280 for (out_index = 0; out_index < MLX5_MAX_FLOW_FWD_VPORTS; out_index++)1280 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) {
1282 mlx5e_detach_encap(priv, flow, out_index);1282 mlx5e_detach_encap(priv, flow, out_index);
1283 kfree(attr->parse_attr->tun_info[out_index]);
1284 }
1283 kvfree(attr->parse_attr);1285 kvfree(attr->parse_attr);
1284 1286
1285 if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)1287 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
1559 mlx5_packet_reformat_dealloc(priv->mdev, e->pkt_reformat);1561 mlx5_packet_reformat_dealloc(priv->mdev, e->pkt_reformat);
1560 }1562 }
1561 1563
1564 kfree(e->tun_info);
1562 kfree(e->encap_header);1565 kfree(e->encap_header);
1563 kfree_rcu(e, rcu);1566 kfree_rcu(e, rcu);
1564}1567}
@@ -2972,6 +2975,13 @@ mlx5e_encap_get(struct mlx5e_priv *priv, struct encap_key *key, · 1407 unmodified lines
2972 return NULL;2975 return NULL;
2973}2976}
2974 2977
2978static 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
2975static int mlx5e_attach_encap(struct mlx5e_priv *priv,2985static int mlx5e_attach_encap(struct mlx5e_priv *priv,
2976 struct mlx5e_tc_flow *flow,2986 struct mlx5e_tc_flow *flow,
2977 struct net_device *mirred_dev,2987 struct net_device *mirred_dev,
@@ -3028,13 +3038,15 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv, · 50 unmodified lines
3028 refcount_set(&e->refcnt, 1);3038 refcount_set(&e->refcnt, 1);
3029 init_completion(&e->res_ready);3039 init_completion(&e->res_ready);
3030 3040
3041 tun_info = dup_tun_info(tun_info);
3042 if (!tun_info) {
3043 err = -ENOMEM;
3044 goto out_err_init;
3045 }
3031 e->tun_info = tun_info;3046 e->tun_info = tun_info;
3032 err = mlx5e_tc_tun_init_encap_attr(mirred_dev, priv, e, extack);3047 err = mlx5e_tc_tun_init_encap_attr(mirred_dev, priv, e, extack);
3033 if (err) {3048 if (err)
3034 kfree(e);3049 goto out_err_init;
3035 e = NULL;
3036 goto out_err;
3037 }
3038 3050
3039 INIT_LIST_HEAD(&e->flows);3051 INIT_LIST_HEAD(&e->flows);
3040 hash_add_rcu(esw->offloads.encap_tbl, &e->encap_hlist, hash_key);3052 hash_add_rcu(esw->offloads.encap_tbl, &e->encap_hlist, hash_key);
@@ -3075,6 +3087,12 @@ out_err: · 34 unmodified lines
3075 if (e)3087 if (e)
3076 mlx5e_encap_put(priv, e);3088 mlx5e_encap_put(priv, e);
3077 return err;3089 return err;
3090
3091out_err_init:
3092 mutex_unlock(&esw->offloads.encap_tbl_lock);
3093 kfree(tun_info);
3094 kfree(e);
3095 return err;
3078}3096}
3079 3097
3080static int parse_tc_vlan_action(struct mlx5e_priv *priv,3098static 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
3160 struct mlx5_esw_flow_attr *attr,3178 struct mlx5_esw_flow_attr *attr,
3161 u32 *action)3179 u32 *action)
3162{3180{
3163 int nest_level = vlan_get_encap_level(attr->parse_attr->filter_dev);3181 int nest_level = attr->parse_attr->filter_dev->lower_level;
3164 struct flow_action_entry vlan_act = {3182 struct flow_action_entry vlan_act = {
3165 .id = FLOW_ACTION_VLAN_POP,3183 .id = FLOW_ACTION_VLAN_POP,
3166 };3184 };
@@ -3295,7 +3313,9 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, · 128 unmodified lines
3295 } else if (encap) {3313 } else if (encap) {
3296 parse_attr->mirred_ifindex[attr->out_count] =3314 parse_attr->mirred_ifindex[attr->out_count] =
3297 out_dev->ifindex;3315 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;
3299 encap = false;3319 encap = false;
3300 attr->dests[attr->out_count].flags |=3320 attr->dests[attr->out_count].flags |=
3301 MLX5_ESW_DEST_ENCAP;3321 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
403static void mlx5e_dump_error_cqe(struct mlx5e_txqsq *sq,403static void mlx5e_dump_error_cqe(struct mlx5e_txqsq *sq,
404 struct mlx5_err_cqe *err_cqe)404 struct mlx5_err_cqe *err_cqe)
405{405{
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);
407 410
408 netdev_err(sq->channel->netdev,411 netdev_err(sq->channel->netdev,
409 "Error cqe on cqn 0x%x, ci 0x%x, sqn 0x%x, opcode 0x%x, syndrome 0x%x, vendor syndrome 0x%x\n",412 "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
479 skb = wi->skb;482 skb = wi->skb;
480 483
481 if (unlikely(!skb)) {484 if (unlikely(!skb)) {
482#ifdef CONFIG_MLX5_EN_TLS485 mlx5e_ktls_tx_handle_resync_dump_comp(sq, wi, &dma_fifo_cc);
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
490 sqcc += wi->num_wqebbs;486 sqcc += wi->num_wqebbs;
491 continue;487 continue;
492 }488 }
@@ -542,29 +538,38 @@ void mlx5e_free_txqsq_descs(struct mlx5e_txqsq *sq) · 49 unmodified lines
542{538{
543 struct mlx5e_tx_wqe_info *wi;539 struct mlx5e_tx_wqe_info *wi;
544 struct sk_buff *skb;540 struct sk_buff *skb;
541 u32 dma_fifo_cc;
542 u16 sqcc;
545 u16 ci;543 u16 ci;
546 int i;544 int i;
547 545
548 while (sq->cc != sq->pc) {546 sqcc = sq->cc;
549 ci = mlx5_wq_cyc_ctr2ix(&sq->wq, 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);
550 wi = &sq->db.wqe_info[ci];551 wi = &sq->db.wqe_info[ci];
551 skb = wi->skb;552 skb = wi->skb;
552 553
553 if (!skb) { /* nop */554 if (!skb) {
554 sq->cc++;555 mlx5e_ktls_tx_handle_resync_dump_comp(sq, wi, &dma_fifo_cc);
556 sqcc += wi->num_wqebbs;
555 continue;557 continue;
556 }558 }
557 559
558 for (i = 0; i < wi->num_dma; i++) {560 for (i = 0; i < wi->num_dma; i++) {
559 struct mlx5e_sq_dma *dma =561 struct mlx5e_sq_dma *dma =
560 mlx5e_dma_get(sq, sq->dma_fifo_cc++);562 mlx5e_dma_get(sq, dma_fifo_cc++);
561 563
562 mlx5e_tx_dma_unmap(sq->pdev, dma);564 mlx5e_tx_dma_unmap(sq->pdev, dma);
563 }565 }
564 566
565 dev_kfree_skb_any(skb);567 dev_kfree_skb_any(skb);
566 sq->cc += wi->num_wqebbs;568 sqcc += wi->num_wqebbs;
567 }569 }
570
571 sq->dma_fifo_cc = dma_fifo_cc;
572 sq->cc = sqcc;
568}573}
569 574
570#ifdef CONFIG_MLX5_CORE_IPOIB575#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
285 285
286 mlx5_eswitch_set_rule_source_port(esw, spec, attr);286 mlx5_eswitch_set_rule_source_port(esw, spec, attr);
287 287
288 spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS;
289 if (attr->outer_match_level != MLX5_MATCH_NONE)288 if (attr->outer_match_level != MLX5_MATCH_NONE)
290 spec->match_criteria_enable |= MLX5_MATCH_OUTER_HEADERS;289 spec->match_criteria_enable |= MLX5_MATCH_OUTER_HEADERS;
291 290
@@ -1080,7 +1079,7 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw, int nvports) · 788 unmodified lines
1080 MLX5_CAP_GEN(dev, max_flow_counter_15_0);1079 MLX5_CAP_GEN(dev, max_flow_counter_15_0);
1081 fdb_max = 1 << MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size);1080 fdb_max = 1 << MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size);
1082 1081
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",
1084 MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size),1083 MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size),
1085 max_flow_counter, ESW_OFFLOADS_NUM_GROUPS,1084 max_flow_counter, ESW_OFFLOADS_NUM_GROUPS,
1086 fdb_max);1085 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
177 memset(&src->vlan[1], 0, sizeof(src->vlan[1]));177 memset(&src->vlan[1], 0, sizeof(src->vlan[1]));
178}178}
179 179
180static 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
180bool196bool
181mlx5_eswitch_termtbl_required(struct mlx5_eswitch *esw,197mlx5_eswitch_termtbl_required(struct mlx5_eswitch *esw,
182 struct mlx5_flow_act *flow_act,198 struct mlx5_flow_act *flow_act,
183 struct mlx5_flow_spec *spec)199 struct mlx5_flow_spec *spec)
184{200{
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
190 if (!MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, termination_table))201 if (!MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, termination_table))
191 return false;202 return false;
192 203
193 /* push vlan on RX */204 /* push vlan on RX */
194 return (flow_act->action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH) &&205 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);
196}207}
197 208
198struct mlx5_flow_handle *209struct 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
464 }464 }
465 465
466 err = mlx5_vector2eqn(mdev, smp_processor_id(), &eqn, &irqn);466 err = mlx5_vector2eqn(mdev, smp_processor_id(), &eqn, &irqn);
467 if (err)467 if (err) {
468 kvfree(in);
468 goto err_cqwq;469 goto err_cqwq;
470 }
469 471
470 cqc = MLX5_ADDR_OF(create_cq_in, in, cq_context);472 cqc = MLX5_ADDR_OF(create_cq_in, in, cq_context);
471 MLX5_SET(cqc, cqc, log_cq_size, ilog2(cq_size));473 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
507 MLX5_SET(dest_format_struct, in_dests,507 MLX5_SET(dest_format_struct, in_dests,
508 destination_eswitch_owner_vhca_id,508 destination_eswitch_owner_vhca_id,
509 dst->dest_attr.vport.vhca_id);509 dst->dest_attr.vport.vhca_id);
510 if (extended_dest) {510 if (extended_dest &&
511 dst->dest_attr.vport.pkt_reformat) {
511 MLX5_SET(dest_format_struct, in_dests,512 MLX5_SET(dest_format_struct, in_dests,
512 packet_reformat,513 packet_reformat,
513 !!(dst->dest_attr.vport.flags &514 !!(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
572 return -ENOMEM;572 return -ENOMEM;
573 err = mlx5_crdump_collect(dev, cr_data);573 err = mlx5_crdump_collect(dev, cr_data);
574 if (err)574 if (err)
575 return err;575 goto free_data;
576 576
577 if (priv_ctx) {577 if (priv_ctx) {
578 struct mlx5_fw_reporter_ctx *fw_reporter_ctx = priv_ctx;578 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
1577 break;1577 break;
1578 case DR_ACTION_TYP_MODIFY_HDR:1578 case DR_ACTION_TYP_MODIFY_HDR:
1579 mlx5dr_icm_free_chunk(action->rewrite.chunk);1579 mlx5dr_icm_free_chunk(action->rewrite.chunk);
1580 kfree(action->rewrite.data);
1580 refcount_dec(&action->rewrite.dmn->refcount);1581 refcount_dec(&action->rewrite.dmn->refcount);
1581 break;1582 break;
1582 default:1583 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
1096 if (htbl)1096 if (htbl)
1097 mlx5dr_htbl_put(htbl);1097 mlx5dr_htbl_put(htbl);
1098 1098
1099 kfree(hw_ste_arr);
1100
1099 return 0;1101 return 0;
1100 1102
1101free_ste:1103free_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
1186 if (err)1186 if (err)
1187 goto err_thermal_init;1187 goto err_thermal_init;
1188 1188
1189 if (mlxsw_driver->params_register && !reload)1189 if (mlxsw_driver->params_register)
1190 devlink_params_publish(devlink);1190 devlink_params_publish(devlink);
1191 1191
1192 return 0;1192 return 0;
@@ -1259,7 +1259,7 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core, · 66 unmodified lines
1259 return;1259 return;
1260 }1260 }
1261 1261
1262 if (mlxsw_core->driver->params_unregister && !reload)1262 if (mlxsw_core->driver->params_unregister)
1263 devlink_params_unpublish(devlink);1263 devlink_params_unpublish(devlink);
1264 mlxsw_thermal_fini(mlxsw_core->thermal);1264 mlxsw_thermal_fini(mlxsw_core->thermal);
1265 mlxsw_hwmon_fini(mlxsw_core->hwmon);1265 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
261 port->pvid = vid;261 port->pvid = vid;
262 262
263 /* Untagged egress vlan clasification */263 /* 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 }
265 port->vid = vid;271 port->vid = vid;
272 }
266 273
267 ocelot_vlan_port_apply(ocelot, port);274 ocelot_vlan_port_apply(ocelot, port);
268 275
@@ -934,7 +941,7 @@ end: · 665 unmodified lines
934static int ocelot_vlan_rx_add_vid(struct net_device *dev, __be16 proto,941static int ocelot_vlan_rx_add_vid(struct net_device *dev, __be16 proto,
935 u16 vid)942 u16 vid)
936{943{
937 return ocelot_vlan_vid_add(dev, vid, false, true);944 return ocelot_vlan_vid_add(dev, vid, false, false);
938}945}
939 946
940static int ocelot_vlan_rx_kill_vid(struct net_device *dev, __be16 proto,947static 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
1673 struct ocelot_port *ocelot_port = netdev_priv(dev);1680 struct ocelot_port *ocelot_port = netdev_priv(dev);
1674 int err = 0;1681 int err = 0;
1675 1682
1676 if (!ocelot_netdevice_dev_check(dev))
1677 return 0;
1678
1679 switch (event) {1683 switch (event) {
1680 case NETDEV_CHANGEUPPER:1684 case NETDEV_CHANGEUPPER:
1681 if (netif_is_bridge_master(info->upper_dev)) {1685 if (netif_is_bridge_master(info->upper_dev)) {
@@ -1712,12 +1716,16 @@ static int ocelot_netdevice_event(struct notifier_block *unused, · 30 unmodified lines
1712 struct net_device *dev = netdev_notifier_info_to_dev(ptr);1716 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
1713 int ret = 0;1717 int ret = 0;
1714 1718
1719 if (!ocelot_netdevice_dev_check(dev))
1720 return 0;
1721
1715 if (event == NETDEV_PRECHANGEUPPER &&1722 if (event == NETDEV_PRECHANGEUPPER &&
1716 netif_is_lag_master(info->upper_dev)) {1723 netif_is_lag_master(info->upper_dev)) {
1717 struct netdev_lag_upper_info *lag_upper_info = info->upper_info;1724 struct netdev_lag_upper_info *lag_upper_info = info->upper_info;
1718 struct netlink_ext_ack *extack;1725 struct netlink_ext_ack *extack;
1719 1726
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) {
1721 extack = netdev_notifier_info_to_extack(&info->info);1729 extack = netdev_notifier_info_to_extack(&info->info);
1722 NL_SET_ERR_MSG_MOD(extack, "LAG device using unsupported Tx type");1730 NL_SET_ERR_MSG_MOD(extack, "LAG device using unsupported Tx type");
1723 1731
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
523#define ocelot_write_rix(ocelot, val, reg, ri) __ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri))523#define ocelot_write_rix(ocelot, val, reg, ri) __ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri))
524#define ocelot_write(ocelot, val, reg) __ocelot_write_ix(ocelot, val, reg, 0)524#define ocelot_write(ocelot, val, reg) __ocelot_write_ix(ocelot, val, reg, 0)
525 525
526void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 reg, u32 mask,526void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, u32 reg,
527 u32 offset);527 u32 offset);
528#define ocelot_rmw_ix(ocelot, val, m, reg, gi, ri) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))528#define ocelot_rmw_ix(ocelot, val, m, reg, gi, ri) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
529#define ocelot_rmw_gix(ocelot, val, m, reg, gi) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi))529#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
299 nfp_port_free(repr->port);299 nfp_port_free(repr->port);
300}300}
301 301
302static struct lock_class_key nfp_repr_netdev_xmit_lock_key;
303static struct lock_class_key nfp_repr_netdev_addr_lock_key;
304
305static 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
312static 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
318int nfp_repr_init(struct nfp_app *app, struct net_device *netdev,302int nfp_repr_init(struct nfp_app *app, struct net_device *netdev,
319 u32 cmsg_port_id, struct nfp_port *port,303 u32 cmsg_port_id, struct nfp_port *port,
320 struct net_device *pf_netdev)304 struct net_device *pf_netdev)
@@ -324,8 +308,6 @@ int nfp_repr_init(struct nfp_app *app, struct net_device *netdev, · 3 unmodified lines
324 u32 repr_cap = nn->tlv_caps.repr_cap;308 u32 repr_cap = nn->tlv_caps.repr_cap;
325 int err;309 int err;
326 310
327 nfp_repr_set_lockdep_class(netdev);
328
329 repr->port = port;311 repr->port = port;
330 repr->dst = metadata_dst_alloc(0, METADATA_HW_PORT_MUX, GFP_KERNEL);312 repr->dst = metadata_dst_alloc(0, METADATA_HW_PORT_MUX, GFP_KERNEL);
331 if (!repr->dst)313 if (!repr->dst)
drivers/net/ethernet/pensando/ionic/ionic_lif.c+2−0
@@ -1,6 +1,8 @@
1// SPDX-License-Identifier: GPL-2.01// SPDX-License-Identifier: GPL-2.0
2/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */2/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
3 3
4#include <linux/printk.h>
5#include <linux/dynamic_debug.h>
4#include <linux/netdevice.h>6#include <linux/netdevice.h>
5#include <linux/etherdevice.h>7#include <linux/etherdevice.h>
6#include <linux/rtnetlink.h>8#include <linux/rtnetlink.h>
drivers/net/ethernet/pensando/ionic/ionic_main.c+2−0
@@ -1,6 +1,8 @@
1// SPDX-License-Identifier: GPL-2.01// SPDX-License-Identifier: GPL-2.0
2/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */2/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
3 3
4#include <linux/printk.h>
5#include <linux/dynamic_debug.h>
4#include <linux/module.h>6#include <linux/module.h>
5#include <linux/netdevice.h>7#include <linux/netdevice.h>
6#include <linux/utsname.h>8#include <linux/utsname.h>
drivers/net/ethernet/qlogic/qed/qed_main.c+21−6
@@ -67,10 +67,9 @@ · 66 unmodified lines
67#define QED_ROCE_QPS (8192)67#define QED_ROCE_QPS (8192)
68#define QED_ROCE_DPIS (8)68#define QED_ROCE_DPIS (8)
69#define QED_RDMA_SRQS QED_ROCE_QPS69#define QED_RDMA_SRQS QED_ROCE_QPS
70#define QED_NVM_CFG_SET_FLAGS 0xE
71#define QED_NVM_CFG_SET_PF_FLAGS 0x1E
72#define QED_NVM_CFG_GET_FLAGS 0xA70#define QED_NVM_CFG_GET_FLAGS 0xA
73#define QED_NVM_CFG_GET_PF_FLAGS 0x1A71#define QED_NVM_CFG_GET_PF_FLAGS 0x1A
72#define QED_NVM_CFG_MAX_ATTRS 50
74 73
75static char version[] =74static char version[] =
76 "QLogic FastLinQ 4xxxx Core Module qed " DRV_MODULE_VERSION "\n";75 "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
2255{2254{
2256 struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev);2255 struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev);
2257 u8 entity_id, len, buf[32];2256 u8 entity_id, len, buf[32];
2257 bool need_nvm_init = true;
2258 struct qed_ptt *ptt;2258 struct qed_ptt *ptt;
2259 u16 cfg_id, count;2259 u16 cfg_id, count;
2260 int rc = 0, i;2260 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
2271 2271
2272 DP_VERBOSE(cdev, NETIF_MSG_DRV,2272 DP_VERBOSE(cdev, NETIF_MSG_DRV,
2273 "Read config ids: num_attrs = %0d\n", count);2273 "Read config ids: num_attrs = %0d\n", count);
2274 /* NVM CFG ID attributes */2274 /* NVM CFG ID attributes. Start loop index from 1 to avoid additional
2275 for (i = 0; i < count; i++) {2275 * arithmetic operations in the implementation.
2276 */
2277 for (i = 1; i <= count; i++) {
2276 cfg_id = *((u16 *)*data);2278 cfg_id = *((u16 *)*data);
2277 *data += 2;2279 *data += 2;
2278 entity_id = **data;2280 entity_id = **data;
@@ -2282,8 +2284,21 @@ static int qed_nvm_flash_cfg_write(struct qed_dev *cdev, const u8 **data) · 3 unmodified lines
2282 memcpy(buf, *data, len);2284 memcpy(buf, *data, len);
2283 *data += len;2285 *data += len;
2284 2286
2285 flags = entity_id ? QED_NVM_CFG_SET_PF_FLAGS :2287 flags = 0;
2286 QED_NVM_CFG_SET_FLAGS;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;
2287 2302
2288 DP_VERBOSE(cdev, NETIF_MSG_DRV,2303 DP_VERBOSE(cdev, NETIF_MSG_DRV,
2289 "cfg_id = %d entity = %d len = %d\n", cfg_id,2304 "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
2005 (qed_iov_validate_active_txq(p_hwfn, vf))) {2005 (qed_iov_validate_active_txq(p_hwfn, vf))) {
2006 vf->b_malicious = true;2006 vf->b_malicious = true;
2007 DP_NOTICE(p_hwfn,2007 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",
2009 vf->abs_vf_id);2009 vf->abs_vf_id);
2010 status = PFVF_STATUS_MALICIOUS;2010 status = PFVF_STATUS_MALICIOUS;
2011 goto out;2011 goto out;
drivers/net/ethernet/qlogic/qede/qede_main.c+10−2
@@ -1208,8 +1208,16 @@ enum qede_remove_mode { · 1207 unmodified lines
1208static void __qede_remove(struct pci_dev *pdev, enum qede_remove_mode mode)1208static void __qede_remove(struct pci_dev *pdev, enum qede_remove_mode mode)
1209{1209{
1210 struct net_device *ndev = pci_get_drvdata(pdev);1210 struct net_device *ndev = pci_get_drvdata(pdev);
1211 struct qede_dev *edev = netdev_priv(ndev);1211 struct qede_dev *edev;
1212 struct qed_dev *cdev = edev->cdev;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;
1213 1221
1214 DP_INFO(edev, "Starting qede_remove\n");1222 DP_INFO(edev, "Starting qede_remove\n");
1215 1223
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
57 if (port->nr_rmnet_devs)57 if (port->nr_rmnet_devs)
58 return -EINVAL;58 return -EINVAL;
59 59
60 kfree(port);
61
62 netdev_rx_handler_unregister(real_dev);60 netdev_rx_handler_unregister(real_dev);
63 61
62 kfree(port);
63
64 /* release reference on real_dev */64 /* release reference on real_dev */
65 dev_put(real_dev);65 dev_put(real_dev);
66 66
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
916 916
917static int r8168g_mdio_read(struct rtl8169_private *tp, int reg)917static int r8168g_mdio_read(struct rtl8169_private *tp, int reg)
918{918{
919 if (reg == 0x1f)
920 return tp->ocp_base == OCP_STD_PHY_BASE ? 0 : tp->ocp_base >> 4;
921
919 if (tp->ocp_base != OCP_STD_PHY_BASE)922 if (tp->ocp_base != OCP_STD_PHY_BASE)
920 reg -= 0x10;923 reg -= 0x10;
921 924
@@ -1029,6 +1032,10 @@ static int r8168dp_2_mdio_read(struct rtl8169_private *tp, int reg) · 107 unmodified lines
1029{1032{
1030 int value;1033 int value;
1031 1034
1035 /* Work around issue with chip reporting wrong PHY ID */
1036 if (reg == MII_PHYSID2)
1037 return 0xc912;
1038
1032 r8168dp_2_mdio_start(tp);1039 r8168dp_2_mdio_start(tp);
1033 1040
1034 value = r8169_mdio_read(tp, reg);1041 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
432 * bits used depends on the hardware configuration432 * bits used depends on the hardware configuration
433 * selected at core configuration time.433 * selected at core configuration time.
434 */434 */
435 int bit_nr = bitrev32(~crc32_le(~0, ha->addr,435 u32 bit_nr = bitrev32(~crc32_le(~0, ha->addr,
436 ETH_ALEN)) >> (32 - mcbitslog2);436 ETH_ALEN)) >> (32 - mcbitslog2);
437 /* The most significant bit determines the register to437 /* The most significant bit determines the register to
438 * use (H/L) while the other 5 bits determine the bit438 * 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
224 writel(low_credit, ioaddr + XGMAC_MTL_TCx_LOCREDIT(queue));224 writel(low_credit, ioaddr + XGMAC_MTL_TCx_LOCREDIT(queue));
225 225
226 value = readl(ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(queue));226 value = readl(ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(queue));
227 value &= ~XGMAC_TSA;
227 value |= XGMAC_CC | XGMAC_CBS;228 value |= XGMAC_CC | XGMAC_CBS;
228 writel(value, ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(queue));229 writel(value, ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(queue));
229}230}
@@ -463,7 +464,7 @@ static void dwxgmac2_set_filter(struct mac_device_info *hw, · 233 unmodified lines
463 value |= XGMAC_FILTER_HMC;464 value |= XGMAC_FILTER_HMC;
464 465
465 netdev_for_each_mc_addr(ha, dev) {466 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)) >>
467 (32 - mcbitslog2));468 (32 - mcbitslog2));
468 mc_filter[nr >> 5] |= (1 << (nr & 0x1F));469 mc_filter[nr >> 5] |= (1 << (nr & 0x1F));
469 }470 }
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
288 288
289static int dwxgmac2_get_rx_header_len(struct dma_desc *p, unsigned int *len)289static int dwxgmac2_get_rx_header_len(struct dma_desc *p, unsigned int *len)
290{290{
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;
292 return 0;293 return 0;
293}294}
294 295
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
369 dma_cap->eee = (hw_cap & XGMAC_HWFEAT_EEESEL) >> 13;369 dma_cap->eee = (hw_cap & XGMAC_HWFEAT_EEESEL) >> 13;
370 dma_cap->atime_stamp = (hw_cap & XGMAC_HWFEAT_TSSEL) >> 12;370 dma_cap->atime_stamp = (hw_cap & XGMAC_HWFEAT_TSSEL) >> 12;
371 dma_cap->av = (hw_cap & XGMAC_HWFEAT_AVSEL) >> 11;371 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);
373 dma_cap->arpoffsel = (hw_cap & XGMAC_HWFEAT_ARPOFFSEL) >> 9;373 dma_cap->arpoffsel = (hw_cap & XGMAC_HWFEAT_ARPOFFSEL) >> 9;
374 dma_cap->rmon = (hw_cap & XGMAC_HWFEAT_MMCSEL) >> 8;374 dma_cap->rmon = (hw_cap & XGMAC_HWFEAT_MMCSEL) >> 8;
375 dma_cap->pmt_magic_frame = (hw_cap & XGMAC_HWFEAT_MGKSEL) >> 7;375 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
470static void dwxgmac2_qmode(void __iomem *ioaddr, u32 channel, u8 qmode)470static void dwxgmac2_qmode(void __iomem *ioaddr, u32 channel, u8 qmode)
471{471{
472 u32 value = readl(ioaddr + XGMAC_MTL_TXQ_OPMODE(channel));472 u32 value = readl(ioaddr + XGMAC_MTL_TXQ_OPMODE(channel));
473 u32 flow = readl(ioaddr + XGMAC_RX_FLOW_CTRL);
473 474
474 value &= ~XGMAC_TXQEN;475 value &= ~XGMAC_TXQEN;
475 if (qmode != MTL_QUEUE_AVB) {476 if (qmode != MTL_QUEUE_AVB) {
@@ -477,6 +478,7 @@ static void dwxgmac2_qmode(void __iomem *ioaddr, u32 channel, u8 qmode) · 1 unmodified line
477 writel(0, ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(channel));478 writel(0, ioaddr + XGMAC_MTL_TCx_ETS_CONTROL(channel));
478 } else {479 } else {
479 value |= 0x1 << XGMAC_TXQEN_SHIFT;480 value |= 0x1 << XGMAC_TXQEN_SHIFT;
481 writel(flow & (~XGMAC_RFE), ioaddr + XGMAC_RX_FLOW_CTRL);
480 }482 }
481 483
482 writel(value, ioaddr + XGMAC_MTL_TXQ_OPMODE(channel));484 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
176#define MMC_XGMAC_RX_PKT_SMD_ERR 0x22c176#define MMC_XGMAC_RX_PKT_SMD_ERR 0x22c
177#define MMC_XGMAC_RX_PKT_ASSEMBLY_OK 0x230177#define MMC_XGMAC_RX_PKT_ASSEMBLY_OK 0x230
178#define MMC_XGMAC_RX_FPE_FRAG 0x234178#define MMC_XGMAC_RX_FPE_FRAG 0x234
179#define MMC_XGMAC_RX_IPC_INTR_MASK 0x25c
179 180
180static void dwmac_mmc_ctrl(void __iomem *mmcaddr, unsigned int mode)181static void dwmac_mmc_ctrl(void __iomem *mmcaddr, unsigned int mode)
181{182{
@@ -333,8 +334,9 @@ static void dwxgmac_mmc_ctrl(void __iomem *mmcaddr, unsigned int mode) · 151 unmodified lines
333 334
334static void dwxgmac_mmc_intr_all_mask(void __iomem *mmcaddr)335static void dwxgmac_mmc_intr_all_mask(void __iomem *mmcaddr)
335{336{
336 writel(MMC_DEFAULT_MASK, mmcaddr + MMC_RX_INTR_MASK);337 writel(0x0, mmcaddr + MMC_RX_INTR_MASK);
337 writel(MMC_DEFAULT_MASK, mmcaddr + MMC_TX_INTR_MASK);338 writel(0x0, mmcaddr + MMC_TX_INTR_MASK);
339 writel(MMC_DEFAULT_MASK, mmcaddr + MMC_XGMAC_RX_IPC_INTR_MASK);
338}340}
339 341
340static void dwxgmac_read_mmc_reg(void __iomem *addr, u32 reg, u32 *dest)342static 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
2995 } else {2995 } else {
2996 stmmac_set_desc_addr(priv, first, des);2996 stmmac_set_desc_addr(priv, first, des);
2997 tmp_pay_len = pay_len;2997 tmp_pay_len = pay_len;
2998 des += proto_hdr_len;
2999 pay_len = 0;
2998 }3000 }
2999 3001
3000 stmmac_tso_allocator(priv, des, tmp_pay_len, (nfrags == 0), queue);3002 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
3022 /* Only the last descriptor gets to point to the skb. */3024 /* Only the last descriptor gets to point to the skb. */
3023 tx_q->tx_skbuff[tx_q->cur_tx] = skb;3025 tx_q->tx_skbuff[tx_q->cur_tx] = skb;
3024 3026
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
3025 /* We've used all descriptors we need for this skb, however,3040 /* We've used all descriptors we need for this skb, however,
3026 * advance cur_tx so that it references a fresh descriptor.3041 * advance cur_tx so that it references a fresh descriptor.
3027 * ndo_start_xmit will fill this descriptor the next time it's3042 * 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
3039 priv->xstats.tx_tso_frames++;3054 priv->xstats.tx_tso_frames++;
3040 priv->xstats.tx_tso_nfrags += nfrags;3055 priv->xstats.tx_tso_nfrags += nfrags;
3041 3056
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
3055 if (priv->sarc_type)3057 if (priv->sarc_type)
3056 stmmac_set_desc_sarc(priv, first, priv->sarc_type);3058 stmmac_set_desc_sarc(priv, first, priv->sarc_type);
3057 3059
@@ -3223,6 +3225,27 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 165 unmodified lines
3223 /* Only the last descriptor gets to point to the skb. */3225 /* Only the last descriptor gets to point to the skb. */
3224 tx_q->tx_skbuff[entry] = skb;3226 tx_q->tx_skbuff[entry] = skb;
3225 3227
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
3226 /* We've used all descriptors we need for this skb, however,3249 /* We've used all descriptors we need for this skb, however,
3227 * advance cur_tx so that it references a fresh descriptor.3250 * advance cur_tx so that it references a fresh descriptor.
3228 * ndo_start_xmit will fill this descriptor the next time it's3251 * 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
3258 3281
3259 dev->stats.tx_bytes += skb->len;3282 dev->stats.tx_bytes += skb->len;
3260 3283
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
3278 if (priv->sarc_type)3284 if (priv->sarc_type)
3279 stmmac_set_desc_sarc(priv, first, priv->sarc_type);3285 stmmac_set_desc_sarc(priv, first, priv->sarc_type);
3280 3286
@@ -3505,8 +3511,6 @@ read_again: · 224 unmodified lines
3505 if (unlikely(status & dma_own))3511 if (unlikely(status & dma_own))
3506 break;3512 break;
3507 3513
3508 count++;
3509
3510 rx_q->cur_rx = STMMAC_GET_ENTRY(rx_q->cur_rx, DMA_RX_SIZE);3514 rx_q->cur_rx = STMMAC_GET_ENTRY(rx_q->cur_rx, DMA_RX_SIZE);
3511 next_entry = rx_q->cur_rx;3515 next_entry = rx_q->cur_rx;
3512 3516
@@ -3533,6 +3537,7 @@ read_again: · 20 unmodified lines
3533 goto read_again;3537 goto read_again;
3534 if (unlikely(error)) {3538 if (unlikely(error)) {
3535 dev_kfree_skb(skb);3539 dev_kfree_skb(skb);
3540 count++;
3536 continue;3541 continue;
3537 }3542 }
3538 3543
@@ -3572,6 +3577,7 @@ read_again: · 33 unmodified lines
3572 skb = napi_alloc_skb(&ch->rx_napi, len);3577 skb = napi_alloc_skb(&ch->rx_napi, len);
3573 if (!skb) {3578 if (!skb) {
3574 priv->dev->stats.rx_dropped++;3579 priv->dev->stats.rx_dropped++;
3580 count++;
3575 continue;3581 continue;
3576 }3582 }
3577 3583
@@ -3637,6 +3643,7 @@ read_again: · 59 unmodified lines
3637 3643
3638 priv->dev->stats.rx_packets++;3644 priv->dev->stats.rx_packets++;
3639 priv->dev->stats.rx_bytes += len;3645 priv->dev->stats.rx_bytes += len;
3646 count++;
3640 }3647 }
3641 3648
3642 if (status & rx_not_ls) {3649 if (status & rx_not_ls) {
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c+94−40
@@ -6,7 +6,9 @@ · 5 unmodified lines
6 * Author: Jose Abreu <joabreu@synopsys.com>6 * Author: Jose Abreu <joabreu@synopsys.com>
7 */7 */
8 8
9#include <linux/bitrev.h>
9#include <linux/completion.h>10#include <linux/completion.h>
11#include <linux/crc32.h>
10#include <linux/ethtool.h>12#include <linux/ethtool.h>
11#include <linux/ip.h>13#include <linux/ip.h>
12#include <linux/phy.h>14#include <linux/phy.h>
@@ -485,12 +487,48 @@ static int stmmac_filter_check(struct stmmac_priv *priv) · 472 unmodified lines
485 return -EOPNOTSUPP;487 return -EOPNOTSUPP;
486}488}
487 489
490static 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
512static 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
488static int stmmac_test_hfilt(struct stmmac_priv *priv)526static int stmmac_test_hfilt(struct stmmac_priv *priv)
489{527{
490 unsigned char gd_addr[ETH_ALEN] = {0x01, 0xee, 0xdd, 0xcc, 0xbb, 0xaa};528 unsigned char gd_addr[ETH_ALEN] = {0xf1, 0xee, 0xdd, 0xcc, 0xbb, 0xaa};
491 unsigned char bd_addr[ETH_ALEN] = {0x01, 0x01, 0x02, 0x03, 0x04, 0x05};529 unsigned char bd_addr[ETH_ALEN] = {0xf1, 0xff, 0xff, 0xff, 0xff, 0xff};
492 struct stmmac_packet_attrs attr = { };530 struct stmmac_packet_attrs attr = { };
493 int ret;531 int ret, tries = 256;
494 532
495 ret = stmmac_filter_check(priv);533 ret = stmmac_filter_check(priv);
496 if (ret)534 if (ret)
@@ -499,6 +537,16 @@ static int stmmac_test_hfilt(struct stmmac_priv *priv) · 2 unmodified lines
499 if (netdev_mc_count(priv->dev) >= priv->hw->multicast_filter_bins)537 if (netdev_mc_count(priv->dev) >= priv->hw->multicast_filter_bins)
500 return -EOPNOTSUPP;538 return -EOPNOTSUPP;
501 539
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
502 ret = dev_mc_add(priv->dev, gd_addr);550 ret = dev_mc_add(priv->dev, gd_addr);
503 if (ret)551 if (ret)
504 return ret;552 return ret;
@@ -523,13 +571,25 @@ cleanup: · 18 unmodified lines
523 571
524static int stmmac_test_pfilt(struct stmmac_priv *priv)572static int stmmac_test_pfilt(struct stmmac_priv *priv)
525{573{
526 unsigned char gd_addr[ETH_ALEN] = {0x00, 0x01, 0x44, 0x55, 0x66, 0x77};574 unsigned char gd_addr[ETH_ALEN] = {0xf0, 0x01, 0x44, 0x55, 0x66, 0x77};
527 unsigned char bd_addr[ETH_ALEN] = {0x08, 0x00, 0x22, 0x33, 0x44, 0x55};575 unsigned char bd_addr[ETH_ALEN] = {0xf0, 0xff, 0xff, 0xff, 0xff, 0xff};
528 struct stmmac_packet_attrs attr = { };576 struct stmmac_packet_attrs attr = { };
529 int ret;577 int ret, tries = 256;
530 578
531 if (stmmac_filter_check(priv))579 if (stmmac_filter_check(priv))
532 return -EOPNOTSUPP;580 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;
533 593
534 ret = dev_uc_add(priv->dev, gd_addr);594 ret = dev_uc_add(priv->dev, gd_addr);
535 if (ret)595 if (ret)
@@ -553,39 +613,31 @@ cleanup: · 17 unmodified lines
553 return ret;613 return ret;
554}614}
555 615
556static int stmmac_dummy_sync(struct net_device *netdev, const u8 *addr)
557{
558 return 0;
559}
560
561static 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
570static int stmmac_test_mcfilt(struct stmmac_priv *priv)616static int stmmac_test_mcfilt(struct stmmac_priv *priv)
571{617{
572 unsigned char uc_addr[ETH_ALEN] = {0x00, 0x01, 0x44, 0x55, 0x66, 0x77};618 unsigned char uc_addr[ETH_ALEN] = {0xf0, 0xff, 0xff, 0xff, 0xff, 0xff};
573 unsigned char mc_addr[ETH_ALEN] = {0x01, 0x01, 0x44, 0x55, 0x66, 0x77};619 unsigned char mc_addr[ETH_ALEN] = {0xf1, 0xff, 0xff, 0xff, 0xff, 0xff};
574 struct stmmac_packet_attrs attr = { };620 struct stmmac_packet_attrs attr = { };
575 int ret;621 int ret, tries = 256;
576 622
577 if (stmmac_filter_check(priv))623 if (stmmac_filter_check(priv))
578 return -EOPNOTSUPP;624 return -EOPNOTSUPP;
579 if (!priv->hw->multicast_filter_bins)625 if (netdev_uc_count(priv->dev) >= priv->hw->unicast_filter_entries)
580 return -EOPNOTSUPP;626 return -EOPNOTSUPP;
581 627
582 /* Remove all MC addresses */628 while (--tries) {
583 __dev_mc_unsync(priv->dev, NULL);629 /* We only need to check the mc_addr for collisions */
584 stmmac_test_set_rx_mode(priv->dev);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;
585 637
586 ret = dev_uc_add(priv->dev, uc_addr);638 ret = dev_uc_add(priv->dev, uc_addr);
587 if (ret)639 if (ret)
588 goto cleanup;640 return ret;
589 641
590 attr.dst = uc_addr;642 attr.dst = uc_addr;
591 643
@@ -602,30 +654,34 @@ static int stmmac_test_mcfilt(struct stmmac_priv *priv) · 10 unmodified lines
602 654
603cleanup:655cleanup:
604 dev_uc_del(priv->dev, uc_addr);656 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);
607 return ret;657 return ret;
608}658}
609 659
610static int stmmac_test_ucfilt(struct stmmac_priv *priv)660static int stmmac_test_ucfilt(struct stmmac_priv *priv)
611{661{
612 unsigned char uc_addr[ETH_ALEN] = {0x00, 0x01, 0x44, 0x55, 0x66, 0x77};662 unsigned char uc_addr[ETH_ALEN] = {0xf0, 0xff, 0xff, 0xff, 0xff, 0xff};
613 unsigned char mc_addr[ETH_ALEN] = {0x01, 0x01, 0x44, 0x55, 0x66, 0x77};663 unsigned char mc_addr[ETH_ALEN] = {0xf1, 0xff, 0xff, 0xff, 0xff, 0xff};
614 struct stmmac_packet_attrs attr = { };664 struct stmmac_packet_attrs attr = { };
615 int ret;665 int ret, tries = 256;
616 666
617 if (stmmac_filter_check(priv))667 if (stmmac_filter_check(priv))
618 return -EOPNOTSUPP;668 return -EOPNOTSUPP;
619 if (!priv->hw->multicast_filter_bins)669 if (netdev_mc_count(priv->dev) >= priv->hw->multicast_filter_bins)
620 return -EOPNOTSUPP;670 return -EOPNOTSUPP;
621 671
622 /* Remove all UC addresses */672 while (--tries) {
623 __dev_uc_unsync(priv->dev, NULL);673 /* We only need to check the uc_addr for collisions */
624 stmmac_test_set_rx_mode(priv->dev);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;
625 681
626 ret = dev_mc_add(priv->dev, mc_addr);682 ret = dev_mc_add(priv->dev, mc_addr);
627 if (ret)683 if (ret)
628 goto cleanup;684 return ret;
629 685
630 attr.dst = mc_addr;686 attr.dst = mc_addr;
631 687
@@ -642,8 +698,6 @@ static int stmmac_test_ucfilt(struct stmmac_priv *priv) · 10 unmodified lines
642 698
643cleanup:699cleanup:
644 dev_mc_del(priv->dev, mc_addr);700 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);
647 return ret;701 return ret;
648}702}
649 703
drivers/net/fjes/fjes_main.c+14−1
@@ -1237,8 +1237,17 @@ static int fjes_probe(struct platform_device *plat_dev) · 1236 unmodified lines
1237 adapter->open_guard = false;1237 adapter->open_guard = false;
1238 1238
1239 adapter->txrx_wq = alloc_workqueue(DRV_NAME "/txrx", WQ_MEM_RECLAIM, 0);1239 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
1240 adapter->control_wq = alloc_workqueue(DRV_NAME "/control",1245 adapter->control_wq = alloc_workqueue(DRV_NAME "/control",
1241 WQ_MEM_RECLAIM, 0);1246 WQ_MEM_RECLAIM, 0);
1247 if (unlikely(!adapter->control_wq)) {
1248 err = -ENOMEM;
1249 goto err_free_txrx_wq;
1250 }
1242 1251
1243 INIT_WORK(&adapter->tx_stall_task, fjes_tx_stall_task);1252 INIT_WORK(&adapter->tx_stall_task, fjes_tx_stall_task);
1244 INIT_WORK(&adapter->raise_intr_rxdata_task,1253 INIT_WORK(&adapter->raise_intr_rxdata_task,
@@ -1255,7 +1264,7 @@ static int fjes_probe(struct platform_device *plat_dev) · 10 unmodified lines
1255 hw->hw_res.irq = platform_get_irq(plat_dev, 0);1264 hw->hw_res.irq = platform_get_irq(plat_dev, 0);
1256 err = fjes_hw_init(&adapter->hw);1265 err = fjes_hw_init(&adapter->hw);
1257 if (err)1266 if (err)
1258 goto err_free_netdev;1267 goto err_free_control_wq;
1259 1268
1260 /* setup MAC address (02:00:00:00:00:[epid])*/1269 /* setup MAC address (02:00:00:00:00:[epid])*/
1261 netdev->dev_addr[0] = 2;1270 netdev->dev_addr[0] = 2;
@@ -1277,6 +1286,10 @@ static int fjes_probe(struct platform_device *plat_dev) · 15 unmodified lines
1277 1286
1278err_hw_exit:1287err_hw_exit:
1279 fjes_hw_exit(&adapter->hw);1288 fjes_hw_exit(&adapter->hw);
1289err_free_control_wq:
1290 destroy_workqueue(adapter->control_wq);
1291err_free_txrx_wq:
1292 destroy_workqueue(adapter->txrx_wq);
1280err_free_netdev:1293err_free_netdev:
1281 free_netdev(netdev);1294 free_netdev(netdev);
1282err_out:1295err_out:
drivers/net/hamradio/bpqether.c+0−22
@@ -107,27 +107,6 @@ struct bpqdev { · 106 unmodified lines
107 107
108static LIST_HEAD(bpq_devices);108static LIST_HEAD(bpq_devices);
109 109
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 */
115static struct lock_class_key bpq_netdev_xmit_lock_key;
116static struct lock_class_key bpq_netdev_addr_lock_key;
117
118static 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
125static 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
131/* ------------------------------------------------------------------------ */110/* ------------------------------------------------------------------------ */
132 111
133 112
@@ -498,7 +477,6 @@ static int bpq_new_device(struct net_device *edev) · 364 unmodified lines
498 err = register_netdevice(ndev);477 err = register_netdevice(ndev);
499 if (err)478 if (err)
500 goto error;479 goto error;
501 bpq_set_lockdep_class(ndev);
502 480
503 /* List protected by RTNL */481 /* List protected by RTNL */
504 list_add_rcu(&bpq->bpq_list, &bpq_devices);482 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
982 if (netif_running(ndev)) {982 if (netif_running(ndev)) {
983 ret = rndis_filter_open(nvdev);983 ret = rndis_filter_open(nvdev);
984 if (ret)984 if (ret)
985 return ret;985 goto err;
986 986
987 rdev = nvdev->extension;987 rdev = nvdev->extension;
988 if (!rdev->link_state)988 if (!rdev->link_state)
@@ -990,6 +990,13 @@ static int netvsc_attach(struct net_device *ndev, · 1 unmodified line
990 }990 }
991 991
992 return 0;992 return 0;
993
994err:
995 netif_device_detach(ndev);
996
997 rndis_filter_device_remove(hdev, nvdev);
998
999 return ret;
993}1000}
994 1001
995static int netvsc_set_channels(struct net_device *net,1002static int netvsc_set_channels(struct net_device *net,
@@ -1807,8 +1814,10 @@ static int netvsc_set_features(struct net_device *ndev, · 811 unmodified lines
1807 1814
1808 ret = rndis_filter_set_offload_params(ndev, nvdev, &offloads);1815 ret = rndis_filter_set_offload_params(ndev, nvdev, &offloads);
1809 1816
1810 if (ret)1817 if (ret) {
1811 features ^= NETIF_F_LRO;1818 features ^= NETIF_F_LRO;
1819 ndev->features = features;
1820 }
1812 1821
1813syncvf:1822syncvf:
1814 if (!vf_netdev)1823 if (!vf_netdev)
@@ -2335,8 +2344,6 @@ static int netvsc_probe(struct hv_device *dev, · 520 unmodified lines
2335 NETIF_F_HW_VLAN_CTAG_RX;2344 NETIF_F_HW_VLAN_CTAG_RX;
2336 net->vlan_features = net->features;2345 net->vlan_features = net->features;
2337 2346
2338 netdev_lockdep_set_classes(net);
2339
2340 /* MTU range: 68 - 1500 or 65521 */2347 /* MTU range: 68 - 1500 or 65521 */
2341 net->min_mtu = NETVSC_MTU_MIN;2348 net->min_mtu = NETVSC_MTU_MIN;
2342 if (nvdev->nvsp_version >= NVSP_PROTOCOL_VERSION_2)2349 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
131 dev->gso_max_segs = phy_dev->gso_max_segs;131 dev->gso_max_segs = phy_dev->gso_max_segs;
132 dev->hard_header_len = phy_dev->hard_header_len;132 dev->hard_header_len = phy_dev->hard_header_len;
133 133
134 netdev_lockdep_set_classes(dev);
135
136 ipvlan->pcpu_stats = netdev_alloc_pcpu_stats(struct ipvl_pcpu_stats);134 ipvlan->pcpu_stats = netdev_alloc_pcpu_stats(struct ipvl_pcpu_stats);
137 if (!ipvlan->pcpu_stats)135 if (!ipvlan->pcpu_stats)
138 return -ENOMEM;136 return -ENOMEM;
drivers/net/macsec.c+0−18
@@ -267,7 +267,6 @@ struct macsec_dev { · 266 unmodified lines
267 struct pcpu_secy_stats __percpu *stats;267 struct pcpu_secy_stats __percpu *stats;
268 struct list_head secys;268 struct list_head secys;
269 struct gro_cells gro_cells;269 struct gro_cells gro_cells;
270 unsigned int nest_level;
271};270};
272 271
273/**272/**
@@ -2750,7 +2749,6 @@ static netdev_tx_t macsec_start_xmit(struct sk_buff *skb, · 2476 unmodified lines
2750 2749
2751#define MACSEC_FEATURES \2750#define MACSEC_FEATURES \
2752 (NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST)2751 (NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST)
2753static struct lock_class_key macsec_netdev_addr_lock_key;
2754 2752
2755static int macsec_dev_init(struct net_device *dev)2753static int macsec_dev_init(struct net_device *dev)
2756{2754{
@@ -2958,11 +2956,6 @@ static int macsec_get_iflink(const struct net_device *dev) · 201 unmodified lines
2958 return macsec_priv(dev)->real_dev->ifindex;2956 return macsec_priv(dev)->real_dev->ifindex;
2959}2957}
2960 2958
2961static int macsec_get_nest_level(struct net_device *dev)
2962{
2963 return macsec_priv(dev)->nest_level;
2964}
2965
2966static const struct net_device_ops macsec_netdev_ops = {2959static const struct net_device_ops macsec_netdev_ops = {
2967 .ndo_init = macsec_dev_init,2960 .ndo_init = macsec_dev_init,
2968 .ndo_uninit = macsec_dev_uninit,2961 .ndo_uninit = macsec_dev_uninit,
@@ -2976,7 +2969,6 @@ static const struct net_device_ops macsec_netdev_ops = { · 7 unmodified lines
2976 .ndo_start_xmit = macsec_start_xmit,2969 .ndo_start_xmit = macsec_start_xmit,
2977 .ndo_get_stats64 = macsec_get_stats64,2970 .ndo_get_stats64 = macsec_get_stats64,
2978 .ndo_get_iflink = macsec_get_iflink,2971 .ndo_get_iflink = macsec_get_iflink,
2979 .ndo_get_lock_subclass = macsec_get_nest_level,
2980};2972};
2981 2973
2982static const struct device_type macsec_type = {2974static 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
3001static void macsec_free_netdev(struct net_device *dev)2993static void macsec_free_netdev(struct net_device *dev)
3002{2994{
3003 struct macsec_dev *macsec = macsec_priv(dev);2995 struct macsec_dev *macsec = macsec_priv(dev);
3004 struct net_device *real_dev = macsec->real_dev;
3005 2996
3006 free_percpu(macsec->stats);2997 free_percpu(macsec->stats);
3007 free_percpu(macsec->secy.tx_sc.stats);2998 free_percpu(macsec->secy.tx_sc.stats);
3008 2999
3009 dev_put(real_dev);
3010}3000}
3011 3001
3012static void macsec_setup(struct net_device *dev)3002static 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
3261 if (err < 0)3251 if (err < 0)
3262 return err;3252 return err;
3263 3253
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
3272 err = netdev_upper_dev_link(real_dev, dev, extack);3254 err = netdev_upper_dev_link(real_dev, dev, extack);
3273 if (err < 0)3255 if (err < 0)
3274 goto unregister;3256 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
852 * "super class" of normal network devices; split their locks off into a852 * "super class" of normal network devices; split their locks off into a
853 * separate class since they always nest.853 * separate class since they always nest.
854 */854 */
855static struct lock_class_key macvlan_netdev_addr_lock_key;
856
857#define ALWAYS_ON_OFFLOADS \855#define ALWAYS_ON_OFFLOADS \
858 (NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE | \856 (NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE | \
859 NETIF_F_GSO_ROBUST | NETIF_F_GSO_ENCAP_ALL)857 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
869#define MACVLAN_STATE_MASK \867#define MACVLAN_STATE_MASK \
870 ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))868 ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))
871 869
872static int macvlan_get_nest_level(struct net_device *dev)
873{
874 return ((struct macvlan_dev *)netdev_priv(dev))->nest_level;
875}
876
877static 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
885static int macvlan_init(struct net_device *dev)870static int macvlan_init(struct net_device *dev)
886{871{
887 struct macvlan_dev *vlan = netdev_priv(dev);872 struct macvlan_dev *vlan = netdev_priv(dev);
@@ -900,8 +885,6 @@ static int macvlan_init(struct net_device *dev) · 12 unmodified lines
900 dev->gso_max_segs = lowerdev->gso_max_segs;885 dev->gso_max_segs = lowerdev->gso_max_segs;
901 dev->hard_header_len = lowerdev->hard_header_len;886 dev->hard_header_len = lowerdev->hard_header_len;
902 887
903 macvlan_set_lockdep_class(dev);
904
905 vlan->pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats);888 vlan->pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats);
906 if (!vlan->pcpu_stats)889 if (!vlan->pcpu_stats)
907 return -ENOMEM;890 return -ENOMEM;
@@ -1161,7 +1144,6 @@ static const struct net_device_ops macvlan_netdev_ops = { · 253 unmodified lines
1161 .ndo_fdb_add = macvlan_fdb_add,1144 .ndo_fdb_add = macvlan_fdb_add,
1162 .ndo_fdb_del = macvlan_fdb_del,1145 .ndo_fdb_del = macvlan_fdb_del,
1163 .ndo_fdb_dump = ndo_dflt_fdb_dump,1146 .ndo_fdb_dump = ndo_dflt_fdb_dump,
1164 .ndo_get_lock_subclass = macvlan_get_nest_level,
1165#ifdef CONFIG_NET_POLL_CONTROLLER1147#ifdef CONFIG_NET_POLL_CONTROLLER
1166 .ndo_poll_controller = macvlan_dev_poll_controller,1148 .ndo_poll_controller = macvlan_dev_poll_controller,
1167 .ndo_netpoll_setup = macvlan_dev_netpoll_setup,1149 .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
1445 vlan->dev = dev;1427 vlan->dev = dev;
1446 vlan->port = port;1428 vlan->port = port;
1447 vlan->set_features = MACVLAN_FEATURES;1429 vlan->set_features = MACVLAN_FEATURES;
1448 vlan->nest_level = dev_get_nest_level(lowerdev) + 1;
1449 1430
1450 vlan->mode = MACVLAN_MODE_VEPA;1431 vlan->mode = MACVLAN_MODE_VEPA;
1451 if (data && data[IFLA_MACVLAN_MODE])1432 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
806{806{
807 struct nsim_dev_port *nsim_dev_port, *tmp;807 struct nsim_dev_port *nsim_dev_port, *tmp;
808 808
809 mutex_lock(&nsim_dev->port_list_lock);
809 list_for_each_entry_safe(nsim_dev_port, tmp,810 list_for_each_entry_safe(nsim_dev_port, tmp,
810 &nsim_dev->port_list, list)811 &nsim_dev->port_list, list)
811 __nsim_dev_port_del(nsim_dev_port);812 __nsim_dev_port_del(nsim_dev_port);
813 mutex_unlock(&nsim_dev->port_list_lock);
812}814}
813 815
814int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev)816int 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
822 return PTR_ERR(nsim_dev);824 return PTR_ERR(nsim_dev);
823 dev_set_drvdata(&nsim_bus_dev->dev, nsim_dev);825 dev_set_drvdata(&nsim_bus_dev->dev, nsim_dev);
824 826
827 mutex_lock(&nsim_dev->port_list_lock);
825 for (i = 0; i < nsim_bus_dev->port_count; i++) {828 for (i = 0; i < nsim_bus_dev->port_count; i++) {
826 err = __nsim_dev_port_add(nsim_dev, i);829 err = __nsim_dev_port_add(nsim_dev, i);
827 if (err)830 if (err)
828 goto err_port_del_all;831 goto err_port_del_all;
829 }832 }
833 mutex_unlock(&nsim_dev->port_list_lock);
830 return 0;834 return 0;
831 835
832err_port_del_all:836err_port_del_all:
837 mutex_unlock(&nsim_dev->port_list_lock);
833 nsim_dev_port_del_all(nsim_dev);838 nsim_dev_port_del_all(nsim_dev);
834 nsim_dev_destroy(nsim_dev);839 nsim_dev_destroy(nsim_dev);
835 return err;840 return err;
drivers/net/phy/phylink.c+16−0
@@ -87,8 +87,24 @@ struct phylink { · 86 unmodified lines
87 phylink_printk(KERN_WARNING, pl, fmt, ##__VA_ARGS__)87 phylink_printk(KERN_WARNING, pl, fmt, ##__VA_ARGS__)
88#define phylink_info(pl, fmt, ...) \88#define phylink_info(pl, fmt, ...) \
89 phylink_printk(KERN_INFO, pl, fmt, ##__VA_ARGS__)89 phylink_printk(KERN_INFO, pl, fmt, ##__VA_ARGS__)
90#if defined(CONFIG_DYNAMIC_DEBUG)
90#define phylink_dbg(pl, fmt, ...) \91#define phylink_dbg(pl, fmt, ...) \
92do { \
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, ...) \
91 phylink_printk(KERN_DEBUG, pl, fmt, ##__VA_ARGS__)100 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
92 108
93/**109/**
94 * phylink_set_port_modes() - set the port type modes in the ethtool mask110 * 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
327 .name = "SMSC LAN8740",327 .name = "SMSC LAN8740",
328 328
329 /* PHY_BASIC_FEATURES */329 /* PHY_BASIC_FEATURES */
330 .flags = PHY_RST_AFTER_CLK_EN,
330 331
331 .probe = smsc_phy_probe,332 .probe = smsc_phy_probe,
332 333
drivers/net/ppp/ppp_generic.c+0−2
@@ -1324,8 +1324,6 @@ static int ppp_dev_init(struct net_device *dev) · 1323 unmodified lines
1324{1324{
1325 struct ppp *ppp;1325 struct ppp *ppp;
1326 1326
1327 netdev_lockdep_set_classes(dev);
1328
1329 ppp = netdev_priv(dev);1327 ppp = netdev_priv(dev);
1330 /* Let the netdevice take a reference on the ppp file. This ensures1328 /* Let the netdevice take a reference on the ppp file. This ensures
1331 * that ppp_destroy_interface() won't run before the device gets1329 * 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
1615 int err;1615 int err;
1616 1616
1617 team->dev = dev;1617 team->dev = dev;
1618 mutex_init(&team->lock);
1619 team_set_no_mode(team);1618 team_set_no_mode(team);
1620 1619
1621 team->pcpu_stats = netdev_alloc_pcpu_stats(struct team_pcpu_stats);1620 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
1642 goto err_options_register;1641 goto err_options_register;
1643 netif_carrier_off(dev);1642 netif_carrier_off(dev);
1644 1643
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);
1646 1646
1647 return 0;1647 return 0;
1648 1648
@@ -1673,6 +1673,7 @@ static void team_uninit(struct net_device *dev) · 24 unmodified lines
1673 team_queue_override_fini(team);1673 team_queue_override_fini(team);
1674 mutex_unlock(&team->lock);1674 mutex_unlock(&team->lock);
1675 netdev_change_features(dev);1675 netdev_change_features(dev);
1676 lockdep_unregister_key(&team->team_lock_key);
1676}1677}
1677 1678
1678static void team_destructor(struct net_device *dev)1679static 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
1976 err = team_port_del(team, port_dev);1977 err = team_port_del(team, port_dev);
1977 mutex_unlock(&team->lock);1978 mutex_unlock(&team->lock);
1978 1979
1979 if (!err)1980 if (err)
1980 netdev_change_features(dev);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);
1981 1989
1982 return err;1990 return err;
1983}1991}
drivers/net/usb/cdc_ether.c+7−0
@@ -787,6 +787,13 @@ static const struct usb_device_id products[] = { · 786 unmodified lines
787 .driver_info = 0,787 .driver_info = 0,
788},788},
789 789
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
790/* NVIDIA Tegra USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */797/* NVIDIA Tegra USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */
791{798{
792 USB_DEVICE_AND_INTERFACE_INFO(NVIDIA_VENDOR_ID, 0x09ff, USB_CLASS_COMM,799 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
578 /* read current mtu value from device */578 /* read current mtu value from device */
579 err = usbnet_read_cmd(dev, USB_CDC_GET_MAX_DATAGRAM_SIZE,579 err = usbnet_read_cmd(dev, USB_CDC_GET_MAX_DATAGRAM_SIZE,
580 USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE,580 USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE,
581 0, iface_no, &max_datagram_size, 2);581 0, iface_no, &max_datagram_size, sizeof(max_datagram_size));
582 if (err < 0) {582 if (err < sizeof(max_datagram_size)) {
583 dev_dbg(&dev->intf->dev, "GET_MAX_DATAGRAM_SIZE failed\n");583 dev_dbg(&dev->intf->dev, "GET_MAX_DATAGRAM_SIZE failed\n");
584 goto out;584 goto out;
585 }585 }
@@ -590,7 +590,7 @@ static void cdc_ncm_set_dgram_size(struct usbnet *dev, int new_size) · 4 unmodified lines
590 max_datagram_size = cpu_to_le16(ctx->max_datagram_size);590 max_datagram_size = cpu_to_le16(ctx->max_datagram_size);
591 err = usbnet_write_cmd(dev, USB_CDC_SET_MAX_DATAGRAM_SIZE,591 err = usbnet_write_cmd(dev, USB_CDC_SET_MAX_DATAGRAM_SIZE,
592 USB_TYPE_CLASS | USB_DIR_OUT | USB_RECIP_INTERFACE,592 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));
594 if (err < 0)594 if (err < 0)
595 dev_dbg(&dev->intf->dev, "SET_MAX_DATAGRAM_SIZE failed\n");595 dev_dbg(&dev->intf->dev, "SET_MAX_DATAGRAM_SIZE failed\n");
596 596
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
1264 netif_dbg(dev, link, dev->net, "PHY INTR: 0x%08x\n", intdata);1264 netif_dbg(dev, link, dev->net, "PHY INTR: 0x%08x\n", intdata);
1265 lan78xx_defer_kevent(dev, EVENT_LINK_RESET);1265 lan78xx_defer_kevent(dev, EVENT_LINK_RESET);
1266 1266
1267 if (dev->domain_data.phyirq > 0)1267 if (dev->domain_data.phyirq > 0) {
1268 local_irq_disable();
1268 generic_handle_irq(dev->domain_data.phyirq);1269 generic_handle_irq(dev->domain_data.phyirq);
1270 local_irq_enable();
1271 }
1269 } else1272 } else
1270 netdev_warn(dev->net,1273 netdev_warn(dev->net,
1271 "unexpected interrupt: 0x%08x\n", intdata);1274 "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
1362 {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */1362 {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */
1363 {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */1363 {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */
1364 {QMI_FIXED_INTF(0x413c, 0x81d7, 0)}, /* Dell Wireless 5821e */1364 {QMI_FIXED_INTF(0x413c, 0x81d7, 0)}, /* Dell Wireless 5821e */
1365 {QMI_FIXED_INTF(0x413c, 0x81e0, 0)}, /* Dell Wireless 5821e with eSIM support*/
1365 {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */1366 {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
1366 {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */1367 {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */
1367 {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */1368 {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
5755 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7205)},5755 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7205)},
5756 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x720c)},5756 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x720c)},
5757 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7214)},5757 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7214)},
5758 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0xa387)},
5758 {REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041)},5759 {REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041)},
5759 {REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff)},5760 {REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff)},
5760 {REALTEK_USB_DEVICE(VENDOR_ID_TPLINK, 0x0601)},5761 {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
865 865
866 /* similarly, oper state is irrelevant; set to up to avoid confusion */866 /* similarly, oper state is irrelevant; set to up to avoid confusion */
867 dev->operstate = IF_OPER_UP;867 dev->operstate = IF_OPER_UP;
868 netdev_lockdep_set_classes(dev);
869 return 0;868 return 0;
870 869
871out_rth:870out_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
2487 vni = tunnel_id_to_key32(info->key.tun_id);2487 vni = tunnel_id_to_key32(info->key.tun_id);
2488 ifindex = 0;2488 ifindex = 0;
2489 dst_cache = &info->dst_cache;2489 dst_cache = &info->dst_cache;
2490 if (info->options_len &&2490 if (info->key.tun_flags & TUNNEL_VXLAN_OPT) {
2491 info->key.tun_flags & TUNNEL_VXLAN_OPT)2491 if (info->options_len < sizeof(*md))
2492 goto drop;
2492 md = ip_tunnel_info_opts(info);2493 md = ip_tunnel_info_opts(info);
2494 }
2493 ttl = info->key.ttl;2495 ttl = info->key.ttl;
2494 tos = info->key.tos;2496 tos = info->key.tos;
2495 label = info->key.label;2497 label = info->key.label;
@@ -3566,10 +3568,13 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev, · 1070 unmodified lines
3566{3568{
3567 struct vxlan_net *vn = net_generic(net, vxlan_net_id);3569 struct vxlan_net *vn = net_generic(net, vxlan_net_id);
3568 struct vxlan_dev *vxlan = netdev_priv(dev);3570 struct vxlan_dev *vxlan = netdev_priv(dev);
3571 struct net_device *remote_dev = NULL;
3569 struct vxlan_fdb *f = NULL;3572 struct vxlan_fdb *f = NULL;
3570 bool unregister = false;3573 bool unregister = false;
3574 struct vxlan_rdst *dst;
3571 int err;3575 int err;
3572 3576
3577 dst = &vxlan->default_dst;
3573 err = vxlan_dev_configure(net, dev, conf, false, extack);3578 err = vxlan_dev_configure(net, dev, conf, false, extack);
3574 if (err)3579 if (err)
3575 return err;3580 return err;
@@ -3577,14 +3582,14 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev, · 1 unmodified line
3577 dev->ethtool_ops = &vxlan_ethtool_ops;3582 dev->ethtool_ops = &vxlan_ethtool_ops;
3578 3583
3579 /* create an fdb entry for a valid default destination */3584 /* 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)) {
3581 err = vxlan_fdb_create(vxlan, all_zeros_mac,3586 err = vxlan_fdb_create(vxlan, all_zeros_mac,
3582 &vxlan->default_dst.remote_ip,3587 &dst->remote_ip,
3583 NUD_REACHABLE | NUD_PERMANENT,3588 NUD_REACHABLE | NUD_PERMANENT,
3584 vxlan->cfg.dst_port,3589 vxlan->cfg.dst_port,
3585 vxlan->default_dst.remote_vni,3590 dst->remote_vni,
3586 vxlan->default_dst.remote_vni,3591 dst->remote_vni,
3587 vxlan->default_dst.remote_ifindex,3592 dst->remote_ifindex,
3588 NTF_SELF, &f);3593 NTF_SELF, &f);
3589 if (err)3594 if (err)
3590 return err;3595 return err;
@@ -3595,26 +3600,41 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev, · 4 unmodified lines
3595 goto errout;3600 goto errout;
3596 unregister = true;3601 unregister = true;
3597 3602
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
3598 err = rtnl_configure_link(dev, NULL);3613 err = rtnl_configure_link(dev, NULL);
3599 if (err)3614 if (err)
3600 goto errout;3615 goto unlink;
3601 3616
3602 if (f) {3617 if (f) {
3603 vxlan_fdb_insert(vxlan, all_zeros_mac,3618 vxlan_fdb_insert(vxlan, all_zeros_mac, dst->remote_vni, f);
3604 vxlan->default_dst.remote_vni, f);
3605 3619
3606 /* notify default fdb entry */3620 /* notify default fdb entry */
3607 err = vxlan_fdb_notify(vxlan, f, first_remote_rtnl(f),3621 err = vxlan_fdb_notify(vxlan, f, first_remote_rtnl(f),
3608 RTM_NEWNEIGH, true, extack);3622 RTM_NEWNEIGH, true, extack);
3609 if (err) {3623 if (err) {
3610 vxlan_fdb_destroy(vxlan, f, false, false);3624 vxlan_fdb_destroy(vxlan, f, false, false);
3625 if (remote_dev)
3626 netdev_upper_dev_unlink(remote_dev, dev);
3611 goto unregister;3627 goto unregister;
3612 }3628 }
3613 }3629 }
3614 3630
3615 list_add(&vxlan->next, &vn->vxlan_list);3631 list_add(&vxlan->next, &vn->vxlan_list);
3632 if (remote_dev)
3633 dst->remote_dev = remote_dev;
3616 return 0;3634 return 0;
3617 3635unlink:
3636 if (remote_dev)
3637 netdev_upper_dev_unlink(remote_dev, dev);
3618errout:3638errout:
3619 /* unregister_netdevice() destroys the default FDB entry with deletion3639 /* unregister_netdevice() destroys the default FDB entry with deletion
3620 * notification. But the addition notification was not sent yet, so3640 * 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
3932 struct netlink_ext_ack *extack)3952 struct netlink_ext_ack *extack)
3933{3953{
3934 struct vxlan_dev *vxlan = netdev_priv(dev);3954 struct vxlan_dev *vxlan = netdev_priv(dev);
3935 struct vxlan_rdst *dst = &vxlan->default_dst;
3936 struct net_device *lowerdev;3955 struct net_device *lowerdev;
3937 struct vxlan_config conf;3956 struct vxlan_config conf;
3957 struct vxlan_rdst *dst;
3938 int err;3958 int err;
3939 3959
3960 dst = &vxlan->default_dst;
3940 err = vxlan_nl2conf(tb, data, dev, &conf, true, extack);3961 err = vxlan_nl2conf(tb, data, dev, &conf, true, extack);
3941 if (err)3962 if (err)
3942 return err;3963 return err;
@@ -3946,6 +3967,14 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[], · 3 unmodified lines
3946 if (err)3967 if (err)
3947 return err;3968 return err;
3948 3969
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
3949 /* handle default dst entry */3978 /* handle default dst entry */
3950 if (!vxlan_addr_equal(&conf.remote_ip, &dst->remote_ip)) {3979 if (!vxlan_addr_equal(&conf.remote_ip, &dst->remote_ip)) {
3951 u32 hash_index = fdb_head_index(vxlan, all_zeros_mac, conf.vni);3980 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
3962 NTF_SELF, true, extack);3991 NTF_SELF, true, extack);
3963 if (err) {3992 if (err) {
3964 spin_unlock_bh(&vxlan->hash_lock[hash_index]);3993 spin_unlock_bh(&vxlan->hash_lock[hash_index]);
3994 netdev_adjacent_change_abort(dst->remote_dev,
3995 lowerdev, dev);
3965 return err;3996 return err;
3966 }3997 }
3967 }3998 }
@@ -3979,6 +4010,11 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[], · 11 unmodified lines
3979 if (conf.age_interval != vxlan->cfg.age_interval)4010 if (conf.age_interval != vxlan->cfg.age_interval)
3980 mod_timer(&vxlan->age_timer, jiffies);4011 mod_timer(&vxlan->age_timer, jiffies);
3981 4012
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 }
3982 vxlan_config_apply(dev, &conf, lowerdev, vxlan->net, true);4018 vxlan_config_apply(dev, &conf, lowerdev, vxlan->net, true);
3983 return 0;4019 return 0;
3984}4020}
@@ -3991,6 +4027,8 @@ static void vxlan_dellink(struct net_device *dev, struct list_head *head) · 6 unmodified lines
3991 4027
3992 list_del(&vxlan->next);4028 list_del(&vxlan->next);
3993 unregister_netdevice_queue(dev, head);4029 unregister_netdevice_queue(dev, head);
4030 if (vxlan->default_dst.remote_dev)
4031 netdev_upper_dev_unlink(vxlan->default_dst.remote_dev, dev);
3994}4032}
3995 4033
3996static size_t vxlan_get_size(const struct net_device *dev)4034static 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
127 "%d\n", result);127 "%d\n", result);
128 result = 0;128 result = 0;
129error_cmd:129error_cmd:
130 kfree(cmd);
131 kfree_skb(ack_skb);130 kfree_skb(ack_skb);
132error_msg_to_dev:131error_msg_to_dev:
133error_alloc:132error_alloc:
134 d_fnend(4, dev, "(wimax_dev %p state %d) = %d\n",133 d_fnend(4, dev, "(wimax_dev %p state %d) = %d\n",
135 wimax_dev, state, result);134 wimax_dev, state, result);
135 kfree(cmd);
136 return result;136 return result;
137}137}
138 138
drivers/net/wireless/intel/iwlwifi/fw/api/scan.h+20−2
@@ -520,7 +520,7 @@ struct iwl_scan_dwell { · 519 unmodified lines
520} __packed;520} __packed;
521 521
522/**522/**
523 * struct iwl_scan_config523 * struct iwl_scan_config_v1
524 * @flags: enum scan_config_flags524 * @flags: enum scan_config_flags
525 * @tx_chains: valid_tx antenna - ANT_* definitions525 * @tx_chains: valid_tx antenna - ANT_* definitions
526 * @rx_chains: valid_rx antenna - ANT_* definitions526 * @rx_chains: valid_rx antenna - ANT_* definitions
@@ -552,7 +552,7 @@ struct iwl_scan_config_v1 { · 25 unmodified lines
552#define SCAN_LB_LMAC_IDX 0552#define SCAN_LB_LMAC_IDX 0
553#define SCAN_HB_LMAC_IDX 1553#define SCAN_HB_LMAC_IDX 1
554 554
555struct iwl_scan_config {555struct iwl_scan_config_v2 {
556 __le32 flags;556 __le32 flags;
557 __le32 tx_chains;557 __le32 tx_chains;
558 __le32 rx_chains;558 __le32 rx_chains;
@@ -564,6 +564,24 @@ struct iwl_scan_config { · 5 unmodified lines
564 u8 bcast_sta_id;564 u8 bcast_sta_id;
565 u8 channel_flags;565 u8 channel_flags;
566 u8 channel_array[];566 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 */
578struct 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;
567} __packed; /* SCAN_CONFIG_DB_CMD_API_S_3 */585} __packed; /* SCAN_CONFIG_DB_CMD_API_S_3 */
568 586
569/**587/**
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
288 * STA_CONTEXT_DOT11AX_API_S288 * STA_CONTEXT_DOT11AX_API_S
289 * @IWL_UCODE_TLV_CAPA_SAR_TABLE_VER: This ucode supports different sar289 * @IWL_UCODE_TLV_CAPA_SAR_TABLE_VER: This ucode supports different sar
290 * version tables.290 * version tables.
291 * @IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG: This ucode supports v3 of
292 * SCAN_CONFIG_DB_CMD_API_S.
291 *293 *
292 * @NUM_IWL_UCODE_TLV_API: number of bits used294 * @NUM_IWL_UCODE_TLV_API: number of bits used
293 */295 */
@@ -321,6 +323,7 @@ enum iwl_ucode_tlv_api { · 27 unmodified lines
321 IWL_UCODE_TLV_API_WOWLAN_TCP_SYN_WAKE = (__force iwl_ucode_tlv_api_t)53,323 IWL_UCODE_TLV_API_WOWLAN_TCP_SYN_WAKE = (__force iwl_ucode_tlv_api_t)53,
322 IWL_UCODE_TLV_API_FTM_RTT_ACCURACY = (__force iwl_ucode_tlv_api_t)54,324 IWL_UCODE_TLV_API_FTM_RTT_ACCURACY = (__force iwl_ucode_tlv_api_t)54,
323 IWL_UCODE_TLV_API_SAR_TABLE_VER = (__force iwl_ucode_tlv_api_t)55,325 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,
324 IWL_UCODE_TLV_API_ADWELL_HB_DEF_N_AP = (__force iwl_ucode_tlv_api_t)57,327 IWL_UCODE_TLV_API_ADWELL_HB_DEF_N_AP = (__force iwl_ucode_tlv_api_t)57,
325 IWL_UCODE_TLV_API_SCAN_EXT_CHAN_VER = (__force iwl_ucode_tlv_api_t)58,328 IWL_UCODE_TLV_API_SCAN_EXT_CHAN_VER = (__force iwl_ucode_tlv_api_t)58,
326 329
drivers/net/wireless/intel/iwlwifi/iwl-csr.h+1−0
@@ -279,6 +279,7 @@ · 278 unmodified lines
279 * Indicates MAC is entering a power-saving sleep power-down.279 * Indicates MAC is entering a power-saving sleep power-down.
280 * Not a good time to access device-internal resources.280 * Not a good time to access device-internal resources.
281 */281 */
282#define CSR_GP_CNTRL_REG_FLAG_INIT_DONE (0x00000004)
282#define CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010)283#define CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010)
283#define CSR_GP_CNTRL_REG_FLAG_XTAL_ON (0x00000400)284#define CSR_GP_CNTRL_REG_FLAG_XTAL_ON (0x00000400)
284 285
drivers/net/wireless/intel/iwlwifi/iwl-prph.h+5−0
@@ -449,6 +449,11 @@ enum { · 448 unmodified lines
449#define PERSISTENCE_BIT BIT(12)449#define PERSISTENCE_BIT BIT(12)
450#define PREG_WFPM_ACCESS BIT(12)450#define PREG_WFPM_ACCESS BIT(12)
451 451
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
452#define UREG_DOORBELL_TO_ISR6 0xA05C04457#define UREG_DOORBELL_TO_ISR6 0xA05C04
453#define UREG_DOORBELL_TO_ISR6_NMI_BIT BIT(0)458#define UREG_DOORBELL_TO_ISR6_NMI_BIT BIT(0)
454#define UREG_DOORBELL_TO_ISR6_SUSPEND BIT(18)459#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
1405 IWL_UCODE_TLV_API_SCAN_EXT_CHAN_VER);1405 IWL_UCODE_TLV_API_SCAN_EXT_CHAN_VER);
1406}1406}
1407 1407
1408static 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
1408static inline bool iwl_mvm_has_new_rx_stats_api(struct iwl_mvm *mvm)1414static inline bool iwl_mvm_has_new_rx_stats_api(struct iwl_mvm *mvm)
1409{1415{
1410 return fw_has_api(&mvm->fw->ucode_capa,1416 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
1137 iwl_mvm_fill_channels(mvm, cfg->channel_array, max_channels);1137 iwl_mvm_fill_channels(mvm, cfg->channel_array, max_channels);
1138}1138}
1139 1139
1140static void iwl_mvm_fill_scan_config(struct iwl_mvm *mvm, void *config,1140static void iwl_mvm_fill_scan_config_v2(struct iwl_mvm *mvm, void *config,
1141 u32 flags, u8 channel_flags,1141 u32 flags, u8 channel_flags,
1142 u32 max_channels)1142 u32 max_channels)
1143{1143{
1144 struct iwl_scan_config *cfg = config;1144 struct iwl_scan_config_v2 *cfg = config;
1145 1145
1146 cfg->flags = cpu_to_le32(flags);1146 cfg->flags = cpu_to_le32(flags);
1147 cfg->tx_chains = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm));1147 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
1185 iwl_mvm_fill_channels(mvm, cfg->channel_array, max_channels);1185 iwl_mvm_fill_channels(mvm, cfg->channel_array, max_channels);
1186}1186}
1187 1187
1188int iwl_mvm_config_scan(struct iwl_mvm *mvm)1188static int iwl_mvm_legacy_config_scan(struct iwl_mvm *mvm)
1189{1189{
1190 void *cfg;1190 void *cfg;
1191 int ret, cmd_size;1191 int ret, cmd_size;
@@ -1217,7 +1217,7 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm) · 25 unmodified lines
1217 }1217 }
1218 1218
1219 if (iwl_mvm_cdb_scan_api(mvm))1219 if (iwl_mvm_cdb_scan_api(mvm))
1220 cmd_size = sizeof(struct iwl_scan_config);1220 cmd_size = sizeof(struct iwl_scan_config_v2);
1221 else1221 else
1222 cmd_size = sizeof(struct iwl_scan_config_v1);1222 cmd_size = sizeof(struct iwl_scan_config_v1);
1223 cmd_size += num_channels;1223 cmd_size += num_channels;
@@ -1254,8 +1254,8 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm) · 30 unmodified lines
1254 flags |= (iwl_mvm_is_scan_fragmented(hb_type)) ?1254 flags |= (iwl_mvm_is_scan_fragmented(hb_type)) ?
1255 SCAN_CONFIG_FLAG_SET_LMAC2_FRAGMENTED :1255 SCAN_CONFIG_FLAG_SET_LMAC2_FRAGMENTED :
1256 SCAN_CONFIG_FLAG_CLEAR_LMAC2_FRAGMENTED;1256 SCAN_CONFIG_FLAG_CLEAR_LMAC2_FRAGMENTED;
1257 iwl_mvm_fill_scan_config(mvm, cfg, flags, channel_flags,1257 iwl_mvm_fill_scan_config_v2(mvm, cfg, flags, channel_flags,
1258 num_channels);1258 num_channels);
1259 } else {1259 } else {
1260 iwl_mvm_fill_scan_config_v1(mvm, cfg, flags, channel_flags,1260 iwl_mvm_fill_scan_config_v1(mvm, cfg, flags, channel_flags,
1261 num_channels);1261 num_channels);
@@ -1277,6 +1277,30 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm) · 15 unmodified lines
1277 return ret;1277 return ret;
1278}1278}
1279 1279
1280int 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
1280static int iwl_mvm_scan_uid_by_status(struct iwl_mvm *mvm, int status)1304static int iwl_mvm_scan_uid_by_status(struct iwl_mvm *mvm, int status)
1281{1305{
1282 int i;1306 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
1482 mvm_sta->sta_id, i);1482 mvm_sta->sta_id, i);
1483 txq_id = iwl_mvm_tvqm_enable_txq(mvm, mvm_sta->sta_id,1483 txq_id = iwl_mvm_tvqm_enable_txq(mvm, mvm_sta->sta_id,
1484 i, wdg);1484 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;
1485 tid_data->txq_id = txq_id;1492 tid_data->txq_id = txq_id;
1486 1493
1487 /*1494 /*
@@ -1950,30 +1957,73 @@ void iwl_mvm_dealloc_int_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *sta) · 462 unmodified lines
1950 sta->sta_id = IWL_MVM_INVALID_STA;1957 sta->sta_id = IWL_MVM_INVALID_STA;
1951}1958}
1952 1959
1953static void iwl_mvm_enable_aux_snif_queue(struct iwl_mvm *mvm, u16 *queue,1960static void iwl_mvm_enable_aux_snif_queue(struct iwl_mvm *mvm, u16 queue,
1954 u8 sta_id, u8 fifo)1961 u8 sta_id, u8 fifo)
1955{1962{
1956 unsigned int wdg_timeout = iwlmvm_mod_params.tfd_q_hang_detect ?1963 unsigned int wdg_timeout = iwlmvm_mod_params.tfd_q_hang_detect ?
1957 mvm->trans->trans_cfg->base_params->wd_timeout :1964 mvm->trans->trans_cfg->base_params->wd_timeout :
1958 IWL_WATCHDOG_DISABLED;1965 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
1979static 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}
1959 1990
1991static 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 */
1960 if (iwl_mvm_has_new_tx_api(mvm)) {2014 if (iwl_mvm_has_new_tx_api(mvm)) {
1961 int tvqm_queue =2015 int txq;
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 };
1974 2016
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;
1976 }2024 }
2025
2026 return 0;
1977}2027}
1978 2028
1979int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm)2029int 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
1989 if (ret)2039 if (ret)
1990 return ret;2040 return ret;
1991 2041
1992 /* Map Aux queue to fifo - needs to happen before adding Aux station */2042 ret = iwl_mvm_add_int_sta_with_queue(mvm, MAC_INDEX_AUX, 0,
1993 if (!iwl_mvm_has_new_tx_api(mvm))2043 &mvm->aux_sta, &mvm->aux_queue,
1994 iwl_mvm_enable_aux_snif_queue(mvm, &mvm->aux_queue,2044 IWL_MVM_TX_FIFO_MCAST);
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);
2000 if (ret) {2045 if (ret) {
2001 iwl_mvm_dealloc_int_sta(mvm, &mvm->aux_sta);2046 iwl_mvm_dealloc_int_sta(mvm, &mvm->aux_sta);
2002 return ret;2047 return ret;
2003 }2048 }
2004 2049
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
2014 return 0;2050 return 0;
2015}2051}
2016 2052
2017int iwl_mvm_add_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)2053int iwl_mvm_add_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
2018{2054{
2019 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);2055 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
2020 int ret;
2021 2056
2022 lockdep_assert_held(&mvm->mutex);2057 lockdep_assert_held(&mvm->mutex);
2023 2058
2024 /* Map snif queue to fifo - must happen before adding snif station */2059 return iwl_mvm_add_int_sta_with_queue(mvm, mvmvif->id, mvmvif->color,
2025 if (!iwl_mvm_has_new_tx_api(mvm))2060 &mvm->snif_sta, &mvm->snif_queue,
2026 iwl_mvm_enable_aux_snif_queue(mvm, &mvm->snif_queue,
2027 mvm->snif_sta.sta_id,
2028 IWL_MVM_TX_FIFO_BE);2061 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;
2045}2062}
2046 2063
2047int iwl_mvm_rm_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)2064int 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
2133 queue = iwl_mvm_tvqm_enable_txq(mvm, bsta->sta_id,2150 queue = iwl_mvm_tvqm_enable_txq(mvm, bsta->sta_id,
2134 IWL_MAX_TID_COUNT,2151 IWL_MAX_TID_COUNT,
2135 wdg_timeout);2152 wdg_timeout);
2153 if (queue < 0) {
2154 iwl_mvm_rm_sta_common(mvm, bsta->sta_id);
2155 return queue;
2156 }
2136 2157
2137 if (vif->type == NL80211_IFTYPE_AP ||2158 if (vif->type == NL80211_IFTYPE_AP ||
2138 vif->type == NL80211_IFTYPE_ADHOC)2159 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
2307 }2328 }
2308 ret = iwl_mvm_add_int_sta_common(mvm, msta, maddr,2329 ret = iwl_mvm_add_int_sta_common(mvm, msta, maddr,
2309 mvmvif->id, mvmvif->color);2330 mvmvif->id, mvmvif->color);
2310 if (ret) {2331 if (ret)
2311 iwl_mvm_dealloc_int_sta(mvm, msta);2332 goto err;
2312 return ret;
2313 }
2314 2333
2315 /*2334 /*
2316 * Enable cab queue after the ADD_STA command is sent.2335 * 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
2323 int queue = iwl_mvm_tvqm_enable_txq(mvm, msta->sta_id,2342 int queue = iwl_mvm_tvqm_enable_txq(mvm, msta->sta_id,
2324 0,2343 0,
2325 timeout);2344 timeout);
2345 if (queue < 0) {
2346 ret = queue;
2347 goto err;
2348 }
2326 mvmvif->cab_queue = queue;2349 mvmvif->cab_queue = queue;
2327 } else if (!fw_has_api(&mvm->fw->ucode_capa,2350 } else if (!fw_has_api(&mvm->fw->ucode_capa,
2328 IWL_UCODE_TLV_API_STA_TYPE))2351 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
2330 timeout);2353 timeout);
2331 2354
2332 return 0;2355 return 0;
2356err:
2357 iwl_mvm_dealloc_int_sta(mvm, msta);
2358 return ret;
2333}2359}
2334 2360
2335static int __iwl_mvm_remove_sta_key(struct iwl_mvm *mvm, u8 sta_id,2361static 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
573 {IWL_PCI_DEVICE(0x2526, 0x0034, iwl9560_2ac_cfg)},573 {IWL_PCI_DEVICE(0x2526, 0x0034, iwl9560_2ac_cfg)},
574 {IWL_PCI_DEVICE(0x2526, 0x0038, iwl9560_2ac_160_cfg)},574 {IWL_PCI_DEVICE(0x2526, 0x0038, iwl9560_2ac_160_cfg)},
575 {IWL_PCI_DEVICE(0x2526, 0x003C, iwl9560_2ac_160_cfg)},575 {IWL_PCI_DEVICE(0x2526, 0x003C, iwl9560_2ac_160_cfg)},
576 {IWL_PCI_DEVICE(0x2526, 0x0060, iwl9460_2ac_cfg)},576 {IWL_PCI_DEVICE(0x2526, 0x0060, iwl9461_2ac_cfg_soc)},
577 {IWL_PCI_DEVICE(0x2526, 0x0064, iwl9460_2ac_cfg)},577 {IWL_PCI_DEVICE(0x2526, 0x0064, iwl9461_2ac_cfg_soc)},
578 {IWL_PCI_DEVICE(0x2526, 0x00A0, iwl9460_2ac_cfg)},578 {IWL_PCI_DEVICE(0x2526, 0x00A0, iwl9462_2ac_cfg_soc)},
579 {IWL_PCI_DEVICE(0x2526, 0x00A4, iwl9460_2ac_cfg)},579 {IWL_PCI_DEVICE(0x2526, 0x00A4, iwl9462_2ac_cfg_soc)},
580 {IWL_PCI_DEVICE(0x2526, 0x0210, iwl9260_2ac_cfg)},580 {IWL_PCI_DEVICE(0x2526, 0x0210, iwl9260_2ac_cfg)},
581 {IWL_PCI_DEVICE(0x2526, 0x0214, iwl9260_2ac_cfg)},581 {IWL_PCI_DEVICE(0x2526, 0x0214, iwl9260_2ac_cfg)},
582 {IWL_PCI_DEVICE(0x2526, 0x0230, iwl9560_2ac_cfg)},582 {IWL_PCI_DEVICE(0x2526, 0x0230, iwl9560_2ac_cfg)},
583 {IWL_PCI_DEVICE(0x2526, 0x0234, iwl9560_2ac_cfg)},583 {IWL_PCI_DEVICE(0x2526, 0x0234, iwl9560_2ac_cfg)},
584 {IWL_PCI_DEVICE(0x2526, 0x0238, iwl9560_2ac_cfg)},584 {IWL_PCI_DEVICE(0x2526, 0x0238, iwl9560_2ac_cfg)},
585 {IWL_PCI_DEVICE(0x2526, 0x023C, iwl9560_2ac_cfg)},585 {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)},
587 {IWL_PCI_DEVICE(0x2526, 0x0264, iwl9461_2ac_cfg_soc)},587 {IWL_PCI_DEVICE(0x2526, 0x0264, iwl9461_2ac_cfg_soc)},
588 {IWL_PCI_DEVICE(0x2526, 0x02A0, iwl9460_2ac_cfg)},588 {IWL_PCI_DEVICE(0x2526, 0x02A0, iwl9462_2ac_cfg_soc)},
589 {IWL_PCI_DEVICE(0x2526, 0x02A4, iwl9460_2ac_cfg)},589 {IWL_PCI_DEVICE(0x2526, 0x02A4, iwl9462_2ac_cfg_soc)},
590 {IWL_PCI_DEVICE(0x2526, 0x1010, iwl9260_2ac_cfg)},590 {IWL_PCI_DEVICE(0x2526, 0x1010, iwl9260_2ac_cfg)},
591 {IWL_PCI_DEVICE(0x2526, 0x1030, iwl9560_2ac_cfg)},591 {IWL_PCI_DEVICE(0x2526, 0x1030, iwl9560_2ac_cfg)},
592 {IWL_PCI_DEVICE(0x2526, 0x1210, iwl9260_2ac_cfg)},592 {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
603 {IWL_PCI_DEVICE(0x2526, 0x401C, iwl9260_2ac_160_cfg)},603 {IWL_PCI_DEVICE(0x2526, 0x401C, iwl9260_2ac_160_cfg)},
604 {IWL_PCI_DEVICE(0x2526, 0x4030, iwl9560_2ac_160_cfg)},604 {IWL_PCI_DEVICE(0x2526, 0x4030, iwl9560_2ac_160_cfg)},
605 {IWL_PCI_DEVICE(0x2526, 0x4034, iwl9560_2ac_160_cfg_soc)},605 {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)},
607 {IWL_PCI_DEVICE(0x2526, 0x4234, iwl9560_2ac_cfg_soc)},607 {IWL_PCI_DEVICE(0x2526, 0x4234, iwl9560_2ac_cfg_soc)},
608 {IWL_PCI_DEVICE(0x2526, 0x42A4, iwl9462_2ac_cfg_soc)},608 {IWL_PCI_DEVICE(0x2526, 0x42A4, iwl9462_2ac_cfg_soc)},
609 {IWL_PCI_DEVICE(0x2526, 0x6010, iwl9260_2ac_160_cfg)},609 {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
618 {IWL_PCI_DEVICE(0x271B, 0x0210, iwl9160_2ac_cfg)},618 {IWL_PCI_DEVICE(0x271B, 0x0210, iwl9160_2ac_cfg)},
619 {IWL_PCI_DEVICE(0x271B, 0x0214, iwl9260_2ac_cfg)},619 {IWL_PCI_DEVICE(0x271B, 0x0214, iwl9260_2ac_cfg)},
620 {IWL_PCI_DEVICE(0x271C, 0x0214, iwl9260_2ac_cfg)},620 {IWL_PCI_DEVICE(0x271C, 0x0214, iwl9260_2ac_cfg)},
621 {IWL_PCI_DEVICE(0x2720, 0x0034, iwl9560_2ac_160_cfg)},621
622 {IWL_PCI_DEVICE(0x2720, 0x0038, iwl9560_2ac_160_cfg)},622 {IWL_PCI_DEVICE(0x2720, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)},
623 {IWL_PCI_DEVICE(0x2720, 0x003C, iwl9560_2ac_160_cfg)},623 {IWL_PCI_DEVICE(0x2720, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
624 {IWL_PCI_DEVICE(0x2720, 0x0060, iwl9461_2ac_cfg_soc)},624 {IWL_PCI_DEVICE(0x2720, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
625 {IWL_PCI_DEVICE(0x2720, 0x0064, iwl9461_2ac_cfg_soc)},625 {IWL_PCI_DEVICE(0x2720, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)},
626 {IWL_PCI_DEVICE(0x2720, 0x00A0, iwl9462_2ac_cfg_soc)},626 {IWL_PCI_DEVICE(0x2720, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)},
627 {IWL_PCI_DEVICE(0x2720, 0x00A4, iwl9462_2ac_cfg_soc)},627 {IWL_PCI_DEVICE(0x2720, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
628 {IWL_PCI_DEVICE(0x2720, 0x0230, iwl9560_2ac_cfg)},628 {IWL_PCI_DEVICE(0x2720, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
629 {IWL_PCI_DEVICE(0x2720, 0x0234, iwl9560_2ac_cfg)},629 {IWL_PCI_DEVICE(0x2720, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)},
630 {IWL_PCI_DEVICE(0x2720, 0x0238, iwl9560_2ac_cfg)},630 {IWL_PCI_DEVICE(0x2720, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
631 {IWL_PCI_DEVICE(0x2720, 0x023C, iwl9560_2ac_cfg)},631 {IWL_PCI_DEVICE(0x2720, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)},
632 {IWL_PCI_DEVICE(0x2720, 0x0260, iwl9461_2ac_cfg_soc)},632 {IWL_PCI_DEVICE(0x2720, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)},
633 {IWL_PCI_DEVICE(0x2720, 0x0264, iwl9461_2ac_cfg_soc)},633 {IWL_PCI_DEVICE(0x2720, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)},
634 {IWL_PCI_DEVICE(0x2720, 0x02A0, iwl9462_2ac_cfg_soc)},634 {IWL_PCI_DEVICE(0x2720, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)},
635 {IWL_PCI_DEVICE(0x2720, 0x02A4, iwl9462_2ac_cfg_soc)},635 {IWL_PCI_DEVICE(0x2720, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
636 {IWL_PCI_DEVICE(0x2720, 0x1010, iwl9260_2ac_cfg)},636 {IWL_PCI_DEVICE(0x2720, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
637 {IWL_PCI_DEVICE(0x2720, 0x1030, iwl9560_2ac_cfg_soc)},637 {IWL_PCI_DEVICE(0x2720, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)},
638 {IWL_PCI_DEVICE(0x2720, 0x1210, iwl9260_2ac_cfg)},638 {IWL_PCI_DEVICE(0x2720, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)},
639 {IWL_PCI_DEVICE(0x2720, 0x1551, iwl9560_killer_s_2ac_cfg_soc)},639 {IWL_PCI_DEVICE(0x2720, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)},
640 {IWL_PCI_DEVICE(0x2720, 0x1552, iwl9560_killer_2ac_cfg_soc)},640 {IWL_PCI_DEVICE(0x2720, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
641 {IWL_PCI_DEVICE(0x2720, 0x2030, iwl9560_2ac_160_cfg_soc)},641 {IWL_PCI_DEVICE(0x2720, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
642 {IWL_PCI_DEVICE(0x2720, 0x2034, iwl9560_2ac_160_cfg_soc)},642 {IWL_PCI_DEVICE(0x2720, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
643 {IWL_PCI_DEVICE(0x2720, 0x4030, iwl9560_2ac_160_cfg)},643 {IWL_PCI_DEVICE(0x2720, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
644 {IWL_PCI_DEVICE(0x2720, 0x4034, iwl9560_2ac_160_cfg_soc)},644 {IWL_PCI_DEVICE(0x2720, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
645 {IWL_PCI_DEVICE(0x2720, 0x40A4, iwl9462_2ac_cfg_soc)},645 {IWL_PCI_DEVICE(0x2720, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
646 {IWL_PCI_DEVICE(0x2720, 0x4234, iwl9560_2ac_cfg_soc)},646 {IWL_PCI_DEVICE(0x2720, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
647 {IWL_PCI_DEVICE(0x2720, 0x42A4, iwl9462_2ac_cfg_soc)},647
648 648 {IWL_PCI_DEVICE(0x30DC, 0x0030, iwl9560_2ac_160_cfg_soc)},
649 {IWL_PCI_DEVICE(0x30DC, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},649 {IWL_PCI_DEVICE(0x30DC, 0x0034, iwl9560_2ac_cfg_soc)},
650 {IWL_PCI_DEVICE(0x30DC, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)},650 {IWL_PCI_DEVICE(0x30DC, 0x0038, iwl9560_2ac_160_cfg_soc)},
651 {IWL_PCI_DEVICE(0x30DC, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},651 {IWL_PCI_DEVICE(0x30DC, 0x003C, iwl9560_2ac_160_cfg_soc)},
652 {IWL_PCI_DEVICE(0x30DC, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},652 {IWL_PCI_DEVICE(0x30DC, 0x0060, iwl9460_2ac_cfg_soc)},
653 {IWL_PCI_DEVICE(0x30DC, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)},653 {IWL_PCI_DEVICE(0x30DC, 0x0064, iwl9461_2ac_cfg_soc)},
654 {IWL_PCI_DEVICE(0x30DC, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)},654 {IWL_PCI_DEVICE(0x30DC, 0x00A0, iwl9462_2ac_cfg_soc)},
655 {IWL_PCI_DEVICE(0x30DC, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},655 {IWL_PCI_DEVICE(0x30DC, 0x00A4, iwl9462_2ac_cfg_soc)},
656 {IWL_PCI_DEVICE(0x30DC, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},656 {IWL_PCI_DEVICE(0x30DC, 0x0230, iwl9560_2ac_cfg_soc)},
657 {IWL_PCI_DEVICE(0x30DC, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)},657 {IWL_PCI_DEVICE(0x30DC, 0x0234, iwl9560_2ac_cfg_soc)},
658 {IWL_PCI_DEVICE(0x30DC, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)},658 {IWL_PCI_DEVICE(0x30DC, 0x0238, iwl9560_2ac_cfg_soc)},
659 {IWL_PCI_DEVICE(0x30DC, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)},659 {IWL_PCI_DEVICE(0x30DC, 0x023C, iwl9560_2ac_cfg_soc)},
660 {IWL_PCI_DEVICE(0x30DC, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)},660 {IWL_PCI_DEVICE(0x30DC, 0x0260, iwl9461_2ac_cfg_soc)},
661 {IWL_PCI_DEVICE(0x30DC, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)},661 {IWL_PCI_DEVICE(0x30DC, 0x0264, iwl9461_2ac_cfg_soc)},
662 {IWL_PCI_DEVICE(0x30DC, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)},662 {IWL_PCI_DEVICE(0x30DC, 0x02A0, iwl9462_2ac_cfg_soc)},
663 {IWL_PCI_DEVICE(0x30DC, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},663 {IWL_PCI_DEVICE(0x30DC, 0x02A4, iwl9462_2ac_cfg_soc)},
664 {IWL_PCI_DEVICE(0x30DC, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},664 {IWL_PCI_DEVICE(0x30DC, 0x1010, iwl9260_2ac_cfg)},
665 {IWL_PCI_DEVICE(0x30DC, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)},665 {IWL_PCI_DEVICE(0x30DC, 0x1030, iwl9560_2ac_cfg_soc)},
666 {IWL_PCI_DEVICE(0x30DC, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)},666 {IWL_PCI_DEVICE(0x30DC, 0x1210, iwl9260_2ac_cfg)},
667 {IWL_PCI_DEVICE(0x30DC, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)},667 {IWL_PCI_DEVICE(0x30DC, 0x1551, iwl9560_killer_s_2ac_cfg_soc)},
668 {IWL_PCI_DEVICE(0x30DC, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},668 {IWL_PCI_DEVICE(0x30DC, 0x1552, iwl9560_killer_2ac_cfg_soc)},
669 {IWL_PCI_DEVICE(0x30DC, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},669 {IWL_PCI_DEVICE(0x30DC, 0x2030, iwl9560_2ac_160_cfg_soc)},
670 {IWL_PCI_DEVICE(0x30DC, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},670 {IWL_PCI_DEVICE(0x30DC, 0x2034, iwl9560_2ac_160_cfg_soc)},
671 {IWL_PCI_DEVICE(0x30DC, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},671 {IWL_PCI_DEVICE(0x30DC, 0x4030, iwl9560_2ac_160_cfg_soc)},
672 {IWL_PCI_DEVICE(0x30DC, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},672 {IWL_PCI_DEVICE(0x30DC, 0x4034, iwl9560_2ac_160_cfg_soc)},
673 {IWL_PCI_DEVICE(0x30DC, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)},673 {IWL_PCI_DEVICE(0x30DC, 0x40A4, iwl9462_2ac_cfg_soc)},
674 {IWL_PCI_DEVICE(0x30DC, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},674 {IWL_PCI_DEVICE(0x30DC, 0x4234, iwl9560_2ac_cfg_soc)},
675 {IWL_PCI_DEVICE(0x30DC, 0x42A4, iwl9462_2ac_cfg_soc)},
675 676
676 {IWL_PCI_DEVICE(0x31DC, 0x0030, iwl9560_2ac_160_cfg_shared_clk)},677 {IWL_PCI_DEVICE(0x31DC, 0x0030, iwl9560_2ac_160_cfg_shared_clk)},
677 {IWL_PCI_DEVICE(0x31DC, 0x0034, iwl9560_2ac_cfg_shared_clk)},678 {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
1067 }1068 }
1068 } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(iwl_trans->hw_rf_id) ==1069 } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(iwl_trans->hw_rf_id) ==
1069 CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR) &&1070 CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR) &&
1070 ((cfg != &iwl_ax200_cfg_cc &&1071 iwl_trans->hw_rev == CSR_HW_REV_TYPE_QNJ_B0) {
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)) {
1075 u32 hw_status;1072 u32 hw_status;
1076 1073
1077 hw_status = iwl_read_prph(iwl_trans, UMAG_GEN_HW_STATUS);1074 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
57#include "internal.h"57#include "internal.h"
58#include "fw/dbg.h"58#include "fw/dbg.h"
59 59
60static 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
60/*78/*
61 * Start up NIC's basic functionality after it has been reset79 * Start up NIC's basic functionality after it has been reset
62 * (e.g. after platform boot, or shutdown via iwl_pcie_apm_stop())80 * (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
92 110
93 iwl_pcie_apm_config(trans);111 iwl_pcie_apm_config(trans);
94 112
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
95 ret = iwl_finish_nic_init(trans, trans->trans_cfg);120 ret = iwl_finish_nic_init(trans, trans->trans_cfg);
96 if (ret)121 if (ret)
97 return ret;122 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
3041 }3041 }
3042}3042}
3043 3043
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 */
3050static struct lock_class_key hostap_netdev_xmit_lock_key;
3051static struct lock_class_key hostap_netdev_addr_lock_key;
3052
3053static 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
3061static 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
3068static struct net_device *3044static struct net_device *
3069prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx,3045prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx,
3070 struct device *sdev)3046 struct device *sdev)
@@ -3223,7 +3199,6 @@ while (0) · 152 unmodified lines
3223 if (ret >= 0)3199 if (ret >= 0)
3224 ret = register_netdevice(dev);3200 ret = register_netdevice(dev);
3225 3201
3226 prism2_set_lockdep_class(dev);
3227 rtnl_unlock();3202 rtnl_unlock();
3228 if (ret < 0) {3203 if (ret < 0) {
3229 printk(KERN_WARNING "%s: register netdevice failed!\n",3204 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
8 mmio.o util.o trace.o dma.o mac80211.o debugfs.o eeprom.o \8 mmio.o util.o trace.o dma.o mac80211.o debugfs.o eeprom.o \
9 tx.o agg-rx.o mcu.o9 tx.o agg-rx.o mcu.o
10 10
11mt76-$(CONFIG_PCI) += pci.o
12
11mt76-usb-y := usb.o usb_trace.o13mt76-usb-y := usb.o usb_trace.o
12 14
13CFLAGS_trace.o := -I$(src)15CFLAGS_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
53 u32 ctrl;53 u32 ctrl;
54 int i, idx = -1;54 int i, idx = -1;
55 55
56 if (txwi)56 if (txwi) {
57 q->entry[q->head].txwi = DMA_DUMMY_DATA;57 q->entry[q->head].txwi = DMA_DUMMY_DATA;
58 q->entry[q->head].skip_buf0 = true;
59 }
58 60
59 for (i = 0; i < nbufs; i += 2, buf += 2) {61 for (i = 0; i < nbufs; i += 2, buf += 2) {
60 u32 buf0 = buf[0].addr, buf1 = 0;62 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
97 __le32 __ctrl = READ_ONCE(q->desc[idx].ctrl);99 __le32 __ctrl = READ_ONCE(q->desc[idx].ctrl);
98 u32 ctrl = le32_to_cpu(__ctrl);100 u32 ctrl = le32_to_cpu(__ctrl);
99 101
100 if (!e->txwi || !e->skb) {102 if (!e->skip_buf0) {
101 __le32 addr = READ_ONCE(q->desc[idx].buf0);103 __le32 addr = READ_ONCE(q->desc[idx].buf0);
102 u32 len = FIELD_GET(MT_DMA_CTL_SD_LEN0, ctrl);104 u32 len = FIELD_GET(MT_DMA_CTL_SD_LEN0, ctrl);
103 105
drivers/net/wireless/mediatek/mt76/mt76.h+4−2
@@ -93,8 +93,9 @@ struct mt76_queue_entry { · 92 unmodified lines
93 struct urb *urb;93 struct urb *urb;
94 };94 };
95 enum mt76_txq_id qid;95 enum mt76_txq_id qid;
96 bool schedule;96 bool skip_buf0:1;
97 bool done;97 bool schedule:1;
98 bool done:1;
98};99};
99 100
100struct mt76_queue_regs {101struct mt76_queue_regs {
@@ -578,6 +579,7 @@ bool __mt76_poll_msec(struct mt76_dev *dev, u32 offset, u32 mask, u32 val, · 477 unmodified lines
578#define mt76_poll_msec(dev, ...) __mt76_poll_msec(&((dev)->mt76), __VA_ARGS__)579#define mt76_poll_msec(dev, ...) __mt76_poll_msec(&((dev)->mt76), __VA_ARGS__)
579 580
580void mt76_mmio_init(struct mt76_dev *dev, void __iomem *regs);581void mt76_mmio_init(struct mt76_dev *dev, void __iomem *regs);
582void mt76_pci_disable_aspm(struct pci_dev *pdev);
581 583
582static inline u16 mt76_chip(struct mt76_dev *dev)584static inline u16 mt76_chip(struct mt76_dev *dev)
583{585{
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
81 /* RG_SSUSB_CDR_BR_PE1D = 0x3 */81 /* RG_SSUSB_CDR_BR_PE1D = 0x3 */
82 mt76_rmw_field(dev, 0x15c58, 0x3 << 6, 0x3);82 mt76_rmw_field(dev, 0x15c58, 0x3 << 6, 0x3);
83 83
84 mt76_pci_disable_aspm(pdev);
85
84 return 0;86 return 0;
85 87
86error:88error:
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
8void 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}
46EXPORT_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
822 hdr = rtl_get_hdr(skb);822 hdr = rtl_get_hdr(skb);
823 fc = rtl_get_fc(skb);823 fc = rtl_get_fc(skb);
824 824
825 if (!stats.crc && !stats.hwerror) {825 if (!stats.crc && !stats.hwerror && (skb->len > FCS_LEN)) {
826 memcpy(IEEE80211_SKB_RXCB(skb), &rx_status,826 memcpy(IEEE80211_SKB_RXCB(skb), &rx_status,
827 sizeof(rx_status));827 sizeof(rx_status));
828 828
@@ -859,6 +859,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) · 30 unmodified lines
859 _rtl_pci_rx_to_mac80211(hw, skb, rx_status);859 _rtl_pci_rx_to_mac80211(hw, skb, rx_status);
860 }860 }
861 } else {861 } else {
862 /* drop packets with errors or those too short */
862 dev_kfree_skb_any(skb);863 dev_kfree_skb_any(skb);
863 }864 }
864new_trx_end:865new_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
754 return;754 return;
755 } else {755 } else {
756 noa_num = (noa_len - 2) / 13;756 noa_num = (noa_len - 2) / 13;
757 if (noa_num > P2P_MAX_NOA_NUM)
758 noa_num = P2P_MAX_NOA_NUM;
759
757 }760 }
758 noa_index = ie[3];761 noa_index = ie[3];
759 if (rtlpriv->psc.p2p_ps_info.p2p_ps_mode ==762 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
848 return;851 return;
849 } else {852 } else {
850 noa_num = (noa_len - 2) / 13;853 noa_num = (noa_len - 2) / 13;
854 if (noa_num > P2P_MAX_NOA_NUM)
855 noa_num = P2P_MAX_NOA_NUM;
856
851 }857 }
852 noa_index = ie[3];858 noa_index = ie[3];
853 if (rtlpriv->psc.p2p_ps_info.p2p_ps_mode ==859 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
548 priv->is_connected = false;548 priv->is_connected = false;
549 priv->is_up = false;549 priv->is_up = false;
550 INIT_DELAYED_WORK(&priv->connect, virt_wifi_connect_complete);550 INIT_DELAYED_WORK(&priv->connect, virt_wifi_connect_complete);
551 __module_get(THIS_MODULE);
551 552
552 return 0;553 return 0;
553unregister_netdev:554unregister_netdev:
@@ -578,6 +579,7 @@ static void virt_wifi_dellink(struct net_device *dev, · 24 unmodified lines
578 netdev_upper_dev_unlink(priv->lowerdev, dev);579 netdev_upper_dev_unlink(priv->lowerdev, dev);
579 580
580 unregister_netdevice_queue(dev, head);581 unregister_netdevice_queue(dev, head);
582 module_put(THIS_MODULE);
581 583
582 /* Deleting the wiphy is handled in the module destructor. */584 /* Deleting the wiphy is handled in the module destructor. */
583}585}
@@ -590,6 +592,42 @@ static struct rtnl_link_ops virt_wifi_link_ops = { · 6 unmodified lines
590 .priv_size = sizeof(struct virt_wifi_netdev_priv),592 .priv_size = sizeof(struct virt_wifi_netdev_priv),
591};593};
592 594
595static 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
600static 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
627static struct notifier_block virt_wifi_notifier = {
628 .notifier_call = virt_wifi_event,
629};
630
593/* Acquires and releases the rtnl lock. */631/* Acquires and releases the rtnl lock. */
594static int __init virt_wifi_init_module(void)632static int __init virt_wifi_init_module(void)
595{633{
@@ -598,14 +636,25 @@ static int __init virt_wifi_init_module(void) · 2 unmodified lines
598 /* Guaranteed to be locallly-administered and not multicast. */636 /* Guaranteed to be locallly-administered and not multicast. */
599 eth_random_addr(fake_router_bssid);637 eth_random_addr(fake_router_bssid);
600 638
639 err = register_netdevice_notifier(&virt_wifi_notifier);
640 if (err)
641 return err;
642
643 err = -ENOMEM;
601 common_wiphy = virt_wifi_make_wiphy();644 common_wiphy = virt_wifi_make_wiphy();
602 if (!common_wiphy)645 if (!common_wiphy)
603 return -ENOMEM;646 goto notifier;
604 647
605 err = rtnl_link_register(&virt_wifi_link_ops);648 err = rtnl_link_register(&virt_wifi_link_ops);
606 if (err)649 if (err)
607 virt_wifi_destroy_wiphy(common_wiphy);650 goto destroy_wiphy;
608 651
652 return 0;
653
654destroy_wiphy:
655 virt_wifi_destroy_wiphy(common_wiphy);
656notifier:
657 unregister_netdevice_notifier(&virt_wifi_notifier);
609 return err;658 return err;
610}659}
611 660
@@ -615,6 +664,7 @@ static void __exit virt_wifi_cleanup_module(void) · 3 unmodified lines
615 /* Will delete any devices that depend on the wiphy. */664 /* Will delete any devices that depend on the wiphy. */
616 rtnl_link_unregister(&virt_wifi_link_ops);665 rtnl_link_unregister(&virt_wifi_link_ops);
617 virt_wifi_destroy_wiphy(common_wiphy);666 virt_wifi_destroy_wiphy(common_wiphy);
667 unregister_netdevice_notifier(&virt_wifi_notifier);
618}668}
619 669
620module_init(virt_wifi_init_module);670module_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
259 *fw_vsc_cfg, len);259 *fw_vsc_cfg, len);
260 260
261 if (r) {261 if (r) {
262 devm_kfree(dev, fw_vsc_cfg);262 devm_kfree(dev, *fw_vsc_cfg);
263 goto vsc_read_err;263 goto vsc_read_err;
264 }264 }
265 } else {265 } 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
708 NFC_PROTO_FELICA_MASK;708 NFC_PROTO_FELICA_MASK;
709 } else {709 } else {
710 kfree_skb(nfcid_skb);710 kfree_skb(nfcid_skb);
711 nfcid_skb = NULL;
711 /* P2P in type A */712 /* P2P in type A */
712 r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_F_GATE,713 r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_F_GATE,
713 ST21NFCA_RF_READER_F_NFCID1,714 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
158 struct nvme_ns *ns;158 struct nvme_ns *ns;
159 159
160 mutex_lock(&ctrl->scan_lock);160 mutex_lock(&ctrl->scan_lock);
161 down_read(&ctrl->namespaces_rwsem);
161 list_for_each_entry(ns, &ctrl->namespaces, list)162 list_for_each_entry(ns, &ctrl->namespaces, list)
162 if (nvme_mpath_clear_current_path(ns))163 if (nvme_mpath_clear_current_path(ns))
163 kblockd_schedule_work(&ns->head->requeue_work);164 kblockd_schedule_work(&ns->head->requeue_work);
165 up_read(&ctrl->namespaces_rwsem);
164 mutex_unlock(&ctrl->scan_lock);166 mutex_unlock(&ctrl->scan_lock);
165}167}
166 168
@@ -522,14 +524,13 @@ static int nvme_update_ana_state(struct nvme_ctrl *ctrl, · 355 unmodified lines
522 return 0;524 return 0;
523}525}
524 526
525static int nvme_read_ana_log(struct nvme_ctrl *ctrl, bool groups_only)527static int nvme_read_ana_log(struct nvme_ctrl *ctrl)
526{528{
527 u32 nr_change_groups = 0;529 u32 nr_change_groups = 0;
528 int error;530 int error;
529 531
530 mutex_lock(&ctrl->ana_lock);532 mutex_lock(&ctrl->ana_lock);
531 error = nvme_get_log(ctrl, NVME_NSID_ALL, NVME_LOG_ANA,533 error = nvme_get_log(ctrl, NVME_NSID_ALL, NVME_LOG_ANA, 0,
532 groups_only ? NVME_ANA_LOG_RGO : 0,
533 ctrl->ana_log_buf, ctrl->ana_log_size, 0);534 ctrl->ana_log_buf, ctrl->ana_log_size, 0);
534 if (error) {535 if (error) {
535 dev_warn(ctrl->device, "Failed to get ANA log: %d\n", error);536 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
565{566{
566 struct nvme_ctrl *ctrl = container_of(work, struct nvme_ctrl, ana_work);567 struct nvme_ctrl *ctrl = container_of(work, struct nvme_ctrl, ana_work);
567 568
568 nvme_read_ana_log(ctrl, false);569 nvme_read_ana_log(ctrl);
569}570}
570 571
571static void nvme_anatt_timeout(struct timer_list *t)572static 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
715 goto out;716 goto out;
716 }717 }
717 718
718 error = nvme_read_ana_log(ctrl, true);719 error = nvme_read_ana_log(ctrl);
719 if (error)720 if (error)
720 goto out_free_ana_log_buf;721 goto out_free_ana_log_buf;
721 return 0;722 return 0;
drivers/nvme/host/rdma.c+8−0
@@ -2133,8 +2133,16 @@ err_unreg_client: · 2132 unmodified lines
2133 2133
2134static void __exit nvme_rdma_cleanup_module(void)2134static void __exit nvme_rdma_cleanup_module(void)
2135{2135{
2136 struct nvme_rdma_ctrl *ctrl;
2137
2136 nvmf_unregister_transport(&nvme_rdma_transport);2138 nvmf_unregister_transport(&nvme_rdma_transport);
2137 ib_unregister_client(&nvme_rdma_ib_client);2139 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);
2138}2146}
2139 2147
2140module_init(nvme_rdma_init_module);2148module_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
2219 struct nvme_tcp_queue *queue = hctx->driver_data;2219 struct nvme_tcp_queue *queue = hctx->driver_data;
2220 struct sock *sk = queue->sock->sk;2220 struct sock *sk = queue->sock->sk;
2221 2221
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))
2223 sk_busy_loop(sk, true);2223 sk_busy_loop(sk, true);
2224 nvme_tcp_try_recv(queue);2224 nvme_tcp_try_recv(queue);
2225 return queue->nr_cqe;2225 return queue->nr_cqe;
drivers/pinctrl/intel/pinctrl-cherryview.c+13−13
@@ -147,6 +147,7 @@ struct chv_pin_context { · 146 unmodified lines
147 * @pctldesc: Pin controller description147 * @pctldesc: Pin controller description
148 * @pctldev: Pointer to the pin controller device148 * @pctldev: Pointer to the pin controller device
149 * @chip: GPIO chip in this pin controller149 * @chip: GPIO chip in this pin controller
150 * @irqchip: IRQ chip in this pin controller
150 * @regs: MMIO registers151 * @regs: MMIO registers
151 * @intr_lines: Stores mapping between 16 HW interrupt wires and GPIO152 * @intr_lines: Stores mapping between 16 HW interrupt wires and GPIO
152 * offset (in GPIO number space)153 * offset (in GPIO number space)
@@ -162,6 +163,7 @@ struct chv_pinctrl { · 9 unmodified lines
162 struct pinctrl_desc pctldesc;163 struct pinctrl_desc pctldesc;
163 struct pinctrl_dev *pctldev;164 struct pinctrl_dev *pctldev;
164 struct gpio_chip chip;165 struct gpio_chip chip;
166 struct irq_chip irqchip;
165 void __iomem *regs;167 void __iomem *regs;
166 unsigned intr_lines[16];168 unsigned intr_lines[16];
167 const struct chv_community *community;169 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
1466 return 0;1468 return 0;
1467}1469}
1468 1470
1469static 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
1479static void chv_gpio_irq_handler(struct irq_desc *desc)1471static void chv_gpio_irq_handler(struct irq_desc *desc)
1480{1472{
1481 struct gpio_chip *gc = irq_desc_get_handler_data(desc);1473 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
1559 intsel >>= CHV_PADCTRL0_INTSEL_SHIFT;1551 intsel >>= CHV_PADCTRL0_INTSEL_SHIFT;
1560 1552
1561 if (intsel >= community->nirqs)1553 if (intsel >= community->nirqs)
1562 clear_bit(i, valid_mask);1554 clear_bit(desc->number, valid_mask);
1563 }1555 }
1564}1556}
1565 1557
@@ -1625,7 +1617,15 @@ static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq) · 59 unmodified lines
1625 }1617 }
1626 }1618 }
1627 1619
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,
1629 handle_bad_irq, IRQ_TYPE_NONE);1629 handle_bad_irq, IRQ_TYPE_NONE);
1630 if (ret) {1630 if (ret) {
1631 dev_err(pctrl->dev, "failed to add IRQ chip\n");1631 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
1642 }1642 }
1643 }1643 }
1644 1644
1645 gpiochip_set_chained_irqchip(chip, &chv_gpio_irqchip, irq,1645 gpiochip_set_chained_irqchip(chip, &pctrl->irqchip, irq,
1646 chv_gpio_irq_handler);1646 chv_gpio_irq_handler);
1647 return 0;1647 return 0;
1648}1648}
drivers/pinctrl/intel/pinctrl-intel.c+20−1
@@ -52,6 +52,7 @@ · 51 unmodified lines
52#define PADCFG0_GPIROUTNMI BIT(17)52#define PADCFG0_GPIROUTNMI BIT(17)
53#define PADCFG0_PMODE_SHIFT 1053#define PADCFG0_PMODE_SHIFT 10
54#define PADCFG0_PMODE_MASK GENMASK(13, 10)54#define PADCFG0_PMODE_MASK GENMASK(13, 10)
55#define PADCFG0_PMODE_GPIO 0
55#define PADCFG0_GPIORXDIS BIT(9)56#define PADCFG0_GPIORXDIS BIT(9)
56#define PADCFG0_GPIOTXDIS BIT(8)57#define PADCFG0_GPIOTXDIS BIT(8)
57#define PADCFG0_GPIORXSTATE BIT(1)58#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
332 cfg1 = readl(intel_get_padcfg(pctrl, pin, PADCFG1));333 cfg1 = readl(intel_get_padcfg(pctrl, pin, PADCFG1));
333 334
334 mode = (cfg0 & PADCFG0_PMODE_MASK) >> PADCFG0_PMODE_SHIFT;335 mode = (cfg0 & PADCFG0_PMODE_MASK) >> PADCFG0_PMODE_SHIFT;
335 if (!mode)336 if (mode == PADCFG0_PMODE_GPIO)
336 seq_puts(s, "GPIO ");337 seq_puts(s, "GPIO ");
337 else338 else
338 seq_printf(s, "mode %d ", mode);339 seq_printf(s, "mode %d ", mode);
@@ -458,6 +459,11 @@ static void __intel_gpio_set_direction(void __iomem *padcfg0, bool input) · 119 unmodified lines
458 writel(value, padcfg0);459 writel(value, padcfg0);
459}460}
460 461
462static int intel_gpio_get_gpio_mode(void __iomem *padcfg0)
463{
464 return (readl(padcfg0) & PADCFG0_PMODE_MASK) >> PADCFG0_PMODE_SHIFT;
465}
466
461static void intel_gpio_set_gpio_mode(void __iomem *padcfg0)467static void intel_gpio_set_gpio_mode(void __iomem *padcfg0)
462{468{
463 u32 value;469 u32 value;
@@ -491,7 +497,20 @@ static int intel_gpio_request_enable(struct pinctrl_dev *pctldev, · 27 unmodified lines
491 }497 }
492 498
493 padcfg0 = intel_get_padcfg(pctrl, pin, PADCFG0);499 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
494 intel_gpio_set_gpio_mode(padcfg0);512 intel_gpio_set_gpio_mode(padcfg0);
513
495 /* Disable TX buffer and enable RX (this will be input) */514 /* Disable TX buffer and enable RX (this will be input) */
496 __intel_gpio_set_direction(padcfg0, true);515 __intel_gpio_set_direction(padcfg0, true);
497 516
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
585 return stmfx_function_enable(pctl->stmfx, func);585 return stmfx_function_enable(pctl->stmfx, func);
586}586}
587 587
588static 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
601static int stmfx_pinctrl_probe(struct platform_device *pdev)588static int stmfx_pinctrl_probe(struct platform_device *pdev)
602{589{
603 struct stmfx *stmfx = dev_get_drvdata(pdev->dev.parent);590 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
660 pctl->gpio_chip.ngpio = pctl->pctl_desc.npins;647 pctl->gpio_chip.ngpio = pctl->pctl_desc.npins;
661 pctl->gpio_chip.can_sleep = true;648 pctl->gpio_chip.can_sleep = true;
662 pctl->gpio_chip.of_node = np;649 pctl->gpio_chip.of_node = np;
663 pctl->gpio_chip.init_valid_mask = stmfx_pinctrl_gpio_init_valid_mask;
664 650
665 ret = devm_gpiochip_add_data(pctl->dev, &pctl->gpio_chip, pctl);651 ret = devm_gpiochip_add_data(pctl->dev, &pctl->gpio_chip, pctl);
666 if (ret) {652 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
472 if (err)472 if (err)
473 return err;473 return err;
474 474
475 /*475 pwm->state = *state;
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;
483 } else {476 } else {
484 /*477 /*
485 * FIXME: restore the initial state in case of error.478 * 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
187static const struct pwm_ops iproc_pwm_ops = {187static const struct pwm_ops iproc_pwm_ops = {
188 .apply = iproc_pwmc_apply,188 .apply = iproc_pwmc_apply,
189 .get_state = iproc_pwmc_get_state,189 .get_state = iproc_pwmc_get_state,
190 .owner = THIS_MODULE,
190};191};
191 192
192static int iproc_pwmc_probe(struct platform_device *pdev)193static 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
76 * of_reset_simple_xlate - translate reset_spec to the reset line number76 * of_reset_simple_xlate - translate reset_spec to the reset line number
77 * @rcdev: a pointer to the reset controller device77 * @rcdev: a pointer to the reset controller device
78 * @reset_spec: reset line specifier as found in the device tree78 * @reset_spec: reset line specifier as found in the device tree
79 * @flags: a flags pointer to fill in (optional)
80 *79 *
81 * This simple translation function should be used for reset controllers80 * This simple translation function should be used for reset controllers
82 * with 1:1 mapping, where reset lines can be indexed by number without gaps.81 * 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
748 for (i = 0; i < resets->num_rstcs; i++)747 for (i = 0; i < resets->num_rstcs; i++)
749 __reset_control_put_internal(resets->rstc[i]);748 __reset_control_put_internal(resets->rstc[i]);
750 mutex_unlock(&reset_list_mutex);749 mutex_unlock(&reset_list_mutex);
750 kfree(resets);
751}751}
752 752
753/**753/**
@@ -825,9 +825,10 @@ int __device_reset(struct device *dev, bool optional) · 71 unmodified lines
825}825}
826EXPORT_SYMBOL_GPL(__device_reset);826EXPORT_SYMBOL_GPL(__device_reset);
827 827
828/**828/*
829 * APIs to manage an array of reset controls.829 * APIs to manage an array of reset controls.
830 */830 */
831
831/**832/**
832 * of_reset_control_get_count - Count number of resets available with a device833 * of_reset_control_get_count - Count number of resets available with a device
833 *834 *
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
851 851
852 if (!(vport->fc_flag & FC_PT2PT)) {852 if (!(vport->fc_flag & FC_PT2PT)) {
853 /* Check config parameter use-adisc or FCP-2 */853 /* 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) ||
855 ((ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) &&855 ((ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) &&
856 (ndlp->nlp_type & NLP_FCP_TARGET))) {856 (ndlp->nlp_type & NLP_FCP_TARGET)))) {
857 spin_lock_irq(shost->host_lock);857 spin_lock_irq(shost->host_lock);
858 ndlp->nlp_flag |= NLP_NPR_ADISC;858 ndlp->nlp_flag |= NLP_NPR_ADISC;
859 spin_unlock_irq(shost->host_lock);859 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
7866 if (sli4_hba->hdwq) {7866 if (sli4_hba->hdwq) {
7867 for (eqidx = 0; eqidx < phba->cfg_irq_chann; eqidx++) {7867 for (eqidx = 0; eqidx < phba->cfg_irq_chann; eqidx++) {
7868 eq = phba->sli4_hba.hba_eq_hdl[eqidx].eq;7868 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) {
7870 fpeq = eq;7870 fpeq = eq;
7871 break;7871 break;
7872 }7872 }
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
440 valid = 0;440 valid = 0;
441 if (ha->optrom_size == OPTROM_SIZE_2300 && start == 0)441 if (ha->optrom_size == OPTROM_SIZE_2300 && start == 0)
442 valid = 1;442 valid = 1;
443 else if (start == (ha->flt_region_boot * 4) ||
444 start == (ha->flt_region_fw * 4))
445 valid = 1;
446 else if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha))443 else if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha))
447 valid = 1;444 valid = 1;
448 if (!valid) {445 if (!valid) {
@@ -489,8 +486,10 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, · 40 unmodified lines
489 "Writing flash region -- 0x%x/0x%x.\n",486 "Writing flash region -- 0x%x/0x%x.\n",
490 ha->optrom_region_start, ha->optrom_region_size);487 ha->optrom_region_start, ha->optrom_region_size);
491 488
492 ha->isp_ops->write_optrom(vha, ha->optrom_buffer,489 rval = ha->isp_ops->write_optrom(vha, ha->optrom_buffer,
493 ha->optrom_region_start, ha->optrom_region_size);490 ha->optrom_region_start, ha->optrom_region_size);
491 if (rval)
492 rval = -EIO;
494 break;493 break;
495 default:494 default:
496 rval = -EINVAL;495 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
253 srb_t *sp;253 srb_t *sp;
254 const char *type;254 const char *type;
255 int req_sg_cnt, rsp_sg_cnt;255 int req_sg_cnt, rsp_sg_cnt;
256 int rval = (DRIVER_ERROR << 16);256 int rval = (DID_ERROR << 16);
257 uint16_t nextlid = 0;257 uint16_t nextlid = 0;
258 258
259 if (bsg_request->msgcode == FC_BSG_RPT_ELS) {259 if (bsg_request->msgcode == FC_BSG_RPT_ELS) {
@@ -432,7 +432,7 @@ qla2x00_process_ct(struct bsg_job *bsg_job) · 172 unmodified lines
432 struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);432 struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
433 scsi_qla_host_t *vha = shost_priv(host);433 scsi_qla_host_t *vha = shost_priv(host);
434 struct qla_hw_data *ha = vha->hw;434 struct qla_hw_data *ha = vha->hw;
435 int rval = (DRIVER_ERROR << 16);435 int rval = (DID_ERROR << 16);
436 int req_sg_cnt, rsp_sg_cnt;436 int req_sg_cnt, rsp_sg_cnt;
437 uint16_t loop_id;437 uint16_t loop_id;
438 struct fc_port *fcport;438 struct fc_port *fcport;
@@ -1950,7 +1950,7 @@ qlafx00_mgmt_cmd(struct bsg_job *bsg_job) · 1511 unmodified lines
1950 struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);1950 struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
1951 scsi_qla_host_t *vha = shost_priv(host);1951 scsi_qla_host_t *vha = shost_priv(host);
1952 struct qla_hw_data *ha = vha->hw;1952 struct qla_hw_data *ha = vha->hw;
1953 int rval = (DRIVER_ERROR << 16);1953 int rval = (DID_ERROR << 16);
1954 struct qla_mt_iocb_rqst_fx00 *piocb_rqst;1954 struct qla_mt_iocb_rqst_fx00 *piocb_rqst;
1955 srb_t *sp;1955 srb_t *sp;
1956 int req_sg_cnt = 0, rsp_sg_cnt = 0;1956 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
702 mcp->mb[2] = LSW(risc_addr);702 mcp->mb[2] = LSW(risc_addr);
703 mcp->mb[3] = 0;703 mcp->mb[3] = 0;
704 mcp->mb[4] = 0;704 mcp->mb[4] = 0;
705 mcp->mb[11] = 0;
705 ha->flags.using_lr_setting = 0;706 ha->flags.using_lr_setting = 0;
706 if (IS_QLA25XX(ha) || IS_QLA81XX(ha) || IS_QLA83XX(ha) ||707 if (IS_QLA25XX(ha) || IS_QLA81XX(ha) || IS_QLA83XX(ha) ||
707 IS_QLA27XX(ha) || IS_QLA28XX(ha)) {708 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
746 if (ha->flags.exchoffld_enabled)747 if (ha->flags.exchoffld_enabled)
747 mcp->mb[4] |= ENABLE_EXCHANGE_OFFLD;748 mcp->mb[4] |= ENABLE_EXCHANGE_OFFLD;
748 749
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;
750 mcp->in_mb |= MBX_3 | MBX_2 | MBX_1;751 mcp->in_mb |= MBX_3 | MBX_2 | MBX_1;
751 } else {752 } else {
752 mcp->mb[1] = LSW(risc_addr);753 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
3535 qla2x00_try_to_stop_firmware(vha);3535 qla2x00_try_to_stop_firmware(vha);
3536 }3536 }
3537 3537
3538 /* Disable timer */
3539 if (vha->timer_active)
3540 qla2x00_stop_timer(vha);
3541
3538 /* Turn adapter off line */3542 /* Turn adapter off line */
3539 vha->flags.online = 0;3543 vha->flags.online = 0;
3540 3544
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
1166 sector_t lba = sectors_to_logical(sdp, blk_rq_pos(rq));1166 sector_t lba = sectors_to_logical(sdp, blk_rq_pos(rq));
1167 sector_t threshold;1167 sector_t threshold;
1168 unsigned int nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq));1168 unsigned int nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq));
1169 bool dif, dix;
1170 unsigned int mask = logical_to_sectors(sdp, 1) - 1;1169 unsigned int mask = logical_to_sectors(sdp, 1) - 1;
1171 bool write = rq_data_dir(rq) == WRITE;1170 bool write = rq_data_dir(rq) == WRITE;
1172 unsigned char protect, fua;1171 unsigned char protect, fua;
1173 blk_status_t ret;1172 blk_status_t ret;
1173 unsigned int dif;
1174 bool dix;
1174 1175
1175 ret = scsi_init_io(cmd);1176 ret = scsi_init_io(cmd);
1176 if (ret != BLK_STS_OK)1177 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
98 98
99 bsg_reply->reply_payload_rcv_len = 0;99 bsg_reply->reply_payload_rcv_len = 0;
100 100
101 pm_runtime_get_sync(hba->dev);
102
101 msgcode = bsg_request->msgcode;103 msgcode = bsg_request->msgcode;
102 switch (msgcode) {104 switch (msgcode) {
103 case UPIU_TRANSACTION_QUERY_REQ:105 case UPIU_TRANSACTION_QUERY_REQ:
@@ -135,6 +137,8 @@ static int ufs_bsg_request(struct bsg_job *job) · 31 unmodified lines
135 break;137 break;
136 }138 }
137 139
140 pm_runtime_put_sync(hba->dev);
141
138 if (!desc_buff)142 if (!desc_buff)
139 goto out;143 goto out;
140 144
drivers/soc/imx/gpc.c+4−4
@@ -249,13 +249,13 @@ static struct genpd_power_state imx6_pm_domain_pu_state = { · 248 unmodified lines
249};249};
250 250
251static struct imx_pm_domain imx_gpc_domains[] = {251static struct imx_pm_domain imx_gpc_domains[] = {
252 [GPC_PGC_DOMAIN_ARM] {252 [GPC_PGC_DOMAIN_ARM] = {
253 .base = {253 .base = {
254 .name = "ARM",254 .name = "ARM",
255 .flags = GENPD_FLAG_ALWAYS_ON,255 .flags = GENPD_FLAG_ALWAYS_ON,
256 },256 },
257 },257 },
258 [GPC_PGC_DOMAIN_PU] {258 [GPC_PGC_DOMAIN_PU] = {
259 .base = {259 .base = {
260 .name = "PU",260 .name = "PU",
261 .power_off = imx6_pm_domain_power_off,261 .power_off = imx6_pm_domain_power_off,
@@ -266,7 +266,7 @@ static struct imx_pm_domain imx_gpc_domains[] = { · 4 unmodified lines
266 .reg_offs = 0x260,266 .reg_offs = 0x260,
267 .cntr_pdn_bit = 0,267 .cntr_pdn_bit = 0,
268 },268 },
269 [GPC_PGC_DOMAIN_DISPLAY] {269 [GPC_PGC_DOMAIN_DISPLAY] = {
270 .base = {270 .base = {
271 .name = "DISPLAY",271 .name = "DISPLAY",
272 .power_off = imx6_pm_domain_power_off,272 .power_off = imx6_pm_domain_power_off,
@@ -275,7 +275,7 @@ static struct imx_pm_domain imx_gpc_domains[] = { · 2 unmodified lines
275 .reg_offs = 0x240,275 .reg_offs = 0x240,
276 .cntr_pdn_bit = 4,276 .cntr_pdn_bit = 4,
277 },277 },
278 [GPC_PGC_DOMAIN_PCI] {278 [GPC_PGC_DOMAIN_PCI] = {
279 .base = {279 .base = {
280 .name = "PCI",280 .name = "PCI",
281 .power_off = imx6_pm_domain_power_off,281 .power_off = imx6_pm_domain_power_off,
drivers/soundwire/Kconfig+1−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
5 5
6menuconfig SOUNDWIRE6menuconfig SOUNDWIRE
7 tristate "SoundWire support"7 tristate "SoundWire support"
8 depends on ACPI || OF
8 help9 help
9 SoundWire is a 2-Pin interface with data and clock line ratified10 SoundWire is a 2-Pin interface with data and clock line ratified
10 by the MIPI Alliance. SoundWire is used for transporting data11 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
900 /* Create PCM DAIs */900 /* Create PCM DAIs */
901 stream = &cdns->pcm;901 stream = &cdns->pcm;
902 902
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,
904 off, stream->num_ch_in, true);904 off, stream->num_ch_in, true);
905 if (ret)905 if (ret)
906 return ret;906 return ret;
@@ -931,7 +931,7 @@ static int intel_register_dai(struct sdw_intel *sdw) · 24 unmodified lines
931 if (ret)931 if (ret)
932 return ret;932 return ret;
933 933
934 off += cdns->pdm.num_bd;934 off += cdns->pdm.num_out;
935 ret = intel_create_dai(cdns, dais, INTEL_PDI_BD, cdns->pdm.num_bd,935 ret = intel_create_dai(cdns, dais, INTEL_PDI_BD, cdns->pdm.num_bd,
936 off, stream->num_ch_bd, false);936 off, stream->num_ch_bd, false);
937 if (ret)937 if (ret)
drivers/soundwire/slave.c+2−1
@@ -128,7 +128,8 @@ int sdw_of_find_slaves(struct sdw_bus *bus) · 127 unmodified lines
128 struct device_node *node;128 struct device_node *node;
129 129
130 for_each_child_of_node(bus->dev->of_node, node) {130 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;
132 const char *compat = NULL;133 const char *compat = NULL;
133 struct sdw_slave_id id;134 struct sdw_slave_id id;
134 const __be32 *addr;135 const __be32 *addr;
drivers/staging/Kconfig+2−0
@@ -125,4 +125,6 @@ source "drivers/staging/exfat/Kconfig" · 124 unmodified lines
125 125
126source "drivers/staging/qlge/Kconfig"126source "drivers/staging/qlge/Kconfig"
127 127
128source "drivers/staging/vboxsf/Kconfig"
129
128endif # STAGING130endif # STAGING
drivers/staging/Makefile+1−0
@@ -53,3 +53,4 @@ obj-$(CONFIG_UWB) += uwb/ · 52 unmodified lines
53obj-$(CONFIG_USB_WUSB) += wusbcore/53obj-$(CONFIG_USB_WUSB) += wusbcore/
54obj-$(CONFIG_EXFAT_FS) += exfat/54obj-$(CONFIG_EXFAT_FS) += exfat/
55obj-$(CONFIG_QLGE) += qlge/55obj-$(CONFIG_QLGE) += qlge/
56obj-$(CONFIG_VBOXSF_FS) += vboxsf/
drivers/staging/vboxsf/Kconfig+10−0
@@ -0,0 +1,10 @@
1config 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
3obj-$(CONFIG_VBOXSF_FS) += vboxsf.o
4
5vboxsf-y := dir.o file.o utils.o vboxsf_wrappers.o super.o
drivers/staging/vboxsf/TODO+7−0
@@ -0,0 +1,7 @@
1TODO:
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
6Please send any patches to Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7and 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
12static 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
44err_close:
45 vboxsf_close(sbi->root, params.handle);
46err_free_dir_info:
47 vboxsf_dir_info_free(sf_d);
48 return err;
49}
50
51static 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
59static 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
95static 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) {
108try_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
163static 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
173const 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 */
185static 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
196const struct dentry_operations vboxsf_dentry_ops = {
197 .d_revalidate = vboxsf_dentry_revalidate
198};
199
200/* iops */
201
202static 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
225static 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
246static 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
282static 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
288static 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
294static 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
326static 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);
363err_put_old_path:
364 __putname(old_path);
365 return err;
366}
367
368static 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
408const 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
15struct vboxsf_handle {
16 u64 handle;
17 u32 root;
18 u32 access_flags;
19 struct kref refcount;
20 struct list_head head;
21};
22
23static 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
108static 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
117static 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 */
140static void vboxsf_vma_close(struct vm_area_struct *vma)
141{
142 filemap_write_and_wait(vma->vm_file->f_mapping);
143}
144
145static 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
151static 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 */
195const 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
206const struct inode_operations vboxsf_reg_iops = {
207 .getattr = vboxsf_getattr,
208 .setattr = vboxsf_setattr
209};
210
211static 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
235static 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
253static 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
290static 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
321out:
322 unlock_page(page);
323 put_page(page);
324
325 return nwritten;
326}
327
328const 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
336static 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
368const 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
27enum {
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. */
62struct 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};
76VMMDEV_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. */
82static 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. */
140enum 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 */
168struct 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. */
223struct shfl_fsobjattr_easize {
224 /** Size of EAs. */
225 s64 cb;
226} __packed;
227
228/** Shared folder filesystem object attributes. */
229struct 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;
247VMMDEV_ASSERT_SIZE(shfl_fsobjattr, 44);
248
249struct shfl_timespec {
250 s64 ns_relative_to_unix_epoch;
251};
252
253/** Filesystem object information structure. */
254struct 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;
289VMMDEV_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 */
297enum 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 */
396struct 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 */
414struct 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. */
431struct 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};
474VMMDEV_ASSERT_SIZE(shfl_fsproperties, 12);
475
476struct 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. */
487struct 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. */
519struct 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. */
533struct 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. */
559struct 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. */
579struct 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. */
617struct 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. */
663struct 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. */
720struct 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. */
764struct 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. */
810struct 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. */
841struct 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. */
872struct 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
29static int follow_symlinks;
30module_param(follow_symlinks, int, 0444);
31MODULE_PARM_DESC(follow_symlinks,
32 "Let host resolve symlinks rather than showing them");
33
34static DEFINE_IDA(vboxsf_bdi_ida);
35static DEFINE_MUTEX(vboxsf_setup_mutex);
36static bool vboxsf_setup_done;
37static struct super_operations vboxsf_super_ops; /* forward declaration */
38static struct kmem_cache *vboxsf_inode_cachep;
39
40static char * const vboxsf_default_nls = CONFIG_NLS_DEFAULT;
41
42enum { opt_nls, opt_uid, opt_gid, opt_ttl, opt_dmode, opt_fmode,
43 opt_dmask, opt_fmask };
44
45static 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
57static const struct fs_parameter_description vboxsf_fs_parameters = {
58 .name = "vboxsf",
59 .specs = vboxsf_param_specs,
60};
61
62static 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
127static 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
226fail_unmap:
227 vboxsf_unmap_folder(sbi->root);
228fail_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
238static 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
246static 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
260static 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
271static 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
290static 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
329static 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
336static 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;
377success:
378 mutex_unlock(&vboxsf_setup_mutex);
379 return 0;
380
381fail_disconnect:
382 vboxsf_disconnect();
383fail_free_cache:
384 kmem_cache_destroy(vboxsf_inode_cachep);
385fail_nomem:
386 mutex_unlock(&vboxsf_setup_mutex);
387 return err;
388}
389
390static 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
405static 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
416static 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
433static 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
441static 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
449static 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
464static 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 */
473static int __init vboxsf_init(void)
474{
475 return register_filesystem(&vboxsf_fs_type);
476}
477
478static 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
495module_init(vboxsf_init);
496module_exit(vboxsf_fini);
497
498MODULE_DESCRIPTION("Oracle VM VirtualBox Module for Host File System Access");
499MODULE_AUTHOR("Oracle Corporation");
500MODULE_LICENSE("GPL v2");
501MODULE_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
15struct 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] */
48void 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
121int 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
138int 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
160int 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
175int 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
215int 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
240int 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 */
345struct 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
417int 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
459static 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
481static 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
488struct 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
500void 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
514int 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
18static u32 vboxsf_client_id;
19
20int 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
40void 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
53static 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
75int 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
102int 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 */
130int 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
149int 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
162int 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
179int 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
201int 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
225int 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 */
250int 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
294int 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
320int 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
340int 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
363int vboxsf_set_utf8(void)
364{
365 return vboxsf_call(SHFL_FN_SET_UTF8, NULL, 0, NULL);
366}
367
368int 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
21struct 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
33struct vboxsf_fs_context {
34 struct vboxsf_options o;
35 char *nls_name;
36};
37
38/* per-shared folder information */
39struct 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 */
51struct 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
62struct vboxsf_dir_info {
63 struct list_head info_list;
64};
65
66struct 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 */
75extern const struct inode_operations vboxsf_dir_iops;
76extern const struct inode_operations vboxsf_lnk_iops;
77extern const struct inode_operations vboxsf_reg_iops;
78extern const struct file_operations vboxsf_dir_fops;
79extern const struct file_operations vboxsf_reg_fops;
80extern const struct address_space_operations vboxsf_reg_aops;
81extern const struct dentry_operations vboxsf_dentry_ops;
82
83/* from utils.c */
84struct inode *vboxsf_new_inode(struct super_block *sb);
85void vboxsf_init_inode(struct vboxsf_sbi *sbi, struct inode *inode,
86 const struct shfl_fsobjinfo *info);
87int vboxsf_create_at_dentry(struct dentry *dentry,
88 struct shfl_createparms *params);
89int vboxsf_stat(struct vboxsf_sbi *sbi, struct shfl_string *path,
90 struct shfl_fsobjinfo *info);
91int vboxsf_stat_dentry(struct dentry *dentry, struct shfl_fsobjinfo *info);
92int vboxsf_inode_revalidate(struct dentry *dentry);
93int vboxsf_getattr(const struct path *path, struct kstat *kstat,
94 u32 request_mask, unsigned int query_flags);
95int vboxsf_setattr(struct dentry *dentry, struct iattr *iattr);
96struct shfl_string *vboxsf_path_from_dentry(struct vboxsf_sbi *sbi,
97 struct dentry *dentry);
98int vboxsf_nlscpy(struct vboxsf_sbi *sbi, char *name, size_t name_bound_len,
99 const unsigned char *utf8_name, size_t utf8_len);
100struct vboxsf_dir_info *vboxsf_dir_info_alloc(void);
101void vboxsf_dir_info_free(struct vboxsf_dir_info *p);
102int vboxsf_dir_read_all(struct vboxsf_sbi *sbi, struct vboxsf_dir_info *sf_d,
103 u64 handle);
104
105/* from vboxsf_wrappers.c */
106int vboxsf_connect(void);
107void vboxsf_disconnect(void);
108
109int vboxsf_create(u32 root, struct shfl_string *parsed_path,
110 struct shfl_createparms *create_parms);
111
112int vboxsf_close(u32 root, u64 handle);
113int vboxsf_remove(u32 root, struct shfl_string *parsed_path, u32 flags);
114int vboxsf_rename(u32 root, struct shfl_string *src_path,
115 struct shfl_string *dest_path, u32 flags);
116
117int vboxsf_read(u32 root, u64 handle, u64 offset, u32 *buf_len, u8 *buf);
118int vboxsf_write(u32 root, u64 handle, u64 offset, u32 *buf_len, u8 *buf);
119
120int 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);
123int vboxsf_fsinfo(u32 root, u64 handle, u32 flags,
124 u32 *buf_len, void *buf);
125
126int vboxsf_map_folder(struct shfl_string *folder_name, u32 *root);
127int vboxsf_unmap_folder(u32 root);
128
129int vboxsf_readlink(u32 root, struct shfl_string *parsed_path,
130 u32 buf_len, u8 *buf);
131int vboxsf_symlink(u32 root, struct shfl_string *new_path,
132 struct shfl_string *old_path, struct shfl_fsobjinfo *buf);
133
134int vboxsf_set_utf8(void);
135int 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
1831 1831
1832 while (credits) {1832 while (credits) {
1833 struct sk_buff *p = cxgbit_sock_peek_wr(csk);1833 struct sk_buff *p = cxgbit_sock_peek_wr(csk);
1834 const u32 csum = (__force u32)p->csum;1834 u32 csum;
1835 1835
1836 if (unlikely(!p)) {1836 if (unlikely(!p)) {
1837 pr_err("csk 0x%p,%u, cr %u,%u+%u, empty.\n",1837 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
1840 break;1840 break;
1841 }1841 }
1842 1842
1843 csum = (__force u32)p->csum;
1843 if (unlikely(credits < csum)) {1844 if (unlikely(credits < csum)) {
1844 pr_warn("csk 0x%p,%u, cr %u,%u+%u, < %u.\n",1845 pr_warn("csk 0x%p,%u, cr %u,%u+%u, < %u.\n",
1845 csk, csk->tid,1846 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
80{80{
81 u32 data;81 u32 data;
82 82
83 pci_read_config_dword(nhi->pdev, VS_CAP_19, &data);
84 data = (cmd << VS_CAP_19_CMD_SHIFT) & VS_CAP_19_CMD_MASK;83 data = (cmd << VS_CAP_19_CMD_SHIFT) & VS_CAP_19_CMD_MASK;
85 pci_write_config_dword(nhi->pdev, VS_CAP_19, data | VS_CAP_19_VALID);84 pci_write_config_dword(nhi->pdev, VS_CAP_19, data | VS_CAP_19_VALID);
86}85}
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
896 */896 */
897bool tb_dp_port_is_enabled(struct tb_port *port)897bool tb_dp_port_is_enabled(struct tb_port *port)
898{898{
899 u32 data;899 u32 data[2];
900 900
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)))
902 return false;903 return false;
903 904
904 return !!(data & (TB_DP_VIDEO_EN | TB_DP_AUX_EN));905 return !!(data[0] & (TB_DP_VIDEO_EN | TB_DP_AUX_EN));
905}906}
906 907
907/**908/**
@@ -914,19 +915,21 @@ bool tb_dp_port_is_enabled(struct tb_port *port) · 6 unmodified lines
914 */915 */
915int tb_dp_port_enable(struct tb_port *port, bool enable)916int tb_dp_port_enable(struct tb_port *port, bool enable)
916{917{
917 u32 data;918 u32 data[2];
918 int ret;919 int ret;
919 920
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));
921 if (ret)923 if (ret)
922 return ret;924 return ret;
923 925
924 if (enable)926 if (enable)
925 data |= TB_DP_VIDEO_EN | TB_DP_AUX_EN;927 data[0] |= TB_DP_VIDEO_EN | TB_DP_AUX_EN;
926 else928 else
927 data &= ~(TB_DP_VIDEO_EN | TB_DP_AUX_EN);929 data[0] &= ~(TB_DP_VIDEO_EN | TB_DP_AUX_EN);
928 930
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));
930}933}
931 934
932/* switch utility functions */935/* switch utility functions */
@@ -1031,13 +1034,6 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val) · 98 unmodified lines
1031 if (sw->authorized)1034 if (sw->authorized)
1032 goto unlock;1035 goto unlock;
1033 1036
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
1041 switch (val) {1037 switch (val) {
1042 /* Approve switch */1038 /* Approve switch */
1043 case 1:1039 case 1:
@@ -1057,8 +1053,6 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val) · 13 unmodified lines
1057 break;1053 break;
1058 }1054 }
1059 1055
1060 pci_unlock_rescan_remove();
1061
1062 if (!ret) {1056 if (!ret) {
1063 sw->authorized = val;1057 sw->authorized = val;
1064 /* Notify status change to the userspace */1058 /* 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
2329 writel(USB_CONF_CLK2OFFDS | USB_CONF_L1DS, &regs->usb_conf);2329 writel(USB_CONF_CLK2OFFDS | USB_CONF_L1DS, &regs->usb_conf);
2330 2330
2331 cdns3_configure_dmult(priv_dev, NULL);2331 cdns3_configure_dmult(priv_dev, NULL);
2332
2333 cdns3_gadget_pullup(&priv_dev->gadget, 1);
2334}2332}
2335 2333
2336/**2334/**
@@ -2345,9 +2343,35 @@ static int cdns3_gadget_udc_start(struct usb_gadget *gadget, · 8 unmodified lines
2345{2343{
2346 struct cdns3_device *priv_dev = gadget_to_cdns3_device(gadget);2344 struct cdns3_device *priv_dev = gadget_to_cdns3_device(gadget);
2347 unsigned long flags;2345 unsigned long flags;
2346 enum usb_device_speed max_speed = driver->max_speed;
2348 2347
2349 spin_lock_irqsave(&priv_dev->lock, flags);2348 spin_lock_irqsave(&priv_dev->lock, flags);
2350 priv_dev->gadget_driver = driver;2349 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
2351 cdns3_gadget_config(priv_dev);2375 cdns3_gadget_config(priv_dev);
2352 spin_unlock_irqrestore(&priv_dev->lock, flags);2376 spin_unlock_irqrestore(&priv_dev->lock, flags);
2353 return 0;2377 return 0;
@@ -2381,6 +2405,8 @@ static int cdns3_gadget_udc_stop(struct usb_gadget *gadget) · 27 unmodified lines
2381 writel(EP_CMD_EPRST, &priv_dev->regs->ep_cmd);2405 writel(EP_CMD_EPRST, &priv_dev->regs->ep_cmd);
2382 readl_poll_timeout_atomic(&priv_dev->regs->ep_cmd, val,2406 readl_poll_timeout_atomic(&priv_dev->regs->ep_cmd, val,
2383 !(val & EP_CMD_EPRST), 1, 100);2407 !(val & EP_CMD_EPRST), 1, 100);
2408
2409 priv_ep->flags &= ~EP_CLAIMED;
2384 }2410 }
2385 2411
2386 /* disable interrupt for device */2412 /* disable interrupt for device */
@@ -2575,12 +2601,7 @@ static int cdns3_gadget_start(struct cdns3 *cdns) · 188 unmodified lines
2575 /* Check the maximum_speed parameter */2601 /* Check the maximum_speed parameter */
2576 switch (max_speed) {2602 switch (max_speed) {
2577 case USB_SPEED_FULL:2603 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;
2581 case USB_SPEED_HIGH:2604 case USB_SPEED_HIGH:
2582 writel(USB_CONF_USB3DIS, &priv_dev->regs->usb_conf);
2583 break;
2584 case USB_SPEED_SUPER:2605 case USB_SPEED_SUPER:
2585 break;2606 break;
2586 default:2607 default:
@@ -2713,8 +2734,6 @@ static int cdns3_gadget_suspend(struct cdns3 *cdns, bool do_wakeup) · 126 unmodified lines
2713 /* disable interrupt for device */2734 /* disable interrupt for device */
2714 writel(0, &priv_dev->regs->usb_ien);2735 writel(0, &priv_dev->regs->usb_ien);
2715 2736
2716 cdns3_gadget_pullup(&priv_dev->gadget, 0);
2717
2718 return 0;2737 return 0;
2719}2738}
2720 2739
drivers/usb/cdns3/host-export.h+0−1
@@ -12,7 +12,6 @@ · 11 unmodified lines
12#ifdef CONFIG_USB_CDNS3_HOST12#ifdef CONFIG_USB_CDNS3_HOST
13 13
14int cdns3_host_init(struct cdns3 *cdns);14int cdns3_host_init(struct cdns3 *cdns);
15void cdns3_host_exit(struct cdns3 *cdns);
16 15
17#else16#else
18 17
drivers/usb/cdns3/host.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
12#include <linux/platform_device.h>12#include <linux/platform_device.h>
13#include "core.h"13#include "core.h"
14#include "drd.h"14#include "drd.h"
15#include "host-export.h"
15 16
16static int __cdns3_host_init(struct cdns3 *cdns)17static int __cdns3_host_init(struct cdns3 *cdns)
17{18{
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
348 348
349 /* Validate the wMaxPacketSize field */349 /* Validate the wMaxPacketSize field */
350 maxp = usb_endpoint_maxp(&endpoint->desc);350 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 }
351 356
352 /* Find the highest legal maxpacket size for this endpoint */357 /* Find the highest legal maxpacket size for this endpoint */
353 i = 0; /* additional transactions per microframe */358 i = 0; /* additional transactions per microframe */
drivers/usb/dwc3/Kconfig+1−0
@@ -102,6 +102,7 @@ config USB_DWC3_MESON_G12A · 101 unmodified lines
102 depends on ARCH_MESON || COMPILE_TEST102 depends on ARCH_MESON || COMPILE_TEST
103 default USB_DWC3103 default USB_DWC3
104 select USB_ROLE_SWITCH104 select USB_ROLE_SWITCH
105 select REGMAP_MMIO
105 help106 help
106 Support USB2/3 functionality in Amlogic G12A platforms.107 Support USB2/3 functionality in Amlogic G12A platforms.
107 Say 'Y' or 'M' if you have one such device.108 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
312 312
313 reg = dwc3_readl(dwc->regs, DWC3_GFLADJ);313 reg = dwc3_readl(dwc->regs, DWC3_GFLADJ);
314 dft = reg & DWC3_GFLADJ_30MHZ_MASK;314 dft = reg & DWC3_GFLADJ_30MHZ_MASK;
315 if (!dev_WARN_ONCE(dwc->dev, dft == dwc->fladj,315 if (dft != dwc->fladj) {
316 "request value same as default, ignoring\n")) {
317 reg &= ~DWC3_GFLADJ_30MHZ_MASK;316 reg &= ~DWC3_GFLADJ_30MHZ_MASK;
318 reg |= DWC3_GFLADJ_30MHZ_SDBND_SEL | dwc->fladj;317 reg |= DWC3_GFLADJ_30MHZ_SDBND_SEL | dwc->fladj;
319 dwc3_writel(dwc->regs, DWC3_GFLADJ, reg);318 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
258 258
259 ret = platform_device_add_properties(dwc->dwc3, p);259 ret = platform_device_add_properties(dwc->dwc3, p);
260 if (ret < 0)260 if (ret < 0)
261 return ret;261 goto err;
262 262
263 ret = dwc3_pci_quirks(dwc);263 ret = dwc3_pci_quirks(dwc);
264 if (ret)264 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
707 707
708 dwc3_gadget_giveback(dep, req, -ESHUTDOWN);708 dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
709 }709 }
710
711 while (!list_empty(&dep->cancelled_list)) {
712 req = next_request(&dep->cancelled_list);
713
714 dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
715 }
710}716}
711 717
712/**718/**
drivers/usb/gadget/composite.c+4−0
@@ -2170,14 +2170,18 @@ void composite_dev_cleanup(struct usb_composite_dev *cdev) · 2169 unmodified lines
2170 usb_ep_dequeue(cdev->gadget->ep0, cdev->os_desc_req);2170 usb_ep_dequeue(cdev->gadget->ep0, cdev->os_desc_req);
2171 2171
2172 kfree(cdev->os_desc_req->buf);2172 kfree(cdev->os_desc_req->buf);
2173 cdev->os_desc_req->buf = NULL;
2173 usb_ep_free_request(cdev->gadget->ep0, cdev->os_desc_req);2174 usb_ep_free_request(cdev->gadget->ep0, cdev->os_desc_req);
2175 cdev->os_desc_req = NULL;
2174 }2176 }
2175 if (cdev->req) {2177 if (cdev->req) {
2176 if (cdev->setup_pending)2178 if (cdev->setup_pending)
2177 usb_ep_dequeue(cdev->gadget->ep0, cdev->req);2179 usb_ep_dequeue(cdev->gadget->ep0, cdev->req);
2178 2180
2179 kfree(cdev->req->buf);2181 kfree(cdev->req->buf);
2182 cdev->req->buf = NULL;
2180 usb_ep_free_request(cdev->gadget->ep0, cdev->req);2183 usb_ep_free_request(cdev->gadget->ep0, cdev->req);
2184 cdev->req = NULL;
2181 }2185 }
2182 cdev->next_string_id = 0;2186 cdev->next_string_id = 0;
2183 device_remove_file(&cdev->gadget->dev, &dev_attr_suspended);2187 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
61 bool use_os_desc;61 bool use_os_desc;
62 char b_vendor_code;62 char b_vendor_code;
63 char qw_sign[OS_STRING_QW_SIGN_LEN];63 char qw_sign[OS_STRING_QW_SIGN_LEN];
64 spinlock_t spinlock;
65 bool unbind;
64};66};
65 67
66static inline struct gadget_info *to_gadget_info(struct config_item *item)68static 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
1244 int ret;1246 int ret;
1245 1247
1246 /* the gi->lock is hold by the caller */1248 /* the gi->lock is hold by the caller */
1249 gi->unbind = 0;
1247 cdev->gadget = gadget;1250 cdev->gadget = gadget;
1248 set_gadget_data(gadget, cdev);1251 set_gadget_data(gadget, cdev);
1249 ret = composite_dev_prepare(composite, cdev);1252 ret = composite_dev_prepare(composite, cdev);
@@ -1376,31 +1379,128 @@ static void configfs_composite_unbind(struct usb_gadget *gadget) · 126 unmodified lines
1376{1379{
1377 struct usb_composite_dev *cdev;1380 struct usb_composite_dev *cdev;
1378 struct gadget_info *gi;1381 struct gadget_info *gi;
1382 unsigned long flags;
1379 1383
1380 /* the gi->lock is hold by the caller */1384 /* the gi->lock is hold by the caller */
1381 1385
1382 cdev = get_gadget_data(gadget);1386 cdev = get_gadget_data(gadget);
1383 gi = container_of(cdev, struct gadget_info, cdev);1387 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);
1384 1391
1385 kfree(otg_desc[0]);1392 kfree(otg_desc[0]);
1386 otg_desc[0] = NULL;1393 otg_desc[0] = NULL;
1387 purge_configs_funcs(gi);1394 purge_configs_funcs(gi);
1388 composite_dev_cleanup(cdev);1395 composite_dev_cleanup(cdev);
1389 usb_ep_autoconfig_reset(cdev->gadget);1396 usb_ep_autoconfig_reset(cdev->gadget);
1397 spin_lock_irqsave(&gi->spinlock, flags);
1390 cdev->gadget = NULL;1398 cdev->gadget = NULL;
1391 set_gadget_data(gadget, NULL);1399 set_gadget_data(gadget, NULL);
1400 spin_unlock_irqrestore(&gi->spinlock, flags);
1401}
1402
1403static 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
1428static 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
1450static 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
1472static 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);
1392}1492}
1393 1493
1394static const struct usb_gadget_driver configfs_driver_template = {1494static const struct usb_gadget_driver configfs_driver_template = {
1395 .bind = configfs_composite_bind,1495 .bind = configfs_composite_bind,
1396 .unbind = configfs_composite_unbind,1496 .unbind = configfs_composite_unbind,
1397 1497
1398 .setup = composite_setup,1498 .setup = configfs_composite_setup,
1399 .reset = composite_disconnect,1499 .reset = configfs_composite_disconnect,
1400 .disconnect = composite_disconnect,1500 .disconnect = configfs_composite_disconnect,
1401 1501
1402 .suspend = composite_suspend,1502 .suspend = configfs_composite_suspend,
1403 .resume = composite_resume,1503 .resume = configfs_composite_resume,
1404 1504
1405 .max_speed = USB_SPEED_SUPER,1505 .max_speed = USB_SPEED_SUPER,
1406 .driver = {1506 .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
449 next_fifo_transaction(ep, req);449 next_fifo_transaction(ep, req);
450 if (req->last_transaction) {450 if (req->last_transaction) {
451 usba_ep_writel(ep, CTL_DIS, USBA_TX_PK_RDY);451 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);
453 } else {454 } 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);
455 usba_ep_writel(ep, CTL_ENB, USBA_TX_PK_RDY);457 usba_ep_writel(ep, CTL_ENB, USBA_TX_PK_RDY);
456 }458 }
457 }459 }
drivers/usb/gadget/udc/core.c+11−0
@@ -98,6 +98,17 @@ int usb_ep_enable(struct usb_ep *ep) · 97 unmodified lines
98 if (ep->enabled)98 if (ep->enabled)
99 goto out;99 goto out;
100 100
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
101 ret = ep->ops->enable(ep, ep->desc);112 ret = ep->ops->enable(ep, ep->desc);
102 if (ret)113 if (ret)
103 goto out;114 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
2576 dma_pool_destroy(udc_controller->td_pool);2576 dma_pool_destroy(udc_controller->td_pool);
2577 free_irq(udc_controller->irq, udc_controller);2577 free_irq(udc_controller->irq, udc_controller);
2578 iounmap(dr_regs);2578 iounmap(dr_regs);
2579 if (pdata->operating_mode == FSL_USB2_DR_DEVICE)2579 if (res && (pdata->operating_mode == FSL_USB2_DR_DEVICE))
2580 release_mem_region(res->start, resource_size(res));2580 release_mem_region(res->start, resource_size(res));
2581 2581
2582 /* free udc --wait for the release() finished */2582 /* 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
1544static bool usb3_std_req_set_address(struct renesas_usb3 *usb3,1544static bool usb3_std_req_set_address(struct renesas_usb3 *usb3,
1545 struct usb_ctrlrequest *ctrl)1545 struct usb_ctrlrequest *ctrl)
1546{1546{
1547 if (ctrl->wValue >= 128)1547 if (le16_to_cpu(ctrl->wValue) >= 128)
1548 return true; /* stall */1548 return true; /* stall */
1549 1549
1550 usb3_set_device_address(usb3, ctrl->wValue);1550 usb3_set_device_address(usb3, le16_to_cpu(ctrl->wValue));
1551 usb3_set_p0_con_for_no_data(usb3);1551 usb3_set_p0_con_for_no_data(usb3);
1552 1552
1553 return false;1553 return false;
@@ -1582,6 +1582,7 @@ static bool usb3_std_req_get_status(struct renesas_usb3 *usb3, · 28 unmodified lines
1582 struct renesas_usb3_ep *usb3_ep;1582 struct renesas_usb3_ep *usb3_ep;
1583 int num;1583 int num;
1584 u16 status = 0;1584 u16 status = 0;
1585 __le16 tx_data;
1585 1586
1586 switch (ctrl->bRequestType & USB_RECIP_MASK) {1587 switch (ctrl->bRequestType & USB_RECIP_MASK) {
1587 case USB_RECIP_DEVICE:1588 case USB_RECIP_DEVICE:
@@ -1604,10 +1605,10 @@ static bool usb3_std_req_get_status(struct renesas_usb3 *usb3, · 16 unmodified lines
1604 }1605 }
1605 1606
1606 if (!stall) {1607 if (!stall) {
1607 status = cpu_to_le16(status);1608 tx_data = cpu_to_le16(status);
1608 dev_dbg(usb3_to_dev(usb3), "get_status: req = %p\n",1609 dev_dbg(usb3_to_dev(usb3), "get_status: req = %p\n",
1609 usb_req_to_usb3_req(usb3->ep0_req));1610 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),
1611 usb3_pipe0_get_status_completion);1612 usb3_pipe0_get_status_completion);
1612 }1613 }
1613 1614
@@ -1772,7 +1773,7 @@ static bool usb3_std_req_set_sel(struct renesas_usb3 *usb3, · 158 unmodified lines
1772static bool usb3_std_req_set_configuration(struct renesas_usb3 *usb3,1773static bool usb3_std_req_set_configuration(struct renesas_usb3 *usb3,
1773 struct usb_ctrlrequest *ctrl)1774 struct usb_ctrlrequest *ctrl)
1774{1775{
1775 if (ctrl->wValue > 0)1776 if (le16_to_cpu(ctrl->wValue) > 0)
1776 usb3_set_bit(usb3, USB_COM_CON_CONF, USB3_USB_COM_CON);1777 usb3_set_bit(usb3, USB_COM_CON_CONF, USB3_USB_COM_CON);
1777 else1778 else
1778 usb3_clear_bit(usb3, USB_COM_CON_CONF, USB3_USB_COM_CON);1779 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
202 trb = &seg->trbs[i];202 trb = &seg->trbs[i];
203 dma = seg->dma + i * sizeof(*trb);203 dma = seg->dma + i * sizeof(*trb);
204 seq_printf(s, "%pad: %s\n", &dma,204 seq_printf(s, "%pad: %s\n", &dma,
205 xhci_decode_trb(trb->generic.field[0],205 xhci_decode_trb(le32_to_cpu(trb->generic.field[0]),
206 trb->generic.field[1],206 le32_to_cpu(trb->generic.field[1]),
207 trb->generic.field[2],207 le32_to_cpu(trb->generic.field[2]),
208 trb->generic.field[3]));208 le32_to_cpu(trb->generic.field[3])));
209 }209 }
210}210}
211 211
@@ -263,10 +263,10 @@ static int xhci_slot_context_show(struct seq_file *s, void *unused) · 51 unmodified lines
263 xhci = hcd_to_xhci(bus_to_hcd(dev->udev->bus));263 xhci = hcd_to_xhci(bus_to_hcd(dev->udev->bus));
264 slot_ctx = xhci_get_slot_ctx(xhci, dev->out_ctx);264 slot_ctx = xhci_get_slot_ctx(xhci, dev->out_ctx);
265 seq_printf(s, "%pad: %s\n", &dev->out_ctx->dma,265 seq_printf(s, "%pad: %s\n", &dev->out_ctx->dma,
266 xhci_decode_slot_context(slot_ctx->dev_info,266 xhci_decode_slot_context(le32_to_cpu(slot_ctx->dev_info),
267 slot_ctx->dev_info2,267 le32_to_cpu(slot_ctx->dev_info2),
268 slot_ctx->tt_info,268 le32_to_cpu(slot_ctx->tt_info),
269 slot_ctx->dev_state));269 le32_to_cpu(slot_ctx->dev_state)));
270 270
271 return 0;271 return 0;
272}272}
@@ -286,10 +286,10 @@ static int xhci_endpoint_context_show(struct seq_file *s, void *unused) · 13 unmodified lines
286 ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, dci);286 ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, dci);
287 dma = dev->out_ctx->dma + dci * CTX_SIZE(xhci->hcc_params);287 dma = dev->out_ctx->dma + dci * CTX_SIZE(xhci->hcc_params);
288 seq_printf(s, "%pad: %s\n", &dma,288 seq_printf(s, "%pad: %s\n", &dma,
289 xhci_decode_ep_context(ep_ctx->ep_info,289 xhci_decode_ep_context(le32_to_cpu(ep_ctx->ep_info),
290 ep_ctx->ep_info2,290 le32_to_cpu(ep_ctx->ep_info2),
291 ep_ctx->deq,291 le64_to_cpu(ep_ctx->deq),
292 ep_ctx->tx_info));292 le32_to_cpu(ep_ctx->tx_info)));
293 }293 }
294 294
295 return 0;295 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
3330 if (xhci_urb_suitable_for_idt(urb)) {3330 if (xhci_urb_suitable_for_idt(urb)) {
3331 memcpy(&send_addr, urb->transfer_buffer,3331 memcpy(&send_addr, urb->transfer_buffer,
3332 trb_buff_len);3332 trb_buff_len);
3333 le64_to_cpus(&send_addr);
3333 field |= TRB_IDT;3334 field |= TRB_IDT;
3334 }3335 }
3335 }3336 }
@@ -3475,6 +3476,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, · 139 unmodified lines
3475 if (xhci_urb_suitable_for_idt(urb)) {3476 if (xhci_urb_suitable_for_idt(urb)) {
3476 memcpy(&addr, urb->transfer_buffer,3477 memcpy(&addr, urb->transfer_buffer,
3477 urb->transfer_buffer_length);3478 urb->transfer_buffer_length);
3479 le64_to_cpus(&addr);
3478 field |= TRB_IDT;3480 field |= TRB_IDT;
3479 } else {3481 } else {
3480 addr = (u64) urb->transfer_dma;3482 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
3071 }3071 }
3072}3072}
3073 3073
3074static 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);
3085rescan:
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);
3111done:
3112 host_ep->hcpriv = NULL;
3113 spin_unlock_irqrestore(&xhci->lock, flags);
3114}
3115
3074/*3116/*
3075 * Called after usb core issues a clear halt control message.3117 * Called after usb core issues a clear halt control message.
3076 * The host side of the halt should already be cleared by a reset endpoint3118 * 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
5238 unsigned int ep_index;5280 unsigned int ep_index;
5239 unsigned long flags;5281 unsigned long flags;
5240 5282
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
5247 xhci = hcd_to_xhci(hcd);5283 xhci = hcd_to_xhci(hcd);
5284
5285 spin_lock_irqsave(&xhci->lock, flags);
5248 udev = (struct usb_device *)ep->hcpriv;5286 udev = (struct usb_device *)ep->hcpriv;
5249 if (!udev)
5250 return;
5251 slot_id = udev->slot_id;5287 slot_id = udev->slot_id;
5252 ep_index = xhci_get_endpoint_index(&ep->desc);5288 ep_index = xhci_get_endpoint_index(&ep->desc);
5253 5289
5254 spin_lock_irqsave(&xhci->lock, flags);
5255 xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_CLEARING_TT;5290 xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_CLEARING_TT;
5256 xhci_ring_doorbell_for_active_rings(xhci, slot_id, ep_index);5291 xhci_ring_doorbell_for_active_rings(xhci, slot_id, ep_index);
5257 spin_unlock_irqrestore(&xhci->lock, flags);5292 spin_unlock_irqrestore(&xhci->lock, flags);
@@ -5288,6 +5323,7 @@ static const struct hc_driver xhci_hc_driver = { · 30 unmodified lines
5288 .free_streams = xhci_free_streams,5323 .free_streams = xhci_free_streams,
5289 .add_endpoint = xhci_add_endpoint,5324 .add_endpoint = xhci_add_endpoint,
5290 .drop_endpoint = xhci_drop_endpoint,5325 .drop_endpoint = xhci_drop_endpoint,
5326 .endpoint_disable = xhci_endpoint_disable,
5291 .endpoint_reset = xhci_endpoint_reset,5327 .endpoint_reset = xhci_endpoint_reset,
5292 .check_bandwidth = xhci_check_bandwidth,5328 .check_bandwidth = xhci_check_bandwidth,
5293 .reset_bandwidth = xhci_reset_bandwidth,5329 .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
487 }487 }
488 bytes_to_read = min(count, *actual_buffer);488 bytes_to_read = min(count, *actual_buffer);
489 if (bytes_to_read < *actual_buffer)489 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",
491 *actual_buffer-bytes_to_read);491 *actual_buffer-bytes_to_read);
492 492
493 /* copy one interrupt_in_buffer from ring_buffer into userspace */493 /* 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
495 retval = -EFAULT;495 retval = -EFAULT;
496 goto unlock_exit;496 goto unlock_exit;
497 }497 }
498 dev->ring_tail = (dev->ring_tail+1) % ring_buffer_size;
499
500 retval = bytes_to_read;498 retval = bytes_to_read;
501 499
502 spin_lock_irq(&dev->rbsl);500 spin_lock_irq(&dev->rbsl);
501 dev->ring_tail = (dev->ring_tail + 1) % ring_buffer_size;
502
503 if (dev->buffer_overflow) {503 if (dev->buffer_overflow) {
504 dev->buffer_overflow = 0;504 dev->buffer_overflow = 0;
505 spin_unlock_irq(&dev->rbsl);505 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
562 /* write the data into interrupt_out_buffer from userspace */562 /* write the data into interrupt_out_buffer from userspace */
563 bytes_to_write = min(count, write_buffer_size*dev->interrupt_out_endpoint_size);563 bytes_to_write = min(count, write_buffer_size*dev->interrupt_out_endpoint_size);
564 if (bytes_to_write < count)564 if (bytes_to_write < count)
565 dev_warn(&dev->intf->dev, "Write buffer overflow, %zd bytes dropped\n", count-bytes_to_write);565 dev_warn(&dev->intf->dev, "Write buffer overflow, %zu bytes dropped\n",
566 dev_dbg(&dev->intf->dev, "%s: count = %zd, bytes_to_write = %zd\n",566 count - bytes_to_write);
567 dev_dbg(&dev->intf->dev, "%s: count = %zu, bytes_to_write = %zu\n",
567 __func__, count, bytes_to_write);568 __func__, count, bytes_to_write);
568 569
569 if (copy_from_user(dev->interrupt_out_buffer, buffer, bytes_to_write)) {570 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
580 1 << 8, 0,581 1 << 8, 0,
581 dev->interrupt_out_buffer,582 dev->interrupt_out_buffer,
582 bytes_to_write,583 bytes_to_write,
583 USB_CTRL_SET_TIMEOUT * HZ);584 USB_CTRL_SET_TIMEOUT);
584 if (retval < 0)585 if (retval < 0)
585 dev_err(&dev->intf->dev,586 dev_err(&dev->intf->dev,
586 "Couldn't submit HID_REQ_SET_REPORT %d\n",587 "Couldn't submit HID_REQ_SET_REPORT %d\n",
drivers/usb/mtu3/mtu3_core.c+1−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
16#include <linux/platform_device.h>16#include <linux/platform_device.h>
17 17
18#include "mtu3.h"18#include "mtu3.h"
19#include "mtu3_dr.h"
19#include "mtu3_debug.h"20#include "mtu3_debug.h"
20#include "mtu3_trace.h"21#include "mtu3_trace.h"
21 22
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
162 req->bRequest = (val >> 8) & 0xFF;162 req->bRequest = (val >> 8) & 0xFF;
163 req->bRequestType = (val >> 0) & 0xFF;163 req->bRequestType = (val >> 0) & 0xFF;
164 164
165 req->wValue = usbhs_read(priv, USBVAL);165 req->wValue = cpu_to_le16(usbhs_read(priv, USBVAL));
166 req->wIndex = usbhs_read(priv, USBINDX);166 req->wIndex = cpu_to_le16(usbhs_read(priv, USBINDX));
167 req->wLength = usbhs_read(priv, USBLENG);167 req->wLength = cpu_to_le16(usbhs_read(priv, USBLENG));
168}168}
169 169
170void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)170void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
171{171{
172 usbhs_write(priv, USBREQ, (req->bRequest << 8) | req->bRequestType);172 usbhs_write(priv, USBREQ, (req->bRequest << 8) | req->bRequestType);
173 usbhs_write(priv, USBVAL, req->wValue);173 usbhs_write(priv, USBVAL, le16_to_cpu(req->wValue));
174 usbhs_write(priv, USBINDX, req->wIndex);174 usbhs_write(priv, USBINDX, le16_to_cpu(req->wIndex));
175 usbhs_write(priv, USBLENG, req->wLength);175 usbhs_write(priv, USBLENG, le16_to_cpu(req->wLength));
176 176
177 usbhs_bset(priv, DCPCTR, SUREQ, SUREQ);177 usbhs_bset(priv, DCPCTR, SUREQ, SUREQ);
178}178}
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
265 case USB_DEVICE_TEST_MODE:265 case USB_DEVICE_TEST_MODE:
266 usbhsg_recip_handler_std_control_done(priv, uep, ctrl);266 usbhsg_recip_handler_std_control_done(priv, uep, ctrl);
267 udelay(100);267 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);
269 break;269 break;
270 default:270 default:
271 usbhsg_recip_handler_std_control_done(priv, uep, ctrl);271 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
315 struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(dcp);315 struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(dcp);
316 struct device *dev = usbhsg_gpriv_to_dev(gpriv);316 struct device *dev = usbhsg_gpriv_to_dev(gpriv);
317 struct usb_request *req;317 struct usb_request *req;
318 unsigned short *buf;318 __le16 *buf;
319 319
320 /* alloc new usb_request for recip */320 /* alloc new usb_request for recip */
321 req = usb_ep_alloc_request(&dcp->ep, GFP_ATOMIC);321 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
559 559
560 command_port = port->serial->port[COMMAND_PORT];560 command_port = port->serial->port[COMMAND_PORT];
561 command_info = usb_get_serial_port_data(command_port);561 command_info = usb_get_serial_port_data(command_port);
562
563 if (command_port->bulk_out_size < datasize + 1)
564 return -EIO;
565
562 mutex_lock(&command_info->mutex);566 mutex_lock(&command_info->mutex);
563 command_info->command_finished = false;567 command_info->command_finished = false;
564 568
@@ -632,6 +636,7 @@ static void firm_setup_port(struct tty_struct *tty) · 67 unmodified lines
632 struct device *dev = &port->dev;636 struct device *dev = &port->dev;
633 struct whiteheat_port_settings port_settings;637 struct whiteheat_port_settings port_settings;
634 unsigned int cflag = tty->termios.c_cflag;638 unsigned int cflag = tty->termios.c_cflag;
639 speed_t baud;
635 640
636 port_settings.port = port->port_number + 1;641 port_settings.port = port->port_number + 1;
637 642
@@ -692,11 +697,13 @@ static void firm_setup_port(struct tty_struct *tty) · 54 unmodified lines
692 dev_dbg(dev, "%s - XON = %2x, XOFF = %2x\n", __func__, port_settings.xon, port_settings.xoff);697 dev_dbg(dev, "%s - XON = %2x, XOFF = %2x\n", __func__, port_settings.xon, port_settings.xoff);
693 698
694 /* get the baud rate wanted */699 /* get the baud rate wanted */
695 port_settings.baud = tty_get_baud_rate(tty);700 baud = tty_get_baud_rate(tty);
696 dev_dbg(dev, "%s - baud rate = %d\n", __func__, port_settings.baud);701 port_settings.baud = cpu_to_le32(baud);
702 dev_dbg(dev, "%s - baud rate = %u\n", __func__, baud);
697 703
698 /* fixme: should set validated settings */704 /* 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
700 /* handle any settings that aren't specified in the tty structure */707 /* handle any settings that aren't specified in the tty structure */
701 port_settings.lloop = 0;708 port_settings.lloop = 0;
702 709
drivers/usb/serial/whiteheat.h+1−1
@@ -87,7 +87,7 @@ struct whiteheat_simple { · 86 unmodified lines
87 87
88struct whiteheat_port_settings {88struct whiteheat_port_settings {
89 __u8 port; /* port number (1 to N) */89 __u8 port; /* port number (1 to N) */
90 __u32 baud; /* any value 7 - 460800, firmware calculates90 __le32 baud; /* any value 7 - 460800, firmware calculates
91 best fit; arrives little endian */91 best fit; arrives little endian */
92 __u8 bits; /* 5, 6, 7, or 8 */92 __u8 bits; /* 5, 6, 7, or 8 */
93 __u8 stop; /* 1 or 2, default 1 (2 = 1.5 if bits = 5) */93 __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
68static int slave_alloc (struct scsi_device *sdev)68static int slave_alloc (struct scsi_device *sdev)
69{69{
70 struct us_data *us = host_to_us(sdev->host);70 struct us_data *us = host_to_us(sdev->host);
71 int maxp;
72 71
73 /*72 /*
74 * Set the INQUIRY transfer length to 36. We don't use any of73 * 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
77 */76 */
78 sdev->inquiry_len = 36;77 sdev->inquiry_len = 36;
79 78
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
89 /*79 /*
90 * Some host controllers may have alignment requirements.80 * Some host controllers may have alignment requirements.
91 * We'll play it safe by requiring 512-byte alignment always.81 * 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
789{789{
790 struct uas_dev_info *devinfo =790 struct uas_dev_info *devinfo =
791 (struct uas_dev_info *)sdev->host->hostdata;791 (struct uas_dev_info *)sdev->host->hostdata;
792 int maxp;
793 792
794 sdev->hostdata = devinfo;793 sdev->hostdata = devinfo;
795 794
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
815 /*795 /*
816 * The protocol has no requirements on alignment in the strict sense.796 * The protocol has no requirements on alignment in the strict sense.
817 * Controllers may or may not have alignment restrictions.797 * 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
147 }147 }
148 148
149 kfree(iov);149 kfree(iov);
150 /* This is only for isochronous case */
150 kfree(iso_buffer);151 kfree(iso_buffer);
152 iso_buffer = NULL;
153
151 usbip_dbg_vhci_tx("send txdata\n");154 usbip_dbg_vhci_tx("send txdata\n");
152 155
153 total_size += txsize;156 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
852 return 0;852 return 0;
853}853}
854 854
855static inline int kern_xfer(void *dst, void *src, size_t len)
856{
857 memcpy(dst, src, len);
858 return 0;
859}
860
855/**861/**
856 * vringh_init_kern - initialize a vringh for a kernelspace vring.862 * vringh_init_kern - initialize a vringh for a kernelspace vring.
857 * @vrh: the vringh to initialize.863 * @vrh: the vringh to initialize.
@@ -958,7 +964,7 @@ EXPORT_SYMBOL(vringh_iov_pull_kern); · 100 unmodified lines
958ssize_t vringh_iov_push_kern(struct vringh_kiov *wiov,964ssize_t vringh_iov_push_kern(struct vringh_kiov *wiov,
959 const void *src, size_t len)965 const void *src, size_t len)
960{966{
961 return vringh_iov_xfer(wiov, (void *)src, len, xfer_kern);967 return vringh_iov_xfer(wiov, (void *)src, len, kern_xfer);
962}968}
963EXPORT_SYMBOL(vringh_iov_push_kern);969EXPORT_SYMBOL(vringh_iov_push_kern);
964 970
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
29 29
30extern void c2p_unsupported(void);30extern void c2p_unsupported(void);
31 31
32static inline u32 get_mask(unsigned int n)32static __always_inline u32 get_mask(unsigned int n)
33{33{
34 switch (n) {34 switch (n) {
35 case 1:35 case 1:
@@ -57,7 +57,7 @@ static inline u32 get_mask(unsigned int n) · 21 unmodified lines
57 * Transpose operations on 8 32-bit words57 * Transpose operations on 8 32-bit words
58 */58 */
59 59
60static inline void transp8(u32 d[], unsigned int n, unsigned int m)60static __always_inline void transp8(u32 d[], unsigned int n, unsigned int m)
61{61{
62 u32 mask = get_mask(n);62 u32 mask = get_mask(n);
63 63
@@ -99,7 +99,7 @@ static inline void transp8(u32 d[], unsigned int n, unsigned int m) · 35 unmodified lines
99 * Transpose operations on 4 32-bit words99 * Transpose operations on 4 32-bit words
100 */100 */
101 101
102static inline void transp4(u32 d[], unsigned int n, unsigned int m)102static __always_inline void transp4(u32 d[], unsigned int n, unsigned int m)
103{103{
104 u32 mask = get_mask(n);104 u32 mask = get_mask(n);
105 105
@@ -126,7 +126,7 @@ static inline void transp4(u32 d[], unsigned int n, unsigned int m) · 20 unmodified lines
126 * Transpose operations on 4 32-bit words (reverse order)126 * Transpose operations on 4 32-bit words (reverse order)
127 */127 */
128 128
129static inline void transp4x(u32 d[], unsigned int n, unsigned int m)129static __always_inline void transp4x(u32 d[], unsigned int n, unsigned int m)
130{130{
131 u32 mask = get_mask(n);131 u32 mask = get_mask(n);
132 132
drivers/virtio/virtio_ring.c+3−4
@@ -1499,9 +1499,6 @@ static bool virtqueue_enable_cb_delayed_packed(struct virtqueue *_vq) · 1498 unmodified lines
1499 * counter first before updating event flags.1499 * counter first before updating event flags.
1500 */1500 */
1501 virtio_wmb(vq->weak_barriers);1501 virtio_wmb(vq->weak_barriers);
1502 } else {
1503 used_idx = vq->last_used_idx;
1504 wrap_counter = vq->packed.used_wrap_counter;
1505 }1502 }
1506 1503
1507 if (vq->packed.event_flags_shadow == VRING_PACKED_EVENT_FLAG_DISABLE) {1504 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
1518 */1515 */
1519 virtio_mb(vq->weak_barriers);1516 virtio_mb(vq->weak_barriers);
1520 1517
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)) {
1522 END_USE(vq);1521 END_USE(vq);
1523 return false;1522 return false;
1524 }1523 }
drivers/watchdog/bd70528_wdt.c+1−0
@@ -288,3 +288,4 @@ module_platform_driver(bd70528_wdt); · 287 unmodified lines
288MODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>");288MODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>");
289MODULE_DESCRIPTION("BD70528 watchdog driver");289MODULE_DESCRIPTION("BD70528 watchdog driver");
290MODULE_LICENSE("GPL");290MODULE_LICENSE("GPL");
291MODULE_ALIAS("platform:bd70528-wdt");
drivers/watchdog/cpwd.c+7−1
@@ -26,6 +26,7 @@ · 25 unmodified lines
26#include <linux/interrupt.h>26#include <linux/interrupt.h>
27#include <linux/ioport.h>27#include <linux/ioport.h>
28#include <linux/timer.h>28#include <linux/timer.h>
29#include <linux/compat.h>
29#include <linux/slab.h>30#include <linux/slab.h>
30#include <linux/mutex.h>31#include <linux/mutex.h>
31#include <linux/io.h>32#include <linux/io.h>
@@ -473,6 +474,11 @@ static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · 441 unmodified lines
473 return 0;474 return 0;
474}475}
475 476
477static 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
476static ssize_t cpwd_write(struct file *file, const char __user *buf,482static ssize_t cpwd_write(struct file *file, const char __user *buf,
477 size_t count, loff_t *ppos)483 size_t count, loff_t *ppos)
478{484{
@@ -497,7 +503,7 @@ static ssize_t cpwd_read(struct file *file, char __user *buffer, · 18 unmodified lines
497static const struct file_operations cpwd_fops = {503static const struct file_operations cpwd_fops = {
498 .owner = THIS_MODULE,504 .owner = THIS_MODULE,
499 .unlocked_ioctl = cpwd_ioctl,505 .unlocked_ioctl = cpwd_ioctl,
500 .compat_ioctl = compat_ptr_ioctl,506 .compat_ioctl = cpwd_compat_ioctl,
501 .open = cpwd_open,507 .open = cpwd_open,
502 .write = cpwd_write,508 .write = cpwd_write,
503 .read = cpwd_read,509 .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
99{99{
100 struct arm_smccc_res res;100 struct arm_smccc_res res;
101 101
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 */
102 arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_PRETIME_WDOG,107 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);
104 if (res.a0)110 if (res.a0)
105 return -EACCES;111 return -EACCES;
106 112
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
89 89
90 reg = readl(data->reg_base + GXBB_WDT_TCNT_REG);90 reg = readl(data->reg_base + GXBB_WDT_TCNT_REG);
91 91
92 return ((reg >> GXBB_WDT_TCNT_CNT_SHIFT) -92 return ((reg & GXBB_WDT_TCNT_SETUP_MASK) -
93 (reg & GXBB_WDT_TCNT_SETUP_MASK)) / 1000;93 (reg >> GXBB_WDT_TCNT_CNT_SHIFT)) / 1000;
94}94}
95 95
96static const struct watchdog_ops meson_gxbb_wdt_ops = {96static 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
163 163
164 irq = platform_get_irq(pdev, 0);164 irq = platform_get_irq(pdev, 0);
165 if (irq > 0) {165 if (irq > 0) {
166 if (devm_request_irq(dev, irq, pm8916_wdt_isr, 0, "pm8916_wdt",166 err = devm_request_irq(dev, irq, pm8916_wdt_isr, 0,
167 wdt))167 "pm8916_wdt", wdt);
168 irq = 0;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;
169 }177 }
170 178
171 /* Configure watchdog to hard-reset mode */179 /* Configure watchdog to hard-reset mode */
@@ -177,7 +185,6 @@ static int pm8916_wdt_probe(struct platform_device *pdev) · 5 unmodified lines
177 return err;185 return err;
178 }186 }
179 187
180 wdt->wdev.info = (irq > 0) ? &pm8916_wdt_pt_ident : &pm8916_wdt_ident,
181 wdt->wdev.ops = &pm8916_wdt_ops,188 wdt->wdev.ops = &pm8916_wdt_ops,
182 wdt->wdev.parent = dev;189 wdt->wdev.parent = dev;
183 wdt->wdev.min_timeout = PM8916_WDT_MIN_TIMEOUT;190 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
474 u64 start = async_chunk->start;474 u64 start = async_chunk->start;
475 u64 end = async_chunk->end;475 u64 end = async_chunk->end;
476 u64 actual_end;476 u64 actual_end;
477 u64 i_size;
477 int ret = 0;478 int ret = 0;
478 struct page **pages = NULL;479 struct page **pages = NULL;
479 unsigned long nr_pages;480 unsigned long nr_pages;
@@ -488,7 +489,19 @@ static noinline int compress_file_range(struct async_chunk *async_chunk) · 8 unmodified lines
488 inode_should_defrag(BTRFS_I(inode), start, end, end - start + 1,489 inode_should_defrag(BTRFS_I(inode), start, end, end - start + 1,
489 SZ_16K);490 SZ_16K);
490 491
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);
492again:505again:
493 will_compress = 0;506 will_compress = 0;
494 nr_pages = (end >> PAGE_SHIFT) - (start >> PAGE_SHIFT) + 1;507 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
4195 u64 transid;4195 u64 transid;
4196 int ret;4196 int ret;
4197 4197
4198 btrfs_warn(root->fs_info,
4199 "START_SYNC ioctl is deprecated and will be removed in kernel 5.7");
4200
4201 trans = btrfs_attach_transaction_barrier(root);4198 trans = btrfs_attach_transaction_barrier(root);
4202 if (IS_ERR(trans)) {4199 if (IS_ERR(trans)) {
4203 if (PTR_ERR(trans) != -ENOENT)4200 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
4225{4222{
4226 u64 transid;4223 u64 transid;
4227 4224
4228 btrfs_warn(fs_info,
4229 "WAIT_SYNC ioctl is deprecated and will be removed in kernel 5.7");
4230
4231 if (argp) {4225 if (argp) {
4232 if (copy_from_user(&transid, argp, sizeof(transid)))4226 if (copy_from_user(&transid, argp, sizeof(transid)))
4233 return -EFAULT;4227 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
893 while (ticket->bytes > 0 && ticket->error == 0) {893 while (ticket->bytes > 0 && ticket->error == 0) {
894 ret = prepare_to_wait_event(&ticket->wait, &wait, TASK_KILLABLE);894 ret = prepare_to_wait_event(&ticket->wait, &wait, TASK_KILLABLE);
895 if (ret) {895 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);
896 ticket->error = -EINTR;905 ticket->error = -EINTR;
897 break;906 break;
898 }907 }
@@ -945,12 +954,24 @@ static int handle_reserve_ticket(struct btrfs_fs_info *fs_info, · 46 unmodified lines
945 spin_lock(&space_info->lock);954 spin_lock(&space_info->lock);
946 ret = ticket->error;955 ret = ticket->error;
947 if (ticket->bytes || ticket->error) {956 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 */
948 list_del_init(&ticket->list);962 list_del_init(&ticket->list);
949 if (!ret)963 if (!ret)
950 ret = -ENOSPC;964 ret = -ENOSPC;
951 }965 }
952 spin_unlock(&space_info->lock);966 spin_unlock(&space_info->lock);
953 ASSERT(list_empty(&ticket->list));967 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));
954 return ret;975 return ret;
955}976}
956 977
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
686static int check_dev_item(struct extent_buffer *leaf,686static int check_dev_item(struct extent_buffer *leaf,
687 struct btrfs_key *key, int slot)687 struct btrfs_key *key, int slot)
688{688{
689 struct btrfs_fs_info *fs_info = leaf->fs_info;
690 struct btrfs_dev_item *ditem;689 struct btrfs_dev_item *ditem;
691 u64 max_devid = max(BTRFS_MAX_DEVS(fs_info), BTRFS_MAX_DEVS_SYS_CHUNK);
692 690
693 if (key->objectid != BTRFS_DEV_ITEMS_OBJECTID) {691 if (key->objectid != BTRFS_DEV_ITEMS_OBJECTID) {
694 dev_item_err(leaf, slot,692 dev_item_err(leaf, slot,
@@ -696,12 +694,6 @@ static int check_dev_item(struct extent_buffer *leaf, · 1 unmodified line
696 key->objectid, BTRFS_DEV_ITEMS_OBJECTID);694 key->objectid, BTRFS_DEV_ITEMS_OBJECTID);
697 return -EUCLEAN;695 return -EUCLEAN;
698 }696 }
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 }
705 ditem = btrfs_item_ptr(leaf, slot, struct btrfs_dev_item);697 ditem = btrfs_item_ptr(leaf, slot, struct btrfs_dev_item);
706 if (btrfs_device_id(leaf, ditem) != key->offset) {698 if (btrfs_device_id(leaf, ditem) != key->offset) {
707 dev_item_err(leaf, slot,699 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
4967 } else if (type & BTRFS_BLOCK_GROUP_SYSTEM) {4967 } else if (type & BTRFS_BLOCK_GROUP_SYSTEM) {
4968 max_stripe_size = SZ_32M;4968 max_stripe_size = SZ_32M;
4969 max_chunk_size = 2 * max_stripe_size;4969 max_chunk_size = 2 * max_stripe_size;
4970 devs_max = min_t(int, devs_max, BTRFS_MAX_DEVS_SYS_CHUNK);
4970 } else {4971 } else {
4971 btrfs_err(info, "invalid chunk type 0x%llx requested",4972 btrfs_err(info, "invalid chunk type 0x%llx requested",
4972 type);4973 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
1058 1058
1059 dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode);1059 dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode);
1060 1060
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
1061 /* remove from session list */1066 /* remove from session list */
1062 spin_lock(&session->s_cap_lock);1067 spin_lock(&session->s_cap_lock);
1063 if (session->s_cap_iterator == cap) {1068 if (session->s_cap_iterator == cap) {
@@ -1091,11 +1096,6 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release) · 27 unmodified lines
1091 1096
1092 spin_unlock(&session->s_cap_lock);1097 spin_unlock(&session->s_cap_lock);
1093 1098
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
1099 if (removed)1099 if (removed)
1100 ceph_put_cap(mdsc, cap);1100 ceph_put_cap(mdsc, cap);
1101 1101
fs/ceph/dir.c+8−7
@@ -1553,36 +1553,37 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags) · 1552 unmodified lines
1553{1553{
1554 int valid = 0;1554 int valid = 0;
1555 struct dentry *parent;1555 struct dentry *parent;
1556 struct inode *dir;1556 struct inode *dir, *inode;
1557 1557
1558 if (flags & LOOKUP_RCU) {1558 if (flags & LOOKUP_RCU) {
1559 parent = READ_ONCE(dentry->d_parent);1559 parent = READ_ONCE(dentry->d_parent);
1560 dir = d_inode_rcu(parent);1560 dir = d_inode_rcu(parent);
1561 if (!dir)1561 if (!dir)
1562 return -ECHILD;1562 return -ECHILD;
1563 inode = d_inode_rcu(dentry);
1563 } else {1564 } else {
1564 parent = dget_parent(dentry);1565 parent = dget_parent(dentry);
1565 dir = d_inode(parent);1566 dir = d_inode(parent);
1567 inode = d_inode(dentry);
1566 }1568 }
1567 1569
1568 dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry,1570 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);
1570 1572
1571 /* always trust cached snapped dentries, snapdir dentry */1573 /* always trust cached snapped dentries, snapdir dentry */
1572 if (ceph_snap(dir) != CEPH_NOSNAP) {1574 if (ceph_snap(dir) != CEPH_NOSNAP) {
1573 dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry,1575 dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry,
1574 dentry, d_inode(dentry));1576 dentry, inode);
1575 valid = 1;1577 valid = 1;
1576 } else if (d_really_is_positive(dentry) &&1578 } else if (inode && ceph_snap(inode) == CEPH_SNAPDIR) {
1577 ceph_snap(d_inode(dentry)) == CEPH_SNAPDIR) {
1578 valid = 1;1579 valid = 1;
1579 } else {1580 } else {
1580 valid = dentry_lease_is_valid(dentry, flags);1581 valid = dentry_lease_is_valid(dentry, flags);
1581 if (valid == -ECHILD)1582 if (valid == -ECHILD)
1582 return valid;1583 return valid;
1583 if (valid || dir_lease_is_valid(dir, dentry)) {1584 if (valid || dir_lease_is_valid(dir, dentry)) {
1584 if (d_really_is_positive(dentry))1585 if (inode)
1585 valid = ceph_is_any_caps(d_inode(dentry));1586 valid = ceph_is_any_caps(inode);
1586 else1587 else
1587 valid = 1;1588 valid = 1;
1588 }1589 }
fs/ceph/file.c+13−2
@@ -462,6 +462,9 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry, · 461 unmodified lines
462 err = ceph_security_init_secctx(dentry, mode, &as_ctx);462 err = ceph_security_init_secctx(dentry, mode, &as_ctx);
463 if (err < 0)463 if (err < 0)
464 goto out_ctx;464 goto out_ctx;
465 } else if (!d_in_lookup(dentry)) {
466 /* If it's not being looked up, it's negative */
467 return -ENOENT;
465 }468 }
466 469
467 /* do the open */470 /* 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
1956 if (ceph_test_mount_opt(src_fsc, NOCOPYFROM))1959 if (ceph_test_mount_opt(src_fsc, NOCOPYFROM))
1957 return -EOPNOTSUPP;1960 return -EOPNOTSUPP;
1958 1961
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 */
1959 if ((src_ci->i_layout.stripe_unit != dst_ci->i_layout.stripe_unit) ||1967 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) ||1968 (src_ci->i_layout.stripe_count != 1) ||
1961 (src_ci->i_layout.object_size != dst_ci->i_layout.object_size))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");
1962 return -EOPNOTSUPP;1972 return -EOPNOTSUPP;
1973 }
1963 1974
1964 if (len < src_ci->i_layout.object_size)1975 if (len < src_ci->i_layout.object_size)
1965 return -EOPNOTSUPP; /* no remote copy will be done */1976 return -EOPNOTSUPP; /* no remote copy will be done */
fs/ceph/inode.c+1−0
@@ -1434,6 +1434,7 @@ retry_lookup: · 1433 unmodified lines
1434 dout(" final dn %p\n", dn);1434 dout(" final dn %p\n", dn);
1435 } else if ((req->r_op == CEPH_MDS_OP_LOOKUPSNAP ||1435 } else if ((req->r_op == CEPH_MDS_OP_LOOKUPSNAP ||
1436 req->r_op == CEPH_MDS_OP_MKSNAP) &&1436 req->r_op == CEPH_MDS_OP_MKSNAP) &&
1437 test_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags) &&
1437 !test_bit(CEPH_MDS_R_ABORTED, &req->r_req_flags)) {1438 !test_bit(CEPH_MDS_R_ABORTED, &req->r_req_flags)) {
1438 struct inode *dir = req->r_parent;1439 struct inode *dir = req->r_parent;
1439 1440
fs/ceph/super.c+10−1
@@ -268,6 +268,7 @@ static int parse_fsopt_token(char *c, void *private) · 267 unmodified lines
268 }268 }
269 break;269 break;
270 case Opt_fscache_uniq:270 case Opt_fscache_uniq:
271#ifdef CONFIG_CEPH_FSCACHE
271 kfree(fsopt->fscache_uniq);272 kfree(fsopt->fscache_uniq);
272 fsopt->fscache_uniq = kstrndup(argstr[0].from,273 fsopt->fscache_uniq = kstrndup(argstr[0].from,
273 argstr[0].to-argstr[0].from,274 argstr[0].to-argstr[0].from,
@@ -276,7 +277,10 @@ static int parse_fsopt_token(char *c, void *private) · 2 unmodified lines
276 return -ENOMEM;277 return -ENOMEM;
277 fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE;278 fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE;
278 break;279 break;
279 /* misc */280#else
281 pr_err("fscache support is disabled\n");
282 return -EINVAL;
283#endif
280 case Opt_wsize:284 case Opt_wsize:
281 if (intval < (int)PAGE_SIZE || intval > CEPH_MAX_WRITE_SIZE)285 if (intval < (int)PAGE_SIZE || intval > CEPH_MAX_WRITE_SIZE)
282 return -EINVAL;286 return -EINVAL;
@@ -353,10 +357,15 @@ static int parse_fsopt_token(char *c, void *private) · 70 unmodified lines
353 fsopt->flags &= ~CEPH_MOUNT_OPT_INO32;357 fsopt->flags &= ~CEPH_MOUNT_OPT_INO32;
354 break;358 break;
355 case Opt_fscache:359 case Opt_fscache:
360#ifdef CONFIG_CEPH_FSCACHE
356 fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE;361 fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE;
357 kfree(fsopt->fscache_uniq);362 kfree(fsopt->fscache_uniq);
358 fsopt->fscache_uniq = NULL;363 fsopt->fscache_uniq = NULL;
359 break;364 break;
365#else
366 pr_err("fscache support is disabled\n");
367 return -EINVAL;
368#endif
360 case Opt_nofscache:369 case Opt_nofscache:
361 fsopt->flags &= ~CEPH_MOUNT_OPT_FSCACHE;370 fsopt->flags &= ~CEPH_MOUNT_OPT_FSCACHE;
362 kfree(fsopt->fscache_uniq);371 kfree(fsopt->fscache_uniq);
fs/cifs/smb2ops.c+2−1
@@ -4084,6 +4084,7 @@ free_pages: · 4083 unmodified lines
4084 4084
4085 kfree(dw->ppages);4085 kfree(dw->ppages);
4086 cifs_small_buf_release(dw->buf);4086 cifs_small_buf_release(dw->buf);
4087 kfree(dw);
4087}4088}
4088 4089
4089 4090
@@ -4157,7 +4158,7 @@ receive_encrypted_read(struct TCP_Server_Info *server, struct mid_q_entry **mid, · 67 unmodified lines
4157 dw->server = server;4158 dw->server = server;
4158 dw->ppages = pages;4159 dw->ppages = pages;
4159 dw->len = len;4160 dw->len = len;
4160 queue_work(cifsiod_wq, &dw->decrypt);4161 queue_work(decrypt_wq, &dw->decrypt);
4161 *num_mids = 0; /* worker thread takes care of finding mid */4162 *num_mids = 0; /* worker thread takes care of finding mid */
4162 return -1;4163 return -1;
4163 }4164 }
fs/cifs/smb2pdu.h+1−0
@@ -838,6 +838,7 @@ struct create_durable_handle_reconnect_v2 { · 837 unmodified lines
838 struct create_context ccontext;838 struct create_context ccontext;
839 __u8 Name[8];839 __u8 Name[8];
840 struct durable_reconnect_context_v2 dcontext;840 struct durable_reconnect_context_v2 dcontext;
841 __u8 Pad[4];
841} __packed;842} __packed;
842 843
843/* See MS-SMB2 2.2.13.2.5 */844/* 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
101 }101 }
102 target_sd->s_links++;102 target_sd->s_links++;
103 spin_unlock(&configfs_dirent_lock);103 spin_unlock(&configfs_dirent_lock);
104 ret = configfs_get_target_path(item, item, body);104 ret = configfs_get_target_path(parent_item, item, body);
105 if (!ret)105 if (!ret)
106 ret = configfs_create_link(target_sd, parent_item->ci_dentry,106 ret = configfs_create_link(target_sd, parent_item->ci_dentry,
107 dentry, body);107 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
576 spin_unlock(&inode->i_lock);576 spin_unlock(&inode->i_lock);
577 577
578 /*578 /*
579 * A dying wb indicates that the memcg-blkcg mapping has changed579 * A dying wb indicates that either the blkcg associated with the
580 * and a new wb is already serving the memcg. Switch immediately.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.
581 */584 */
582 if (unlikely(wb_dying(wbc->wb)))585 if (unlikely(wb_dying(wbc->wb) && !css_is_dying(wbc->wb->memcg_css)))
583 inode_switch_wbs(inode, wbc->wb_id);586 inode_switch_wbs(inode, wbc->wb_id);
584}587}
585EXPORT_SYMBOL_GPL(wbc_attach_and_unlock_inode);588EXPORT_SYMBOL_GPL(wbc_attach_and_unlock_inode);
fs/fuse/Makefile+2−1
@@ -5,6 +5,7 @@ · 4 unmodified lines
5 5
6obj-$(CONFIG_FUSE_FS) += fuse.o6obj-$(CONFIG_FUSE_FS) += fuse.o
7obj-$(CONFIG_CUSE) += cuse.o7obj-$(CONFIG_CUSE) += cuse.o
8obj-$(CONFIG_VIRTIO_FS) += virtio_fs.o8obj-$(CONFIG_VIRTIO_FS) += virtiofs.o
9 9
10fuse-objs := dev.o dir.o file.o inode.o control.o xattr.o acl.o readdir.o10fuse-objs := dev.o dir.o file.o inode.o control.o xattr.o acl.o readdir.o
11virtiofs-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
276void fuse_request_end(struct fuse_conn *fc, struct fuse_req *req)276void fuse_request_end(struct fuse_conn *fc, struct fuse_req *req)
277{277{
278 struct fuse_iqueue *fiq = &fc->iq;278 struct fuse_iqueue *fiq = &fc->iq;
279 bool async = req->args->end;279 bool async;
280 280
281 if (test_and_set_bit(FR_FINISHED, &req->flags))281 if (test_and_set_bit(FR_FINISHED, &req->flags))
282 goto put_request;282 goto put_request;
283
284 async = req->args->end;
283 /*285 /*
284 * test_and_set_bit() implies smp_mb() between bit286 * test_and_set_bit() implies smp_mb() between bit
285 * changing and below intr_entry check. Pairs with287 * 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
405 else405 else
406 fuse_invalidate_entry_cache(entry);406 fuse_invalidate_entry_cache(entry);
407 407
408 fuse_advise_use_readdirplus(dir);408 if (inode)
409 fuse_advise_use_readdirplus(dir);
409 return newent;410 return newent;
410 411
411 out_iput:412 out_iput:
@@ -1521,6 +1522,19 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr, · 1109 unmodified lines
1521 is_truncate = true;1522 is_truncate = true;
1522 }1523 }
1523 1524
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
1524 if (is_truncate) {1538 if (is_truncate) {
1525 fuse_set_nowrite(inode);1539 fuse_set_nowrite(inode);
1526 set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);1540 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
217{217{
218 struct fuse_conn *fc = get_fuse_conn(inode);218 struct fuse_conn *fc = get_fuse_conn(inode);
219 int err;219 int err;
220 bool lock_inode = (file->f_flags & O_TRUNC) &&220 bool is_wb_truncate = (file->f_flags & O_TRUNC) &&
221 fc->atomic_o_trunc &&221 fc->atomic_o_trunc &&
222 fc->writeback_cache;222 fc->writeback_cache;
223 223
@@ -225,16 +225,20 @@ int fuse_open_common(struct inode *inode, struct file *file, bool isdir) · 1 unmodified line
225 if (err)225 if (err)
226 return err;226 return err;
227 227
228 if (lock_inode)228 if (is_wb_truncate) {
229 inode_lock(inode);229 inode_lock(inode);
230 fuse_set_nowrite(inode);
231 }
230 232
231 err = fuse_do_open(fc, get_node_id(inode), file, isdir);233 err = fuse_do_open(fc, get_node_id(inode), file, isdir);
232 234
233 if (!err)235 if (!err)
234 fuse_finish_open(inode, file);236 fuse_finish_open(inode, file);
235 237
236 if (lock_inode)238 if (is_wb_truncate) {
239 fuse_release_nowrite(inode);
237 inode_unlock(inode);240 inode_unlock(inode);
241 }
238 242
239 return err;243 return err;
240}244}
@@ -1997,7 +2001,7 @@ static int fuse_writepages_fill(struct page *page, · 1756 unmodified lines
1997 2001
1998 if (!data->ff) {2002 if (!data->ff) {
1999 err = -EIO;2003 err = -EIO;
2000 data->ff = fuse_write_file_get(fc, get_fuse_inode(inode));2004 data->ff = fuse_write_file_get(fc, fi);
2001 if (!data->ff)2005 if (!data->ff)
2002 goto out_unlock;2006 goto out_unlock;
2003 }2007 }
@@ -2042,8 +2046,6 @@ static int fuse_writepages_fill(struct page *page, · 38 unmodified lines
2042 * under writeback, so we can release the page lock.2046 * under writeback, so we can release the page lock.
2043 */2047 */
2044 if (data->wpa == NULL) {2048 if (data->wpa == NULL) {
2045 struct fuse_inode *fi = get_fuse_inode(inode);
2046
2047 err = -ENOMEM;2049 err = -ENOMEM;
2048 wpa = fuse_writepage_args_alloc();2050 wpa = fuse_writepage_args_alloc();
2049 if (!wpa) {2051 if (!wpa) {
fs/fuse/fuse_i.h+4−0
@@ -479,6 +479,7 @@ struct fuse_fs_context { · 478 unmodified lines
479 bool destroy:1;479 bool destroy:1;
480 bool no_control:1;480 bool no_control:1;
481 bool no_force_umount:1;481 bool no_force_umount:1;
482 bool no_mount_options:1;
482 unsigned int max_read;483 unsigned int max_read;
483 unsigned int blksize;484 unsigned int blksize;
484 const char *subtype;485 const char *subtype;
@@ -713,6 +714,9 @@ struct fuse_conn { · 228 unmodified lines
713 /** Do not allow MNT_FORCE umount */714 /** Do not allow MNT_FORCE umount */
714 unsigned int no_force_umount:1;715 unsigned int no_force_umount:1;
715 716
717 /* Do not show mount options */
718 unsigned int no_mount_options:1;
719
716 /** The number of requests waiting for completion */720 /** The number of requests waiting for completion */
717 atomic_t num_waiting;721 atomic_t num_waiting;
718 722
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
558 struct super_block *sb = root->d_sb;558 struct super_block *sb = root->d_sb;
559 struct fuse_conn *fc = get_fuse_conn_super(sb);559 struct fuse_conn *fc = get_fuse_conn_super(sb);
560 560
561 if (fc->no_mount_options)
562 return 0;
563
561 seq_printf(m, ",user_id=%u", from_kuid_munged(fc->user_ns, fc->user_id));564 seq_printf(m, ",user_id=%u", from_kuid_munged(fc->user_ns, fc->user_id));
562 seq_printf(m, ",group_id=%u", from_kgid_munged(fc->user_ns, fc->group_id));565 seq_printf(m, ",group_id=%u", from_kgid_munged(fc->user_ns, fc->group_id));
563 if (fc->default_permissions)566 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
1180 fc->destroy = ctx->destroy;1183 fc->destroy = ctx->destroy;
1181 fc->no_control = ctx->no_control;1184 fc->no_control = ctx->no_control;
1182 fc->no_force_umount = ctx->no_force_umount;1185 fc->no_force_umount = ctx->no_force_umount;
1186 fc->no_mount_options = ctx->no_mount_options;
1183 1187
1184 err = -ENOMEM;1188 err = -ENOMEM;
1185 root = fuse_get_root_inode(sb, ctx->rootmode);1189 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
30 struct virtqueue *vq; /* protected by ->lock */30 struct virtqueue *vq; /* protected by ->lock */
31 struct work_struct done_work;31 struct work_struct done_work;
32 struct list_head queued_reqs;32 struct list_head queued_reqs;
33 struct list_head end_reqs; /* End these requests */
33 struct delayed_work dispatch_work;34 struct delayed_work dispatch_work;
34 struct fuse_dev *fud;35 struct fuse_dev *fud;
35 bool connected;36 bool connected;
@@ -54,6 +55,9 @@ struct virtio_fs_forget { · 18 unmodified lines
54 struct list_head list;55 struct list_head list;
55};56};
56 57
58static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq,
59 struct fuse_req *req, bool in_flight);
60
57static inline struct virtio_fs_vq *vq_to_fsvq(struct virtqueue *vq)61static inline struct virtio_fs_vq *vq_to_fsvq(struct virtqueue *vq)
58{62{
59 struct virtio_fs *fs = vq->vdev->priv;63 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
66 return &vq_to_fsvq(vq)->fud->pq;70 return &vq_to_fsvq(vq)->fud->pq;
67}71}
68 72
73/* Should be called with fsvq->lock held. */
74static 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. */
80static 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
69static void release_virtio_fs_obj(struct kref *ref)86static void release_virtio_fs_obj(struct kref *ref)
70{87{
71 struct virtio_fs *vfs = container_of(ref, struct virtio_fs, refcount);88 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
109 flush_delayed_work(&fsvq->dispatch_work);126 flush_delayed_work(&fsvq->dispatch_work);
110}127}
111 128
112static 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
128static void virtio_fs_drain_all_queues(struct virtio_fs *fs)129static void virtio_fs_drain_all_queues(struct virtio_fs *fs)
129{130{
130 struct virtio_fs_vq *fsvq;131 struct virtio_fs_vq *fsvq;
@@ -132,9 +133,6 @@ static void virtio_fs_drain_all_queues(struct virtio_fs *fs) · 1 unmodified line
132 133
133 for (i = 0; i < fs->nvqs; i++) {134 for (i = 0; i < fs->nvqs; i++) {
134 fsvq = &fs->vqs[i];135 fsvq = &fs->vqs[i];
135 if (i == VQ_HIPRIO)
136 drain_hiprio_queued_reqs(fsvq);
137
138 virtio_fs_drain_queue(fsvq);136 virtio_fs_drain_queue(fsvq);
139 }137 }
140}138}
@@ -253,14 +251,66 @@ static void virtio_fs_hiprio_done_work(struct work_struct *work) · 112 unmodified lines
253 251
254 while ((req = virtqueue_get_buf(vq, &len)) != NULL) {252 while ((req = virtqueue_get_buf(vq, &len)) != NULL) {
255 kfree(req);253 kfree(req);
256 fsvq->in_flight--;254 dec_in_flight_req(fsvq);
257 }255 }
258 } while (!virtqueue_enable_cb(vq) && likely(!virtqueue_is_broken(vq)));256 } while (!virtqueue_enable_cb(vq) && likely(!virtqueue_is_broken(vq)));
259 spin_unlock(&fsvq->lock);257 spin_unlock(&fsvq->lock);
260}258}
261 259
262static void virtio_fs_dummy_dispatch_work(struct work_struct *work)260static void virtio_fs_request_dispatch_work(struct work_struct *work)
263{261{
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 }
264}314}
265 315
266static void virtio_fs_hiprio_dispatch_work(struct work_struct *work)316static 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
286 336
287 list_del(&forget->list);337 list_del(&forget->list);
288 if (!fsvq->connected) {338 if (!fsvq->connected) {
339 dec_in_flight_req(fsvq);
289 spin_unlock(&fsvq->lock);340 spin_unlock(&fsvq->lock);
290 kfree(forget);341 kfree(forget);
291 continue;342 continue;
@@ -307,13 +358,13 @@ static void virtio_fs_hiprio_dispatch_work(struct work_struct *work) · 15 unmodified lines
307 } else {358 } else {
308 pr_debug("virtio-fs: Could not queue FORGET: err=%d. Dropping it.\n",359 pr_debug("virtio-fs: Could not queue FORGET: err=%d. Dropping it.\n",
309 ret);360 ret);
361 dec_in_flight_req(fsvq);
310 kfree(forget);362 kfree(forget);
311 }363 }
312 spin_unlock(&fsvq->lock);364 spin_unlock(&fsvq->lock);
313 return;365 return;
314 }366 }
315 367
316 fsvq->in_flight++;
317 notify = virtqueue_kick_prepare(vq);368 notify = virtqueue_kick_prepare(vq);
318 spin_unlock(&fsvq->lock);369 spin_unlock(&fsvq->lock);
319 370
@@ -452,7 +503,7 @@ static void virtio_fs_requests_done_work(struct work_struct *work) · 132 unmodified lines
452 503
453 fuse_request_end(fc, req);504 fuse_request_end(fc, req);
454 spin_lock(&fsvq->lock);505 spin_lock(&fsvq->lock);
455 fsvq->in_flight--;506 dec_in_flight_req(fsvq);
456 spin_unlock(&fsvq->lock);507 spin_unlock(&fsvq->lock);
457 }508 }
458}509}
@@ -502,6 +553,7 @@ static int virtio_fs_setup_vqs(struct virtio_device *vdev, · 43 unmodified lines
502 names[VQ_HIPRIO] = fs->vqs[VQ_HIPRIO].name;553 names[VQ_HIPRIO] = fs->vqs[VQ_HIPRIO].name;
503 INIT_WORK(&fs->vqs[VQ_HIPRIO].done_work, virtio_fs_hiprio_done_work);554 INIT_WORK(&fs->vqs[VQ_HIPRIO].done_work, virtio_fs_hiprio_done_work);
504 INIT_LIST_HEAD(&fs->vqs[VQ_HIPRIO].queued_reqs);555 INIT_LIST_HEAD(&fs->vqs[VQ_HIPRIO].queued_reqs);
556 INIT_LIST_HEAD(&fs->vqs[VQ_HIPRIO].end_reqs);
505 INIT_DELAYED_WORK(&fs->vqs[VQ_HIPRIO].dispatch_work,557 INIT_DELAYED_WORK(&fs->vqs[VQ_HIPRIO].dispatch_work,
506 virtio_fs_hiprio_dispatch_work);558 virtio_fs_hiprio_dispatch_work);
507 spin_lock_init(&fs->vqs[VQ_HIPRIO].lock);559 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
511 spin_lock_init(&fs->vqs[i].lock);563 spin_lock_init(&fs->vqs[i].lock);
512 INIT_WORK(&fs->vqs[i].done_work, virtio_fs_requests_done_work);564 INIT_WORK(&fs->vqs[i].done_work, virtio_fs_requests_done_work);
513 INIT_DELAYED_WORK(&fs->vqs[i].dispatch_work,565 INIT_DELAYED_WORK(&fs->vqs[i].dispatch_work,
514 virtio_fs_dummy_dispatch_work);566 virtio_fs_request_dispatch_work);
515 INIT_LIST_HEAD(&fs->vqs[i].queued_reqs);567 INIT_LIST_HEAD(&fs->vqs[i].queued_reqs);
568 INIT_LIST_HEAD(&fs->vqs[i].end_reqs);
516 snprintf(fs->vqs[i].name, sizeof(fs->vqs[i].name),569 snprintf(fs->vqs[i].name, sizeof(fs->vqs[i].name),
517 "requests.%u", i - VQ_REQUEST);570 "requests.%u", i - VQ_REQUEST);
518 callbacks[i] = virtio_fs_vq_done;571 callbacks[i] = virtio_fs_vq_done;
@@ -708,6 +761,7 @@ __releases(fiq->lock) · 189 unmodified lines
708 list_add_tail(&forget->list, &fsvq->queued_reqs);761 list_add_tail(&forget->list, &fsvq->queued_reqs);
709 schedule_delayed_work(&fsvq->dispatch_work,762 schedule_delayed_work(&fsvq->dispatch_work,
710 msecs_to_jiffies(1));763 msecs_to_jiffies(1));
764 inc_in_flight_req(fsvq);
711 } else {765 } else {
712 pr_debug("virtio-fs: Could not queue FORGET: err=%d. Dropping it.\n",766 pr_debug("virtio-fs: Could not queue FORGET: err=%d. Dropping it.\n",
713 ret);767 ret);
@@ -717,7 +771,7 @@ __releases(fiq->lock) · 3 unmodified lines
717 goto out;771 goto out;
718 }772 }
719 773
720 fsvq->in_flight++;774 inc_in_flight_req(fsvq);
721 notify = virtqueue_kick_prepare(vq);775 notify = virtqueue_kick_prepare(vq);
722 776
723 spin_unlock(&fsvq->lock);777 spin_unlock(&fsvq->lock);
@@ -819,7 +873,7 @@ static unsigned int sg_init_fuse_args(struct scatterlist *sg, · 95 unmodified lines
819 873
820/* Add a request to a virtqueue and kick the device */874/* Add a request to a virtqueue and kick the device */
821static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq,875static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq,
822 struct fuse_req *req)876 struct fuse_req *req, bool in_flight)
823{877{
824 /* requests need at least 4 elements */878 /* requests need at least 4 elements */
825 struct scatterlist *stack_sgs[6];879 struct scatterlist *stack_sgs[6];
@@ -835,6 +889,7 @@ static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq, · 9 unmodified lines
835 unsigned int i;889 unsigned int i;
836 int ret;890 int ret;
837 bool notify;891 bool notify;
892 struct fuse_pqueue *fpq;
838 893
839 /* Does the sglist fit on the stack? */894 /* Does the sglist fit on the stack? */
840 total_sgs = sg_count_fuse_req(req);895 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
889 goto out;944 goto out;
890 }945 }
891 946
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);
893 notify = virtqueue_kick_prepare(vq);958 notify = virtqueue_kick_prepare(vq);
894 959
895 spin_unlock(&fsvq->lock);960 spin_unlock(&fsvq->lock);
@@ -915,9 +980,8 @@ __releases(fiq->lock) · 19 unmodified lines
915{980{
916 unsigned int queue_id = VQ_REQUEST; /* TODO multiqueue */981 unsigned int queue_id = VQ_REQUEST; /* TODO multiqueue */
917 struct virtio_fs *fs;982 struct virtio_fs *fs;
918 struct fuse_conn *fc;
919 struct fuse_req *req;983 struct fuse_req *req;
920 struct fuse_pqueue *fpq;984 struct virtio_fs_vq *fsvq;
921 int ret;985 int ret;
922 986
923 WARN_ON(list_empty(&fiq->pending));987 WARN_ON(list_empty(&fiq->pending));
@@ -928,44 +992,36 @@ __releases(fiq->lock) · 4 unmodified lines
928 spin_unlock(&fiq->lock);992 spin_unlock(&fiq->lock);
929 993
930 fs = fiq->priv;994 fs = fiq->priv;
931 fc = fs->vqs[queue_id].fud->fc;
932 995
933 pr_debug("%s: opcode %u unique %#llx nodeid %#llx in.len %u out.len %u\n",996 pr_debug("%s: opcode %u unique %#llx nodeid %#llx in.len %u out.len %u\n",
934 __func__, req->in.h.opcode, req->in.h.unique,997 __func__, req->in.h.opcode, req->in.h.unique,
935 req->in.h.nodeid, req->in.h.len,998 req->in.h.nodeid, req->in.h.len,
936 fuse_len_args(req->args->out_numargs, req->args->out_args));999 fuse_len_args(req->args->out_numargs, req->args->out_args));
937 1000
938 fpq = &fs->vqs[queue_id].fud->pq;1001 fsvq = &fs->vqs[queue_id];
939 spin_lock(&fpq->lock);1002 ret = virtio_fs_enqueue_req(fsvq, req, false);
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
953retry:
954 ret = virtio_fs_enqueue_req(&fs->vqs[queue_id], req);
955 if (ret < 0) {1003 if (ret < 0) {
956 if (ret == -ENOMEM || ret == -ENOSPC) {1004 if (ret == -ENOMEM || ret == -ENOSPC) {
957 /* Virtqueue full. Retry submission */1005 /*
958 /* TODO use completion instead of timeout */1006 * Virtqueue full. Retry submission from worker
959 usleep_range(20, 30);1007 * context as we might be holding fc->bg_lock.
960 goto retry;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;
961 }1016 }
962 req->out.h.error = ret;1017 req->out.h.error = ret;
963 pr_err("virtio-fs: virtio_fs_enqueue_req() failed %d\n", ret);1018 pr_err("virtio-fs: virtio_fs_enqueue_req() failed %d\n", ret);
964 spin_lock(&fpq->lock);1019
965 clear_bit(FR_SENT, &req->flags);1020 /* Can't end request in submission context. Use a worker */
966 list_del_init(&req->list);1021 spin_lock(&fsvq->lock);
967 spin_unlock(&fpq->lock);1022 list_add_tail(&req->list, &fsvq->end_reqs);
968 fuse_request_end(fc, req);1023 schedule_delayed_work(&fsvq->dispatch_work, 0);
1024 spin_unlock(&fsvq->lock);
969 return;1025 return;
970 }1026 }
971}1027}
@@ -992,6 +1048,7 @@ static int virtio_fs_fill_super(struct super_block *sb) · 20 unmodified lines
992 .destroy = true,1048 .destroy = true,
993 .no_control = true,1049 .no_control = true,
994 .no_force_umount = true,1050 .no_force_umount = true,
1051 .no_mount_options = true,
995 };1052 };
996 1053
997 mutex_lock(&virtio_fs_mutex);1054 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
1540{1540{
1541 struct gfs2_args *args;1541 struct gfs2_args *args;
1542 1542
1543 args = kzalloc(sizeof(*args), GFP_KERNEL);1543 args = kmalloc(sizeof(*args), GFP_KERNEL);
1544 if (args == NULL)1544 if (args == NULL)
1545 return -ENOMEM;1545 return -ENOMEM;
1546 1546
1547 args->ar_quota = GFS2_QUOTA_DEFAULT;1547 if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) {
1548 args->ar_data = GFS2_DATA_DEFAULT;1548 struct gfs2_sbd *sdp = fc->root->d_sb->s_fs_info;
1549 args->ar_commit = 30;
1550 args->ar_statfs_quantum = 30;
1551 args->ar_quota_quantum = 60;
1552 args->ar_errors = GFS2_ERRORS_DEFAULT;
1553 1549
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 }
1554 fc->fs_private = args;1560 fc->fs_private = args;
1555 fc->ops = &gfs2_context_ops;1561 fc->ops = &gfs2_context_ops;
1556 return 0;1562 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
1124 1124
1125 kiocb->ki_flags |= IOCB_HIPRI;1125 kiocb->ki_flags |= IOCB_HIPRI;
1126 kiocb->ki_complete = io_complete_rw_iopoll;1126 kiocb->ki_complete = io_complete_rw_iopoll;
1127 req->result = 0;
1127 } else {1128 } else {
1128 if (kiocb->ki_flags & IOCB_HIPRI)1129 if (kiocb->ki_flags & IOCB_HIPRI)
1129 return -EINVAL;1130 return -EINVAL;
@@ -2413,6 +2414,7 @@ static int io_queue_link_head(struct io_ring_ctx *ctx, struct io_kiocb *req, · 1283 unmodified lines
2413 if (ret) {2414 if (ret) {
2414 if (ret != -EIOCBQUEUED) {2415 if (ret != -EIOCBQUEUED) {
2415 io_free_req(req);2416 io_free_req(req);
2417 __io_free_req(shadow);
2416 io_cqring_add_event(ctx, s->sqe->user_data, ret);2418 io_cqring_add_event(ctx, s->sqe->user_data, ret);
2417 return 0;2419 return 0;
2418 }2420 }
@@ -3828,10 +3830,6 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p) · 1409 unmodified lines
3828 if (ret)3830 if (ret)
3829 goto err;3831 goto err;
3830 3832
3831 ret = io_uring_get_fd(ctx);
3832 if (ret < 0)
3833 goto err;
3834
3835 memset(&p->sq_off, 0, sizeof(p->sq_off));3833 memset(&p->sq_off, 0, sizeof(p->sq_off));
3836 p->sq_off.head = offsetof(struct io_rings, sq.head);3834 p->sq_off.head = offsetof(struct io_rings, sq.head);
3837 p->sq_off.tail = offsetof(struct io_rings, sq.tail);3835 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
3849 p->cq_off.overflow = offsetof(struct io_rings, cq_overflow);3847 p->cq_off.overflow = offsetof(struct io_rings, cq_overflow);
3850 p->cq_off.cqes = offsetof(struct io_rings, cqes);3848 p->cq_off.cqes = offsetof(struct io_rings, cqes);
3851 3849
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
3852 p->features = IORING_FEAT_SINGLE_MMAP;3858 p->features = IORING_FEAT_SINGLE_MMAP;
3853 return ret;3859 return ret;
3854err:3860err:
fs/nfs/delegation.c+11−1
@@ -53,6 +53,16 @@ nfs4_is_valid_delegation(const struct nfs_delegation *delegation, · 52 unmodified lines
53 return false;53 return false;
54}54}
55 55
56struct 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
56static int66static int
57nfs4_do_check_delegation(struct inode *inode, fmode_t flags, bool mark)67nfs4_do_check_delegation(struct inode *inode, fmode_t flags, bool mark)
58{68{
@@ -1181,7 +1191,7 @@ bool nfs4_refresh_delegation_stateid(nfs4_stateid *dst, struct inode *inode) · 1122 unmodified lines
1181 if (delegation != NULL &&1191 if (delegation != NULL &&
1182 nfs4_stateid_match_other(dst, &delegation->stateid)) {1192 nfs4_stateid_match_other(dst, &delegation->stateid)) {
1183 dst->seqid = delegation->stateid.seqid;1193 dst->seqid = delegation->stateid.seqid;
1184 return ret;1194 ret = true;
1185 }1195 }
1186 rcu_read_unlock();1196 rcu_read_unlock();
1187out:1197out:
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
68bool nfs4_copy_delegation_stateid(struct inode *inode, fmode_t flags, nfs4_stateid *dst, const struct cred **cred);68bool nfs4_copy_delegation_stateid(struct inode *inode, fmode_t flags, nfs4_stateid *dst, const struct cred **cred);
69bool nfs4_refresh_delegation_stateid(nfs4_stateid *dst, struct inode *inode);69bool nfs4_refresh_delegation_stateid(nfs4_stateid *dst, struct inode *inode);
70 70
71struct nfs_delegation *nfs4_get_valid_delegation(const struct inode *inode);
71void nfs_mark_delegation_referenced(struct nfs_delegation *delegation);72void nfs_mark_delegation_referenced(struct nfs_delegation *delegation);
72int nfs4_have_delegation(struct inode *inode, fmode_t flags);73int nfs4_have_delegation(struct inode *inode, fmode_t flags);
73int nfs4_check_delegation(struct inode *inode, fmode_t flags);74int 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
1440 return 0;1440 return 0;
1441 if ((delegation->type & fmode) != fmode)1441 if ((delegation->type & fmode) != fmode)
1442 return 0;1442 return 0;
1443 if (test_bit(NFS_DELEGATION_RETURNING, &delegation->flags))
1444 return 0;
1445 switch (claim) {1443 switch (claim) {
1446 case NFS4_OPEN_CLAIM_NULL:1444 case NFS4_OPEN_CLAIM_NULL:
1447 case NFS4_OPEN_CLAIM_FH:1445 case NFS4_OPEN_CLAIM_FH:
@@ -1810,7 +1808,6 @@ static void nfs4_return_incompatible_delegation(struct inode *inode, fmode_t fmo · 362 unmodified lines
1810static struct nfs4_state *nfs4_try_open_cached(struct nfs4_opendata *opendata)1808static struct nfs4_state *nfs4_try_open_cached(struct nfs4_opendata *opendata)
1811{1809{
1812 struct nfs4_state *state = opendata->state;1810 struct nfs4_state *state = opendata->state;
1813 struct nfs_inode *nfsi = NFS_I(state->inode);
1814 struct nfs_delegation *delegation;1811 struct nfs_delegation *delegation;
1815 int open_mode = opendata->o_arg.open_flags;1812 int open_mode = opendata->o_arg.open_flags;
1816 fmode_t fmode = opendata->o_arg.fmode;1813 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
1827 }1824 }
1828 spin_unlock(&state->owner->so_lock);1825 spin_unlock(&state->owner->so_lock);
1829 rcu_read_lock();1826 rcu_read_lock();
1830 delegation = rcu_dereference(nfsi->delegation);1827 delegation = nfs4_get_valid_delegation(state->inode);
1831 if (!can_open_delegated(delegation, fmode, claim)) {1828 if (!can_open_delegated(delegation, fmode, claim)) {
1832 rcu_read_unlock();1829 rcu_read_unlock();
1833 break;1830 break;
@@ -2371,7 +2368,7 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata) · 537 unmodified lines
2371 data->o_arg.open_flags, claim))2368 data->o_arg.open_flags, claim))
2372 goto out_no_action;2369 goto out_no_action;
2373 rcu_read_lock();2370 rcu_read_lock();
2374 delegation = rcu_dereference(NFS_I(data->state->inode)->delegation);2371 delegation = nfs4_get_valid_delegation(data->state->inode);
2375 if (can_open_delegated(delegation, data->o_arg.fmode, claim))2372 if (can_open_delegated(delegation, data->o_arg.fmode, claim))
2376 goto unlock_no_action;2373 goto unlock_no_action;
2377 rcu_read_unlock();2374 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
2098 return 0;2098 return 0;
2099}2099}
2100 2100
2101static int ocfs2_prepare_inode_for_refcount(struct inode *inode,2101static int ocfs2_inode_lock_for_extent_tree(struct inode *inode,
2102 struct file *file,2102 struct buffer_head **di_bh,
2103 loff_t pos, size_t count,2103 int meta_level,
2104 int *meta_level)2104 int overwrite_io,
2105 int write_sem,
2106 int wait)
2105{2107{
2106 int ret;2108 int ret = 0;
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;
2111 2109
2112 ret = ocfs2_inode_lock(inode, &di_bh, 1);2110 if (wait)
2113 if (ret) {2111 ret = ocfs2_inode_lock(inode, NULL, meta_level);
2114 mlog_errno(ret);2112 else
2113 ret = ocfs2_try_inode_lock(inode,
2114 overwrite_io ? NULL : di_bh, meta_level);
2115 if (ret < 0)
2115 goto out;2116 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 }
2116 }2133 }
2117 2134
2118 *meta_level = 1;2135 return ret;
2119 2136
2120 ret = ocfs2_refcount_cow(inode, di_bh, cpos, clusters, UINT_MAX);2137out_unlock:
2121 if (ret)2138 brelse(*di_bh);
2122 mlog_errno(ret);2139 ocfs2_inode_unlock(inode, meta_level);
2123out:2140out:
2124 brelse(di_bh);
2125 return ret;2141 return ret;
2126}2142}
2127 2143
2144static 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
2128static int ocfs2_prepare_inode_for_write(struct file *file,2161static int ocfs2_prepare_inode_for_write(struct file *file,
2129 loff_t pos, size_t count, int wait)2162 loff_t pos, size_t count, int wait)
2130{2163{
2131 int ret = 0, meta_level = 0, overwrite_io = 0;2164 int ret = 0, meta_level = 0, overwrite_io = 0;
2165 int write_sem = 0;
2132 struct dentry *dentry = file->f_path.dentry;2166 struct dentry *dentry = file->f_path.dentry;
2133 struct inode *inode = d_inode(dentry);2167 struct inode *inode = d_inode(dentry);
2134 struct buffer_head *di_bh = NULL;2168 struct buffer_head *di_bh = NULL;
2169 u32 cpos;
2170 u32 clusters;
2135 2171
2136 /*2172 /*
2137 * We start with a read level meta lock and only jump to an ex2173 * We start with a read level meta lock and only jump to an ex
2138 * if we need to make modifications here.2174 * if we need to make modifications here.
2139 */2175 */
2140 for(;;) {2176 for(;;) {
2141 if (wait)2177 ret = ocfs2_inode_lock_for_extent_tree(inode,
2142 ret = ocfs2_inode_lock(inode, NULL, meta_level);2178 &di_bh,
2143 else2179 meta_level,
2144 ret = ocfs2_try_inode_lock(inode,2180 overwrite_io,
2145 overwrite_io ? NULL : &di_bh, meta_level);2181 write_sem,
2182 wait);
2146 if (ret < 0) {2183 if (ret < 0) {
2147 meta_level = -1;
2148 if (ret != -EAGAIN)2184 if (ret != -EAGAIN)
2149 mlog_errno(ret);2185 mlog_errno(ret);
2150 goto out;2186 goto out;
@@ -2156,15 +2192,8 @@ static int ocfs2_prepare_inode_for_write(struct file *file, · 5 unmodified lines
2156 */2192 */
2157 if (!wait && !overwrite_io) {2193 if (!wait && !overwrite_io) {
2158 overwrite_io = 1;2194 overwrite_io = 1;
2159 if (!down_read_trylock(&OCFS2_I(inode)->ip_alloc_sem)) {
2160 ret = -EAGAIN;
2161 goto out_unlock;
2162 }
2163 2195
2164 ret = ocfs2_overwrite_io(inode, di_bh, pos, count);2196 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);
2168 if (ret < 0) {2197 if (ret < 0) {
2169 if (ret != -EAGAIN)2198 if (ret != -EAGAIN)
2170 mlog_errno(ret);2199 mlog_errno(ret);
@@ -2183,7 +2212,10 @@ static int ocfs2_prepare_inode_for_write(struct file *file, · 12 unmodified lines
2183 * set inode->i_size at the end of a write. */2212 * set inode->i_size at the end of a write. */
2184 if (should_remove_suid(dentry)) {2213 if (should_remove_suid(dentry)) {
2185 if (meta_level == 0) {2214 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);
2187 meta_level = 1;2219 meta_level = 1;
2188 continue;2220 continue;
2189 }2221 }
@@ -2197,18 +2229,32 @@ static int ocfs2_prepare_inode_for_write(struct file *file, · 7 unmodified lines
2197 2229
2198 ret = ocfs2_check_range_for_refcount(inode, pos, count);2230 ret = ocfs2_check_range_for_refcount(inode, pos, count);
2199 if (ret == 1) {2231 if (ret == 1) {
2200 ocfs2_inode_unlock(inode, meta_level);2232 ocfs2_inode_unlock_for_extent_tree(inode,
2201 meta_level = -1;2233 &di_bh,
2202 2234 meta_level,
2203 ret = ocfs2_prepare_inode_for_refcount(inode,2235 write_sem);
2204 file,2236 ret = ocfs2_inode_lock_for_extent_tree(inode,
2205 pos,2237 &di_bh,
2206 count,2238 meta_level,
2207 &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);
2208 }2253 }
2209 2254
2210 if (ret < 0) {2255 if (ret < 0) {
2211 mlog_errno(ret);2256 if (ret != -EAGAIN)
2257 mlog_errno(ret);
2212 goto out_unlock;2258 goto out_unlock;
2213 }2259 }
2214 2260
@@ -2219,10 +2265,10 @@ out_unlock: · 4 unmodified lines
2219 trace_ocfs2_prepare_inode_for_write(OCFS2_I(inode)->ip_blkno,2265 trace_ocfs2_prepare_inode_for_write(OCFS2_I(inode)->ip_blkno,
2220 pos, count, wait);2266 pos, count, wait);
2221 2267
2222 brelse(di_bh);2268 ocfs2_inode_unlock_for_extent_tree(inode,
2223 2269 &di_bh,
2224 if (meta_level >= 0)2270 meta_level,
2225 ocfs2_inode_unlock(inode, meta_level);2271 write_sem);
2226 2272
2227out:2273out:
2228 return ret;2274 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
25}25}
26#endif /* __arch_get_clock_mode */26#endif /* __arch_get_clock_mode */
27 27
28#ifndef __arch_use_vsyscall
29static __always_inline int __arch_use_vsyscall(struct vdso_data *vdata)
30{
31 return 1;
32}
33#endif /* __arch_use_vsyscall */
34
35#ifndef __arch_update_vsyscall28#ifndef __arch_update_vsyscall
36static __always_inline void __arch_update_vsyscall(struct vdso_data *vdata,29static __always_inline void __arch_update_vsyscall(struct vdso_data *vdata,
37 struct timekeeper *tk)30 struct timekeeper *tk)
include/drm/drm_gem_shmem_helper.h+13−0
@@ -44,7 +44,20 @@ struct drm_gem_shmem_object { · 43 unmodified lines
44 */44 */
45 unsigned int pages_use_count;45 unsigned int pages_use_count;
46 46
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 */
47 int madv;54 int madv;
55
56 /**
57 * @madv_list: List entry for madvise tracking
58 *
59 * Typically used by drivers to track purgeable objects
60 */
48 struct list_head madv_list;61 struct list_head madv_list;
49 62
50 /**63 /**
include/drm/drm_self_refresh_helper.h+2−1
@@ -13,7 +13,8 @@ struct drm_crtc; · 12 unmodified lines
13 13
14void drm_self_refresh_helper_alter_state(struct drm_atomic_state *state);14void drm_self_refresh_helper_alter_state(struct drm_atomic_state *state);
15void drm_self_refresh_helper_update_avg_times(struct drm_atomic_state *state,15void 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);
17 18
18int drm_self_refresh_helper_init(struct drm_crtc *crtc);19int drm_self_refresh_helper_init(struct drm_crtc *crtc);
19void drm_self_refresh_helper_cleanup(struct drm_crtc *crtc);20void 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
656void bpf_map_put(struct bpf_map *map);656void bpf_map_put(struct bpf_map *map);
657int bpf_map_charge_memlock(struct bpf_map *map, u32 pages);657int bpf_map_charge_memlock(struct bpf_map *map, u32 pages);
658void bpf_map_uncharge_memlock(struct bpf_map *map, u32 pages);658void bpf_map_uncharge_memlock(struct bpf_map *map, u32 pages);
659int bpf_map_charge_init(struct bpf_map_memory *mem, size_t size);659int bpf_map_charge_init(struct bpf_map_memory *mem, u64 size);
660void bpf_map_charge_finish(struct bpf_map_memory *mem);660void bpf_map_charge_finish(struct bpf_map_memory *mem);
661void bpf_map_charge_move(struct bpf_map_memory *dst,661void bpf_map_charge_move(struct bpf_map_memory *dst,
662 struct bpf_map_memory *src);662 struct bpf_map_memory *src);
663void *bpf_map_area_alloc(size_t size, int numa_node);663void *bpf_map_area_alloc(u64 size, int numa_node);
664void bpf_map_area_free(void *base);664void bpf_map_area_free(void *base);
665void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr);665void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr);
666 666
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
204 do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0)204 do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0)
205#define dynamic_dev_dbg(dev, fmt, ...) \205#define dynamic_dev_dbg(dev, fmt, ...) \
206 do { if (0) dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); } while (0)206 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)
207#endif213#endif
208 214
209#endif215#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
1579efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg,1579efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg,
1580 struct efi_boot_memmap *map);1580 struct efi_boot_memmap *map);
1581 1581
1582efi_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
1586static inline
1582efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,1587efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,
1583 unsigned long size, unsigned long align,1588 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}
1585 1598
1586efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg,1599efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg,
1587 unsigned long size, unsigned long align,1600 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
1592 unsigned long image_size,1605 unsigned long image_size,
1593 unsigned long alloc_size,1606 unsigned long alloc_size,
1594 unsigned long preferred_addr,1607 unsigned long preferred_addr,
1595 unsigned long alignment);1608 unsigned long alignment,
1609 unsigned long min_addr);
1596 1610
1597efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,1611efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
1598 efi_loaded_image_t *image,1612 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
1099 1099
1100#endif /* CONFIG_BPF_JIT */1100#endif /* CONFIG_BPF_JIT */
1101 1101
1102void bpf_prog_kallsyms_del_subprogs(struct bpf_prog *fp);
1103void bpf_prog_kallsyms_del_all(struct bpf_prog *fp);1102void bpf_prog_kallsyms_del_all(struct bpf_prog *fp);
1104 1103
1105#define BPF_ANC BIT(15)1104#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
325 return !!(gfp_flags & __GFP_DIRECT_RECLAIM);325 return !!(gfp_flags & __GFP_DIRECT_RECLAIM);
326}326}
327 327
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 */
345static 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
328#ifdef CONFIG_HIGHMEM351#ifdef CONFIG_HIGHMEM
329#define OPT_ZONE_HIGHMEM ZONE_HIGHMEM352#define OPT_ZONE_HIGHMEM ZONE_HIGHMEM
330#else353#else
include/linux/idr.h+1−1
@@ -185,7 +185,7 @@ static inline void idr_preload_end(void) · 184 unmodified lines
185 * is convenient for a "not found" value.185 * is convenient for a "not found" value.
186 */186 */
187#define idr_for_each_entry(idr, entry, id) \187#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)
189 189
190/**190/**
191 * idr_for_each_entry_ul() - Iterate over an IDR's elements of a given type.191 * 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
29 netdev_features_t set_features;29 netdev_features_t set_features;
30 enum macvlan_mode mode;30 enum macvlan_mode mode;
31 u16 flags;31 u16 flags;
32 int nest_level;
33 unsigned int macaddr_count;32 unsigned int macaddr_count;
34#ifdef CONFIG_NET_POLL_CONTROLLER33#ifdef CONFIG_NET_POLL_CONTROLLER
35 struct netpoll *netpoll;34 struct netpoll *netpoll;
include/linux/if_team.h+1−0
@@ -223,6 +223,7 @@ struct team { · 222 unmodified lines
223 atomic_t count_pending;223 atomic_t count_pending;
224 struct delayed_work dw;224 struct delayed_work dw;
225 } mcast_rejoin;225 } mcast_rejoin;
226 struct lock_class_key team_lock_key;
226 long mode_priv[TEAM_MODE_PRIV_LONGS];227 long mode_priv[TEAM_MODE_PRIV_LONGS];
227};228};
228 229
include/linux/if_vlan.h+0−11
@@ -182,7 +182,6 @@ struct vlan_dev_priv { · 181 unmodified lines
182#ifdef CONFIG_NET_POLL_CONTROLLER182#ifdef CONFIG_NET_POLL_CONTROLLER
183 struct netpoll *netpoll;183 struct netpoll *netpoll;
184#endif184#endif
185 unsigned int nest_level;
186};185};
187 186
188static inline struct vlan_dev_priv *vlan_dev_priv(const struct net_device *dev)187static 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
221 220
222extern bool vlan_uses_dev(const struct net_device *dev);221extern bool vlan_uses_dev(const struct net_device *dev);
223 222
224static 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}
229#else223#else
230static inline struct net_device *224static inline struct net_device *
231__vlan_find_dev_deep_rcu(struct net_device *real_dev,225__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
295{289{
296 return false;290 return false;
297}291}
298static inline int vlan_get_encap_level(struct net_device *dev)
299{
300 BUG();
301 return 0;
302}
303#endif292#endif
304 293
305/**294/**
include/linux/mlx5/mlx5_ifc.h+1−2
@@ -1545,9 +1545,8 @@ struct mlx5_ifc_extended_dest_format_bits { · 1544 unmodified lines
1545};1545};
1546 1546
1547union mlx5_ifc_dest_format_struct_flow_counter_list_auto_bits {1547union 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;
1549 struct mlx5_ifc_flow_counter_list_bits flow_counter_list;1549 struct mlx5_ifc_flow_counter_list_bits flow_counter_list;
1550 u8 reserved_at_0[0x40];
1551};1550};
1552 1551
1553struct mlx5_ifc_fte_match_param_bits {1552struct 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
695 695
696extern void kvfree(const void *addr);696extern void kvfree(const void *addr);
697 697
698static inline atomic_t *compound_mapcount_ptr(struct page *page)
699{
700 return &page[1].compound_mapcount;
701}
702
703static inline int compound_mapcount(struct page *page)698static inline int compound_mapcount(struct page *page)
704{699{
705 VM_BUG_ON_PAGE(!PageCompound(page), page);700 VM_BUG_ON_PAGE(!PageCompound(page), page);
include/linux/mm_types.h+5−0
@@ -221,6 +221,11 @@ struct page { · 220 unmodified lines
221#endif221#endif
222} _struct_page_alignment;222} _struct_page_alignment;
223 223
224static inline atomic_t *compound_mapcount_ptr(struct page *page)
225{
226 return &page[1].compound_mapcount;
227}
228
224/*229/*
225 * Used for sizing the vmemmap region on some architectures230 * Used for sizing the vmemmap region on some architectures
226 */231 */
include/linux/netdevice.h+27−34
@@ -925,6 +925,7 @@ struct dev_ifalias { · 924 unmodified lines
925struct devlink;925struct devlink;
926struct tlsdev_ops;926struct tlsdev_ops;
927 927
928
928/*929/*
929 * This structure defines the management hooks for network devices.930 * This structure defines the management hooks for network devices.
930 * The following hooks can be defined; unless noted otherwise, they are931 * The following hooks can be defined; unless noted otherwise, they are
@@ -1421,7 +1422,6 @@ struct net_device_ops { · 490 unmodified lines
1421 void (*ndo_dfwd_del_station)(struct net_device *pdev,1422 void (*ndo_dfwd_del_station)(struct net_device *pdev,
1422 void *priv);1423 void *priv);
1423 1424
1424 int (*ndo_get_lock_subclass)(struct net_device *dev);
1425 int (*ndo_set_tx_maxrate)(struct net_device *dev,1425 int (*ndo_set_tx_maxrate)(struct net_device *dev,
1426 int queue_index,1426 int queue_index,
1427 u32 maxrate);1427 u32 maxrate);
@@ -1649,6 +1649,8 @@ enum netdev_priv_flags { · 221 unmodified lines
1649 * @perm_addr: Permanent hw address1649 * @perm_addr: Permanent hw address
1650 * @addr_assign_type: Hw address assignment type1650 * @addr_assign_type: Hw address assignment type
1651 * @addr_len: Hardware address length1651 * @addr_len: Hardware address length
1652 * @upper_level: Maximum depth level of upper devices.
1653 * @lower_level: Maximum depth level of lower devices.
1652 * @neigh_priv_len: Used in neigh_alloc()1654 * @neigh_priv_len: Used in neigh_alloc()
1653 * @dev_id: Used to differentiate devices that share1655 * @dev_id: Used to differentiate devices that share
1654 * the same link layer address1656 * the same link layer address
@@ -1758,9 +1760,13 @@ enum netdev_priv_flags { · 103 unmodified lines
1758 * @phydev: Physical device may attach itself1760 * @phydev: Physical device may attach itself
1759 * for hardware timestamping1761 * for hardware timestamping
1760 * @sfp_bus: attached &struct sfp_bus structure.1762 * @sfp_bus: attached &struct sfp_bus structure.
1761 *1763 * @qdisc_tx_busylock_key: lockdep class annotating Qdisc->busylock
1762 * @qdisc_tx_busylock: lockdep class annotating Qdisc->busylock spinlock1764 spinlock
1763 * @qdisc_running_key: lockdep class annotating Qdisc->running seqcount1765 * @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
1764 *1770 *
1765 * @proto_down: protocol port state information can be sent to the1771 * @proto_down: protocol port state information can be sent to the
1766 * switch driver and used to set the phys state of the1772 * switch driver and used to set the phys state of the
@@ -1875,6 +1881,8 @@ struct net_device { · 108 unmodified lines
1875 unsigned char perm_addr[MAX_ADDR_LEN];1881 unsigned char perm_addr[MAX_ADDR_LEN];
1876 unsigned char addr_assign_type;1882 unsigned char addr_assign_type;
1877 unsigned char addr_len;1883 unsigned char addr_len;
1884 unsigned char upper_level;
1885 unsigned char lower_level;
1878 unsigned short neigh_priv_len;1886 unsigned short neigh_priv_len;
1879 unsigned short dev_id;1887 unsigned short dev_id;
1880 unsigned short dev_port;1888 unsigned short dev_port;
@@ -2045,8 +2053,10 @@ struct net_device { · 164 unmodified lines
2045#endif2053#endif
2046 struct phy_device *phydev;2054 struct phy_device *phydev;
2047 struct sfp_bus *sfp_bus;2055 struct sfp_bus *sfp_bus;
2048 struct lock_class_key *qdisc_tx_busylock;2056 struct lock_class_key qdisc_tx_busylock_key;
2049 struct lock_class_key *qdisc_running_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;
2050 bool proto_down;2060 bool proto_down;
2051 unsigned wol_enabled:1;2061 unsigned wol_enabled:1;
2052};2062};
@@ -2124,23 +2134,6 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev, · 71 unmodified lines
2124 f(dev, &dev->_tx[i], arg);2134 f(dev, &dev->_tx[i], arg);
2125}2135}
2126 2136
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
2144u16 netdev_pick_tx(struct net_device *dev, struct sk_buff *skb,2137u16 netdev_pick_tx(struct net_device *dev, struct sk_buff *skb,
2145 struct net_device *sb_dev);2138 struct net_device *sb_dev);
2146struct netdev_queue *netdev_core_pick_tx(struct net_device *dev,2139struct 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
3139}3132}
3140 3133
3141void netif_tx_stop_all_queues(struct net_device *dev);3134void netif_tx_stop_all_queues(struct net_device *dev);
3135void netdev_update_lockdep_key(struct net_device *dev);
3142 3136
3143static inline bool netif_tx_queue_stopped(const struct netdev_queue *dev_queue)3137static inline bool netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
3144{3138{
@@ -4056,16 +4050,6 @@ static inline void netif_addr_lock(struct net_device *dev) · 911 unmodified lines
4056 spin_lock(&dev->addr_list_lock);4050 spin_lock(&dev->addr_list_lock);
4057}4051}
4058 4052
4059static 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
4069static inline void netif_addr_lock_bh(struct net_device *dev)4053static inline void netif_addr_lock_bh(struct net_device *dev)
4070{4054{
4071 spin_lock_bh(&dev->addr_list_lock);4055 spin_lock_bh(&dev->addr_list_lock);
@@ -4329,6 +4313,16 @@ int netdev_master_upper_dev_link(struct net_device *dev, · 257 unmodified lines
4329 struct netlink_ext_ack *extack);4313 struct netlink_ext_ack *extack);
4330void netdev_upper_dev_unlink(struct net_device *dev,4314void netdev_upper_dev_unlink(struct net_device *dev,
4331 struct net_device *upper_dev);4315 struct net_device *upper_dev);
4316int 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);
4320void netdev_adjacent_change_commit(struct net_device *old_dev,
4321 struct net_device *new_dev,
4322 struct net_device *dev);
4323void netdev_adjacent_change_abort(struct net_device *old_dev,
4324 struct net_device *new_dev,
4325 struct net_device *dev);
4332void netdev_adjacent_rename_links(struct net_device *dev, char *oldname);4326void netdev_adjacent_rename_links(struct net_device *dev, char *oldname);
4333void *netdev_lower_dev_get_private(struct net_device *dev,4327void *netdev_lower_dev_get_private(struct net_device *dev,
4334 struct net_device *lower_dev);4328 struct net_device *lower_dev);
@@ -4340,7 +4334,6 @@ void netdev_lower_state_changed(struct net_device *lower_dev, · 5 unmodified lines
4340extern u8 netdev_rss_key[NETDEV_RSS_KEY_LEN] __read_mostly;4334extern u8 netdev_rss_key[NETDEV_RSS_KEY_LEN] __read_mostly;
4341void netdev_rss_key_fill(void *buffer, size_t len);4335void netdev_rss_key_fill(void *buffer, size_t len);
4342 4336
4343int dev_get_nest_level(struct net_device *dev);
4344int skb_checksum_help(struct sk_buff *skb);4337int skb_checksum_help(struct sk_buff *skb);
4345int skb_crc32c_csum_help(struct sk_buff *skb);4338int skb_crc32c_csum_help(struct sk_buff *skb);
4346int skb_csum_hwoffload_help(struct sk_buff *skb,4339int 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
622 *622 *
623 * Unlike PageTransCompound, this is safe to be called only while623 * Unlike PageTransCompound, this is safe to be called only while
624 * split_huge_pmd() cannot run from under us, like if protected by the624 * split_huge_pmd() cannot run from under us, like if protected by the
625 * MMU notifier, otherwise it may result in page->_mapcount < 0 false625 * MMU notifier, otherwise it may result in page->_mapcount check false
626 * positives.626 * 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.
627 */632 */
628static inline int PageTransCompoundMap(struct page *page)633static inline int PageTransCompoundMap(struct page *page)
629{634{
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));
631}647}
632 648
633/*649/*
include/linux/platform_data/dma-imx-sdma.h+3−0
@@ -51,7 +51,10 @@ struct sdma_script_start_addrs { · 50 unmodified lines
51 /* End of v2 array */51 /* End of v2 array */
52 s32 zcanfd_2_mcu_addr;52 s32 zcanfd_2_mcu_addr;
53 s32 zqspi_2_mcu_addr;53 s32 zqspi_2_mcu_addr;
54 s32 mcu_2_ecspi_addr;
54 /* End of v3 array */55 /* End of v3 array */
56 s32 mcu_2_zqspi_addr;
57 /* End of v4 array */
55};58};
56 59
57/**60/**
include/linux/radix-tree.h+0−18
@@ -315,24 +315,6 @@ radix_tree_iter_lookup(const struct radix_tree_root *root, · 314 unmodified lines
315 return radix_tree_next_chunk(root, iter, RADIX_TREE_ITER_CONTIG);315 return radix_tree_next_chunk(root, iter, RADIX_TREE_ITER_CONTIG);
316}316}
317 317
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 */
328static inline void __rcu **
329radix_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
336/**318/**
337 * radix_tree_iter_retry - retry this chunk of the iteration319 * radix_tree_iter_retry - retry this chunk of the iteration
338 * @iter: iterator state320 * @iter: iterator state
include/linux/reset-controller.h+2−2
@@ -7,7 +7,7 @@ · 6 unmodified lines
7struct reset_controller_dev;7struct reset_controller_dev;
8 8
9/**9/**
10 * struct reset_control_ops10 * struct reset_control_ops - reset controller driver callbacks
11 *11 *
12 * @reset: for self-deasserting resets, does all necessary12 * @reset: for self-deasserting resets, does all necessary
13 * things to reset the device13 * things to reset the device
@@ -33,7 +33,7 @@ struct of_phandle_args; · 19 unmodified lines
33 * @provider: name of the reset controller device controlling this reset line33 * @provider: name of the reset controller device controlling this reset line
34 * @index: ID of the reset controller in the reset controller device34 * @index: ID of the reset controller in the reset controller device
35 * @dev_id: name of the device associated with this reset line35 * @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)
37 */37 */
38struct reset_control_lookup {38struct reset_control_lookup {
39 struct list_head list;39 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
143 * If this function is called more than once for the same reset_control it will143 * If this function is called more than once for the same reset_control it will
144 * return -EBUSY.144 * return -EBUSY.
145 *145 *
146 * See reset_control_get_shared for details on shared references to146 * See reset_control_get_shared() for details on shared references to
147 * reset-controls.147 * reset-controls.
148 *148 *
149 * Use of id names is optional.149 * Use of id names is optional.
include/linux/security.h+1−0
@@ -105,6 +105,7 @@ enum lockdown_reason { · 104 unmodified lines
105 LOCKDOWN_NONE,105 LOCKDOWN_NONE,
106 LOCKDOWN_MODULE_SIGNATURE,106 LOCKDOWN_MODULE_SIGNATURE,
107 LOCKDOWN_DEV_MEM,107 LOCKDOWN_DEV_MEM,
108 LOCKDOWN_EFI_TEST,
108 LOCKDOWN_KEXEC,109 LOCKDOWN_KEXEC,
109 LOCKDOWN_HIBERNATION,110 LOCKDOWN_HIBERNATION,
110 LOCKDOWN_PCI_ACCESS,111 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
1354 return skb->hash;1354 return skb->hash;
1355}1355}
1356 1356
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);
1358 1359
1359static inline __u32 skb_get_hash_raw(const struct sk_buff *skb)1360static inline __u32 skb_get_hash_raw(const struct sk_buff *skb)
1360{1361{
@@ -1494,6 +1495,19 @@ static inline int skb_queue_empty(const struct sk_buff_head *list) · 133 unmodified lines
1494 return list->next == (const struct sk_buff *) list;1495 return list->next == (const struct sk_buff *) list;
1495}1496}
1496 1497
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 */
1505static 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
1497/**1511/**
1498 * skb_queue_is_last - check if skb is the last entry in the queue1512 * skb_queue_is_last - check if skb is the last entry in the queue
1499 * @list: queue head1513 * @list: queue head
@@ -1847,9 +1861,11 @@ static inline void __skb_insert(struct sk_buff *newsk, · 347 unmodified lines
1847 struct sk_buff *prev, struct sk_buff *next,1861 struct sk_buff *prev, struct sk_buff *next,
1848 struct sk_buff_head *list)1862 struct sk_buff_head *list)
1849{1863{
1850 newsk->next = next;1864 /* see skb_queue_empty_lockless() for the opposite READ_ONCE() */
1851 newsk->prev = prev;1865 WRITE_ONCE(newsk->next, next);
1852 next->prev = prev->next = newsk;1866 WRITE_ONCE(newsk->prev, prev);
1867 WRITE_ONCE(next->prev, newsk);
1868 WRITE_ONCE(prev->next, newsk);
1853 list->qlen++;1869 list->qlen++;
1854}1870}
1855 1871
@@ -1860,11 +1876,11 @@ static inline void __skb_queue_splice(const struct sk_buff_head *list, · 4 unmodified lines
1860 struct sk_buff *first = list->next;1876 struct sk_buff *first = list->next;
1861 struct sk_buff *last = list->prev;1877 struct sk_buff *last = list->prev;
1862 1878
1863 first->prev = prev;1879 WRITE_ONCE(first->prev, prev);
1864 prev->next = first;1880 WRITE_ONCE(prev->next, first);
1865 1881
1866 last->next = next;1882 WRITE_ONCE(last->next, next);
1867 next->prev = last;1883 WRITE_ONCE(next->prev, last);
1868}1884}
1869 1885
1870/**1886/**
@@ -2005,8 +2021,8 @@ static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) · 134 unmodified lines
2005 next = skb->next;2021 next = skb->next;
2006 prev = skb->prev;2022 prev = skb->prev;
2007 skb->next = skb->prev = NULL;2023 skb->next = skb->prev = NULL;
2008 next->prev = prev;2024 WRITE_ONCE(next->prev, prev);
2009 prev->next = next;2025 WRITE_ONCE(prev->next, next);
2010}2026}
2011 2027
2012/**2028/**
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
139 }139 }
140}140}
141 141
142static inline u32 sk_msg_iter_dist(u32 start, u32 end)
143{
144 return end >= start ? end - start : end + (MAX_MSG_FRAGS - start);
145}
146
142#define sk_msg_iter_var_prev(var) \147#define sk_msg_iter_var_prev(var) \
143 do { \148 do { \
144 if (var == 0) \149 if (var == 0) \
@@ -198,9 +203,7 @@ static inline u32 sk_msg_elem_used(const struct sk_msg *msg) · 53 unmodified lines
198 if (sk_msg_full(msg))203 if (sk_msg_full(msg))
199 return MAX_MSG_FRAGS;204 return MAX_MSG_FRAGS;
200 205
201 return msg->sg.end >= msg->sg.start ?206 return sk_msg_iter_dist(msg->sg.start, msg->sg.end);
202 msg->sg.end - msg->sg.start :
203 msg->sg.end + (MAX_MSG_FRAGS - msg->sg.start);
204}207}
205 208
206static inline struct scatterlist *sk_msg_elem(struct sk_msg *msg, int which)209static 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
263#define PF_MAX AF_MAX263#define PF_MAX AF_MAX
264 264
265/* Maximum queue length specifiable by listen. */265/* Maximum queue length specifiable by listen. */
266#define SOMAXCONN 128266#define SOMAXCONN 4096
267 267
268/* Flags we can use with send/ and recv.268/* Flags we can use with send/ and recv.
269 Added those for 1003.1g not all are supported yet269 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
64 return 0;64 return 0;
65}65}
66 66
67static inline void xprt_destroy_backchannel(struct rpc_xprt *xprt,
68 unsigned int max_reqs)
69{
70}
71
67static inline bool svc_is_backchannel(const struct svc_rqst *rqstp)72static inline bool svc_is_backchannel(const struct svc_rqst *rqstp)
68{73{
69 return false;74 return false;
include/linux/virtio_vsock.h+0−1
@@ -48,7 +48,6 @@ struct virtio_vsock_sock { · 47 unmodified lines
48 48
49struct virtio_vsock_pkt {49struct virtio_vsock_pkt {
50 struct virtio_vsock_hdr hdr;50 struct virtio_vsock_hdr hdr;
51 struct work_struct work;
52 struct list_head list;51 struct list_head list;
53 /* socket refcnt not held, only use for cancellation */52 /* socket refcnt not held, only use for cancellation */
54 struct vsock_sock *vsk;53 struct vsock_sock *vsk;
include/net/bonding.h+2−3
@@ -159,7 +159,6 @@ struct slave { · 158 unmodified lines
159 unsigned long target_last_arp_rx[BOND_MAX_ARP_TARGETS];159 unsigned long target_last_arp_rx[BOND_MAX_ARP_TARGETS];
160 s8 link; /* one of BOND_LINK_XXXX */160 s8 link; /* one of BOND_LINK_XXXX */
161 s8 link_new_state; /* one of BOND_LINK_XXXX */161 s8 link_new_state; /* one of BOND_LINK_XXXX */
162 s8 new_link;
163 u8 backup:1, /* indicates backup slave. Value corresponds with162 u8 backup:1, /* indicates backup slave. Value corresponds with
164 BOND_STATE_ACTIVE and BOND_STATE_BACKUP */163 BOND_STATE_ACTIVE and BOND_STATE_BACKUP */
165 inactive:1, /* indicates inactive slave */164 inactive:1, /* indicates inactive slave */
@@ -203,7 +202,6 @@ struct bonding { · 37 unmodified lines
203 struct slave __rcu *primary_slave;202 struct slave __rcu *primary_slave;
204 struct bond_up_slave __rcu *slave_arr; /* Array of usable slaves */203 struct bond_up_slave __rcu *slave_arr; /* Array of usable slaves */
205 bool force_primary;204 bool force_primary;
206 u32 nest_level;
207 s32 slave_cnt; /* never change this value outside the attach/detach wrappers */205 s32 slave_cnt; /* never change this value outside the attach/detach wrappers */
208 int (*recv_probe)(const struct sk_buff *, struct bonding *,206 int (*recv_probe)(const struct sk_buff *, struct bonding *,
209 struct slave *);207 struct slave *);
@@ -239,6 +237,7 @@ struct bonding { · 29 unmodified lines
239 struct dentry *debug_dir;237 struct dentry *debug_dir;
240#endif /* CONFIG_DEBUG_FS */238#endif /* CONFIG_DEBUG_FS */
241 struct rtnl_link_stats64 bond_stats;239 struct rtnl_link_stats64 bond_stats;
240 struct lock_class_key stats_lock_key;
242};241};
243 242
244#define bond_slave_get_rcu(dev) \243#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
549 548
550static inline void bond_commit_link_state(struct slave *slave, bool notify)549static inline void bond_commit_link_state(struct slave *slave, bool notify)
551{550{
552 if (slave->link == slave->link_new_state)551 if (slave->link_new_state == BOND_LINK_NOCHANGE)
553 return;552 return;
554 553
555 slave->link = slave->link_new_state;554 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
122static inline void sk_mark_napi_id(struct sock *sk, const struct sk_buff *skb)122static inline void sk_mark_napi_id(struct sock *sk, const struct sk_buff *skb)
123{123{
124#ifdef CONFIG_NET_RX_BUSY_POLL124#ifdef CONFIG_NET_RX_BUSY_POLL
125 sk->sk_napi_id = skb->napi_id;125 WRITE_ONCE(sk->sk_napi_id, skb->napi_id);
126#endif126#endif
127 sk_rx_queue_set(sk, skb);127 sk_rx_queue_set(sk, skb);
128}128}
@@ -132,8 +132,8 @@ static inline void sk_mark_napi_id_once(struct sock *sk, · 3 unmodified lines
132 const struct sk_buff *skb)132 const struct sk_buff *skb)
133{133{
134#ifdef CONFIG_NET_RX_BUSY_POLL134#ifdef CONFIG_NET_RX_BUSY_POLL
135 if (!sk->sk_napi_id)135 if (!READ_ONCE(sk->sk_napi_id))
136 sk->sk_napi_id = skb->napi_id;136 WRITE_ONCE(sk->sk_napi_id, skb->napi_id);
137#endif137#endif
138}138}
139 139
include/net/flow_dissector.h+2−1
@@ -4,6 +4,7 @@ · 3 unmodified lines
4 4
5#include <linux/types.h>5#include <linux/types.h>
6#include <linux/in6.h>6#include <linux/in6.h>
7#include <linux/siphash.h>
7#include <uapi/linux/if_ether.h>8#include <uapi/linux/if_ether.h>
8 9
9/**10/**
@@ -276,7 +277,7 @@ struct flow_keys_basic { · 266 unmodified lines
276struct flow_keys {277struct flow_keys {
277 struct flow_dissector_key_control control;278 struct flow_dissector_key_control control;
278#define FLOW_KEYS_HASH_START_FIELD basic279#define FLOW_KEYS_HASH_START_FIELD basic
279 struct flow_dissector_key_basic basic;280 struct flow_dissector_key_basic basic __aligned(SIPHASH_ALIGNMENT);
280 struct flow_dissector_key_tags tags;281 struct flow_dissector_key_tags tags;
281 struct flow_dissector_key_vlan vlan;282 struct flow_dissector_key_vlan vlan;
282 struct flow_dissector_key_vlan cvlan;283 struct flow_dissector_key_vlan cvlan;
include/net/fq.h+1−1
@@ -69,7 +69,7 @@ struct fq { · 68 unmodified lines
69 struct list_head backlogs;69 struct list_head backlogs;
70 spinlock_t lock;70 spinlock_t lock;
71 u32 flows_cnt;71 u32 flows_cnt;
72 u32 perturbation;72 siphash_key_t perturbation;
73 u32 limit;73 u32 limit;
74 u32 memory_limit;74 u32 memory_limit;
75 u32 memory_usage;75 u32 memory_usage;
include/net/fq_impl.h+4−4
@@ -108,7 +108,7 @@ begin: · 107 unmodified lines
108 108
109static u32 fq_flow_idx(struct fq *fq, struct sk_buff *skb)109static u32 fq_flow_idx(struct fq *fq, struct sk_buff *skb)
110{110{
111 u32 hash = skb_get_hash_perturb(skb, fq->perturbation);111 u32 hash = skb_get_hash_perturb(skb, &fq->perturbation);
112 112
113 return reciprocal_scale(hash, fq->flows_cnt);113 return reciprocal_scale(hash, fq->flows_cnt);
114}114}
@@ -308,12 +308,12 @@ static int fq_init(struct fq *fq, int flows_cnt) · 193 unmodified lines
308 INIT_LIST_HEAD(&fq->backlogs);308 INIT_LIST_HEAD(&fq->backlogs);
309 spin_lock_init(&fq->lock);309 spin_lock_init(&fq->lock);
310 fq->flows_cnt = max_t(u32, flows_cnt, 1);310 fq->flows_cnt = max_t(u32, flows_cnt, 1);
311 fq->perturbation = prandom_u32();311 get_random_bytes(&fq->perturbation, sizeof(fq->perturbation));
312 fq->quantum = 300;312 fq->quantum = 300;
313 fq->limit = 8192;313 fq->limit = 8192;
314 fq->memory_limit = 16 << 20; /* 16 MBytes */314 fq->memory_limit = 16 << 20; /* 16 MBytes */
315 315
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);
317 if (!fq->flows)317 if (!fq->flows)
318 return -ENOMEM;318 return -ENOMEM;
319 319
@@ -331,7 +331,7 @@ static void fq_reset(struct fq *fq, · 11 unmodified lines
331 for (i = 0; i < fq->flows_cnt; i++)331 for (i = 0; i < fq->flows_cnt; i++)
332 fq_flow_reset(fq, &fq->flows[i], free_func);332 fq_flow_reset(fq, &fq->flows[i], free_func);
333 333
334 kfree(fq->flows);334 kvfree(fq->flows);
335 fq->flows = NULL;335 fq->flows = NULL;
336}336}
337 337
include/net/hwbm.h+7−3
@@ -21,9 +21,13 @@ void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf); · 20 unmodified lines
21int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp);21int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp);
22int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num);22int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num);
23#else23#else
24void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}24static inline void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
25int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; }25
26int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num)26static inline int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp)
27{ return 0; }
28
29static inline int hwbm_pool_add(struct hwbm_pool *bm_pool,
30 unsigned int buf_num)
27{ return 0; }31{ return 0; }
28#endif /* CONFIG_HWBM */32#endif /* CONFIG_HWBM */
29#endif /* _HWBM_H */33#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
185}185}
186 186
187struct ip_frag_state {187struct ip_frag_state {
188 struct iphdr *iph;188 bool DF;
189 unsigned int hlen;189 unsigned int hlen;
190 unsigned int ll_rs;190 unsigned int ll_rs;
191 unsigned int mtu;191 unsigned int mtu;
@@ -196,7 +196,7 @@ struct ip_frag_state { · 4 unmodified lines
196};196};
197 197
198void ip_frag_init(struct sk_buff *skb, unsigned int hlen, unsigned int ll_rs,198void 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);
200struct sk_buff *ip_frag_next(struct sk_buff *skb,200struct sk_buff *ip_frag_next(struct sk_buff *skb,
201 struct ip_frag_state *state);201 struct ip_frag_state *state);
202 202
include/net/ip_vs.h+1−0
@@ -889,6 +889,7 @@ struct netns_ipvs { · 888 unmodified lines
889 struct delayed_work defense_work; /* Work handler */889 struct delayed_work defense_work; /* Work handler */
890 int drop_rate;890 int drop_rate;
891 int drop_counter;891 int drop_counter;
892 int old_secure_tcp;
892 atomic_t dropentry;893 atomic_t dropentry;
893 /* locks in ctl.c */894 /* locks in ctl.c */
894 spinlock_t dropentry_lock; /* drop entry handling */895 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
439{439{
440 unsigned long now = jiffies;440 unsigned long now = jiffies;
441 441
442 if (neigh->used != now)442 if (READ_ONCE(neigh->used) != now)
443 neigh->used = now;443 WRITE_ONCE(neigh->used, now);
444 if (!(neigh->nud_state&(NUD_CONNECTED|NUD_DELAY|NUD_PROBE)))444 if (!(neigh->nud_state&(NUD_CONNECTED|NUD_DELAY|NUD_PROBE)))
445 return __neigh_event_send(neigh, skb);445 return __neigh_event_send(neigh, skb);
446 return 0;446 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
342#define __net_initconst __initconst342#define __net_initconst __initconst
343#endif343#endif
344 344
345int peernet2id_alloc(struct net *net, struct net *peer);345int peernet2id_alloc(struct net *net, struct net *peer, gfp_t gfp);
346int peernet2id(struct net *net, struct net *peer);346int peernet2id(struct net *net, struct net *peer);
347bool peernet_has_id(struct net *net, struct net *peer);347bool peernet_has_id(struct net *net, struct net *peer);
348struct net *get_net_ns_by_id(struct net *net, int id);348struct 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
820 */820 */
821struct nft_expr {821struct nft_expr {
822 const struct nft_expr_ops *ops;822 const struct nft_expr_ops *ops;
823 unsigned char data[];823 unsigned char data[]
824 __attribute__((aligned(__alignof__(u64))));
824};825};
825 826
826static inline void *nft_expr_priv(const struct nft_expr *expr)827static inline void *nft_expr_priv(const struct nft_expr *expr)
include/net/sch_generic.h+4−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
15#include <linux/mutex.h>15#include <linux/mutex.h>
16#include <linux/rwsem.h>16#include <linux/rwsem.h>
17#include <linux/atomic.h>17#include <linux/atomic.h>
18#include <linux/hashtable.h>
18#include <net/gen_stats.h>19#include <net/gen_stats.h>
19#include <net/rtnetlink.h>20#include <net/rtnetlink.h>
20#include <net/flow_offload.h>21#include <net/flow_offload.h>
@@ -362,6 +363,7 @@ struct tcf_proto { · 341 unmodified lines
362 bool deleting;363 bool deleting;
363 refcount_t refcnt;364 refcount_t refcnt;
364 struct rcu_head rcu;365 struct rcu_head rcu;
366 struct hlist_node destroy_ht_node;
365};367};
366 368
367struct qdisc_skb_cb {369struct qdisc_skb_cb {
@@ -414,6 +416,8 @@ struct tcf_block { · 46 unmodified lines
414 struct list_head filter_chain_list;416 struct list_head filter_chain_list;
415 } chain0;417 } chain0;
416 struct rcu_head rcu;418 struct rcu_head rcu;
419 DECLARE_HASHTABLE(proto_destroy_ht, 7);
420 struct mutex proto_destroy_lock; /* Lock for proto_destroy hashtable. */
417};421};
418 422
419#ifdef CONFIG_PROVE_LOCKING423#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
954{954{
955 int cpu = raw_smp_processor_id();955 int cpu = raw_smp_processor_id();
956 956
957 if (unlikely(sk->sk_incoming_cpu != cpu))957 if (unlikely(READ_ONCE(sk->sk_incoming_cpu) != cpu))
958 sk->sk_incoming_cpu = cpu;958 WRITE_ONCE(sk->sk_incoming_cpu, cpu);
959}959}
960 960
961static inline void sock_rps_record_flow_hash(__u32 hash)961static 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
2242 * sk_page_frag - return an appropriate page_frag2242 * sk_page_frag - return an appropriate page_frag
2243 * @sk: socket2243 * @sk: socket
2244 *2244 *
2245 * If socket allocation mode allows current thread to sleep, it means its2245 * Use the per task page_frag instead of the per socket one for
2246 * safe to use the per task page_frag instead of the per socket one.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.
2247 */2252 */
2248static inline struct page_frag *sk_page_frag(struct sock *sk)2253static inline struct page_frag *sk_page_frag(struct sock *sk)
2249{2254{
2250 if (gfpflags_allow_blocking(sk->sk_allocation))2255 if (gfpflags_normal_context(sk->sk_allocation))
2251 return &current->task_frag;2256 return &current->task_frag;
2252 2257
2253 return &sk->sk_frag;2258 return &sk->sk_frag;
@@ -2337,7 +2342,7 @@ static inline ktime_t sock_read_timestamp(struct sock *sk) · 83 unmodified lines
2337 2342
2338 return kt;2343 return kt;
2339#else2344#else
2340 return sk->sk_stamp;2345 return READ_ONCE(sk->sk_stamp);
2341#endif2346#endif
2342}2347}
2343 2348
@@ -2348,7 +2353,7 @@ static inline void sock_write_timestamp(struct sock *sk, ktime_t kt) · 4 unmodified lines
2348 sk->sk_stamp = kt;2353 sk->sk_stamp = kt;
2349 write_sequnlock(&sk->sk_stamp_seq);2354 write_sequnlock(&sk->sk_stamp_seq);
2350#else2355#else
2351 sk->sk_stamp = kt;2356 WRITE_ONCE(sk->sk_stamp, kt);
2352#endif2357#endif
2353}2358}
2354 2359
include/net/tls.h+5−0
@@ -40,6 +40,7 @@ · 39 unmodified lines
40#include <linux/socket.h>40#include <linux/socket.h>
41#include <linux/tcp.h>41#include <linux/tcp.h>
42#include <linux/skmsg.h>42#include <linux/skmsg.h>
43#include <linux/mutex.h>
43#include <linux/netdevice.h>44#include <linux/netdevice.h>
44#include <linux/rcupdate.h>45#include <linux/rcupdate.h>
45 46
@@ -269,6 +270,10 @@ struct tls_context { · 223 unmodified lines
269 270
270 bool in_tcp_sendpages;271 bool in_tcp_sendpages;
271 bool pending_open_record_frags;272 bool pending_open_record_frags;
273
274 struct mutex tx_lock; /* protects partially_sent_* fields and
275 * per-type TX fields
276 */
272 unsigned long flags;277 unsigned long flags;
273 278
274 /* cache cold stuff */279 /* cache cold stuff */
include/net/vxlan.h+1−0
@@ -197,6 +197,7 @@ struct vxlan_rdst { · 196 unmodified lines
197 u8 offloaded:1;197 u8 offloaded:1;
198 __be32 remote_vni;198 __be32 remote_vni;
199 u32 remote_ifindex;199 u32 remote_ifindex;
200 struct net_device *remote_dev;
200 struct list_head list;201 struct list_head list;
201 struct rcu_head rcu;202 struct rcu_head rcu;
202 struct dst_cache dst_cache;203 struct dst_cache dst_cache;
include/rdma/ib_verbs.h+1−1
@@ -366,7 +366,7 @@ struct ib_tm_caps { · 365 unmodified lines
366 366
367struct ib_cq_init_attr {367struct ib_cq_init_attr {
368 unsigned int cqe;368 unsigned int cqe;
369 int comp_vector;369 u32 comp_vector;
370 u32 flags;370 u32 flags;
371};371};
372 372
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) */
2/*2/*
3 * linux/can.h3 * linux/can.h
4 *4 *
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) */
2/*2/*
3 * linux/can/bcm.h3 * linux/can/bcm.h
4 *4 *
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) */
2/*2/*
3 * linux/can/error.h3 * linux/can/error.h
4 *4 *
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) */
2/*2/*
3 * linux/can/gw.h3 * linux/can/gw.h
4 *4 *
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 */
2/*2/*
3 * j1939.h3 * j1939.h
4 *4 *
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 */
2/*2/*
3 * linux/can/netlink.h3 * linux/can/netlink.h
4 *4 *
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) */
2/*2/*
3 * linux/can/raw.h3 * linux/can/raw.h
4 *4 *
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 */
2#ifndef _UAPI_CAN_VXCAN_H2#ifndef _UAPI_CAN_VXCAN_H
3#define _UAPI_CAN_VXCAN_H3#define _UAPI_CAN_VXCAN_H
4 4
include/uapi/linux/fuse.h+37−0
@@ -38,6 +38,43 @@ · 37 unmodified lines
38 *38 *
39 * Protocol changelog:39 * Protocol changelog:
40 *40 *
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 *
41 * 7.9:78 * 7.9:
42 * - new fuse_getattr_in input argument of GETATTR79 * - new fuse_getattr_in input argument of GETATTR
43 * - add lk_flags in fuse_lk_in80 * - 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
63 __u32 cdw14;63 __u32 cdw14;
64 __u32 cdw15;64 __u32 cdw15;
65 __u32 timeout_ms;65 __u32 timeout_ms;
66 __u32 rsvd2;
66 __u64 result;67 __u64 result;
67};68};
68 69
include/uapi/linux/sched.h+4−0
@@ -51,6 +51,10 @@ · 50 unmodified lines
51 * sent when the child exits.51 * sent when the child exits.
52 * @stack: Specify the location of the stack for the52 * @stack: Specify the location of the stack for the
53 * child process.53 * 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.
54 * @stack_size: The size of the stack for the child process.58 * @stack_size: The size of the stack for the child process.
55 * @tls: If CLONE_SETTLS is set, the tls descriptor59 * @tls: If CLONE_SETTLS is set, the tls descriptor
56 * is set to tls.60 * 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
1311 return false;1311 return false;
1312 1312
1313 switch (off) {1313 switch (off) {
1314 case offsetof(struct bpf_sysctl, write):1314 case bpf_ctx_range(struct bpf_sysctl, write):
1315 if (type != BPF_READ)1315 if (type != BPF_READ)
1316 return false;1316 return false;
1317 bpf_ctx_record_field_size(info, size_default);1317 bpf_ctx_record_field_size(info, size_default);
1318 return bpf_ctx_narrow_access_ok(off, size, size_default);1318 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):
1320 if (type == BPF_READ) {1320 if (type == BPF_READ) {
1321 bpf_ctx_record_field_size(info, size_default);1321 bpf_ctx_record_field_size(info, size_default);
1322 return bpf_ctx_narrow_access_ok(off, size, size_default);1322 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
502 return WARN_ON_ONCE(bpf_adj_branches(prog, off, off + cnt, off, false));502 return WARN_ON_ONCE(bpf_adj_branches(prog, off, off + cnt, off, false));
503}503}
504 504
505void bpf_prog_kallsyms_del_subprogs(struct bpf_prog *fp)505static void bpf_prog_kallsyms_del_subprogs(struct bpf_prog *fp)
506{506{
507 int i;507 int i;
508 508
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
128 128
129 if (!dtab->n_buckets) /* Overflow check */129 if (!dtab->n_buckets) /* Overflow check */
130 return -EINVAL;130 return -EINVAL;
131 cost += sizeof(struct hlist_head) * dtab->n_buckets;131 cost += (u64) sizeof(struct hlist_head) * dtab->n_buckets;
132 }132 }
133 133
134 /* if map size is larger than memlock limit, reject it */134 /* 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
719 .map_check_btf = map_check_no_btf,719 .map_check_btf = map_check_no_btf,
720};720};
721 721
722static 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
722static int dev_map_notification(struct notifier_block *notifier,748static int dev_map_notification(struct notifier_block *notifier,
723 ulong event, void *ptr)749 ulong event, void *ptr)
724{750{
@@ -735,6 +761,11 @@ static int dev_map_notification(struct notifier_block *notifier, · 10 unmodified lines
735 */761 */
736 rcu_read_lock();762 rcu_read_lock();
737 list_for_each_entry_rcu(dtab, &dev_map_list, list) {763 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
738 for (i = 0; i < dtab->map.max_entries; i++) {769 for (i = 0; i < dtab->map.max_entries; i++) {
739 struct bpf_dtab_netdev *dev, *odev;770 struct bpf_dtab_netdev *dev, *odev;
740 771
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
126 return map;126 return map;
127}127}
128 128
129void *bpf_map_area_alloc(size_t size, int numa_node)129void *bpf_map_area_alloc(u64 size, int numa_node)
130{130{
131 /* We really just want to fail instead of triggering OOM killer131 /* We really just want to fail instead of triggering OOM killer
132 * under memory pressure, therefore we set __GFP_NORETRY to kmalloc,132 * 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
141 const gfp_t flags = __GFP_NOWARN | __GFP_ZERO;141 const gfp_t flags = __GFP_NOWARN | __GFP_ZERO;
142 void *area;142 void *area;
143 143
144 if (size >= SIZE_MAX)
145 return NULL;
146
144 if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) {147 if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) {
145 area = kmalloc_node(size, GFP_USER | __GFP_NORETRY | flags,148 area = kmalloc_node(size, GFP_USER | __GFP_NORETRY | flags,
146 numa_node);149 numa_node);
@@ -197,7 +200,7 @@ static void bpf_uncharge_memlock(struct user_struct *user, u32 pages) · 50 unmodified lines
197 atomic_long_sub(pages, &user->locked_vm);200 atomic_long_sub(pages, &user->locked_vm);
198}201}
199 202
200int bpf_map_charge_init(struct bpf_map_memory *mem, size_t size)203int bpf_map_charge_init(struct bpf_map_memory *mem, u64 size)
201{204{
202 u32 pages = round_up(size, PAGE_SIZE) >> PAGE_SHIFT;205 u32 pages = round_up(size, PAGE_SIZE) >> PAGE_SHIFT;
203 struct user_struct *user;206 struct user_struct *user;
@@ -1326,24 +1329,32 @@ static void __bpf_prog_put_rcu(struct rcu_head *rcu) · 1122 unmodified lines
1326{1329{
1327 struct bpf_prog_aux *aux = container_of(rcu, struct bpf_prog_aux, rcu);1330 struct bpf_prog_aux *aux = container_of(rcu, struct bpf_prog_aux, rcu);
1328 1331
1332 kvfree(aux->func_info);
1329 free_used_maps(aux);1333 free_used_maps(aux);
1330 bpf_prog_uncharge_memlock(aux->prog);1334 bpf_prog_uncharge_memlock(aux->prog);
1331 security_bpf_prog_free(aux);1335 security_bpf_prog_free(aux);
1332 bpf_prog_free(aux->prog);1336 bpf_prog_free(aux->prog);
1333}1337}
1334 1338
1339static 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
1335static void __bpf_prog_put(struct bpf_prog *prog, bool do_idr_lock)1351static void __bpf_prog_put(struct bpf_prog *prog, bool do_idr_lock)
1336{1352{
1337 if (atomic_dec_and_test(&prog->aux->refcnt)) {1353 if (atomic_dec_and_test(&prog->aux->refcnt)) {
1338 perf_event_bpf_event(prog, PERF_BPF_EVENT_PROG_UNLOAD, 0);1354 perf_event_bpf_event(prog, PERF_BPF_EVENT_PROG_UNLOAD, 0);
1339 /* bpf_prog_free_id() must be called first */1355 /* bpf_prog_free_id() must be called first */
1340 bpf_prog_free_id(prog, do_idr_lock);1356 bpf_prog_free_id(prog, do_idr_lock);
1341 bpf_prog_kallsyms_del_all(prog);1357 __bpf_prog_put_noref(prog, true);
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);
1347 }1358 }
1348}1359}
1349 1360
@@ -1741,11 +1752,12 @@ static int bpf_prog_load(union bpf_attr *attr, union bpf_attr __user *uattr) · 391 unmodified lines
1741 return err;1752 return err;
1742 1753
1743free_used_maps:1754free_used_maps:
1744 bpf_prog_free_linfo(prog);1755 /* In case we have subprogs, we need to wait for a grace
1745 kvfree(prog->aux->func_info);1756 * period before we can tear down JIT memory since symbols
1746 btf_put(prog->aux->btf);1757 * are already exposed under kallsyms.
1747 bpf_prog_kallsyms_del_subprogs(prog);1758 */
1748 free_used_maps(prog->aux);1759 __bpf_prog_put_noref(prog, prog->aux->func_cnt);
1760 return err;
1749free_prog:1761free_prog:
1750 bpf_prog_uncharge_memlock(prog);1762 bpf_prog_uncharge_memlock(prog);
1751free_prog_sec:1763free_prog_sec:
kernel/cgroup/cpuset.c+2−1
@@ -798,7 +798,8 @@ static int generate_sched_domains(cpumask_var_t **domains, · 797 unmodified lines
798 cpumask_subset(cp->cpus_allowed, top_cpuset.effective_cpus))798 cpumask_subset(cp->cpus_allowed, top_cpuset.effective_cpus))
799 continue;799 continue;
800 800
801 if (is_sched_load_balance(cp))801 if (is_sched_load_balance(cp) &&
802 !cpumask_empty(cp->effective_cpus))
802 csa[csn++] = cp;803 csa[csn++] = cp;
803 804
804 /* skip @cp's subtree if not a partition root */805 /* 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
2561 return 0;2561 return 0;
2562}2562}
2563 2563
2564static 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 */
2572static 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
2592static bool clone3_args_valid(struct kernel_clone_args *kargs)
2565{2593{
2566 /*2594 /*
2567 * All lower bits of the flag word are taken.2595 * 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
2581 kargs->exit_signal)2609 kargs->exit_signal)
2582 return false;2610 return false;
2583 2611
2612 if (!clone3_stack_valid(kargs))
2613 return false;
2614
2584 return true;2615 return true;
2585}2616}
2586 2617
kernel/irq/irqdomain.c+1−1
@@ -51,7 +51,7 @@ EXPORT_SYMBOL_GPL(irqchip_fwnode_ops); · 50 unmodified lines
51 * @type: Type of irqchip_fwnode. See linux/irqdomain.h51 * @type: Type of irqchip_fwnode. See linux/irqdomain.h
52 * @name: Optional user provided domain name52 * @name: Optional user provided domain name
53 * @id: Optional user provided id if name != NULL53 * @id: Optional user provided id if name != NULL
54 * @data: Optional user-provided data54 * @pa: Optional user-provided physical address
55 *55 *
56 * Allocate a struct irqchip_fwid, and return a poiner to the embedded56 * Allocate a struct irqchip_fwid, and return a poiner to the embedded
57 * fwnode_handle (or NULL on failure).57 * 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
1073 task_rq_unlock(rq, p, &rf);1073 task_rq_unlock(rq, p, &rf);
1074}1074}
1075 1075
1076#ifdef CONFIG_UCLAMP_TASK_GROUP
1076static inline void1077static inline void
1077uclamp_update_active_tasks(struct cgroup_subsys_state *css,1078uclamp_update_active_tasks(struct cgroup_subsys_state *css,
1078 unsigned int clamps)1079 unsigned int clamps)
@@ -1091,7 +1092,6 @@ uclamp_update_active_tasks(struct cgroup_subsys_state *css, · 12 unmodified lines
1091 css_task_iter_end(&it);1092 css_task_iter_end(&it);
1092}1093}
1093 1094
1094#ifdef CONFIG_UCLAMP_TASK_GROUP
1095static void cpu_util_update_eff(struct cgroup_subsys_state *css);1095static void cpu_util_update_eff(struct cgroup_subsys_state *css);
1096static void uclamp_update_root_tg(void)1096static void uclamp_update_root_tg(void)
1097{1097{
@@ -3929,13 +3929,22 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) · 2831 unmodified lines
3929 }3929 }
3930 3930
3931restart:3931restart:
3932#ifdef CONFIG_SMP
3932 /*3933 /*
3933 * Ensure that we put DL/RT tasks before the pick loop, such that they3934 * We must do the balancing pass before put_next_task(), such
3934 * can PULL higher prio tasks when we lower the RQ 'priority'.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.
3935 */3940 */
3936 prev->sched_class->put_prev_task(rq, prev, rf);3941 for_class_range(class, prev->sched_class, &idle_sched_class) {
3937 if (!rq->nr_running)3942 if (class->balance(rq, prev, rf))
3938 newidle_balance(rq, rf);3943 break;
3944 }
3945#endif
3946
3947 put_prev_task(rq, prev);
3939 3948
3940 for_each_class(class) {3949 for_each_class(class) {
3941 p = class->pick_next_task(rq, NULL, NULL);3950 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
6201 for_each_class(class) {6210 for_each_class(class) {
6202 next = class->pick_next_task(rq, NULL, NULL);6211 next = class->pick_next_task(rq, NULL, NULL);
6203 if (next) {6212 if (next) {
6204 next->sched_class->put_prev_task(rq, next, NULL);6213 next->sched_class->put_prev_task(rq, next);
6205 return next;6214 return next;
6206 }6215 }
6207 }6216 }
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
1691 resched_curr(rq);1691 resched_curr(rq);
1692}1692}
1693 1693
1694static 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}
1694#endif /* CONFIG_SMP */1710#endif /* CONFIG_SMP */
1695 1711
1696/*1712/*
@@ -1758,45 +1774,28 @@ static struct task_struct * · 61 unmodified lines
1758pick_next_task_dl(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)1774pick_next_task_dl(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
1759{1775{
1760 struct sched_dl_entity *dl_se;1776 struct sched_dl_entity *dl_se;
1777 struct dl_rq *dl_rq = &rq->dl;
1761 struct task_struct *p;1778 struct task_struct *p;
1762 struct dl_rq *dl_rq;
1763 1779
1764 WARN_ON_ONCE(prev || rf);1780 WARN_ON_ONCE(prev || rf);
1765 1781
1766 dl_rq = &rq->dl;1782 if (!sched_dl_runnable(rq))
1767
1768 if (unlikely(!dl_rq->dl_nr_running))
1769 return NULL;1783 return NULL;
1770 1784
1771 dl_se = pick_next_dl_entity(rq, dl_rq);1785 dl_se = pick_next_dl_entity(rq, dl_rq);
1772 BUG_ON(!dl_se);1786 BUG_ON(!dl_se);
1773
1774 p = dl_task_of(dl_se);1787 p = dl_task_of(dl_se);
1775
1776 set_next_task_dl(rq, p);1788 set_next_task_dl(rq, p);
1777
1778 return p;1789 return p;
1779}1790}
1780 1791
1781static void put_prev_task_dl(struct rq *rq, struct task_struct *p, struct rq_flags *rf)1792static void put_prev_task_dl(struct rq *rq, struct task_struct *p)
1782{1793{
1783 update_curr_dl(rq);1794 update_curr_dl(rq);
1784 1795
1785 update_dl_rq_load_avg(rq_clock_pelt(rq), rq, 1);1796 update_dl_rq_load_avg(rq_clock_pelt(rq), rq, 1);
1786 if (on_dl_rq(&p->dl) && p->nr_cpus_allowed > 1)1797 if (on_dl_rq(&p->dl) && p->nr_cpus_allowed > 1)
1787 enqueue_pushable_dl_task(rq, p);1798 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 }
1800}1799}
1801 1800
1802/*1801/*
@@ -2442,6 +2441,7 @@ const struct sched_class dl_sched_class = { · 639 unmodified lines
2442 .set_next_task = set_next_task_dl,2441 .set_next_task = set_next_task_dl,
2443 2442
2444#ifdef CONFIG_SMP2443#ifdef CONFIG_SMP
2444 .balance = balance_dl,
2445 .select_task_rq = select_task_rq_dl,2445 .select_task_rq = select_task_rq_dl,
2446 .migrate_task_rq = migrate_task_rq_dl,2446 .migrate_task_rq = migrate_task_rq_dl,
2447 .set_cpus_allowed = set_cpus_allowed_dl,2447 .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
6570{6570{
6571 remove_entity_load_avg(&p->se);6571 remove_entity_load_avg(&p->se);
6572}6572}
6573
6574static int
6575balance_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}
6573#endif /* CONFIG_SMP */6582#endif /* CONFIG_SMP */
6574 6583
6575static unsigned long wakeup_gran(struct sched_entity *se)6584static 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
6746 int new_tasks;6755 int new_tasks;
6747 6756
6748again:6757again:
6749 if (!cfs_rq->nr_running)6758 if (!sched_fair_runnable(rq))
6750 goto idle;6759 goto idle;
6751 6760
6752#ifdef CONFIG_FAIR_GROUP_SCHED6761#ifdef CONFIG_FAIR_GROUP_SCHED
@@ -6884,7 +6893,7 @@ idle: · 131 unmodified lines
6884/*6893/*
6885 * Account for a descheduled task:6894 * Account for a descheduled task:
6886 */6895 */
6887static void put_prev_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)6896static void put_prev_task_fair(struct rq *rq, struct task_struct *prev)
6888{6897{
6889 struct sched_entity *se = &prev->se;6898 struct sched_entity *se = &prev->se;
6890 struct cfs_rq *cfs_rq;6899 struct cfs_rq *cfs_rq;
@@ -10414,11 +10423,11 @@ const struct sched_class fair_sched_class = { · 3523 unmodified lines
10414 .check_preempt_curr = check_preempt_wakeup,10423 .check_preempt_curr = check_preempt_wakeup,
10415 10424
10416 .pick_next_task = pick_next_task_fair,10425 .pick_next_task = pick_next_task_fair,
10417
10418 .put_prev_task = put_prev_task_fair,10426 .put_prev_task = put_prev_task_fair,
10419 .set_next_task = set_next_task_fair,10427 .set_next_task = set_next_task_fair,
10420 10428
10421#ifdef CONFIG_SMP10429#ifdef CONFIG_SMP
10430 .balance = balance_fair,
10422 .select_task_rq = select_task_rq_fair,10431 .select_task_rq = select_task_rq_fair,
10423 .migrate_task_rq = migrate_task_rq_fair,10432 .migrate_task_rq = migrate_task_rq_fair,
10424 10433
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
365{365{
366 return task_cpu(p); /* IDLE tasks as never migrated */366 return task_cpu(p); /* IDLE tasks as never migrated */
367}367}
368
369static int
370balance_idle(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
371{
372 return WARN_ON_ONCE(1);
373}
368#endif374#endif
369 375
370/*376/*
@@ -375,7 +381,7 @@ static void check_preempt_curr_idle(struct rq *rq, struct task_struct *p, int fl · 4 unmodified lines
375 resched_curr(rq);381 resched_curr(rq);
376}382}
377 383
378static void put_prev_task_idle(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)384static void put_prev_task_idle(struct rq *rq, struct task_struct *prev)
379{385{
380}386}
381 387
@@ -460,6 +466,7 @@ const struct sched_class idle_sched_class = { · 78 unmodified lines
460 .set_next_task = set_next_task_idle,466 .set_next_task = set_next_task_idle,
461 467
462#ifdef CONFIG_SMP468#ifdef CONFIG_SMP
469 .balance = balance_idle,
463 .select_task_rq = select_task_rq_idle,470 .select_task_rq = select_task_rq_idle,
464 .set_cpus_allowed = set_cpus_allowed_common,471 .set_cpus_allowed = set_cpus_allowed_common,
465#endif472#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
1469 resched_curr(rq);1469 resched_curr(rq);
1470}1470}
1471 1471
1472static 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}
1472#endif /* CONFIG_SMP */1488#endif /* CONFIG_SMP */
1473 1489
1474/*1490/*
@@ -1552,21 +1568,18 @@ static struct task_struct * · 77 unmodified lines
1552pick_next_task_rt(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)1568pick_next_task_rt(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
1553{1569{
1554 struct task_struct *p;1570 struct task_struct *p;
1555 struct rt_rq *rt_rq = &rq->rt;
1556 1571
1557 WARN_ON_ONCE(prev || rf);1572 WARN_ON_ONCE(prev || rf);
1558 1573
1559 if (!rt_rq->rt_queued)1574 if (!sched_rt_runnable(rq))
1560 return NULL;1575 return NULL;
1561 1576
1562 p = _pick_next_task_rt(rq);1577 p = _pick_next_task_rt(rq);
1563
1564 set_next_task_rt(rq, p);1578 set_next_task_rt(rq, p);
1565
1566 return p;1579 return p;
1567}1580}
1568 1581
1569static void put_prev_task_rt(struct rq *rq, struct task_struct *p, struct rq_flags *rf)1582static void put_prev_task_rt(struct rq *rq, struct task_struct *p)
1570{1583{
1571 update_curr_rt(rq);1584 update_curr_rt(rq);
1572 1585
@@ -1578,18 +1591,6 @@ static void put_prev_task_rt(struct rq *rq, struct task_struct *p, struct rq_fla · 5 unmodified lines
1578 */1591 */
1579 if (on_rt_rq(&p->rt) && p->nr_cpus_allowed > 1)1592 if (on_rt_rq(&p->rt) && p->nr_cpus_allowed > 1)
1580 enqueue_pushable_task(rq, p);1593 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 }
1593}1594}
1594 1595
1595#ifdef CONFIG_SMP1596#ifdef CONFIG_SMP
@@ -2366,8 +2367,8 @@ const struct sched_class rt_sched_class = { · 770 unmodified lines
2366 .set_next_task = set_next_task_rt,2367 .set_next_task = set_next_task_rt,
2367 2368
2368#ifdef CONFIG_SMP2369#ifdef CONFIG_SMP
2370 .balance = balance_rt,
2369 .select_task_rq = select_task_rq_rt,2371 .select_task_rq = select_task_rq_rt,
2370
2371 .set_cpus_allowed = set_cpus_allowed_common,2372 .set_cpus_allowed = set_cpus_allowed_common,
2372 .rq_online = rq_online_rt,2373 .rq_online = rq_online_rt,
2373 .rq_offline = rq_offline_rt,2374 .rq_offline = rq_offline_rt,
kernel/sched/sched.h+27−3
@@ -1727,10 +1727,11 @@ struct sched_class { · 1726 unmodified lines
1727 struct task_struct * (*pick_next_task)(struct rq *rq,1727 struct task_struct * (*pick_next_task)(struct rq *rq,
1728 struct task_struct *prev,1728 struct task_struct *prev,
1729 struct rq_flags *rf);1729 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);
1731 void (*set_next_task)(struct rq *rq, struct task_struct *p);1731 void (*set_next_task)(struct rq *rq, struct task_struct *p);
1732 1732
1733#ifdef CONFIG_SMP1733#ifdef CONFIG_SMP
1734 int (*balance)(struct rq *rq, struct task_struct *prev, struct rq_flags *rf);
1734 int (*select_task_rq)(struct task_struct *p, int task_cpu, int sd_flag, int flags);1735 int (*select_task_rq)(struct task_struct *p, int task_cpu, int sd_flag, int flags);
1735 void (*migrate_task_rq)(struct task_struct *p, int new_cpu);1736 void (*migrate_task_rq)(struct task_struct *p, int new_cpu);
1736 1737
@@ -1773,7 +1774,7 @@ struct sched_class { · 36 unmodified lines
1773static inline void put_prev_task(struct rq *rq, struct task_struct *prev)1774static inline void put_prev_task(struct rq *rq, struct task_struct *prev)
1774{1775{
1775 WARN_ON_ONCE(rq->curr != prev);1776 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);
1777}1778}
1778 1779
1779static inline void set_next_task(struct rq *rq, struct task_struct *next)1780static 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
1787#else1788#else
1788#define sched_class_highest (&dl_sched_class)1789#define sched_class_highest (&dl_sched_class)
1789#endif1790#endif
1791
1792#define for_class_range(class, _from, _to) \
1793 for (class = (_from); class != (_to); class = class->next)
1794
1790#define for_each_class(class) \1795#define for_each_class(class) \
1791 for (class = sched_class_highest; class; class = class->next)1796 for_class_range(class, sched_class_highest, NULL)
1792 1797
1793extern const struct sched_class stop_sched_class;1798extern const struct sched_class stop_sched_class;
1794extern const struct sched_class dl_sched_class;1799extern const struct sched_class dl_sched_class;
@@ -1796,6 +1801,25 @@ extern const struct sched_class rt_sched_class; · 1 unmodified line
1796extern const struct sched_class fair_sched_class;1801extern const struct sched_class fair_sched_class;
1797extern const struct sched_class idle_sched_class;1802extern const struct sched_class idle_sched_class;
1798 1803
1804static inline bool sched_stop_runnable(struct rq *rq)
1805{
1806 return rq->stop && task_on_rq_queued(rq->stop);
1807}
1808
1809static inline bool sched_dl_runnable(struct rq *rq)
1810{
1811 return rq->dl.dl_nr_running > 0;
1812}
1813
1814static inline bool sched_rt_runnable(struct rq *rq)
1815{
1816 return rq->rt.rt_queued > 0;
1817}
1818
1819static inline bool sched_fair_runnable(struct rq *rq)
1820{
1821 return rq->cfs.nr_running > 0;
1822}
1799 1823
1800#ifdef CONFIG_SMP1824#ifdef CONFIG_SMP
1801 1825
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
15{15{
16 return task_cpu(p); /* stop tasks as never migrate */16 return task_cpu(p); /* stop tasks as never migrate */
17}17}
18
19static int
20balance_stop(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
21{
22 return sched_stop_runnable(rq);
23}
18#endif /* CONFIG_SMP */24#endif /* CONFIG_SMP */
19 25
20static void26static void
@@ -31,16 +37,13 @@ static void set_next_task_stop(struct rq *rq, struct task_struct *stop) · 10 unmodified lines
31static struct task_struct *37static struct task_struct *
32pick_next_task_stop(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)38pick_next_task_stop(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
33{39{
34 struct task_struct *stop = rq->stop;
35
36 WARN_ON_ONCE(prev || rf);40 WARN_ON_ONCE(prev || rf);
37 41
38 if (!stop || !task_on_rq_queued(stop))42 if (!sched_stop_runnable(rq))
39 return NULL;43 return NULL;
40 44
41 set_next_task_stop(rq, stop);45 set_next_task_stop(rq, rq->stop);
42 46 return rq->stop;
43 return stop;
44}47}
45 48
46static void49static void
@@ -60,7 +63,7 @@ static void yield_task_stop(struct rq *rq) · 13 unmodified lines
60 BUG(); /* the stop task should never yield, its pointless. */63 BUG(); /* the stop task should never yield, its pointless. */
61}64}
62 65
63static void put_prev_task_stop(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)66static void put_prev_task_stop(struct rq *rq, struct task_struct *prev)
64{67{
65 struct task_struct *curr = rq->curr;68 struct task_struct *curr = rq->curr;
66 u64 delta_exec;69 u64 delta_exec;
@@ -129,6 +132,7 @@ const struct sched_class stop_sched_class = { · 62 unmodified lines
129 .set_next_task = set_next_task_stop,132 .set_next_task = set_next_task_stop,
130 133
131#ifdef CONFIG_SMP134#ifdef CONFIG_SMP
135 .balance = balance_stop,
132 .select_task_rq = select_task_rq_stop,136 .select_task_rq = select_task_rq_stop,
133 .set_cpus_allowed = set_cpus_allowed_common,137 .set_cpus_allowed = set_cpus_allowed_common,
134#endif138#endif
kernel/sched/topology.c+9−2
@@ -1948,7 +1948,7 @@ next_level: · 1947 unmodified lines
1948static int1948static int
1949build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *attr)1949build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *attr)
1950{1950{
1951 enum s_alloc alloc_state;1951 enum s_alloc alloc_state = sa_none;
1952 struct sched_domain *sd;1952 struct sched_domain *sd;
1953 struct s_data d;1953 struct s_data d;
1954 struct rq *rq = NULL;1954 struct rq *rq = NULL;
@@ -1956,6 +1956,9 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att · 1 unmodified line
1956 struct sched_domain_topology_level *tl_asym;1956 struct sched_domain_topology_level *tl_asym;
1957 bool has_asym = false;1957 bool has_asym = false;
1958 1958
1959 if (WARN_ON(cpumask_empty(cpu_map)))
1960 goto error;
1961
1959 alloc_state = __visit_domain_allocation_hell(&d, cpu_map);1962 alloc_state = __visit_domain_allocation_hell(&d, cpu_map);
1960 if (alloc_state != sa_rootdomain)1963 if (alloc_state != sa_rootdomain)
1961 goto error;1964 goto error;
@@ -2026,7 +2029,7 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att · 64 unmodified lines
2026 rcu_read_unlock();2029 rcu_read_unlock();
2027 2030
2028 if (has_asym)2031 if (has_asym)
2029 static_branch_enable_cpuslocked(&sched_asym_cpucapacity);2032 static_branch_inc_cpuslocked(&sched_asym_cpucapacity);
2030 2033
2031 if (rq && sched_debug_enabled) {2034 if (rq && sched_debug_enabled) {
2032 pr_info("root domain span: %*pbl (max cpu_capacity = %lu)\n",2035 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
2121 */2124 */
2122static void detach_destroy_domains(const struct cpumask *cpu_map)2125static void detach_destroy_domains(const struct cpumask *cpu_map)
2123{2126{
2127 unsigned int cpu = cpumask_any(cpu_map);
2124 int i;2128 int i;
2125 2129
2130 if (rcu_access_pointer(per_cpu(sd_asym_cpucapacity, cpu)))
2131 static_branch_dec_cpuslocked(&sched_asym_cpucapacity);
2132
2126 rcu_read_lock();2133 rcu_read_lock();
2127 for_each_cpu(i, cpu_map)2134 for_each_cpu(i, cpu_map)
2128 cpu_attach_domain(NULL, &def_root_domain, i);2135 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
141 struct stacktrace_cookie c = {141 struct stacktrace_cookie c = {
142 .store = store,142 .store = store,
143 .size = size,143 .size = size,
144 .skip = skipnr + 1,144 /* skip this function if they are tracing us */
145 .skip = skipnr + !!(current == tsk),
145 };146 };
146 147
147 if (!try_get_task_stack(tsk))148 if (!try_get_task_stack(tsk))
@@ -298,7 +299,8 @@ unsigned int stack_trace_save_tsk(struct task_struct *task, · 150 unmodified lines
298 struct stack_trace trace = {299 struct stack_trace trace = {
299 .entries = store,300 .entries = store,
300 .max_entries = size,301 .max_entries = size,
301 .skip = skipnr + 1,302 /* skip this function if they are tracing us */
303 .skip = skipnr + !!(current == task),
302 };304 };
303 305
304 save_stack_trace_tsk(task, &trace);306 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
110 nsec = nsec + tk->wall_to_monotonic.tv_nsec;110 nsec = nsec + tk->wall_to_monotonic.tv_nsec;
111 vdso_ts->sec += __iter_div_u64_rem(nsec, NSEC_PER_SEC, &vdso_ts->nsec);111 vdso_ts->sec += __iter_div_u64_rem(nsec, NSEC_PER_SEC, &vdso_ts->nsec);
112 112
113 if (__arch_use_vsyscall(vdata))113 update_vdso_data(vdata, tk);
114 update_vdso_data(vdata, tk);
115 114
116 __arch_update_vsyscall(vdata, tk);115 __arch_update_vsyscall(vdata, tk);
117 116
@@ -124,10 +123,8 @@ void update_vsyscall_tz(void) · 6 unmodified lines
124{123{
125 struct vdso_data *vdata = __arch_get_k_vdso_data();124 struct vdso_data *vdata = __arch_get_k_vdso_data();
126 125
127 if (__arch_use_vsyscall(vdata)) {126 vdata[CS_HRES_COARSE].tz_minuteswest = sys_tz.tz_minuteswest;
128 vdata[CS_HRES_COARSE].tz_minuteswest = sys_tz.tz_minuteswest;127 vdata[CS_HRES_COARSE].tz_dsttime = sys_tz.tz_dsttime;
129 vdata[CS_HRES_COARSE].tz_dsttime = sys_tz.tz_dsttime;
130 }
131 128
132 __arch_sync_vdso_data(vdata);129 __arch_sync_vdso_data(vdata);
133}130}
lib/Kconfig+0−1
@@ -447,7 +447,6 @@ config ASSOCIATIVE_ARRAY · 446 unmodified lines
447config HAS_IOMEM447config HAS_IOMEM
448 bool448 bool
449 depends on !NO_IOMEM449 depends on !NO_IOMEM
450 select GENERIC_IO
451 default y450 default y
452 451
453config HAS_IOPORT_MAP452config HAS_IOPORT_MAP
lib/dump_stack.c+6−1
@@ -106,7 +106,12 @@ retry: · 105 unmodified lines
106 was_locked = 1;106 was_locked = 1;
107 } else {107 } else {
108 local_irq_restore(flags);108 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);
110 goto retry;115 goto retry;
111 }116 }
112 117
lib/idr.c+11−20
@@ -215,7 +215,7 @@ int idr_for_each(const struct idr *idr, · 214 unmodified lines
215EXPORT_SYMBOL(idr_for_each);215EXPORT_SYMBOL(idr_for_each);
216 216
217/**217/**
218 * idr_get_next() - Find next populated entry.218 * idr_get_next_ul() - Find next populated entry.
219 * @idr: IDR handle.219 * @idr: IDR handle.
220 * @nextid: Pointer to an ID.220 * @nextid: Pointer to an ID.
221 *221 *
@@ -224,7 +224,7 @@ EXPORT_SYMBOL(idr_for_each); · 2 unmodified lines
224 * to the ID of the found value. To use in a loop, the value pointed to by224 * to the ID of the found value. To use in a loop, the value pointed to by
225 * nextid must be incremented by the user.225 * nextid must be incremented by the user.
226 */226 */
227void *idr_get_next(struct idr *idr, int *nextid)227void *idr_get_next_ul(struct idr *idr, unsigned long *nextid)
228{228{
229 struct radix_tree_iter iter;229 struct radix_tree_iter iter;
230 void __rcu **slot;230 void __rcu **slot;
@@ -245,18 +245,14 @@ void *idr_get_next(struct idr *idr, int *nextid) · 14 unmodified lines
245 }245 }
246 if (!slot)246 if (!slot)
247 return NULL;247 return NULL;
248 id = iter.index + base;
249
250 if (WARN_ON_ONCE(id > INT_MAX))
251 return NULL;
252 248
253 *nextid = id;249 *nextid = iter.index + base;
254 return entry;250 return entry;
255}251}
256EXPORT_SYMBOL(idr_get_next);252EXPORT_SYMBOL(idr_get_next_ul);
257 253
258/**254/**
259 * idr_get_next_ul() - Find next populated entry.255 * idr_get_next() - Find next populated entry.
260 * @idr: IDR handle.256 * @idr: IDR handle.
261 * @nextid: Pointer to an ID.257 * @nextid: Pointer to an ID.
262 *258 *
@@ -265,22 +261,17 @@ EXPORT_SYMBOL(idr_get_next); · 2 unmodified lines
265 * to the ID of the found value. To use in a loop, the value pointed to by261 * to the ID of the found value. To use in a loop, the value pointed to by
266 * nextid must be incremented by the user.262 * nextid must be incremented by the user.
267 */263 */
268void *idr_get_next_ul(struct idr *idr, unsigned long *nextid)264void *idr_get_next(struct idr *idr, int *nextid)
269{265{
270 struct radix_tree_iter iter;
271 void __rcu **slot;
272 unsigned long base = idr->idr_base;
273 unsigned long id = *nextid;266 unsigned long id = *nextid;
267 void *entry = idr_get_next_ul(idr, &id);
274 268
275 id = (id < base) ? 0 : id - base;269 if (WARN_ON_ONCE(id > INT_MAX))
276 slot = radix_tree_iter_find(&idr->idr_rt, &iter, id);
277 if (!slot)
278 return NULL;270 return NULL;
279 271 *nextid = id;
280 *nextid = iter.index + base;272 return entry;
281 return rcu_dereference_raw(*slot);
282}273}
283EXPORT_SYMBOL(idr_get_next_ul);274EXPORT_SYMBOL(idr_get_next);
284 275
285/**276/**
286 * idr_replace() - replace pointer for given ID.277 * 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
1529 offset = radix_tree_find_next_bit(node, IDR_FREE,1529 offset = radix_tree_find_next_bit(node, IDR_FREE,
1530 offset + 1);1530 offset + 1);
1531 start = next_index(start, node, offset);1531 start = next_index(start, node, offset);
1532 if (start > max)1532 if (start > max || start == 0)
1533 return ERR_PTR(-ENOSPC);1533 return ERR_PTR(-ENOSPC);
1534 while (offset == RADIX_TREE_MAP_SIZE) {1534 while (offset == RADIX_TREE_MAP_SIZE) {
1535 offset = node->offset + 1;1535 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
1110 XA_BUG_ON(xa, !xa_empty(xa));1110 XA_BUG_ON(xa, !xa_empty(xa));
1111}1111}
1112 1112
1113static 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
1113static noinline void check_move_small(struct xarray *xa, unsigned long idx)1135static noinline void check_move_small(struct xarray *xa, unsigned long idx)
1114{1136{
1115 XA_STATE(xas, xa, 0);1137 XA_STATE(xas, xa, 0);
@@ -1217,6 +1239,8 @@ static noinline void check_move(struct xarray *xa) · 101 unmodified lines
1217 1239
1218 xa_destroy(xa);1240 xa_destroy(xa);
1219 1241
1242 check_move_tiny(xa);
1243
1220 for (i = 0; i < 16; i++)1244 for (i = 0; i < 16; i++)
1221 check_move_small(xa, 1UL << i);1245 check_move_small(xa, 1UL << i);
1222 1246
lib/xarray.c+4−0
@@ -994,6 +994,8 @@ void *__xas_prev(struct xa_state *xas) · 993 unmodified lines
994 994
995 if (!xas_frozen(xas->xa_node))995 if (!xas_frozen(xas->xa_node))
996 xas->xa_index--;996 xas->xa_index--;
997 if (!xas->xa_node)
998 return set_bounds(xas);
997 if (xas_not_node(xas->xa_node))999 if (xas_not_node(xas->xa_node))
998 return xas_load(xas);1000 return xas_load(xas);
999 1001
@@ -1031,6 +1033,8 @@ void *__xas_next(struct xa_state *xas) · 31 unmodified lines
1031 1033
1032 if (!xas_frozen(xas->xa_node))1034 if (!xas_frozen(xas->xa_node))
1033 xas->xa_index++;1035 xas->xa_index++;
1036 if (!xas->xa_node)
1037 return set_bounds(xas);
1034 if (xas_not_node(xas->xa_node))1038 if (xas_not_node(xas->xa_node))
1035 return xas_load(xas);1039 return xas_load(xas);
1036 1040
mm/khugepaged.c+4−3
@@ -1028,12 +1028,13 @@ static void collapse_huge_page(struct mm_struct *mm, · 1027 unmodified lines
1028 1028
1029 anon_vma_lock_write(vma->anon_vma);1029 anon_vma_lock_write(vma->anon_vma);
1030 1030
1031 pte = pte_offset_map(pmd, address);
1032 pte_ptl = pte_lockptr(mm, pmd);
1033
1034 mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, NULL, mm,1031 mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, NULL, mm,
1035 address, address + HPAGE_PMD_SIZE);1032 address, address + HPAGE_PMD_SIZE);
1036 mmu_notifier_invalidate_range_start(&range);1033 mmu_notifier_invalidate_range_start(&range);
1034
1035 pte = pte_offset_map(pmd, address);
1036 pte_ptl = pte_lockptr(mm, pmd);
1037
1037 pmd_ptl = pmd_lock(mm, pmd); /* probably unnecessary */1038 pmd_ptl = pmd_lock(mm, pmd); /* probably unnecessary */
1038 /*1039 /*
1039 * After this gup_fast can't run anymore. This also removes1040 * 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
484 unsigned long ino = 0;484 unsigned long ino = 0;
485 485
486 rcu_read_lock();486 rcu_read_lock();
487 if (PageHead(page) && PageSlab(page))487 if (PageSlab(page) && !PageTail(page))
488 memcg = memcg_from_slab_page(page);488 memcg = memcg_from_slab_page(page);
489 else489 else
490 memcg = READ_ONCE(page->mem_cgroup);490 memcg = READ_ONCE(page->mem_cgroup);
@@ -2534,6 +2534,15 @@ retry: · 2043 unmodified lines
2534 goto retry;2534 goto retry;
2535 }2535 }
2536 2536
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
2537 /*2546 /*
2538 * Unlike in global OOM situations, memcg is not in a physical2547 * Unlike in global OOM situations, memcg is not in a physical
2539 * memory shortage. Allow dying and OOM-killed tasks to2548 * 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
5014{5023{
5015 int node;5024 int node;
5016 5025
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);
5023 for_each_node(node)5026 for_each_node(node)
5024 free_mem_cgroup_per_node_info(memcg, node);5027 free_mem_cgroup_per_node_info(memcg, node);
5025 free_percpu(memcg->vmstats_percpu);5028 free_percpu(memcg->vmstats_percpu);
@@ -5030,6 +5033,12 @@ static void __mem_cgroup_free(struct mem_cgroup *memcg) · 4 unmodified lines
5030static void mem_cgroup_free(struct mem_cgroup *memcg)5033static void mem_cgroup_free(struct mem_cgroup *memcg)
5031{5034{
5032 memcg_wb_domain_exit(memcg);5035 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);
5033 __mem_cgroup_free(memcg);5042 __mem_cgroup_free(memcg);
5034}5043}
5035 5044
mm/memory_hotplug.c+8−0
@@ -447,6 +447,14 @@ static void update_pgdat_span(struct pglist_data *pgdat) · 446 unmodified lines
447 zone->spanned_pages;447 zone->spanned_pages;
448 448
449 /* No need to lock the zones, they can't change. */449 /* 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
450 if (zone_end_pfn > node_end_pfn)458 if (zone_end_pfn > node_end_pfn)
451 node_end_pfn = zone_end_pfn;459 node_end_pfn = zone_end_pfn;
452 if (zone->zone_start_pfn < node_start_pfn)460 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
180 mn->ops->invalidate_range_start, _ret,180 mn->ops->invalidate_range_start, _ret,
181 !mmu_notifier_range_blockable(range) ? "non-" : "");181 !mmu_notifier_range_blockable(range) ? "non-" : "");
182 WARN_ON(mmu_notifier_range_blockable(range) ||182 WARN_ON(mmu_notifier_range_blockable(range) ||
183 ret != -EAGAIN);183 _ret != -EAGAIN);
184 ret = _ret;184 ret = _ret;
185 }185 }
186 }186 }
mm/page_alloc.c+9−8
@@ -1947,6 +1947,14 @@ void __init page_alloc_init_late(void) · 1946 unmodified lines
1947 /* Block until all are initialised */1947 /* Block until all are initialised */
1948 wait_for_completion(&pgdat_init_all_done_comp);1948 wait_for_completion(&pgdat_init_all_done_comp);
1949 1949
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
1950 /*1958 /*
1951 * We initialized the rest of the deferred pages. Permanently disable1959 * We initialized the rest of the deferred pages. Permanently disable
1952 * on-demand struct page initialization.1960 * on-demand struct page initialization.
@@ -3720,10 +3728,6 @@ try_this_zone: · 1767 unmodified lines
3720static void warn_alloc_show_mem(gfp_t gfp_mask, nodemask_t *nodemask)3728static void warn_alloc_show_mem(gfp_t gfp_mask, nodemask_t *nodemask)
3721{3729{
3722 unsigned int filter = SHOW_MEM_FILTER_NODES;3730 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;
3727 3731
3728 /*3732 /*
3729 * This documents exceptions given to allocations in certain3733 * 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
3744{3748{
3745 struct va_format vaf;3749 struct va_format vaf;
3746 va_list args;3750 va_list args;
3747 static DEFINE_RATELIMIT_STATE(nopage_rs, DEFAULT_RATELIMIT_INTERVAL,3751 static DEFINE_RATELIMIT_STATE(nopage_rs, 10*HZ, 1);
3748 DEFAULT_RATELIMIT_BURST);
3749 3752
3750 if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs))3753 if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs))
3751 return;3754 return;
@@ -8514,7 +8517,6 @@ void free_contig_range(unsigned long pfn, unsigned int nr_pages) · 4762 unmodified lines
8514 WARN(count != 0, "%d pages are still in use!\n", count);8517 WARN(count != 0, "%d pages are still in use!\n", count);
8515}8518}
8516 8519
8517#ifdef CONFIG_MEMORY_HOTPLUG
8518/*8520/*
8519 * The zone indicated has a new number of managed_pages; batch sizes and percpu8521 * The zone indicated has a new number of managed_pages; batch sizes and percpu
8520 * page high values need to be recalulated.8522 * page high values need to be recalulated.
@@ -8528,7 +8530,6 @@ void __meminit zone_pcp_update(struct zone *zone) · 7 unmodified lines
8528 per_cpu_ptr(zone->pageset, cpu));8530 per_cpu_ptr(zone->pageset, cpu));
8529 mutex_unlock(&pcp_batch_high_lock);8531 mutex_unlock(&pcp_batch_high_lock);
8530}8532}
8531#endif
8532 8533
8533void zone_pcp_reset(struct zone *zone)8534void zone_pcp_reset(struct zone *zone)
8534{8535{
mm/slab.h+2−2
@@ -323,8 +323,8 @@ static inline struct kmem_cache *memcg_root_cache(struct kmem_cache *s) · 322 unmodified lines
323 * Expects a pointer to a slab page. Please note, that PageSlab() check323 * Expects a pointer to a slab page. Please note, that PageSlab() check
324 * isn't sufficient, as it returns true also for tail compound slab pages,324 * isn't sufficient, as it returns true also for tail compound slab pages,
325 * which do not have slab_cache pointer set.325 * which do not have slab_cache pointer set.
326 * So this function assumes that the page can pass PageHead() and PageSlab()326 * So this function assumes that the page can pass PageSlab() && !PageTail()
327 * checks.327 * check.
328 *328 *
329 * The kmem_cache can be reparented asynchronously. The caller must ensure329 * The kmem_cache can be reparented asynchronously. The caller must ensure
330 * the memcg lifetime, e.g. by taking rcu_read_lock() or cgroup_mutex.330 * 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
1383 unsigned long freecount = 0;1383 unsigned long freecount = 0;
1384 struct free_area *area;1384 struct free_area *area;
1385 struct list_head *curr;1385 struct list_head *curr;
1386 bool overflow = false;
1386 1387
1387 area = &(zone->free_area[order]);1388 area = &(zone->free_area[order]);
1388 1389
1389 list_for_each(curr, &area->free_list[mtype])1390 list_for_each(curr, &area->free_list[mtype]) {
1390 freecount++;1391 /*
1391 seq_printf(m, "%6lu ", freecount);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);
1392 }1409 }
1393 seq_putc(m, '\n');1410 seq_putc(m, '\n');
1394 }1411 }
@@ -1972,7 +1989,7 @@ void __init init_mm_internals(void) · 577 unmodified lines
1972#endif1989#endif
1973#ifdef CONFIG_PROC_FS1990#ifdef CONFIG_PROC_FS
1974 proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op);1991 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);
1976 proc_create_seq("vmstat", 0444, NULL, &vmstat_op);1993 proc_create_seq("vmstat", 0444, NULL, &vmstat_op);
1977 proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op);1994 proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op);
1978#endif1995#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
172 if (err < 0)172 if (err < 0)
173 goto out_uninit_mvrp;173 goto out_uninit_mvrp;
174 174
175 vlan->nest_level = dev_get_nest_level(real_dev) + 1;
176 err = register_netdevice(dev);175 err = register_netdevice(dev);
177 if (err < 0)176 if (err < 0)
178 goto out_uninit_mvrp;177 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
489 dev_uc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev);489 dev_uc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev);
490}490}
491 491
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 */
497static struct lock_class_key vlan_netdev_xmit_lock_key;
498static struct lock_class_key vlan_netdev_addr_lock_key;
499
500static 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
509static 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
517static int vlan_dev_get_lock_subclass(struct net_device *dev)
518{
519 return vlan_dev_priv(dev)->nest_level;
520}
521
522static const struct header_ops vlan_header_ops = {492static const struct header_ops vlan_header_ops = {
523 .create = vlan_dev_hard_header,493 .create = vlan_dev_hard_header,
524 .parse = eth_header_parse,494 .parse = eth_header_parse,
@@ -609,8 +579,6 @@ static int vlan_dev_init(struct net_device *dev) · 84 unmodified lines
609 579
610 SET_NETDEV_DEVTYPE(dev, &vlan_type);580 SET_NETDEV_DEVTYPE(dev, &vlan_type);
611 581
612 vlan_dev_set_lockdep_class(dev, vlan_dev_get_lock_subclass(dev));
613
614 vlan->vlan_pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats);582 vlan->vlan_pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats);
615 if (!vlan->vlan_pcpu_stats)583 if (!vlan->vlan_pcpu_stats)
616 return -ENOMEM;584 return -ENOMEM;
@@ -812,7 +780,6 @@ static const struct net_device_ops vlan_netdev_ops = { · 195 unmodified lines
812 .ndo_netpoll_cleanup = vlan_dev_netpoll_cleanup,780 .ndo_netpoll_cleanup = vlan_dev_netpoll_cleanup,
813#endif781#endif
814 .ndo_fix_features = vlan_dev_fix_features,782 .ndo_fix_features = vlan_dev_fix_features,
815 .ndo_get_lock_subclass = vlan_dev_get_lock_subclass,
816 .ndo_get_iflink = vlan_dev_get_iflink,783 .ndo_get_iflink = vlan_dev_get_iflink,
817};784};
818 785
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
668 mask |= EPOLLHUP;668 mask |= EPOLLHUP;
669 669
670 /* readable? */670 /* readable? */
671 if (!skb_queue_empty(&sk->sk_receive_queue))671 if (!skb_queue_empty_lockless(&sk->sk_receive_queue))
672 mask |= EPOLLIN | EPOLLRDNORM;672 mask |= EPOLLIN | EPOLLRDNORM;
673 673
674 /* writable? */674 /* writable? */
net/batman-adv/bat_iv_ogm.c+52−9
@@ -22,6 +22,8 @@ · 21 unmodified lines
22#include <linux/kernel.h>22#include <linux/kernel.h>
23#include <linux/kref.h>23#include <linux/kref.h>
24#include <linux/list.h>24#include <linux/list.h>
25#include <linux/lockdep.h>
26#include <linux/mutex.h>
25#include <linux/netdevice.h>27#include <linux/netdevice.h>
26#include <linux/netlink.h>28#include <linux/netlink.h>
27#include <linux/pkt_sched.h>29#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
193 unsigned char *ogm_buff;195 unsigned char *ogm_buff;
194 u32 random_seqno;196 u32 random_seqno;
195 197
198 mutex_lock(&hard_iface->bat_iv.ogm_buff_mutex);
199
196 /* randomize initial seqno to avoid collision */200 /* randomize initial seqno to avoid collision */
197 get_random_bytes(&random_seqno, sizeof(random_seqno));201 get_random_bytes(&random_seqno, sizeof(random_seqno));
198 atomic_set(&hard_iface->bat_iv.ogm_seqno, random_seqno);202 atomic_set(&hard_iface->bat_iv.ogm_seqno, random_seqno);
199 203
200 hard_iface->bat_iv.ogm_buff_len = BATADV_OGM_HLEN;204 hard_iface->bat_iv.ogm_buff_len = BATADV_OGM_HLEN;
201 ogm_buff = kmalloc(hard_iface->bat_iv.ogm_buff_len, GFP_ATOMIC);205 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);
203 return -ENOMEM;208 return -ENOMEM;
209 }
204 210
205 hard_iface->bat_iv.ogm_buff = ogm_buff;211 hard_iface->bat_iv.ogm_buff = ogm_buff;
206 212
@@ -212,35 +218,59 @@ static int batadv_iv_ogm_iface_enable(struct batadv_hard_iface *hard_iface) · 5 unmodified lines
212 batadv_ogm_packet->reserved = 0;218 batadv_ogm_packet->reserved = 0;
213 batadv_ogm_packet->tq = BATADV_TQ_MAX_VALUE;219 batadv_ogm_packet->tq = BATADV_TQ_MAX_VALUE;
214 220
221 mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex);
222
215 return 0;223 return 0;
216}224}
217 225
218static void batadv_iv_ogm_iface_disable(struct batadv_hard_iface *hard_iface)226static void batadv_iv_ogm_iface_disable(struct batadv_hard_iface *hard_iface)
219{227{
228 mutex_lock(&hard_iface->bat_iv.ogm_buff_mutex);
229
220 kfree(hard_iface->bat_iv.ogm_buff);230 kfree(hard_iface->bat_iv.ogm_buff);
221 hard_iface->bat_iv.ogm_buff = NULL;231 hard_iface->bat_iv.ogm_buff = NULL;
232
233 mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex);
222}234}
223 235
224static void batadv_iv_ogm_iface_update_mac(struct batadv_hard_iface *hard_iface)236static void batadv_iv_ogm_iface_update_mac(struct batadv_hard_iface *hard_iface)
225{237{
226 struct batadv_ogm_packet *batadv_ogm_packet;238 struct batadv_ogm_packet *batadv_ogm_packet;
227 unsigned char *ogm_buff = hard_iface->bat_iv.ogm_buff;239 void *ogm_buff;
228 240
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;
230 ether_addr_copy(batadv_ogm_packet->orig,248 ether_addr_copy(batadv_ogm_packet->orig,
231 hard_iface->net_dev->dev_addr);249 hard_iface->net_dev->dev_addr);
232 ether_addr_copy(batadv_ogm_packet->prev_sender,250 ether_addr_copy(batadv_ogm_packet->prev_sender,
233 hard_iface->net_dev->dev_addr);251 hard_iface->net_dev->dev_addr);
252
253unlock:
254 mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex);
234}255}
235 256
236static void257static void
237batadv_iv_ogm_primary_iface_set(struct batadv_hard_iface *hard_iface)258batadv_iv_ogm_primary_iface_set(struct batadv_hard_iface *hard_iface)
238{259{
239 struct batadv_ogm_packet *batadv_ogm_packet;260 struct batadv_ogm_packet *batadv_ogm_packet;
240 unsigned char *ogm_buff = hard_iface->bat_iv.ogm_buff;261 void *ogm_buff;
241 262
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;
243 batadv_ogm_packet->ttl = BATADV_TTL;270 batadv_ogm_packet->ttl = BATADV_TTL;
271
272unlock:
273 mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex);
244}274}
245 275
246/* when do we schedule our own ogm to be sent */276/* 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
742 }772 }
743}773}
744 774
745static 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 */
779static void batadv_iv_ogm_schedule_buff(struct batadv_hard_iface *hard_iface)
746{780{
747 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);781 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
748 unsigned char **ogm_buff = &hard_iface->bat_iv.ogm_buff;782 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
753 u16 tvlv_len = 0;787 u16 tvlv_len = 0;
754 unsigned long send_time;788 unsigned long send_time;
755 789
756 if (hard_iface->if_status == BATADV_IF_NOT_IN_USE ||790 lockdep_assert_held(&hard_iface->bat_iv.ogm_buff_mutex);
757 hard_iface->if_status == BATADV_IF_TO_BE_REMOVED)
758 return;
759 791
760 /* the interface gets activated here to avoid race conditions between792 /* the interface gets activated here to avoid race conditions between
761 * the moment of activating the interface in793 * the moment of activating the interface in
@@ -823,6 +855,17 @@ out: · 61 unmodified lines
823 batadv_hardif_put(primary_if);855 batadv_hardif_put(primary_if);
824}856}
825 857
858static 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
826/**869/**
827 * batadv_iv_orig_ifinfo_sum() - Get bcast_own sum for originator over iterface870 * batadv_iv_orig_ifinfo_sum() - Get bcast_own sum for originator over iterface
828 * @orig_node: originator which reproadcasted the OGMs directly871 * @orig_node: originator which reproadcasted the OGMs directly
net/batman-adv/bat_v_ogm.c+33−8
@@ -18,6 +18,7 @@ · 17 unmodified lines
18#include <linux/kref.h>18#include <linux/kref.h>
19#include <linux/list.h>19#include <linux/list.h>
20#include <linux/lockdep.h>20#include <linux/lockdep.h>
21#include <linux/mutex.h>
21#include <linux/netdevice.h>22#include <linux/netdevice.h>
22#include <linux/random.h>23#include <linux/random.h>
23#include <linux/rculist.h>24#include <linux/rculist.h>
@@ -256,14 +257,12 @@ static void batadv_v_ogm_queue_on_if(struct sk_buff *skb, · 232 unmodified lines
256}257}
257 258
258/**259/**
259 * batadv_v_ogm_send() - periodic worker broadcasting the own OGM260 * batadv_v_ogm_send_softif() - periodic worker broadcasting the own OGM
260 * @work: work queue item261 * @bat_priv: the bat priv with all the soft interface information
261 */262 */
262static void batadv_v_ogm_send(struct work_struct *work)263static void batadv_v_ogm_send_softif(struct batadv_priv *bat_priv)
263{264{
264 struct batadv_hard_iface *hard_iface;265 struct batadv_hard_iface *hard_iface;
265 struct batadv_priv_bat_v *bat_v;
266 struct batadv_priv *bat_priv;
267 struct batadv_ogm2_packet *ogm_packet;266 struct batadv_ogm2_packet *ogm_packet;
268 struct sk_buff *skb, *skb_tmp;267 struct sk_buff *skb, *skb_tmp;
269 unsigned char *ogm_buff;268 unsigned char *ogm_buff;
@@ -271,8 +270,7 @@ static void batadv_v_ogm_send(struct work_struct *work) · 1 unmodified line
271 u16 tvlv_len = 0;270 u16 tvlv_len = 0;
272 int ret;271 int ret;
273 272
274 bat_v = container_of(work, struct batadv_priv_bat_v, ogm_wq.work);273 lockdep_assert_held(&bat_priv->bat_v.ogm_buff_mutex);
275 bat_priv = container_of(bat_v, struct batadv_priv, bat_v);
276 274
277 if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_DEACTIVATING)275 if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_DEACTIVATING)
278 goto out;276 goto out;
@@ -363,6 +361,23 @@ out: · 84 unmodified lines
363 return;361 return;
364}362}
365 363
364/**
365 * batadv_v_ogm_send() - periodic worker broadcasting the own OGM
366 * @work: work queue item
367 */
368static 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
366/**381/**
367 * batadv_v_ogm_aggr_work() - OGM queue periodic task per interface382 * batadv_v_ogm_aggr_work() - OGM queue periodic task per interface
368 * @work: work queue item383 * @work: work queue item
@@ -424,11 +439,15 @@ void batadv_v_ogm_primary_iface_set(struct batadv_hard_iface *primary_iface) · 55 unmodified lines
424 struct batadv_priv *bat_priv = netdev_priv(primary_iface->soft_iface);439 struct batadv_priv *bat_priv = netdev_priv(primary_iface->soft_iface);
425 struct batadv_ogm2_packet *ogm_packet;440 struct batadv_ogm2_packet *ogm_packet;
426 441
442 mutex_lock(&bat_priv->bat_v.ogm_buff_mutex);
427 if (!bat_priv->bat_v.ogm_buff)443 if (!bat_priv->bat_v.ogm_buff)
428 return;444 goto unlock;
429 445
430 ogm_packet = (struct batadv_ogm2_packet *)bat_priv->bat_v.ogm_buff;446 ogm_packet = (struct batadv_ogm2_packet *)bat_priv->bat_v.ogm_buff;
431 ether_addr_copy(ogm_packet->orig, primary_iface->net_dev->dev_addr);447 ether_addr_copy(ogm_packet->orig, primary_iface->net_dev->dev_addr);
448
449unlock:
450 mutex_unlock(&bat_priv->bat_v.ogm_buff_mutex);
432}451}
433 452
434/**453/**
@@ -1050,6 +1069,8 @@ int batadv_v_ogm_init(struct batadv_priv *bat_priv) · 615 unmodified lines
1050 atomic_set(&bat_priv->bat_v.ogm_seqno, random_seqno);1069 atomic_set(&bat_priv->bat_v.ogm_seqno, random_seqno);
1051 INIT_DELAYED_WORK(&bat_priv->bat_v.ogm_wq, batadv_v_ogm_send);1070 INIT_DELAYED_WORK(&bat_priv->bat_v.ogm_wq, batadv_v_ogm_send);
1052 1071
1072 mutex_init(&bat_priv->bat_v.ogm_buff_mutex);
1073
1053 return 0;1074 return 0;
1054}1075}
1055 1076
@@ -1061,7 +1082,11 @@ void batadv_v_ogm_free(struct batadv_priv *bat_priv) · 5 unmodified lines
1061{1082{
1062 cancel_delayed_work_sync(&bat_priv->bat_v.ogm_wq);1083 cancel_delayed_work_sync(&bat_priv->bat_v.ogm_wq);
1063 1084
1085 mutex_lock(&bat_priv->bat_v.ogm_buff_mutex);
1086
1064 kfree(bat_priv->bat_v.ogm_buff);1087 kfree(bat_priv->bat_v.ogm_buff);
1065 bat_priv->bat_v.ogm_buff = NULL;1088 bat_priv->bat_v.ogm_buff = NULL;
1066 bat_priv->bat_v.ogm_buff_len = 0;1089 bat_priv->bat_v.ogm_buff_len = 0;
1090
1091 mutex_unlock(&bat_priv->bat_v.ogm_buff_mutex);
1067}1092}
net/batman-adv/hard-interface.c+2−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
18#include <linux/kref.h>18#include <linux/kref.h>
19#include <linux/limits.h>19#include <linux/limits.h>
20#include <linux/list.h>20#include <linux/list.h>
21#include <linux/mutex.h>
21#include <linux/netdevice.h>22#include <linux/netdevice.h>
22#include <linux/printk.h>23#include <linux/printk.h>
23#include <linux/rculist.h>24#include <linux/rculist.h>
@@ -929,6 +930,7 @@ batadv_hardif_add_interface(struct net_device *net_dev) · 905 unmodified lines
929 INIT_LIST_HEAD(&hard_iface->list);930 INIT_LIST_HEAD(&hard_iface->list);
930 INIT_HLIST_HEAD(&hard_iface->neigh_list);931 INIT_HLIST_HEAD(&hard_iface->neigh_list);
931 932
933 mutex_init(&hard_iface->bat_iv.ogm_buff_mutex);
932 spin_lock_init(&hard_iface->neigh_list_lock);934 spin_lock_init(&hard_iface->neigh_list_lock);
933 kref_init(&hard_iface->refcount);935 kref_init(&hard_iface->refcount);
934 936
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
740 return 0;740 return 0;
741}741}
742 742
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 */
747static struct lock_class_key batadv_netdev_xmit_lock_key;
748static 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 */
756static 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 */
767static 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
773/**743/**
774 * batadv_softif_init_late() - late stage initialization of soft interface744 * batadv_softif_init_late() - late stage initialization of soft interface
775 * @dev: registered network device to modify745 * @dev: registered network device to modify
@@ -783,8 +753,6 @@ static int batadv_softif_init_late(struct net_device *dev) · 7 unmodified lines
783 int ret;753 int ret;
784 size_t cnt_len = sizeof(u64) * BATADV_CNT_NUM;754 size_t cnt_len = sizeof(u64) * BATADV_CNT_NUM;
785 755
786 batadv_set_lockdep_class(dev);
787
788 bat_priv = netdev_priv(dev);756 bat_priv = netdev_priv(dev);
789 bat_priv->soft_iface = dev;757 bat_priv->soft_iface = dev;
790 758
net/batman-adv/types.h+7−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
17#include <linux/if.h>17#include <linux/if.h>
18#include <linux/if_ether.h>18#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