History

Merge 5.5-rc6 into usb-next

We need the USB fixes in here as well.

Greg Kroah-Hartman committed 6 years ago

Commit 845f0812 parents 585c91f b3a987b485 files · +3773 −2350Browse files

Unified · Split

485 files
  1. Documentation/dev-tools/kcov.rst +5 −5
  2. Documentation/dev-tools/kunit/start.rst +5 −8
  3. Documentation/devicetree/bindings/i2c/i2c-at91.txt +4 −2
  4. Documentation/devicetree/bindings/spi/spi-controller.yaml +2 −2
  5. Documentation/features/debug/gcov-profile-all/arch-support.txt +1 −1
  6. Documentation/networking/dsa/sja1105.rst +0 −6
  7. Documentation/networking/ip-sysctl.txt +1 −1
  8. Documentation/networking/netdev-FAQ.rst +2 −2
  9. Documentation/process/index.rst +1 −0
  10. Documentation/riscv/index.rst +1 −0
  11. Documentation/riscv/patch-acceptance.rst +35 −0
  12. MAINTAINERS +9 −8
  13. Makefile +1 −1
  14. arch/arc/include/asm/entry-arcv2.h +4 −4
  15. arch/arc/include/asm/hugepage.h +0 −1
  16. arch/arc/kernel/asm-offsets.c +9 −1
  17. arch/arc/plat-eznps/Kconfig +1 −1
  18. arch/arm/Kconfig +1 −0
  19. arch/arm/kernel/process.c +3 −3
  20. arch/arm64/Kconfig +1 −0
  21. arch/arm64/include/asm/pgtable-prot.h +2 −3
  22. arch/arm64/include/asm/pgtable.h +3 −7
  23. arch/arm64/include/asm/unistd.h +0 −1
  24. arch/arm64/include/uapi/asm/unistd.h +1 −0
  25. arch/arm64/kernel/process.c +5 −5
  26. arch/arm64/mm/fault.c +1 −1
  27. arch/arm64/mm/mmu.c +1 −3
  28. arch/hexagon/include/asm/atomic.h +4 −4
  29. arch/hexagon/include/asm/bitops.h +4 −4
  30. arch/hexagon/include/asm/cmpxchg.h +1 −1
  31. arch/hexagon/include/asm/futex.h +3 −3
  32. arch/hexagon/include/asm/io.h +1 −0
  33. arch/hexagon/include/asm/spinlock.h +10 −10
  34. arch/hexagon/kernel/stacktrace.c +1 −3
  35. arch/hexagon/kernel/vm_entry.S +1 −1
  36. arch/ia64/mm/init.c +1 −3
  37. arch/mips/Kconfig +1 −1
  38. arch/mips/boot/compressed/Makefile +3 −0
  39. arch/mips/include/asm/cpu-type.h +2 −1
  40. arch/mips/include/asm/thread_info.h +19 −1
  41. arch/mips/include/asm/vdso/gettimeofday.h +0 −13
  42. arch/mips/kernel/cacheinfo.c +26 −1
  43. arch/mips/net/ebpf_jit.c +1 −1
  44. arch/mips/vdso/vgettimeofday.c +20 −0
  45. arch/parisc/Kconfig +1 −0
  46. arch/parisc/kernel/process.c +4 −4
  47. arch/powerpc/include/asm/spinlock.h +1 −0
  48. arch/powerpc/mm/mem.c +1 −2
  49. arch/powerpc/mm/slice.c +2 −2
  50. arch/riscv/Kconfig +2 −0
  51. arch/riscv/boot/dts/sifive/fu540-c000.dtsi +15 −0
  52. arch/riscv/include/asm/csr.h +9 −9
  53. arch/riscv/kernel/entry.S +1 −0
  54. arch/riscv/kernel/ftrace.c +1 −1
  55. arch/riscv/kernel/head.S +1 −1
  56. arch/riscv/kernel/irq.c +3 −3
  57. arch/riscv/kernel/process.c +3 −3
  58. arch/riscv/kernel/riscv_ksyms.c +0 −3
  59. arch/riscv/lib/uaccess.S +4 −0
  60. arch/riscv/mm/cacheflush.c +1 −0
  61. arch/riscv/mm/init.c +6 −6
  62. arch/s390/mm/init.c +1 −3
  63. arch/sh/mm/init.c +1 −3
  64. arch/um/Kconfig +1 −0
  65. arch/um/include/asm/ptrace-generic.h +1 −1
  66. arch/um/kernel/process.c +3 −3
  67. arch/x86/mm/init_32.c +1 −3
  68. arch/x86/mm/init_64.c +1 −3
  69. arch/x86/um/tls_32.c +2 −4
  70. arch/x86/um/tls_64.c +3 −4
  71. arch/xtensa/Kconfig +1 −0
  72. arch/xtensa/kernel/process.c +4 −4
  73. block/bio.c +49 −0
  74. block/blk-merge.c +9 −9
  75. block/compat_ioctl.c +16 −0
  76. drivers/ata/ahci_brcm.c +94 −39
  77. drivers/ata/libahci_platform.c +4 −2
  78. drivers/ata/libata-core.c +24 −0
  79. drivers/ata/sata_fsl.c +1 −1
  80. drivers/ata/sata_mv.c +1 −1
  81. drivers/ata/sata_nv.c +1 −1
  82. drivers/atm/eni.c +2 −2
  83. drivers/block/null_blk_zoned.c +4 −1
  84. drivers/block/pktcdvd.c +1 −1
  85. drivers/char/agp/isoch.c +1 −8
  86. drivers/char/tpm/tpm-dev-common.c +1 −1
  87. drivers/char/tpm/tpm-dev.h +1 −1
  88. drivers/char/tpm/tpm_tis_core.c +15 −19
  89. drivers/clocksource/timer-riscv.c +1 −1
  90. drivers/cpufreq/cpufreq-dt-platdev.c +2 −0
  91. drivers/devfreq/Kconfig +1 −4
  92. drivers/dma/dma-jz4780.c +2 −1
  93. drivers/dma/ioat/dma.c +2 −1
  94. drivers/dma/k3dma.c +9 −3
  95. drivers/dma/virt-dma.c +1 −2
  96. drivers/edac/sifive_edac.c +1 −1
  97. drivers/firmware/broadcom/tee_bnxt_fw.c +0 −1
  98. drivers/gpio/Kconfig +3 −2
  99. drivers/gpio/gpio-aspeed-sgpio.c +1 −1
  100. drivers/gpio/gpio-mockup.c +7 −4
  101. drivers/gpio/gpio-mpc8xxx.c +1 −0
  102. drivers/gpio/gpio-pca953x.c +10 −16
  103. drivers/gpio/gpio-xgs-iproc.c +1 −1
  104. drivers/gpio/gpio-xtensa.c +3 −4
  105. drivers/gpio/gpio-zynq.c +5 −3
  106. drivers/gpio/gpiolib-acpi.c +46 −5
  107. drivers/gpio/gpiolib.c +11 −2
  108. drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +11 −1
  109. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 −3
  110. drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 −1
  111. drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +1 −1
  112. drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4 −11
  113. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +23 −22
  114. drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 −0
  115. drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +3 −0
  116. drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 −0
  117. drivers/gpu/drm/amd/powerplay/navi10_ppt.c +3 −0
  118. drivers/gpu/drm/amd/powerplay/vega20_ppt.c +3 −0
  119. drivers/gpu/drm/arm/malidp_mw.c +1 −1
  120. drivers/gpu/drm/drm_dp_mst_topology.c +1 −1
  121. drivers/gpu/drm/drm_fb_helper.c +6 −1
  122. drivers/gpu/drm/i915/display/intel_audio.c +2 −2
  123. drivers/gpu/drm/i915/display/intel_display.c +2 −7
  124. drivers/gpu/drm/i915/display/intel_frontbuffer.c +6 −10
  125. drivers/gpu/drm/i915/display/intel_frontbuffer.h +31 −3
  126. drivers/gpu/drm/i915/display/intel_overlay.c +13 −4
  127. drivers/gpu/drm/i915/gem/i915_gem_clflush.c +2 −1
  128. drivers/gpu/drm/i915/gem/i915_gem_domain.c +2 −2
  129. drivers/gpu/drm/i915/gem/i915_gem_object.c +25 −1
  130. drivers/gpu/drm/i915/gem/i915_gem_object.h +22 −1
  131. drivers/gpu/drm/i915/gem/i915_gem_object_types.h +1 −1
  132. drivers/gpu/drm/i915/gt/intel_gt_pm.c +2 −1
  133. drivers/gpu/drm/i915/gt/intel_lrc.c +2 −0
  134. drivers/gpu/drm/i915/gt/intel_ring_submission.c +11 −20
  135. drivers/gpu/drm/i915/i915_drv.h +4 −2
  136. drivers/gpu/drm/i915/i915_gem.c +5 −5
  137. drivers/gpu/drm/i915/i915_pmu.c +20 −53
  138. drivers/gpu/drm/i915/i915_pmu.h +1 −1
  139. drivers/gpu/drm/i915/i915_reg.h +7 −1
  140. drivers/gpu/drm/i915/i915_vma.c +8 −2
  141. drivers/gpu/drm/i915/intel_pm.c +11 −0
  142. drivers/gpu/drm/mediatek/mtk_drm_crtc.c +12 −6
  143. drivers/gpu/drm/mediatek/mtk_dsi.c +38 −29
  144. drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +0 −2
  145. drivers/gpu/drm/sun4i/sun4i_tcon.c +12 −3
  146. drivers/gpu/drm/sun4i/sun4i_tcon.h +1 −0
  147. drivers/hid/hid-asus.c +2 −1
  148. drivers/hid/hid-core.c +6 −0
  149. drivers/hid/hid-ids.h +3 −0
  150. drivers/hid/hid-input.c +12 −4
  151. drivers/hid/hid-ite.c +3 −0
  152. drivers/hid/hid-multitouch.c +4 −1
  153. drivers/hid/hid-quirks.c +1 −0
  154. drivers/hid/hid-steam.c +4 −0
  155. drivers/hid/hidraw.c +4 −3
  156. drivers/hid/i2c-hid/i2c-hid-core.c +13 −3
  157. drivers/hid/intel-ish-hid/ipc/hw-ish.h +2 −0
  158. drivers/hid/intel-ish-hid/ipc/pci-ish.c +2 −0
  159. drivers/hid/uhid.c +3 −2
  160. drivers/hid/usbhid/hiddev.c +42 −55
  161. drivers/hid/wacom_wac.c +4 −2
  162. drivers/i2c/busses/i2c-at91-core.c +1 −1
  163. drivers/i2c/busses/i2c-bcm2835.c +8 −9
  164. drivers/i2c/i2c-core-base.c +10 −3
  165. drivers/infiniband/hw/bnxt_re/ib_verbs.c +3 −1
  166. drivers/infiniband/hw/bnxt_re/qplib_fp.c +6 −6
  167. drivers/infiniband/hw/hfi1/iowait.c +3 −1
  168. drivers/infiniband/hw/hfi1/tid_rdma.c +9 −0
  169. drivers/infiniband/hw/i40iw/i40iw_verbs.c +6 −8
  170. drivers/input/evdev.c +7 −7
  171. drivers/input/input.c +16 −10
  172. drivers/input/keyboard/imx_sc_key.c +7 −1
  173. drivers/input/misc/uinput.c +12 −7
  174. drivers/iommu/dma-iommu.c +0 −3
  175. drivers/iommu/intel-iommu.c +18 −4
  176. drivers/iommu/iommu.c +1 −0
  177. drivers/irqchip/irq-sifive-plic.c +1 −1
  178. drivers/media/cec/cec-adap.c +27 −13
  179. drivers/media/usb/pulse8-cec/pulse8-cec.c +13 −4
  180. drivers/mtd/nand/onenand/omap2.c +8 −6
  181. drivers/mtd/nand/onenand/onenand_base.c +7 −7
  182. drivers/mtd/nand/onenand/samsung_mtd.c +4 −4
  183. drivers/mtd/nand/raw/cadence-nand-controller.c +6 −7
  184. drivers/mtd/nand/raw/stm32_fmc2_nand.c +36 −2
  185. drivers/mtd/sm_ftl.c +2 −1
  186. drivers/mtd/spi-nor/spi-nor.c +1 −0
  187. drivers/net/can/m_can/tcan4x5x.c +53 −10
  188. drivers/net/can/mscan/mscan.c +10 −11
  189. drivers/net/can/usb/gs_usb.c +2 −2
  190. drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +1 −1
  191. drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +1 −1
  192. drivers/net/dsa/bcm_sf2_cfp.c +3 −3
  193. drivers/net/dsa/mv88e6xxx/global1.c +5 −0
  194. drivers/net/dsa/mv88e6xxx/global1.h +1 −0
  195. drivers/net/dsa/mv88e6xxx/port.c +6 −6
  196. drivers/net/dsa/sja1105/sja1105_main.c +5 −5
  197. drivers/net/dsa/sja1105/sja1105_ptp.c +3 −3
  198. drivers/net/dsa/sja1105/sja1105_static_config.c +5 −2
  199. drivers/net/dsa/sja1105/sja1105_tas.c +0 −5
  200. drivers/net/ethernet/aquantia/atlantic/aq_nic.c +2 −2
  201. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +0 −3
  202. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c +1 −3
  203. drivers/net/ethernet/broadcom/b44.c +6 −3
  204. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h +4 −1
  205. drivers/net/ethernet/cadence/macb_main.c +1 −3
  206. drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +1 −0
  207. drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +2 −2
  208. drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +13 −8
  209. drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +2 −2
  210. drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h +1 −0
  211. drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c +11 −7
  212. drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +20 −19
  213. drivers/net/ethernet/freescale/fec_main.c +9 −0
  214. drivers/net/ethernet/google/gve/gve_rx.c +0 −2
  215. drivers/net/ethernet/google/gve/gve_tx.c +0 −6
  216. drivers/net/ethernet/mellanox/mlx5/core/en/fs.h +16 −0
  217. drivers/net/ethernet/mellanox/mlx5/core/en/health.c +4 −3
  218. drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +0 −16
  219. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +58 −2
  220. drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +15 −55
  221. drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +0 −1
  222. drivers/net/ethernet/mellanox/mlx5/core/main.c +9 −7
  223. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c +4 −1
  224. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +5 −5
  225. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +8 −6
  226. drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c +4 −3
  227. drivers/net/ethernet/mellanox/mlxsw/reg.h +1 −0
  228. drivers/net/ethernet/mellanox/mlxsw/spectrum.c +7 −2
  229. drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c +7 −0
  230. drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +3 −0
  231. drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +1 −1
  232. drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +11 −3
  233. drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +3 −0
  234. drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c +1 −1
  235. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +32 −0
  236. drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1 −1
  237. drivers/net/gtp.c +4 −3
  238. drivers/net/macvlan.c +1 −1
  239. drivers/net/phy/aquantia_main.c +2 −0
  240. drivers/net/phy/phylink.c +3 −0
  241. drivers/net/usb/lan78xx.c +3 −6
  242. drivers/net/vxlan.c +2 −2
  243. drivers/net/wan/sdla.c +1 −1
  244. drivers/nvme/host/core.c +2 −0
  245. drivers/nvme/target/admin-cmd.c +11 −1
  246. drivers/phy/motorola/phy-cpcap-usb.c +90 −38
  247. drivers/phy/motorola/phy-mapphone-mdm6600.c +3 −8
  248. drivers/phy/qualcomm/phy-qcom-qmp.c +1 −1
  249. drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +4 −0
  250. drivers/pinctrl/cirrus/Kconfig +1 −0
  251. drivers/pinctrl/meson/pinctrl-meson.c +1 −0
  252. drivers/platform/mips/Kconfig +1 −1
  253. drivers/powercap/intel_rapl_common.c +3 −0
  254. drivers/ptp/ptp_clock.c +14 −17
  255. drivers/ptp/ptp_private.h +1 −1
  256. drivers/regulator/axp20x-regulator.c +7 −4
  257. drivers/regulator/bd70528-regulator.c +0 −1
  258. drivers/rtc/rtc-mc146818-lib.c +1 −14
  259. drivers/rtc/rtc-mt6397.c +25 −14
  260. drivers/rtc/rtc-sun6i.c +16 −0
  261. drivers/s390/net/qeth_core_main.c +9 −20
  262. drivers/s390/net/qeth_l2_main.c +5 −5
  263. drivers/s390/net/qeth_l3_main.c +1 −1
  264. drivers/s390/net/qeth_l3_sys.c +28 −12
  265. drivers/scsi/cxgbi/libcxgbi.c +2 −1
  266. drivers/scsi/lpfc/lpfc_debugfs.c +1 −2
  267. drivers/scsi/lpfc/lpfc_init.c +1 −1
  268. drivers/scsi/lpfc/lpfc_sli.c +5 −5
  269. drivers/scsi/mpt3sas/mpt3sas_base.c +0 −1
  270. drivers/soc/sifive/sifive_l2_cache.c +1 −1
  271. drivers/spi/spi-dw.c +12 −3
  272. drivers/spi/spi-dw.h +1 −0
  273. drivers/spi/spi-fsl-dspi.c +10 −14
  274. drivers/spi/spi-uniphier.c +19 −12
  275. drivers/spi/spi.c +8 −14
  276. drivers/staging/comedi/drivers/adv_pci1710.c +2 −2
  277. drivers/staging/media/ipu3/include/intel-ipu3.h +1 −1
  278. drivers/staging/rtl8188eu/os_dep/usb_intf.c +1 −0
  279. drivers/staging/vt6656/baseband.c +2 −2
  280. drivers/staging/vt6656/card.c +1 −1
  281. drivers/staging/vt6656/device.h +1 −0
  282. drivers/staging/vt6656/main_usb.c +2 −1
  283. drivers/staging/vt6656/usbpipe.c +23 −2
  284. drivers/staging/vt6656/usbpipe.h +5 −0
  285. drivers/staging/vt6656/wcmd.c +1 −0
  286. drivers/target/target_core_iblock.c +3 −1
  287. drivers/thermal/qcom/tsens.c +3 −0
  288. drivers/tty/serdev/core.c +10 −0
  289. drivers/tty/tty_port.c +1 −2
  290. drivers/usb/cdns3/gadget.c +5 −9
  291. drivers/usb/chipidea/host.c +3 −1
  292. drivers/usb/core/config.c +66 −16
  293. drivers/usb/core/hub.c +1 −1
  294. drivers/usb/dwc3/gadget.c +7 −0
  295. drivers/usb/gadget/udc/Kconfig +1 −0
  296. drivers/usb/host/ohci-da8xx.c +6 −2
  297. drivers/usb/musb/jz4740.c +5 −2
  298. drivers/usb/musb/musb_core.c +11 −0
  299. drivers/usb/musb/musbhsdma.c +1 −1
  300. drivers/usb/serial/option.c +10 −0
  301. drivers/usb/serial/usb-wwan.h +1 −0
  302. drivers/usb/serial/usb_wwan.c +4 −0
  303. drivers/usb/typec/tcpm/tcpci.c +15 −5
  304. drivers/usb/typec/ucsi/ucsi.h +9 −9
  305. drivers/watchdog/Kconfig +2 −0
  306. drivers/watchdog/imx7ulp_wdt.c +1 −1
  307. drivers/watchdog/orion_wdt.c +2 −2
  308. drivers/watchdog/rn5t618_wdt.c +1 −0
  309. drivers/watchdog/w83627hf_wdt.c +1 −1
  310. fs/btrfs/compression.c +6 −1
  311. fs/btrfs/inode.c +3 −3
  312. fs/buffer.c +5 −28
  313. fs/char_dev.c +1 −1
  314. fs/cifs/cifsglob.h +1 −0
  315. fs/cifs/readdir.c +54 −9
  316. fs/cifs/smb2file.c +1 −1
  317. fs/direct-io.c +2 −0
  318. fs/file.c +6 −1
  319. fs/hugetlbfs/inode.c +3 −1
  320. fs/internal.h +1 −1
  321. fs/io-wq.c +2 −8
  322. fs/io_uring.c +355 −347
  323. fs/locks.c +1 −1
  324. fs/mpage.c +1 −1
  325. fs/namespace.c +1 −1
  326. fs/nsfs.c +3 −0
  327. fs/ocfs2/dlmglue.c +1 −0
  328. fs/ocfs2/journal.c +8 −0
  329. fs/posix_acl.c +5 −2
  330. fs/pstore/ram.c +13 −0
  331. fs/pstore/ram_core.c +1 −1
  332. include/linux/ahci_platform.h +2 −0
  333. include/linux/bio.h +1 −0
  334. include/linux/bvec.h +0 −22
  335. include/linux/can/dev.h +34 −0
  336. include/linux/dmaengine.h +4 −1
  337. include/linux/if_ether.h +8 −0
  338. include/linux/kernel.h +0 −9
  339. include/linux/libata.h +1 −0
  340. include/linux/memory_hotplug.h +5 −2
  341. include/linux/mfd/mt6397/rtc.h +8 −0
  342. include/linux/mtd/flashchip.h +1 −1
  343. include/linux/of_mdio.h +1 −1
  344. include/linux/posix-clock.h +11 −8
  345. include/linux/spi/spi.h +2 −2
  346. include/linux/sxgbe_platform.h +1 −1
  347. include/linux/syscalls.h +1 −0
  348. include/net/dst.h +11 −2
  349. include/net/dst_ops.h +2 −1
  350. include/net/netfilter/nf_flow_table.h +6 −0
  351. include/net/sch_generic.h +5 −0
  352. include/soc/sifive/sifive_l2_cache.h +3 −3
  353. include/trace/events/preemptirq.h +4 −4
  354. include/uapi/linux/input.h +1 −0
  355. include/uapi/linux/kcov.h +5 −5
  356. init/main.c +6 −20
  357. kernel/bpf/cgroup.c +9 −2
  358. kernel/bpf/verifier.c +29 −23
  359. kernel/cred.c +3 −3
  360. kernel/exit.c +8 −4
  361. kernel/fork.c +10 −0
  362. kernel/seccomp.c +7 −0
  363. kernel/taskstats.c +19 −11
  364. kernel/time/posix-clock.c +13 −18
  365. kernel/trace/fgraph.c +14 −0
  366. kernel/trace/ftrace.c +3 −3
  367. kernel/trace/trace_events_inject.c +1 −1
  368. kernel/trace/trace_sched_wakeup.c +3 −1
  369. kernel/trace/trace_seq.c +1 −1
  370. kernel/trace/trace_stack.c +5 −0
  371. mm/gup_benchmark.c +6 −2
  372. mm/hugetlb.c +50 −1
  373. mm/memory_hotplug.c +16 −15
  374. mm/memremap.c +1 −1
  375. mm/migrate.c +17 −6
  376. mm/mmap.c +0 −6
  377. mm/oom_kill.c +1 −1
  378. mm/zsmalloc.c +5 −0
  379. net/8021q/vlan.h +1 −0
  380. net/8021q/vlan_dev.c +2 −1
  381. net/8021q/vlan_netlink.c +12 −7
  382. net/bridge/br_nf_core.c +2 −1
  383. net/bridge/netfilter/ebtables.c +16 −17
  384. net/decnet/dn_route.c +4 −2
  385. net/hsr/hsr_debugfs.c +40 −12
  386. net/hsr/hsr_device.c +16 −12
  387. net/hsr/hsr_framereg.c +46 −27
  388. net/hsr/hsr_framereg.h +2 −4
  389. net/hsr/hsr_main.c +6 −1
  390. net/hsr/hsr_main.h +15 −7
  391. net/hsr/hsr_netlink.c +1 −0
  392. net/ipv4/inet_connection_sock.c +1 −1
  393. net/ipv4/ip_tunnel.c +1 −1
  394. net/ipv4/ip_vti.c +1 −1
  395. net/ipv4/netfilter/arp_tables.c +16 −11
  396. net/ipv4/route.c +6 −3
  397. net/ipv4/tcp_input.c +4 −1
  398. net/ipv4/tcp_output.c +3 −0
  399. net/ipv4/udp.c +1 −1
  400. net/ipv4/xfrm4_policy.c +3 −2
  401. net/ipv6/inet6_connection_sock.c +1 −1
  402. net/ipv6/ip6_gre.c +1 −1
  403. net/ipv6/ip6_tunnel.c +2 −2
  404. net/ipv6/ip6_vti.c +1 −1
  405. net/ipv6/route.c +15 −7
  406. net/ipv6/sit.c +1 −1
  407. net/ipv6/xfrm6_policy.c +3 −2
  408. net/netfilter/ipset/ip_set_core.c +2 −1
  409. net/netfilter/ipvs/ip_vs_xmit.c +1 −1
  410. net/netfilter/nf_conntrack_proto_dccp.c +3 −0
  411. net/netfilter/nf_conntrack_proto_sctp.c +3 −0
  412. net/netfilter/nf_flow_table_core.c +1 −6
  413. net/netfilter/nf_flow_table_ip.c +2 −2
  414. net/netfilter/nf_flow_table_offload.c +37 −15
  415. net/netfilter/nf_tables_api.c +6 −2
  416. net/netfilter/nft_flow_offload.c +0 −3
  417. net/netfilter/nft_tproxy.c +2 −2
  418. net/qrtr/qrtr.c +1 −1
  419. net/rxrpc/ar-internal.h +7 −3
  420. net/rxrpc/call_accept.c +37 −23
  421. net/rxrpc/conn_event.c +1 −15
  422. net/rxrpc/conn_service.c +4 −0
  423. net/rxrpc/input.c +0 −18
  424. net/rxrpc/rxkad.c +3 −2
  425. net/rxrpc/security.c +33 −37
  426. net/sched/act_mirred.c +12 −10
  427. net/sched/cls_api.c +5 −26
  428. net/sched/cls_flower.c +12 −0
  429. net/sched/cls_u32.c +0 −25
  430. net/sched/sch_cake.c +1 −1
  431. net/sched/sch_fq.c +12 −11
  432. net/sched/sch_prio.c +8 −2
  433. net/sctp/sm_sideeffect.c +18 −10
  434. net/sctp/stream.c +15 −15
  435. net/sctp/transport.c +1 −1
  436. net/tipc/Makefile +1 −3
  437. net/tipc/netlink_compat.c +2 −2
  438. net/tipc/socket.c +34 −23
  439. samples/seccomp/user-trap.c +2 −2
  440. scripts/gcc-plugins/Kconfig +4 −5
  441. scripts/package/mkdebian +1 −1
  442. security/apparmor/apparmorfs.c +1 −1
  443. security/apparmor/domain.c +43 −39
  444. security/apparmor/file.c +8 −4
  445. security/apparmor/mount.c +1 −1
  446. security/apparmor/policy.c +2 −2
  447. security/tomoyo/common.c +6 −3
  448. security/tomoyo/domain.c +10 −5
  449. security/tomoyo/group.c +6 −3
  450. security/tomoyo/realpath.c +1 −31
  451. security/tomoyo/util.c +4 −2
  452. sound/hda/hdac_regmap.c +0 −1
  453. sound/pci/hda/hda_intel.c +16 −5
  454. sound/pci/hda/patch_realtek.c +36 −13
  455. sound/pci/ice1712/ice1724.c +6 −3
  456. sound/soc/fsl/fsl_audmix.c +8 −1
  457. sound/soc/intel/boards/cml_rt1011_rt5682.c +0 −1
  458. sound/soc/soc-core.c +8 −6
  459. sound/soc/soc-topology.c +3 −3
  460. sound/soc/sof/imx/imx8.c +4 −1
  461. sound/soc/sof/intel/hda-dai.c +9 −2
  462. sound/soc/sof/ipc.c +3 −0
  463. sound/soc/stm/stm32_spdifrx.c +26 −14
  464. sound/usb/card.h +1 −0
  465. sound/usb/pcm.c +21 −4
  466. sound/usb/quirks-table.h +2 −1
  467. sound/usb/quirks.c +12 −0
  468. sound/usb/usbaudio.h +2 −1
  469. tools/lib/bpf/Makefile +8 −7
  470. tools/testing/kunit/kunit.py +11 −7
  471. tools/testing/kunit/kunit_kernel.py +5 −5
  472. tools/testing/kunit/kunit_tool_test.py +9 −1
  473. tools/testing/selftests/bpf/.gitignore +1 −0
  474. tools/testing/selftests/bpf/Makefile +3 −3
  475. tools/testing/selftests/filesystems/epoll/Makefile +1 −1
  476. tools/testing/selftests/firmware/fw_lib.sh +6 −0
  477. tools/testing/selftests/livepatch/functions.sh +14 −1
  478. tools/testing/selftests/livepatch/test-state.sh +1 −2
  479. tools/testing/selftests/net/forwarding/loopback.sh +8 −0
  480. tools/testing/selftests/netfilter/nft_flowtable.sh +34 −5
  481. tools/testing/selftests/rseq/param_test.c +10 −8
  482. tools/testing/selftests/rseq/rseq.h +7 −5
  483. tools/testing/selftests/rseq/settings +1 −0
  484. tools/testing/selftests/seccomp/seccomp_bpf.c +14 −1
  485. usr/gen_initramfs_list.sh +1 −1
Documentation/dev-tools/kcov.rst+5−5
@@ -251,11 +251,11 @@ selectively from different subsystems. · 250 unmodified lines
251251 .. code-block:: c
252252
253253 struct kcov_remote_arg {
254− unsigned trace_mode;
255− unsigned area_size;
256− unsigned num_handles;
257− uint64_t common_handle;
258− uint64_t handles[0];
254+ __u32 trace_mode;
255+ __u32 area_size;
256+ __u32 num_handles;
257+ __aligned_u64 common_handle;
258+ __aligned_u64 handles[0];
259259 };
260260
261261 #define KCOV_INIT_TRACE _IOR('c', 1, unsigned long)
Documentation/dev-tools/kunit/start.rst+5−8
@@ -24,19 +24,16 @@ The wrapper can be run with: · 23 unmodified lines
2424 For more information on this wrapper (also called kunit_tool) checkout the
2525 :doc:`kunit-tool` page.
2626
27−Creating a kunitconfig
28−======================
27+Creating a .kunitconfig
28+=======================
2929 The Python script is a thin wrapper around Kbuild. As such, it needs to be
30−configured with a ``kunitconfig`` file. This file essentially contains the
30+configured with a ``.kunitconfig`` file. This file essentially contains the
3131 regular Kernel config, with the specific test targets as well.
3232
3333 .. code-block:: bash
3434
35− git clone -b master https://kunit.googlesource.com/kunitconfig $PATH_TO_KUNITCONFIG_REPO
3635 cd $PATH_TO_LINUX_REPO
37− ln -s $PATH_TO_KUNIT_CONFIG_REPO/kunitconfig kunitconfig
38−
39−You may want to add kunitconfig to your local gitignore.
36+ cp arch/um/configs/kunit_defconfig .kunitconfig
4037
4138 Verifying KUnit Works
4239 ---------------------
@@ -151,7 +148,7 @@ and the following to ``drivers/misc/Makefile``: · 108 unmodified lines
151148
152149 obj-$(CONFIG_MISC_EXAMPLE_TEST) += example-test.o
153150
154−Now add it to your ``kunitconfig``:
151+Now add it to your ``.kunitconfig``:
155152
156153 .. code-block:: none
157154
Documentation/devicetree/bindings/i2c/i2c-at91.txt+4−2
@@ -18,8 +18,10 @@ Optional properties: · 17 unmodified lines
1818 - dma-names: should contain "tx" and "rx".
1919 - atmel,fifo-size: maximum number of data the RX and TX FIFOs can store for FIFO
2020 capable I2C controllers.
21−- i2c-sda-hold-time-ns: TWD hold time, only available for "atmel,sama5d4-i2c"
22− and "atmel,sama5d2-i2c".
21+- i2c-sda-hold-time-ns: TWD hold time, only available for:
22+ "atmel,sama5d4-i2c",
23+ "atmel,sama5d2-i2c",
24+ "microchip,sam9x60-i2c".
2325 - Child nodes conforming to i2c bus binding
2426
2527 Examples :
Documentation/devicetree/bindings/spi/spi-controller.yaml+2−2
@@ -111,7 +111,7 @@ patternProperties: · 110 unmodified lines
111111 spi-rx-bus-width:
112112 allOf:
113113 - $ref: /schemas/types.yaml#/definitions/uint32
114− - enum: [ 1, 2, 4 ]
114+ - enum: [ 1, 2, 4, 8 ]
115115 - default: 1
116116 description:
117117 Bus width to the SPI bus used for MISO.
@@ -123,7 +123,7 @@ patternProperties: · 5 unmodified lines
123123 spi-tx-bus-width:
124124 allOf:
125125 - $ref: /schemas/types.yaml#/definitions/uint32
126− - enum: [ 1, 2, 4 ]
126+ - enum: [ 1, 2, 4, 8 ]
127127 - default: 1
128128 description:
129129 Bus width to the SPI bus used for MOSI.
Documentation/features/debug/gcov-profile-all/arch-support.txt+1−1
@@ -23,7 +23,7 @@ · 22 unmodified lines
2323 | openrisc: | TODO |
2424 | parisc: | TODO |
2525 | powerpc: | ok |
26− | riscv: | TODO |
26+ | riscv: | ok |
2727 | s390: | ok |
2828 | sh: | ok |
2929 | sparc: | TODO |
Documentation/networking/dsa/sja1105.rst+0−6
@@ -230,12 +230,6 @@ simultaneously on two ports. The driver checks the consistency of the schedules · 229 unmodified lines
230230 against this restriction and errors out when appropriate. Schedule analysis is
231231 needed to avoid this, which is outside the scope of the document.
232232
233−At the moment, the time-aware scheduler can only be triggered based on a
234−standalone clock and not based on PTP time. This means the base-time argument
235−from tc-taprio is ignored and the schedule starts right away. It also means it
236−is more difficult to phase-align the scheduler with the other devices in the
237−network.
238−
239233 Device Tree bindings and board design
240234 =====================================
241235
Documentation/networking/ip-sysctl.txt+1−1
@@ -603,7 +603,7 @@ tcp_synack_retries - INTEGER · 602 unmodified lines
603603 with the current initial RTO of 1second. With this the final timeout
604604 for a passive TCP connection will happen after 63seconds.
605605
606−tcp_syncookies - BOOLEAN
606+tcp_syncookies - INTEGER
607607 Only valid when the kernel was compiled with CONFIG_SYN_COOKIES
608608 Send out syncookies when the syn backlog queue of a socket
609609 overflows. This is to prevent against the common 'SYN flood attack'
Documentation/networking/netdev-FAQ.rst+2−2
@@ -34,8 +34,8 @@ the names, the ``net`` tree is for fixes to existing code already in the · 33 unmodified lines
3434 mainline tree from Linus, and ``net-next`` is where the new code goes
3535 for the future release. You can find the trees here:
3636
37−- https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
38−- https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
37+- https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
38+- https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
3939
4040 Q: How often do changes from these trees make it to the mainline Linus tree?
4141 ----------------------------------------------------------------------------
Documentation/process/index.rst+1−0
@@ -60,6 +60,7 @@ lack of a better place. · 59 unmodified lines
6060 volatile-considered-harmful
6161 botching-up-ioctls
6262 clang-format
63+ ../riscv/patch-acceptance
6364
6465 .. only:: subproject and html
6566
Documentation/riscv/index.rst+1−0
@@ -7,6 +7,7 @@ RISC-V architecture · 6 unmodified lines
77
88 boot-image-header
99 pmu
10+ patch-acceptance
1011
1112 .. only:: subproject and html
1213
Documentation/riscv/patch-acceptance.rst+35−0
@@ -0,0 +1,35 @@
1+.. SPDX-License-Identifier: GPL-2.0
2+
3+arch/riscv maintenance guidelines for developers
4+================================================
5+
6+Overview
7+--------
8+The RISC-V instruction set architecture is developed in the open:
9+in-progress drafts are available for all to review and to experiment
10+with implementations. New module or extension drafts can change
11+during the development process - sometimes in ways that are
12+incompatible with previous drafts. This flexibility can present a
13+challenge for RISC-V Linux maintenance. Linux maintainers disapprove
14+of churn, and the Linux development process prefers well-reviewed and
15+tested code over experimental code. We wish to extend these same
16+principles to the RISC-V-related code that will be accepted for
17+inclusion in the kernel.
18+
19+Submit Checklist Addendum
20+-------------------------
21+We'll only accept patches for new modules or extensions if the
22+specifications for those modules or extensions are listed as being
23+"Frozen" or "Ratified" by the RISC-V Foundation. (Developers may, of
24+course, maintain their own Linux kernel trees that contain code for
25+any draft extensions that they wish.)
26+
27+Additionally, the RISC-V specification allows implementors to create
28+their own custom extensions. These custom extensions aren't required
29+to go through any review or ratification process by the RISC-V
30+Foundation. To avoid the maintenance complexity and potential
31+performance impact of adding kernel code for implementor-specific
32+RISC-V extensions, we'll only to accept patches for extensions that
33+have been officially frozen or ratified by the RISC-V Foundation.
34+(Implementors, may, of course, maintain their own Linux kernel trees
35+containing code for any custom extensions that they wish.)
MAINTAINERS+9−8
@@ -771,6 +771,8 @@ F: drivers/thermal/thermal_mmio.c · 770 unmodified lines
771771
772772 AMAZON ETHERNET DRIVERS
773773 M: Netanel Belgazal <netanel@amazon.com>
774+M: Arthur Kiyanovski <akiyano@amazon.com>
775+R: Guy Tzalik <gtzalik@amazon.com>
774776 R: Saeed Bishara <saeedb@amazon.com>
775777 R: Zorik Machulsky <zorik@amazon.com>
776778 L: netdev@vger.kernel.org
@@ -7034,6 +7036,7 @@ L: linux-acpi@vger.kernel.org · 6257 unmodified lines
70347036 S: Maintained
70357037 F: Documentation/firmware-guide/acpi/gpio-properties.rst
70367038 F: drivers/gpio/gpiolib-acpi.c
7039+F: drivers/gpio/gpiolib-acpi.h
70377040
70387041 GPIO IR Transmitter
70397042 M: Sean Young <sean@mess.org>
@@ -11457,8 +11460,8 @@ M: "David S. Miller" <davem@davemloft.net> · 4417 unmodified lines
1145711460 L: netdev@vger.kernel.org
1145811461 W: http://www.linuxfoundation.org/en/Net
1145911462 Q: http://patchwork.ozlabs.org/project/netdev/list/
11460−T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
11461−T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
11463+T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
11464+T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
1146211465 S: Odd Fixes
1146311466 F: Documentation/devicetree/bindings/net/
1146411467 F: drivers/net/
@@ -11499,8 +11502,8 @@ M: "David S. Miller" <davem@davemloft.net> · 34 unmodified lines
1149911502 L: netdev@vger.kernel.org
1150011503 W: http://www.linuxfoundation.org/en/Net
1150111504 Q: http://patchwork.ozlabs.org/project/netdev/list/
11502−T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
11503−T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
11505+T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
11506+T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
1150411507 B: mailto:netdev@vger.kernel.org
1150511508 S: Maintained
1150611509 F: net/
@@ -11545,7 +11548,7 @@ M: "David S. Miller" <davem@davemloft.net> · 38 unmodified lines
1154511548 M: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
1154611549 M: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
1154711550 L: netdev@vger.kernel.org
11548−T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
11551+T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
1154911552 S: Maintained
1155011553 F: net/ipv4/
1155111554 F: net/ipv6/
@@ -13676,7 +13679,6 @@ F: drivers/net/ethernet/qualcomm/emac/ · 2124 unmodified lines
1367613679
1367713680 QUALCOMM ETHQOS ETHERNET DRIVER
1367813681 M: Vinod Koul <vkoul@kernel.org>
13679−M: Niklas Cassel <niklas.cassel@linaro.org>
1368013682 L: netdev@vger.kernel.org
1368113683 S: Maintained
1368213684 F: drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -14118,6 +14120,7 @@ M: Paul Walmsley <paul.walmsley@sifive.com> · 435 unmodified lines
1411814120 M: Palmer Dabbelt <palmer@dabbelt.com>
1411914121 M: Albert Ou <aou@eecs.berkeley.edu>
1412014122 L: linux-riscv@lists.infradead.org
14123+P: Documentation/riscv/patch-acceptance.rst
1412114124 T: git git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git
1412214125 S: Supported
1412314126 F: arch/riscv/
@@ -14545,8 +14548,6 @@ F: include/linux/platform_data/spi-s3c64xx.h · 421 unmodified lines
1454514548
1454614549 SAMSUNG SXGBE DRIVERS
1454714550 M: Byungho An <bh74.an@samsung.com>
14548−M: Girish K S <ks.giri@samsung.com>
14549−M: Vipul Pandya <vipul.pandya@samsung.com>
1455014551 S: Supported
1455114552 L: netdev@vger.kernel.org
1455214553 F: drivers/net/ethernet/samsung/sxgbe/
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 5
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc3
5+EXTRAVERSION = -rc6
66 NAME = Kleptomaniac Octopus
77
88 # *DOCUMENTATION*
arch/arc/include/asm/entry-arcv2.h+4−4
@@ -162,7 +162,7 @@ · 161 unmodified lines
162162 #endif
163163
164164 #ifdef CONFIG_ARC_HAS_ACCL_REGS
165− ST2 r58, r59, PT_sp + 12
165+ ST2 r58, r59, PT_r58
166166 #endif
167167
168168 .endm
@@ -172,8 +172,8 @@ · 3 unmodified lines
172172
173173 LD2 gp, fp, PT_r26 ; gp (r26), fp (r27)
174174
175− ld r12, [sp, PT_sp + 4]
176− ld r30, [sp, PT_sp + 8]
175+ ld r12, [sp, PT_r12]
176+ ld r30, [sp, PT_r30]
177177
178178 ; Restore SP (into AUX_USER_SP) only if returning to U mode
179179 ; - for K mode, it will be implicitly restored as stack is unwound
@@ -190,7 +190,7 @@ · 10 unmodified lines
190190 #endif
191191
192192 #ifdef CONFIG_ARC_HAS_ACCL_REGS
193− LD2 r58, r59, PT_sp + 12
193+ LD2 r58, r59, PT_r58
194194 #endif
195195 .endm
196196
arch/arc/include/asm/hugepage.h+0−1
@@ -8,7 +8,6 @@ · 7 unmodified lines
88 #define _ASM_ARC_HUGEPAGE_H
99
1010 #include <linux/types.h>
11−#define __ARCH_USE_5LEVEL_HACK
1211 #include <asm-generic/pgtable-nopmd.h>
1312
1413 static inline pte_t pmd_pte(pmd_t pmd)
arch/arc/kernel/asm-offsets.c+9−1
@@ -66,7 +66,15 @@ int main(void) · 65 unmodified lines
6666
6767 DEFINE(SZ_CALLEE_REGS, sizeof(struct callee_regs));
6868 DEFINE(SZ_PT_REGS, sizeof(struct pt_regs));
69− DEFINE(PT_user_r25, offsetof(struct pt_regs, user_r25));
69+
70+#ifdef CONFIG_ISA_ARCV2
71+ OFFSET(PT_r12, pt_regs, r12);
72+ OFFSET(PT_r30, pt_regs, r30);
73+#endif
74+#ifdef CONFIG_ARC_HAS_ACCL_REGS
75+ OFFSET(PT_r58, pt_regs, r58);
76+ OFFSET(PT_r59, pt_regs, r59);
77+#endif
7078
7179 return 0;
7280 }
arch/arc/plat-eznps/Kconfig+1−1
@@ -7,7 +7,7 @@ · 6 unmodified lines
77 menuconfig ARC_PLAT_EZNPS
88 bool "\"EZchip\" ARC dev platform"
99 select CPU_BIG_ENDIAN
10− select CLKSRC_NPS
10+ select CLKSRC_NPS if !PHYS_ADDR_T_64BIT
1111 select EZNPS_GIC
1212 select EZCHIP_NPS_MANAGEMENT_ENET if ETHERNET
1313 help
arch/arm/Kconfig+1−0
@@ -72,6 +72,7 @@ config ARM · 71 unmodified lines
7272 select HAVE_ARM_SMCCC if CPU_V7
7373 select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32
7474 select HAVE_CONTEXT_TRACKING
75+ select HAVE_COPY_THREAD_TLS
7576 select HAVE_C_RECORDMCOUNT
7677 select HAVE_DEBUG_KMEMLEAK
7778 select HAVE_DMA_CONTIGUOUS if MMU
arch/arm/kernel/process.c+3−3
@@ -226,8 +226,8 @@ void release_thread(struct task_struct *dead_task) · 225 unmodified lines
226226 asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
227227
228228 int
229−copy_thread(unsigned long clone_flags, unsigned long stack_start,
230− unsigned long stk_sz, struct task_struct *p)
229+copy_thread_tls(unsigned long clone_flags, unsigned long stack_start,
230+ unsigned long stk_sz, struct task_struct *p, unsigned long tls)
231231 {
232232 struct thread_info *thread = task_thread_info(p);
233233 struct pt_regs *childregs = task_pt_regs(p);
@@ -261,7 +261,7 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start, · 27 unmodified lines
261261 clear_ptrace_hw_breakpoint(p);
262262
263263 if (clone_flags & CLONE_SETTLS)
264− thread->tp_value[0] = childregs->ARM_r3;
264+ thread->tp_value[0] = tls;
265265 thread->tp_value[1] = get_tpuser();
266266
267267 thread_notify(THREAD_NOTIFY_COPY, thread);
arch/arm64/Kconfig+1−0
@@ -138,6 +138,7 @@ config ARM64 · 137 unmodified lines
138138 select HAVE_CMPXCHG_DOUBLE
139139 select HAVE_CMPXCHG_LOCAL
140140 select HAVE_CONTEXT_TRACKING
141+ select HAVE_COPY_THREAD_TLS
141142 select HAVE_DEBUG_BUGVERBOSE
142143 select HAVE_DEBUG_KMEMLEAK
143144 select HAVE_DMA_CONTIGUOUS
arch/arm64/include/asm/pgtable-prot.h+2−3
@@ -85,13 +85,12 @@ · 84 unmodified lines
8585 #define PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_WRITE)
8686 #define PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN)
8787 #define PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN)
88−#define PAGE_EXECONLY __pgprot(_PAGE_DEFAULT | PTE_RDONLY | PTE_NG | PTE_PXN)
8988
9089 #define __P000 PAGE_NONE
9190 #define __P001 PAGE_READONLY
9291 #define __P010 PAGE_READONLY
9392 #define __P011 PAGE_READONLY
94−#define __P100 PAGE_EXECONLY
93+#define __P100 PAGE_READONLY_EXEC
9594 #define __P101 PAGE_READONLY_EXEC
9695 #define __P110 PAGE_READONLY_EXEC
9796 #define __P111 PAGE_READONLY_EXEC
@@ -100,7 +99,7 @@ · 2 unmodified lines
10099 #define __S001 PAGE_READONLY
101100 #define __S010 PAGE_SHARED
102101 #define __S011 PAGE_SHARED
103−#define __S100 PAGE_EXECONLY
102+#define __S100 PAGE_READONLY_EXEC
104103 #define __S101 PAGE_READONLY_EXEC
105104 #define __S110 PAGE_SHARED_EXEC
106105 #define __S111 PAGE_SHARED_EXEC
arch/arm64/include/asm/pgtable.h+3−7
@@ -96,12 +96,8 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; · 95 unmodified lines
9696 #define pte_dirty(pte) (pte_sw_dirty(pte) || pte_hw_dirty(pte))
9797
9898 #define pte_valid(pte) (!!(pte_val(pte) & PTE_VALID))
99−/*
100− * Execute-only user mappings do not have the PTE_USER bit set. All valid
101− * kernel mappings have the PTE_UXN bit set.
102− */
10399 #define pte_valid_not_user(pte) \
104− ((pte_val(pte) & (PTE_VALID | PTE_USER | PTE_UXN)) == (PTE_VALID | PTE_UXN))
100+ ((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID)
105101 #define pte_valid_young(pte) \
106102 ((pte_val(pte) & (PTE_VALID | PTE_AF)) == (PTE_VALID | PTE_AF))
107103 #define pte_valid_user(pte) \
@@ -117,8 +113,8 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; · 9 unmodified lines
117113
118114 /*
119115 * p??_access_permitted() is true for valid user mappings (subject to the
120− * write permission check) other than user execute-only which do not have the
121− * PTE_USER bit set. PROT_NONE mappings do not have the PTE_VALID bit set.
116+ * write permission check). PROT_NONE mappings do not have the PTE_VALID bit
117+ * set.
122118 */
123119 #define pte_access_permitted(pte, write) \
124120 (pte_valid_user(pte) && (!(write) || pte_write(pte)))
arch/arm64/include/asm/unistd.h+0−1
@@ -42,7 +42,6 @@ · 41 unmodified lines
4242 #endif
4343
4444 #define __ARCH_WANT_SYS_CLONE
45−#define __ARCH_WANT_SYS_CLONE3
4645
4746 #ifndef __COMPAT_SYSCALL_NR
4847 #include <uapi/asm/unistd.h>
arch/arm64/include/uapi/asm/unistd.h+1−0
@@ -19,5 +19,6 @@ · 18 unmodified lines
1919 #define __ARCH_WANT_NEW_STAT
2020 #define __ARCH_WANT_SET_GET_RLIMIT
2121 #define __ARCH_WANT_TIME32_SYSCALLS
22+#define __ARCH_WANT_SYS_CLONE3
2223
2324 #include <asm-generic/unistd.h>
arch/arm64/kernel/process.c+5−5
@@ -360,8 +360,8 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) · 359 unmodified lines
360360
361361 asmlinkage void ret_from_fork(void) asm("ret_from_fork");
362362
363−int copy_thread(unsigned long clone_flags, unsigned long stack_start,
364− unsigned long stk_sz, struct task_struct *p)
363+int copy_thread_tls(unsigned long clone_flags, unsigned long stack_start,
364+ unsigned long stk_sz, struct task_struct *p, unsigned long tls)
365365 {
366366 struct pt_regs *childregs = task_pt_regs(p);
367367
@@ -394,11 +394,11 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start, · 26 unmodified lines
394394 }
395395
396396 /*
397− * If a TLS pointer was passed to clone (4th argument), use it
398− * for the new thread.
397+ * If a TLS pointer was passed to clone, use it for the new
398+ * thread.
399399 */
400400 if (clone_flags & CLONE_SETTLS)
401− p->thread.uw.tp_value = childregs->regs[3];
401+ p->thread.uw.tp_value = tls;
402402 } else {
403403 memset(childregs, 0, sizeof(struct pt_regs));
404404 childregs->pstate = PSR_MODE_EL1h;
arch/arm64/mm/fault.c+1−1
@@ -445,7 +445,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, · 444 unmodified lines
445445 const struct fault_info *inf;
446446 struct mm_struct *mm = current->mm;
447447 vm_fault_t fault, major = 0;
448− unsigned long vm_flags = VM_READ | VM_WRITE;
448+ unsigned long vm_flags = VM_READ | VM_WRITE | VM_EXEC;
449449 unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
450450
451451 if (kprobe_page_fault(regs, esr))
arch/arm64/mm/mmu.c+1−3
@@ -1070,7 +1070,6 @@ void arch_remove_memory(int nid, u64 start, u64 size, · 1069 unmodified lines
10701070 {
10711071 unsigned long start_pfn = start >> PAGE_SHIFT;
10721072 unsigned long nr_pages = size >> PAGE_SHIFT;
1073− struct zone *zone;
10741073
10751074 /*
10761075 * FIXME: Cleanup page tables (also in arch_add_memory() in case
@@ -1079,7 +1078,6 @@ void arch_remove_memory(int nid, u64 start, u64 size, · 2 unmodified lines
10791078 * unplug. ARCH_ENABLE_MEMORY_HOTREMOVE must not be
10801079 * unlocked yet.
10811080 */
1082− zone = page_zone(pfn_to_page(start_pfn));
1083− __remove_pages(zone, start_pfn, nr_pages, altmap);
1081+ __remove_pages(start_pfn, nr_pages, altmap);
10841082 }
10851083 #endif
arch/hexagon/include/asm/atomic.h+4−4
@@ -91,7 +91,7 @@ static inline void atomic_##op(int i, atomic_t *v) \ · 90 unmodified lines
9191 "1: %0 = memw_locked(%1);\n" \
9292 " %0 = "#op "(%0,%2);\n" \
9393 " memw_locked(%1,P3)=%0;\n" \
94− " if !P3 jump 1b;\n" \
94+ " if (!P3) jump 1b;\n" \
9595 : "=&r" (output) \
9696 : "r" (&v->counter), "r" (i) \
9797 : "memory", "p3" \
@@ -107,7 +107,7 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \ · 9 unmodified lines
107107 "1: %0 = memw_locked(%1);\n" \
108108 " %0 = "#op "(%0,%2);\n" \
109109 " memw_locked(%1,P3)=%0;\n" \
110− " if !P3 jump 1b;\n" \
110+ " if (!P3) jump 1b;\n" \
111111 : "=&r" (output) \
112112 : "r" (&v->counter), "r" (i) \
113113 : "memory", "p3" \
@@ -124,7 +124,7 @@ static inline int atomic_fetch_##op(int i, atomic_t *v) \ · 10 unmodified lines
124124 "1: %0 = memw_locked(%2);\n" \
125125 " %1 = "#op "(%0,%3);\n" \
126126 " memw_locked(%2,P3)=%1;\n" \
127− " if !P3 jump 1b;\n" \
127+ " if (!P3) jump 1b;\n" \
128128 : "=&r" (output), "=&r" (val) \
129129 : "r" (&v->counter), "r" (i) \
130130 : "memory", "p3" \
@@ -173,7 +173,7 @@ static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u) · 42 unmodified lines
173173 " }"
174174 " memw_locked(%2, p3) = %1;"
175175 " {"
176− " if !p3 jump 1b;"
176+ " if (!p3) jump 1b;"
177177 " }"
178178 "2:"
179179 : "=&r" (__oldval), "=&r" (tmp)
arch/hexagon/include/asm/bitops.h+4−4
@@ -38,7 +38,7 @@ static inline int test_and_clear_bit(int nr, volatile void *addr) · 37 unmodified lines
3838 "1: R12 = memw_locked(R10);\n"
3939 " { P0 = tstbit(R12,R11); R12 = clrbit(R12,R11); }\n"
4040 " memw_locked(R10,P1) = R12;\n"
41− " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n"
41+ " {if (!P1) jump 1b; %0 = mux(P0,#1,#0);}\n"
4242 : "=&r" (oldval)
4343 : "r" (addr), "r" (nr)
4444 : "r10", "r11", "r12", "p0", "p1", "memory"
@@ -62,7 +62,7 @@ static inline int test_and_set_bit(int nr, volatile void *addr) · 17 unmodified lines
6262 "1: R12 = memw_locked(R10);\n"
6363 " { P0 = tstbit(R12,R11); R12 = setbit(R12,R11); }\n"
6464 " memw_locked(R10,P1) = R12;\n"
65− " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n"
65+ " {if (!P1) jump 1b; %0 = mux(P0,#1,#0);}\n"
6666 : "=&r" (oldval)
6767 : "r" (addr), "r" (nr)
6868 : "r10", "r11", "r12", "p0", "p1", "memory"
@@ -88,7 +88,7 @@ static inline int test_and_change_bit(int nr, volatile void *addr) · 19 unmodified lines
8888 "1: R12 = memw_locked(R10);\n"
8989 " { P0 = tstbit(R12,R11); R12 = togglebit(R12,R11); }\n"
9090 " memw_locked(R10,P1) = R12;\n"
91− " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n"
91+ " {if (!P1) jump 1b; %0 = mux(P0,#1,#0);}\n"
9292 : "=&r" (oldval)
9393 : "r" (addr), "r" (nr)
9494 : "r10", "r11", "r12", "p0", "p1", "memory"
@@ -223,7 +223,7 @@ static inline int ffs(int x) · 128 unmodified lines
223223 int r;
224224
225225 asm("{ P0 = cmp.eq(%1,#0); %0 = ct0(%1);}\n"
226− "{ if P0 %0 = #0; if !P0 %0 = add(%0,#1);}\n"
226+ "{ if (P0) %0 = #0; if (!P0) %0 = add(%0,#1);}\n"
227227 : "=&r" (r)
228228 : "r" (x)
229229 : "p0");
arch/hexagon/include/asm/cmpxchg.h+1−1
@@ -30,7 +30,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, · 29 unmodified lines
3030 __asm__ __volatile__ (
3131 "1: %0 = memw_locked(%1);\n" /* load into retval */
3232 " memw_locked(%1,P0) = %2;\n" /* store into memory */
33− " if !P0 jump 1b;\n"
33+ " if (!P0) jump 1b;\n"
3434 : "=&r" (retval)
3535 : "r" (ptr), "r" (x)
3636 : "memory", "p0"
arch/hexagon/include/asm/futex.h+3−3
@@ -16,7 +16,7 @@ · 15 unmodified lines
1616 /* For example: %1 = %4 */ \
1717 insn \
1818 "2: memw_locked(%3,p2) = %1;\n" \
19− " if !p2 jump 1b;\n" \
19+ " if (!p2) jump 1b;\n" \
2020 " %1 = #0;\n" \
2121 "3:\n" \
2222 ".section .fixup,\"ax\"\n" \
@@ -84,10 +84,10 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval, · 61 unmodified lines
8484 "1: %1 = memw_locked(%3)\n"
8585 " {\n"
8686 " p2 = cmp.eq(%1,%4)\n"
87− " if !p2.new jump:NT 3f\n"
87+ " if (!p2.new) jump:NT 3f\n"
8888 " }\n"
8989 "2: memw_locked(%3,p2) = %5\n"
90− " if !p2 jump 1b\n"
90+ " if (!p2) jump 1b\n"
9191 "3:\n"
9292 ".section .fixup,\"ax\"\n"
9393 "4: %0 = #%6\n"
arch/hexagon/include/asm/io.h+1−0
@@ -173,6 +173,7 @@ static inline void writel(u32 data, volatile void __iomem *addr) · 172 unmodified lines
173173
174174 void __iomem *ioremap(unsigned long phys_addr, unsigned long size);
175175 #define ioremap_nocache ioremap
176+#define ioremap_uc(X, Y) ioremap((X), (Y))
176177
177178
178179 #define __raw_writel writel
arch/hexagon/include/asm/spinlock.h+10−10
@@ -30,9 +30,9 @@ static inline void arch_read_lock(arch_rwlock_t *lock) · 29 unmodified lines
3030 __asm__ __volatile__(
3131 "1: R6 = memw_locked(%0);\n"
3232 " { P3 = cmp.ge(R6,#0); R6 = add(R6,#1);}\n"
33− " { if !P3 jump 1b; }\n"
33+ " { if (!P3) jump 1b; }\n"
3434 " memw_locked(%0,P3) = R6;\n"
35− " { if !P3 jump 1b; }\n"
35+ " { if (!P3) jump 1b; }\n"
3636 :
3737 : "r" (&lock->lock)
3838 : "memory", "r6", "p3"
@@ -46,7 +46,7 @@ static inline void arch_read_unlock(arch_rwlock_t *lock) · 7 unmodified lines
4646 "1: R6 = memw_locked(%0);\n"
4747 " R6 = add(R6,#-1);\n"
4848 " memw_locked(%0,P3) = R6\n"
49− " if !P3 jump 1b;\n"
49+ " if (!P3) jump 1b;\n"
5050 :
5151 : "r" (&lock->lock)
5252 : "memory", "r6", "p3"
@@ -61,7 +61,7 @@ static inline int arch_read_trylock(arch_rwlock_t *lock) · 8 unmodified lines
6161 __asm__ __volatile__(
6262 " R6 = memw_locked(%1);\n"
6363 " { %0 = #0; P3 = cmp.ge(R6,#0); R6 = add(R6,#1);}\n"
64− " { if !P3 jump 1f; }\n"
64+ " { if (!P3) jump 1f; }\n"
6565 " memw_locked(%1,P3) = R6;\n"
6666 " { %0 = P3 }\n"
6767 "1:\n"
@@ -78,9 +78,9 @@ static inline void arch_write_lock(arch_rwlock_t *lock) · 10 unmodified lines
7878 __asm__ __volatile__(
7979 "1: R6 = memw_locked(%0)\n"
8080 " { P3 = cmp.eq(R6,#0); R6 = #-1;}\n"
81− " { if !P3 jump 1b; }\n"
81+ " { if (!P3) jump 1b; }\n"
8282 " memw_locked(%0,P3) = R6;\n"
83− " { if !P3 jump 1b; }\n"
83+ " { if (!P3) jump 1b; }\n"
8484 :
8585 : "r" (&lock->lock)
8686 : "memory", "r6", "p3"
@@ -94,7 +94,7 @@ static inline int arch_write_trylock(arch_rwlock_t *lock) · 7 unmodified lines
9494 __asm__ __volatile__(
9595 " R6 = memw_locked(%1)\n"
9696 " { %0 = #0; P3 = cmp.eq(R6,#0); R6 = #-1;}\n"
97− " { if !P3 jump 1f; }\n"
97+ " { if (!P3) jump 1f; }\n"
9898 " memw_locked(%1,P3) = R6;\n"
9999 " %0 = P3;\n"
100100 "1:\n"
@@ -117,9 +117,9 @@ static inline void arch_spin_lock(arch_spinlock_t *lock) · 16 unmodified lines
117117 __asm__ __volatile__(
118118 "1: R6 = memw_locked(%0);\n"
119119 " P3 = cmp.eq(R6,#0);\n"
120− " { if !P3 jump 1b; R6 = #1; }\n"
120+ " { if (!P3) jump 1b; R6 = #1; }\n"
121121 " memw_locked(%0,P3) = R6;\n"
122− " { if !P3 jump 1b; }\n"
122+ " { if (!P3) jump 1b; }\n"
123123 :
124124 : "r" (&lock->lock)
125125 : "memory", "r6", "p3"
@@ -139,7 +139,7 @@ static inline unsigned int arch_spin_trylock(arch_spinlock_t *lock) · 13 unmodified lines
139139 __asm__ __volatile__(
140140 " R6 = memw_locked(%1);\n"
141141 " P3 = cmp.eq(R6,#0);\n"
142− " { if !P3 jump 1f; R6 = #1; %0 = #0; }\n"
142+ " { if (!P3) jump 1f; R6 = #1; %0 = #0; }\n"
143143 " memw_locked(%1,P3) = R6;\n"
144144 " %0 = P3;\n"
145145 "1:\n"
arch/hexagon/kernel/stacktrace.c+1−3
@@ -11,8 +11,6 @@ · 10 unmodified lines
1111 #include <linux/thread_info.h>
1212 #include <linux/module.h>
1313
14−register unsigned long current_frame_pointer asm("r30");
15−
1614 struct stackframe {
1715 unsigned long fp;
1816 unsigned long rets;
@@ -30,7 +28,7 @@ void save_stack_trace(struct stack_trace *trace) · 11 unmodified lines
3028
3129 low = (unsigned long)task_stack_page(current);
3230 high = low + THREAD_SIZE;
33− fp = current_frame_pointer;
31+ fp = (unsigned long)__builtin_frame_address(0);
3432
3533 while (fp >= low && fp <= (high - sizeof(*frame))) {
3634 frame = (struct stackframe *)fp;
arch/hexagon/kernel/vm_entry.S+1−1
@@ -369,7 +369,7 @@ ret_from_fork: · 368 unmodified lines
369369 R26.L = #LO(do_work_pending);
370370 R0 = #VM_INT_DISABLE;
371371 }
372− if P0 jump check_work_pending
372+ if (P0) jump check_work_pending
373373 {
374374 R0 = R25;
375375 callr R24
arch/ia64/mm/init.c+1−3
@@ -689,9 +689,7 @@ void arch_remove_memory(int nid, u64 start, u64 size, · 688 unmodified lines
689689 {
690690 unsigned long start_pfn = start >> PAGE_SHIFT;
691691 unsigned long nr_pages = size >> PAGE_SHIFT;
692− struct zone *zone;
693692
694− zone = page_zone(pfn_to_page(start_pfn));
695− __remove_pages(zone, start_pfn, nr_pages, altmap);
693+ __remove_pages(start_pfn, nr_pages, altmap);
696694 }
697695 #endif
arch/mips/Kconfig+1−1
@@ -47,7 +47,7 @@ config MIPS · 46 unmodified lines
4747 select HAVE_ARCH_TRACEHOOK
4848 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES
4949 select HAVE_ASM_MODVERSIONS
50− select HAVE_EBPF_JIT if (!CPU_MICROMIPS)
50+ select HAVE_EBPF_JIT if 64BIT && !CPU_MICROMIPS && TARGET_ISA_REV >= 2
5151 select HAVE_CONTEXT_TRACKING
5252 select HAVE_COPY_THREAD_TLS
5353 select HAVE_C_RECORDMCOUNT
arch/mips/boot/compressed/Makefile+3−0
@@ -29,6 +29,9 @@ KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY__ \ · 28 unmodified lines
2929 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
3030 -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS)
3131
32+# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
33+KCOV_INSTRUMENT := n
34+
3235 # decompressor objects (linked with vmlinuz)
3336 vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o
3437
arch/mips/include/asm/cpu-type.h+2−1
@@ -15,7 +15,8 @@ · 14 unmodified lines
1515 static inline int __pure __get_cpu_type(const int cpu_type)
1616 {
1717 switch (cpu_type) {
18−#if defined(CONFIG_SYS_HAS_CPU_LOONGSON2EF)
18+#if defined(CONFIG_SYS_HAS_CPU_LOONGSON2E) || \
19+ defined(CONFIG_SYS_HAS_CPU_LOONGSON2F)
1920 case CPU_LOONGSON2EF:
2021 #endif
2122
arch/mips/include/asm/thread_info.h+19−1
@@ -49,8 +49,26 @@ struct thread_info { · 48 unmodified lines
4949 .addr_limit = KERNEL_DS, \
5050 }
5151
52−/* How to get the thread information struct from C. */
52+/*
53+ * A pointer to the struct thread_info for the currently executing thread is
54+ * held in register $28/$gp.
55+ *
56+ * We declare __current_thread_info as a global register variable rather than a
57+ * local register variable within current_thread_info() because clang doesn't
58+ * support explicit local register variables.
59+ *
60+ * When building the VDSO we take care not to declare the global register
61+ * variable because this causes GCC to not preserve the value of $28/$gp in
62+ * functions that change its value (which is common in the PIC VDSO when
63+ * accessing the GOT). Since the VDSO shouldn't be accessing
64+ * __current_thread_info anyway we declare it extern in order to cause a link
65+ * failure if it's referenced.
66+ */
67+#ifdef __VDSO__
68+extern struct thread_info *__current_thread_info;
69+#else
5370 register struct thread_info *__current_thread_info __asm__("$28");
71+#endif
5472
5573 static inline struct thread_info *current_thread_info(void)
5674 {
arch/mips/include/asm/vdso/gettimeofday.h+0−13
@@ -26,8 +26,6 @@ · 25 unmodified lines
2626
2727 #define __VDSO_USE_SYSCALL ULLONG_MAX
2828
29−#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
30−
3129 static __always_inline long gettimeofday_fallback(
3230 struct __kernel_old_timeval *_tv,
3331 struct timezone *_tz)
@@ -48,17 +46,6 @@ static __always_inline long gettimeofday_fallback( · 14 unmodified lines
4846 return error ? -ret : ret;
4947 }
5048
51−#else
52−
53−static __always_inline long gettimeofday_fallback(
54− struct __kernel_old_timeval *_tv,
55− struct timezone *_tz)
56−{
57− return -1;
58−}
59−
60−#endif
61−
6249 static __always_inline long clock_gettime_fallback(
6350 clockid_t _clkid,
6451 struct __kernel_timespec *_ts)
arch/mips/kernel/cacheinfo.c+26−1
@@ -50,6 +50,25 @@ static int __init_cache_level(unsigned int cpu) · 49 unmodified lines
5050 return 0;
5151 }
5252
53+static void fill_cpumask_siblings(int cpu, cpumask_t *cpu_map)
54+{
55+ int cpu1;
56+
57+ for_each_possible_cpu(cpu1)
58+ if (cpus_are_siblings(cpu, cpu1))
59+ cpumask_set_cpu(cpu1, cpu_map);
60+}
61+
62+static void fill_cpumask_cluster(int cpu, cpumask_t *cpu_map)
63+{
64+ int cpu1;
65+ int cluster = cpu_cluster(&cpu_data[cpu]);
66+
67+ for_each_possible_cpu(cpu1)
68+ if (cpu_cluster(&cpu_data[cpu1]) == cluster)
69+ cpumask_set_cpu(cpu1, cpu_map);
70+}
71+
5372 static int __populate_cache_leaves(unsigned int cpu)
5473 {
5574 struct cpuinfo_mips *c = &current_cpu_data;
@@ -57,14 +76,20 @@ static int __populate_cache_leaves(unsigned int cpu) · 1 unmodified line
5776 struct cacheinfo *this_leaf = this_cpu_ci->info_list;
5877
5978 if (c->icache.waysize) {
79+ /* L1 caches are per core */
80+ fill_cpumask_siblings(cpu, &this_leaf->shared_cpu_map);
6081 populate_cache(dcache, this_leaf, 1, CACHE_TYPE_DATA);
82+ fill_cpumask_siblings(cpu, &this_leaf->shared_cpu_map);
6183 populate_cache(icache, this_leaf, 1, CACHE_TYPE_INST);
6284 } else {
6385 populate_cache(dcache, this_leaf, 1, CACHE_TYPE_UNIFIED);
6486 }
6587
66− if (c->scache.waysize)
88+ if (c->scache.waysize) {
89+ /* L2 cache is per cluster */
90+ fill_cpumask_cluster(cpu, &this_leaf->shared_cpu_map);
6791 populate_cache(scache, this_leaf, 2, CACHE_TYPE_UNIFIED);
92+ }
6893
6994 if (c->tcache.waysize)
7095 populate_cache(tcache, this_leaf, 3, CACHE_TYPE_UNIFIED);
arch/mips/net/ebpf_jit.c+1−1
@@ -1804,7 +1804,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) · 1803 unmodified lines
18041804 unsigned int image_size;
18051805 u8 *image_ptr;
18061806
1807− if (!prog->jit_requested || MIPS_ISA_REV < 2)
1807+ if (!prog->jit_requested)
18081808 return prog;
18091809
18101810 tmp = bpf_jit_blind_constants(prog);
arch/mips/vdso/vgettimeofday.c+20−0
@@ -17,12 +17,22 @@ int __vdso_clock_gettime(clockid_t clock, · 16 unmodified lines
1717 return __cvdso_clock_gettime32(clock, ts);
1818 }
1919
20+#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
21+
22+/*
23+ * This is behind the ifdef so that we don't provide the symbol when there's no
24+ * possibility of there being a usable clocksource, because there's nothing we
25+ * can do without it. When libc fails the symbol lookup it should fall back on
26+ * the standard syscall path.
27+ */
2028 int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
2129 struct timezone *tz)
2230 {
2331 return __cvdso_gettimeofday(tv, tz);
2432 }
2533
34+#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */
35+
2636 int __vdso_clock_getres(clockid_t clock_id,
2737 struct old_timespec32 *res)
2838 {
@@ -43,12 +53,22 @@ int __vdso_clock_gettime(clockid_t clock, · 14 unmodified lines
4353 return __cvdso_clock_gettime(clock, ts);
4454 }
4555
56+#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
57+
58+/*
59+ * This is behind the ifdef so that we don't provide the symbol when there's no
60+ * possibility of there being a usable clocksource, because there's nothing we
61+ * can do without it. When libc fails the symbol lookup it should fall back on
62+ * the standard syscall path.
63+ */
4664 int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
4765 struct timezone *tz)
4866 {
4967 return __cvdso_gettimeofday(tv, tz);
5068 }
5169
70+#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */
71+
5272 int __vdso_clock_getres(clockid_t clock_id,
5373 struct __kernel_timespec *res)
5474 {
arch/parisc/Kconfig+1−0
@@ -62,6 +62,7 @@ config PARISC · 61 unmodified lines
6262 select HAVE_FTRACE_MCOUNT_RECORD if HAVE_DYNAMIC_FTRACE
6363 select HAVE_KPROBES_ON_FTRACE
6464 select HAVE_DYNAMIC_FTRACE_WITH_REGS
65+ select HAVE_COPY_THREAD_TLS
6566
6667 help
6768 The PA-RISC microprocessor is designed by Hewlett-Packard and used
arch/parisc/kernel/process.c+4−4
@@ -208,8 +208,8 @@ arch_initcall(parisc_idle_init); · 207 unmodified lines
208208 * Copy architecture-specific thread state
209209 */
210210 int
211−copy_thread(unsigned long clone_flags, unsigned long usp,
212− unsigned long kthread_arg, struct task_struct *p)
211+copy_thread_tls(unsigned long clone_flags, unsigned long usp,
212+ unsigned long kthread_arg, struct task_struct *p, unsigned long tls)
213213 {
214214 struct pt_regs *cregs = &(p->thread.regs);
215215 void *stack = task_stack_page(p);
@@ -254,9 +254,9 @@ copy_thread(unsigned long clone_flags, unsigned long usp, · 38 unmodified lines
254254 cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN + FRAME_SIZE;
255255 cregs->kpc = (unsigned long) &child_return;
256256
257− /* Setup thread TLS area from the 4th parameter in clone */
257+ /* Setup thread TLS area */
258258 if (clone_flags & CLONE_SETTLS)
259− cregs->cr27 = cregs->gr[23];
259+ cregs->cr27 = tls;
260260 }
261261
262262 return 0;
arch/powerpc/include/asm/spinlock.h+1−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 *
1616 * (the type definitions are in asm/spinlock_types.h)
1717 */
18+#include <linux/jump_label.h>
1819 #include <linux/irqflags.h>
1920 #ifdef CONFIG_PPC64
2021 #include <asm/paca.h>
arch/powerpc/mm/mem.c+1−2
@@ -151,10 +151,9 @@ void __ref arch_remove_memory(int nid, u64 start, u64 size, · 150 unmodified lines
151151 {
152152 unsigned long start_pfn = start >> PAGE_SHIFT;
153153 unsigned long nr_pages = size >> PAGE_SHIFT;
154− struct page *page = pfn_to_page(start_pfn) + vmem_altmap_offset(altmap);
155154 int ret;
156155
157− __remove_pages(page_zone(page), start_pfn, nr_pages, altmap);
156+ __remove_pages(start_pfn, nr_pages, altmap);
158157
159158 /* Remove htab bolted mappings for this section of memory */
160159 start = (unsigned long)__va(start);
arch/powerpc/mm/slice.c+2−2
@@ -50,7 +50,7 @@ static void slice_print_mask(const char *label, const struct slice_mask *mask) { · 49 unmodified lines
5050
5151 #endif
5252
53−static inline bool slice_addr_is_low(unsigned long addr)
53+static inline notrace bool slice_addr_is_low(unsigned long addr)
5454 {
5555 u64 tmp = (u64)addr;
5656
@@ -659,7 +659,7 @@ unsigned long arch_get_unmapped_area_topdown(struct file *filp, · 602 unmodified lines
659659 mm_ctx_user_psize(&current->mm->context), 1);
660660 }
661661
662−unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr)
662+unsigned int notrace get_slice_psize(struct mm_struct *mm, unsigned long addr)
663663 {
664664 unsigned char *psizes;
665665 int index, mask_index;
arch/riscv/Kconfig+2−0
@@ -64,6 +64,8 @@ config RISCV · 63 unmodified lines
6464 select SPARSEMEM_STATIC if 32BIT
6565 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
6666 select HAVE_ARCH_MMAP_RND_BITS if MMU
67+ select ARCH_HAS_GCOV_PROFILE_ALL
68+ select HAVE_COPY_THREAD_TLS
6769
6870 config ARCH_MMAP_RND_BITS_MIN
6971 default 18 if 64BIT
arch/riscv/boot/dts/sifive/fu540-c000.dtsi+15−0
@@ -54,6 +54,7 @@ · 53 unmodified lines
5454 reg = <1>;
5555 riscv,isa = "rv64imafdc";
5656 tlb-split;
57+ next-level-cache = <&l2cache>;
5758 cpu1_intc: interrupt-controller {
5859 #interrupt-cells = <1>;
5960 compatible = "riscv,cpu-intc";
@@ -77,6 +78,7 @@ · 17 unmodified lines
7778 reg = <2>;
7879 riscv,isa = "rv64imafdc";
7980 tlb-split;
81+ next-level-cache = <&l2cache>;
8082 cpu2_intc: interrupt-controller {
8183 #interrupt-cells = <1>;
8284 compatible = "riscv,cpu-intc";
@@ -100,6 +102,7 @@ · 17 unmodified lines
100102 reg = <3>;
101103 riscv,isa = "rv64imafdc";
102104 tlb-split;
105+ next-level-cache = <&l2cache>;
103106 cpu3_intc: interrupt-controller {
104107 #interrupt-cells = <1>;
105108 compatible = "riscv,cpu-intc";
@@ -123,6 +126,7 @@ · 17 unmodified lines
123126 reg = <4>;
124127 riscv,isa = "rv64imafdc";
125128 tlb-split;
129+ next-level-cache = <&l2cache>;
126130 cpu4_intc: interrupt-controller {
127131 #interrupt-cells = <1>;
128132 compatible = "riscv,cpu-intc";
@@ -253,6 +257,17 @@ · 124 unmodified lines
253257 #pwm-cells = <3>;
254258 status = "disabled";
255259 };
260+ l2cache: cache-controller@2010000 {
261+ compatible = "sifive,fu540-c000-ccache", "cache";
262+ cache-block-size = <64>;
263+ cache-level = <2>;
264+ cache-sets = <1024>;
265+ cache-size = <2097152>;
266+ cache-unified;
267+ interrupt-parent = <&plic0>;
268+ interrupts = <1 2 3>;
269+ reg = <0x0 0x2010000 0x0 0x1000>;
270+ };
256271
257272 };
258273 };
arch/riscv/include/asm/csr.h+9−9
@@ -116,9 +116,9 @@ · 115 unmodified lines
116116 # define SR_PIE SR_MPIE
117117 # define SR_PP SR_MPP
118118
119−# define IRQ_SOFT IRQ_M_SOFT
120−# define IRQ_TIMER IRQ_M_TIMER
121−# define IRQ_EXT IRQ_M_EXT
119+# define RV_IRQ_SOFT IRQ_M_SOFT
120+# define RV_IRQ_TIMER IRQ_M_TIMER
121+# define RV_IRQ_EXT IRQ_M_EXT
122122 #else /* CONFIG_RISCV_M_MODE */
123123 # define CSR_STATUS CSR_SSTATUS
124124 # define CSR_IE CSR_SIE
@@ -133,15 +133,15 @@ · 8 unmodified lines
133133 # define SR_PIE SR_SPIE
134134 # define SR_PP SR_SPP
135135
136−# define IRQ_SOFT IRQ_S_SOFT
137−# define IRQ_TIMER IRQ_S_TIMER
138−# define IRQ_EXT IRQ_S_EXT
136+# define RV_IRQ_SOFT IRQ_S_SOFT
137+# define RV_IRQ_TIMER IRQ_S_TIMER
138+# define RV_IRQ_EXT IRQ_S_EXT
139139 #endif /* CONFIG_RISCV_M_MODE */
140140
141141 /* IE/IP (Supervisor/Machine Interrupt Enable/Pending) flags */
142−#define IE_SIE (_AC(0x1, UL) << IRQ_SOFT)
143−#define IE_TIE (_AC(0x1, UL) << IRQ_TIMER)
144−#define IE_EIE (_AC(0x1, UL) << IRQ_EXT)
142+#define IE_SIE (_AC(0x1, UL) << RV_IRQ_SOFT)
143+#define IE_TIE (_AC(0x1, UL) << RV_IRQ_TIMER)
144+#define IE_EIE (_AC(0x1, UL) << RV_IRQ_EXT)
145145
146146 #ifndef __ASSEMBLY__
147147
arch/riscv/kernel/entry.S+1−0
@@ -246,6 +246,7 @@ check_syscall_nr: · 245 unmodified lines
246246 */
247247 li t1, -1
248248 beq a7, t1, ret_from_syscall_rejected
249+ blt a7, t1, 1f
249250 /* Call syscall */
250251 la s0, sys_call_table
251252 slli t0, a7, RISCV_LGPTR
arch/riscv/kernel/ftrace.c+1−1
@@ -142,7 +142,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, · 141 unmodified lines
142142 */
143143 old = *parent;
144144
145− if (function_graph_enter(old, self_addr, frame_pointer, parent))
145+ if (!function_graph_enter(old, self_addr, frame_pointer, parent))
146146 *parent = return_hooker;
147147 }
148148
arch/riscv/kernel/head.S+1−1
@@ -251,7 +251,7 @@ ENTRY(reset_regs) · 250 unmodified lines
251251 #ifdef CONFIG_FPU
252252 csrr t0, CSR_MISA
253253 andi t0, t0, (COMPAT_HWCAP_ISA_F | COMPAT_HWCAP_ISA_D)
254− bnez t0, .Lreset_regs_done
254+ beqz t0, .Lreset_regs_done
255255
256256 li t1, SR_FS
257257 csrs CSR_STATUS, t1
arch/riscv/kernel/irq.c+3−3
@@ -23,11 +23,11 @@ asmlinkage __visible void __irq_entry do_IRQ(struct pt_regs *regs) · 22 unmodified lines
2323
2424 irq_enter();
2525 switch (regs->cause & ~CAUSE_IRQ_FLAG) {
26− case IRQ_TIMER:
26+ case RV_IRQ_TIMER:
2727 riscv_timer_interrupt();
2828 break;
2929 #ifdef CONFIG_SMP
30− case IRQ_SOFT:
30+ case RV_IRQ_SOFT:
3131 /*
3232 * We only use software interrupts to pass IPIs, so if a non-SMP
3333 * system gets one, then we don't know what to do.
@@ -35,7 +35,7 @@ asmlinkage __visible void __irq_entry do_IRQ(struct pt_regs *regs) · 1 unmodified line
3535 riscv_software_interrupt();
3636 break;
3737 #endif
38− case IRQ_EXT:
38+ case RV_IRQ_EXT:
3939 handle_arch_irq(regs);
4040 break;
4141 default:
arch/riscv/kernel/process.c+3−3
@@ -99,8 +99,8 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) · 98 unmodified lines
9999 return 0;
100100 }
101101
102−int copy_thread(unsigned long clone_flags, unsigned long usp,
103− unsigned long arg, struct task_struct *p)
102+int copy_thread_tls(unsigned long clone_flags, unsigned long usp,
103+ unsigned long arg, struct task_struct *p, unsigned long tls)
104104 {
105105 struct pt_regs *childregs = task_pt_regs(p);
106106
@@ -121,7 +121,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, · 14 unmodified lines
121121 if (usp) /* User fork */
122122 childregs->sp = usp;
123123 if (clone_flags & CLONE_SETTLS)
124− childregs->tp = childregs->a5;
124+ childregs->tp = tls;
125125 childregs->a0 = 0; /* Return value of fork() */
126126 p->thread.ra = (unsigned long)ret_from_fork;
127127 }
arch/riscv/kernel/riscv_ksyms.c+0−3
@@ -9,8 +9,5 @@ · 8 unmodified lines
99 /*
1010 * Assembly functions that may be used (directly or indirectly) by modules
1111 */
12−EXPORT_SYMBOL(__clear_user);
13−EXPORT_SYMBOL(__asm_copy_to_user);
14−EXPORT_SYMBOL(__asm_copy_from_user);
1512 EXPORT_SYMBOL(memset);
1613 EXPORT_SYMBOL(memcpy);
arch/riscv/lib/uaccess.S+4−0
@@ -1,4 +1,5 @@
11 #include <linux/linkage.h>
2+#include <asm-generic/export.h>
23 #include <asm/asm.h>
34 #include <asm/csr.h>
45
@@ -66,6 +67,8 @@ ENTRY(__asm_copy_from_user) · 61 unmodified lines
6667 j 3b
6768 ENDPROC(__asm_copy_to_user)
6869 ENDPROC(__asm_copy_from_user)
70+EXPORT_SYMBOL(__asm_copy_to_user)
71+EXPORT_SYMBOL(__asm_copy_from_user)
6972
7073
7174 ENTRY(__clear_user)
@@ -108,6 +111,7 @@ ENTRY(__clear_user) · 36 unmodified lines
108111 bltu a0, a3, 5b
109112 j 3b
110113 ENDPROC(__clear_user)
114+EXPORT_SYMBOL(__clear_user)
111115
112116 .section .fixup,"ax"
113117 .balign 4
arch/riscv/mm/cacheflush.c+1−0
@@ -22,6 +22,7 @@ void flush_icache_all(void) · 21 unmodified lines
2222 else
2323 on_each_cpu(ipi_remote_fence_i, NULL, 1);
2424 }
25+EXPORT_SYMBOL(flush_icache_all);
2526
2627 /*
2728 * Performs an icache flush for the given MM context. RISC-V has no direct
arch/riscv/mm/init.c+6−6
@@ -99,13 +99,13 @@ static void __init setup_initrd(void) · 98 unmodified lines
9999 pr_info("initrd not found or empty");
100100 goto disable;
101101 }
102− if (__pa(initrd_end) > PFN_PHYS(max_low_pfn)) {
102+ if (__pa_symbol(initrd_end) > PFN_PHYS(max_low_pfn)) {
103103 pr_err("initrd extends beyond end of memory");
104104 goto disable;
105105 }
106106
107107 size = initrd_end - initrd_start;
108− memblock_reserve(__pa(initrd_start), size);
108+ memblock_reserve(__pa_symbol(initrd_start), size);
109109 initrd_below_start_ok = 1;
110110
111111 pr_info("Initial ramdisk at: 0x%p (%lu bytes)\n",
@@ -124,8 +124,8 @@ void __init setup_bootmem(void) · 12 unmodified lines
124124 {
125125 struct memblock_region *reg;
126126 phys_addr_t mem_size = 0;
127− phys_addr_t vmlinux_end = __pa(&_end);
128− phys_addr_t vmlinux_start = __pa(&_start);
127+ phys_addr_t vmlinux_end = __pa_symbol(&_end);
128+ phys_addr_t vmlinux_start = __pa_symbol(&_start);
129129
130130 /* Find the memory region containing the kernel */
131131 for_each_memblock(memory, reg) {
@@ -445,7 +445,7 @@ static void __init setup_vm_final(void) · 313 unmodified lines
445445
446446 /* Setup swapper PGD for fixmap */
447447 create_pgd_mapping(swapper_pg_dir, FIXADDR_START,
448− __pa(fixmap_pgd_next),
448+ __pa_symbol(fixmap_pgd_next),
449449 PGDIR_SIZE, PAGE_TABLE);
450450
451451 /* Map all memory banks */
@@ -474,7 +474,7 @@ static void __init setup_vm_final(void) · 22 unmodified lines
474474 clear_fixmap(FIX_PMD);
475475
476476 /* Move to swapper page table */
477− csr_write(CSR_SATP, PFN_DOWN(__pa(swapper_pg_dir)) | SATP_MODE);
477+ csr_write(CSR_SATP, PFN_DOWN(__pa_symbol(swapper_pg_dir)) | SATP_MODE);
478478 local_flush_tlb_all();
479479 }
480480 #else
arch/s390/mm/init.c+1−3
@@ -292,10 +292,8 @@ void arch_remove_memory(int nid, u64 start, u64 size, · 291 unmodified lines
292292 {
293293 unsigned long start_pfn = start >> PAGE_SHIFT;
294294 unsigned long nr_pages = size >> PAGE_SHIFT;
295− struct zone *zone;
296295
297− zone = page_zone(pfn_to_page(start_pfn));
298− __remove_pages(zone, start_pfn, nr_pages, altmap);
296+ __remove_pages(start_pfn, nr_pages, altmap);
299297 vmem_remove_mapping(start, size);
300298 }
301299 #endif /* CONFIG_MEMORY_HOTPLUG */
arch/sh/mm/init.c+1−3
@@ -434,9 +434,7 @@ void arch_remove_memory(int nid, u64 start, u64 size, · 433 unmodified lines
434434 {
435435 unsigned long start_pfn = PFN_DOWN(start);
436436 unsigned long nr_pages = size >> PAGE_SHIFT;
437− struct zone *zone;
438437
439− zone = page_zone(pfn_to_page(start_pfn));
440− __remove_pages(zone, start_pfn, nr_pages, altmap);
438+ __remove_pages(start_pfn, nr_pages, altmap);
441439 }
442440 #endif /* CONFIG_MEMORY_HOTPLUG */
arch/um/Kconfig+1−0
@@ -14,6 +14,7 @@ config UML · 13 unmodified lines
1414 select HAVE_FUTEX_CMPXCHG if FUTEX
1515 select HAVE_DEBUG_KMEMLEAK
1616 select HAVE_DEBUG_BUGVERBOSE
17+ select HAVE_COPY_THREAD_TLS
1718 select GENERIC_IRQ_SHOW
1819 select GENERIC_CPU_DEVICES
1920 select GENERIC_CLOCKEVENTS
arch/um/include/asm/ptrace-generic.h+1−1
@@ -36,7 +36,7 @@ extern long subarch_ptrace(struct task_struct *child, long request, · 35 unmodified lines
3636 extern unsigned long getreg(struct task_struct *child, int regno);
3737 extern int putreg(struct task_struct *child, int regno, unsigned long value);
3838
39−extern int arch_copy_tls(struct task_struct *new);
39+extern int arch_set_tls(struct task_struct *new, unsigned long tls);
4040 extern void clear_flushed_tls(struct task_struct *task);
4141 extern int syscall_trace_enter(struct pt_regs *regs);
4242 extern void syscall_trace_leave(struct pt_regs *regs);
arch/um/kernel/process.c+3−3
@@ -153,8 +153,8 @@ void fork_handler(void) · 152 unmodified lines
153153 userspace(&current->thread.regs.regs, current_thread_info()->aux_fp_regs);
154154 }
155155
156−int copy_thread(unsigned long clone_flags, unsigned long sp,
157− unsigned long arg, struct task_struct * p)
156+int copy_thread_tls(unsigned long clone_flags, unsigned long sp,
157+ unsigned long arg, struct task_struct * p, unsigned long tls)
158158 {
159159 void (*handler)(void);
160160 int kthread = current->flags & PF_KTHREAD;
@@ -188,7 +188,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, · 27 unmodified lines
188188 * Set a new TLS for the child thread?
189189 */
190190 if (clone_flags & CLONE_SETTLS)
191− ret = arch_copy_tls(p);
191+ ret = arch_set_tls(p, tls);
192192 }
193193
194194 return ret;
arch/x86/mm/init_32.c+1−3
@@ -865,10 +865,8 @@ void arch_remove_memory(int nid, u64 start, u64 size, · 864 unmodified lines
865865 {
866866 unsigned long start_pfn = start >> PAGE_SHIFT;
867867 unsigned long nr_pages = size >> PAGE_SHIFT;
868− struct zone *zone;
869868
870− zone = page_zone(pfn_to_page(start_pfn));
871− __remove_pages(zone, start_pfn, nr_pages, altmap);
869+ __remove_pages(start_pfn, nr_pages, altmap);
872870 }
873871 #endif
874872
arch/x86/mm/init_64.c+1−3
@@ -1212,10 +1212,8 @@ void __ref arch_remove_memory(int nid, u64 start, u64 size, · 1211 unmodified lines
12121212 {
12131213 unsigned long start_pfn = start >> PAGE_SHIFT;
12141214 unsigned long nr_pages = size >> PAGE_SHIFT;
1215− struct page *page = pfn_to_page(start_pfn) + vmem_altmap_offset(altmap);
1216− struct zone *zone = page_zone(page);
12171215
1218− __remove_pages(zone, start_pfn, nr_pages, altmap);
1216+ __remove_pages(start_pfn, nr_pages, altmap);
12191217 kernel_physical_mapping_remove(start, start + size);
12201218 }
12211219 #endif /* CONFIG_MEMORY_HOTPLUG */
arch/x86/um/tls_32.c+2−4
@@ -215,14 +215,12 @@ static int set_tls_entry(struct task_struct* task, struct user_desc *info, · 214 unmodified lines
215215 return 0;
216216 }
217217
218−int arch_copy_tls(struct task_struct *new)
218+int arch_set_tls(struct task_struct *new, unsigned long tls)
219219 {
220220 struct user_desc info;
221221 int idx, ret = -EFAULT;
222222
223− if (copy_from_user(&info,
224− (void __user *) UPT_SI(&new->thread.regs.regs),
225− sizeof(info)))
223+ if (copy_from_user(&info, (void __user *) tls, sizeof(info)))
226224 goto out;
227225
228226 ret = -EINVAL;
arch/x86/um/tls_64.c+3−4
@@ -6,14 +6,13 @@ void clear_flushed_tls(struct task_struct *task) · 5 unmodified lines
66 {
77 }
88
9−int arch_copy_tls(struct task_struct *t)
9+int arch_set_tls(struct task_struct *t, unsigned long tls)
1010 {
1111 /*
1212 * If CLONE_SETTLS is set, we need to save the thread id
13− * (which is argument 5, child_tid, of clone) so it can be set
14− * during context switches.
13+ * so it can be set during context switches.
1514 */
16− t->thread.arch.fs = t->thread.regs.regs.gp[R8 / sizeof(long)];
15+ t->thread.arch.fs = tls;
1716
1817 return 0;
1918 }
arch/xtensa/Kconfig+1−0
@@ -24,6 +24,7 @@ config XTENSA · 23 unmodified lines
2424 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
2525 select HAVE_ARCH_KASAN if MMU && !XIP_KERNEL
2626 select HAVE_ARCH_TRACEHOOK
27+ select HAVE_COPY_THREAD_TLS
2728 select HAVE_DEBUG_KMEMLEAK
2829 select HAVE_DMA_CONTIGUOUS
2930 select HAVE_EXIT_THREAD
arch/xtensa/kernel/process.c+4−4
@@ -202,8 +202,9 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) · 201 unmodified lines
202202 * involved. Much simpler to just not copy those live frames across.
203203 */
204204
205−int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn,
206− unsigned long thread_fn_arg, struct task_struct *p)
205+int copy_thread_tls(unsigned long clone_flags, unsigned long usp_thread_fn,
206+ unsigned long thread_fn_arg, struct task_struct *p,
207+ unsigned long tls)
207208 {
208209 struct pt_regs *childregs = task_pt_regs(p);
209210
@@ -266,9 +267,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn, · 56 unmodified lines
266267
267268 childregs->syscall = regs->syscall;
268269
269− /* The thread pointer is passed in the '4th argument' (= a5) */
270270 if (clone_flags & CLONE_SETTLS)
271− childregs->threadptr = childregs->areg[5];
271+ childregs->threadptr = tls;
272272 } else {
273273 p->thread.ra = MAKE_RA_FOR_CALL(
274274 (unsigned long)ret_from_kernel_thread, 1);
block/bio.c+49−0
@@ -538,6 +538,55 @@ void zero_fill_bio_iter(struct bio *bio, struct bvec_iter start) · 537 unmodified lines
538538 }
539539 EXPORT_SYMBOL(zero_fill_bio_iter);
540540
541+/**
542+ * bio_truncate - truncate the bio to small size of @new_size
543+ * @bio: the bio to be truncated
544+ * @new_size: new size for truncating the bio
545+ *
546+ * Description:
547+ * Truncate the bio to new size of @new_size. If bio_op(bio) is
548+ * REQ_OP_READ, zero the truncated part. This function should only
549+ * be used for handling corner cases, such as bio eod.
550+ */
551+void bio_truncate(struct bio *bio, unsigned new_size)
552+{
553+ struct bio_vec bv;
554+ struct bvec_iter iter;
555+ unsigned int done = 0;
556+ bool truncated = false;
557+
558+ if (new_size >= bio->bi_iter.bi_size)
559+ return;
560+
561+ if (bio_op(bio) != REQ_OP_READ)
562+ goto exit;
563+
564+ bio_for_each_segment(bv, bio, iter) {
565+ if (done + bv.bv_len > new_size) {
566+ unsigned offset;
567+
568+ if (!truncated)
569+ offset = new_size - done;
570+ else
571+ offset = 0;
572+ zero_user(bv.bv_page, offset, bv.bv_len - offset);
573+ truncated = true;
574+ }
575+ done += bv.bv_len;
576+ }
577+
578+ exit:
579+ /*
580+ * Don't touch bvec table here and make it really immutable, since
581+ * fs bio user has to retrieve all pages via bio_for_each_segment_all
582+ * in its .end_bio() callback.
583+ *
584+ * It is enough to truncate bio by updating .bi_size since we can make
585+ * correct bvec with the updated .bi_size for drivers.
586+ */
587+ bio->bi_iter.bi_size = new_size;
588+}
589+
541590 /**
542591 * bio_put - release a reference to a bio
543592 * @bio: bio to release reference to
block/blk-merge.c+9−9
@@ -157,16 +157,14 @@ static inline unsigned get_max_io_size(struct request_queue *q, · 156 unmodified lines
157157 return sectors & (lbs - 1);
158158 }
159159
160−static unsigned get_max_segment_size(const struct request_queue *q,
161− unsigned offset)
160+static inline unsigned get_max_segment_size(const struct request_queue *q,
161+ struct page *start_page,
162+ unsigned long offset)
162163 {
163164 unsigned long mask = queue_segment_boundary(q);
164165
165− /* default segment boundary mask means no boundary limit */
166− if (mask == BLK_SEG_BOUNDARY_MASK)
167− return queue_max_segment_size(q);
168−
169− return min_t(unsigned long, mask - (mask & offset) + 1,
166+ offset = mask & (page_to_phys(start_page) + offset);
167+ return min_t(unsigned long, mask - offset + 1,
170168 queue_max_segment_size(q));
171169 }
172170
@@ -201,7 +199,8 @@ static bool bvec_split_segs(const struct request_queue *q, · 28 unmodified lines
201199 unsigned seg_size = 0;
202200
203201 while (len && *nsegs < max_segs) {
204− seg_size = get_max_segment_size(q, bv->bv_offset + total_len);
202+ seg_size = get_max_segment_size(q, bv->bv_page,
203+ bv->bv_offset + total_len);
205204 seg_size = min(seg_size, len);
206205
207206 (*nsegs)++;
@@ -419,7 +418,8 @@ static unsigned blk_bvec_map_sg(struct request_queue *q, · 211 unmodified lines
419418
420419 while (nbytes > 0) {
421420 unsigned offset = bvec->bv_offset + total;
422− unsigned len = min(get_max_segment_size(q, offset), nbytes);
421+ unsigned len = min(get_max_segment_size(q, bvec->bv_page,
422+ offset), nbytes);
423423 struct page *page = bvec->bv_page;
424424
425425 /*
block/compat_ioctl.c+16−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #include <linux/compat.h>
77 #include <linux/elevator.h>
88 #include <linux/hdreg.h>
9+#include <linux/pr.h>
910 #include <linux/slab.h>
1011 #include <linux/syscalls.h>
1112 #include <linux/types.h>
@@ -354,6 +355,13 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) · 342 unmodified lines
354355 * but we call blkdev_ioctl, which gets the lock for us
355356 */
356357 case BLKRRPART:
358+ case BLKREPORTZONE:
359+ case BLKRESETZONE:
360+ case BLKOPENZONE:
361+ case BLKCLOSEZONE:
362+ case BLKFINISHZONE:
363+ case BLKGETZONESZ:
364+ case BLKGETNRZONES:
357365 return blkdev_ioctl(bdev, mode, cmd,
358366 (unsigned long)compat_ptr(arg));
359367 case BLKBSZSET_32:
@@ -401,6 +409,14 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) · 41 unmodified lines
401409 case BLKTRACETEARDOWN: /* compatible */
402410 ret = blk_trace_ioctl(bdev, cmd, compat_ptr(arg));
403411 return ret;
412+ case IOC_PR_REGISTER:
413+ case IOC_PR_RESERVE:
414+ case IOC_PR_RELEASE:
415+ case IOC_PR_PREEMPT:
416+ case IOC_PR_PREEMPT_ABORT:
417+ case IOC_PR_CLEAR:
418+ return blkdev_ioctl(bdev, mode, cmd,
419+ (unsigned long)compat_ptr(arg));
404420 default:
405421 if (disk->fops->compat_ioctl)
406422 ret = disk->fops->compat_ioctl(bdev, mode, cmd, arg);
drivers/ata/ahci_brcm.c+94−39
@@ -76,8 +76,7 @@ enum brcm_ahci_version { · 75 unmodified lines
7676 };
7777
7878 enum brcm_ahci_quirks {
79− BRCM_AHCI_QUIRK_NO_NCQ = BIT(0),
80− BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE = BIT(1),
79+ BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE = BIT(0),
8180 };
8281
8382 struct brcm_ahci_priv {
@@ -213,19 +212,12 @@ static void brcm_sata_phys_disable(struct brcm_ahci_priv *priv) · 129 unmodified lines
213212 brcm_sata_phy_disable(priv, i);
214213 }
215214
216−static u32 brcm_ahci_get_portmask(struct platform_device *pdev,
215+static u32 brcm_ahci_get_portmask(struct ahci_host_priv *hpriv,
217216 struct brcm_ahci_priv *priv)
218217 {
219− void __iomem *ahci;
220− struct resource *res;
221218 u32 impl;
222219
223− res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ahci");
224− ahci = devm_ioremap_resource(&pdev->dev, res);
225− if (IS_ERR(ahci))
226− return 0;
227−
228− impl = readl(ahci + HOST_PORTS_IMPL);
220+ impl = readl(hpriv->mmio + HOST_PORTS_IMPL);
229221
230222 if (fls(impl) > SATA_TOP_MAX_PHYS)
231223 dev_warn(priv->dev, "warning: more ports than PHYs (%#x)\n",
@@ -233,9 +225,6 @@ static u32 brcm_ahci_get_portmask(struct platform_device *pdev, · 1 unmodified line
233225 else if (!impl)
234226 dev_info(priv->dev, "no ports found\n");
235227
236− devm_iounmap(&pdev->dev, ahci);
237− devm_release_mem_region(&pdev->dev, res->start, resource_size(res));
238−
239228 return impl;
240229 }
241230
@@ -285,6 +274,13 @@ static unsigned int brcm_ahci_read_id(struct ata_device *dev, · 43 unmodified lines
285274 /* Perform the SATA PHY reset sequence */
286275 brcm_sata_phy_disable(priv, ap->port_no);
287276
277+ /* Reset the SATA clock */
278+ ahci_platform_disable_clks(hpriv);
279+ msleep(10);
280+
281+ ahci_platform_enable_clks(hpriv);
282+ msleep(10);
283+
288284 /* Bring the PHY back on */
289285 brcm_sata_phy_enable(priv, ap->port_no);
290286
@@ -347,11 +343,10 @@ static int brcm_ahci_suspend(struct device *dev) · 56 unmodified lines
347343 struct ata_host *host = dev_get_drvdata(dev);
348344 struct ahci_host_priv *hpriv = host->private_data;
349345 struct brcm_ahci_priv *priv = hpriv->plat_data;
350− int ret;
351346
352− ret = ahci_platform_suspend(dev);
353347 brcm_sata_phys_disable(priv);
354− return ret;
348+
349+ return ahci_platform_suspend(dev);
355350 }
356351
357352 static int brcm_ahci_resume(struct device *dev)
@@ -359,11 +354,44 @@ static int brcm_ahci_resume(struct device *dev) · 1 unmodified line
359354 struct ata_host *host = dev_get_drvdata(dev);
360355 struct ahci_host_priv *hpriv = host->private_data;
361356 struct brcm_ahci_priv *priv = hpriv->plat_data;
357+ int ret;
358+
359+ /* Make sure clocks are turned on before re-configuration */
360+ ret = ahci_platform_enable_clks(hpriv);
361+ if (ret)
362+ return ret;
362363
363364 brcm_sata_init(priv);
364365 brcm_sata_phys_enable(priv);
365366 brcm_sata_alpm_init(hpriv);
366− return ahci_platform_resume(dev);
367+
368+ /* Since we had to enable clocks earlier on, we cannot use
369+ * ahci_platform_resume() as-is since a second call to
370+ * ahci_platform_enable_resources() would bump up the resources
371+ * (regulators, clocks, PHYs) count artificially so we copy the part
372+ * after ahci_platform_enable_resources().
373+ */
374+ ret = ahci_platform_enable_phys(hpriv);
375+ if (ret)
376+ goto out_disable_phys;
377+
378+ ret = ahci_platform_resume_host(dev);
379+ if (ret)
380+ goto out_disable_platform_phys;
381+
382+ /* We resumed so update PM runtime state */
383+ pm_runtime_disable(dev);
384+ pm_runtime_set_active(dev);
385+ pm_runtime_enable(dev);
386+
387+ return 0;
388+
389+out_disable_platform_phys:
390+ ahci_platform_disable_phys(hpriv);
391+out_disable_phys:
392+ brcm_sata_phys_disable(priv);
393+ ahci_platform_disable_clks(hpriv);
394+ return ret;
367395 }
368396 #endif
369397
@@ -410,44 +438,71 @@ static int brcm_ahci_probe(struct platform_device *pdev) · 40 unmodified lines
410438 if (!IS_ERR_OR_NULL(priv->rcdev))
411439 reset_control_deassert(priv->rcdev);
412440
413− if ((priv->version == BRCM_SATA_BCM7425) ||
414− (priv->version == BRCM_SATA_NSP)) {
415− priv->quirks |= BRCM_AHCI_QUIRK_NO_NCQ;
441+ hpriv = ahci_platform_get_resources(pdev, 0);
442+ if (IS_ERR(hpriv)) {
443+ ret = PTR_ERR(hpriv);
444+ goto out_reset;
445+ }
446+
447+ hpriv->plat_data = priv;
448+ hpriv->flags = AHCI_HFLAG_WAKE_BEFORE_STOP | AHCI_HFLAG_NO_WRITE_TO_RO;
449+
450+ switch (priv->version) {
451+ case BRCM_SATA_BCM7425:
452+ hpriv->flags |= AHCI_HFLAG_DELAY_ENGINE;
453+ /* fall through */
454+ case BRCM_SATA_NSP:
455+ hpriv->flags |= AHCI_HFLAG_NO_NCQ;
416456 priv->quirks |= BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE;
457+ break;
458+ default:
459+ break;
417460 }
418461
462+ ret = ahci_platform_enable_clks(hpriv);
463+ if (ret)
464+ goto out_reset;
465+
466+ /* Must be first so as to configure endianness including that
467+ * of the standard AHCI register space.
468+ */
419469 brcm_sata_init(priv);
420470
421− priv->port_mask = brcm_ahci_get_portmask(pdev, priv);
422− if (!priv->port_mask)
423− return -ENODEV;
471+ /* Initializes priv->port_mask which is used below */
472+ priv->port_mask = brcm_ahci_get_portmask(hpriv, priv);
473+ if (!priv->port_mask) {
474+ ret = -ENODEV;
475+ goto out_disable_clks;
476+ }
424477
478+ /* Must be done before ahci_platform_enable_phys() */
425479 brcm_sata_phys_enable(priv);
426480
427− hpriv = ahci_platform_get_resources(pdev, 0);
428− if (IS_ERR(hpriv))
429− return PTR_ERR(hpriv);
430− hpriv->plat_data = priv;
431− hpriv->flags = AHCI_HFLAG_WAKE_BEFORE_STOP;
432−
433481 brcm_sata_alpm_init(hpriv);
434482
435− ret = ahci_platform_enable_resources(hpriv);
483+ ret = ahci_platform_enable_phys(hpriv);
436484 if (ret)
437− return ret;
438−
439− if (priv->quirks & BRCM_AHCI_QUIRK_NO_NCQ)
440− hpriv->flags |= AHCI_HFLAG_NO_NCQ;
441− hpriv->flags |= AHCI_HFLAG_NO_WRITE_TO_RO;
485+ goto out_disable_phys;
442486
443487 ret = ahci_platform_init_host(pdev, hpriv, &ahci_brcm_port_info,
444488 &ahci_platform_sht);
445489 if (ret)
446− return ret;
490+ goto out_disable_platform_phys;
447491
448492 dev_info(dev, "Broadcom AHCI SATA3 registered\n");
449493
450494 return 0;
495+
496+out_disable_platform_phys:
497+ ahci_platform_disable_phys(hpriv);
498+out_disable_phys:
499+ brcm_sata_phys_disable(priv);
500+out_disable_clks:
501+ ahci_platform_disable_clks(hpriv);
502+out_reset:
503+ if (!IS_ERR_OR_NULL(priv->rcdev))
504+ reset_control_assert(priv->rcdev);
505+ return ret;
451506 }
452507
453508 static int brcm_ahci_remove(struct platform_device *pdev)
@@ -457,12 +512,12 @@ static int brcm_ahci_remove(struct platform_device *pdev) · 3 unmodified lines
457512 struct brcm_ahci_priv *priv = hpriv->plat_data;
458513 int ret;
459514
515+ brcm_sata_phys_disable(priv);
516+
460517 ret = ata_platform_remove_one(pdev);
461518 if (ret)
462519 return ret;
463520
464− brcm_sata_phys_disable(priv);
465−
466521 return 0;
467522 }
468523
drivers/ata/libahci_platform.c+4−2
@@ -43,7 +43,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_ops); · 42 unmodified lines
4343 * RETURNS:
4444 * 0 on success otherwise a negative error code
4545 */
46−static int ahci_platform_enable_phys(struct ahci_host_priv *hpriv)
46+int ahci_platform_enable_phys(struct ahci_host_priv *hpriv)
4747 {
4848 int rc, i;
4949
@@ -74,6 +74,7 @@ disable_phys: · 24 unmodified lines
7474 }
7575 return rc;
7676 }
77+EXPORT_SYMBOL_GPL(ahci_platform_enable_phys);
7778
7879 /**
7980 * ahci_platform_disable_phys - Disable PHYs
@@ -81,7 +82,7 @@ disable_phys: · 1 unmodified line
8182 *
8283 * This function disables all PHYs found in hpriv->phys.
8384 */
84−static void ahci_platform_disable_phys(struct ahci_host_priv *hpriv)
85+void ahci_platform_disable_phys(struct ahci_host_priv *hpriv)
8586 {
8687 int i;
8788
@@ -90,6 +91,7 @@ static void ahci_platform_disable_phys(struct ahci_host_priv *hpriv) · 2 unmodified lines
9091 phy_exit(hpriv->phys[i]);
9192 }
9293 }
94+EXPORT_SYMBOL_GPL(ahci_platform_disable_phys);
9395
9496 /**
9597 * ahci_platform_enable_clks - Enable platform clocks
drivers/ata/libata-core.c+24−0
@@ -5328,6 +5328,30 @@ void ata_qc_complete(struct ata_queued_cmd *qc) · 5327 unmodified lines
53285328 }
53295329 }
53305330
5331+/**
5332+ * ata_qc_get_active - get bitmask of active qcs
5333+ * @ap: port in question
5334+ *
5335+ * LOCKING:
5336+ * spin_lock_irqsave(host lock)
5337+ *
5338+ * RETURNS:
5339+ * Bitmask of active qcs
5340+ */
5341+u64 ata_qc_get_active(struct ata_port *ap)
5342+{
5343+ u64 qc_active = ap->qc_active;
5344+
5345+ /* ATA_TAG_INTERNAL is sent to hw as tag 0 */
5346+ if (qc_active & (1ULL << ATA_TAG_INTERNAL)) {
5347+ qc_active |= (1 << 0);
5348+ qc_active &= ~(1ULL << ATA_TAG_INTERNAL);
5349+ }
5350+
5351+ return qc_active;
5352+}
5353+EXPORT_SYMBOL_GPL(ata_qc_get_active);
5354+
53315355 /**
53325356 * ata_qc_complete_multiple - Complete multiple qcs successfully
53335357 * @ap: port in question
drivers/ata/sata_fsl.c+1−1
@@ -1280,7 +1280,7 @@ static void sata_fsl_host_intr(struct ata_port *ap) · 1279 unmodified lines
12801280 i, ioread32(hcr_base + CC),
12811281 ioread32(hcr_base + CA));
12821282 }
1283− ata_qc_complete_multiple(ap, ap->qc_active ^ done_mask);
1283+ ata_qc_complete_multiple(ap, ata_qc_get_active(ap) ^ done_mask);
12841284 return;
12851285
12861286 } else if ((ap->qc_active & (1ULL << ATA_TAG_INTERNAL))) {
drivers/ata/sata_mv.c+1−1
@@ -2829,7 +2829,7 @@ static void mv_process_crpb_entries(struct ata_port *ap, struct mv_port_priv *pp · 2828 unmodified lines
28292829 }
28302830
28312831 if (work_done) {
2832− ata_qc_complete_multiple(ap, ap->qc_active ^ done_mask);
2832+ ata_qc_complete_multiple(ap, ata_qc_get_active(ap) ^ done_mask);
28332833
28342834 /* Update the software queue position index in hardware */
28352835 writelfl((pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK) |
drivers/ata/sata_nv.c+1−1
@@ -984,7 +984,7 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance) · 983 unmodified lines
984984 check_commands = 0;
985985 check_commands &= ~(1 << pos);
986986 }
987− ata_qc_complete_multiple(ap, ap->qc_active ^ done_mask);
987+ ata_qc_complete_multiple(ap, ata_qc_get_active(ap) ^ done_mask);
988988 }
989989 }
990990
drivers/atm/eni.c+2−2
@@ -374,7 +374,7 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb, · 373 unmodified lines
374374 here = (eni_vcc->descr+skip) & (eni_vcc->words-1);
375375 dma[j++] = (here << MID_DMA_COUNT_SHIFT) | (vcc->vci
376376 << MID_DMA_VCI_SHIFT) | MID_DT_JK;
377− j++;
377+ dma[j++] = 0;
378378 }
379379 here = (eni_vcc->descr+size+skip) & (eni_vcc->words-1);
380380 if (!eff) size += skip;
@@ -447,7 +447,7 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb, · 66 unmodified lines
447447 if (size != eff) {
448448 dma[j++] = (here << MID_DMA_COUNT_SHIFT) |
449449 (vcc->vci << MID_DMA_VCI_SHIFT) | MID_DT_JK;
450− j++;
450+ dma[j++] = 0;
451451 }
452452 if (!j || j > 2*RX_DMA_BUF) {
453453 printk(KERN_CRIT DEV_LABEL "!j or j too big!!!\n");
drivers/block/null_blk_zoned.c+4−1
@@ -186,7 +186,10 @@ static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op, · 185 unmodified lines
186186 if (zone->cond == BLK_ZONE_COND_FULL)
187187 return BLK_STS_IOERR;
188188
189− zone->cond = BLK_ZONE_COND_CLOSED;
189+ if (zone->wp == zone->start)
190+ zone->cond = BLK_ZONE_COND_EMPTY;
191+ else
192+ zone->cond = BLK_ZONE_COND_CLOSED;
190193 break;
191194 case REQ_OP_ZONE_FINISH:
192195 if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL)
drivers/block/pktcdvd.c+1−1
@@ -2707,7 +2707,7 @@ static const struct block_device_operations pktcdvd_ops = { · 2706 unmodified lines
27072707 .release = pkt_close,
27082708 .ioctl = pkt_ioctl,
27092709 #ifdef CONFIG_COMPAT
2710− .ioctl = pkt_compat_ioctl,
2710+ .compat_ioctl = pkt_compat_ioctl,
27112711 #endif
27122712 .check_events = pkt_check_events,
27132713 };
drivers/char/agp/isoch.c+1−8
@@ -84,7 +84,6 @@ static int agp_3_5_isochronous_node_enable(struct agp_bridge_data *bridge, · 83 unmodified lines
8484 unsigned int cdev = 0;
8585 u32 mnistat, tnistat, tstatus, mcmd;
8686 u16 tnicmd, mnicmd;
87− u8 mcapndx;
8887 u32 tot_bw = 0, tot_n = 0, tot_rq = 0, y_max, rq_isoch, rq_async;
8988 u32 step, rem, rem_isoch, rem_async;
9089 int ret = 0;
@@ -138,8 +137,6 @@ static int agp_3_5_isochronous_node_enable(struct agp_bridge_data *bridge, · 47 unmodified lines
138137 cur = list_entry(pos, struct agp_3_5_dev, list);
139138 dev = cur->dev;
140139
141− mcapndx = cur->capndx;
142−
143140 pci_read_config_dword(dev, cur->capndx+AGPNISTAT, &mnistat);
144141
145142 master[cdev].maxbw = (mnistat >> 16) & 0xff;
@@ -251,8 +248,6 @@ static int agp_3_5_isochronous_node_enable(struct agp_bridge_data *bridge, · 105 unmodified lines
251248 cur = master[cdev].dev;
252249 dev = cur->dev;
253250
254− mcapndx = cur->capndx;
255−
256251 master[cdev].rq += (cdev == ndevs - 1)
257252 ? (rem_async + rem_isoch) : step;
258253
@@ -319,7 +314,7 @@ int agp_3_5_enable(struct agp_bridge_data *bridge) · 60 unmodified lines
319314 {
320315 struct pci_dev *td = bridge->dev, *dev = NULL;
321316 u8 mcapndx;
322− u32 isoch, arqsz;
317+ u32 isoch;
323318 u32 tstatus, mstatus, ncapid;
324319 u32 mmajor;
325320 u16 mpstat;
@@ -334,8 +329,6 @@ int agp_3_5_enable(struct agp_bridge_data *bridge) · 8 unmodified lines
334329 if (isoch == 0) /* isoch xfers not available, bail out. */
335330 return -ENODEV;
336331
337− arqsz = (tstatus >> 13) & 0x7;
338−
339332 /*
340333 * Allocate a head for our AGP 3.5 device list
341334 * (multiple AGP v3 devices are allowed behind a single bridge).
drivers/char/tpm/tpm-dev-common.c+1−1
@@ -130,7 +130,7 @@ ssize_t tpm_common_read(struct file *file, char __user *buf, · 129 unmodified lines
130130 priv->response_read = true;
131131
132132 ret_size = min_t(ssize_t, size, priv->response_length);
133− if (!ret_size) {
133+ if (ret_size <= 0) {
134134 priv->response_length = 0;
135135 goto out;
136136 }
drivers/char/tpm/tpm-dev.h+1−1
@@ -14,7 +14,7 @@ struct file_priv { · 13 unmodified lines
1414 struct work_struct timeout_work;
1515 struct work_struct async_work;
1616 wait_queue_head_t async_wait;
17− size_t response_length;
17+ ssize_t response_length;
1818 bool response_read;
1919 bool command_enqueued;
2020
drivers/char/tpm/tpm_tis_core.c+15−19
@@ -978,13 +978,13 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · 977 unmodified lines
978978
979979 if (wait_startup(chip, 0) != 0) {
980980 rc = -ENODEV;
981− goto err_start;
981+ goto out_err;
982982 }
983983
984984 /* Take control of the TPM's interrupt hardware and shut it off */
985985 rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask);
986986 if (rc < 0)
987− goto err_start;
987+ goto out_err;
988988
989989 intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT |
990990 TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT;
@@ -993,21 +993,21 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · 2 unmodified lines
993993
994994 rc = tpm_chip_start(chip);
995995 if (rc)
996− goto err_start;
997−
996+ goto out_err;
998997 rc = tpm2_probe(chip);
998+ tpm_chip_stop(chip);
999999 if (rc)
1000− goto err_probe;
1000+ goto out_err;
10011001
10021002 rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor);
10031003 if (rc < 0)
1004− goto err_probe;
1004+ goto out_err;
10051005
10061006 priv->manufacturer_id = vendor;
10071007
10081008 rc = tpm_tis_read8(priv, TPM_RID(0), &rid);
10091009 if (rc < 0)
1010− goto err_probe;
1010+ goto out_err;
10111011
10121012 dev_info(dev, "%s TPM (device-id 0x%X, rev-id %d)\n",
10131013 (chip->flags & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2",
@@ -1016,13 +1016,13 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · 2 unmodified lines
10161016 probe = probe_itpm(chip);
10171017 if (probe < 0) {
10181018 rc = -ENODEV;
1019− goto err_probe;
1019+ goto out_err;
10201020 }
10211021
10221022 /* Figure out the capabilities */
10231023 rc = tpm_tis_read32(priv, TPM_INTF_CAPS(priv->locality), &intfcaps);
10241024 if (rc < 0)
1025− goto err_probe;
1025+ goto out_err;
10261026
10271027 dev_dbg(dev, "TPM interface capabilities (0x%x):\n",
10281028 intfcaps);
@@ -1056,10 +1056,9 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · 27 unmodified lines
10561056 if (tpm_get_timeouts(chip)) {
10571057 dev_err(dev, "Could not get TPM timeouts and durations\n");
10581058 rc = -ENODEV;
1059− goto err_probe;
1059+ goto out_err;
10601060 }
10611061
1062− chip->flags |= TPM_CHIP_FLAG_IRQ;
10631062 if (irq) {
10641063 tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
10651064 irq);
@@ -1071,18 +1070,15 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · 5 unmodified lines
10711070 }
10721071 }
10731072
1074− tpm_chip_stop(chip);
1075−
10761073 rc = tpm_chip_register(chip);
10771074 if (rc)
1078− goto err_start;
1079−
1080− return 0;
1075+ goto out_err;
10811076
1082−err_probe:
1083− tpm_chip_stop(chip);
1077+ if (chip->ops->clk_enable != NULL)
1078+ chip->ops->clk_enable(chip, false);
10841079
1085−err_start:
1080+ return 0;
1081+out_err:
10861082 if ((chip->ops != NULL) && (chip->ops->clk_enable != NULL))
10871083 chip->ops->clk_enable(chip, false);
10881084
drivers/clocksource/timer-riscv.c+1−1
@@ -56,7 +56,7 @@ static unsigned long long riscv_clocksource_rdtime(struct clocksource *cs) · 55 unmodified lines
5656 return get_cycles64();
5757 }
5858
59−static u64 riscv_sched_clock(void)
59+static u64 notrace riscv_sched_clock(void)
6060 {
6161 return get_cycles64();
6262 }
drivers/cpufreq/cpufreq-dt-platdev.c+2−0
@@ -121,6 +121,8 @@ static const struct of_device_id blacklist[] __initconst = { · 120 unmodified lines
121121 { .compatible = "mediatek,mt8176", },
122122 { .compatible = "mediatek,mt8183", },
123123
124+ { .compatible = "nvidia,tegra20", },
125+ { .compatible = "nvidia,tegra30", },
124126 { .compatible = "nvidia,tegra124", },
125127 { .compatible = "nvidia,tegra210", },
126128
drivers/devfreq/Kconfig+1−4
@@ -83,7 +83,6 @@ config ARM_EXYNOS_BUS_DEVFREQ · 82 unmodified lines
8383 select DEVFREQ_GOV_PASSIVE
8484 select DEVFREQ_EVENT_EXYNOS_PPMU
8585 select PM_DEVFREQ_EVENT
86− select PM_OPP
8786 help
8887 This adds the common DEVFREQ driver for Exynos Memory bus. Exynos
8988 Memory bus has one more group of memory bus (e.g, MIF and INT block).
@@ -98,7 +97,7 @@ config ARM_TEGRA_DEVFREQ · 8 unmodified lines
9897 ARCH_TEGRA_132_SOC || ARCH_TEGRA_124_SOC || \
9998 ARCH_TEGRA_210_SOC || \
10099 COMPILE_TEST
101− select PM_OPP
100+ depends on COMMON_CLK
102101 help
103102 This adds the DEVFREQ driver for the Tegra family of SoCs.
104103 It reads ACTMON counters of memory controllers and adjusts the
@@ -109,7 +108,6 @@ config ARM_TEGRA20_DEVFREQ · 4 unmodified lines
109108 depends on (TEGRA_MC && TEGRA20_EMC) || COMPILE_TEST
110109 depends on COMMON_CLK
111110 select DEVFREQ_GOV_SIMPLE_ONDEMAND
112− select PM_OPP
113111 help
114112 This adds the DEVFREQ driver for the Tegra20 family of SoCs.
115113 It reads Memory Controller counters and adjusts the operating
@@ -121,7 +119,6 @@ config ARM_RK3399_DMC_DEVFREQ · 5 unmodified lines
121119 select DEVFREQ_EVENT_ROCKCHIP_DFI
122120 select DEVFREQ_GOV_SIMPLE_ONDEMAND
123121 select PM_DEVFREQ_EVENT
124− select PM_OPP
125122 help
126123 This adds the DEVFREQ driver for the RK3399 DMC(Dynamic Memory Controller).
127124 It sets the frequency for the memory controller and reads the usage counts
drivers/dma/dma-jz4780.c+2−1
@@ -999,7 +999,8 @@ static const struct jz4780_dma_soc_data jz4740_dma_soc_data = { · 998 unmodified lines
999999 static const struct jz4780_dma_soc_data jz4725b_dma_soc_data = {
10001000 .nb_channels = 6,
10011001 .transfer_ord_max = 5,
1002− .flags = JZ_SOC_DATA_PER_CHAN_PM | JZ_SOC_DATA_NO_DCKES_DCKEC,
1002+ .flags = JZ_SOC_DATA_PER_CHAN_PM | JZ_SOC_DATA_NO_DCKES_DCKEC |
1003+ JZ_SOC_DATA_BREAK_LINKS,
10031004 };
10041005
10051006 static const struct jz4780_dma_soc_data jz4770_dma_soc_data = {
drivers/dma/ioat/dma.c+2−1
@@ -377,10 +377,11 @@ ioat_alloc_ring(struct dma_chan *c, int order, gfp_t flags) · 376 unmodified lines
377377
378378 descs->virt = dma_alloc_coherent(to_dev(ioat_chan),
379379 SZ_2M, &descs->hw, flags);
380− if (!descs->virt && (i > 0)) {
380+ if (!descs->virt) {
381381 int idx;
382382
383383 for (idx = 0; idx < i; idx++) {
384+ descs = &ioat_chan->descs[idx];
384385 dma_free_coherent(to_dev(ioat_chan), SZ_2M,
385386 descs->virt, descs->hw);
386387 descs->virt = NULL;
drivers/dma/k3dma.c+9−3
@@ -229,9 +229,11 @@ static irqreturn_t k3_dma_int_handler(int irq, void *dev_id) · 228 unmodified lines
229229 c = p->vchan;
230230 if (c && (tc1 & BIT(i))) {
231231 spin_lock_irqsave(&c->vc.lock, flags);
232− vchan_cookie_complete(&p->ds_run->vd);
233− p->ds_done = p->ds_run;
234− p->ds_run = NULL;
232+ if (p->ds_run != NULL) {
233+ vchan_cookie_complete(&p->ds_run->vd);
234+ p->ds_done = p->ds_run;
235+ p->ds_run = NULL;
236+ }
235237 spin_unlock_irqrestore(&c->vc.lock, flags);
236238 }
237239 if (c && (tc2 & BIT(i))) {
@@ -271,6 +273,10 @@ static int k3_dma_start_txd(struct k3_dma_chan *c) · 33 unmodified lines
271273 if (BIT(c->phy->idx) & k3_dma_get_chan_stat(d))
272274 return -EAGAIN;
273275
276+ /* Avoid losing track of ds_run if a transaction is in flight */
277+ if (c->phy->ds_run)
278+ return -EAGAIN;
279+
274280 if (vd) {
275281 struct k3_dma_desc_sw *ds =
276282 container_of(vd, struct k3_dma_desc_sw, vd);
drivers/dma/virt-dma.c+1−2
@@ -104,9 +104,8 @@ static void vchan_complete(unsigned long arg) · 103 unmodified lines
104104 dmaengine_desc_get_callback(&vd->tx, &cb);
105105
106106 list_del(&vd->node);
107− vchan_vdesc_fini(vd);
108−
109107 dmaengine_desc_callback_invoke(&cb, &vd->tx_result);
108+ vchan_vdesc_fini(vd);
110109 }
111110 }
112111
drivers/edac/sifive_edac.c+1−1
@@ -10,7 +10,7 @@ · 9 unmodified lines
1010 #include <linux/edac.h>
1111 #include <linux/platform_device.h>
1212 #include "edac_module.h"
13−#include <asm/sifive_l2_cache.h>
13+#include <soc/sifive/sifive_l2_cache.h>
1414
1515 #define DRVNAME "sifive_edac"
1616
drivers/firmware/broadcom/tee_bnxt_fw.c+0−1
@@ -215,7 +215,6 @@ static int tee_bnxt_fw_probe(struct device *dev) · 214 unmodified lines
215215 fw_shm_pool = tee_shm_alloc(pvt_data.ctx, MAX_SHM_MEM_SZ,
216216 TEE_SHM_MAPPED | TEE_SHM_DMA_BUF);
217217 if (IS_ERR(fw_shm_pool)) {
218− tee_client_close_context(pvt_data.ctx);
219218 dev_err(pvt_data.dev, "tee_shm_alloc failed\n");
220219 err = PTR_ERR(fw_shm_pool);
221220 goto out_sess;
drivers/gpio/Kconfig+3−2
@@ -553,8 +553,8 @@ config GPIO_TEGRA · 552 unmodified lines
553553
554554 config GPIO_TEGRA186
555555 tristate "NVIDIA Tegra186 GPIO support"
556− default ARCH_TEGRA_186_SOC
557− depends on ARCH_TEGRA_186_SOC || COMPILE_TEST
556+ default ARCH_TEGRA_186_SOC || ARCH_TEGRA_194_SOC
557+ depends on ARCH_TEGRA_186_SOC || ARCH_TEGRA_194_SOC || COMPILE_TEST
558558 depends on OF_GPIO
559559 select GPIOLIB_IRQCHIP
560560 select IRQ_DOMAIN_HIERARCHY
@@ -1148,6 +1148,7 @@ config GPIO_MADERA · 587 unmodified lines
11481148 config GPIO_MAX77620
11491149 tristate "GPIO support for PMIC MAX77620 and MAX20024"
11501150 depends on MFD_MAX77620
1151+ select GPIOLIB_IRQCHIP
11511152 help
11521153 GPIO driver for MAX77620 and MAX20024 PMIC from Maxim Semiconductor.
11531154 MAX77620 PMIC has 8 pins that can be configured as GPIOs. The
drivers/gpio/gpio-aspeed-sgpio.c+1−1
@@ -107,7 +107,7 @@ static void __iomem *bank_reg(struct aspeed_sgpio *gpio, · 106 unmodified lines
107107 return gpio->base + bank->irq_regs + GPIO_IRQ_STATUS;
108108 default:
109109 /* acturally if code runs to here, it's an error case */
110− BUG_ON(1);
110+ BUG();
111111 }
112112 }
113113
drivers/gpio/gpio-mockup.c+7−4
@@ -156,7 +156,7 @@ static int gpio_mockup_apply_pull(struct gpio_mockup_chip *chip, · 155 unmodified lines
156156 mutex_lock(&chip->lock);
157157
158158 if (test_bit(FLAG_REQUESTED, &desc->flags) &&
159− !test_bit(FLAG_IS_OUT, &desc->flags)) {
159+ !test_bit(FLAG_IS_OUT, &desc->flags)) {
160160 curr = __gpio_mockup_get(chip, offset);
161161 if (curr == value)
162162 goto out;
@@ -165,7 +165,7 @@ static int gpio_mockup_apply_pull(struct gpio_mockup_chip *chip, · 2 unmodified lines
165165 irq_type = irq_get_trigger_type(irq);
166166
167167 if ((value == 1 && (irq_type & IRQ_TYPE_EDGE_RISING)) ||
168− (value == 0 && (irq_type & IRQ_TYPE_EDGE_FALLING)))
168+ (value == 0 && (irq_type & IRQ_TYPE_EDGE_FALLING)))
169169 irq_sim_fire(sim, offset);
170170 }
171171
@@ -226,7 +226,7 @@ static int gpio_mockup_get_direction(struct gpio_chip *gc, unsigned int offset) · 54 unmodified lines
226226 int direction;
227227
228228 mutex_lock(&chip->lock);
229− direction = !chip->lines[offset].dir;
229+ direction = chip->lines[offset].dir;
230230 mutex_unlock(&chip->lock);
231231
232232 return direction;
@@ -395,7 +395,7 @@ static int gpio_mockup_probe(struct platform_device *pdev) · 162 unmodified lines
395395 struct gpio_chip *gc;
396396 struct device *dev;
397397 const char *name;
398− int rv, base;
398+ int rv, base, i;
399399 u16 ngpio;
400400
401401 dev = &pdev->dev;
@@ -447,6 +447,9 @@ static int gpio_mockup_probe(struct platform_device *pdev) · 45 unmodified lines
447447 if (!chip->lines)
448448 return -ENOMEM;
449449
450+ for (i = 0; i < gc->ngpio; i++)
451+ chip->lines[i].dir = GPIO_LINE_DIRECTION_IN;
452+
450453 if (device_property_read_bool(dev, "named-gpio-lines")) {
451454 rv = gpio_mockup_name_lines(dev, chip);
452455 if (rv)
drivers/gpio/gpio-mpc8xxx.c+1−0
@@ -346,6 +346,7 @@ static int mpc8xxx_probe(struct platform_device *pdev) · 345 unmodified lines
346346 return -ENOMEM;
347347
348348 gc = &mpc8xxx_gc->gc;
349+ gc->parent = &pdev->dev;
349350
350351 if (of_property_read_bool(np, "little-endian")) {
351352 ret = bgpio_init(gc, &pdev->dev, 4,
drivers/gpio/gpio-pca953x.c+10−16
@@ -568,16 +568,18 @@ static void pca953x_irq_mask(struct irq_data *d) · 567 unmodified lines
568568 {
569569 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
570570 struct pca953x_chip *chip = gpiochip_get_data(gc);
571+ irq_hw_number_t hwirq = irqd_to_hwirq(d);
571572
572− chip->irq_mask[d->hwirq / BANK_SZ] &= ~BIT(d->hwirq % BANK_SZ);
573+ clear_bit(hwirq, chip->irq_mask);
573574 }
574575
575576 static void pca953x_irq_unmask(struct irq_data *d)
576577 {
577578 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
578579 struct pca953x_chip *chip = gpiochip_get_data(gc);
580+ irq_hw_number_t hwirq = irqd_to_hwirq(d);
579581
580− chip->irq_mask[d->hwirq / BANK_SZ] |= BIT(d->hwirq % BANK_SZ);
582+ set_bit(hwirq, chip->irq_mask);
581583 }
582584
583585 static int pca953x_irq_set_wake(struct irq_data *d, unsigned int on)
@@ -635,8 +637,7 @@ static int pca953x_irq_set_type(struct irq_data *d, unsigned int type) · 51 unmodified lines
635637 {
636638 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
637639 struct pca953x_chip *chip = gpiochip_get_data(gc);
638− int bank_nb = d->hwirq / BANK_SZ;
639− u8 mask = BIT(d->hwirq % BANK_SZ);
640+ irq_hw_number_t hwirq = irqd_to_hwirq(d);
640641
641642 if (!(type & IRQ_TYPE_EDGE_BOTH)) {
642643 dev_err(&chip->client->dev, "irq %d: unsupported type %d\n",
@@ -644,15 +645,8 @@ static int pca953x_irq_set_type(struct irq_data *d, unsigned int type) · 1 unmodified line
644645 return -EINVAL;
645646 }
646647
647− if (type & IRQ_TYPE_EDGE_FALLING)
648− chip->irq_trig_fall[bank_nb] |= mask;
649− else
650− chip->irq_trig_fall[bank_nb] &= ~mask;
651−
652− if (type & IRQ_TYPE_EDGE_RISING)
653− chip->irq_trig_raise[bank_nb] |= mask;
654− else
655− chip->irq_trig_raise[bank_nb] &= ~mask;
648+ assign_bit(hwirq, chip->irq_trig_fall, type & IRQ_TYPE_EDGE_FALLING);
649+ assign_bit(hwirq, chip->irq_trig_raise, type & IRQ_TYPE_EDGE_RISING);
656650
657651 return 0;
658652 }
@@ -661,10 +655,10 @@ static void pca953x_irq_shutdown(struct irq_data *d) · 2 unmodified lines
661655 {
662656 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
663657 struct pca953x_chip *chip = gpiochip_get_data(gc);
664− u8 mask = BIT(d->hwirq % BANK_SZ);
658+ irq_hw_number_t hwirq = irqd_to_hwirq(d);
665659
666− chip->irq_trig_raise[d->hwirq / BANK_SZ] &= ~mask;
667− chip->irq_trig_fall[d->hwirq / BANK_SZ] &= ~mask;
660+ clear_bit(hwirq, chip->irq_trig_raise);
661+ clear_bit(hwirq, chip->irq_trig_fall);
668662 }
669663
670664 static bool pca953x_irq_pending(struct pca953x_chip *chip, unsigned long *pending)
drivers/gpio/gpio-xgs-iproc.c+1−1
@@ -280,7 +280,7 @@ static int iproc_gpio_probe(struct platform_device *pdev) · 279 unmodified lines
280280 return 0;
281281 }
282282
283−static int __exit iproc_gpio_remove(struct platform_device *pdev)
283+static int iproc_gpio_remove(struct platform_device *pdev)
284284 {
285285 struct iproc_gpio_chip *chip;
286286
drivers/gpio/gpio-xtensa.c+3−4
@@ -44,15 +44,14 @@ static inline unsigned long enable_cp(unsigned long *cpenable) · 43 unmodified lines
4444 unsigned long flags;
4545
4646 local_irq_save(flags);
47− RSR_CPENABLE(*cpenable);
48− WSR_CPENABLE(*cpenable | BIT(XCHAL_CP_ID_XTIOP));
49−
47+ *cpenable = xtensa_get_sr(cpenable);
48+ xtensa_set_sr(*cpenable | BIT(XCHAL_CP_ID_XTIOP), cpenable);
5049 return flags;
5150 }
5251
5352 static inline void disable_cp(unsigned long flags, unsigned long cpenable)
5453 {
55− WSR_CPENABLE(cpenable);
54+ xtensa_set_sr(cpenable, cpenable);
5655 local_irq_restore(flags);
5756 }
5857
drivers/gpio/gpio-zynq.c+5−3
@@ -684,6 +684,8 @@ static void zynq_gpio_restore_context(struct zynq_gpio *gpio) · 683 unmodified lines
684684 unsigned int bank_num;
685685
686686 for (bank_num = 0; bank_num < gpio->p_data->max_bank; bank_num++) {
687+ writel_relaxed(ZYNQ_GPIO_IXR_DISABLE_ALL, gpio->base_addr +
688+ ZYNQ_GPIO_INTDIS_OFFSET(bank_num));
687689 writel_relaxed(gpio->context.datalsw[bank_num],
688690 gpio->base_addr +
689691 ZYNQ_GPIO_DATA_LSW_OFFSET(bank_num));
@@ -693,9 +695,6 @@ static void zynq_gpio_restore_context(struct zynq_gpio *gpio) · 3 unmodified lines
693695 writel_relaxed(gpio->context.dirm[bank_num],
694696 gpio->base_addr +
695697 ZYNQ_GPIO_DIRM_OFFSET(bank_num));
696− writel_relaxed(gpio->context.int_en[bank_num],
697− gpio->base_addr +
698− ZYNQ_GPIO_INTEN_OFFSET(bank_num));
699698 writel_relaxed(gpio->context.int_type[bank_num],
700699 gpio->base_addr +
701700 ZYNQ_GPIO_INTTYPE_OFFSET(bank_num));
@@ -705,6 +704,9 @@ static void zynq_gpio_restore_context(struct zynq_gpio *gpio) · 3 unmodified lines
705704 writel_relaxed(gpio->context.int_any[bank_num],
706705 gpio->base_addr +
707706 ZYNQ_GPIO_INTANY_OFFSET(bank_num));
707+ writel_relaxed(~(gpio->context.int_en[bank_num]),
708+ gpio->base_addr +
709+ ZYNQ_GPIO_INTEN_OFFSET(bank_num));
708710 }
709711 }
710712
drivers/gpio/gpiolib-acpi.c+46−5
@@ -21,11 +21,19 @@ · 20 unmodified lines
2121 #include "gpiolib.h"
2222 #include "gpiolib-acpi.h"
2323
24+#define QUIRK_NO_EDGE_EVENTS_ON_BOOT 0x01l
25+#define QUIRK_NO_WAKEUP 0x02l
26+
2427 static int run_edge_events_on_boot = -1;
2528 module_param(run_edge_events_on_boot, int, 0444);
2629 MODULE_PARM_DESC(run_edge_events_on_boot,
2730 "Run edge _AEI event-handlers at boot: 0=no, 1=yes, -1=auto");
2831
32+static int honor_wakeup = -1;
33+module_param(honor_wakeup, int, 0444);
34+MODULE_PARM_DESC(honor_wakeup,
35+ "Honor the ACPI wake-capable flag: 0=no, 1=yes, -1=auto");
36+
2937 /**
3038 * struct acpi_gpio_event - ACPI GPIO event handler data
3139 *
@@ -281,7 +289,7 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares, · 249 unmodified lines
281289 event->handle = evt_handle;
282290 event->handler = handler;
283291 event->irq = irq;
284− event->irq_is_wake = agpio->wake_capable == ACPI_WAKE_CAPABLE;
292+ event->irq_is_wake = honor_wakeup && agpio->wake_capable == ACPI_WAKE_CAPABLE;
285293 event->pin = pin;
286294 event->desc = desc;
287295
@@ -1309,7 +1317,7 @@ static int acpi_gpio_handle_deferred_request_irqs(void) · 1021 unmodified lines
13091317 /* We must use _sync so that this runs after the first deferred_probe run */
13101318 late_initcall_sync(acpi_gpio_handle_deferred_request_irqs);
13111319
1312−static const struct dmi_system_id run_edge_events_on_boot_blacklist[] = {
1320+static const struct dmi_system_id gpiolib_acpi_quirks[] = {
13131321 {
13141322 /*
13151323 * The Minix Neo Z83-4 has a micro-USB-B id-pin handler for
@@ -1319,7 +1327,8 @@ static const struct dmi_system_id run_edge_events_on_boot_blacklist[] = { · 3 unmodified lines
13191327 .matches = {
13201328 DMI_MATCH(DMI_SYS_VENDOR, "MINIX"),
13211329 DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"),
1322− }
1330+ },
1331+ .driver_data = (void *)QUIRK_NO_EDGE_EVENTS_ON_BOOT,
13231332 },
13241333 {
13251334 /*
@@ -1331,20 +1340,52 @@ static const struct dmi_system_id run_edge_events_on_boot_blacklist[] = { · 5 unmodified lines
13311340 .matches = {
13321341 DMI_MATCH(DMI_SYS_VENDOR, "Wortmann_AG"),
13331342 DMI_MATCH(DMI_PRODUCT_NAME, "TERRA_PAD_1061"),
1334− }
1343+ },
1344+ .driver_data = (void *)QUIRK_NO_EDGE_EVENTS_ON_BOOT,
1345+ },
1346+ {
1347+ /*
1348+ * Various HP X2 10 Cherry Trail models use an external
1349+ * embedded-controller connected via I2C + an ACPI GPIO
1350+ * event handler. The embedded controller generates various
1351+ * spurious wakeup events when suspended. So disable wakeup
1352+ * for its handler (it uses the only ACPI GPIO event handler).
1353+ * This breaks wakeup when opening the lid, the user needs
1354+ * to press the power-button to wakeup the system. The
1355+ * alternative is suspend simply not working, which is worse.
1356+ */
1357+ .matches = {
1358+ DMI_MATCH(DMI_SYS_VENDOR, "HP"),
1359+ DMI_MATCH(DMI_PRODUCT_NAME, "HP x2 Detachable 10-p0XX"),
1360+ },
1361+ .driver_data = (void *)QUIRK_NO_WAKEUP,
13351362 },
13361363 {} /* Terminating entry */
13371364 };
13381365
13391366 static int acpi_gpio_setup_params(void)
13401367 {
1368+ const struct dmi_system_id *id;
1369+ long quirks = 0;
1370+
1371+ id = dmi_first_match(gpiolib_acpi_quirks);
1372+ if (id)
1373+ quirks = (long)id->driver_data;
1374+
13411375 if (run_edge_events_on_boot < 0) {
1342− if (dmi_check_system(run_edge_events_on_boot_blacklist))
1376+ if (quirks & QUIRK_NO_EDGE_EVENTS_ON_BOOT)
13431377 run_edge_events_on_boot = 0;
13441378 else
13451379 run_edge_events_on_boot = 1;
13461380 }
13471381
1382+ if (honor_wakeup < 0) {
1383+ if (quirks & QUIRK_NO_WAKEUP)
1384+ honor_wakeup = 0;
1385+ else
1386+ honor_wakeup = 1;
1387+ }
1388+
13481389 return 0;
13491390 }
13501391
drivers/gpio/gpiolib.c+11−2
@@ -220,6 +220,14 @@ int gpiod_get_direction(struct gpio_desc *desc) · 219 unmodified lines
220220 chip = gpiod_to_chip(desc);
221221 offset = gpio_chip_hwgpio(desc);
222222
223+ /*
224+ * Open drain emulation using input mode may incorrectly report
225+ * input here, fix that up.
226+ */
227+ if (test_bit(FLAG_OPEN_DRAIN, &desc->flags) &&
228+ test_bit(FLAG_IS_OUT, &desc->flags))
229+ return 0;
230+
223231 if (!chip->get_direction)
224232 return -ENOTSUPP;
225233
@@ -4472,8 +4480,9 @@ static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, · 4246 unmodified lines
44724480
44734481 if (chip->ngpio <= p->chip_hwnum) {
44744482 dev_err(dev,
4475− "requested GPIO %d is out of range [0..%d] for chip %s\n",
4476− idx, chip->ngpio, chip->label);
4483+ "requested GPIO %u (%u) is out of range [0..%u] for chip %s\n",
4484+ idx, p->chip_hwnum, chip->ngpio - 1,
4485+ chip->label);
44774486 return ERR_PTR(-EINVAL);
44784487 }
44794488
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c+11−1
@@ -613,7 +613,17 @@ static bool amdgpu_atpx_detect(void) · 612 unmodified lines
613613 bool d3_supported = false;
614614 struct pci_dev *parent_pdev;
615615
616− while ((pdev = pci_get_class(PCI_BASE_CLASS_DISPLAY << 16, pdev)) != NULL) {
616+ while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
617+ vga_count++;
618+
619+ has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true);
620+
621+ parent_pdev = pci_upstream_bridge(pdev);
622+ d3_supported |= parent_pdev && parent_pdev->bridge_d3;
623+ amdgpu_atpx_get_quirks(pdev);
624+ }
625+
626+ while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
617627 vga_count++;
618628
619629 has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true);
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+4−3
@@ -142,7 +142,7 @@ int amdgpu_async_gfx_ring = 1; · 141 unmodified lines
142142 int amdgpu_mcbp = 0;
143143 int amdgpu_discovery = -1;
144144 int amdgpu_mes = 0;
145−int amdgpu_noretry = 1;
145+int amdgpu_noretry;
146146 int amdgpu_force_asic_type = -1;
147147
148148 struct amdgpu_mgpu_info mgpu_info = {
@@ -588,7 +588,7 @@ MODULE_PARM_DESC(mes, · 439 unmodified lines
588588 module_param_named(mes, amdgpu_mes, int, 0444);
589589
590590 MODULE_PARM_DESC(noretry,
591− "Disable retry faults (0 = retry enabled, 1 = retry disabled (default))");
591+ "Disable retry faults (0 = retry enabled (default), 1 = retry disabled)");
592592 module_param_named(noretry, amdgpu_noretry, int, 0644);
593593
594594 /**
@@ -1359,7 +1359,8 @@ static struct drm_driver kms_driver = { · 764 unmodified lines
13591359 .driver_features =
13601360 DRIVER_USE_AGP | DRIVER_ATOMIC |
13611361 DRIVER_GEM |
1362− DRIVER_RENDER | DRIVER_MODESET | DRIVER_SYNCOBJ,
1362+ DRIVER_RENDER | DRIVER_MODESET | DRIVER_SYNCOBJ |
1363+ DRIVER_SYNCOBJ_TIMELINE,
13631364 .load = amdgpu_driver_load_kms,
13641365 .open = amdgpu_driver_open_kms,
13651366 .postclose = amdgpu_driver_postclose_kms,
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c+1−1
@@ -1488,7 +1488,7 @@ out: · 1487 unmodified lines
14881488
14891489 /* Start rlc autoload after psp recieved all the gfx firmware */
14901490 if (psp->autoload_supported && ucode->ucode_id == (amdgpu_sriov_vf(adev) ?
1491− AMDGPU_UCODE_ID_CP_MEC2 : AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM)) {
1491+ AMDGPU_UCODE_ID_CP_MEC2 : AMDGPU_UCODE_ID_RLC_G)) {
14921492 ret = psp_rlc_autoload(psp);
14931493 if (ret) {
14941494 DRM_ERROR("Failed to start rlc autoload\n");
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h+1−1
@@ -292,10 +292,10 @@ enum AMDGPU_UCODE_ID { · 291 unmodified lines
292292 AMDGPU_UCODE_ID_CP_MEC2_JT,
293293 AMDGPU_UCODE_ID_CP_MES,
294294 AMDGPU_UCODE_ID_CP_MES_DATA,
295− AMDGPU_UCODE_ID_RLC_G,
296295 AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL,
297296 AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM,
298297 AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM,
298+ AMDGPU_UCODE_ID_RLC_G,
299299 AMDGPU_UCODE_ID_STORAGE,
300300 AMDGPU_UCODE_ID_SMC,
301301 AMDGPU_UCODE_ID_UVD,
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c+4−11
@@ -1052,17 +1052,10 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev) · 1051 unmodified lines
10521052 case CHIP_VEGA20:
10531053 break;
10541054 case CHIP_RAVEN:
1055− /* Disable GFXOFF on original raven. There are combinations
1056− * of sbios and platforms that are not stable.
1057− */
1058− if (!(adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8))
1059− adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
1060− else if (!(adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8)
1061− &&((adev->gfx.rlc_fw_version != 106 &&
1062− adev->gfx.rlc_fw_version < 531) ||
1063− (adev->gfx.rlc_fw_version == 53815) ||
1064− (adev->gfx.rlc_feature_version < 1) ||
1065− !adev->gfx.rlc.is_rlc_v2_1))
1055+ if (!(adev->rev_id >= 0x8 ||
1056+ adev->pdev->device == 0x15d8) &&
1057+ (adev->pm.fw_version < 0x41e2b || /* not raven1 fresh */
1058+ !adev->gfx.rlc.is_rlc_v2_1)) /* without rlc save restore ucodes */
10661059 adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
10671060
10681061 if (adev->pm.pp_feature & PP_GFXOFF_MASK)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+23−22
@@ -3356,27 +3356,21 @@ get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing) · 3355 unmodified lines
33563356 return color_space;
33573357 }
33583358
3359−static void reduce_mode_colour_depth(struct dc_crtc_timing *timing_out)
3360−{
3361− if (timing_out->display_color_depth <= COLOR_DEPTH_888)
3362− return;
3363−
3364− timing_out->display_color_depth--;
3365−}
3366−
3367−static void adjust_colour_depth_from_display_info(struct dc_crtc_timing *timing_out,
3368− const struct drm_display_info *info)
3359+static bool adjust_colour_depth_from_display_info(
3360+ struct dc_crtc_timing *timing_out,
3361+ const struct drm_display_info *info)
33693362 {
3363+ enum dc_color_depth depth = timing_out->display_color_depth;
33703364 int normalized_clk;
3371− if (timing_out->display_color_depth <= COLOR_DEPTH_888)
3372− return;
33733365 do {
33743366 normalized_clk = timing_out->pix_clk_100hz / 10;
33753367 /* YCbCr 4:2:0 requires additional adjustment of 1/2 */
33763368 if (timing_out->pixel_encoding == PIXEL_ENCODING_YCBCR420)
33773369 normalized_clk /= 2;
33783370 /* Adjusting pix clock following on HDMI spec based on colour depth */
3379− switch (timing_out->display_color_depth) {
3371+ switch (depth) {
3372+ case COLOR_DEPTH_888:
3373+ break;
33803374 case COLOR_DEPTH_101010:
33813375 normalized_clk = (normalized_clk * 30) / 24;
33823376 break;
@@ -3387,14 +3381,15 @@ static void adjust_colour_depth_from_display_info(struct dc_crtc_timing *timing_ · 4 unmodified lines
33873381 normalized_clk = (normalized_clk * 48) / 24;
33883382 break;
33893383 default:
3390− return;
3384+ /* The above depths are the only ones valid for HDMI. */
3385+ return false;
33913386 }
3392− if (normalized_clk <= info->max_tmds_clock)
3393− return;
3394− reduce_mode_colour_depth(timing_out);
3395−
3396− } while (timing_out->display_color_depth > COLOR_DEPTH_888);
3397−
3387+ if (normalized_clk <= info->max_tmds_clock) {
3388+ timing_out->display_color_depth = depth;
3389+ return true;
3390+ }
3391+ } while (--depth > COLOR_DEPTH_666);
3392+ return false;
33983393 }
33993394
34003395 static void fill_stream_properties_from_drm_display_mode(
@@ -3474,8 +3469,14 @@ static void fill_stream_properties_from_drm_display_mode( · 73 unmodified lines
34743469
34753470 stream->out_transfer_func->type = TF_TYPE_PREDEFINED;
34763471 stream->out_transfer_func->tf = TRANSFER_FUNCTION_SRGB;
3477− if (stream->signal == SIGNAL_TYPE_HDMI_TYPE_A)
3478− adjust_colour_depth_from_display_info(timing_out, info);
3472+ if (stream->signal == SIGNAL_TYPE_HDMI_TYPE_A) {
3473+ if (!adjust_colour_depth_from_display_info(timing_out, info) &&
3474+ drm_mode_is_420_also(info, mode_in) &&
3475+ timing_out->pixel_encoding != PIXEL_ENCODING_YCBCR420) {
3476+ timing_out->pixel_encoding = PIXEL_ENCODING_YCBCR420;
3477+ adjust_colour_depth_from_display_info(timing_out, info);
3478+ }
3479+ }
34793480 }
34803481
34813482 static void fill_audio_info(struct audio_info *audio_info,
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c+1−0
@@ -866,6 +866,7 @@ static int smu_sw_init(void *handle) · 865 unmodified lines
866866 smu->smu_baco.platform_support = false;
867867
868868 mutex_init(&smu->sensor_lock);
869+ mutex_init(&smu->metrics_lock);
869870
870871 smu->watermarks_bitmap = 0;
871872 smu->power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c+3−0
@@ -862,18 +862,21 @@ static int arcturus_get_metrics_table(struct smu_context *smu, · 861 unmodified lines
862862 struct smu_table_context *smu_table= &smu->smu_table;
863863 int ret = 0;
864864
865+ mutex_lock(&smu->metrics_lock);
865866 if (!smu_table->metrics_time ||
866867 time_after(jiffies, smu_table->metrics_time + HZ / 1000)) {
867868 ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, 0,
868869 (void *)smu_table->metrics_table, false);
869870 if (ret) {
870871 pr_info("Failed to export SMU metrics table!\n");
872+ mutex_unlock(&smu->metrics_lock);
871873 return ret;
872874 }
873875 smu_table->metrics_time = jiffies;
874876 }
875877
876878 memcpy(metrics_table, smu_table->metrics_table, sizeof(SmuMetrics_t));
879+ mutex_unlock(&smu->metrics_lock);
877880
878881 return ret;
879882 }
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h+1−0
@@ -349,6 +349,7 @@ struct smu_context · 348 unmodified lines
349349 const struct pptable_funcs *ppt_funcs;
350350 struct mutex mutex;
351351 struct mutex sensor_lock;
352+ struct mutex metrics_lock;
352353 uint64_t pool_size;
353354
354355 struct smu_table_context smu_table;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c+3−0
@@ -562,17 +562,20 @@ static int navi10_get_metrics_table(struct smu_context *smu, · 561 unmodified lines
562562 struct smu_table_context *smu_table= &smu->smu_table;
563563 int ret = 0;
564564
565+ mutex_lock(&smu->metrics_lock);
565566 if (!smu_table->metrics_time || time_after(jiffies, smu_table->metrics_time + msecs_to_jiffies(100))) {
566567 ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, 0,
567568 (void *)smu_table->metrics_table, false);
568569 if (ret) {
569570 pr_info("Failed to export SMU metrics table!\n");
571+ mutex_unlock(&smu->metrics_lock);
570572 return ret;
571573 }
572574 smu_table->metrics_time = jiffies;
573575 }
574576
575577 memcpy(metrics_table, smu_table->metrics_table, sizeof(SmuMetrics_t));
578+ mutex_unlock(&smu->metrics_lock);
576579
577580 return ret;
578581 }
drivers/gpu/drm/amd/powerplay/vega20_ppt.c+3−0
@@ -1678,17 +1678,20 @@ static int vega20_get_metrics_table(struct smu_context *smu, · 1677 unmodified lines
16781678 struct smu_table_context *smu_table= &smu->smu_table;
16791679 int ret = 0;
16801680
1681+ mutex_lock(&smu->metrics_lock);
16811682 if (!smu_table->metrics_time || time_after(jiffies, smu_table->metrics_time + HZ / 1000)) {
16821683 ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, 0,
16831684 (void *)smu_table->metrics_table, false);
16841685 if (ret) {
16851686 pr_info("Failed to export SMU metrics table!\n");
1687+ mutex_unlock(&smu->metrics_lock);
16861688 return ret;
16871689 }
16881690 smu_table->metrics_time = jiffies;
16891691 }
16901692
16911693 memcpy(metrics_table, smu_table->metrics_table, sizeof(SmuMetrics_t));
1694+ mutex_unlock(&smu->metrics_lock);
16921695
16931696 return ret;
16941697 }
drivers/gpu/drm/arm/malidp_mw.c+1−1
@@ -56,7 +56,7 @@ malidp_mw_connector_mode_valid(struct drm_connector *connector, · 55 unmodified lines
5656 return MODE_OK;
5757 }
5858
59−const struct drm_connector_helper_funcs malidp_mw_connector_helper_funcs = {
59+static const struct drm_connector_helper_funcs malidp_mw_connector_helper_funcs = {
6060 .get_modes = malidp_mw_connector_get_modes,
6161 .mode_valid = malidp_mw_connector_mode_valid,
6262 };
drivers/gpu/drm/drm_dp_mst_topology.c+1−1
@@ -393,7 +393,7 @@ drm_dp_encode_sideband_req(const struct drm_dp_sideband_msg_req_body *req, · 392 unmodified lines
393393 memcpy(&buf[idx], req->u.i2c_read.transactions[i].bytes, req->u.i2c_read.transactions[i].num_bytes);
394394 idx += req->u.i2c_read.transactions[i].num_bytes;
395395
396− buf[idx] = (req->u.i2c_read.transactions[i].no_stop_bit & 0x1) << 5;
396+ buf[idx] = (req->u.i2c_read.transactions[i].no_stop_bit & 0x1) << 4;
397397 buf[idx] |= (req->u.i2c_read.transactions[i].i2c_transaction_delay & 0xf);
398398 idx++;
399399 }
drivers/gpu/drm/drm_fb_helper.c+6−1
@@ -1283,7 +1283,7 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, · 1282 unmodified lines
12831283 * Changes struct fb_var_screeninfo are currently not pushed back
12841284 * to KMS, hence fail if different settings are requested.
12851285 */
1286− if (var->bits_per_pixel != fb->format->cpp[0] * 8 ||
1286+ if (var->bits_per_pixel > fb->format->cpp[0] * 8 ||
12871287 var->xres > fb->width || var->yres > fb->height ||
12881288 var->xres_virtual > fb->width || var->yres_virtual > fb->height) {
12891289 DRM_DEBUG("fb requested width/height/bpp can't fit in current fb "
@@ -1308,6 +1308,11 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, · 18 unmodified lines
13081308 drm_fb_helper_fill_pixel_fmt(var, fb->format->depth);
13091309 }
13101310
1311+ /*
1312+ * Likewise, bits_per_pixel should be rounded up to a supported value.
1313+ */
1314+ var->bits_per_pixel = fb->format->cpp[0] * 8;
1315+
13111316 /*
13121317 * drm fbdev emulation doesn't support changing the pixel format at all,
13131318 * so reject all pixel format changing requests.
drivers/gpu/drm/i915/display/intel_audio.c+2−2
@@ -856,7 +856,7 @@ static unsigned long i915_audio_component_get_power(struct device *kdev) · 855 unmodified lines
856856 }
857857
858858 /* Force CDCLK to 2*BCLK as long as we need audio powered. */
859− if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
859+ if (IS_GEMINILAKE(dev_priv))
860860 glk_force_audio_cdclk(dev_priv, true);
861861
862862 if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
@@ -875,7 +875,7 @@ static void i915_audio_component_put_power(struct device *kdev, · 12 unmodified lines
875875
876876 /* Stop forcing CDCLK to 2*BCLK if no need for audio to be powered. */
877877 if (--dev_priv->audio_power_refcount == 0)
878− if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
878+ if (IS_GEMINILAKE(dev_priv))
879879 glk_force_audio_cdclk(dev_priv, false);
880880
881881 intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO, cookie);
drivers/gpu/drm/i915/display/intel_display.c+2−7
@@ -4515,8 +4515,6 @@ static void icl_disable_transcoder_port_sync(const struct intel_crtc_state *old_ · 4514 unmodified lines
45154515 {
45164516 struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->base.crtc);
45174517 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
4518− i915_reg_t reg;
4519− u32 trans_ddi_func_ctl2_val;
45204518
45214519 if (old_crtc_state->master_transcoder == INVALID_TRANSCODER)
45224520 return;
@@ -4524,10 +4522,7 @@ static void icl_disable_transcoder_port_sync(const struct intel_crtc_state *old_ · 1 unmodified line
45244522 DRM_DEBUG_KMS("Disabling Transcoder Port Sync on Slave Transcoder %s\n",
45254523 transcoder_name(old_crtc_state->cpu_transcoder));
45264524
4527− reg = TRANS_DDI_FUNC_CTL2(old_crtc_state->cpu_transcoder);
4528− trans_ddi_func_ctl2_val = ~(PORT_SYNC_MODE_ENABLE |
4529− PORT_SYNC_MODE_MASTER_SELECT_MASK);
4530− I915_WRITE(reg, trans_ddi_func_ctl2_val);
4525+ I915_WRITE(TRANS_DDI_FUNC_CTL2(old_crtc_state->cpu_transcoder), 0);
45314526 }
45324527
45334528 static void intel_fdi_normal_train(struct intel_crtc *crtc)
@@ -15112,7 +15107,7 @@ intel_prepare_plane_fb(struct drm_plane *plane, · 10578 unmodified lines
1511215107 return ret;
1511315108
1511415109 fb_obj_bump_render_priority(obj);
15115− intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_DIRTYFB);
15110+ i915_gem_object_flush_frontbuffer(obj, ORIGIN_DIRTYFB);
1511615111
1511715112 if (!new_plane_state->base.fence) { /* implicit fencing */
1511815113 struct dma_fence *fence;
drivers/gpu/drm/i915/display/intel_frontbuffer.c+6−10
@@ -229,11 +229,11 @@ static void frontbuffer_release(struct kref *ref) · 228 unmodified lines
229229 vma->display_alignment = I915_GTT_MIN_ALIGNMENT;
230230 spin_unlock(&obj->vma.lock);
231231
232− obj->frontbuffer = NULL;
232+ RCU_INIT_POINTER(obj->frontbuffer, NULL);
233233 spin_unlock(&to_i915(obj->base.dev)->fb_tracking.lock);
234234
235235 i915_gem_object_put(obj);
236− kfree(front);
236+ kfree_rcu(front, rcu);
237237 }
238238
239239 struct intel_frontbuffer *
@@ -242,11 +242,7 @@ intel_frontbuffer_get(struct drm_i915_gem_object *obj) · 2 unmodified lines
242242 struct drm_i915_private *i915 = to_i915(obj->base.dev);
243243 struct intel_frontbuffer *front;
244244
245− spin_lock(&i915->fb_tracking.lock);
246− front = obj->frontbuffer;
247− if (front)
248− kref_get(&front->ref);
249− spin_unlock(&i915->fb_tracking.lock);
245+ front = __intel_frontbuffer_get(obj);
250246 if (front)
251247 return front;
252248
@@ -262,13 +258,13 @@ intel_frontbuffer_get(struct drm_i915_gem_object *obj) · 9 unmodified lines
262258 i915_active_may_sleep(frontbuffer_retire));
263259
264260 spin_lock(&i915->fb_tracking.lock);
265− if (obj->frontbuffer) {
261+ if (rcu_access_pointer(obj->frontbuffer)) {
266262 kfree(front);
267− front = obj->frontbuffer;
263+ front = rcu_dereference_protected(obj->frontbuffer, true);
268264 kref_get(&front->ref);
269265 } else {
270266 i915_gem_object_get(obj);
271− obj->frontbuffer = front;
267+ rcu_assign_pointer(obj->frontbuffer, front);
272268 }
273269 spin_unlock(&i915->fb_tracking.lock);
274270
drivers/gpu/drm/i915/display/intel_frontbuffer.h+31−3
@@ -27,10 +27,10 @@ · 26 unmodified lines
2727 #include <linux/atomic.h>
2828 #include <linux/kref.h>
2929
30+#include "gem/i915_gem_object_types.h"
3031 #include "i915_active.h"
3132
3233 struct drm_i915_private;
33−struct drm_i915_gem_object;
3434
3535 enum fb_op_origin {
3636 ORIGIN_GTT,
@@ -45,6 +45,7 @@ struct intel_frontbuffer { · 8 unmodified lines
4545 atomic_t bits;
4646 struct i915_active write;
4747 struct drm_i915_gem_object *obj;
48+ struct rcu_head rcu;
4849 };
4950
5051 void intel_frontbuffer_flip_prepare(struct drm_i915_private *i915,
@@ -54,6 +55,35 @@ void intel_frontbuffer_flip_complete(struct drm_i915_private *i915, · 3 unmodified lines
5455 void intel_frontbuffer_flip(struct drm_i915_private *i915,
5556 unsigned frontbuffer_bits);
5657
58+void intel_frontbuffer_put(struct intel_frontbuffer *front);
59+
60+static inline struct intel_frontbuffer *
61+__intel_frontbuffer_get(const struct drm_i915_gem_object *obj)
62+{
63+ struct intel_frontbuffer *front;
64+
65+ if (likely(!rcu_access_pointer(obj->frontbuffer)))
66+ return NULL;
67+
68+ rcu_read_lock();
69+ do {
70+ front = rcu_dereference(obj->frontbuffer);
71+ if (!front)
72+ break;
73+
74+ if (unlikely(!kref_get_unless_zero(&front->ref)))
75+ continue;
76+
77+ if (likely(front == rcu_access_pointer(obj->frontbuffer)))
78+ break;
79+
80+ intel_frontbuffer_put(front);
81+ } while (1);
82+ rcu_read_unlock();
83+
84+ return front;
85+}
86+
5787 struct intel_frontbuffer *
5888 intel_frontbuffer_get(struct drm_i915_gem_object *obj);
5989
@@ -119,6 +149,4 @@ void intel_frontbuffer_track(struct intel_frontbuffer *old, · 59 unmodified lines
119149 struct intel_frontbuffer *new,
120150 unsigned int frontbuffer_bits);
121151
122−void intel_frontbuffer_put(struct intel_frontbuffer *front);
123−
124152 #endif /* __INTEL_FRONTBUFFER_H__ */
drivers/gpu/drm/i915/display/intel_overlay.c+13−4
@@ -279,12 +279,21 @@ static void intel_overlay_flip_prepare(struct intel_overlay *overlay, · 278 unmodified lines
279279 struct i915_vma *vma)
280280 {
281281 enum pipe pipe = overlay->crtc->pipe;
282+ struct intel_frontbuffer *from = NULL, *to = NULL;
282283
283284 WARN_ON(overlay->old_vma);
284285
285− intel_frontbuffer_track(overlay->vma ? overlay->vma->obj->frontbuffer : NULL,
286− vma ? vma->obj->frontbuffer : NULL,
287− INTEL_FRONTBUFFER_OVERLAY(pipe));
286+ if (overlay->vma)
287+ from = intel_frontbuffer_get(overlay->vma->obj);
288+ if (vma)
289+ to = intel_frontbuffer_get(vma->obj);
290+
291+ intel_frontbuffer_track(from, to, INTEL_FRONTBUFFER_OVERLAY(pipe));
292+
293+ if (to)
294+ intel_frontbuffer_put(to);
295+ if (from)
296+ intel_frontbuffer_put(from);
288297
289298 intel_frontbuffer_flip_prepare(overlay->i915,
290299 INTEL_FRONTBUFFER_OVERLAY(pipe));
@@ -766,7 +775,7 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay, · 475 unmodified lines
766775 ret = PTR_ERR(vma);
767776 goto out_pin_section;
768777 }
769− intel_frontbuffer_flush(new_bo->frontbuffer, ORIGIN_DIRTYFB);
778+ i915_gem_object_flush_frontbuffer(new_bo, ORIGIN_DIRTYFB);
770779
771780 if (!overlay->active) {
772781 u32 oconfig;
drivers/gpu/drm/i915/gem/i915_gem_clflush.c+2−1
@@ -20,7 +20,8 @@ static void __do_clflush(struct drm_i915_gem_object *obj) · 19 unmodified lines
2020 {
2121 GEM_BUG_ON(!i915_gem_object_has_pages(obj));
2222 drm_clflush_sg(obj->mm.pages);
23− intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_CPU);
23+
24+ i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU);
2425 }
2526
2627 static int clflush_work(struct dma_fence_work *base)
drivers/gpu/drm/i915/gem/i915_gem_domain.c+2−2
@@ -664,7 +664,7 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, · 663 unmodified lines
664664 i915_gem_object_unlock(obj);
665665
666666 if (write_domain)
667− intel_frontbuffer_invalidate(obj->frontbuffer, ORIGIN_CPU);
667+ i915_gem_object_invalidate_frontbuffer(obj, ORIGIN_CPU);
668668
669669 out_unpin:
670670 i915_gem_object_unpin_pages(obj);
@@ -784,7 +784,7 @@ int i915_gem_object_prepare_write(struct drm_i915_gem_object *obj, · 113 unmodified lines
784784 }
785785
786786 out:
787− intel_frontbuffer_invalidate(obj->frontbuffer, ORIGIN_CPU);
787+ i915_gem_object_invalidate_frontbuffer(obj, ORIGIN_CPU);
788788 obj->mm.dirty = true;
789789 /* return with the pages pinned */
790790 return 0;
drivers/gpu/drm/i915/gem/i915_gem_object.c+25−1
@@ -280,7 +280,7 @@ i915_gem_object_flush_write_domain(struct drm_i915_gem_object *obj, · 279 unmodified lines
280280 for_each_ggtt_vma(vma, obj)
281281 intel_gt_flush_ggtt_writes(vma->vm->gt);
282282
283− intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_CPU);
283+ i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU);
284284
285285 for_each_ggtt_vma(vma, obj) {
286286 if (vma->iomap)
@@ -308,6 +308,30 @@ i915_gem_object_flush_write_domain(struct drm_i915_gem_object *obj, · 21 unmodified lines
308308 obj->write_domain = 0;
309309 }
310310
311+void __i915_gem_object_flush_frontbuffer(struct drm_i915_gem_object *obj,
312+ enum fb_op_origin origin)
313+{
314+ struct intel_frontbuffer *front;
315+
316+ front = __intel_frontbuffer_get(obj);
317+ if (front) {
318+ intel_frontbuffer_flush(front, origin);
319+ intel_frontbuffer_put(front);
320+ }
321+}
322+
323+void __i915_gem_object_invalidate_frontbuffer(struct drm_i915_gem_object *obj,
324+ enum fb_op_origin origin)
325+{
326+ struct intel_frontbuffer *front;
327+
328+ front = __intel_frontbuffer_get(obj);
329+ if (front) {
330+ intel_frontbuffer_invalidate(front, origin);
331+ intel_frontbuffer_put(front);
332+ }
333+}
334+
311335 void i915_gem_init__objects(struct drm_i915_private *i915)
312336 {
313337 INIT_WORK(&i915->mm.free_work, __i915_gem_free_work);
drivers/gpu/drm/i915/gem/i915_gem_object.h+22−1
@@ -13,8 +13,8 @@ · 12 unmodified lines
1313
1414 #include <drm/i915_drm.h>
1515
16+#include "display/intel_frontbuffer.h"
1617 #include "i915_gem_object_types.h"
17−
1818 #include "i915_gem_gtt.h"
1919
2020 void i915_gem_init__objects(struct drm_i915_private *i915);
@@ -463,4 +463,25 @@ int i915_gem_object_wait_priority(struct drm_i915_gem_object *obj, · 442 unmodified lines
463463 unsigned int flags,
464464 const struct i915_sched_attr *attr);
465465
466+void __i915_gem_object_flush_frontbuffer(struct drm_i915_gem_object *obj,
467+ enum fb_op_origin origin);
468+void __i915_gem_object_invalidate_frontbuffer(struct drm_i915_gem_object *obj,
469+ enum fb_op_origin origin);
470+
471+static inline void
472+i915_gem_object_flush_frontbuffer(struct drm_i915_gem_object *obj,
473+ enum fb_op_origin origin)
474+{
475+ if (unlikely(rcu_access_pointer(obj->frontbuffer)))
476+ __i915_gem_object_flush_frontbuffer(obj, origin);
477+}
478+
479+static inline void
480+i915_gem_object_invalidate_frontbuffer(struct drm_i915_gem_object *obj,
481+ enum fb_op_origin origin)
482+{
483+ if (unlikely(rcu_access_pointer(obj->frontbuffer)))
484+ __i915_gem_object_invalidate_frontbuffer(obj, origin);
485+}
486+
466487 #endif
drivers/gpu/drm/i915/gem/i915_gem_object_types.h+1−1
@@ -150,7 +150,7 @@ struct drm_i915_gem_object { · 149 unmodified lines
150150 */
151151 u16 write_domain;
152152
153− struct intel_frontbuffer *frontbuffer;
153+ struct intel_frontbuffer __rcu *frontbuffer;
154154
155155 /** Current tiling stride for the object, if it's tiled. */
156156 unsigned int tiling_and_stride;
drivers/gpu/drm/i915/gt/intel_gt_pm.c+2−1
@@ -94,8 +94,9 @@ static int __gt_park(struct intel_wakeref *wf) · 93 unmodified lines
9494 intel_uncore_forcewake_put(&i915->uncore, FORCEWAKE_ALL);
9595 }
9696
97+ /* Defer dropping the display power well for 100ms, it's slow! */
9798 GEM_BUG_ON(!wakeref);
98− intel_display_power_put(i915, POWER_DOMAIN_GT_IRQ, wakeref);
99+ intel_display_power_put_async(i915, POWER_DOMAIN_GT_IRQ, wakeref);
99100
100101 i915_globals_park();
101102
drivers/gpu/drm/i915/gt/intel_lrc.c+2−0
@@ -4416,9 +4416,11 @@ intel_execlists_create_virtual(struct i915_gem_context *ctx, · 4415 unmodified lines
44164416 ve->base.gt = siblings[0]->gt;
44174417 ve->base.uncore = siblings[0]->uncore;
44184418 ve->base.id = -1;
4419+
44194420 ve->base.class = OTHER_CLASS;
44204421 ve->base.uabi_class = I915_ENGINE_CLASS_INVALID;
44214422 ve->base.instance = I915_ENGINE_CLASS_INVALID_VIRTUAL;
4423+ ve->base.uabi_instance = I915_ENGINE_CLASS_INVALID_VIRTUAL;
44224424
44234425 /*
44244426 * The decision on whether to submit a request using semaphores
drivers/gpu/drm/i915/gt/intel_ring_submission.c+11−20
@@ -1413,14 +1413,6 @@ static inline int mi_set_context(struct i915_request *rq, u32 flags) · 1412 unmodified lines
14131413 int len;
14141414 u32 *cs;
14151415
1416− flags |= MI_MM_SPACE_GTT;
1417− if (IS_HASWELL(i915))
1418− /* These flags are for resource streamer on HSW+ */
1419− flags |= HSW_MI_RS_SAVE_STATE_EN | HSW_MI_RS_RESTORE_STATE_EN;
1420− else
1421− /* We need to save the extended state for powersaving modes */
1422− flags |= MI_SAVE_EXT_STATE_EN | MI_RESTORE_EXT_STATE_EN;
1423−
14241416 len = 4;
14251417 if (IS_GEN(i915, 7))
14261418 len += 2 + (num_engines ? 4 * num_engines + 6 : 0);
@@ -1589,22 +1581,21 @@ static int switch_context(struct i915_request *rq) · 162 unmodified lines
15891581 }
15901582
15911583 if (ce->state) {
1592− u32 hw_flags;
1584+ u32 flags;
15931585
15941586 GEM_BUG_ON(rq->engine->id != RCS0);
15951587
1596− /*
1597− * The kernel context(s) is treated as pure scratch and is not
1598− * expected to retain any state (as we sacrifice it during
1599− * suspend and on resume it may be corrupted). This is ok,
1600− * as nothing actually executes using the kernel context; it
1601− * is purely used for flushing user contexts.
1602− */
1603− hw_flags = 0;
1604− if (i915_gem_context_is_kernel(rq->gem_context))
1605− hw_flags = MI_RESTORE_INHIBIT;
1588+ /* For resource streamer on HSW+ and power context elsewhere */
1589+ BUILD_BUG_ON(HSW_MI_RS_SAVE_STATE_EN != MI_SAVE_EXT_STATE_EN);
1590+ BUILD_BUG_ON(HSW_MI_RS_RESTORE_STATE_EN != MI_RESTORE_EXT_STATE_EN);
1591+
1592+ flags = MI_SAVE_EXT_STATE_EN | MI_MM_SPACE_GTT;
1593+ if (!i915_gem_context_is_kernel(rq->gem_context))
1594+ flags |= MI_RESTORE_EXT_STATE_EN;
1595+ else
1596+ flags |= MI_RESTORE_INHIBIT;
16061597
1607− ret = mi_set_context(rq, hw_flags);
1598+ ret = mi_set_context(rq, flags);
16081599 if (ret)
16091600 return ret;
16101601 }
drivers/gpu/drm/i915/i915_drv.h+4−2
@@ -1660,8 +1660,10 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915, · 1659 unmodified lines
16601660 (IS_BROADWELL(dev_priv) || IS_GEN(dev_priv, 9))
16611661
16621662 /* WaRsDisableCoarsePowerGating:skl,cnl */
1663−#define NEEDS_WaRsDisableCoarsePowerGating(dev_priv) \
1664− (IS_CANNONLAKE(dev_priv) || IS_GEN(dev_priv, 9))
1663+#define NEEDS_WaRsDisableCoarsePowerGating(dev_priv) \
1664+ (IS_CANNONLAKE(dev_priv) || \
1665+ IS_SKL_GT3(dev_priv) || \
1666+ IS_SKL_GT4(dev_priv))
16651667
16661668 #define HAS_GMBUS_IRQ(dev_priv) (INTEL_GEN(dev_priv) >= 4)
16671669 #define HAS_GMBUS_BURST_READ(dev_priv) (INTEL_GEN(dev_priv) >= 10 || \
drivers/gpu/drm/i915/i915_gem.c+5−5
@@ -161,7 +161,7 @@ i915_gem_phys_pwrite(struct drm_i915_gem_object *obj, · 160 unmodified lines
161161 * We manually control the domain here and pretend that it
162162 * remains coherent i.e. in the GTT domain, like shmem_pwrite.
163163 */
164− intel_frontbuffer_invalidate(obj->frontbuffer, ORIGIN_CPU);
164+ i915_gem_object_invalidate_frontbuffer(obj, ORIGIN_CPU);
165165
166166 if (copy_from_user(vaddr, user_data, args->size))
167167 return -EFAULT;
@@ -169,7 +169,7 @@ i915_gem_phys_pwrite(struct drm_i915_gem_object *obj, · 1 unmodified line
169169 drm_clflush_virt_range(vaddr, args->size);
170170 intel_gt_chipset_flush(&to_i915(obj->base.dev)->gt);
171171
172− intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_CPU);
172+ i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU);
173173 return 0;
174174 }
175175
@@ -589,7 +589,7 @@ i915_gem_gtt_pwrite_fast(struct drm_i915_gem_object *obj, · 413 unmodified lines
589589 goto out_unpin;
590590 }
591591
592− intel_frontbuffer_invalidate(obj->frontbuffer, ORIGIN_CPU);
592+ i915_gem_object_invalidate_frontbuffer(obj, ORIGIN_CPU);
593593
594594 user_data = u64_to_user_ptr(args->data_ptr);
595595 offset = args->offset;
@@ -631,7 +631,7 @@ i915_gem_gtt_pwrite_fast(struct drm_i915_gem_object *obj, · 35 unmodified lines
631631 user_data += page_length;
632632 offset += page_length;
633633 }
634− intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_CPU);
634+ i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU);
635635
636636 i915_gem_object_unlock_fence(obj, fence);
637637 out_unpin:
@@ -721,7 +721,7 @@ i915_gem_shmem_pwrite(struct drm_i915_gem_object *obj, · 83 unmodified lines
721721 offset = 0;
722722 }
723723
724− intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_CPU);
724+ i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU);
725725 i915_gem_object_unlock_fence(obj, fence);
726726
727727 return ret;
drivers/gpu/drm/i915/i915_pmu.c+20−53
@@ -144,61 +144,40 @@ static inline s64 ktime_since(const ktime_t kt) · 143 unmodified lines
144144 return ktime_to_ns(ktime_sub(ktime_get(), kt));
145145 }
146146
147−static u64 __pmu_estimate_rc6(struct i915_pmu *pmu)
148−{
149− u64 val;
150−
151− /*
152− * We think we are runtime suspended.
153− *
154− * Report the delta from when the device was suspended to now,
155− * on top of the last known real value, as the approximated RC6
156− * counter value.
157− */
158− val = ktime_since(pmu->sleep_last);
159− val += pmu->sample[__I915_SAMPLE_RC6].cur;
160−
161− pmu->sample[__I915_SAMPLE_RC6_ESTIMATED].cur = val;
162−
163− return val;
164−}
165−
166−static u64 __pmu_update_rc6(struct i915_pmu *pmu, u64 val)
167−{
168− /*
169− * If we are coming back from being runtime suspended we must
170− * be careful not to report a larger value than returned
171− * previously.
172− */
173− if (val >= pmu->sample[__I915_SAMPLE_RC6_ESTIMATED].cur) {
174− pmu->sample[__I915_SAMPLE_RC6_ESTIMATED].cur = 0;
175− pmu->sample[__I915_SAMPLE_RC6].cur = val;
176− } else {
177− val = pmu->sample[__I915_SAMPLE_RC6_ESTIMATED].cur;
178− }
179−
180− return val;
181−}
182−
183147 static u64 get_rc6(struct intel_gt *gt)
184148 {
185149 struct drm_i915_private *i915 = gt->i915;
186150 struct i915_pmu *pmu = &i915->pmu;
187151 unsigned long flags;
152+ bool awake = false;
188153 u64 val;
189154
190− val = 0;
191155 if (intel_gt_pm_get_if_awake(gt)) {
192156 val = __get_rc6(gt);
193157 intel_gt_pm_put_async(gt);
158+ awake = true;
194159 }
195160
196161 spin_lock_irqsave(&pmu->lock, flags);
197162
198− if (val)
199− val = __pmu_update_rc6(pmu, val);
163+ if (awake) {
164+ pmu->sample[__I915_SAMPLE_RC6].cur = val;
165+ } else {
166+ /*
167+ * We think we are runtime suspended.
168+ *
169+ * Report the delta from when the device was suspended to now,
170+ * on top of the last known real value, as the approximated RC6
171+ * counter value.
172+ */
173+ val = ktime_since(pmu->sleep_last);
174+ val += pmu->sample[__I915_SAMPLE_RC6].cur;
175+ }
176+
177+ if (val < pmu->sample[__I915_SAMPLE_RC6_LAST_REPORTED].cur)
178+ val = pmu->sample[__I915_SAMPLE_RC6_LAST_REPORTED].cur;
200179 else
201− val = __pmu_estimate_rc6(pmu);
180+ pmu->sample[__I915_SAMPLE_RC6_LAST_REPORTED].cur = val;
202181
203182 spin_unlock_irqrestore(&pmu->lock, flags);
204183
@@ -210,20 +189,11 @@ static void park_rc6(struct drm_i915_private *i915) · 5 unmodified lines
210189 struct i915_pmu *pmu = &i915->pmu;
211190
212191 if (pmu->enable & config_enabled_mask(I915_PMU_RC6_RESIDENCY))
213− __pmu_update_rc6(pmu, __get_rc6(&i915->gt));
192+ pmu->sample[__I915_SAMPLE_RC6].cur = __get_rc6(&i915->gt);
214193
215194 pmu->sleep_last = ktime_get();
216195 }
217196
218−static void unpark_rc6(struct drm_i915_private *i915)
219−{
220− struct i915_pmu *pmu = &i915->pmu;
221−
222− /* Estimate how long we slept and accumulate that into rc6 counters */
223− if (pmu->enable & config_enabled_mask(I915_PMU_RC6_RESIDENCY))
224− __pmu_estimate_rc6(pmu);
225−}
226−
227197 #else
228198
229199 static u64 get_rc6(struct intel_gt *gt)
@@ -232,7 +202,6 @@ static u64 get_rc6(struct intel_gt *gt) · 2 unmodified lines
232202 }
233203
234204 static void park_rc6(struct drm_i915_private *i915) {}
235−static void unpark_rc6(struct drm_i915_private *i915) {}
236205
237206 #endif
238207
@@ -281,8 +250,6 @@ void i915_pmu_gt_unparked(struct drm_i915_private *i915) · 42 unmodified lines
281250 */
282251 __i915_pmu_maybe_start_timer(pmu);
283252
284− unpark_rc6(i915);
285−
286253 spin_unlock_irq(&pmu->lock);
287254 }
288255
drivers/gpu/drm/i915/i915_pmu.h+1−1
@@ -18,7 +18,7 @@ enum { · 17 unmodified lines
1818 __I915_SAMPLE_FREQ_ACT = 0,
1919 __I915_SAMPLE_FREQ_REQ,
2020 __I915_SAMPLE_RC6,
21− __I915_SAMPLE_RC6_ESTIMATED,
21+ __I915_SAMPLE_RC6_LAST_REPORTED,
2222 __I915_NUM_PMU_SAMPLERS
2323 };
2424
drivers/gpu/drm/i915/i915_reg.h+7−1
@@ -4177,7 +4177,13 @@ enum { · 4176 unmodified lines
41774177 #define CPSSUNIT_CLKGATE_DIS REG_BIT(9)
41784178
41794179 #define UNSLICE_UNIT_LEVEL_CLKGATE _MMIO(0x9434)
4180−#define VFUNIT_CLKGATE_DIS (1 << 20)
4180+#define VFUNIT_CLKGATE_DIS REG_BIT(20)
4181+#define HSUNIT_CLKGATE_DIS REG_BIT(8)
4182+#define VSUNIT_CLKGATE_DIS REG_BIT(3)
4183+
4184+#define UNSLICE_UNIT_LEVEL_CLKGATE2 _MMIO(0x94e4)
4185+#define VSUNIT_CLKGATE_DIS_TGL REG_BIT(19)
4186+#define PSDUNIT_CLKGATE_DIS REG_BIT(5)
41814187
41824188 #define INF_UNIT_LEVEL_CLKGATE _MMIO(0x9560)
41834189 #define CGPSF_CLKGATE_DIS (1 << 3)
drivers/gpu/drm/i915/i915_vma.c+8−2
@@ -1104,8 +1104,14 @@ int i915_vma_move_to_active(struct i915_vma *vma, · 1103 unmodified lines
11041104 return err;
11051105
11061106 if (flags & EXEC_OBJECT_WRITE) {
1107− if (intel_frontbuffer_invalidate(obj->frontbuffer, ORIGIN_CS))
1108− i915_active_add_request(&obj->frontbuffer->write, rq);
1107+ struct intel_frontbuffer *front;
1108+
1109+ front = __intel_frontbuffer_get(obj);
1110+ if (unlikely(front)) {
1111+ if (intel_frontbuffer_invalidate(front, ORIGIN_CS))
1112+ i915_active_add_request(&front->write, rq);
1113+ intel_frontbuffer_put(front);
1114+ }
11091115
11101116 dma_resv_add_excl_fence(vma->resv, &rq->fence);
11111117 obj->write_domain = I915_GEM_DOMAIN_RENDER;
drivers/gpu/drm/i915/intel_pm.c+11−0
@@ -6565,6 +6565,17 @@ static void icl_init_clock_gating(struct drm_i915_private *dev_priv) · 6564 unmodified lines
65656565 /* WaEnable32PlaneMode:icl */
65666566 I915_WRITE(GEN9_CSFE_CHICKEN1_RCS,
65676567 _MASKED_BIT_ENABLE(GEN11_ENABLE_32_PLANE_MODE));
6568+
6569+ /*
6570+ * Wa_1408615072:icl,ehl (vsunit)
6571+ * Wa_1407596294:icl,ehl (hsunit)
6572+ */
6573+ intel_uncore_rmw(&dev_priv->uncore, UNSLICE_UNIT_LEVEL_CLKGATE,
6574+ 0, VSUNIT_CLKGATE_DIS | HSUNIT_CLKGATE_DIS);
6575+
6576+ /* Wa_1407352427:icl,ehl */
6577+ intel_uncore_rmw(&dev_priv->uncore, UNSLICE_UNIT_LEVEL_CLKGATE2,
6578+ 0, PSDUNIT_CLKGATE_DIS);
65686579 }
65696580
65706581 static void tgl_init_clock_gating(struct drm_i915_private *dev_priv)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c+12−6
@@ -215,11 +215,12 @@ struct mtk_ddp_comp *mtk_drm_ddp_comp_for_plane(struct drm_crtc *crtc, · 214 unmodified lines
215215 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
216216 struct mtk_ddp_comp *comp;
217217 int i, count = 0;
218+ unsigned int local_index = plane - mtk_crtc->planes;
218219
219220 for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) {
220221 comp = mtk_crtc->ddp_comp[i];
221− if (plane->index < (count + mtk_ddp_comp_layer_nr(comp))) {
222− *local_layer = plane->index - count;
222+ if (local_index < (count + mtk_ddp_comp_layer_nr(comp))) {
223+ *local_layer = local_index - count;
223224 return comp;
224225 }
225226 count += mtk_ddp_comp_layer_nr(comp);
@@ -310,7 +311,9 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc) · 84 unmodified lines
310311
311312 plane_state = to_mtk_plane_state(plane->state);
312313 comp = mtk_drm_ddp_comp_for_plane(crtc, plane, &local_layer);
313− mtk_ddp_comp_layer_config(comp, local_layer, plane_state);
314+ if (comp)
315+ mtk_ddp_comp_layer_config(comp, local_layer,
316+ plane_state);
314317 }
315318
316319 return 0;
@@ -386,8 +389,9 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc) · 69 unmodified lines
386389 comp = mtk_drm_ddp_comp_for_plane(crtc, plane,
387390 &local_layer);
388391
389− mtk_ddp_comp_layer_config(comp, local_layer,
390− plane_state);
392+ if (comp)
393+ mtk_ddp_comp_layer_config(comp, local_layer,
394+ plane_state);
391395 plane_state->pending.config = false;
392396 }
393397 mtk_crtc->pending_planes = false;
@@ -401,7 +405,9 @@ int mtk_drm_crtc_plane_check(struct drm_crtc *crtc, struct drm_plane *plane, · 7 unmodified lines
401405 struct mtk_ddp_comp *comp;
402406
403407 comp = mtk_drm_ddp_comp_for_plane(crtc, plane, &local_layer);
404− return mtk_ddp_comp_layer_check(comp, local_layer, state);
408+ if (comp)
409+ return mtk_ddp_comp_layer_check(comp, local_layer, state);
410+ return 0;
405411 }
406412
407413 static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
drivers/gpu/drm/mediatek/mtk_dsi.c+38−29
@@ -230,28 +230,25 @@ static void mtk_dsi_mask(struct mtk_dsi *dsi, u32 offset, u32 mask, u32 data) · 229 unmodified lines
230230 static void mtk_dsi_phy_timconfig(struct mtk_dsi *dsi)
231231 {
232232 u32 timcon0, timcon1, timcon2, timcon3;
233− u32 ui, cycle_time;
233+ u32 data_rate_mhz = DIV_ROUND_UP(dsi->data_rate, 1000000);
234234 struct mtk_phy_timing *timing = &dsi->phy_timing;
235235
236− ui = DIV_ROUND_UP(1000000000, dsi->data_rate);
237− cycle_time = div_u64(8000000000ULL, dsi->data_rate);
236+ timing->lpx = (60 * data_rate_mhz / (8 * 1000)) + 1;
237+ timing->da_hs_prepare = (80 * data_rate_mhz + 4 * 1000) / 8000;
238+ timing->da_hs_zero = (170 * data_rate_mhz + 10 * 1000) / 8000 + 1 -
239+ timing->da_hs_prepare;
240+ timing->da_hs_trail = timing->da_hs_prepare + 1;
238241
239− timing->lpx = NS_TO_CYCLE(60, cycle_time);
240− timing->da_hs_prepare = NS_TO_CYCLE(50 + 5 * ui, cycle_time);
241− timing->da_hs_zero = NS_TO_CYCLE(110 + 6 * ui, cycle_time);
242− timing->da_hs_trail = NS_TO_CYCLE(77 + 4 * ui, cycle_time);
242+ timing->ta_go = 4 * timing->lpx - 2;
243+ timing->ta_sure = timing->lpx + 2;
244+ timing->ta_get = 4 * timing->lpx;
245+ timing->da_hs_exit = 2 * timing->lpx + 1;
243246
244− timing->ta_go = 4 * timing->lpx;
245− timing->ta_sure = 3 * timing->lpx / 2;
246− timing->ta_get = 5 * timing->lpx;
247− timing->da_hs_exit = 2 * timing->lpx;
248−
249− timing->clk_hs_zero = NS_TO_CYCLE(336, cycle_time);
250− timing->clk_hs_trail = NS_TO_CYCLE(100, cycle_time) + 10;
251−
252− timing->clk_hs_prepare = NS_TO_CYCLE(64, cycle_time);
253− timing->clk_hs_post = NS_TO_CYCLE(80 + 52 * ui, cycle_time);
254− timing->clk_hs_exit = 2 * timing->lpx;
247+ timing->clk_hs_prepare = 70 * data_rate_mhz / (8 * 1000);
248+ timing->clk_hs_post = timing->clk_hs_prepare + 8;
249+ timing->clk_hs_trail = timing->clk_hs_prepare;
250+ timing->clk_hs_zero = timing->clk_hs_trail * 4;
251+ timing->clk_hs_exit = 2 * timing->clk_hs_trail;
255252
256253 timcon0 = timing->lpx | timing->da_hs_prepare << 8 |
257254 timing->da_hs_zero << 16 | timing->da_hs_trail << 24;
@@ -482,27 +479,39 @@ static void mtk_dsi_config_vdo_timing(struct mtk_dsi *dsi) · 224 unmodified lines
482479 dsi_tmp_buf_bpp - 10);
483480
484481 data_phy_cycles = timing->lpx + timing->da_hs_prepare +
485− timing->da_hs_zero + timing->da_hs_exit + 2;
482+ timing->da_hs_zero + timing->da_hs_exit + 3;
486483
487484 if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) {
488− if (vm->hfront_porch * dsi_tmp_buf_bpp >
485+ if ((vm->hfront_porch + vm->hback_porch) * dsi_tmp_buf_bpp >
489486 data_phy_cycles * dsi->lanes + 18) {
490− horizontal_frontporch_byte = vm->hfront_porch *
491− dsi_tmp_buf_bpp -
492− data_phy_cycles *
493− dsi->lanes - 18;
487+ horizontal_frontporch_byte =
488+ vm->hfront_porch * dsi_tmp_buf_bpp -
489+ (data_phy_cycles * dsi->lanes + 18) *
490+ vm->hfront_porch /
491+ (vm->hfront_porch + vm->hback_porch);
492+
493+ horizontal_backporch_byte =
494+ horizontal_backporch_byte -
495+ (data_phy_cycles * dsi->lanes + 18) *
496+ vm->hback_porch /
497+ (vm->hfront_porch + vm->hback_porch);
494498 } else {
495499 DRM_WARN("HFP less than d-phy, FPS will under 60Hz\n");
496500 horizontal_frontporch_byte = vm->hfront_porch *
497501 dsi_tmp_buf_bpp;
498502 }
499503 } else {
500− if (vm->hfront_porch * dsi_tmp_buf_bpp >
504+ if ((vm->hfront_porch + vm->hback_porch) * dsi_tmp_buf_bpp >
501505 data_phy_cycles * dsi->lanes + 12) {
502− horizontal_frontporch_byte = vm->hfront_porch *
503− dsi_tmp_buf_bpp -
504− data_phy_cycles *
505− dsi->lanes - 12;
506+ horizontal_frontporch_byte =
507+ vm->hfront_porch * dsi_tmp_buf_bpp -
508+ (data_phy_cycles * dsi->lanes + 12) *
509+ vm->hfront_porch /
510+ (vm->hfront_porch + vm->hback_porch);
511+ horizontal_backporch_byte = horizontal_backporch_byte -
512+ (data_phy_cycles * dsi->lanes + 12) *
513+ vm->hback_porch /
514+ (vm->hfront_porch + vm->hback_porch);
506515 } else {
507516 DRM_WARN("HFP less than d-phy, FPS will under 60Hz\n");
508517 horizontal_frontporch_byte = vm->hfront_porch *
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c+0−2
@@ -685,8 +685,6 @@ static void sun4i_hdmi_unbind(struct device *dev, struct device *master, · 684 unmodified lines
685685 struct sun4i_hdmi *hdmi = dev_get_drvdata(dev);
686686
687687 cec_unregister_adapter(hdmi->cec_adap);
688− drm_connector_cleanup(&hdmi->connector);
689− drm_encoder_cleanup(&hdmi->encoder);
690688 i2c_del_adapter(hdmi->i2c);
691689 i2c_put_adapter(hdmi->ddc_i2c);
692690 clk_disable_unprepare(hdmi->mod_clk);
drivers/gpu/drm/sun4i/sun4i_tcon.c+12−3
@@ -489,7 +489,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, · 488 unmodified lines
489489
490490 WARN_ON(!tcon->quirks->has_channel_0);
491491
492− tcon->dclk_min_div = 1;
492+ tcon->dclk_min_div = tcon->quirks->dclk_min_div;
493493 tcon->dclk_max_div = 127;
494494 sun4i_tcon0_mode_set_common(tcon, mode);
495495
@@ -1426,12 +1426,14 @@ static int sun8i_r40_tcon_tv_set_mux(struct sun4i_tcon *tcon, · 930 unmodified lines
14261426 static const struct sun4i_tcon_quirks sun4i_a10_quirks = {
14271427 .has_channel_0 = true,
14281428 .has_channel_1 = true,
1429+ .dclk_min_div = 4,
14291430 .set_mux = sun4i_a10_tcon_set_mux,
14301431 };
14311432
14321433 static const struct sun4i_tcon_quirks sun5i_a13_quirks = {
14331434 .has_channel_0 = true,
14341435 .has_channel_1 = true,
1436+ .dclk_min_div = 4,
14351437 .set_mux = sun5i_a13_tcon_set_mux,
14361438 };
14371439
@@ -1440,6 +1442,7 @@ static const struct sun4i_tcon_quirks sun6i_a31_quirks = { · 2 unmodified lines
14401442 .has_channel_1 = true,
14411443 .has_lvds_alt = true,
14421444 .needs_de_be_mux = true,
1445+ .dclk_min_div = 1,
14431446 .set_mux = sun6i_tcon_set_mux,
14441447 };
14451448
@@ -1447,11 +1450,13 @@ static const struct sun4i_tcon_quirks sun6i_a31s_quirks = { · 1 unmodified line
14471450 .has_channel_0 = true,
14481451 .has_channel_1 = true,
14491452 .needs_de_be_mux = true,
1453+ .dclk_min_div = 1,
14501454 };
14511455
14521456 static const struct sun4i_tcon_quirks sun7i_a20_quirks = {
14531457 .has_channel_0 = true,
14541458 .has_channel_1 = true,
1459+ .dclk_min_div = 4,
14551460 /* Same display pipeline structure as A10 */
14561461 .set_mux = sun4i_a10_tcon_set_mux,
14571462 };
@@ -1459,11 +1464,13 @@ static const struct sun4i_tcon_quirks sun7i_a20_quirks = { · 1 unmodified line
14591464 static const struct sun4i_tcon_quirks sun8i_a33_quirks = {
14601465 .has_channel_0 = true,
14611466 .has_lvds_alt = true,
1467+ .dclk_min_div = 1,
14621468 };
14631469
14641470 static const struct sun4i_tcon_quirks sun8i_a83t_lcd_quirks = {
14651471 .supports_lvds = true,
14661472 .has_channel_0 = true,
1473+ .dclk_min_div = 1,
14671474 };
14681475
14691476 static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = {
@@ -1477,11 +1484,13 @@ static const struct sun4i_tcon_quirks sun8i_r40_tv_quirks = { · 7 unmodified lines
14771484
14781485 static const struct sun4i_tcon_quirks sun8i_v3s_quirks = {
14791486 .has_channel_0 = true,
1487+ .dclk_min_div = 1,
14801488 };
14811489
14821490 static const struct sun4i_tcon_quirks sun9i_a80_tcon_lcd_quirks = {
1483− .has_channel_0 = true,
1484− .needs_edp_reset = true,
1491+ .has_channel_0 = true,
1492+ .needs_edp_reset = true,
1493+ .dclk_min_div = 1,
14851494 };
14861495
14871496 static const struct sun4i_tcon_quirks sun9i_a80_tcon_tv_quirks = {
drivers/gpu/drm/sun4i/sun4i_tcon.h+1−0
@@ -224,6 +224,7 @@ struct sun4i_tcon_quirks { · 223 unmodified lines
224224 bool needs_de_be_mux; /* sun6i needs mux to select backend */
225225 bool needs_edp_reset; /* a80 edp reset needed for tcon0 access */
226226 bool supports_lvds; /* Does the TCON support an LVDS output? */
227+ u8 dclk_min_div; /* minimum divider for TCON0 DCLK */
227228
228229 /* callback to handle tcon muxing options */
229230 int (*set_mux)(struct sun4i_tcon *, const struct drm_encoder *);
drivers/hid/hid-asus.c+2−1
@@ -261,7 +261,8 @@ static int asus_event(struct hid_device *hdev, struct hid_field *field, · 260 unmodified lines
261261 struct hid_usage *usage, __s32 value)
262262 {
263263 if ((usage->hid & HID_USAGE_PAGE) == 0xff310000 &&
264− (usage->hid & HID_USAGE) != 0x00 && !usage->type) {
264+ (usage->hid & HID_USAGE) != 0x00 &&
265+ (usage->hid & HID_USAGE) != 0xff && !usage->type) {
265266 hid_warn(hdev, "Unmapped Asus vendor usagepage code 0x%02x\n",
266267 usage->hid & HID_USAGE);
267268 }
drivers/hid/hid-core.c+6−0
@@ -288,6 +288,12 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign · 287 unmodified lines
288288 offset = report->size;
289289 report->size += parser->global.report_size * parser->global.report_count;
290290
291+ /* Total size check: Allow for possible report index byte */
292+ if (report->size > (HID_MAX_BUFFER_SIZE - 1) << 3) {
293+ hid_err(parser->device, "report is too long\n");
294+ return -1;
295+ }
296+
291297 if (!parser->local.usage_index) /* Ignore padding fields */
292298 return 0;
293299
drivers/hid/hid-ids.h+3−0
@@ -631,6 +631,7 @@ · 630 unmodified lines
631631 #define USB_VENDOR_ID_ITE 0x048d
632632 #define USB_DEVICE_ID_ITE_LENOVO_YOGA 0x8386
633633 #define USB_DEVICE_ID_ITE_LENOVO_YOGA2 0x8350
634+#define I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720 0x837a
634635 #define USB_DEVICE_ID_ITE_LENOVO_YOGA900 0x8396
635636 #define USB_DEVICE_ID_ITE8595 0x8595
636637
@@ -730,6 +731,7 @@ · 93 unmodified lines
730731 #define USB_DEVICE_ID_LG_MULTITOUCH 0x0064
731732 #define USB_DEVICE_ID_LG_MELFAS_MT 0x6007
732733 #define I2C_DEVICE_ID_LG_8001 0x8001
734+#define I2C_DEVICE_ID_LG_7010 0x7010
733735
734736 #define USB_VENDOR_ID_LOGITECH 0x046d
735737 #define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e
@@ -1102,6 +1104,7 @@ · 366 unmodified lines
11021104 #define USB_DEVICE_ID_SYNAPTICS_LTS2 0x1d10
11031105 #define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3
11041106 #define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3
1107+#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 0x2968
11051108 #define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710
11061109 #define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5 0x81a7
11071110
drivers/hid/hid-input.c+12−4
@@ -1132,9 +1132,15 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · 1131 unmodified lines
11321132 }
11331133
11341134 mapped:
1135− if (device->driver->input_mapped && device->driver->input_mapped(device,
1136− hidinput, field, usage, &bit, &max) < 0)
1137− goto ignore;
1135+ if (device->driver->input_mapped &&
1136+ device->driver->input_mapped(device, hidinput, field, usage,
1137+ &bit, &max) < 0) {
1138+ /*
1139+ * The driver indicated that no further generic handling
1140+ * of the usage is desired.
1141+ */
1142+ return;
1143+ }
11381144
11391145 set_bit(usage->type, input->evbit);
11401146
@@ -1215,9 +1221,11 @@ mapped: · 74 unmodified lines
12151221 set_bit(MSC_SCAN, input->mscbit);
12161222 }
12171223
1218−ignore:
12191224 return;
12201225
1226+ignore:
1227+ usage->type = 0;
1228+ usage->code = 0;
12211229 }
12221230
12231231 static void hidinput_handle_scroll(struct hid_usage *usage,
drivers/hid/hid-ite.c+3−0
@@ -40,6 +40,9 @@ static int ite_event(struct hid_device *hdev, struct hid_field *field, · 39 unmodified lines
4040 static const struct hid_device_id ite_devices[] = {
4141 { HID_USB_DEVICE(USB_VENDOR_ID_ITE, USB_DEVICE_ID_ITE8595) },
4242 { HID_USB_DEVICE(USB_VENDOR_ID_258A, USB_DEVICE_ID_258A_6A88) },
43+ /* ITE8595 USB kbd ctlr, with Synaptics touchpad connected to it. */
44+ { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS,
45+ USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012) },
4346 { }
4447 };
4548 MODULE_DEVICE_TABLE(hid, ite_devices);
drivers/hid/hid-multitouch.c+4−1
@@ -1019,7 +1019,7 @@ static int mt_process_slot(struct mt_device *td, struct input_dev *input, · 1018 unmodified lines
10191019 tool = MT_TOOL_DIAL;
10201020 else if (unlikely(!confidence_state)) {
10211021 tool = MT_TOOL_PALM;
1022− if (!active &&
1022+ if (!active && mt &&
10231023 input_mt_is_active(&mt->slots[slotnum])) {
10241024 /*
10251025 * The non-confidence was reported for
@@ -1985,6 +1985,9 @@ static const struct hid_device_id mt_devices[] = { · 959 unmodified lines
19851985 { .driver_data = MT_CLS_LG,
19861986 HID_USB_DEVICE(USB_VENDOR_ID_LG,
19871987 USB_DEVICE_ID_LG_MELFAS_MT) },
1988+ { .driver_data = MT_CLS_LG,
1989+ HID_DEVICE(BUS_I2C, HID_GROUP_GENERIC,
1990+ USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_7010) },
19881991
19891992 /* MosArt panels */
19901993 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
drivers/hid/hid-quirks.c+1−0
@@ -174,6 +174,7 @@ static const struct hid_device_id hid_quirks[] = { · 173 unmodified lines
174174 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET), HID_QUIRK_MULTI_INPUT },
175175 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
176176 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
177+ { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE), HID_QUIRK_MULTI_INPUT },
177178
178179 { 0 }
179180 };
drivers/hid/hid-steam.c+4−0
@@ -768,8 +768,12 @@ static int steam_probe(struct hid_device *hdev, · 767 unmodified lines
768768
769769 if (steam->quirks & STEAM_QUIRK_WIRELESS) {
770770 hid_info(hdev, "Steam wireless receiver connected");
771+ /* If using a wireless adaptor ask for connection status */
772+ steam->connected = false;
771773 steam_request_conn_status(steam);
772774 } else {
775+ /* A wired connection is always present */
776+ steam->connected = true;
773777 ret = steam_register(steam);
774778 if (ret) {
775779 hid_err(hdev,
drivers/hid/hidraw.c+4−3
@@ -249,13 +249,14 @@ out: · 248 unmodified lines
249249 static __poll_t hidraw_poll(struct file *file, poll_table *wait)
250250 {
251251 struct hidraw_list *list = file->private_data;
252+ __poll_t mask = EPOLLOUT | EPOLLWRNORM; /* hidraw is always writable */
252253
253254 poll_wait(file, &list->hidraw->wait, wait);
254255 if (list->head != list->tail)
255− return EPOLLIN | EPOLLRDNORM | EPOLLOUT;
256+ mask |= EPOLLIN | EPOLLRDNORM;
256257 if (!list->hidraw->exist)
257− return EPOLLERR | EPOLLHUP;
258− return 0;
258+ mask |= EPOLLERR | EPOLLHUP;
259+ return mask;
259260 }
260261
261262 static int hidraw_open(struct inode *inode, struct file *file)
drivers/hid/i2c-hid/i2c-hid-core.c+13−3
@@ -49,6 +49,8 @@ · 48 unmodified lines
4949 #define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1)
5050 #define I2C_HID_QUIRK_BOGUS_IRQ BIT(4)
5151 #define I2C_HID_QUIRK_RESET_ON_RESUME BIT(5)
52+#define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(6)
53+
5254
5355 /* flags */
5456 #define I2C_HID_STARTED 0
@@ -175,6 +177,8 @@ static const struct i2c_hid_quirks { · 120 unmodified lines
175177 I2C_HID_QUIRK_BOGUS_IRQ },
176178 { USB_VENDOR_ID_ALPS_JP, HID_ANY_ID,
177179 I2C_HID_QUIRK_RESET_ON_RESUME },
180+ { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720,
181+ I2C_HID_QUIRK_BAD_INPUT_SIZE },
178182 { 0, 0 }
179183 };
180184
@@ -496,9 +500,15 @@ static void i2c_hid_get_input(struct i2c_hid *ihid) · 315 unmodified lines
496500 }
497501
498502 if ((ret_size > size) || (ret_size < 2)) {
499− dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
500− __func__, size, ret_size);
501− return;
503+ if (ihid->quirks & I2C_HID_QUIRK_BAD_INPUT_SIZE) {
504+ ihid->inbuf[0] = size & 0xff;
505+ ihid->inbuf[1] = size >> 8;
506+ ret_size = size;
507+ } else {
508+ dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
509+ __func__, size, ret_size);
510+ return;
511+ }
502512 }
503513
504514 i2c_hid_dbg(ihid, "input: %*ph\n", ret_size, ihid->inbuf);
drivers/hid/intel-ish-hid/ipc/hw-ish.h+2−0
@@ -24,7 +24,9 @@ · 23 unmodified lines
2424 #define ICL_MOBILE_DEVICE_ID 0x34FC
2525 #define SPT_H_DEVICE_ID 0xA135
2626 #define CML_LP_DEVICE_ID 0x02FC
27+#define CMP_H_DEVICE_ID 0x06FC
2728 #define EHL_Ax_DEVICE_ID 0x4BB3
29+#define TGL_LP_DEVICE_ID 0xA0FC
2830
2931 #define REVISION_ID_CHT_A0 0x6
3032 #define REVISION_ID_CHT_Ax_SI 0x0
drivers/hid/intel-ish-hid/ipc/pci-ish.c+2−0
@@ -34,7 +34,9 @@ static const struct pci_device_id ish_pci_tbl[] = { · 33 unmodified lines
3434 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, ICL_MOBILE_DEVICE_ID)},
3535 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, SPT_H_DEVICE_ID)},
3636 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, CML_LP_DEVICE_ID)},
37+ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, CMP_H_DEVICE_ID)},
3738 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, EHL_Ax_DEVICE_ID)},
39+ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, TGL_LP_DEVICE_ID)},
3840 {0, }
3941 };
4042 MODULE_DEVICE_TABLE(pci, ish_pci_tbl);
drivers/hid/uhid.c+3−2
@@ -766,13 +766,14 @@ unlock: · 765 unmodified lines
766766 static __poll_t uhid_char_poll(struct file *file, poll_table *wait)
767767 {
768768 struct uhid_device *uhid = file->private_data;
769+ __poll_t mask = EPOLLOUT | EPOLLWRNORM; /* uhid is always writable */
769770
770771 poll_wait(file, &uhid->waitq, wait);
771772
772773 if (uhid->head != uhid->tail)
773− return EPOLLIN | EPOLLRDNORM;
774+ mask |= EPOLLIN | EPOLLRDNORM;
774775
775− return 0;
776+ return mask;
776777 }
777778
778779 static const struct file_operations uhid_fops = {
drivers/hid/usbhid/hiddev.c+42−55
@@ -241,12 +241,51 @@ static int hiddev_release(struct inode * inode, struct file * file) · 240 unmodified lines
241241 return 0;
242242 }
243243
244+static int __hiddev_open(struct hiddev *hiddev, struct file *file)
245+{
246+ struct hiddev_list *list;
247+ int error;
248+
249+ lockdep_assert_held(&hiddev->existancelock);
250+
251+ list = vzalloc(sizeof(*list));
252+ if (!list)
253+ return -ENOMEM;
254+
255+ mutex_init(&list->thread_lock);
256+ list->hiddev = hiddev;
257+
258+ if (!hiddev->open++) {
259+ error = hid_hw_power(hiddev->hid, PM_HINT_FULLON);
260+ if (error < 0)
261+ goto err_drop_count;
262+
263+ error = hid_hw_open(hiddev->hid);
264+ if (error < 0)
265+ goto err_normal_power;
266+ }
267+
268+ spin_lock_irq(&hiddev->list_lock);
269+ list_add_tail(&list->node, &hiddev->list);
270+ spin_unlock_irq(&hiddev->list_lock);
271+
272+ file->private_data = list;
273+
274+ return 0;
275+
276+err_normal_power:
277+ hid_hw_power(hiddev->hid, PM_HINT_NORMAL);
278+err_drop_count:
279+ hiddev->open--;
280+ vfree(list);
281+ return error;
282+}
283+
244284 /*
245285 * open file op
246286 */
247287 static int hiddev_open(struct inode *inode, struct file *file)
248288 {
249− struct hiddev_list *list;
250289 struct usb_interface *intf;
251290 struct hid_device *hid;
252291 struct hiddev *hiddev;
@@ -255,66 +294,14 @@ static int hiddev_open(struct inode *inode, struct file *file) · 2 unmodified lines
255294 intf = usbhid_find_interface(iminor(inode));
256295 if (!intf)
257296 return -ENODEV;
297+
258298 hid = usb_get_intfdata(intf);
259299 hiddev = hid->hiddev;
260300
261− if (!(list = vzalloc(sizeof(struct hiddev_list))))
262− return -ENOMEM;
263− mutex_init(&list->thread_lock);
264− list->hiddev = hiddev;
265− file->private_data = list;
266−
267− /*
268− * no need for locking because the USB major number
269− * is shared which usbcore guards against disconnect
270− */
271− if (list->hiddev->exist) {
272− if (!list->hiddev->open++) {
273− res = hid_hw_open(hiddev->hid);
274− if (res < 0)
275− goto bail;
276− }
277− } else {
278− res = -ENODEV;
279− goto bail;
280− }
281−
282− spin_lock_irq(&list->hiddev->list_lock);
283− list_add_tail(&list->node, &hiddev->list);
284− spin_unlock_irq(&list->hiddev->list_lock);
285−
286301 mutex_lock(&hiddev->existancelock);
287− /*
288− * recheck exist with existance lock held to
289− * avoid opening a disconnected device
290− */
291− if (!list->hiddev->exist) {
292− res = -ENODEV;
293− goto bail_unlock;
294− }
295− if (!list->hiddev->open++)
296− if (list->hiddev->exist) {
297− struct hid_device *hid = hiddev->hid;
298− res = hid_hw_power(hid, PM_HINT_FULLON);
299− if (res < 0)
300− goto bail_unlock;
301− res = hid_hw_open(hid);
302− if (res < 0)
303− goto bail_normal_power;
304− }
305− mutex_unlock(&hiddev->existancelock);
306− return 0;
307−bail_normal_power:
308− hid_hw_power(hid, PM_HINT_NORMAL);
309−bail_unlock:
302+ res = hiddev->exist ? __hiddev_open(hiddev, file) : -ENODEV;
310303 mutex_unlock(&hiddev->existancelock);
311304
312− spin_lock_irq(&list->hiddev->list_lock);
313− list_del(&list->node);
314− spin_unlock_irq(&list->hiddev->list_lock);
315−bail:
316− file->private_data = NULL;
317− vfree(list);
318305 return res;
319306 }
320307
drivers/hid/wacom_wac.c+4−2
@@ -2096,14 +2096,16 @@ static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field · 2095 unmodified lines
20962096 (hdev->product == 0x34d || hdev->product == 0x34e || /* MobileStudio Pro */
20972097 hdev->product == 0x357 || hdev->product == 0x358 || /* Intuos Pro 2 */
20982098 hdev->product == 0x392 || /* Intuos Pro 2 */
2099− hdev->product == 0x398 || hdev->product == 0x399)) { /* MobileStudio Pro */
2099+ hdev->product == 0x398 || hdev->product == 0x399 || /* MobileStudio Pro */
2100+ hdev->product == 0x3AA)) { /* MobileStudio Pro */
21002101 value = (field->logical_maximum - value);
21012102
21022103 if (hdev->product == 0x357 || hdev->product == 0x358 ||
21032104 hdev->product == 0x392)
21042105 value = wacom_offset_rotation(input, usage, value, 3, 16);
21052106 else if (hdev->product == 0x34d || hdev->product == 0x34e ||
2106− hdev->product == 0x398 || hdev->product == 0x399)
2107+ hdev->product == 0x398 || hdev->product == 0x399 ||
2108+ hdev->product == 0x3AA)
21072109 value = wacom_offset_rotation(input, usage, value, 1, 2);
21082110 }
21092111 else {
drivers/i2c/busses/i2c-at91-core.c+1−1
@@ -174,7 +174,7 @@ static struct at91_twi_pdata sama5d2_config = { · 173 unmodified lines
174174
175175 static struct at91_twi_pdata sam9x60_config = {
176176 .clk_max_div = 7,
177− .clk_offset = 4,
177+ .clk_offset = 3,
178178 .has_unre_flag = true,
179179 .has_alt_cmd = true,
180180 .has_hold_field = true,
drivers/i2c/busses/i2c-bcm2835.c+8−9
@@ -58,6 +58,7 @@ struct bcm2835_i2c_dev { · 57 unmodified lines
5858 struct i2c_adapter adapter;
5959 struct completion completion;
6060 struct i2c_msg *curr_msg;
61+ struct clk *bus_clk;
6162 int num_msgs;
6263 u32 msg_err;
6364 u8 *msg_buf;
@@ -404,7 +405,6 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) · 340 unmodified lines
404405 struct resource *mem, *irq;
405406 int ret;
406407 struct i2c_adapter *adap;
407− struct clk *bus_clk;
408408 struct clk *mclk;
409409 u32 bus_clk_rate;
410410
@@ -427,11 +427,11 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) · 16 unmodified lines
427427 return PTR_ERR(mclk);
428428 }
429429
430− bus_clk = bcm2835_i2c_register_div(&pdev->dev, mclk, i2c_dev);
430+ i2c_dev->bus_clk = bcm2835_i2c_register_div(&pdev->dev, mclk, i2c_dev);
431431
432− if (IS_ERR(bus_clk)) {
432+ if (IS_ERR(i2c_dev->bus_clk)) {
433433 dev_err(&pdev->dev, "Could not register clock\n");
434− return PTR_ERR(bus_clk);
434+ return PTR_ERR(i2c_dev->bus_clk);
435435 }
436436
437437 ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency",
@@ -442,13 +442,13 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) · 4 unmodified lines
442442 bus_clk_rate = 100000;
443443 }
444444
445− ret = clk_set_rate_exclusive(bus_clk, bus_clk_rate);
445+ ret = clk_set_rate_exclusive(i2c_dev->bus_clk, bus_clk_rate);
446446 if (ret < 0) {
447447 dev_err(&pdev->dev, "Could not set clock frequency\n");
448448 return ret;
449449 }
450450
451− ret = clk_prepare_enable(bus_clk);
451+ ret = clk_prepare_enable(i2c_dev->bus_clk);
452452 if (ret) {
453453 dev_err(&pdev->dev, "Couldn't prepare clock");
454454 return ret;
@@ -491,10 +491,9 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) · 36 unmodified lines
491491 static int bcm2835_i2c_remove(struct platform_device *pdev)
492492 {
493493 struct bcm2835_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
494− struct clk *bus_clk = devm_clk_get(i2c_dev->dev, "div");
495494
496− clk_rate_exclusive_put(bus_clk);
497− clk_disable_unprepare(bus_clk);
495+ clk_rate_exclusive_put(i2c_dev->bus_clk);
496+ clk_disable_unprepare(i2c_dev->bus_clk);
498497
499498 free_irq(i2c_dev->irq, i2c_dev);
500499 i2c_del_adapter(&i2c_dev->adapter);
drivers/i2c/i2c-core-base.c+10−3
@@ -186,10 +186,11 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap) · 185 unmodified lines
186186 * If we can set SDA, we will always create a STOP to ensure additional
187187 * pulses will do no harm. This is achieved by letting SDA follow SCL
188188 * half a cycle later. Check the 'incomplete_write_byte' fault injector
189− * for details.
189+ * for details. Note that we must honour tsu:sto, 4us, but lets use 5us
190+ * here for simplicity.
190191 */
191192 bri->set_scl(adap, scl);
192− ndelay(RECOVERY_NDELAY / 2);
193+ ndelay(RECOVERY_NDELAY);
193194 if (bri->set_sda)
194195 bri->set_sda(adap, scl);
195196 ndelay(RECOVERY_NDELAY / 2);
@@ -211,7 +212,13 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap) · 15 unmodified lines
211212 scl = !scl;
212213 bri->set_scl(adap, scl);
213214 /* Creating STOP again, see above */
214− ndelay(RECOVERY_NDELAY / 2);
215+ if (scl) {
216+ /* Honour minimum tsu:sto */
217+ ndelay(RECOVERY_NDELAY);
218+ } else {
219+ /* Honour minimum tf and thd:dat */
220+ ndelay(RECOVERY_NDELAY / 2);
221+ }
215222 if (bri->set_sda)
216223 bri->set_sda(adap, scl);
217224 ndelay(RECOVERY_NDELAY / 2);
drivers/infiniband/hw/bnxt_re/ib_verbs.c+3−1
@@ -3305,8 +3305,10 @@ int bnxt_re_dereg_mr(struct ib_mr *ib_mr, struct ib_udata *udata) · 3304 unmodified lines
33053305 int rc;
33063306
33073307 rc = bnxt_qplib_free_mrw(&rdev->qplib_res, &mr->qplib_mr);
3308− if (rc)
3308+ if (rc) {
33093309 dev_err(rdev_to_dev(rdev), "Dereg MR failed: %#x\n", rc);
3310+ return rc;
3311+ }
33103312
33113313 if (mr->pages) {
33123314 rc = bnxt_qplib_free_fast_reg_page_list(&rdev->qplib_res,
drivers/infiniband/hw/bnxt_re/qplib_fp.c+6−6
@@ -2283,13 +2283,13 @@ static int bnxt_qplib_cq_process_req(struct bnxt_qplib_cq *cq, · 2282 unmodified lines
22832283 /* Add qp to flush list of the CQ */
22842284 bnxt_qplib_add_flush_qp(qp);
22852285 } else {
2286+ /* Before we complete, do WA 9060 */
2287+ if (do_wa9060(qp, cq, cq_cons, sw_sq_cons,
2288+ cqe_sq_cons)) {
2289+ *lib_qp = qp;
2290+ goto out;
2291+ }
22862292 if (swq->flags & SQ_SEND_FLAGS_SIGNAL_COMP) {
2287− /* Before we complete, do WA 9060 */
2288− if (do_wa9060(qp, cq, cq_cons, sw_sq_cons,
2289− cqe_sq_cons)) {
2290− *lib_qp = qp;
2291− goto out;
2292− }
22932293 cqe->status = CQ_REQ_STATUS_OK;
22942294 cqe++;
22952295 (*budget)--;
drivers/infiniband/hw/hfi1/iowait.c+3−1
@@ -81,7 +81,9 @@ void iowait_init(struct iowait *wait, u32 tx_limit, · 80 unmodified lines
8181 void iowait_cancel_work(struct iowait *w)
8282 {
8383 cancel_work_sync(&iowait_get_ib_work(w)->iowork);
84− cancel_work_sync(&iowait_get_tid_work(w)->iowork);
84+ /* Make sure that the iowork for TID RDMA is used */
85+ if (iowait_get_tid_work(w)->iowork.func)
86+ cancel_work_sync(&iowait_get_tid_work(w)->iowork);
8587 }
8688
8789 /**
drivers/infiniband/hw/hfi1/tid_rdma.c+9−0
@@ -4633,6 +4633,15 @@ void hfi1_rc_rcv_tid_rdma_ack(struct hfi1_packet *packet) · 4632 unmodified lines
46334633 */
46344634 fpsn = full_flow_psn(flow, flow->flow_state.spsn);
46354635 req->r_ack_psn = psn;
4636+ /*
4637+ * If resync_psn points to the last flow PSN for a
4638+ * segment and the new segment (likely from a new
4639+ * request) starts with a new generation number, we
4640+ * need to adjust resync_psn accordingly.
4641+ */
4642+ if (flow->flow_state.generation !=
4643+ (resync_psn >> HFI1_KDETH_BTH_SEQ_SHIFT))
4644+ resync_psn = mask_psn(fpsn - 1);
46364645 flow->resync_npkts +=
46374646 delta_psn(mask_psn(resync_psn + 1), fpsn);
46384647 /*
drivers/infiniband/hw/i40iw/i40iw_verbs.c+6−8
@@ -169,8 +169,7 @@ static void i40iw_dealloc_ucontext(struct ib_ucontext *context) · 168 unmodified lines
169169 static int i40iw_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
170170 {
171171 struct i40iw_ucontext *ucontext;
172− u64 db_addr_offset;
173− u64 push_offset;
172+ u64 db_addr_offset, push_offset, pfn;
174173
175174 ucontext = to_ucontext(context);
176175 if (ucontext->iwdev->sc_dev.is_pf) {
@@ -189,7 +188,6 @@ static int i40iw_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) · 12 unmodified lines
189188
190189 if (vma->vm_pgoff == (db_addr_offset >> PAGE_SHIFT)) {
191190 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
192− vma->vm_private_data = ucontext;
193191 } else {
194192 if ((vma->vm_pgoff - (push_offset >> PAGE_SHIFT)) % 2)
195193 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
@@ -197,12 +195,12 @@ static int i40iw_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) · 1 unmodified line
197195 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
198196 }
199197
200− if (io_remap_pfn_range(vma, vma->vm_start,
201− vma->vm_pgoff + (pci_resource_start(ucontext->iwdev->ldev->pcidev, 0) >> PAGE_SHIFT),
202− PAGE_SIZE, vma->vm_page_prot))
203− return -EAGAIN;
198+ pfn = vma->vm_pgoff +
199+ (pci_resource_start(ucontext->iwdev->ldev->pcidev, 0) >>
200+ PAGE_SHIFT);
204201
205− return 0;
202+ return rdma_user_mmap_io(context, vma, pfn, PAGE_SIZE,
203+ vma->vm_page_prot, NULL);
206204 }
207205
208206 /**
drivers/input/evdev.c+7−7
@@ -224,13 +224,13 @@ static void __pass_event(struct evdev_client *client, · 223 unmodified lines
224224 */
225225 client->tail = (client->head - 2) & (client->bufsize - 1);
226226
227− client->buffer[client->tail].input_event_sec =
228− event->input_event_sec;
229− client->buffer[client->tail].input_event_usec =
230− event->input_event_usec;
231− client->buffer[client->tail].type = EV_SYN;
232− client->buffer[client->tail].code = SYN_DROPPED;
233− client->buffer[client->tail].value = 0;
227+ client->buffer[client->tail] = (struct input_event) {
228+ .input_event_sec = event->input_event_sec,
229+ .input_event_usec = event->input_event_usec,
230+ .type = EV_SYN,
231+ .code = SYN_DROPPED,
232+ .value = 0,
233+ };
234234
235235 client->packet_head = client->tail;
236236 }
drivers/input/input.c+16−10
@@ -878,16 +878,18 @@ static int input_default_setkeycode(struct input_dev *dev, · 877 unmodified lines
878878 }
879879 }
880880
881− __clear_bit(*old_keycode, dev->keybit);
882− __set_bit(ke->keycode, dev->keybit);
883−
884− for (i = 0; i < dev->keycodemax; i++) {
885− if (input_fetch_keycode(dev, i) == *old_keycode) {
886− __set_bit(*old_keycode, dev->keybit);
887− break; /* Setting the bit twice is useless, so break */
881+ if (*old_keycode <= KEY_MAX) {
882+ __clear_bit(*old_keycode, dev->keybit);
883+ for (i = 0; i < dev->keycodemax; i++) {
884+ if (input_fetch_keycode(dev, i) == *old_keycode) {
885+ __set_bit(*old_keycode, dev->keybit);
886+ /* Setting the bit twice is useless, so break */
887+ break;
888+ }
888889 }
889890 }
890891
892+ __set_bit(ke->keycode, dev->keybit);
891893 return 0;
892894 }
893895
@@ -943,9 +945,13 @@ int input_set_keycode(struct input_dev *dev, · 49 unmodified lines
943945 * Simulate keyup event if keycode is not present
944946 * in the keymap anymore
945947 */
946− if (test_bit(EV_KEY, dev->evbit) &&
947− !is_event_supported(old_keycode, dev->keybit, KEY_MAX) &&
948− __test_and_clear_bit(old_keycode, dev->key)) {
948+ if (old_keycode > KEY_MAX) {
949+ dev_warn(dev->dev.parent ?: &dev->dev,
950+ "%s: got too big old keycode %#x\n",
951+ __func__, old_keycode);
952+ } else if (test_bit(EV_KEY, dev->evbit) &&
953+ !is_event_supported(old_keycode, dev->keybit, KEY_MAX) &&
954+ __test_and_clear_bit(old_keycode, dev->key)) {
949955 struct input_value vals[] = {
950956 { EV_KEY, old_keycode, 0 },
951957 input_value_sync
drivers/input/keyboard/imx_sc_key.c+7−1
@@ -78,7 +78,13 @@ static void imx_sc_check_for_events(struct work_struct *work) · 77 unmodified lines
7878 return;
7979 }
8080
81− state = (bool)msg.state;
81+ /*
82+ * The response data from SCU firmware is 4 bytes,
83+ * but ONLY the first byte is the key state, other
84+ * 3 bytes could be some dirty data, so we should
85+ * ONLY take the first byte as key state.
86+ */
87+ state = (bool)(msg.state & 0xff);
8288
8389 if (state ^ priv->keystate) {
8490 priv->keystate = state;
drivers/input/misc/uinput.c+12−7
@@ -74,12 +74,16 @@ static int uinput_dev_event(struct input_dev *dev, · 73 unmodified lines
7474 struct uinput_device *udev = input_get_drvdata(dev);
7575 struct timespec64 ts;
7676
77− udev->buff[udev->head].type = type;
78− udev->buff[udev->head].code = code;
79− udev->buff[udev->head].value = value;
8077 ktime_get_ts64(&ts);
81− udev->buff[udev->head].input_event_sec = ts.tv_sec;
82− udev->buff[udev->head].input_event_usec = ts.tv_nsec / NSEC_PER_USEC;
78+
79+ udev->buff[udev->head] = (struct input_event) {
80+ .input_event_sec = ts.tv_sec,
81+ .input_event_usec = ts.tv_nsec / NSEC_PER_USEC,
82+ .type = type,
83+ .code = code,
84+ .value = value,
85+ };
86+
8387 udev->head = (udev->head + 1) % UINPUT_BUFFER_SIZE;
8488
8589 wake_up_interruptible(&udev->waitq);
@@ -689,13 +693,14 @@ static ssize_t uinput_read(struct file *file, char __user *buffer, · 603 unmodified lines
689693 static __poll_t uinput_poll(struct file *file, poll_table *wait)
690694 {
691695 struct uinput_device *udev = file->private_data;
696+ __poll_t mask = EPOLLOUT | EPOLLWRNORM; /* uinput is always writable */
692697
693698 poll_wait(file, &udev->waitq, wait);
694699
695700 if (udev->head != udev->tail)
696− return EPOLLIN | EPOLLRDNORM;
701+ mask |= EPOLLIN | EPOLLRDNORM;
697702
698− return EPOLLOUT | EPOLLWRNORM;
703+ return mask;
699704 }
700705
701706 static int uinput_release(struct inode *inode, struct file *file)
drivers/iommu/dma-iommu.c+0−3
@@ -1203,7 +1203,6 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr) · 1202 unmodified lines
12031203 {
12041204 struct device *dev = msi_desc_to_dev(desc);
12051205 struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
1206− struct iommu_dma_cookie *cookie;
12071206 struct iommu_dma_msi_page *msi_page;
12081207 static DEFINE_MUTEX(msi_prepare_lock); /* see below */
12091208
@@ -1212,8 +1211,6 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr) · 2 unmodified lines
12121211 return 0;
12131212 }
12141213
1215− cookie = domain->iova_cookie;
1216−
12171214 /*
12181215 * In fact the whole prepare operation should already be serialised by
12191216 * irq_domain_mutex further up the callchain, but that's pretty subtle
drivers/iommu/intel-iommu.c+18−4
@@ -5624,8 +5624,10 @@ static int intel_iommu_add_device(struct device *dev) · 5623 unmodified lines
56245624
56255625 group = iommu_group_get_for_dev(dev);
56265626
5627− if (IS_ERR(group))
5628− return PTR_ERR(group);
5627+ if (IS_ERR(group)) {
5628+ ret = PTR_ERR(group);
5629+ goto unlink;
5630+ }
56295631
56305632 iommu_group_put(group);
56315633
@@ -5651,7 +5653,8 @@ static int intel_iommu_add_device(struct device *dev) · 19 unmodified lines
56515653 if (!get_private_domain_for_dev(dev)) {
56525654 dev_warn(dev,
56535655 "Failed to get a private domain.\n");
5654− return -ENOMEM;
5656+ ret = -ENOMEM;
5657+ goto unlink;
56555658 }
56565659
56575660 dev_info(dev,
@@ -5666,6 +5669,10 @@ static int intel_iommu_add_device(struct device *dev) · 8 unmodified lines
56665669 }
56675670
56685671 return 0;
5672+
5673+unlink:
5674+ iommu_device_unlink(&iommu->iommu, dev);
5675+ return ret;
56695676 }
56705677
56715678 static void intel_iommu_remove_device(struct device *dev)
@@ -5817,6 +5824,13 @@ static void intel_iommu_apply_resv_region(struct device *dev, · 145 unmodified lines
58175824 WARN_ON_ONCE(!reserve_iova(&dmar_domain->iovad, start, end));
58185825 }
58195826
5827+static struct iommu_group *intel_iommu_device_group(struct device *dev)
5828+{
5829+ if (dev_is_pci(dev))
5830+ return pci_device_group(dev);
5831+ return generic_device_group(dev);
5832+}
5833+
58205834 #ifdef CONFIG_INTEL_IOMMU_SVM
58215835 struct intel_iommu *intel_svm_device_to_iommu(struct device *dev)
58225836 {
@@ -5989,7 +6003,7 @@ const struct iommu_ops intel_iommu_ops = { · 166 unmodified lines
59896003 .get_resv_regions = intel_iommu_get_resv_regions,
59906004 .put_resv_regions = intel_iommu_put_resv_regions,
59916005 .apply_resv_region = intel_iommu_apply_resv_region,
5992− .device_group = pci_device_group,
6006+ .device_group = intel_iommu_device_group,
59936007 .dev_has_feat = intel_iommu_dev_has_feat,
59946008 .dev_feat_enabled = intel_iommu_dev_feat_enabled,
59956009 .dev_enable_feat = intel_iommu_dev_enable_feat,
drivers/iommu/iommu.c+1−0
@@ -751,6 +751,7 @@ err_put_group: · 750 unmodified lines
751751 mutex_unlock(&group->mutex);
752752 dev->iommu_group = NULL;
753753 kobject_put(group->devices_kobj);
754+ sysfs_remove_link(group->devices_kobj, device->name);
754755 err_free_name:
755756 kfree(device->name);
756757 err_remove_link:
drivers/irqchip/irq-sifive-plic.c+1−1
@@ -256,7 +256,7 @@ static int __init plic_init(struct device_node *node, · 255 unmodified lines
256256 * Skip contexts other than external interrupts for our
257257 * privilege level.
258258 */
259− if (parent.args[0] != IRQ_EXT)
259+ if (parent.args[0] != RV_IRQ_EXT)
260260 continue;
261261
262262 hartid = plic_find_hart_id(parent.np);
drivers/media/cec/cec-adap.c+27−13
@@ -380,7 +380,8 @@ static void cec_data_cancel(struct cec_data *data, u8 tx_status) · 379 unmodified lines
380380 } else {
381381 list_del_init(&data->list);
382382 if (!(data->msg.tx_status & CEC_TX_STATUS_OK))
383− data->adap->transmit_queue_sz--;
383+ if (!WARN_ON(!data->adap->transmit_queue_sz))
384+ data->adap->transmit_queue_sz--;
384385 }
385386
386387 if (data->msg.tx_status & CEC_TX_STATUS_OK) {
@@ -432,6 +433,14 @@ static void cec_flush(struct cec_adapter *adap) · 45 unmodified lines
432433 * need to do anything special in that case.
433434 */
434435 }
436+ /*
437+ * If something went wrong and this counter isn't what it should
438+ * be, then this will reset it back to 0. Warn if it is not 0,
439+ * since it indicates a bug, either in this framework or in a
440+ * CEC driver.
441+ */
442+ if (WARN_ON(adap->transmit_queue_sz))
443+ adap->transmit_queue_sz = 0;
435444 }
436445
437446 /*
@@ -456,7 +465,7 @@ int cec_thread_func(void *_adap) · 18 unmodified lines
456465 bool timeout = false;
457466 u8 attempts;
458467
459− if (adap->transmitting) {
468+ if (adap->transmit_in_progress) {
460469 int err;
461470
462471 /*
@@ -491,7 +500,7 @@ int cec_thread_func(void *_adap) · 28 unmodified lines
491500 goto unlock;
492501 }
493502
494− if (adap->transmitting && timeout) {
503+ if (adap->transmit_in_progress && timeout) {
495504 /*
496505 * If we timeout, then log that. Normally this does
497506 * not happen and it is an indication of a faulty CEC
@@ -500,14 +509,18 @@ int cec_thread_func(void *_adap) · 2 unmodified lines
500509 * so much traffic on the bus that the adapter was
501510 * unable to transmit for CEC_XFER_TIMEOUT_MS (2.1s).
502511 */
503− pr_warn("cec-%s: message %*ph timed out\n", adap->name,
504− adap->transmitting->msg.len,
505− adap->transmitting->msg.msg);
512+ if (adap->transmitting) {
513+ pr_warn("cec-%s: message %*ph timed out\n", adap->name,
514+ adap->transmitting->msg.len,
515+ adap->transmitting->msg.msg);
516+ /* Just give up on this. */
517+ cec_data_cancel(adap->transmitting,
518+ CEC_TX_STATUS_TIMEOUT);
519+ } else {
520+ pr_warn("cec-%s: transmit timed out\n", adap->name);
521+ }
506522 adap->transmit_in_progress = false;
507523 adap->tx_timeouts++;
508− /* Just give up on this. */
509− cec_data_cancel(adap->transmitting,
510− CEC_TX_STATUS_TIMEOUT);
511524 goto unlock;
512525 }
513526
@@ -522,7 +535,8 @@ int cec_thread_func(void *_adap) · 8 unmodified lines
522535 data = list_first_entry(&adap->transmit_queue,
523536 struct cec_data, list);
524537 list_del_init(&data->list);
525− adap->transmit_queue_sz--;
538+ if (!WARN_ON(!data->adap->transmit_queue_sz))
539+ adap->transmit_queue_sz--;
526540
527541 /* Make this the current transmitting message */
528542 adap->transmitting = data;
@@ -1085,11 +1099,11 @@ void cec_received_msg_ts(struct cec_adapter *adap, · 556 unmodified lines
10851099 valid_la = false;
10861100 else if (!cec_msg_is_broadcast(msg) && !(dir_fl & DIRECTED))
10871101 valid_la = false;
1088− else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST1_4))
1102+ else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST))
10891103 valid_la = false;
10901104 else if (cec_msg_is_broadcast(msg) &&
1091− adap->log_addrs.cec_version >= CEC_OP_CEC_VERSION_2_0 &&
1092− !(dir_fl & BCAST2_0))
1105+ adap->log_addrs.cec_version < CEC_OP_CEC_VERSION_2_0 &&
1106+ !(dir_fl & BCAST1_4))
10931107 valid_la = false;
10941108 }
10951109 if (valid_la && min_len) {
drivers/media/usb/pulse8-cec/pulse8-cec.c+13−4
@@ -116,6 +116,7 @@ struct pulse8 { · 115 unmodified lines
116116 unsigned int vers;
117117 struct completion cmd_done;
118118 struct work_struct work;
119+ u8 work_result;
119120 struct delayed_work ping_eeprom_work;
120121 struct cec_msg rx_msg;
121122 u8 data[DATA_SIZE];
@@ -137,8 +138,10 @@ static void pulse8_irq_work_handler(struct work_struct *work) · 15 unmodified lines
137138 {
138139 struct pulse8 *pulse8 =
139140 container_of(work, struct pulse8, work);
141+ u8 result = pulse8->work_result;
140142
141− switch (pulse8->data[0] & 0x3f) {
143+ pulse8->work_result = 0;
144+ switch (result & 0x3f) {
142145 case MSGCODE_FRAME_DATA:
143146 cec_received_msg(pulse8->adap, &pulse8->rx_msg);
144147 break;
@@ -172,12 +175,12 @@ static irqreturn_t pulse8_interrupt(struct serio *serio, unsigned char data, · 27 unmodified lines
172175 pulse8->escape = false;
173176 } else if (data == MSGEND) {
174177 struct cec_msg *msg = &pulse8->rx_msg;
178+ u8 msgcode = pulse8->buf[0];
175179
176180 if (debug)
177181 dev_info(pulse8->dev, "received: %*ph\n",
178182 pulse8->idx, pulse8->buf);
179− pulse8->data[0] = pulse8->buf[0];
180− switch (pulse8->buf[0] & 0x3f) {
183+ switch (msgcode & 0x3f) {
181184 case MSGCODE_FRAME_START:
182185 msg->len = 1;
183186 msg->msg[0] = pulse8->buf[1];
@@ -186,14 +189,20 @@ static irqreturn_t pulse8_interrupt(struct serio *serio, unsigned char data, · 2 unmodified lines
186189 if (msg->len == CEC_MAX_MSG_SIZE)
187190 break;
188191 msg->msg[msg->len++] = pulse8->buf[1];
189− if (pulse8->buf[0] & MSGCODE_FRAME_EOM)
192+ if (msgcode & MSGCODE_FRAME_EOM) {
193+ WARN_ON(pulse8->work_result);
194+ pulse8->work_result = msgcode;
190195 schedule_work(&pulse8->work);
196+ break;
197+ }
191198 break;
192199 case MSGCODE_TRANSMIT_SUCCEEDED:
193200 case MSGCODE_TRANSMIT_FAILED_LINE:
194201 case MSGCODE_TRANSMIT_FAILED_ACK:
195202 case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA:
196203 case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE:
204+ WARN_ON(pulse8->work_result);
205+ pulse8->work_result = msgcode;
197206 schedule_work(&pulse8->work);
198207 break;
199208 case MSGCODE_HIGH_ERROR:
drivers/mtd/nand/onenand/omap2.c+8−6
@@ -148,13 +148,13 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state) · 147 unmodified lines
148148 unsigned long timeout;
149149 u32 syscfg;
150150
151− if (state == FL_RESETING || state == FL_PREPARING_ERASE ||
151+ if (state == FL_RESETTING || state == FL_PREPARING_ERASE ||
152152 state == FL_VERIFYING_ERASE) {
153153 int i = 21;
154154 unsigned int intr_flags = ONENAND_INT_MASTER;
155155
156156 switch (state) {
157− case FL_RESETING:
157+ case FL_RESETTING:
158158 intr_flags |= ONENAND_INT_RESET;
159159 break;
160160 case FL_PREPARING_ERASE:
@@ -328,7 +328,8 @@ static inline int omap2_onenand_dma_transfer(struct omap2_onenand *c, · 167 unmodified lines
328328 struct dma_async_tx_descriptor *tx;
329329 dma_cookie_t cookie;
330330
331− tx = dmaengine_prep_dma_memcpy(c->dma_chan, dst, src, count, 0);
331+ tx = dmaengine_prep_dma_memcpy(c->dma_chan, dst, src, count,
332+ DMA_CTRL_ACK | DMA_PREP_INTERRUPT);
332333 if (!tx) {
333334 dev_err(&c->pdev->dev, "Failed to prepare DMA memcpy\n");
334335 return -EIO;
@@ -375,7 +376,7 @@ static int omap2_onenand_read_bufferram(struct mtd_info *mtd, int area, · 40 unmodified lines
375376 * context fallback to PIO mode.
376377 */
377378 if (!virt_addr_valid(buf) || bram_offset & 3 || (size_t)buf & 3 ||
378− count < 384 || in_interrupt() || oops_in_progress )
379+ count < 384 || in_interrupt() || oops_in_progress)
379380 goto out_copy;
380381
381382 xtra = count & 3;
@@ -422,7 +423,7 @@ static int omap2_onenand_write_bufferram(struct mtd_info *mtd, int area, · 40 unmodified lines
422423 * context fallback to PIO mode.
423424 */
424425 if (!virt_addr_valid(buf) || bram_offset & 3 || (size_t)buf & 3 ||
425− count < 384 || in_interrupt() || oops_in_progress )
426+ count < 384 || in_interrupt() || oops_in_progress)
426427 goto out_copy;
427428
428429 dma_src = dma_map_single(dev, buf, count, DMA_TO_DEVICE);
@@ -528,7 +529,8 @@ static int omap2_onenand_probe(struct platform_device *pdev) · 99 unmodified lines
528529 c->gpmc_cs, c->phys_base, c->onenand.base,
529530 c->dma_chan ? "DMA" : "PIO");
530531
531− if ((r = onenand_scan(&c->mtd, 1)) < 0)
532+ r = onenand_scan(&c->mtd, 1);
533+ if (r < 0)
532534 goto err_release_dma;
533535
534536 freq = omap2_onenand_get_freq(c->onenand.version_id);
drivers/mtd/nand/onenand/onenand_base.c+7−7
@@ -2853,7 +2853,7 @@ static int onenand_otp_write_oob_nolock(struct mtd_info *mtd, loff_t to, · 2852 unmodified lines
28532853
28542854 /* Exit OTP access mode */
28552855 this->command(mtd, ONENAND_CMD_RESET, 0, 0);
2856− this->wait(mtd, FL_RESETING);
2856+ this->wait(mtd, FL_RESETTING);
28572857
28582858 status = this->read_word(this->base + ONENAND_REG_CTRL_STATUS);
28592859 status &= 0x60;
@@ -2924,7 +2924,7 @@ static int do_otp_read(struct mtd_info *mtd, loff_t from, size_t len, · 64 unmodified lines
29242924
29252925 /* Exit OTP access mode */
29262926 this->command(mtd, ONENAND_CMD_RESET, 0, 0);
2927− this->wait(mtd, FL_RESETING);
2927+ this->wait(mtd, FL_RESETTING);
29282928
29292929 return ret;
29302930 }
@@ -2968,7 +2968,7 @@ static int do_otp_write(struct mtd_info *mtd, loff_t to, size_t len, · 37 unmodified lines
29682968
29692969 /* Exit OTP access mode */
29702970 this->command(mtd, ONENAND_CMD_RESET, 0, 0);
2971− this->wait(mtd, FL_RESETING);
2971+ this->wait(mtd, FL_RESETTING);
29722972
29732973 return ret;
29742974 }
@@ -3008,7 +3008,7 @@ static int do_otp_lock(struct mtd_info *mtd, loff_t from, size_t len, · 33 unmodified lines
30083008
30093009 /* Exit OTP access mode */
30103010 this->command(mtd, ONENAND_CMD_RESET, 0, 0);
3011− this->wait(mtd, FL_RESETING);
3011+ this->wait(mtd, FL_RESETTING);
30123012 } else {
30133013 ops.mode = MTD_OPS_PLACE_OOB;
30143014 ops.ooblen = len;
@@ -3413,7 +3413,7 @@ static int flexonenand_get_boundary(struct mtd_info *mtd) · 398 unmodified lines
34133413 this->boundary[die] = bdry & FLEXONENAND_PI_MASK;
34143414
34153415 this->command(mtd, ONENAND_CMD_RESET, 0, 0);
3416− this->wait(mtd, FL_RESETING);
3416+ this->wait(mtd, FL_RESETTING);
34173417
34183418 printk(KERN_INFO "Die %d boundary: %d%s\n", die,
34193419 this->boundary[die], locked ? "(Locked)" : "(Unlocked)");
@@ -3635,7 +3635,7 @@ static int flexonenand_set_boundary(struct mtd_info *mtd, int die, · 215 unmodified lines
36353635 ret = this->wait(mtd, FL_WRITING);
36363636 out:
36373637 this->write_word(ONENAND_CMD_RESET, this->base + ONENAND_REG_COMMAND);
3638− this->wait(mtd, FL_RESETING);
3638+ this->wait(mtd, FL_RESETTING);
36393639 if (!ret)
36403640 /* Recalculate device size on boundary change*/
36413641 flexonenand_get_size(mtd);
@@ -3671,7 +3671,7 @@ static int onenand_chip_probe(struct mtd_info *mtd) · 29 unmodified lines
36713671 /* Reset OneNAND to read default register values */
36723672 this->write_word(ONENAND_CMD_RESET, this->base + ONENAND_BOOTRAM);
36733673 /* Wait reset */
3674− this->wait(mtd, FL_RESETING);
3674+ this->wait(mtd, FL_RESETTING);
36753675
36763676 /* Restore system configuration 1 */
36773677 this->write_word(syscfg, this->base + ONENAND_REG_SYS_CFG1);
drivers/mtd/nand/onenand/samsung_mtd.c+4−4
@@ -675,12 +675,12 @@ static int s5pc110_read_bufferram(struct mtd_info *mtd, int area, · 674 unmodified lines
675675 normal:
676676 if (count != mtd->writesize) {
677677 /* Copy the bufferram to memory to prevent unaligned access */
678− memcpy(this->page_buf, p, mtd->writesize);
679− p = this->page_buf + offset;
678+ memcpy_fromio(this->page_buf, p, mtd->writesize);
679+ memcpy(buffer, this->page_buf + offset, count);
680+ } else {
681+ memcpy_fromio(buffer, p, count);
680682 }
681683
682− memcpy(buffer, p, count);
683−
684684 return 0;
685685 }
686686
drivers/mtd/nand/raw/cadence-nand-controller.c+6−7
@@ -914,8 +914,8 @@ static void cadence_nand_get_caps(struct cdns_nand_ctrl *cdns_ctrl) · 913 unmodified lines
914914 /* Prepare CDMA descriptor. */
915915 static void
916916 cadence_nand_cdma_desc_prepare(struct cdns_nand_ctrl *cdns_ctrl,
917− char nf_mem, u32 flash_ptr, char *mem_ptr,
918− char *ctrl_data_ptr, u16 ctype)
917+ char nf_mem, u32 flash_ptr, dma_addr_t mem_ptr,
918+ dma_addr_t ctrl_data_ptr, u16 ctype)
919919 {
920920 struct cadence_nand_cdma_desc *cdma_desc = cdns_ctrl->cdma_desc;
921921
@@ -931,13 +931,13 @@ cadence_nand_cdma_desc_prepare(struct cdns_nand_ctrl *cdns_ctrl, · 9 unmodified lines
931931 cdma_desc->command_flags |= CDMA_CF_DMA_MASTER;
932932 cdma_desc->command_flags |= CDMA_CF_INT;
933933
934− cdma_desc->memory_pointer = (uintptr_t)mem_ptr;
934+ cdma_desc->memory_pointer = mem_ptr;
935935 cdma_desc->status = 0;
936936 cdma_desc->sync_flag_pointer = 0;
937937 cdma_desc->sync_arguments = 0;
938938
939939 cdma_desc->command_type = ctype;
940− cdma_desc->ctrl_data_ptr = (uintptr_t)ctrl_data_ptr;
940+ cdma_desc->ctrl_data_ptr = ctrl_data_ptr;
941941 }
942942
943943 static u8 cadence_nand_check_desc_error(struct cdns_nand_ctrl *cdns_ctrl,
@@ -1280,8 +1280,7 @@ cadence_nand_cdma_transfer(struct cdns_nand_ctrl *cdns_ctrl, u8 chip_nr, · 336 unmodified lines
12801280 }
12811281
12821282 cadence_nand_cdma_desc_prepare(cdns_ctrl, chip_nr, page,
1283− (void *)dma_buf, (void *)dma_ctrl_dat,
1284− ctype);
1283+ dma_buf, dma_ctrl_dat, ctype);
12851284
12861285 status = cadence_nand_cdma_send_and_wait(cdns_ctrl, thread_nr);
12871286
@@ -1360,7 +1359,7 @@ static int cadence_nand_erase(struct nand_chip *chip, u32 page) · 72 unmodified lines
13601359
13611360 cadence_nand_cdma_desc_prepare(cdns_ctrl,
13621361 cdns_chip->cs[chip->cur_cs],
1363− page, NULL, NULL,
1362+ page, 0, 0,
13641363 CDMA_CT_ERASE);
13651364 status = cadence_nand_cdma_send_and_wait(cdns_ctrl, thread_nr);
13661365 if (status) {
drivers/mtd/nand/raw/stm32_fmc2_nand.c+36−2
@@ -37,6 +37,7 @@ · 36 unmodified lines
3737 /* Max ECC buffer length */
3838 #define FMC2_MAX_ECC_BUF_LEN (FMC2_BCHDSRS_LEN * FMC2_MAX_SG)
3939
40+#define FMC2_TIMEOUT_US 1000
4041 #define FMC2_TIMEOUT_MS 1000
4142
4243 /* Timings */
@@ -53,6 +54,8 @@ · 10 unmodified lines
5354 #define FMC2_PMEM 0x88
5455 #define FMC2_PATT 0x8c
5556 #define FMC2_HECCR 0x94
57+#define FMC2_ISR 0x184
58+#define FMC2_ICR 0x188
5659 #define FMC2_CSQCR 0x200
5760 #define FMC2_CSQCFGR1 0x204
5861 #define FMC2_CSQCFGR2 0x208
@@ -118,6 +121,12 @@ · 59 unmodified lines
118121 #define FMC2_PATT_ATTHIZ(x) (((x) & 0xff) << 24)
119122 #define FMC2_PATT_DEFAULT 0x0a0a0a0a
120123
124+/* Register: FMC2_ISR */
125+#define FMC2_ISR_IHLF BIT(1)
126+
127+/* Register: FMC2_ICR */
128+#define FMC2_ICR_CIHLF BIT(1)
129+
121130 /* Register: FMC2_CSQCR */
122131 #define FMC2_CSQCR_CSQSTART BIT(0)
123132
@@ -1322,6 +1331,31 @@ static void stm32_fmc2_write_data(struct nand_chip *chip, const void *buf, · 1198 unmodified lines
13221331 stm32_fmc2_set_buswidth_16(fmc2, true);
13231332 }
13241333
1334+static int stm32_fmc2_waitrdy(struct nand_chip *chip, unsigned long timeout_ms)
1335+{
1336+ struct stm32_fmc2_nfc *fmc2 = to_stm32_nfc(chip->controller);
1337+ const struct nand_sdr_timings *timings;
1338+ u32 isr, sr;
1339+
1340+ /* Check if there is no pending requests to the NAND flash */
1341+ if (readl_relaxed_poll_timeout_atomic(fmc2->io_base + FMC2_SR, sr,
1342+ sr & FMC2_SR_NWRF, 1,
1343+ FMC2_TIMEOUT_US))
1344+ dev_warn(fmc2->dev, "Waitrdy timeout\n");
1345+
1346+ /* Wait tWB before R/B# signal is low */
1347+ timings = nand_get_sdr_timings(&chip->data_interface);
1348+ ndelay(PSEC_TO_NSEC(timings->tWB_max));
1349+
1350+ /* R/B# signal is low, clear high level flag */
1351+ writel_relaxed(FMC2_ICR_CIHLF, fmc2->io_base + FMC2_ICR);
1352+
1353+ /* Wait R/B# signal is high */
1354+ return readl_relaxed_poll_timeout_atomic(fmc2->io_base + FMC2_ISR,
1355+ isr, isr & FMC2_ISR_IHLF,
1356+ 5, 1000 * timeout_ms);
1357+}
1358+
13251359 static int stm32_fmc2_exec_op(struct nand_chip *chip,
13261360 const struct nand_operation *op,
13271361 bool check_only)
@@ -1366,8 +1400,8 @@ static int stm32_fmc2_exec_op(struct nand_chip *chip, · 38 unmodified lines
13661400 break;
13671401
13681402 case NAND_OP_WAITRDY_INSTR:
1369− ret = nand_soft_waitrdy(chip,
1370− instr->ctx.waitrdy.timeout_ms);
1403+ ret = stm32_fmc2_waitrdy(chip,
1404+ instr->ctx.waitrdy.timeout_ms);
13711405 break;
13721406 }
13731407 }
drivers/mtd/sm_ftl.c+2−1
@@ -247,7 +247,8 @@ static int sm_read_sector(struct sm_ftl *ftl, · 246 unmodified lines
247247
248248 /* FTL can contain -1 entries that are by default filled with bits */
249249 if (block == -1) {
250− memset(buffer, 0xFF, SM_SECTOR_SIZE);
250+ if (buffer)
251+ memset(buffer, 0xFF, SM_SECTOR_SIZE);
251252 return 0;
252253 }
253254
drivers/mtd/spi-nor/spi-nor.c+1−0
@@ -4596,6 +4596,7 @@ static void sst_set_default_init(struct spi_nor *nor) · 4595 unmodified lines
45964596 static void st_micron_set_default_init(struct spi_nor *nor)
45974597 {
45984598 nor->flags |= SNOR_F_HAS_LOCK;
4599+ nor->flags &= ~SNOR_F_HAS_16BIT_SR;
45994600 nor->params.quad_enable = NULL;
46004601 nor->params.set_4byte = st_micron_set_4byte;
46014602 }
drivers/net/can/m_can/tcan4x5x.c+53−10
@@ -102,6 +102,7 @@ · 101 unmodified lines
102102 #define TCAN4X5X_MODE_NORMAL BIT(7)
103103
104104 #define TCAN4X5X_DISABLE_WAKE_MSK (BIT(31) | BIT(30))
105+#define TCAN4X5X_DISABLE_INH_MSK BIT(9)
105106
106107 #define TCAN4X5X_SW_RESET BIT(2)
107108
@@ -166,6 +167,28 @@ static void tcan4x5x_check_wake(struct tcan4x5x_priv *priv) · 58 unmodified lines
166167 }
167168 }
168169
170+static int tcan4x5x_reset(struct tcan4x5x_priv *priv)
171+{
172+ int ret = 0;
173+
174+ if (priv->reset_gpio) {
175+ gpiod_set_value(priv->reset_gpio, 1);
176+
177+ /* tpulse_width minimum 30us */
178+ usleep_range(30, 100);
179+ gpiod_set_value(priv->reset_gpio, 0);
180+ } else {
181+ ret = regmap_write(priv->regmap, TCAN4X5X_CONFIG,
182+ TCAN4X5X_SW_RESET);
183+ if (ret)
184+ return ret;
185+ }
186+
187+ usleep_range(700, 1000);
188+
189+ return ret;
190+}
191+
169192 static int regmap_spi_gather_write(void *context, const void *reg,
170193 size_t reg_len, const void *val,
171194 size_t val_len)
@@ -348,14 +371,23 @@ static int tcan4x5x_disable_wake(struct m_can_classdev *cdev) · 176 unmodified lines
348371 TCAN4X5X_DISABLE_WAKE_MSK, 0x00);
349372 }
350373
374+static int tcan4x5x_disable_state(struct m_can_classdev *cdev)
375+{
376+ struct tcan4x5x_priv *tcan4x5x = cdev->device_data;
377+
378+ return regmap_update_bits(tcan4x5x->regmap, TCAN4X5X_CONFIG,
379+ TCAN4X5X_DISABLE_INH_MSK, 0x01);
380+}
381+
351382 static int tcan4x5x_parse_config(struct m_can_classdev *cdev)
352383 {
353384 struct tcan4x5x_priv *tcan4x5x = cdev->device_data;
385+ int ret;
354386
355387 tcan4x5x->device_wake_gpio = devm_gpiod_get(cdev->dev, "device-wake",
356388 GPIOD_OUT_HIGH);
357389 if (IS_ERR(tcan4x5x->device_wake_gpio)) {
358− if (PTR_ERR(tcan4x5x->power) == -EPROBE_DEFER)
390+ if (PTR_ERR(tcan4x5x->device_wake_gpio) == -EPROBE_DEFER)
359391 return -EPROBE_DEFER;
360392
361393 tcan4x5x_disable_wake(cdev);
@@ -366,18 +398,17 @@ static int tcan4x5x_parse_config(struct m_can_classdev *cdev) · 4 unmodified lines
366398 if (IS_ERR(tcan4x5x->reset_gpio))
367399 tcan4x5x->reset_gpio = NULL;
368400
369− usleep_range(700, 1000);
401+ ret = tcan4x5x_reset(tcan4x5x);
402+ if (ret)
403+ return ret;
370404
371405 tcan4x5x->device_state_gpio = devm_gpiod_get_optional(cdev->dev,
372406 "device-state",
373407 GPIOD_IN);
374− if (IS_ERR(tcan4x5x->device_state_gpio))
408+ if (IS_ERR(tcan4x5x->device_state_gpio)) {
375409 tcan4x5x->device_state_gpio = NULL;
376−
377− tcan4x5x->power = devm_regulator_get_optional(cdev->dev,
378− "vsup");
379− if (PTR_ERR(tcan4x5x->power) == -EPROBE_DEFER)
380− return -EPROBE_DEFER;
410+ tcan4x5x_disable_state(cdev);
411+ }
381412
382413 return 0;
383414 }
@@ -412,6 +443,12 @@ static int tcan4x5x_can_probe(struct spi_device *spi) · 28 unmodified lines
412443 if (!priv)
413444 return -ENOMEM;
414445
446+ priv->power = devm_regulator_get_optional(&spi->dev, "vsup");
447+ if (PTR_ERR(priv->power) == -EPROBE_DEFER)
448+ return -EPROBE_DEFER;
449+ else
450+ priv->power = NULL;
451+
415452 mcan_class->device_data = priv;
416453
417454 m_can_class_get_clocks(mcan_class);
@@ -451,11 +488,17 @@ static int tcan4x5x_can_probe(struct spi_device *spi) · 33 unmodified lines
451488 priv->regmap = devm_regmap_init(&spi->dev, &tcan4x5x_bus,
452489 &spi->dev, &tcan4x5x_regmap);
453490
454− ret = tcan4x5x_parse_config(mcan_class);
491+ ret = tcan4x5x_power_enable(priv->power, 1);
455492 if (ret)
456493 goto out_clk;
457494
458− tcan4x5x_power_enable(priv->power, 1);
495+ ret = tcan4x5x_parse_config(mcan_class);
496+ if (ret)
497+ goto out_power;
498+
499+ ret = tcan4x5x_init(mcan_class);
500+ if (ret)
501+ goto out_power;
459502
460503 ret = m_can_class_register(mcan_class);
461504 if (ret)
drivers/net/can/mscan/mscan.c+10−11
@@ -381,13 +381,12 @@ static int mscan_rx_poll(struct napi_struct *napi, int quota) · 380 unmodified lines
381381 struct net_device *dev = napi->dev;
382382 struct mscan_regs __iomem *regs = priv->reg_base;
383383 struct net_device_stats *stats = &dev->stats;
384− int npackets = 0;
385− int ret = 1;
384+ int work_done = 0;
386385 struct sk_buff *skb;
387386 struct can_frame *frame;
388387 u8 canrflg;
389388
390− while (npackets < quota) {
389+ while (work_done < quota) {
391390 canrflg = in_8(&regs->canrflg);
392391 if (!(canrflg & (MSCAN_RXF | MSCAN_ERR_IF)))
393392 break;
@@ -408,18 +407,18 @@ static int mscan_rx_poll(struct napi_struct *napi, int quota) · 14 unmodified lines
408407
409408 stats->rx_packets++;
410409 stats->rx_bytes += frame->can_dlc;
411− npackets++;
410+ work_done++;
412411 netif_receive_skb(skb);
413412 }
414413
415− if (!(in_8(&regs->canrflg) & (MSCAN_RXF | MSCAN_ERR_IF))) {
416− napi_complete(&priv->napi);
417− clear_bit(F_RX_PROGRESS, &priv->flags);
418− if (priv->can.state < CAN_STATE_BUS_OFF)
419− out_8(&regs->canrier, priv->shadow_canrier);
420− ret = 0;
414+ if (work_done < quota) {
415+ if (likely(napi_complete_done(&priv->napi, work_done))) {
416+ clear_bit(F_RX_PROGRESS, &priv->flags);
417+ if (priv->can.state < CAN_STATE_BUS_OFF)
418+ out_8(&regs->canrier, priv->shadow_canrier);
419+ }
421420 }
422− return ret;
421+ return work_done;
423422 }
424423
425424 static irqreturn_t mscan_isr(int irq, void *dev_id)
drivers/net/can/usb/gs_usb.c+2−2
@@ -918,7 +918,7 @@ static int gs_usb_probe(struct usb_interface *intf, · 917 unmodified lines
918918 GS_USB_BREQ_HOST_FORMAT,
919919 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
920920 1,
921− intf->altsetting[0].desc.bInterfaceNumber,
921+ intf->cur_altsetting->desc.bInterfaceNumber,
922922 hconf,
923923 sizeof(*hconf),
924924 1000);
@@ -941,7 +941,7 @@ static int gs_usb_probe(struct usb_interface *intf, · 16 unmodified lines
941941 GS_USB_BREQ_DEVICE_CONFIG,
942942 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
943943 1,
944− intf->altsetting[0].desc.bInterfaceNumber,
944+ intf->cur_altsetting->desc.bInterfaceNumber,
945945 dconf,
946946 sizeof(*dconf),
947947 1000);
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c+1−1
@@ -1590,7 +1590,7 @@ static int kvaser_usb_hydra_setup_endpoints(struct kvaser_usb *dev) · 1589 unmodified lines
15901590 struct usb_endpoint_descriptor *ep;
15911591 int i;
15921592
1593− iface_desc = &dev->intf->altsetting[0];
1593+ iface_desc = dev->intf->cur_altsetting;
15941594
15951595 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
15961596 ep = &iface_desc->endpoint[i].desc;
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c+1−1
@@ -1310,7 +1310,7 @@ static int kvaser_usb_leaf_setup_endpoints(struct kvaser_usb *dev) · 1309 unmodified lines
13101310 struct usb_endpoint_descriptor *endpoint;
13111311 int i;
13121312
1313− iface_desc = &dev->intf->altsetting[0];
1313+ iface_desc = dev->intf->cur_altsetting;
13141314
13151315 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
13161316 endpoint = &iface_desc->endpoint[i].desc;
drivers/net/dsa/bcm_sf2_cfp.c+3−3
@@ -358,7 +358,7 @@ static int bcm_sf2_cfp_ipv4_rule_set(struct bcm_sf2_priv *priv, int port, · 357 unmodified lines
358358 return -EINVAL;
359359 }
360360
361− ip_frag = be32_to_cpu(fs->m_ext.data[0]);
361+ ip_frag = !!(be32_to_cpu(fs->h_ext.data[0]) & 1);
362362
363363 /* Locate the first rule available */
364364 if (fs->location == RX_CLS_LOC_ANY)
@@ -569,7 +569,7 @@ static int bcm_sf2_cfp_rule_cmp(struct bcm_sf2_priv *priv, int port, · 204 unmodified lines
569569
570570 if (rule->fs.flow_type != fs->flow_type ||
571571 rule->fs.ring_cookie != fs->ring_cookie ||
572− rule->fs.m_ext.data[0] != fs->m_ext.data[0])
572+ rule->fs.h_ext.data[0] != fs->h_ext.data[0])
573573 continue;
574574
575575 switch (fs->flow_type & ~FLOW_EXT) {
@@ -621,7 +621,7 @@ static int bcm_sf2_cfp_ipv6_rule_set(struct bcm_sf2_priv *priv, int port, · 45 unmodified lines
621621 return -EINVAL;
622622 }
623623
624− ip_frag = be32_to_cpu(fs->m_ext.data[0]);
624+ ip_frag = !!(be32_to_cpu(fs->h_ext.data[0]) & 1);
625625
626626 layout = &udf_tcpip6_layout;
627627 slice_num = bcm_sf2_get_slice_number(layout, 0);
drivers/net/dsa/mv88e6xxx/global1.c+5−0
@@ -360,6 +360,11 @@ int mv88e6390_g1_set_cpu_port(struct mv88e6xxx_chip *chip, int port) · 359 unmodified lines
360360 {
361361 u16 ptr = MV88E6390_G1_MONITOR_MGMT_CTL_PTR_CPU_DEST;
362362
363+ /* Use the default high priority for management frames sent to
364+ * the CPU.
365+ */
366+ port |= MV88E6390_G1_MONITOR_MGMT_CTL_PTR_CPU_DEST_MGMTPRI;
367+
363368 return mv88e6390_g1_monitor_write(chip, ptr, port);
364369 }
365370
drivers/net/dsa/mv88e6xxx/global1.h+1−0
@@ -211,6 +211,7 @@ · 210 unmodified lines
211211 #define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_INGRESS_DEST 0x2000
212212 #define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_EGRESS_DEST 0x2100
213213 #define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_CPU_DEST 0x3000
214+#define MV88E6390_G1_MONITOR_MGMT_CTL_PTR_CPU_DEST_MGMTPRI 0x00e0
214215 #define MV88E6390_G1_MONITOR_MGMT_CTL_DATA_MASK 0x00ff
215216
216217 /* Offset 0x1C: Global Control 2 */
drivers/net/dsa/mv88e6xxx/port.c+6−6
@@ -393,7 +393,7 @@ phy_interface_t mv88e6390x_port_max_speed_mode(int port) · 392 unmodified lines
393393 }
394394
395395 static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
396− phy_interface_t mode)
396+ phy_interface_t mode, bool force)
397397 {
398398 u8 lane;
399399 u16 cmode;
@@ -427,8 +427,8 @@ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port, · 27 unmodified lines
427427 cmode = 0;
428428 }
429429
430− /* cmode doesn't change, nothing to do for us */
431− if (cmode == chip->ports[port].cmode)
430+ /* cmode doesn't change, nothing to do for us unless forced */
431+ if (cmode == chip->ports[port].cmode && !force)
432432 return 0;
433433
434434 lane = mv88e6xxx_serdes_get_lane(chip, port);
@@ -484,7 +484,7 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, · 49 unmodified lines
484484 if (port != 9 && port != 10)
485485 return -EOPNOTSUPP;
486486
487− return mv88e6xxx_port_set_cmode(chip, port, mode);
487+ return mv88e6xxx_port_set_cmode(chip, port, mode, false);
488488 }
489489
490490 int mv88e6390_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
@@ -504,7 +504,7 @@ int mv88e6390_port_set_cmode(struct mv88e6xxx_chip *chip, int port, · 13 unmodified lines
504504 break;
505505 }
506506
507− return mv88e6xxx_port_set_cmode(chip, port, mode);
507+ return mv88e6xxx_port_set_cmode(chip, port, mode, false);
508508 }
509509
510510 static int mv88e6341_port_set_cmode_writable(struct mv88e6xxx_chip *chip,
@@ -555,7 +555,7 @@ int mv88e6341_port_set_cmode(struct mv88e6xxx_chip *chip, int port, · 44 unmodified lines
555555 if (err)
556556 return err;
557557
558− return mv88e6xxx_port_set_cmode(chip, port, mode);
558+ return mv88e6xxx_port_set_cmode(chip, port, mode, true);
559559 }
560560
561561 int mv88e6185_port_get_cmode(struct mv88e6xxx_chip *chip, int port, u8 *cmode)
drivers/net/dsa/sja1105/sja1105_main.c+5−5
@@ -1569,8 +1569,8 @@ static int sja1105_vlan_filtering(struct dsa_switch *ds, int port, bool enabled) · 1568 unmodified lines
15691569
15701570 if (enabled) {
15711571 /* Enable VLAN filtering. */
1572− tpid = ETH_P_8021AD;
1573− tpid2 = ETH_P_8021Q;
1572+ tpid = ETH_P_8021Q;
1573+ tpid2 = ETH_P_8021AD;
15741574 } else {
15751575 /* Disable VLAN filtering. */
15761576 tpid = ETH_P_SJA1105;
@@ -1579,9 +1579,9 @@ static int sja1105_vlan_filtering(struct dsa_switch *ds, int port, bool enabled) · 2 unmodified lines
15791579
15801580 table = &priv->static_config.tables[BLK_IDX_GENERAL_PARAMS];
15811581 general_params = table->entries;
1582− /* EtherType used to identify outer tagged (S-tag) VLAN traffic */
1583− general_params->tpid = tpid;
15841582 /* EtherType used to identify inner tagged (C-tag) VLAN traffic */
1583+ general_params->tpid = tpid;
1584+ /* EtherType used to identify outer tagged (S-tag) VLAN traffic */
15851585 general_params->tpid2 = tpid2;
15861586 /* When VLAN filtering is on, we need to at least be able to
15871587 * decode management traffic through the "backup plan".
@@ -1855,7 +1855,7 @@ static netdev_tx_t sja1105_port_deferred_xmit(struct dsa_switch *ds, int port, · 267 unmodified lines
18551855 if (!clone)
18561856 goto out;
18571857
1858− sja1105_ptp_txtstamp_skb(ds, slot, clone);
1858+ sja1105_ptp_txtstamp_skb(ds, port, clone);
18591859
18601860 out:
18611861 mutex_unlock(&priv->mgmt_lock);
drivers/net/dsa/sja1105/sja1105_ptp.c+3−3
@@ -234,7 +234,7 @@ int sja1105_ptp_commit(struct dsa_switch *ds, struct sja1105_ptp_cmd *cmd, · 233 unmodified lines
234234 if (rw == SPI_WRITE)
235235 priv->info->ptp_cmd_packing(buf, cmd, PACK);
236236
237− rc = sja1105_xfer_buf(priv, SPI_WRITE, regs->ptp_control, buf,
237+ rc = sja1105_xfer_buf(priv, rw, regs->ptp_control, buf,
238238 SJA1105_SIZE_PTP_CMD);
239239
240240 if (rw == SPI_READ)
@@ -659,7 +659,7 @@ void sja1105_ptp_clock_unregister(struct dsa_switch *ds) · 418 unmodified lines
659659 ptp_data->clock = NULL;
660660 }
661661
662−void sja1105_ptp_txtstamp_skb(struct dsa_switch *ds, int slot,
662+void sja1105_ptp_txtstamp_skb(struct dsa_switch *ds, int port,
663663 struct sk_buff *skb)
664664 {
665665 struct sja1105_private *priv = ds->priv;
@@ -679,7 +679,7 @@ void sja1105_ptp_txtstamp_skb(struct dsa_switch *ds, int slot, · 13 unmodified lines
679679 goto out;
680680 }
681681
682− rc = sja1105_ptpegr_ts_poll(ds, slot, &ts);
682+ rc = sja1105_ptpegr_ts_poll(ds, port, &ts);
683683 if (rc < 0) {
684684 dev_err(ds->dev, "timed out polling for tstamp\n");
685685 kfree_skb(skb);
drivers/net/dsa/sja1105/sja1105_static_config.c+5−2
@@ -142,6 +142,9 @@ static size_t sja1105et_general_params_entry_packing(void *buf, void *entry_ptr, · 141 unmodified lines
142142 return size;
143143 }
144144
145+/* TPID and TPID2 are intentionally reversed so that semantic
146+ * compatibility with E/T is kept.
147+ */
145148 static size_t
146149 sja1105pqrs_general_params_entry_packing(void *buf, void *entry_ptr,
147150 enum packing_op op)
@@ -166,9 +169,9 @@ sja1105pqrs_general_params_entry_packing(void *buf, void *entry_ptr, · 18 unmodified lines
166169 sja1105_packing(buf, &entry->mirr_port, 141, 139, size, op);
167170 sja1105_packing(buf, &entry->vlmarker, 138, 107, size, op);
168171 sja1105_packing(buf, &entry->vlmask, 106, 75, size, op);
169− sja1105_packing(buf, &entry->tpid, 74, 59, size, op);
172+ sja1105_packing(buf, &entry->tpid2, 74, 59, size, op);
170173 sja1105_packing(buf, &entry->ignore2stf, 58, 58, size, op);
171− sja1105_packing(buf, &entry->tpid2, 57, 42, size, op);
174+ sja1105_packing(buf, &entry->tpid, 57, 42, size, op);
172175 sja1105_packing(buf, &entry->queue_ts, 41, 41, size, op);
173176 sja1105_packing(buf, &entry->egrmirrvid, 40, 29, size, op);
174177 sja1105_packing(buf, &entry->egrmirrpcp, 28, 26, size, op);
drivers/net/dsa/sja1105/sja1105_tas.c+0−5
@@ -477,11 +477,6 @@ int sja1105_setup_tc_taprio(struct dsa_switch *ds, int port, · 476 unmodified lines
477477 if (admin->cycle_time_extension)
478478 return -ENOTSUPP;
479479
480− if (!ns_to_sja1105_delta(admin->base_time)) {
481− dev_err(ds->dev, "A base time of zero is not hardware-allowed\n");
482− return -ERANGE;
483− }
484−
485480 for (i = 0; i < admin->num_entries; i++) {
486481 s64 delta_ns = admin->entries[i].interval;
487482 s64 delta_cycles = ns_to_sja1105_delta(delta_ns);
drivers/net/ethernet/aquantia/atlantic/aq_nic.c+2−2
@@ -403,6 +403,8 @@ int aq_nic_start(struct aq_nic_s *self) · 402 unmodified lines
403403 if (err < 0)
404404 goto err_exit;
405405
406+ aq_nic_set_loopback(self);
407+
406408 err = self->aq_hw_ops->hw_start(self->aq_hw);
407409 if (err < 0)
408410 goto err_exit;
@@ -413,8 +415,6 @@ int aq_nic_start(struct aq_nic_s *self) · 4 unmodified lines
413415
414416 INIT_WORK(&self->service_task, aq_nic_service_task);
415417
416− aq_nic_set_loopback(self);
417−
418418 timer_setup(&self->service_timer, aq_nic_service_timer_cb, 0);
419419 aq_nic_service_timer_cb(&self->service_timer);
420420
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c+0−3
@@ -1525,9 +1525,6 @@ const struct aq_hw_ops hw_atl_ops_b0 = { · 1524 unmodified lines
15251525 .rx_extract_ts = hw_atl_b0_rx_extract_ts,
15261526 .extract_hwts = hw_atl_b0_extract_hwts,
15271527 .hw_set_offload = hw_atl_b0_hw_offload_set,
1528− .hw_get_hw_stats = hw_atl_utils_get_hw_stats,
1529− .hw_get_fw_version = hw_atl_utils_get_fw_version,
1530− .hw_set_offload = hw_atl_b0_hw_offload_set,
15311528 .hw_set_loopback = hw_atl_b0_set_loopback,
15321529 .hw_set_fc = hw_atl_b0_set_fc,
15331530 };
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c+1−3
@@ -667,9 +667,7 @@ int hw_atl_utils_mpi_get_link_status(struct aq_hw_s *self) · 666 unmodified lines
667667 u32 speed;
668668
669669 mpi_state = hw_atl_utils_mpi_get_state(self);
670− speed = mpi_state & (FW2X_RATE_100M | FW2X_RATE_1G |
671− FW2X_RATE_2G5 | FW2X_RATE_5G |
672− FW2X_RATE_10G);
670+ speed = mpi_state >> HW_ATL_MPI_SPEED_SHIFT;
673671
674672 if (!speed) {
675673 link_status->mbps = 0U;
drivers/net/ethernet/broadcom/b44.c+6−3
@@ -1516,8 +1516,10 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset) · 1515 unmodified lines
15161516 int ethaddr_bytes = ETH_ALEN;
15171517
15181518 memset(ppattern + offset, 0xff, magicsync);
1519− for (j = 0; j < magicsync; j++)
1520− set_bit(len++, (unsigned long *) pmask);
1519+ for (j = 0; j < magicsync; j++) {
1520+ pmask[len >> 3] |= BIT(len & 7);
1521+ len++;
1522+ }
15211523
15221524 for (j = 0; j < B44_MAX_PATTERNS; j++) {
15231525 if ((B44_PATTERN_SIZE - len) >= ETH_ALEN)
@@ -1529,7 +1531,8 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset) · 5 unmodified lines
15291531 for (k = 0; k< ethaddr_bytes; k++) {
15301532 ppattern[offset + magicsync +
15311533 (j * ETH_ALEN) + k] = macaddr[k];
1532− set_bit(len++, (unsigned long *) pmask);
1534+ pmask[len >> 3] |= BIT(len & 7);
1535+ len++;
15331536 }
15341537 }
15351538 return len - 1;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h+4−1
@@ -1536,8 +1536,11 @@ void bnx2x_get_rss_ind_table(struct bnx2x_rss_config_obj *rss_obj, · 1535 unmodified lines
15361536 ((MAX_MAC_CREDIT_E2 - GET_NUM_VFS_PER_PATH(bp) * VF_MAC_CREDIT_CNT) / \
15371537 func_num + GET_NUM_VFS_PER_PF(bp) * VF_MAC_CREDIT_CNT)
15381538
1539+#define BNX2X_VFS_VLAN_CREDIT(bp) \
1540+ (GET_NUM_VFS_PER_PATH(bp) * VF_VLAN_CREDIT_CNT)
1541+
15391542 #define PF_VLAN_CREDIT_E2(bp, func_num) \
1540− ((MAX_MAC_CREDIT_E2 - GET_NUM_VFS_PER_PATH(bp) * VF_VLAN_CREDIT_CNT) / \
1543+ ((MAX_VLAN_CREDIT_E2 - 1 - BNX2X_VFS_VLAN_CREDIT(bp)) / \
15411544 func_num + GET_NUM_VFS_PER_PF(bp) * VF_VLAN_CREDIT_CNT)
15421545
15431546 #endif /* BNX2X_SP_VERBS */
drivers/net/ethernet/cadence/macb_main.c+1−3
@@ -4088,7 +4088,7 @@ static int fu540_c000_clk_init(struct platform_device *pdev, struct clk **pclk, · 4087 unmodified lines
40884088 mgmt->rate = 0;
40894089 mgmt->hw.init = &init;
40904090
4091− *tx_clk = clk_register(NULL, &mgmt->hw);
4091+ *tx_clk = devm_clk_register(&pdev->dev, &mgmt->hw);
40924092 if (IS_ERR(*tx_clk))
40934093 return PTR_ERR(*tx_clk);
40944094
@@ -4416,7 +4416,6 @@ err_out_free_netdev: · 321 unmodified lines
44164416
44174417 err_disable_clocks:
44184418 clk_disable_unprepare(tx_clk);
4419− clk_unregister(tx_clk);
44204419 clk_disable_unprepare(hclk);
44214420 clk_disable_unprepare(pclk);
44224421 clk_disable_unprepare(rx_clk);
@@ -4446,7 +4445,6 @@ static int macb_remove(struct platform_device *pdev) · 23 unmodified lines
44464445 pm_runtime_dont_use_autosuspend(&pdev->dev);
44474446 if (!pm_runtime_suspended(&pdev->dev)) {
44484447 clk_disable_unprepare(bp->tx_clk);
4449− clk_unregister(bp->tx_clk);
44504448 clk_disable_unprepare(bp->hclk);
44514449 clk_disable_unprepare(bp->pclk);
44524450 clk_disable_unprepare(bp->rx_clk);
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h+1−0
@@ -504,6 +504,7 @@ struct link_config { · 503 unmodified lines
504504
505505 enum cc_pause requested_fc; /* flow control user has requested */
506506 enum cc_pause fc; /* actual link flow control */
507+ enum cc_pause advertised_fc; /* actual advertised flow control */
507508
508509 enum cc_fec requested_fec; /* Forward Error Correction: */
509510 enum cc_fec fec; /* requested and actual in use */
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c+2−2
@@ -807,8 +807,8 @@ static void get_pauseparam(struct net_device *dev, · 806 unmodified lines
807807 struct port_info *p = netdev_priv(dev);
808808
809809 epause->autoneg = (p->link_cfg.requested_fc & PAUSE_AUTONEG) != 0;
810− epause->rx_pause = (p->link_cfg.fc & PAUSE_RX) != 0;
811− epause->tx_pause = (p->link_cfg.fc & PAUSE_TX) != 0;
810+ epause->rx_pause = (p->link_cfg.advertised_fc & PAUSE_RX) != 0;
811+ epause->tx_pause = (p->link_cfg.advertised_fc & PAUSE_TX) != 0;
812812 }
813813
814814 static int set_pauseparam(struct net_device *dev,
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c+13−8
@@ -4089,7 +4089,8 @@ static inline fw_port_cap32_t cc_to_fwcap_pause(enum cc_pause cc_pause) · 4088 unmodified lines
40894089 if (cc_pause & PAUSE_TX)
40904090 fw_pause |= FW_PORT_CAP32_802_3_PAUSE;
40914091 else
4092− fw_pause |= FW_PORT_CAP32_802_3_ASM_DIR;
4092+ fw_pause |= FW_PORT_CAP32_802_3_ASM_DIR |
4093+ FW_PORT_CAP32_802_3_PAUSE;
40934094 } else if (cc_pause & PAUSE_TX) {
40944095 fw_pause |= FW_PORT_CAP32_802_3_ASM_DIR;
40954096 }
@@ -8563,17 +8564,17 @@ static fw_port_cap32_t lstatus_to_fwcap(u32 lstatus) · 4467 unmodified lines
85638564 void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl)
85648565 {
85658566 const struct fw_port_cmd *cmd = (const void *)rpl;
8566− int action = FW_PORT_CMD_ACTION_G(be32_to_cpu(cmd->action_to_len16));
8567− struct adapter *adapter = pi->adapter;
8567+ fw_port_cap32_t pcaps, acaps, lpacaps, linkattr;
85688568 struct link_config *lc = &pi->link_cfg;
8569− int link_ok, linkdnrc;
8570− enum fw_port_type port_type;
8569+ struct adapter *adapter = pi->adapter;
8570+ unsigned int speed, fc, fec, adv_fc;
85718571 enum fw_port_module_type mod_type;
8572− unsigned int speed, fc, fec;
8573− fw_port_cap32_t pcaps, acaps, lpacaps, linkattr;
8572+ int action, link_ok, linkdnrc;
8573+ enum fw_port_type port_type;
85748574
85758575 /* Extract the various fields from the Port Information message.
85768576 */
8577+ action = FW_PORT_CMD_ACTION_G(be32_to_cpu(cmd->action_to_len16));
85778578 switch (action) {
85788579 case FW_PORT_ACTION_GET_PORT_INFO: {
85798580 u32 lstatus = be32_to_cpu(cmd->u.info.lstatus_to_modtype);
@@ -8611,6 +8612,7 @@ void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl) · 31 unmodified lines
86118612 }
86128613
86138614 fec = fwcap_to_cc_fec(acaps);
8615+ adv_fc = fwcap_to_cc_pause(acaps);
86148616 fc = fwcap_to_cc_pause(linkattr);
86158617 speed = fwcap_to_speed(linkattr);
86168618
@@ -8667,7 +8669,9 @@ void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl) · 50 unmodified lines
86678669 }
86688670
86698671 if (link_ok != lc->link_ok || speed != lc->speed ||
8670− fc != lc->fc || fec != lc->fec) { /* something changed */
8672+ fc != lc->fc || adv_fc != lc->advertised_fc ||
8673+ fec != lc->fec) {
8674+ /* something changed */
86718675 if (!link_ok && lc->link_ok) {
86728676 lc->link_down_rc = linkdnrc;
86738677 dev_warn_ratelimited(adapter->pdev_dev,
@@ -8677,6 +8681,7 @@ void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl) · 3 unmodified lines
86778681 }
86788682 lc->link_ok = link_ok;
86798683 lc->speed = speed;
8684+ lc->advertised_fc = adv_fc;
86808685 lc->fc = fc;
86818686 lc->fec = fec;
86828687
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c+2−2
@@ -1690,8 +1690,8 @@ static void cxgb4vf_get_pauseparam(struct net_device *dev, · 1689 unmodified lines
16901690 struct port_info *pi = netdev_priv(dev);
16911691
16921692 pauseparam->autoneg = (pi->link_cfg.requested_fc & PAUSE_AUTONEG) != 0;
1693− pauseparam->rx_pause = (pi->link_cfg.fc & PAUSE_RX) != 0;
1694− pauseparam->tx_pause = (pi->link_cfg.fc & PAUSE_TX) != 0;
1693+ pauseparam->rx_pause = (pi->link_cfg.advertised_fc & PAUSE_RX) != 0;
1694+ pauseparam->tx_pause = (pi->link_cfg.advertised_fc & PAUSE_TX) != 0;
16951695 }
16961696
16971697 /*
drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h+1−0
@@ -135,6 +135,7 @@ struct link_config { · 134 unmodified lines
135135
136136 enum cc_pause requested_fc; /* flow control user has requested */
137137 enum cc_pause fc; /* actual link flow control */
138+ enum cc_pause advertised_fc; /* actual advertised flow control */
138139
139140 enum cc_fec auto_fec; /* Forward Error Correction: */
140141 enum cc_fec requested_fec; /* "automatic" (IEEE 802.3), */
drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c+11−7
@@ -1913,16 +1913,16 @@ static const char *t4vf_link_down_rc_str(unsigned char link_down_rc) · 1912 unmodified lines
19131913 static void t4vf_handle_get_port_info(struct port_info *pi,
19141914 const struct fw_port_cmd *cmd)
19151915 {
1916− int action = FW_PORT_CMD_ACTION_G(be32_to_cpu(cmd->action_to_len16));
1917− struct adapter *adapter = pi->adapter;
1916+ fw_port_cap32_t pcaps, acaps, lpacaps, linkattr;
19181917 struct link_config *lc = &pi->link_cfg;
1919− int link_ok, linkdnrc;
1920− enum fw_port_type port_type;
1918+ struct adapter *adapter = pi->adapter;
1919+ unsigned int speed, fc, fec, adv_fc;
19211920 enum fw_port_module_type mod_type;
1922− unsigned int speed, fc, fec;
1923− fw_port_cap32_t pcaps, acaps, lpacaps, linkattr;
1921+ int action, link_ok, linkdnrc;
1922+ enum fw_port_type port_type;
19241923
19251924 /* Extract the various fields from the Port Information message. */
1925+ action = FW_PORT_CMD_ACTION_G(be32_to_cpu(cmd->action_to_len16));
19261926 switch (action) {
19271927 case FW_PORT_ACTION_GET_PORT_INFO: {
19281928 u32 lstatus = be32_to_cpu(cmd->u.info.lstatus_to_modtype);
@@ -1982,6 +1982,7 @@ static void t4vf_handle_get_port_info(struct port_info *pi, · 53 unmodified lines
19821982 }
19831983
19841984 fec = fwcap_to_cc_fec(acaps);
1985+ adv_fc = fwcap_to_cc_pause(acaps);
19851986 fc = fwcap_to_cc_pause(linkattr);
19861987 speed = fwcap_to_speed(linkattr);
19871988
@@ -2012,7 +2013,9 @@ static void t4vf_handle_get_port_info(struct port_info *pi, · 24 unmodified lines
20122013 }
20132014
20142015 if (link_ok != lc->link_ok || speed != lc->speed ||
2015− fc != lc->fc || fec != lc->fec) { /* something changed */
2016+ fc != lc->fc || adv_fc != lc->advertised_fc ||
2017+ fec != lc->fec) {
2018+ /* something changed */
20162019 if (!link_ok && lc->link_ok) {
20172020 lc->link_down_rc = linkdnrc;
20182021 dev_warn_ratelimited(adapter->pdev_dev,
@@ -2022,6 +2025,7 @@ static void t4vf_handle_get_port_info(struct port_info *pi, · 3 unmodified lines
20222025 }
20232026 lc->link_ok = link_ok;
20242027 lc->speed = speed;
2028+ lc->advertised_fc = adv_fc;
20252029 lc->fc = fc;
20262030 lc->fec = fec;
20272031
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c+20−19
@@ -1719,7 +1719,7 @@ static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv, · 1718 unmodified lines
17191719 int page_offset;
17201720 unsigned int sz;
17211721 int *count_ptr;
1722− int i;
1722+ int i, j;
17231723
17241724 vaddr = phys_to_virt(addr);
17251725 WARN_ON(!IS_ALIGNED((unsigned long)vaddr, SMP_CACHE_BYTES));
@@ -1736,14 +1736,14 @@ static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv, · 10 unmodified lines
17361736 WARN_ON(!IS_ALIGNED((unsigned long)sg_vaddr,
17371737 SMP_CACHE_BYTES));
17381738
1739+ dma_unmap_page(priv->rx_dma_dev, sg_addr,
1740+ DPAA_BP_RAW_SIZE, DMA_FROM_DEVICE);
1741+
17391742 /* We may use multiple Rx pools */
17401743 dpaa_bp = dpaa_bpid2pool(sgt[i].bpid);
17411744 if (!dpaa_bp)
17421745 goto free_buffers;
17431746
1744− count_ptr = this_cpu_ptr(dpaa_bp->percpu_count);
1745− dma_unmap_page(priv->rx_dma_dev, sg_addr,
1746− DPAA_BP_RAW_SIZE, DMA_FROM_DEVICE);
17471747 if (!skb) {
17481748 sz = dpaa_bp->size +
17491749 SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
@@ -1786,7 +1786,9 @@ static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv, · 36 unmodified lines
17861786 skb_add_rx_frag(skb, i - 1, head_page, frag_off,
17871787 frag_len, dpaa_bp->size);
17881788 }
1789+
17891790 /* Update the pool count for the current {cpu x bpool} */
1791+ count_ptr = this_cpu_ptr(dpaa_bp->percpu_count);
17901792 (*count_ptr)--;
17911793
17921794 if (qm_sg_entry_is_final(&sgt[i]))
@@ -1800,26 +1802,25 @@ static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv, · 7 unmodified lines
18001802 return skb;
18011803
18021804 free_buffers:
1803− /* compensate sw bpool counter changes */
1804− for (i--; i >= 0; i--) {
1805− dpaa_bp = dpaa_bpid2pool(sgt[i].bpid);
1806− if (dpaa_bp) {
1807− count_ptr = this_cpu_ptr(dpaa_bp->percpu_count);
1808− (*count_ptr)++;
1809− }
1810− }
18111805 /* free all the SG entries */
1812− for (i = 0; i < DPAA_SGT_MAX_ENTRIES ; i++) {
1813− sg_addr = qm_sg_addr(&sgt[i]);
1806+ for (j = 0; j < DPAA_SGT_MAX_ENTRIES ; j++) {
1807+ sg_addr = qm_sg_addr(&sgt[j]);
18141808 sg_vaddr = phys_to_virt(sg_addr);
1809+ /* all pages 0..i were unmaped */
1810+ if (j > i)
1811+ dma_unmap_page(priv->rx_dma_dev, qm_sg_addr(&sgt[j]),
1812+ DPAA_BP_RAW_SIZE, DMA_FROM_DEVICE);
18151813 free_pages((unsigned long)sg_vaddr, 0);
1816− dpaa_bp = dpaa_bpid2pool(sgt[i].bpid);
1817− if (dpaa_bp) {
1818− count_ptr = this_cpu_ptr(dpaa_bp->percpu_count);
1819− (*count_ptr)--;
1814+ /* counters 0..i-1 were decremented */
1815+ if (j >= i) {
1816+ dpaa_bp = dpaa_bpid2pool(sgt[j].bpid);
1817+ if (dpaa_bp) {
1818+ count_ptr = this_cpu_ptr(dpaa_bp->percpu_count);
1819+ (*count_ptr)--;
1820+ }
18201821 }
18211822
1822− if (qm_sg_entry_is_final(&sgt[i]))
1823+ if (qm_sg_entry_is_final(&sgt[j]))
18231824 break;
18241825 }
18251826 /* free the SGT fragment */
drivers/net/ethernet/freescale/fec_main.c+9−0
@@ -2199,8 +2199,14 @@ static void fec_enet_get_regs(struct net_device *ndev, · 2198 unmodified lines
21992199 {
22002200 struct fec_enet_private *fep = netdev_priv(ndev);
22012201 u32 __iomem *theregs = (u32 __iomem *)fep->hwp;
2202+ struct device *dev = &fep->pdev->dev;
22022203 u32 *buf = (u32 *)regbuf;
22032204 u32 i, off;
2205+ int ret;
2206+
2207+ ret = pm_runtime_get_sync(dev);
2208+ if (ret < 0)
2209+ return;
22042210
22052211 regs->version = fec_enet_register_version;
22062212
@@ -2216,6 +2222,9 @@ static void fec_enet_get_regs(struct net_device *ndev, · 9 unmodified lines
22162222 off >>= 2;
22172223 buf[off] = readl(&theregs[off]);
22182224 }
2225+
2226+ pm_runtime_mark_last_busy(dev);
2227+ pm_runtime_put_autosuspend(dev);
22192228 }
22202229
22212230 static int fec_enet_get_ts_info(struct net_device *ndev,
drivers/net/ethernet/google/gve/gve_rx.c+0−2
@@ -418,8 +418,6 @@ bool gve_clean_rx_done(struct gve_rx_ring *rx, int budget, · 417 unmodified lines
418418 rx->cnt = cnt;
419419 rx->fill_cnt += work_done;
420420
421− /* restock desc ring slots */
422− dma_wmb(); /* Ensure descs are visible before ringing doorbell */
423421 gve_rx_write_doorbell(priv, rx);
424422 return gve_rx_work_pending(rx);
425423 }
drivers/net/ethernet/google/gve/gve_tx.c+0−6
@@ -487,10 +487,6 @@ netdev_tx_t gve_tx(struct sk_buff *skb, struct net_device *dev) · 486 unmodified lines
487487 * may have added descriptors without ringing the doorbell.
488488 */
489489
490− /* Ensure tx descs from a prior gve_tx are visible before
491− * ringing doorbell.
492− */
493− dma_wmb();
494490 gve_tx_put_doorbell(priv, tx->q_resources, tx->req);
495491 return NETDEV_TX_BUSY;
496492 }
@@ -505,8 +501,6 @@ netdev_tx_t gve_tx(struct sk_buff *skb, struct net_device *dev) · 8 unmodified lines
505501 if (!netif_xmit_stopped(tx->netdev_txq) && netdev_xmit_more())
506502 return NETDEV_TX_OK;
507503
508− /* Ensure tx descs are visible before ringing doorbell */
509− dma_wmb();
510504 gve_tx_put_doorbell(priv, tx->q_resources, tx->req);
511505 return NETDEV_TX_OK;
512506 }
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h+16−0
@@ -122,6 +122,22 @@ enum { · 121 unmodified lines
122122 #endif
123123 };
124124
125+#define MLX5E_TTC_NUM_GROUPS 3
126+#define MLX5E_TTC_GROUP1_SIZE (BIT(3) + MLX5E_NUM_TUNNEL_TT)
127+#define MLX5E_TTC_GROUP2_SIZE BIT(1)
128+#define MLX5E_TTC_GROUP3_SIZE BIT(0)
129+#define MLX5E_TTC_TABLE_SIZE (MLX5E_TTC_GROUP1_SIZE +\
130+ MLX5E_TTC_GROUP2_SIZE +\
131+ MLX5E_TTC_GROUP3_SIZE)
132+
133+#define MLX5E_INNER_TTC_NUM_GROUPS 3
134+#define MLX5E_INNER_TTC_GROUP1_SIZE BIT(3)
135+#define MLX5E_INNER_TTC_GROUP2_SIZE BIT(1)
136+#define MLX5E_INNER_TTC_GROUP3_SIZE BIT(0)
137+#define MLX5E_INNER_TTC_TABLE_SIZE (MLX5E_INNER_TTC_GROUP1_SIZE +\
138+ MLX5E_INNER_TTC_GROUP2_SIZE +\
139+ MLX5E_INNER_TTC_GROUP3_SIZE)
140+
125141 #ifdef CONFIG_MLX5_EN_RXNFC
126142
127143 struct mlx5e_ethtool_table {
drivers/net/ethernet/mellanox/mlx5/core/en/health.c+4−3
@@ -197,9 +197,10 @@ int mlx5e_health_report(struct mlx5e_priv *priv, · 196 unmodified lines
197197 struct devlink_health_reporter *reporter, char *err_str,
198198 struct mlx5e_err_ctx *err_ctx)
199199 {
200− if (!reporter) {
201− netdev_err(priv->netdev, err_str);
200+ netdev_err(priv->netdev, err_str);
201+
202+ if (!reporter)
202203 return err_ctx->recover(&err_ctx->ctx);
203− }
204+
204205 return devlink_health_report(reporter, err_str, err_ctx);
205206 }
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c+0−16
@@ -904,22 +904,6 @@ del_rules: · 903 unmodified lines
904904 return err;
905905 }
906906
907−#define MLX5E_TTC_NUM_GROUPS 3
908−#define MLX5E_TTC_GROUP1_SIZE (BIT(3) + MLX5E_NUM_TUNNEL_TT)
909−#define MLX5E_TTC_GROUP2_SIZE BIT(1)
910−#define MLX5E_TTC_GROUP3_SIZE BIT(0)
911−#define MLX5E_TTC_TABLE_SIZE (MLX5E_TTC_GROUP1_SIZE +\
912− MLX5E_TTC_GROUP2_SIZE +\
913− MLX5E_TTC_GROUP3_SIZE)
914−
915−#define MLX5E_INNER_TTC_NUM_GROUPS 3
916−#define MLX5E_INNER_TTC_GROUP1_SIZE BIT(3)
917−#define MLX5E_INNER_TTC_GROUP2_SIZE BIT(1)
918−#define MLX5E_INNER_TTC_GROUP3_SIZE BIT(0)
919−#define MLX5E_INNER_TTC_TABLE_SIZE (MLX5E_INNER_TTC_GROUP1_SIZE +\
920− MLX5E_INNER_TTC_GROUP2_SIZE +\
921− MLX5E_INNER_TTC_GROUP3_SIZE)
922−
923907 static int mlx5e_create_ttc_table_groups(struct mlx5e_ttc_table *ttc,
924908 bool use_ipv)
925909 {
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+58−2
@@ -592,7 +592,7 @@ static void mlx5e_hairpin_set_ttc_params(struct mlx5e_hairpin *hp, · 591 unmodified lines
592592 for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++)
593593 ttc_params->indir_tirn[tt] = hp->indir_tirn[tt];
594594
595− ft_attr->max_fte = MLX5E_NUM_TT;
595+ ft_attr->max_fte = MLX5E_TTC_TABLE_SIZE;
596596 ft_attr->level = MLX5E_TC_TTC_FT_LEVEL;
597597 ft_attr->prio = MLX5E_TC_PRIO;
598598 }
@@ -2999,6 +2999,25 @@ static struct ip_tunnel_info *dup_tun_info(const struct ip_tunnel_info *tun_info · 2400 unmodified lines
29992999 return kmemdup(tun_info, tun_size, GFP_KERNEL);
30003000 }
30013001
3002+static bool is_duplicated_encap_entry(struct mlx5e_priv *priv,
3003+ struct mlx5e_tc_flow *flow,
3004+ int out_index,
3005+ struct mlx5e_encap_entry *e,
3006+ struct netlink_ext_ack *extack)
3007+{
3008+ int i;
3009+
3010+ for (i = 0; i < out_index; i++) {
3011+ if (flow->encaps[i].e != e)
3012+ continue;
3013+ NL_SET_ERR_MSG_MOD(extack, "can't duplicate encap action");
3014+ netdev_err(priv->netdev, "can't duplicate encap action\n");
3015+ return true;
3016+ }
3017+
3018+ return false;
3019+}
3020+
30023021 static int mlx5e_attach_encap(struct mlx5e_priv *priv,
30033022 struct mlx5e_tc_flow *flow,
30043023 struct net_device *mirred_dev,
@@ -3034,6 +3053,12 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv, · 29 unmodified lines
30343053
30353054 /* must verify if encap is valid or not */
30363055 if (e) {
3056+ /* Check that entry was not already attached to this flow */
3057+ if (is_duplicated_encap_entry(priv, flow, out_index, e, extack)) {
3058+ err = -EOPNOTSUPP;
3059+ goto out_err;
3060+ }
3061+
30373062 mutex_unlock(&esw->offloads.encap_tbl_lock);
30383063 wait_for_completion(&e->res_ready);
30393064
@@ -3220,6 +3245,26 @@ bool mlx5e_is_valid_eswitch_fwd_dev(struct mlx5e_priv *priv, · 180 unmodified lines
32203245 same_hw_devs(priv, netdev_priv(out_dev));
32213246 }
32223247
3248+static bool is_duplicated_output_device(struct net_device *dev,
3249+ struct net_device *out_dev,
3250+ int *ifindexes, int if_count,
3251+ struct netlink_ext_ack *extack)
3252+{
3253+ int i;
3254+
3255+ for (i = 0; i < if_count; i++) {
3256+ if (ifindexes[i] == out_dev->ifindex) {
3257+ NL_SET_ERR_MSG_MOD(extack,
3258+ "can't duplicate output to same device");
3259+ netdev_err(dev, "can't duplicate output to same device: %s\n",
3260+ out_dev->name);
3261+ return true;
3262+ }
3263+ }
3264+
3265+ return false;
3266+}
3267+
32233268 static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
32243269 struct flow_action *flow_action,
32253270 struct mlx5e_tc_flow *flow,
@@ -3231,11 +3276,12 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, · 5 unmodified lines
32313276 struct mlx5e_tc_flow_parse_attr *parse_attr = attr->parse_attr;
32323277 struct mlx5e_rep_priv *rpriv = priv->ppriv;
32333278 const struct ip_tunnel_info *info = NULL;
3279+ int ifindexes[MLX5_MAX_FLOW_FWD_VPORTS];
32343280 bool ft_flow = mlx5e_is_ft_flow(flow);
32353281 const struct flow_action_entry *act;
3282+ int err, i, if_count = 0;
32363283 bool encap = false;
32373284 u32 action = 0;
3238− int err, i;
32393285
32403286 if (!flow_action_has_entries(flow_action))
32413287 return -EINVAL;
@@ -3312,6 +3358,16 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, · 70 unmodified lines
33123358 struct net_device *uplink_dev = mlx5_eswitch_uplink_get_proto_dev(esw, REP_ETH);
33133359 struct net_device *uplink_upper;
33143360
3361+ if (is_duplicated_output_device(priv->netdev,
3362+ out_dev,
3363+ ifindexes,
3364+ if_count,
3365+ extack))
3366+ return -EOPNOTSUPP;
3367+
3368+ ifindexes[if_count] = out_dev->ifindex;
3369+ if_count++;
3370+
33153371 rcu_read_lock();
33163372 uplink_upper =
33173373 netdev_master_upper_dev_get_rcu(uplink_dev);
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c+15−55
@@ -531,16 +531,9 @@ static void del_hw_fte(struct fs_node *node) · 530 unmodified lines
531531 }
532532 }
533533
534−static void del_sw_fte_rcu(struct rcu_head *head)
535−{
536− struct fs_fte *fte = container_of(head, struct fs_fte, rcu);
537− struct mlx5_flow_steering *steering = get_steering(&fte->node);
538−
539− kmem_cache_free(steering->ftes_cache, fte);
540−}
541−
542534 static void del_sw_fte(struct fs_node *node)
543535 {
536+ struct mlx5_flow_steering *steering = get_steering(node);
544537 struct mlx5_flow_group *fg;
545538 struct fs_fte *fte;
546539 int err;
@@ -553,8 +546,7 @@ static void del_sw_fte(struct fs_node *node) · 6 unmodified lines
553546 rhash_fte);
554547 WARN_ON(err);
555548 ida_simple_remove(&fg->fte_allocator, fte->index - fg->start_index);
556−
557− call_rcu(&fte->rcu, del_sw_fte_rcu);
549+ kmem_cache_free(steering->ftes_cache, fte);
558550 }
559551
560552 static void del_hw_flow_group(struct fs_node *node)
@@ -1633,47 +1625,22 @@ static u64 matched_fgs_get_version(struct list_head *match_head) · 1072 unmodified lines
16331625 }
16341626
16351627 static struct fs_fte *
1636−lookup_fte_for_write_locked(struct mlx5_flow_group *g, const u32 *match_value)
1628+lookup_fte_locked(struct mlx5_flow_group *g,
1629+ const u32 *match_value,
1630+ bool take_write)
16371631 {
16381632 struct fs_fte *fte_tmp;
16391633
1640− nested_down_write_ref_node(&g->node, FS_LOCK_PARENT);
1641−
1642− fte_tmp = rhashtable_lookup_fast(&g->ftes_hash, match_value, rhash_fte);
1643− if (!fte_tmp || !tree_get_node(&fte_tmp->node)) {
1644− fte_tmp = NULL;
1645− goto out;
1646− }
1647−
1648− if (!fte_tmp->node.active) {
1649− tree_put_node(&fte_tmp->node, false);
1650− fte_tmp = NULL;
1651− goto out;
1652− }
1653− nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD);
1654−
1655−out:
1656− up_write_ref_node(&g->node, false);
1657− return fte_tmp;
1658−}
1659−
1660−static struct fs_fte *
1661−lookup_fte_for_read_locked(struct mlx5_flow_group *g, const u32 *match_value)
1662−{
1663− struct fs_fte *fte_tmp;
1664−
1665− if (!tree_get_node(&g->node))
1666− return NULL;
1667−
1668− rcu_read_lock();
1669− fte_tmp = rhashtable_lookup(&g->ftes_hash, match_value, rhash_fte);
1634+ if (take_write)
1635+ nested_down_write_ref_node(&g->node, FS_LOCK_PARENT);
1636+ else
1637+ nested_down_read_ref_node(&g->node, FS_LOCK_PARENT);
1638+ fte_tmp = rhashtable_lookup_fast(&g->ftes_hash, match_value,
1639+ rhash_fte);
16701640 if (!fte_tmp || !tree_get_node(&fte_tmp->node)) {
1671− rcu_read_unlock();
16721641 fte_tmp = NULL;
16731642 goto out;
16741643 }
1675− rcu_read_unlock();
1676−
16771644 if (!fte_tmp->node.active) {
16781645 tree_put_node(&fte_tmp->node, false);
16791646 fte_tmp = NULL;
@@ -1681,19 +1648,12 @@ lookup_fte_for_read_locked(struct mlx5_flow_group *g, const u32 *match_value) · 1 unmodified line
16811648 }
16821649
16831650 nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD);
1684−
16851651 out:
1686− tree_put_node(&g->node, false);
1687− return fte_tmp;
1688−}
1689−
1690−static struct fs_fte *
1691−lookup_fte_locked(struct mlx5_flow_group *g, const u32 *match_value, bool write)
1692−{
1693− if (write)
1694− return lookup_fte_for_write_locked(g, match_value);
1652+ if (take_write)
1653+ up_write_ref_node(&g->node, false);
16951654 else
1696− return lookup_fte_for_read_locked(g, match_value);
1655+ up_read_ref_node(&g->node);
1656+ return fte_tmp;
16971657 }
16981658
16991659 static struct mlx5_flow_handle *
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h+0−1
@@ -203,7 +203,6 @@ struct fs_fte { · 202 unmodified lines
203203 enum fs_fte_status status;
204204 struct mlx5_fc *counter;
205205 struct rhash_head hash;
206− struct rcu_head rcu;
207206 int modify_mask;
208207 };
209208
drivers/net/ethernet/mellanox/mlx5/core/main.c+9−7
@@ -1193,6 +1193,12 @@ int mlx5_load_one(struct mlx5_core_dev *dev, bool boot) · 1192 unmodified lines
11931193 if (err)
11941194 goto err_load;
11951195
1196+ if (boot) {
1197+ err = mlx5_devlink_register(priv_to_devlink(dev), dev->device);
1198+ if (err)
1199+ goto err_devlink_reg;
1200+ }
1201+
11961202 if (mlx5_device_registered(dev)) {
11971203 mlx5_attach_device(dev);
11981204 } else {
@@ -1210,6 +1216,9 @@ out: · 11 unmodified lines
12101216 return err;
12111217
12121218 err_reg_dev:
1219+ if (boot)
1220+ mlx5_devlink_unregister(priv_to_devlink(dev));
1221+err_devlink_reg:
12131222 mlx5_unload(dev);
12141223 err_load:
12151224 if (boot)
@@ -1347,10 +1356,6 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *id) · 131 unmodified lines
13471356
13481357 request_module_nowait(MLX5_IB_MOD);
13491358
1350− err = mlx5_devlink_register(devlink, &pdev->dev);
1351− if (err)
1352− goto clean_load;
1353−
13541359 err = mlx5_crdump_enable(dev);
13551360 if (err)
13561361 dev_err(&pdev->dev, "mlx5_crdump_enable failed with error code %d\n", err);
@@ -1358,9 +1363,6 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *id) · 1 unmodified line
13581363 pci_save_state(pdev);
13591364 return 0;
13601365
1361−clean_load:
1362− mlx5_unload_one(dev, true);
1363−
13641366 err_load_one:
13651367 mlx5_pci_close(dev);
13661368 pci_init_err:
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c+4−1
@@ -209,7 +209,7 @@ static void dr_rule_rehash_copy_ste_ctrl(struct mlx5dr_matcher *matcher, · 208 unmodified lines
209209 /* We need to copy the refcount since this ste
210210 * may have been traversed several times
211211 */
212− refcount_set(&new_ste->refcount, refcount_read(&cur_ste->refcount));
212+ new_ste->refcount = cur_ste->refcount;
213213
214214 /* Link old STEs rule_mem list to the new ste */
215215 mlx5dr_rule_update_rule_member(cur_ste, new_ste);
@@ -638,6 +638,9 @@ static int dr_rule_add_member(struct mlx5dr_rule_rx_tx *nic_rule, · 422 unmodified lines
638638 if (!rule_mem)
639639 return -ENOMEM;
640640
641+ INIT_LIST_HEAD(&rule_mem->list);
642+ INIT_LIST_HEAD(&rule_mem->use_ste_list);
643+
641644 rule_mem->ste = ste;
642645 list_add_tail(&rule_mem->list, &nic_rule->rule_members_list);
643646
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c+5−5
@@ -348,7 +348,7 @@ static void dr_ste_replace(struct mlx5dr_ste *dst, struct mlx5dr_ste *src) · 347 unmodified lines
348348 if (dst->next_htbl)
349349 dst->next_htbl->pointing_ste = dst;
350350
351− refcount_set(&dst->refcount, refcount_read(&src->refcount));
351+ dst->refcount = src->refcount;
352352
353353 INIT_LIST_HEAD(&dst->rule_list);
354354 list_splice_tail_init(&src->rule_list, &dst->rule_list);
@@ -565,7 +565,7 @@ bool mlx5dr_ste_is_not_valid_entry(u8 *p_hw_ste) · 210 unmodified lines
565565
566566 bool mlx5dr_ste_not_used_ste(struct mlx5dr_ste *ste)
567567 {
568− return !refcount_read(&ste->refcount);
568+ return !ste->refcount;
569569 }
570570
571571 /* Init one ste as a pattern for ste data array */
@@ -689,14 +689,14 @@ struct mlx5dr_ste_htbl *mlx5dr_ste_htbl_alloc(struct mlx5dr_icm_pool *pool, · 117 unmodified lines
689689 htbl->ste_arr = chunk->ste_arr;
690690 htbl->hw_ste_arr = chunk->hw_ste_arr;
691691 htbl->miss_list = chunk->miss_list;
692− refcount_set(&htbl->refcount, 0);
692+ htbl->refcount = 0;
693693
694694 for (i = 0; i < chunk->num_of_entries; i++) {
695695 struct mlx5dr_ste *ste = &htbl->ste_arr[i];
696696
697697 ste->hw_ste = htbl->hw_ste_arr + i * DR_STE_SIZE_REDUCED;
698698 ste->htbl = htbl;
699− refcount_set(&ste->refcount, 0);
699+ ste->refcount = 0;
700700 INIT_LIST_HEAD(&ste->miss_list_node);
701701 INIT_LIST_HEAD(&htbl->miss_list[i]);
702702 INIT_LIST_HEAD(&ste->rule_list);
@@ -713,7 +713,7 @@ out_free_htbl: · 10 unmodified lines
713713
714714 int mlx5dr_ste_htbl_free(struct mlx5dr_ste_htbl *htbl)
715715 {
716− if (refcount_read(&htbl->refcount))
716+ if (htbl->refcount)
717717 return -EBUSY;
718718
719719 mlx5dr_icm_free_chunk(htbl->chunk);
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h+8−6
@@ -123,7 +123,7 @@ struct mlx5dr_matcher_rx_tx; · 122 unmodified lines
123123 struct mlx5dr_ste {
124124 u8 *hw_ste;
125125 /* refcount: indicates the num of rules that using this ste */
126− refcount_t refcount;
126+ u32 refcount;
127127
128128 /* attached to the miss_list head at each htbl entry */
129129 struct list_head miss_list_node;
@@ -155,7 +155,7 @@ struct mlx5dr_ste_htbl_ctrl { · 25 unmodified lines
155155 struct mlx5dr_ste_htbl {
156156 u8 lu_type;
157157 u16 byte_mask;
158− refcount_t refcount;
158+ u32 refcount;
159159 struct mlx5dr_icm_chunk *chunk;
160160 struct mlx5dr_ste *ste_arr;
161161 u8 *hw_ste_arr;
@@ -206,13 +206,14 @@ int mlx5dr_ste_htbl_free(struct mlx5dr_ste_htbl *htbl); · 44 unmodified lines
206206
207207 static inline void mlx5dr_htbl_put(struct mlx5dr_ste_htbl *htbl)
208208 {
209− if (refcount_dec_and_test(&htbl->refcount))
209+ htbl->refcount--;
210+ if (!htbl->refcount)
210211 mlx5dr_ste_htbl_free(htbl);
211212 }
212213
213214 static inline void mlx5dr_htbl_get(struct mlx5dr_ste_htbl *htbl)
214215 {
215− refcount_inc(&htbl->refcount);
216+ htbl->refcount++;
216217 }
217218
218219 /* STE utils */
@@ -254,14 +255,15 @@ static inline void mlx5dr_ste_put(struct mlx5dr_ste *ste, · 35 unmodified lines
254255 struct mlx5dr_matcher *matcher,
255256 struct mlx5dr_matcher_rx_tx *nic_matcher)
256257 {
257− if (refcount_dec_and_test(&ste->refcount))
258+ ste->refcount--;
259+ if (!ste->refcount)
258260 mlx5dr_ste_free(ste, matcher, nic_matcher);
259261 }
260262
261263 /* initial as 0, increased only when ste appears in a new rule */
262264 static inline void mlx5dr_ste_get(struct mlx5dr_ste *ste)
263265 {
264− refcount_inc(&ste->refcount);
266+ ste->refcount++;
265267 }
266268
267269 void mlx5dr_ste_set_hit_addr_by_next_htbl(u8 *hw_ste,
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c+4−3
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #include <linux/kernel.h>
77 #include <linux/module.h>
88 #include <linux/netlink.h>
9+#include <linux/vmalloc.h>
910 #include <linux/xz.h>
1011 #include "mlxfw_mfa2.h"
1112 #include "mlxfw_mfa2_file.h"
@@ -548,7 +549,7 @@ mlxfw_mfa2_file_component_get(const struct mlxfw_mfa2_file *mfa2_file, · 536 unmodified lines
548549 comp_size = be32_to_cpu(comp->size);
549550 comp_buf_size = comp_size + mlxfw_mfa2_comp_magic_len;
550551
551− comp_data = kmalloc(sizeof(*comp_data) + comp_buf_size, GFP_KERNEL);
552+ comp_data = vzalloc(sizeof(*comp_data) + comp_buf_size);
552553 if (!comp_data)
553554 return ERR_PTR(-ENOMEM);
554555 comp_data->comp.data_size = comp_size;
@@ -570,7 +571,7 @@ mlxfw_mfa2_file_component_get(const struct mlxfw_mfa2_file *mfa2_file, · 15 unmodified lines
570571 comp_data->comp.data = comp_data->buff + mlxfw_mfa2_comp_magic_len;
571572 return &comp_data->comp;
572573 err_out:
573− kfree(comp_data);
574+ vfree(comp_data);
574575 return ERR_PTR(err);
575576 }
576577
@@ -579,7 +580,7 @@ void mlxfw_mfa2_file_component_put(struct mlxfw_mfa2_component *comp) · 2 unmodified lines
579580 const struct mlxfw_mfa2_comp_data *comp_data;
580581
581582 comp_data = container_of(comp, struct mlxfw_mfa2_comp_data, comp);
582− kfree(comp_data);
583+ vfree(comp_data);
583584 }
584585
585586 void mlxfw_mfa2_file_fini(struct mlxfw_mfa2_file *mfa2_file)
drivers/net/ethernet/mellanox/mlxsw/reg.h+1−0
@@ -5472,6 +5472,7 @@ enum mlxsw_reg_htgt_trap_group { · 5471 unmodified lines
54725472 MLXSW_REG_HTGT_TRAP_GROUP_SP_LBERROR,
54735473 MLXSW_REG_HTGT_TRAP_GROUP_SP_PTP0,
54745474 MLXSW_REG_HTGT_TRAP_GROUP_SP_PTP1,
5475+ MLXSW_REG_HTGT_TRAP_GROUP_SP_VRRP,
54755476
54765477 __MLXSW_REG_HTGT_TRAP_GROUP_MAX,
54775478 MLXSW_REG_HTGT_TRAP_GROUP_MAX = __MLXSW_REG_HTGT_TRAP_GROUP_MAX - 1
drivers/net/ethernet/mellanox/mlxsw/spectrum.c+7−2
@@ -4542,8 +4542,8 @@ static const struct mlxsw_listener mlxsw_sp_listener[] = { · 4541 unmodified lines
45424542 MLXSW_SP_RXL_MARK(ROUTER_ALERT_IPV6, TRAP_TO_CPU, ROUTER_EXP, false),
45434543 MLXSW_SP_RXL_MARK(IPIP_DECAP_ERROR, TRAP_TO_CPU, ROUTER_EXP, false),
45444544 MLXSW_SP_RXL_MARK(DECAP_ECN0, TRAP_TO_CPU, ROUTER_EXP, false),
4545− MLXSW_SP_RXL_MARK(IPV4_VRRP, TRAP_TO_CPU, ROUTER_EXP, false),
4546− MLXSW_SP_RXL_MARK(IPV6_VRRP, TRAP_TO_CPU, ROUTER_EXP, false),
4545+ MLXSW_SP_RXL_MARK(IPV4_VRRP, TRAP_TO_CPU, VRRP, false),
4546+ MLXSW_SP_RXL_MARK(IPV6_VRRP, TRAP_TO_CPU, VRRP, false),
45474547 /* PKT Sample trap */
45484548 MLXSW_RXL(mlxsw_sp_rx_listener_sample_func, PKT_SAMPLE, MIRROR_TO_CPU,
45494549 false, SP_IP2ME, DISCARD),
@@ -4626,6 +4626,10 @@ static int mlxsw_sp_cpu_policers_set(struct mlxsw_core *mlxsw_core) · 76 unmodified lines
46264626 rate = 19 * 1024;
46274627 burst_size = 12;
46284628 break;
4629+ case MLXSW_REG_HTGT_TRAP_GROUP_SP_VRRP:
4630+ rate = 360;
4631+ burst_size = 7;
4632+ break;
46294633 default:
46304634 continue;
46314635 }
@@ -4665,6 +4669,7 @@ static int mlxsw_sp_trap_groups_set(struct mlxsw_core *mlxsw_core) · 33 unmodified lines
46654669 case MLXSW_REG_HTGT_TRAP_GROUP_SP_OSPF:
46664670 case MLXSW_REG_HTGT_TRAP_GROUP_SP_PIM:
46674671 case MLXSW_REG_HTGT_TRAP_GROUP_SP_PTP0:
4672+ case MLXSW_REG_HTGT_TRAP_GROUP_SP_VRRP:
46684673 priority = 5;
46694674 tc = 5;
46704675 break;
drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c+7−0
@@ -651,6 +651,13 @@ mlxsw_sp_qdisc_prio_graft(struct mlxsw_sp_port *mlxsw_sp_port, · 650 unmodified lines
651651 mlxsw_sp_port->tclass_qdiscs[tclass_num].handle == p->child_handle)
652652 return 0;
653653
654+ if (!p->child_handle) {
655+ /* This is an invisible FIFO replacing the original Qdisc.
656+ * Ignore it--the original Qdisc's destroy will follow.
657+ */
658+ return 0;
659+ }
660+
654661 /* See if the grafted qdisc is already offloaded on any tclass. If so,
655662 * unoffload it.
656663 */
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+3−0
@@ -7079,6 +7079,9 @@ static int mlxsw_sp_router_port_check_rif_addr(struct mlxsw_sp *mlxsw_sp, · 7078 unmodified lines
70797079
70807080 for (i = 0; i < MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); i++) {
70817081 rif = mlxsw_sp->router->rifs[i];
7082+ if (rif && rif->ops &&
7083+ rif->ops->type == MLXSW_SP_RIF_TYPE_IPIP_LB)
7084+ continue;
70827085 if (rif && rif->dev && rif->dev != dev &&
70837086 !ether_addr_equal_masked(rif->dev->dev_addr, dev_addr,
70847087 mlxsw_sp->mac_mask)) {
drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c+1−1
@@ -2296,7 +2296,7 @@ __setup("sxgbeeth=", sxgbe_cmdline_opt); · 2295 unmodified lines
22962296
22972297
22982298
2299−MODULE_DESCRIPTION("SAMSUNG 10G/2.5G/1G Ethernet PLATFORM driver");
2299+MODULE_DESCRIPTION("Samsung 10G/2.5G/1G Ethernet PLATFORM driver");
23002300
23012301 MODULE_PARM_DESC(debug, "Message Level (-1: default, 0: no output, 16: all)");
23022302 MODULE_PARM_DESC(eee_timer, "EEE-LPI Default LS timer value");
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c+11−3
@@ -112,6 +112,14 @@ static int meson8b_init_rgmii_tx_clk(struct meson8b_dwmac *dwmac) · 111 unmodified lines
112112 struct device *dev = dwmac->dev;
113113 const char *parent_name, *mux_parent_names[MUX_CLK_NUM_PARENTS];
114114 struct meson8b_dwmac_clk_configs *clk_configs;
115+ static const struct clk_div_table div_table[] = {
116+ { .div = 2, .val = 2, },
117+ { .div = 3, .val = 3, },
118+ { .div = 4, .val = 4, },
119+ { .div = 5, .val = 5, },
120+ { .div = 6, .val = 6, },
121+ { .div = 7, .val = 7, },
122+ };
115123
116124 clk_configs = devm_kzalloc(dev, sizeof(*clk_configs), GFP_KERNEL);
117125 if (!clk_configs)
@@ -146,9 +154,9 @@ static int meson8b_init_rgmii_tx_clk(struct meson8b_dwmac *dwmac) · 28 unmodified lines
146154 clk_configs->m250_div.reg = dwmac->regs + PRG_ETH0;
147155 clk_configs->m250_div.shift = PRG_ETH0_CLK_M250_DIV_SHIFT;
148156 clk_configs->m250_div.width = PRG_ETH0_CLK_M250_DIV_WIDTH;
149− clk_configs->m250_div.flags = CLK_DIVIDER_ONE_BASED |
150− CLK_DIVIDER_ALLOW_ZERO |
151− CLK_DIVIDER_ROUND_CLOSEST;
157+ clk_configs->m250_div.table = div_table;
158+ clk_configs->m250_div.flags = CLK_DIVIDER_ALLOW_ZERO |
159+ CLK_DIVIDER_ROUND_CLOSEST;
152160 clk = meson8b_dwmac_register_clk(dwmac, "m250_div", &parent_name, 1,
153161 &clk_divider_ops,
154162 &clk_configs->m250_div.hw);
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c+3−0
@@ -957,6 +957,9 @@ static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv) · 956 unmodified lines
957957 /* default */
958958 break;
959959 case PHY_INTERFACE_MODE_RGMII:
960+ case PHY_INTERFACE_MODE_RGMII_ID:
961+ case PHY_INTERFACE_MODE_RGMII_RXID:
962+ case PHY_INTERFACE_MODE_RGMII_TXID:
960963 reg |= SYSCON_EPIT | SYSCON_ETCS_INT_GMII;
961964 break;
962965 case PHY_INTERFACE_MODE_RMII:
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c+1−1
@@ -44,7 +44,7 @@ static int sun7i_gmac_init(struct platform_device *pdev, void *priv) · 43 unmodified lines
4444 * rate, which then uses the auto-reparenting feature of the
4545 * clock driver, and enabling/disabling the clock.
4646 */
47− if (gmac->interface == PHY_INTERFACE_MODE_RGMII) {
47+ if (phy_interface_mode_is_rgmii(gmac->interface)) {
4848 clk_set_rate(gmac->tx_clk, SUN7I_GMAC_GMII_RGMII_RATE);
4949 clk_prepare_enable(gmac->tx_clk);
5050 gmac->clk_enabled = 1;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+32−0
@@ -106,6 +106,7 @@ MODULE_PARM_DESC(chain_mode, "To use chain instead of ring mode"); · 105 unmodified lines
106106 static irqreturn_t stmmac_interrupt(int irq, void *dev_id);
107107
108108 #ifdef CONFIG_DEBUG_FS
109+static const struct net_device_ops stmmac_netdev_ops;
109110 static void stmmac_init_fs(struct net_device *dev);
110111 static void stmmac_exit_fs(struct net_device *dev);
111112 #endif
@@ -4256,6 +4257,34 @@ static int stmmac_dma_cap_show(struct seq_file *seq, void *v) · 4144 unmodified lines
42564257 }
42574258 DEFINE_SHOW_ATTRIBUTE(stmmac_dma_cap);
42584259
4260+/* Use network device events to rename debugfs file entries.
4261+ */
4262+static int stmmac_device_event(struct notifier_block *unused,
4263+ unsigned long event, void *ptr)
4264+{
4265+ struct net_device *dev = netdev_notifier_info_to_dev(ptr);
4266+ struct stmmac_priv *priv = netdev_priv(dev);
4267+
4268+ if (dev->netdev_ops != &stmmac_netdev_ops)
4269+ goto done;
4270+
4271+ switch (event) {
4272+ case NETDEV_CHANGENAME:
4273+ if (priv->dbgfs_dir)
4274+ priv->dbgfs_dir = debugfs_rename(stmmac_fs_dir,
4275+ priv->dbgfs_dir,
4276+ stmmac_fs_dir,
4277+ dev->name);
4278+ break;
4279+ }
4280+done:
4281+ return NOTIFY_DONE;
4282+}
4283+
4284+static struct notifier_block stmmac_notifier = {
4285+ .notifier_call = stmmac_device_event,
4286+};
4287+
42594288 static void stmmac_init_fs(struct net_device *dev)
42604289 {
42614290 struct stmmac_priv *priv = netdev_priv(dev);
@@ -4270,12 +4299,15 @@ static void stmmac_init_fs(struct net_device *dev) · 8 unmodified lines
42704299 /* Entry to report the DMA HW features */
42714300 debugfs_create_file("dma_cap", 0444, priv->dbgfs_dir, dev,
42724301 &stmmac_dma_cap_fops);
4302+
4303+ register_netdevice_notifier(&stmmac_notifier);
42734304 }
42744305
42754306 static void stmmac_exit_fs(struct net_device *dev)
42764307 {
42774308 struct stmmac_priv *priv = netdev_priv(dev);
42784309
4310+ unregister_netdevice_notifier(&stmmac_notifier);
42794311 debugfs_remove_recursive(priv->dbgfs_dir);
42804312 }
42814313 #endif /* CONFIG_DEBUG_FS */
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c+1−1
@@ -320,7 +320,7 @@ out: · 319 unmodified lines
320320 static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
321321 struct device_node *np, struct device *dev)
322322 {
323− bool mdio = false;
323+ bool mdio = !of_phy_is_fixed_link(np);
324324 static const struct of_device_id need_mdio_ids[] = {
325325 { .compatible = "snps,dwc-qos-ethernet-4.10" },
326326 {},
drivers/net/gtp.c+4−3
@@ -540,7 +540,7 @@ static int gtp_build_skb_ip4(struct sk_buff *skb, struct net_device *dev, · 539 unmodified lines
540540 mtu = dst_mtu(&rt->dst);
541541 }
542542
543− rt->dst.ops->update_pmtu(&rt->dst, NULL, skb, mtu);
543+ rt->dst.ops->update_pmtu(&rt->dst, NULL, skb, mtu, false);
544544
545545 if (!skb_is_gso(skb) && (iph->frag_off & htons(IP_DF)) &&
546546 mtu < ntohs(iph->tot_len)) {
@@ -813,7 +813,7 @@ static struct sock *gtp_encap_enable_socket(int fd, int type, · 266 unmodified lines
813813 lock_sock(sock->sk);
814814 if (sock->sk->sk_user_data) {
815815 sk = ERR_PTR(-EBUSY);
816− goto out_sock;
816+ goto out_rel_sock;
817817 }
818818
819819 sk = sock->sk;
@@ -826,8 +826,9 @@ static struct sock *gtp_encap_enable_socket(int fd, int type, · 6 unmodified lines
826826
827827 setup_udp_tunnel_sock(sock_net(sock->sk), sock, &tuncfg);
828828
829−out_sock:
829+out_rel_sock:
830830 release_sock(sock->sk);
831+out_sock:
831832 sockfd_put(sock);
832833 return sk;
833834 }
drivers/net/macvlan.c+1−1
@@ -259,7 +259,7 @@ static void macvlan_broadcast(struct sk_buff *skb, · 258 unmodified lines
259259 struct net_device *src,
260260 enum macvlan_mode mode)
261261 {
262− const struct ethhdr *eth = eth_hdr(skb);
262+ const struct ethhdr *eth = skb_eth_hdr(skb);
263263 const struct macvlan_dev *vlan;
264264 struct sk_buff *nskb;
265265 unsigned int i;
drivers/net/phy/aquantia_main.c+2−0
@@ -627,6 +627,8 @@ static struct phy_driver aqr_driver[] = { · 626 unmodified lines
627627 .config_intr = aqr_config_intr,
628628 .ack_interrupt = aqr_ack_interrupt,
629629 .read_status = aqr_read_status,
630+ .suspend = aqr107_suspend,
631+ .resume = aqr107_resume,
630632 },
631633 {
632634 PHY_ID_MATCH_MODEL(PHY_ID_AQR106),
drivers/net/phy/phylink.c+3−0
@@ -566,6 +566,9 @@ static int phylink_register_sfp(struct phylink *pl, · 565 unmodified lines
566566 struct sfp_bus *bus;
567567 int ret;
568568
569+ if (!fwnode)
570+ return 0;
571+
569572 bus = sfp_bus_find_fwnode(fwnode);
570573 if (IS_ERR(bus)) {
571574 ret = PTR_ERR(bus);
drivers/net/usb/lan78xx.c+3−6
@@ -2724,11 +2724,6 @@ static int lan78xx_stop(struct net_device *net) · 2723 unmodified lines
27242724 return 0;
27252725 }
27262726
2727−static int lan78xx_linearize(struct sk_buff *skb)
2728−{
2729− return skb_linearize(skb);
2730−}
2731−
27322727 static struct sk_buff *lan78xx_tx_prep(struct lan78xx_net *dev,
27332728 struct sk_buff *skb, gfp_t flags)
27342729 {
@@ -2740,8 +2735,10 @@ static struct sk_buff *lan78xx_tx_prep(struct lan78xx_net *dev, · 5 unmodified lines
27402735 return NULL;
27412736 }
27422737
2743− if (lan78xx_linearize(skb) < 0)
2738+ if (skb_linearize(skb)) {
2739+ dev_kfree_skb_any(skb);
27442740 return NULL;
2741+ }
27452742
27462743 tx_cmd_a = (u32)(skb->len & TX_CMD_A_LEN_MASK_) | TX_CMD_A_FCS_;
27472744
drivers/net/vxlan.c+2−2
@@ -2541,7 +2541,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, · 2540 unmodified lines
25412541 ndst = &rt->dst;
25422542 skb_tunnel_check_pmtu(skb, ndst, VXLAN_HEADROOM);
25432543
2544− tos = ip_tunnel_ecn_encap(tos, old_iph, skb);
2544+ tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb);
25452545 ttl = ttl ? : ip4_dst_hoplimit(&rt->dst);
25462546 err = vxlan_build_skb(skb, ndst, sizeof(struct iphdr),
25472547 vni, md, flags, udp_sum);
@@ -2581,7 +2581,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, · 33 unmodified lines
25812581
25822582 skb_tunnel_check_pmtu(skb, ndst, VXLAN6_HEADROOM);
25832583
2584− tos = ip_tunnel_ecn_encap(tos, old_iph, skb);
2584+ tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb);
25852585 ttl = ttl ? : ip6_dst_hoplimit(ndst);
25862586 skb_scrub_packet(skb, xnet);
25872587 err = vxlan_build_skb(skb, ndst, sizeof(struct ipv6hdr),
drivers/net/wan/sdla.c+1−1
@@ -708,7 +708,7 @@ static netdev_tx_t sdla_transmit(struct sk_buff *skb, · 707 unmodified lines
708708
709709 spin_lock_irqsave(&sdla_lock, flags);
710710 SDLA_WINDOW(dev, addr);
711− pbuf = (void *)(((int) dev->mem_start) + (addr & SDLA_ADDR_MASK));
711+ pbuf = (void *)(dev->mem_start + (addr & SDLA_ADDR_MASK));
712712 __sdla_write(dev, pbuf->buf_addr, skb->data, skb->len);
713713 SDLA_WINDOW(dev, addr);
714714 pbuf->opp_flag = 1;
drivers/nvme/host/core.c+2−0
@@ -222,6 +222,8 @@ static blk_status_t nvme_error_status(u16 status) · 221 unmodified lines
222222 case NVME_SC_CAP_EXCEEDED:
223223 return BLK_STS_NOSPC;
224224 case NVME_SC_LBA_RANGE:
225+ case NVME_SC_CMD_INTERRUPTED:
226+ case NVME_SC_NS_NOT_READY:
225227 return BLK_STS_TARGET;
226228 case NVME_SC_BAD_ATTRIBUTES:
227229 case NVME_SC_ONCS_NOT_SUPPORTED:
drivers/nvme/target/admin-cmd.c+11−1
@@ -24,6 +24,16 @@ u32 nvmet_get_log_page_len(struct nvme_command *cmd) · 23 unmodified lines
2424 return len;
2525 }
2626
27+static u32 nvmet_feat_data_len(struct nvmet_req *req, u32 cdw10)
28+{
29+ switch (cdw10 & 0xff) {
30+ case NVME_FEAT_HOST_ID:
31+ return sizeof(req->sq->ctrl->hostid);
32+ default:
33+ return 0;
34+ }
35+}
36+
2737 u64 nvmet_get_log_page_offset(struct nvme_command *cmd)
2838 {
2939 return le64_to_cpu(cmd->get_log_page.lpo);
@@ -778,7 +788,7 @@ static void nvmet_execute_get_features(struct nvmet_req *req) · 748 unmodified lines
778788 u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10);
779789 u16 status = 0;
780790
781− if (!nvmet_check_data_len(req, 0))
791+ if (!nvmet_check_data_len(req, nvmet_feat_data_len(req, cdw10)))
782792 return;
783793
784794 switch (cdw10 & 0xff) {
drivers/phy/motorola/phy-cpcap-usb.c+90−38
@@ -115,7 +115,7 @@ struct cpcap_usb_ints_state { · 114 unmodified lines
115115 enum cpcap_gpio_mode {
116116 CPCAP_DM_DP,
117117 CPCAP_MDM_RX_TX,
118− CPCAP_UNKNOWN,
118+ CPCAP_UNKNOWN_DISABLED, /* Seems to disable USB lines */
119119 CPCAP_OTG_DM_DP,
120120 };
121121
@@ -134,6 +134,8 @@ struct cpcap_phy_ddata { · 12 unmodified lines
134134 struct iio_channel *id;
135135 struct regulator *vusb;
136136 atomic_t active;
137+ unsigned int vbus_provider:1;
138+ unsigned int docked:1;
137139 };
138140
139141 static bool cpcap_usb_vbus_valid(struct cpcap_phy_ddata *ddata)
@@ -207,6 +209,19 @@ static int cpcap_phy_get_ints_state(struct cpcap_phy_ddata *ddata, · 67 unmodified lines
207209 static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata);
208210 static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata);
209211
212+static void cpcap_usb_try_musb_mailbox(struct cpcap_phy_ddata *ddata,
213+ enum musb_vbus_id_status status)
214+{
215+ int error;
216+
217+ error = musb_mailbox(status);
218+ if (!error)
219+ return;
220+
221+ dev_dbg(ddata->dev, "%s: musb_mailbox failed: %i\n",
222+ __func__, error);
223+}
224+
210225 static void cpcap_usb_detect(struct work_struct *work)
211226 {
212227 struct cpcap_phy_ddata *ddata;
@@ -220,16 +235,66 @@ static void cpcap_usb_detect(struct work_struct *work) · 7 unmodified lines
220235 if (error)
221236 return;
222237
223− if (s.id_ground) {
224− dev_dbg(ddata->dev, "id ground, USB host mode\n");
238+ vbus = cpcap_usb_vbus_valid(ddata);
239+
240+ /* We need to kick the VBUS as USB A-host */
241+ if (s.id_ground && ddata->vbus_provider) {
242+ dev_dbg(ddata->dev, "still in USB A-host mode, kicking VBUS\n");
243+
244+ cpcap_usb_try_musb_mailbox(ddata, MUSB_ID_GROUND);
245+
246+ error = regmap_update_bits(ddata->reg, CPCAP_REG_USBC3,
247+ CPCAP_BIT_VBUSSTBY_EN |
248+ CPCAP_BIT_VBUSEN_SPI,
249+ CPCAP_BIT_VBUSEN_SPI);
250+ if (error)
251+ goto out_err;
252+
253+ return;
254+ }
255+
256+ if (vbus && s.id_ground && ddata->docked) {
257+ dev_dbg(ddata->dev, "still docked as A-host, signal ID down\n");
258+
259+ cpcap_usb_try_musb_mailbox(ddata, MUSB_ID_GROUND);
260+
261+ return;
262+ }
263+
264+ /* No VBUS needed with docks */
265+ if (vbus && s.id_ground && !ddata->vbus_provider) {
266+ dev_dbg(ddata->dev, "connected to a dock\n");
267+
268+ ddata->docked = true;
269+
225270 error = cpcap_usb_set_usb_mode(ddata);
226271 if (error)
227272 goto out_err;
228273
229− error = musb_mailbox(MUSB_ID_GROUND);
274+ cpcap_usb_try_musb_mailbox(ddata, MUSB_ID_GROUND);
275+
276+ /*
277+ * Force check state again after musb has reoriented,
278+ * otherwise devices won't enumerate after loading PHY
279+ * driver.
280+ */
281+ schedule_delayed_work(&ddata->detect_work,
282+ msecs_to_jiffies(1000));
283+
284+ return;
285+ }
286+
287+ if (s.id_ground && !ddata->docked) {
288+ dev_dbg(ddata->dev, "id ground, USB host mode\n");
289+
290+ ddata->vbus_provider = true;
291+
292+ error = cpcap_usb_set_usb_mode(ddata);
230293 if (error)
231294 goto out_err;
232295
296+ cpcap_usb_try_musb_mailbox(ddata, MUSB_ID_GROUND);
297+
233298 error = regmap_update_bits(ddata->reg, CPCAP_REG_USBC3,
234299 CPCAP_BIT_VBUSSTBY_EN |
235300 CPCAP_BIT_VBUSEN_SPI,
@@ -248,43 +313,26 @@ static void cpcap_usb_detect(struct work_struct *work) · 12 unmodified lines
248313
249314 vbus = cpcap_usb_vbus_valid(ddata);
250315
316+ /* Otherwise assume we're connected to a USB host */
251317 if (vbus) {
252− /* Are we connected to a docking station with vbus? */
253− if (s.id_ground) {
254− dev_dbg(ddata->dev, "connected to a dock\n");
255−
256− /* No VBUS needed with docks */
257− error = cpcap_usb_set_usb_mode(ddata);
258− if (error)
259− goto out_err;
260− error = musb_mailbox(MUSB_ID_GROUND);
261− if (error)
262− goto out_err;
263−
264− return;
265− }
266−
267− /* Otherwise assume we're connected to a USB host */
268318 dev_dbg(ddata->dev, "connected to USB host\n");
269319 error = cpcap_usb_set_usb_mode(ddata);
270320 if (error)
271321 goto out_err;
272− error = musb_mailbox(MUSB_VBUS_VALID);
273− if (error)
274− goto out_err;
322+ cpcap_usb_try_musb_mailbox(ddata, MUSB_VBUS_VALID);
275323
276324 return;
277325 }
278326
327+ ddata->vbus_provider = false;
328+ ddata->docked = false;
329+ cpcap_usb_try_musb_mailbox(ddata, MUSB_VBUS_OFF);
330+
279331 /* Default to debug UART mode */
280332 error = cpcap_usb_set_uart_mode(ddata);
281333 if (error)
282334 goto out_err;
283335
284− error = musb_mailbox(MUSB_VBUS_OFF);
285− if (error)
286− goto out_err;
287−
288336 dev_dbg(ddata->dev, "set UART mode\n");
289337
290338 return;
@@ -376,7 +424,8 @@ static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata) · 85 unmodified lines
376424 {
377425 int error;
378426
379− error = cpcap_usb_gpio_set_mode(ddata, CPCAP_DM_DP);
427+ /* Disable lines to prevent glitches from waking up mdm6600 */
428+ error = cpcap_usb_gpio_set_mode(ddata, CPCAP_UNKNOWN_DISABLED);
380429 if (error)
381430 goto out_err;
382431
@@ -403,6 +452,11 @@ static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata) · 20 unmodified lines
403452 if (error)
404453 goto out_err;
405454
455+ /* Enable UART mode */
456+ error = cpcap_usb_gpio_set_mode(ddata, CPCAP_DM_DP);
457+ if (error)
458+ goto out_err;
459+
406460 return 0;
407461
408462 out_err:
@@ -415,7 +469,8 @@ static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata) · 6 unmodified lines
415469 {
416470 int error;
417471
418− error = cpcap_usb_gpio_set_mode(ddata, CPCAP_OTG_DM_DP);
472+ /* Disable lines to prevent glitches from waking up mdm6600 */
473+ error = cpcap_usb_gpio_set_mode(ddata, CPCAP_UNKNOWN_DISABLED);
419474 if (error)
420475 return error;
421476
@@ -434,12 +489,6 @@ static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata) · 12 unmodified lines
434489 if (error)
435490 goto out_err;
436491
437− error = regmap_update_bits(ddata->reg, CPCAP_REG_USBC2,
438− CPCAP_BIT_USBXCVREN,
439− CPCAP_BIT_USBXCVREN);
440− if (error)
441− goto out_err;
442−
443492 error = regmap_update_bits(ddata->reg, CPCAP_REG_USBC3,
444493 CPCAP_BIT_PU_SPI |
445494 CPCAP_BIT_DMPD_SPI |
@@ -455,6 +504,11 @@ static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata) · 9 unmodified lines
455504 if (error)
456505 goto out_err;
457506
507+ /* Enable USB mode */
508+ error = cpcap_usb_gpio_set_mode(ddata, CPCAP_OTG_DM_DP);
509+ if (error)
510+ goto out_err;
511+
458512 return 0;
459513
460514 out_err:
@@ -649,9 +703,7 @@ static int cpcap_usb_phy_remove(struct platform_device *pdev) · 188 unmodified lines
649703 if (error)
650704 dev_err(ddata->dev, "could not set UART mode\n");
651705
652− error = musb_mailbox(MUSB_VBUS_OFF);
653− if (error)
654− dev_err(ddata->dev, "could not set mailbox\n");
706+ cpcap_usb_try_musb_mailbox(ddata, MUSB_VBUS_OFF);
655707
656708 usb_remove_phy(&ddata->phy);
657709 cancel_delayed_work_sync(&ddata->detect_work);
drivers/phy/motorola/phy-mapphone-mdm6600.c+3−8
@@ -200,7 +200,7 @@ static void phy_mdm6600_status(struct work_struct *work) · 199 unmodified lines
200200 struct phy_mdm6600 *ddata;
201201 struct device *dev;
202202 DECLARE_BITMAP(values, PHY_MDM6600_NR_STATUS_LINES);
203− int error, i, val = 0;
203+ int error;
204204
205205 ddata = container_of(work, struct phy_mdm6600, status_work.work);
206206 dev = ddata->dev;
@@ -212,16 +212,11 @@ static void phy_mdm6600_status(struct work_struct *work) · 5 unmodified lines
212212 if (error)
213213 return;
214214
215− for (i = 0; i < PHY_MDM6600_NR_STATUS_LINES; i++) {
216− val |= test_bit(i, values) << i;
217− dev_dbg(ddata->dev, "XXX %s: i: %i values[i]: %i val: %i\n",
218− __func__, i, test_bit(i, values), val);
219− }
220− ddata->status = values[0];
215+ ddata->status = values[0] & ((1 << PHY_MDM6600_NR_STATUS_LINES) - 1);
221216
222217 dev_info(dev, "modem status: %i %s\n",
223218 ddata->status,
224− phy_mdm6600_status_name[ddata->status & 7]);
219+ phy_mdm6600_status_name[ddata->status]);
225220 complete(&ddata->ack);
226221 }
227222
drivers/phy/qualcomm/phy-qcom-qmp.c+1−1
@@ -66,7 +66,7 @@ · 65 unmodified lines
6666 /* QPHY_V3_PCS_MISC_CLAMP_ENABLE register bits */
6767 #define CLAMP_EN BIT(0) /* enables i/o clamp_n */
6868
69−#define PHY_INIT_COMPLETE_TIMEOUT 1000
69+#define PHY_INIT_COMPLETE_TIMEOUT 10000
7070 #define POWER_DOWN_DELAY_US_MIN 10
7171 #define POWER_DOWN_DELAY_US_MAX 11
7272
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c+4−0
@@ -603,6 +603,8 @@ static long inno_hdmi_phy_rk3228_clk_round_rate(struct clk_hw *hw, · 602 unmodified lines
603603 {
604604 const struct pre_pll_config *cfg = pre_pll_cfg_table;
605605
606+ rate = (rate / 1000) * 1000;
607+
606608 for (; cfg->pixclock != 0; cfg++)
607609 if (cfg->pixclock == rate && !cfg->fracdiv)
608610 break;
@@ -755,6 +757,8 @@ static long inno_hdmi_phy_rk3328_clk_round_rate(struct clk_hw *hw, · 146 unmodified lines
755757 {
756758 const struct pre_pll_config *cfg = pre_pll_cfg_table;
757759
760+ rate = (rate / 1000) * 1000;
761+
758762 for (; cfg->pixclock != 0; cfg++)
759763 if (cfg->pixclock == rate)
760764 break;
drivers/pinctrl/cirrus/Kconfig+1−0
@@ -2,6 +2,7 @@ · 1 unmodified line
22 config PINCTRL_LOCHNAGAR
33 tristate "Cirrus Logic Lochnagar pinctrl driver"
44 depends on MFD_LOCHNAGAR
5+ select GPIOLIB
56 select PINMUX
67 select PINCONF
78 select GENERIC_PINCONF
drivers/pinctrl/meson/pinctrl-meson.c+1−0
@@ -441,6 +441,7 @@ static int meson_pinconf_get_drive_strength(struct meson_pinctrl *pc, · 440 unmodified lines
441441 return ret;
442442
443443 meson_calc_reg_and_bit(bank, pin, REG_DS, &reg, &bit);
444+ bit = bit << 1;
444445
445446 ret = regmap_read(pc->reg_ds, reg, &val);
446447 if (ret)
drivers/platform/mips/Kconfig+1−1
@@ -18,7 +18,7 @@ if MIPS_PLATFORM_DEVICES · 17 unmodified lines
1818
1919 config CPU_HWMON
2020 tristate "Loongson-3 CPU HWMon Driver"
21− depends on CONFIG_MACH_LOONGSON64
21+ depends on MACH_LOONGSON64
2222 select HWMON
2323 default y
2424 help
drivers/powercap/intel_rapl_common.c+3−0
@@ -1295,6 +1295,9 @@ struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv) · 1294 unmodified lines
12951295 struct cpuinfo_x86 *c = &cpu_data(cpu);
12961296 int ret;
12971297
1298+ if (!rapl_defaults)
1299+ return ERR_PTR(-ENODEV);
1300+
12981301 rp = kzalloc(sizeof(struct rapl_package), GFP_KERNEL);
12991302 if (!rp)
13001303 return ERR_PTR(-ENOMEM);
drivers/ptp/ptp_clock.c+14−17
@@ -166,9 +166,9 @@ static struct posix_clock_operations ptp_clock_ops = { · 165 unmodified lines
166166 .read = ptp_read,
167167 };
168168
169−static void delete_ptp_clock(struct posix_clock *pc)
169+static void ptp_clock_release(struct device *dev)
170170 {
171− struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
171+ struct ptp_clock *ptp = container_of(dev, struct ptp_clock, dev);
172172
173173 mutex_destroy(&ptp->tsevq_mux);
174174 mutex_destroy(&ptp->pincfg_mux);
@@ -213,7 +213,6 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, · 38 unmodified lines
213213 }
214214
215215 ptp->clock.ops = ptp_clock_ops;
216− ptp->clock.release = delete_ptp_clock;
217216 ptp->info = info;
218217 ptp->devid = MKDEV(major, index);
219218 ptp->index = index;
@@ -236,15 +235,6 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, · 16 unmodified lines
236235 if (err)
237236 goto no_pin_groups;
238237
239− /* Create a new device in our class. */
240− ptp->dev = device_create_with_groups(ptp_class, parent, ptp->devid,
241− ptp, ptp->pin_attr_groups,
242− "ptp%d", ptp->index);
243− if (IS_ERR(ptp->dev)) {
244− err = PTR_ERR(ptp->dev);
245− goto no_device;
246− }
247−
248238 /* Register a new PPS source. */
249239 if (info->pps) {
250240 struct pps_source_info pps;
@@ -260,8 +250,18 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, · 9 unmodified lines
260250 }
261251 }
262252
263− /* Create a posix clock. */
264− err = posix_clock_register(&ptp->clock, ptp->devid);
253+ /* Initialize a new device of our class in our clock structure. */
254+ device_initialize(&ptp->dev);
255+ ptp->dev.devt = ptp->devid;
256+ ptp->dev.class = ptp_class;
257+ ptp->dev.parent = parent;
258+ ptp->dev.groups = ptp->pin_attr_groups;
259+ ptp->dev.release = ptp_clock_release;
260+ dev_set_drvdata(&ptp->dev, ptp);
261+ dev_set_name(&ptp->dev, "ptp%d", ptp->index);
262+
263+ /* Create a posix clock and link it to the device. */
264+ err = posix_clock_register(&ptp->clock, &ptp->dev);
265265 if (err) {
266266 pr_err("failed to create posix clock\n");
267267 goto no_clock;
@@ -273,8 +273,6 @@ no_clock: · 5 unmodified lines
273273 if (ptp->pps_source)
274274 pps_unregister_source(ptp->pps_source);
275275 no_pps:
276− device_destroy(ptp_class, ptp->devid);
277−no_device:
278276 ptp_cleanup_pin_groups(ptp);
279277 no_pin_groups:
280278 if (ptp->kworker)
@@ -304,7 +302,6 @@ int ptp_clock_unregister(struct ptp_clock *ptp) · 23 unmodified lines
304302 if (ptp->pps_source)
305303 pps_unregister_source(ptp->pps_source);
306304
307− device_destroy(ptp_class, ptp->devid);
308305 ptp_cleanup_pin_groups(ptp);
309306
310307 posix_clock_unregister(&ptp->clock);
drivers/ptp/ptp_private.h+1−1
@@ -28,7 +28,7 @@ struct timestamp_event_queue { · 27 unmodified lines
2828
2929 struct ptp_clock {
3030 struct posix_clock clock;
31− struct device *dev;
31+ struct device dev;
3232 struct ptp_clock_info *info;
3333 dev_t devid;
3434 int index; /* index into clocks.map */
drivers/regulator/axp20x-regulator.c+7−4
@@ -413,10 +413,13 @@ static int axp20x_set_ramp_delay(struct regulator_dev *rdev, int ramp) · 412 unmodified lines
413413 int i;
414414
415415 for (i = 0; i < rate_count; i++) {
416− if (ramp <= slew_rates[i])
417− cfg = AXP20X_DCDC2_LDO3_V_RAMP_LDO3_RATE(i);
418− else
416+ if (ramp > slew_rates[i])
419417 break;
418+
419+ if (id == AXP20X_DCDC2)
420+ cfg = AXP20X_DCDC2_LDO3_V_RAMP_DCDC2_RATE(i);
421+ else
422+ cfg = AXP20X_DCDC2_LDO3_V_RAMP_LDO3_RATE(i);
420423 }
421424
422425 if (cfg == 0xff) {
@@ -605,7 +608,7 @@ static const struct regulator_desc axp22x_regulators[] = { · 182 unmodified lines
605608 AXP22X_PWR_OUT_CTRL2, AXP22X_PWR_OUT_ELDO1_MASK),
606609 AXP_DESC(AXP22X, ELDO2, "eldo2", "eldoin", 700, 3300, 100,
607610 AXP22X_ELDO2_V_OUT, AXP22X_ELDO2_V_OUT_MASK,
608− AXP22X_PWR_OUT_CTRL2, AXP22X_PWR_OUT_ELDO1_MASK),
611+ AXP22X_PWR_OUT_CTRL2, AXP22X_PWR_OUT_ELDO2_MASK),
609612 AXP_DESC(AXP22X, ELDO3, "eldo3", "eldoin", 700, 3300, 100,
610613 AXP22X_ELDO3_V_OUT, AXP22X_ELDO3_V_OUT_MASK,
611614 AXP22X_PWR_OUT_CTRL2, AXP22X_PWR_OUT_ELDO3_MASK),
drivers/regulator/bd70528-regulator.c+0−1
@@ -101,7 +101,6 @@ static const struct regulator_ops bd70528_ldo_ops = { · 100 unmodified lines
101101 .set_voltage_sel = regulator_set_voltage_sel_regmap,
102102 .get_voltage_sel = regulator_get_voltage_sel_regmap,
103103 .set_voltage_time_sel = regulator_set_voltage_time_sel,
104− .set_ramp_delay = bd70528_set_ramp_delay,
105104 };
106105
107106 static const struct regulator_ops bd70528_led_ops = {
drivers/rtc/rtc-mc146818-lib.c+1−14
@@ -172,20 +172,7 @@ int mc146818_set_time(struct rtc_time *time) · 171 unmodified lines
172172 save_control = CMOS_READ(RTC_CONTROL);
173173 CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);
174174 save_freq_select = CMOS_READ(RTC_FREQ_SELECT);
175−
176−#ifdef CONFIG_X86
177− if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
178− boot_cpu_data.x86 == 0x17) ||
179− boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
180− CMOS_WRITE((save_freq_select & (~RTC_DIV_RESET2)),
181− RTC_FREQ_SELECT);
182− save_freq_select &= ~RTC_DIV_RESET2;
183− } else
184− CMOS_WRITE((save_freq_select | RTC_DIV_RESET2),
185− RTC_FREQ_SELECT);
186−#else
187− CMOS_WRITE((save_freq_select | RTC_DIV_RESET2), RTC_FREQ_SELECT);
188−#endif
175+ CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
189176
190177 #ifdef CONFIG_MACH_DECSTATION
191178 CMOS_WRITE(real_yrs, RTC_DEC_YEAR);
drivers/rtc/rtc-mt6397.c+25−14
@@ -47,7 +47,7 @@ static irqreturn_t mtk_rtc_irq_handler_thread(int irq, void *data) · 46 unmodified lines
4747 irqen = irqsta & ~RTC_IRQ_EN_AL;
4848 mutex_lock(&rtc->lock);
4949 if (regmap_write(rtc->regmap, rtc->addr_base + RTC_IRQ_EN,
50− irqen) < 0)
50+ irqen) == 0)
5151 mtk_rtc_write_trigger(rtc);
5252 mutex_unlock(&rtc->lock);
5353
@@ -169,12 +169,12 @@ static int mtk_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) · 115 unmodified lines
169169 alm->pending = !!(pdn2 & RTC_PDN2_PWRON_ALARM);
170170 mutex_unlock(&rtc->lock);
171171
172− tm->tm_sec = data[RTC_OFFSET_SEC];
173− tm->tm_min = data[RTC_OFFSET_MIN];
174− tm->tm_hour = data[RTC_OFFSET_HOUR];
175− tm->tm_mday = data[RTC_OFFSET_DOM];
176− tm->tm_mon = data[RTC_OFFSET_MTH];
177− tm->tm_year = data[RTC_OFFSET_YEAR];
172+ tm->tm_sec = data[RTC_OFFSET_SEC] & RTC_AL_SEC_MASK;
173+ tm->tm_min = data[RTC_OFFSET_MIN] & RTC_AL_MIN_MASK;
174+ tm->tm_hour = data[RTC_OFFSET_HOUR] & RTC_AL_HOU_MASK;
175+ tm->tm_mday = data[RTC_OFFSET_DOM] & RTC_AL_DOM_MASK;
176+ tm->tm_mon = data[RTC_OFFSET_MTH] & RTC_AL_MTH_MASK;
177+ tm->tm_year = data[RTC_OFFSET_YEAR] & RTC_AL_YEA_MASK;
178178
179179 tm->tm_year += RTC_MIN_YEAR_OFFSET;
180180 tm->tm_mon--;
@@ -195,14 +195,25 @@ static int mtk_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) · 14 unmodified lines
195195 tm->tm_year -= RTC_MIN_YEAR_OFFSET;
196196 tm->tm_mon++;
197197
198− data[RTC_OFFSET_SEC] = tm->tm_sec;
199− data[RTC_OFFSET_MIN] = tm->tm_min;
200− data[RTC_OFFSET_HOUR] = tm->tm_hour;
201− data[RTC_OFFSET_DOM] = tm->tm_mday;
202− data[RTC_OFFSET_MTH] = tm->tm_mon;
203− data[RTC_OFFSET_YEAR] = tm->tm_year;
204−
205198 mutex_lock(&rtc->lock);
199+ ret = regmap_bulk_read(rtc->regmap, rtc->addr_base + RTC_AL_SEC,
200+ data, RTC_OFFSET_COUNT);
201+ if (ret < 0)
202+ goto exit;
203+
204+ data[RTC_OFFSET_SEC] = ((data[RTC_OFFSET_SEC] & ~(RTC_AL_SEC_MASK)) |
205+ (tm->tm_sec & RTC_AL_SEC_MASK));
206+ data[RTC_OFFSET_MIN] = ((data[RTC_OFFSET_MIN] & ~(RTC_AL_MIN_MASK)) |
207+ (tm->tm_min & RTC_AL_MIN_MASK));
208+ data[RTC_OFFSET_HOUR] = ((data[RTC_OFFSET_HOUR] & ~(RTC_AL_HOU_MASK)) |
209+ (tm->tm_hour & RTC_AL_HOU_MASK));
210+ data[RTC_OFFSET_DOM] = ((data[RTC_OFFSET_DOM] & ~(RTC_AL_DOM_MASK)) |
211+ (tm->tm_mday & RTC_AL_DOM_MASK));
212+ data[RTC_OFFSET_MTH] = ((data[RTC_OFFSET_MTH] & ~(RTC_AL_MTH_MASK)) |
213+ (tm->tm_mon & RTC_AL_MTH_MASK));
214+ data[RTC_OFFSET_YEAR] = ((data[RTC_OFFSET_YEAR] & ~(RTC_AL_YEA_MASK)) |
215+ (tm->tm_year & RTC_AL_YEA_MASK));
216+
206217 if (alm->enabled) {
207218 ret = regmap_bulk_write(rtc->regmap,
208219 rtc->addr_base + RTC_AL_SEC,
drivers/rtc/rtc-sun6i.c+16−0
@@ -379,6 +379,22 @@ static void __init sun50i_h6_rtc_clk_init(struct device_node *node) · 378 unmodified lines
379379 CLK_OF_DECLARE_DRIVER(sun50i_h6_rtc_clk, "allwinner,sun50i-h6-rtc",
380380 sun50i_h6_rtc_clk_init);
381381
382+/*
383+ * The R40 user manual is self-conflicting on whether the prescaler is
384+ * fixed or configurable. The clock diagram shows it as fixed, but there
385+ * is also a configurable divider in the RTC block.
386+ */
387+static const struct sun6i_rtc_clk_data sun8i_r40_rtc_data = {
388+ .rc_osc_rate = 16000000,
389+ .fixed_prescaler = 512,
390+};
391+static void __init sun8i_r40_rtc_clk_init(struct device_node *node)
392+{
393+ sun6i_rtc_clk_init(node, &sun8i_r40_rtc_data);
394+}
395+CLK_OF_DECLARE_DRIVER(sun8i_r40_rtc_clk, "allwinner,sun8i-r40-rtc",
396+ sun8i_r40_rtc_clk_init);
397+
382398 static const struct sun6i_rtc_clk_data sun8i_v3_rtc_data = {
383399 .rc_osc_rate = 32000,
384400 .has_out_clk = 1,
drivers/s390/net/qeth_core_main.c+9−20
@@ -2482,50 +2482,46 @@ static int qeth_mpc_initialize(struct qeth_card *card) · 2481 unmodified lines
24822482 rc = qeth_cm_enable(card);
24832483 if (rc) {
24842484 QETH_CARD_TEXT_(card, 2, "2err%d", rc);
2485− goto out_qdio;
2485+ return rc;
24862486 }
24872487 rc = qeth_cm_setup(card);
24882488 if (rc) {
24892489 QETH_CARD_TEXT_(card, 2, "3err%d", rc);
2490− goto out_qdio;
2490+ return rc;
24912491 }
24922492 rc = qeth_ulp_enable(card);
24932493 if (rc) {
24942494 QETH_CARD_TEXT_(card, 2, "4err%d", rc);
2495− goto out_qdio;
2495+ return rc;
24962496 }
24972497 rc = qeth_ulp_setup(card);
24982498 if (rc) {
24992499 QETH_CARD_TEXT_(card, 2, "5err%d", rc);
2500− goto out_qdio;
2500+ return rc;
25012501 }
25022502 rc = qeth_alloc_qdio_queues(card);
25032503 if (rc) {
25042504 QETH_CARD_TEXT_(card, 2, "5err%d", rc);
2505− goto out_qdio;
2505+ return rc;
25062506 }
25072507 rc = qeth_qdio_establish(card);
25082508 if (rc) {
25092509 QETH_CARD_TEXT_(card, 2, "6err%d", rc);
25102510 qeth_free_qdio_queues(card);
2511− goto out_qdio;
2511+ return rc;
25122512 }
25132513 rc = qeth_qdio_activate(card);
25142514 if (rc) {
25152515 QETH_CARD_TEXT_(card, 2, "7err%d", rc);
2516− goto out_qdio;
2516+ return rc;
25172517 }
25182518 rc = qeth_dm_act(card);
25192519 if (rc) {
25202520 QETH_CARD_TEXT_(card, 2, "8err%d", rc);
2521− goto out_qdio;
2521+ return rc;
25222522 }
25232523
25242524 return 0;
2525−out_qdio:
2526− qeth_qdio_clear_card(card, !IS_IQD(card));
2527− qdio_free(CARD_DDEV(card));
2528− return rc;
25292525 }
25302526
25312527 void qeth_print_status_message(struct qeth_card *card)
@@ -3429,11 +3425,6 @@ int qeth_configure_cq(struct qeth_card *card, enum qeth_cq cq) · 897 unmodified lines
34293425 goto out;
34303426 }
34313427
3432− if (card->state != CARD_STATE_DOWN) {
3433− rc = -1;
3434− goto out;
3435− }
3436−
34373428 qeth_free_qdio_queues(card);
34383429 card->options.cq = cq;
34393430 rc = 0;
@@ -5035,10 +5026,8 @@ retriable: · 1595 unmodified lines
50355026 }
50365027 if (qeth_adp_supported(card, IPA_SETADP_SET_DIAG_ASSIST)) {
50375028 rc = qeth_query_setdiagass(card);
5038− if (rc < 0) {
5029+ if (rc)
50395030 QETH_CARD_TEXT_(card, 2, "8err%d", rc);
5040− goto out;
5041− }
50425031 }
50435032
50445033 if (!qeth_is_diagass_supported(card, QETH_DIAGS_CMD_TRAP) ||
drivers/s390/net/qeth_l2_main.c+5−5
@@ -287,12 +287,12 @@ static void qeth_l2_stop_card(struct qeth_card *card) · 286 unmodified lines
287287 card->state = CARD_STATE_HARDSETUP;
288288 }
289289 if (card->state == CARD_STATE_HARDSETUP) {
290− qeth_qdio_clear_card(card, 0);
291290 qeth_drain_output_queues(card);
292291 qeth_clear_working_pool_list(card);
293292 card->state = CARD_STATE_DOWN;
294293 }
295294
295+ qeth_qdio_clear_card(card, 0);
296296 flush_workqueue(card->event_wq);
297297 card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED;
298298 card->info.promisc_mode = 0;
@@ -1952,8 +1952,7 @@ int qeth_l2_vnicc_get_timeout(struct qeth_card *card, u32 *timeout) · 1653 unmodified lines
19521952 /* check if VNICC is currently enabled */
19531953 bool qeth_l2_vnicc_is_in_use(struct qeth_card *card)
19541954 {
1955− /* if everything is turned off, VNICC is not active */
1956− if (!card->options.vnicc.cur_chars)
1955+ if (!card->options.vnicc.sup_chars)
19571956 return false;
19581957 /* default values are only OK if rx_bcast was not enabled by user
19591958 * or the card is offline.
@@ -2040,8 +2039,9 @@ static void qeth_l2_vnicc_init(struct qeth_card *card) · 80 unmodified lines
20402039 /* enforce assumed default values and recover settings, if changed */
20412040 error |= qeth_l2_vnicc_recover_timeout(card, QETH_VNICC_LEARNING,
20422041 timeout);
2043− chars_tmp = card->options.vnicc.wanted_chars ^ QETH_VNICC_DEFAULT;
2044− chars_tmp |= QETH_VNICC_BRIDGE_INVISIBLE;
2042+ /* Change chars, if necessary */
2043+ chars_tmp = card->options.vnicc.wanted_chars ^
2044+ card->options.vnicc.cur_chars;
20452045 chars_len = sizeof(card->options.vnicc.wanted_chars) * BITS_PER_BYTE;
20462046 for_each_set_bit(i, &chars_tmp, chars_len) {
20472047 vnicc = BIT(i);
drivers/s390/net/qeth_l3_main.c+1−1
@@ -1307,12 +1307,12 @@ static void qeth_l3_stop_card(struct qeth_card *card) · 1306 unmodified lines
13071307 card->state = CARD_STATE_HARDSETUP;
13081308 }
13091309 if (card->state == CARD_STATE_HARDSETUP) {
1310− qeth_qdio_clear_card(card, 0);
13111310 qeth_drain_output_queues(card);
13121311 qeth_clear_working_pool_list(card);
13131312 card->state = CARD_STATE_DOWN;
13141313 }
13151314
1315+ qeth_qdio_clear_card(card, 0);
13161316 flush_workqueue(card->event_wq);
13171317 card->info.promisc_mode = 0;
13181318 }
drivers/s390/net/qeth_l3_sys.c+28−12
@@ -242,21 +242,33 @@ static ssize_t qeth_l3_dev_hsuid_store(struct device *dev, · 241 unmodified lines
242242 struct device_attribute *attr, const char *buf, size_t count)
243243 {
244244 struct qeth_card *card = dev_get_drvdata(dev);
245+ int rc = 0;
245246 char *tmp;
246− int rc;
247247
248248 if (!IS_IQD(card))
249249 return -EPERM;
250− if (card->state != CARD_STATE_DOWN)
251− return -EPERM;
252− if (card->options.sniffer)
253− return -EPERM;
254− if (card->options.cq == QETH_CQ_NOTAVAILABLE)
255− return -EPERM;
250+
251+ mutex_lock(&card->conf_mutex);
252+ if (card->state != CARD_STATE_DOWN) {
253+ rc = -EPERM;
254+ goto out;
255+ }
256+
257+ if (card->options.sniffer) {
258+ rc = -EPERM;
259+ goto out;
260+ }
261+
262+ if (card->options.cq == QETH_CQ_NOTAVAILABLE) {
263+ rc = -EPERM;
264+ goto out;
265+ }
256266
257267 tmp = strsep((char **)&buf, "\n");
258− if (strlen(tmp) > 8)
259− return -EINVAL;
268+ if (strlen(tmp) > 8) {
269+ rc = -EINVAL;
270+ goto out;
271+ }
260272
261273 if (card->options.hsuid[0])
262274 /* delete old ip address */
@@ -267,11 +279,13 @@ static ssize_t qeth_l3_dev_hsuid_store(struct device *dev, · 4 unmodified lines
267279 card->options.hsuid[0] = '\0';
268280 memcpy(card->dev->perm_addr, card->options.hsuid, 9);
269281 qeth_configure_cq(card, QETH_CQ_DISABLED);
270− return count;
282+ goto out;
271283 }
272284
273− if (qeth_configure_cq(card, QETH_CQ_ENABLED))
274− return -EPERM;
285+ if (qeth_configure_cq(card, QETH_CQ_ENABLED)) {
286+ rc = -EPERM;
287+ goto out;
288+ }
275289
276290 snprintf(card->options.hsuid, sizeof(card->options.hsuid),
277291 "%-8s", tmp);
@@ -280,6 +294,8 @@ static ssize_t qeth_l3_dev_hsuid_store(struct device *dev, · 2 unmodified lines
280294
281295 rc = qeth_l3_modify_hsuid(card, true);
282296
297+out:
298+ mutex_unlock(&card->conf_mutex);
283299 return rc ? rc : count;
284300 }
285301
drivers/scsi/cxgbi/libcxgbi.c+2−1
@@ -121,7 +121,8 @@ static inline void cxgbi_device_destroy(struct cxgbi_device *cdev) · 120 unmodified lines
121121 "cdev 0x%p, p# %u.\n", cdev, cdev->nports);
122122 cxgbi_hbas_remove(cdev);
123123 cxgbi_device_portmap_cleanup(cdev);
124− cxgbi_ppm_release(cdev->cdev2ppm(cdev));
124+ if (cdev->cdev2ppm)
125+ cxgbi_ppm_release(cdev->cdev2ppm(cdev));
125126 if (cdev->pmap.max_connect)
126127 cxgbi_free_big_mem(cdev->pmap.port_csk);
127128 kfree(cdev);
drivers/scsi/lpfc/lpfc_debugfs.c+1−2
@@ -5385,7 +5385,6 @@ static const struct file_operations lpfc_debugfs_ras_log = { · 5384 unmodified lines
53855385 .read = lpfc_debugfs_read,
53865386 .release = lpfc_debugfs_ras_log_release,
53875387 };
5388−#endif
53895388
53905389 #undef lpfc_debugfs_op_dumpHBASlim
53915390 static const struct file_operations lpfc_debugfs_op_dumpHBASlim = {
@@ -5557,7 +5556,7 @@ static const struct file_operations lpfc_idiag_op_extAcc = { · 165 unmodified lines
55575556 .write = lpfc_idiag_extacc_write,
55585557 .release = lpfc_idiag_cmd_release,
55595558 };
5560−
5559+#endif
55615560
55625561 /* lpfc_idiag_mbxacc_dump_bsg_mbox - idiag debugfs dump bsg mailbox command
55635562 * @phba: Pointer to HBA context object.
drivers/scsi/lpfc/lpfc_init.c+1−1
@@ -5883,7 +5883,7 @@ void lpfc_sli4_async_event_proc(struct lpfc_hba *phba) · 5882 unmodified lines
58835883 break;
58845884 default:
58855885 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
5886− "1804 Invalid asynchrous event code: "
5886+ "1804 Invalid asynchronous event code: "
58875887 "x%x\n", bf_get(lpfc_trailer_code,
58885888 &cq_event->cqe.mcqe_cmpl));
58895889 break;
drivers/scsi/lpfc/lpfc_sli.c+5−5
@@ -8555,7 +8555,7 @@ lpfc_sli4_async_mbox_unblock(struct lpfc_hba *phba) · 8554 unmodified lines
85558555 psli->sli_flag &= ~LPFC_SLI_ASYNC_MBX_BLK;
85568556 spin_unlock_irq(&phba->hbalock);
85578557
8558− /* wake up worker thread to post asynchronlous mailbox command */
8558+ /* wake up worker thread to post asynchronous mailbox command */
85598559 lpfc_worker_wake_up(phba);
85608560 }
85618561
@@ -8823,7 +8823,7 @@ lpfc_sli_issue_mbox_s4(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq, · 261 unmodified lines
88238823 return rc;
88248824 }
88258825
8826− /* Now, interrupt mode asynchrous mailbox command */
8826+ /* Now, interrupt mode asynchronous mailbox command */
88278827 rc = lpfc_mbox_cmd_check(phba, mboxq);
88288828 if (rc) {
88298829 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
@@ -13112,11 +13112,11 @@ lpfc_cq_event_setup(struct lpfc_hba *phba, void *entry, int size) · 4282 unmodified lines
1311213112 }
1311313113
1311413114 /**
13115− * lpfc_sli4_sp_handle_async_event - Handle an asynchroous event
13115+ * lpfc_sli4_sp_handle_async_event - Handle an asynchronous event
1311613116 * @phba: Pointer to HBA context object.
1311713117 * @cqe: Pointer to mailbox completion queue entry.
1311813118 *
13119− * This routine process a mailbox completion queue entry with asynchrous
13119+ * This routine process a mailbox completion queue entry with asynchronous
1312013120 * event.
1312113121 *
1312213122 * Return: true if work posted to worker thread, otherwise false.
@@ -13270,7 +13270,7 @@ out_no_mqe_complete: · 147 unmodified lines
1327013270 * @cqe: Pointer to mailbox completion queue entry.
1327113271 *
1327213272 * This routine process a mailbox completion queue entry, it invokes the
13273− * proper mailbox complete handling or asynchrous event handling routine
13273+ * proper mailbox complete handling or asynchronous event handling routine
1327413274 * according to the MCQE's async bit.
1327513275 *
1327613276 * Return: true if work posted to worker thread, otherwise false.
drivers/scsi/mpt3sas/mpt3sas_base.c+0−1
@@ -5248,7 +5248,6 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 5247 unmodified lines
52485248 &ct->chain_buffer_dma);
52495249 if (!ct->chain_buffer) {
52505250 ioc_err(ioc, "chain_lookup: pci_pool_alloc failed\n");
5251− _base_release_memory_pools(ioc);
52525251 goto out;
52535252 }
52545253 }
drivers/soc/sifive/sifive_l2_cache.c+1−1
@@ -9,7 +9,7 @@ · 8 unmodified lines
99 #include <linux/interrupt.h>
1010 #include <linux/of_irq.h>
1111 #include <linux/of_address.h>
12−#include <asm/sifive_l2_cache.h>
12+#include <soc/sifive/sifive_l2_cache.h>
1313
1414 #define SIFIVE_L2_DIRECCFIX_LOW 0x100
1515 #define SIFIVE_L2_DIRECCFIX_HIGH 0x104
drivers/spi/spi-dw.c+12−3
@@ -172,9 +172,11 @@ static inline u32 rx_max(struct dw_spi *dws) · 171 unmodified lines
172172
173173 static void dw_writer(struct dw_spi *dws)
174174 {
175− u32 max = tx_max(dws);
175+ u32 max;
176176 u16 txw = 0;
177177
178+ spin_lock(&dws->buf_lock);
179+ max = tx_max(dws);
178180 while (max--) {
179181 /* Set the tx word if the transfer's original "tx" is not null */
180182 if (dws->tx_end - dws->len) {
@@ -186,13 +188,16 @@ static void dw_writer(struct dw_spi *dws) · 5 unmodified lines
186188 dw_write_io_reg(dws, DW_SPI_DR, txw);
187189 dws->tx += dws->n_bytes;
188190 }
191+ spin_unlock(&dws->buf_lock);
189192 }
190193
191194 static void dw_reader(struct dw_spi *dws)
192195 {
193− u32 max = rx_max(dws);
196+ u32 max;
194197 u16 rxw;
195198
199+ spin_lock(&dws->buf_lock);
200+ max = rx_max(dws);
196201 while (max--) {
197202 rxw = dw_read_io_reg(dws, DW_SPI_DR);
198203 /* Care rx only if the transfer's original "rx" is not null */
@@ -204,6 +209,7 @@ static void dw_reader(struct dw_spi *dws) · 5 unmodified lines
204209 }
205210 dws->rx += dws->n_bytes;
206211 }
212+ spin_unlock(&dws->buf_lock);
207213 }
208214
209215 static void int_error_stop(struct dw_spi *dws, const char *msg)
@@ -276,18 +282,20 @@ static int dw_spi_transfer_one(struct spi_controller *master, · 66 unmodified lines
276282 {
277283 struct dw_spi *dws = spi_controller_get_devdata(master);
278284 struct chip_data *chip = spi_get_ctldata(spi);
285+ unsigned long flags;
279286 u8 imask = 0;
280287 u16 txlevel = 0;
281288 u32 cr0;
282289 int ret;
283290
284291 dws->dma_mapped = 0;
285−
292+ spin_lock_irqsave(&dws->buf_lock, flags);
286293 dws->tx = (void *)transfer->tx_buf;
287294 dws->tx_end = dws->tx + transfer->len;
288295 dws->rx = transfer->rx_buf;
289296 dws->rx_end = dws->rx + transfer->len;
290297 dws->len = transfer->len;
298+ spin_unlock_irqrestore(&dws->buf_lock, flags);
291299
292300 spi_enable_chip(dws, 0);
293301
@@ -471,6 +479,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) · 177 unmodified lines
471479 dws->type = SSI_MOTO_SPI;
472480 dws->dma_inited = 0;
473481 dws->dma_addr = (dma_addr_t)(dws->paddr + DW_SPI_DR);
482+ spin_lock_init(&dws->buf_lock);
474483
475484 spi_controller_set_devdata(master, dws);
476485
drivers/spi/spi-dw.h+1−0
@@ -119,6 +119,7 @@ struct dw_spi { · 118 unmodified lines
119119 size_t len;
120120 void *tx;
121121 void *tx_end;
122+ spinlock_t buf_lock;
122123 void *rx;
123124 void *rx_end;
124125 int dma_mapped;
drivers/spi/spi-fsl-dspi.c+10−14
@@ -185,6 +185,7 @@ struct fsl_dspi { · 184 unmodified lines
185185 struct spi_transfer *cur_transfer;
186186 struct spi_message *cur_msg;
187187 struct chip_data *cur_chip;
188+ size_t progress;
188189 size_t len;
189190 const void *tx;
190191 void *rx;
@@ -586,21 +587,14 @@ static void dspi_tcfq_write(struct fsl_dspi *dspi) · 395 unmodified lines
586587 dspi->tx_cmd |= SPI_PUSHR_CMD_CTCNT;
587588
588589 if (dspi->devtype_data->xspi_mode && dspi->bits_per_word > 16) {
589− /* Write two TX FIFO entries first, and then the corresponding
590− * CMD FIFO entry.
590+ /* Write the CMD FIFO entry first, and then the two
591+ * corresponding TX FIFO entries.
591592 */
592593 u32 data = dspi_pop_tx(dspi);
593594
594− if (dspi->cur_chip->ctar_val & SPI_CTAR_LSBFE) {
595− /* LSB */
596− tx_fifo_write(dspi, data & 0xFFFF);
597− tx_fifo_write(dspi, data >> 16);
598− } else {
599− /* MSB */
600− tx_fifo_write(dspi, data >> 16);
601− tx_fifo_write(dspi, data & 0xFFFF);
602− }
603595 cmd_fifo_write(dspi);
596+ tx_fifo_write(dspi, data & 0xFFFF);
597+ tx_fifo_write(dspi, data >> 16);
604598 } else {
605599 /* Write one entry to both TX FIFO and CMD FIFO
606600 * simultaneously.
@@ -658,7 +652,7 @@ static int dspi_rxtx(struct fsl_dspi *dspi) · 51 unmodified lines
658652 u32 spi_tcr;
659653
660654 spi_take_timestamp_post(dspi->ctlr, dspi->cur_transfer,
661− dspi->tx - dspi->bytes_per_word, !dspi->irq);
655+ dspi->progress, !dspi->irq);
662656
663657 /* Get transfer counter (in number of SPI transfers). It was
664658 * reset to 0 when transfer(s) were started.
@@ -667,6 +661,7 @@ static int dspi_rxtx(struct fsl_dspi *dspi) · 2 unmodified lines
667661 spi_tcnt = SPI_TCR_GET_TCNT(spi_tcr);
668662 /* Update total number of bytes that were transferred */
669663 msg->actual_length += spi_tcnt * dspi->bytes_per_word;
664+ dspi->progress += spi_tcnt;
670665
671666 trans_mode = dspi->devtype_data->trans_mode;
672667 if (trans_mode == DSPI_EOQ_MODE)
@@ -679,7 +674,7 @@ static int dspi_rxtx(struct fsl_dspi *dspi) · 6 unmodified lines
679674 return 0;
680675
681676 spi_take_timestamp_pre(dspi->ctlr, dspi->cur_transfer,
682− dspi->tx, !dspi->irq);
677+ dspi->progress, !dspi->irq);
683678
684679 if (trans_mode == DSPI_EOQ_MODE)
685680 dspi_eoq_write(dspi);
@@ -768,6 +763,7 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr, · 82 unmodified lines
768763 dspi->rx = transfer->rx_buf;
769764 dspi->rx_end = dspi->rx + transfer->len;
770765 dspi->len = transfer->len;
766+ dspi->progress = 0;
771767 /* Validated transfer specific frame size (defaults applied) */
772768 dspi->bits_per_word = transfer->bits_per_word;
773769 if (transfer->bits_per_word <= 8)
@@ -789,7 +785,7 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr, · 15 unmodified lines
789785 SPI_CTARE_DTCP(1));
790786
791787 spi_take_timestamp_pre(dspi->ctlr, dspi->cur_transfer,
792− dspi->tx, !dspi->irq);
788+ dspi->progress, !dspi->irq);
793789
794790 trans_mode = dspi->devtype_data->trans_mode;
795791 switch (trans_mode) {
drivers/spi/spi-uniphier.c+19−12
@@ -290,25 +290,32 @@ static void uniphier_spi_recv(struct uniphier_spi_priv *priv) · 289 unmodified lines
290290 }
291291 }
292292
293−static void uniphier_spi_fill_tx_fifo(struct uniphier_spi_priv *priv)
293+static void uniphier_spi_set_fifo_threshold(struct uniphier_spi_priv *priv,
294+ unsigned int threshold)
294295 {
295− unsigned int fifo_threshold, fill_bytes;
296296 u32 val;
297297
298− fifo_threshold = DIV_ROUND_UP(priv->rx_bytes,
299− bytes_per_word(priv->bits_per_word));
300− fifo_threshold = min(fifo_threshold, SSI_FIFO_DEPTH);
301−
302− fill_bytes = fifo_threshold - (priv->rx_bytes - priv->tx_bytes);
303−
304− /* set fifo threshold */
305298 val = readl(priv->base + SSI_FC);
306299 val &= ~(SSI_FC_TXFTH_MASK | SSI_FC_RXFTH_MASK);
307− val |= FIELD_PREP(SSI_FC_TXFTH_MASK, fifo_threshold);
308− val |= FIELD_PREP(SSI_FC_RXFTH_MASK, fifo_threshold);
300+ val |= FIELD_PREP(SSI_FC_TXFTH_MASK, SSI_FIFO_DEPTH - threshold);
301+ val |= FIELD_PREP(SSI_FC_RXFTH_MASK, threshold);
309302 writel(val, priv->base + SSI_FC);
303+}
304+
305+static void uniphier_spi_fill_tx_fifo(struct uniphier_spi_priv *priv)
306+{
307+ unsigned int fifo_threshold, fill_words;
308+ unsigned int bpw = bytes_per_word(priv->bits_per_word);
309+
310+ fifo_threshold = DIV_ROUND_UP(priv->rx_bytes, bpw);
311+ fifo_threshold = min(fifo_threshold, SSI_FIFO_DEPTH);
312+
313+ uniphier_spi_set_fifo_threshold(priv, fifo_threshold);
314+
315+ fill_words = fifo_threshold -
316+ DIV_ROUND_UP(priv->rx_bytes - priv->tx_bytes, bpw);
310317
311− while (fill_bytes--)
318+ while (fill_words--)
312319 uniphier_spi_send(priv);
313320 }
314321
drivers/spi/spi.c+8−14
@@ -1499,8 +1499,7 @@ static void spi_pump_messages(struct kthread_work *work) · 1498 unmodified lines
14991499 * advances its @tx buffer pointer monotonically.
15001500 * @ctlr: Pointer to the spi_controller structure of the driver
15011501 * @xfer: Pointer to the transfer being timestamped
1502− * @tx: Pointer to the current word within the xfer->tx_buf that the driver is
1503− * preparing to transmit right now.
1502+ * @progress: How many words (not bytes) have been transferred so far
15041503 * @irqs_off: If true, will disable IRQs and preemption for the duration of the
15051504 * transfer, for less jitter in time measurement. Only compatible
15061505 * with PIO drivers. If true, must follow up with
@@ -1510,21 +1509,19 @@ static void spi_pump_messages(struct kthread_work *work) · 3 unmodified lines
15101509 */
15111510 void spi_take_timestamp_pre(struct spi_controller *ctlr,
15121511 struct spi_transfer *xfer,
1513− const void *tx, bool irqs_off)
1512+ size_t progress, bool irqs_off)
15141513 {
1515− u8 bytes_per_word = DIV_ROUND_UP(xfer->bits_per_word, 8);
1516−
15171514 if (!xfer->ptp_sts)
15181515 return;
15191516
15201517 if (xfer->timestamped_pre)
15211518 return;
15221519
1523− if (tx < (xfer->tx_buf + xfer->ptp_sts_word_pre * bytes_per_word))
1520+ if (progress < xfer->ptp_sts_word_pre)
15241521 return;
15251522
15261523 /* Capture the resolution of the timestamp */
1527− xfer->ptp_sts_word_pre = (tx - xfer->tx_buf) / bytes_per_word;
1524+ xfer->ptp_sts_word_pre = progress;
15281525
15291526 xfer->timestamped_pre = true;
15301527
@@ -1546,23 +1543,20 @@ EXPORT_SYMBOL_GPL(spi_take_timestamp_pre); · 15 unmodified lines
15461543 * timestamped.
15471544 * @ctlr: Pointer to the spi_controller structure of the driver
15481545 * @xfer: Pointer to the transfer being timestamped
1549− * @tx: Pointer to the current word within the xfer->tx_buf that the driver has
1550− * just transmitted.
1546+ * @progress: How many words (not bytes) have been transferred so far
15511547 * @irqs_off: If true, will re-enable IRQs and preemption for the local CPU.
15521548 */
15531549 void spi_take_timestamp_post(struct spi_controller *ctlr,
15541550 struct spi_transfer *xfer,
1555− const void *tx, bool irqs_off)
1551+ size_t progress, bool irqs_off)
15561552 {
1557− u8 bytes_per_word = DIV_ROUND_UP(xfer->bits_per_word, 8);
1558−
15591553 if (!xfer->ptp_sts)
15601554 return;
15611555
15621556 if (xfer->timestamped_post)
15631557 return;
15641558
1565− if (tx < (xfer->tx_buf + xfer->ptp_sts_word_post * bytes_per_word))
1559+ if (progress < xfer->ptp_sts_word_post)
15661560 return;
15671561
15681562 ptp_read_system_postts(xfer->ptp_sts);
@@ -1573,7 +1567,7 @@ void spi_take_timestamp_post(struct spi_controller *ctlr, · 4 unmodified lines
15731567 }
15741568
15751569 /* Capture the resolution of the timestamp */
1576− xfer->ptp_sts_word_post = (tx - xfer->tx_buf) / bytes_per_word;
1570+ xfer->ptp_sts_word_post = progress;
15771571
15781572 xfer->timestamped_post = true;
15791573 }
drivers/staging/comedi/drivers/adv_pci1710.c+2−2
@@ -46,8 +46,8 @@ · 45 unmodified lines
4646 #define PCI171X_RANGE_UNI BIT(4)
4747 #define PCI171X_RANGE_GAIN(x) (((x) & 0x7) << 0)
4848 #define PCI171X_MUX_REG 0x04 /* W: A/D multiplexor control */
49−#define PCI171X_MUX_CHANH(x) (((x) & 0xf) << 8)
50−#define PCI171X_MUX_CHANL(x) (((x) & 0xf) << 0)
49+#define PCI171X_MUX_CHANH(x) (((x) & 0xff) << 8)
50+#define PCI171X_MUX_CHANL(x) (((x) & 0xff) << 0)
5151 #define PCI171X_MUX_CHAN(x) (PCI171X_MUX_CHANH(x) | PCI171X_MUX_CHANL(x))
5252 #define PCI171X_STATUS_REG 0x06 /* R: status register */
5353 #define PCI171X_STATUS_IRQ BIT(11) /* 1=IRQ occurred */
drivers/staging/media/ipu3/include/intel-ipu3.h+1−1
@@ -449,7 +449,7 @@ struct ipu3_uapi_awb_fr_config_s { · 448 unmodified lines
449449 __u16 reserved1;
450450 __u32 bayer_sign;
451451 __u8 bayer_nf;
452− __u8 reserved2[3];
452+ __u8 reserved2[7];
453453 } __attribute__((aligned(32))) __packed;
454454
455455 /**
drivers/staging/rtl8188eu/os_dep/usb_intf.c+1−0
@@ -37,6 +37,7 @@ static const struct usb_device_id rtw_usb_id_tbl[] = { · 36 unmodified lines
3737 {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */
3838 {USB_DEVICE(0x2001, 0x331B)}, /* D-Link DWA-121 rev B1 */
3939 {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */
40+ {USB_DEVICE(0x2357, 0x0111)}, /* TP-Link TL-WN727N v5.21 */
4041 {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */
4142 {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */
4243 {} /* Terminating entry */
drivers/staging/vt6656/baseband.c+2−2
@@ -449,8 +449,8 @@ int vnt_vt3184_init(struct vnt_private *priv) · 448 unmodified lines
449449
450450 memcpy(array, addr, length);
451451
452− ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0,
453− MESSAGE_REQUEST_BBREG, length, array);
452+ ret = vnt_control_out_blocks(priv, VNT_REG_BLOCK_SIZE,
453+ MESSAGE_REQUEST_BBREG, length, array);
454454 if (ret)
455455 goto end;
456456
drivers/staging/vt6656/card.c+1−1
@@ -719,7 +719,7 @@ end: · 718 unmodified lines
719719 */
720720 int vnt_radio_power_on(struct vnt_private *priv)
721721 {
722− int ret = true;
722+ int ret = 0;
723723
724724 vnt_exit_deep_sleep(priv);
725725
drivers/staging/vt6656/device.h+1−0
@@ -259,6 +259,7 @@ struct vnt_private { · 258 unmodified lines
259259 u8 mac_hw;
260260 /* netdev */
261261 struct usb_device *usb;
262+ struct usb_interface *intf;
262263
263264 u64 tsf_time;
264265 u8 rx_rate;
drivers/staging/vt6656/main_usb.c+2−1
@@ -949,7 +949,7 @@ static const struct ieee80211_ops vnt_mac_ops = { · 948 unmodified lines
949949
950950 int vnt_init(struct vnt_private *priv)
951951 {
952− if (!(vnt_init_registers(priv)))
952+ if (vnt_init_registers(priv))
953953 return -EAGAIN;
954954
955955 SET_IEEE80211_PERM_ADDR(priv->hw, priv->permanent_net_addr);
@@ -992,6 +992,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) · 36 unmodified lines
992992 priv = hw->priv;
993993 priv->hw = hw;
994994 priv->usb = udev;
995+ priv->intf = intf;
995996
996997 vnt_set_options(priv);
997998
drivers/staging/vt6656/usbpipe.c+23−2
@@ -59,7 +59,9 @@ int vnt_control_out(struct vnt_private *priv, u8 request, u16 value, · 58 unmodified lines
5959
6060 kfree(usb_buffer);
6161
62− if (ret >= 0 && ret < (int)length)
62+ if (ret == (int)length)
63+ ret = 0;
64+ else
6365 ret = -EIO;
6466
6567 end_unlock:
@@ -74,6 +76,23 @@ int vnt_control_out_u8(struct vnt_private *priv, u8 reg, u8 reg_off, u8 data) · 8 unmodified lines
7476 reg_off, reg, sizeof(u8), &data);
7577 }
7678
79+int vnt_control_out_blocks(struct vnt_private *priv,
80+ u16 block, u8 reg, u16 length, u8 *data)
81+{
82+ int ret = 0, i;
83+
84+ for (i = 0; i < length; i += block) {
85+ u16 len = min_t(int, length - i, block);
86+
87+ ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE,
88+ i, reg, len, data + i);
89+ if (ret)
90+ goto end;
91+ }
92+end:
93+ return ret;
94+}
95+
7796 int vnt_control_in(struct vnt_private *priv, u8 request, u16 value,
7897 u16 index, u16 length, u8 *buffer)
7998 {
@@ -103,7 +122,9 @@ int vnt_control_in(struct vnt_private *priv, u8 request, u16 value, · 23 unmodified lines
103122
104123 kfree(usb_buffer);
105124
106− if (ret >= 0 && ret < (int)length)
125+ if (ret == (int)length)
126+ ret = 0;
127+ else
107128 ret = -EIO;
108129
109130 end_unlock:
drivers/staging/vt6656/usbpipe.h+5−0
@@ -18,6 +18,8 @@ · 17 unmodified lines
1818
1919 #include "device.h"
2020
21+#define VNT_REG_BLOCK_SIZE 64
22+
2123 int vnt_control_out(struct vnt_private *priv, u8 request, u16 value,
2224 u16 index, u16 length, u8 *buffer);
2325 int vnt_control_in(struct vnt_private *priv, u8 request, u16 value,
@@ -26,6 +28,9 @@ int vnt_control_in(struct vnt_private *priv, u8 request, u16 value, · 2 unmodified lines
2628 int vnt_control_out_u8(struct vnt_private *priv, u8 reg, u8 ref_off, u8 data);
2729 int vnt_control_in_u8(struct vnt_private *priv, u8 reg, u8 reg_off, u8 *data);
2830
31+int vnt_control_out_blocks(struct vnt_private *priv,
32+ u16 block, u8 reg, u16 len, u8 *data);
33+
2934 int vnt_start_interrupt_urb(struct vnt_private *priv);
3035 int vnt_submit_rx_urb(struct vnt_private *priv, struct vnt_rcb *rcb);
3136 int vnt_tx_context(struct vnt_private *priv,
drivers/staging/vt6656/wcmd.c+1−0
@@ -99,6 +99,7 @@ void vnt_run_command(struct work_struct *work) · 98 unmodified lines
9999 if (vnt_init(priv)) {
100100 /* If fail all ends TODO retry */
101101 dev_err(&priv->usb->dev, "failed to start\n");
102+ usb_set_intfdata(priv->intf, NULL);
102103 ieee80211_free_hw(priv->hw);
103104 return;
104105 }
drivers/target/target_core_iblock.c+3−1
@@ -646,7 +646,9 @@ iblock_alloc_bip(struct se_cmd *cmd, struct bio *bio, · 645 unmodified lines
646646 }
647647
648648 bip->bip_iter.bi_size = bio_integrity_bytes(bi, bio_sectors(bio));
649− bip_set_seed(bip, bio->bi_iter.bi_sector);
649+ /* virtual start sector must be in integrity interval units */
650+ bip_set_seed(bip, bio->bi_iter.bi_sector >>
651+ (bi->interval_exp - SECTOR_SHIFT));
650652
651653 pr_debug("IBLOCK BIP Size: %u Sector: %llu\n", bip->bip_iter.bi_size,
652654 (unsigned long long)bip->bip_iter.bi_sector);
drivers/thermal/qcom/tsens.c+3−0
@@ -110,6 +110,9 @@ static int tsens_register(struct tsens_priv *priv) · 109 unmodified lines
110110 irq = platform_get_irq_byname(pdev, "uplow");
111111 if (irq < 0) {
112112 ret = irq;
113+ /* For old DTs with no IRQ defined */
114+ if (irq == -ENXIO)
115+ ret = 0;
113116 goto err_put_device;
114117 }
115118
drivers/tty/serdev/core.c+10−0
@@ -663,6 +663,12 @@ static acpi_status acpi_serdev_register_device(struct serdev_controller *ctrl, · 662 unmodified lines
663663 return AE_OK;
664664 }
665665
666+static const struct acpi_device_id serdev_acpi_devices_blacklist[] = {
667+ { "INT3511", 0 },
668+ { "INT3512", 0 },
669+ { },
670+};
671+
666672 static acpi_status acpi_serdev_add_device(acpi_handle handle, u32 level,
667673 void *data, void **return_value)
668674 {
@@ -675,6 +681,10 @@ static acpi_status acpi_serdev_add_device(acpi_handle handle, u32 level, · 6 unmodified lines
675681 if (acpi_device_enumerated(adev))
676682 return AE_OK;
677683
684+ /* Skip if black listed */
685+ if (!acpi_match_device_ids(adev, serdev_acpi_devices_blacklist))
686+ return AE_OK;
687+
678688 if (acpi_serdev_check_resources(ctrl, adev))
679689 return AE_OK;
680690
drivers/tty/tty_port.c+1−2
@@ -89,8 +89,7 @@ void tty_port_link_device(struct tty_port *port, · 88 unmodified lines
8989 {
9090 if (WARN_ON(index >= driver->num))
9191 return;
92− if (!driver->ports[index])
93− driver->ports[index] = port;
92+ driver->ports[index] = port;
9493 }
9594 EXPORT_SYMBOL_GPL(tty_port_link_device);
9695
drivers/usb/cdns3/gadget.c+5−9
@@ -1375,13 +1375,10 @@ static void cdns3_check_usb_interrupt_proceed(struct cdns3_device *priv_dev, · 1374 unmodified lines
13751375 */
13761376 static irqreturn_t cdns3_device_irq_handler(int irq, void *data)
13771377 {
1378− struct cdns3_device *priv_dev;
1379− struct cdns3 *cdns = data;
1378+ struct cdns3_device *priv_dev = data;
13801379 irqreturn_t ret = IRQ_NONE;
13811380 u32 reg;
13821381
1383− priv_dev = cdns->gadget_dev;
1384−
13851382 /* check USB device interrupt */
13861383 reg = readl(&priv_dev->regs->usb_ists);
13871384 if (reg) {
@@ -1419,14 +1416,12 @@ static irqreturn_t cdns3_device_irq_handler(int irq, void *data) · 31 unmodified lines
14191416 */
14201417 static irqreturn_t cdns3_device_thread_irq_handler(int irq, void *data)
14211418 {
1422− struct cdns3_device *priv_dev;
1423− struct cdns3 *cdns = data;
1419+ struct cdns3_device *priv_dev = data;
14241420 irqreturn_t ret = IRQ_NONE;
14251421 unsigned long flags;
14261422 int bit;
14271423 u32 reg;
14281424
1429− priv_dev = cdns->gadget_dev;
14301425 spin_lock_irqsave(&priv_dev->lock, flags);
14311426
14321427 reg = readl(&priv_dev->regs->usb_ists);
@@ -2538,7 +2533,7 @@ void cdns3_gadget_exit(struct cdns3 *cdns) · 1105 unmodified lines
25382533
25392534 priv_dev = cdns->gadget_dev;
25402535
2541− devm_free_irq(cdns->dev, cdns->dev_irq, cdns);
2536+ devm_free_irq(cdns->dev, cdns->dev_irq, priv_dev);
25422537
25432538 pm_runtime_mark_last_busy(cdns->dev);
25442539 pm_runtime_put_autosuspend(cdns->dev);
@@ -2709,7 +2704,8 @@ static int __cdns3_gadget_init(struct cdns3 *cdns) · 164 unmodified lines
27092704 ret = devm_request_threaded_irq(cdns->dev, cdns->dev_irq,
27102705 cdns3_device_irq_handler,
27112706 cdns3_device_thread_irq_handler,
2712− IRQF_SHARED, dev_name(cdns->dev), cdns);
2707+ IRQF_SHARED, dev_name(cdns->dev),
2708+ cdns->gadget_dev);
27132709
27142710 if (ret)
27152711 goto err0;
drivers/usb/chipidea/host.c+3−1
@@ -26,6 +26,7 @@ static int (*orig_bus_suspend)(struct usb_hcd *hcd); · 25 unmodified lines
2626
2727 struct ehci_ci_priv {
2828 struct regulator *reg_vbus;
29+ bool enabled;
2930 };
3031
3132 static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable)
@@ -37,7 +38,7 @@ static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) · 5 unmodified lines
3738 int ret = 0;
3839 int port = HCS_N_PORTS(ehci->hcs_params);
3940
40− if (priv->reg_vbus) {
41+ if (priv->reg_vbus && enable != priv->enabled) {
4142 if (port > 1) {
4243 dev_warn(dev,
4344 "Not support multi-port regulator control\n");
@@ -53,6 +54,7 @@ static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) · 9 unmodified lines
5354 enable ? "enable" : "disable", ret);
5455 return ret;
5556 }
57+ priv->enabled = enable;
5658 }
5759
5860 if (enable && (ci->platdata->phy_mode == USBPHY_INTERFACE_MODE_HSIC)) {
drivers/usb/core/config.c+66−16
@@ -203,9 +203,58 @@ static const unsigned short super_speed_maxpacket_maxes[4] = { · 202 unmodified lines
203203 [USB_ENDPOINT_XFER_INT] = 1024,
204204 };
205205
206−static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
207− int asnum, struct usb_host_interface *ifp, int num_ep,
208− unsigned char *buffer, int size)
206+static bool endpoint_is_duplicate(struct usb_endpoint_descriptor *e1,
207+ struct usb_endpoint_descriptor *e2)
208+{
209+ if (e1->bEndpointAddress == e2->bEndpointAddress)
210+ return true;
211+
212+ if (usb_endpoint_xfer_control(e1) || usb_endpoint_xfer_control(e2)) {
213+ if (usb_endpoint_num(e1) == usb_endpoint_num(e2))
214+ return true;
215+ }
216+
217+ return false;
218+}
219+
220+/*
221+ * Check for duplicate endpoint addresses in other interfaces and in the
222+ * altsetting currently being parsed.
223+ */
224+static bool config_endpoint_is_duplicate(struct usb_host_config *config,
225+ int inum, int asnum, struct usb_endpoint_descriptor *d)
226+{
227+ struct usb_endpoint_descriptor *epd;
228+ struct usb_interface_cache *intfc;
229+ struct usb_host_interface *alt;
230+ int i, j, k;
231+
232+ for (i = 0; i < config->desc.bNumInterfaces; ++i) {
233+ intfc = config->intf_cache[i];
234+
235+ for (j = 0; j < intfc->num_altsetting; ++j) {
236+ alt = &intfc->altsetting[j];
237+
238+ if (alt->desc.bInterfaceNumber == inum &&
239+ alt->desc.bAlternateSetting != asnum)
240+ continue;
241+
242+ for (k = 0; k < alt->desc.bNumEndpoints; ++k) {
243+ epd = &alt->endpoint[k].desc;
244+
245+ if (endpoint_is_duplicate(epd, d))
246+ return true;
247+ }
248+ }
249+ }
250+
251+ return false;
252+}
253+
254+static int usb_parse_endpoint(struct device *ddev, int cfgno,
255+ struct usb_host_config *config, int inum, int asnum,
256+ struct usb_host_interface *ifp, int num_ep,
257+ unsigned char *buffer, int size)
209258 {
210259 unsigned char *buffer0 = buffer;
211260 struct usb_endpoint_descriptor *d;
@@ -242,13 +291,10 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, · 30 unmodified lines
242291 goto skip_to_next_endpoint_or_interface_descriptor;
243292
244293 /* Check for duplicate endpoint addresses */
245− for (i = 0; i < ifp->desc.bNumEndpoints; ++i) {
246− if (ifp->endpoint[i].desc.bEndpointAddress ==
247− d->bEndpointAddress) {
248− dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n",
249− cfgno, inum, asnum, d->bEndpointAddress);
250− goto skip_to_next_endpoint_or_interface_descriptor;
251− }
294+ if (config_endpoint_is_duplicate(config, inum, asnum, d)) {
295+ dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n",
296+ cfgno, inum, asnum, d->bEndpointAddress);
297+ goto skip_to_next_endpoint_or_interface_descriptor;
252298 }
253299
254300 endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints];
@@ -346,12 +392,16 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, · 91 unmodified lines
346392 endpoint->desc.wMaxPacketSize = cpu_to_le16(8);
347393 }
348394
349− /* Validate the wMaxPacketSize field */
395+ /*
396+ * Validate the wMaxPacketSize field.
397+ * Some devices have isochronous endpoints in altsetting 0;
398+ * the USB-2 spec requires such endpoints to have wMaxPacketSize = 0
399+ * (see the end of section 5.6.3), so don't warn about them.
400+ */
350401 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",
402+ if (maxp == 0 && !(usb_endpoint_xfer_isoc(d) && asnum == 0)) {
403+ dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n",
353404 cfgno, inum, asnum, d->bEndpointAddress);
354− goto skip_to_next_endpoint_or_interface_descriptor;
355405 }
356406
357407 /* Find the highest legal maxpacket size for this endpoint */
@@ -522,8 +572,8 @@ static int usb_parse_interface(struct device *ddev, int cfgno, · 164 unmodified lines
522572 if (((struct usb_descriptor_header *) buffer)->bDescriptorType
523573 == USB_DT_INTERFACE)
524574 break;
525− retval = usb_parse_endpoint(ddev, cfgno, inum, asnum, alt,
526− num_ep, buffer, size);
575+ retval = usb_parse_endpoint(ddev, cfgno, config, inum, asnum,
576+ alt, num_ep, buffer, size);
527577 if (retval < 0)
528578 return retval;
529579 ++n;
drivers/usb/core/hub.c+1−1
@@ -2692,7 +2692,7 @@ static unsigned hub_is_wusb(struct usb_hub *hub) · 2691 unmodified lines
26922692 #define SET_ADDRESS_TRIES 2
26932693 #define GET_DESCRIPTOR_TRIES 2
26942694 #define SET_CONFIG_TRIES (2 * (use_both_schemes + 1))
2695−#define USE_NEW_SCHEME(i, scheme) ((i) / 2 == (int)scheme)
2695+#define USE_NEW_SCHEME(i, scheme) ((i) / 2 == (int)(scheme))
26962696
26972697 #define HUB_ROOT_RESET_TIME 60 /* times are in msec */
26982698 #define HUB_SHORT_RESET_TIME 10
drivers/usb/dwc3/gadget.c+7−0
@@ -2467,6 +2467,13 @@ static int dwc3_gadget_ep_reclaim_trb_linear(struct dwc3_ep *dep, · 2466 unmodified lines
24672467
24682468 static bool dwc3_gadget_ep_request_completed(struct dwc3_request *req)
24692469 {
2470+ /*
2471+ * For OUT direction, host may send less than the setup
2472+ * length. Return true for all OUT requests.
2473+ */
2474+ if (!req->direction)
2475+ return true;
2476+
24702477 return req->request.actual == req->request.length;
24712478 }
24722479
drivers/usb/gadget/udc/Kconfig+1−0
@@ -445,6 +445,7 @@ config USB_TEGRA_XUDC · 444 unmodified lines
445445 tristate "NVIDIA Tegra Superspeed USB 3.0 Device Controller"
446446 depends on ARCH_TEGRA || COMPILE_TEST
447447 depends on PHY_TEGRA_XUSB
448+ select USB_ROLE_SWITCH
448449 help
449450 Enables NVIDIA Tegra USB 3.0 device mode controller driver.
450451
drivers/usb/host/ohci-da8xx.c+6−2
@@ -415,13 +415,17 @@ static int ohci_da8xx_probe(struct platform_device *pdev) · 414 unmodified lines
415415 }
416416
417417 da8xx_ohci->oc_gpio = devm_gpiod_get_optional(dev, "oc", GPIOD_IN);
418− if (IS_ERR(da8xx_ohci->oc_gpio))
418+ if (IS_ERR(da8xx_ohci->oc_gpio)) {
419+ error = PTR_ERR(da8xx_ohci->oc_gpio);
419420 goto err;
421+ }
420422
421423 if (da8xx_ohci->oc_gpio) {
422424 oc_irq = gpiod_to_irq(da8xx_ohci->oc_gpio);
423− if (oc_irq < 0)
425+ if (oc_irq < 0) {
426+ error = oc_irq;
424427 goto err;
428+ }
425429
426430 error = devm_request_threaded_irq(dev, oc_irq, NULL,
427431 ohci_da8xx_oc_thread, IRQF_TRIGGER_RISING |
drivers/usb/musb/jz4740.c+5−2
@@ -75,14 +75,17 @@ static struct musb_hdrc_platform_data jz4740_musb_platform_data = { · 74 unmodified lines
7575 static int jz4740_musb_init(struct musb *musb)
7676 {
7777 struct device *dev = musb->controller->parent;
78+ int err;
7879
7980 if (dev->of_node)
8081 musb->xceiv = devm_usb_get_phy_by_phandle(dev, "phys", 0);
8182 else
8283 musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
8384 if (IS_ERR(musb->xceiv)) {
84− dev_err(dev, "No transceiver configured\n");
85− return PTR_ERR(musb->xceiv);
85+ err = PTR_ERR(musb->xceiv);
86+ if (err != -EPROBE_DEFER)
87+ dev_err(dev, "No transceiver configured: %d", err);
88+ return err;
8689 }
8790
8891 /* Silicon does not implement ConfigData register.
drivers/usb/musb/musb_core.c+11−0
@@ -1840,6 +1840,9 @@ ATTRIBUTE_GROUPS(musb); · 1839 unmodified lines
18401840 #define MUSB_QUIRK_B_INVALID_VBUS_91 (MUSB_DEVCTL_BDEVICE | \
18411841 (2 << MUSB_DEVCTL_VBUS_SHIFT) | \
18421842 MUSB_DEVCTL_SESSION)
1843+#define MUSB_QUIRK_B_DISCONNECT_99 (MUSB_DEVCTL_BDEVICE | \
1844+ (3 << MUSB_DEVCTL_VBUS_SHIFT) | \
1845+ MUSB_DEVCTL_SESSION)
18431846 #define MUSB_QUIRK_A_DISCONNECT_19 ((3 << MUSB_DEVCTL_VBUS_SHIFT) | \
18441847 MUSB_DEVCTL_SESSION)
18451848
@@ -1862,6 +1865,11 @@ static void musb_pm_runtime_check_session(struct musb *musb) · 16 unmodified lines
18621865 s = MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV |
18631866 MUSB_DEVCTL_HR;
18641867 switch (devctl & ~s) {
1868+ case MUSB_QUIRK_B_DISCONNECT_99:
1869+ musb_dbg(musb, "Poll devctl in case of suspend after disconnect\n");
1870+ schedule_delayed_work(&musb->irq_work,
1871+ msecs_to_jiffies(1000));
1872+ break;
18651873 case MUSB_QUIRK_B_INVALID_VBUS_91:
18661874 if (musb->quirk_retries && !musb->flush_irq_work) {
18671875 musb_dbg(musb,
@@ -2310,6 +2318,9 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) · 442 unmodified lines
23102318 musb_disable_interrupts(musb);
23112319 musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
23122320
2321+ /* MUSB_POWER_SOFTCONN might be already set, JZ4740 does this. */
2322+ musb_writeb(musb->mregs, MUSB_POWER, 0);
2323+
23132324 /* Init IRQ workqueue before request_irq */
23142325 INIT_DELAYED_WORK(&musb->irq_work, musb_irq_work);
23152326 INIT_DELAYED_WORK(&musb->deassert_reset_work, musb_deassert_reset);
drivers/usb/musb/musbhsdma.c+1−1
@@ -425,7 +425,7 @@ struct dma_controller *musbhs_dma_controller_create(struct musb *musb, · 424 unmodified lines
425425 controller->controller.channel_abort = dma_channel_abort;
426426
427427 if (request_irq(irq, dma_controller_irq, 0,
428− dev_name(musb->controller), &controller->controller)) {
428+ dev_name(musb->controller), controller)) {
429429 dev_err(dev, "request_irq %d failed!\n", irq);
430430 musb_dma_controller_destroy(&controller->controller);
431431
drivers/usb/serial/option.c+10−0
@@ -567,6 +567,9 @@ static void option_instat_callback(struct urb *urb); · 566 unmodified lines
567567 /* Interface must have two endpoints */
568568 #define NUMEP2 BIT(16)
569569
570+/* Device needs ZLP */
571+#define ZLP BIT(17)
572+
570573
571574 static const struct usb_device_id option_ids[] = {
572575 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
@@ -1172,6 +1175,8 @@ static const struct usb_device_id option_ids[] = { · 599 unmodified lines
11721175 .driver_info = NCTRL(0) | RSVD(3) },
11731176 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1102, 0xff), /* Telit ME910 (ECM) */
11741177 .driver_info = NCTRL(0) },
1178+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x110a, 0xff), /* Telit ME910G1 */
1179+ .driver_info = NCTRL(0) | RSVD(3) },
11751180 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910),
11761181 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
11771182 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4),
@@ -1196,6 +1201,8 @@ static const struct usb_device_id option_ids[] = { · 18 unmodified lines
11961201 .driver_info = NCTRL(0) | RSVD(1) },
11971202 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1901, 0xff), /* Telit LN940 (MBIM) */
11981203 .driver_info = NCTRL(0) },
1204+ { USB_DEVICE(TELIT_VENDOR_ID, 0x9010), /* Telit SBL FN980 flashing device */
1205+ .driver_info = NCTRL(0) | ZLP },
11991206 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
12001207 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff),
12011208 .driver_info = RSVD(1) },
@@ -2097,6 +2104,9 @@ static int option_attach(struct usb_serial *serial) · 895 unmodified lines
20972104 if (!(device_flags & NCTRL(iface_desc->bInterfaceNumber)))
20982105 data->use_send_setup = 1;
20992106
2107+ if (device_flags & ZLP)
2108+ data->use_zlp = 1;
2109+
21002110 spin_lock_init(&data->susp_lock);
21012111
21022112 usb_set_serial_data(serial, data);
drivers/usb/serial/usb-wwan.h+1−0
@@ -38,6 +38,7 @@ struct usb_wwan_intf_private { · 37 unmodified lines
3838 spinlock_t susp_lock;
3939 unsigned int suspended:1;
4040 unsigned int use_send_setup:1;
41+ unsigned int use_zlp:1;
4142 int in_flight;
4243 unsigned int open_ports;
4344 void *private;
drivers/usb/serial/usb_wwan.c+4−0
@@ -461,6 +461,7 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port, · 460 unmodified lines
461461 void (*callback) (struct urb *))
462462 {
463463 struct usb_serial *serial = port->serial;
464+ struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial);
464465 struct urb *urb;
465466
466467 urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */
@@ -471,6 +472,9 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port, · 4 unmodified lines
471472 usb_sndbulkpipe(serial->dev, endpoint) | dir,
472473 buf, len, callback, ctx);
473474
475+ if (intfdata->use_zlp && dir == USB_DIR_OUT)
476+ urb->transfer_flags |= URB_ZERO_PACKET;
477+
474478 return urb;
475479 }
476480
drivers/usb/typec/tcpm/tcpci.c+15−5
@@ -432,20 +432,30 @@ irqreturn_t tcpci_irq(struct tcpci *tcpci) · 431 unmodified lines
432432
433433 if (status & TCPC_ALERT_RX_STATUS) {
434434 struct pd_message msg;
435− unsigned int cnt;
435+ unsigned int cnt, payload_cnt;
436436 u16 header;
437437
438438 regmap_read(tcpci->regmap, TCPC_RX_BYTE_CNT, &cnt);
439+ /*
440+ * 'cnt' corresponds to READABLE_BYTE_COUNT in section 4.4.14
441+ * of the TCPCI spec [Rev 2.0 Ver 1.0 October 2017] and is
442+ * defined in table 4-36 as one greater than the number of
443+ * bytes received. And that number includes the header. So:
444+ */
445+ if (cnt > 3)
446+ payload_cnt = cnt - (1 + sizeof(msg.header));
447+ else
448+ payload_cnt = 0;
439449
440450 tcpci_read16(tcpci, TCPC_RX_HDR, &header);
441451 msg.header = cpu_to_le16(header);
442452
443− if (WARN_ON(cnt > sizeof(msg.payload)))
444− cnt = sizeof(msg.payload);
453+ if (WARN_ON(payload_cnt > sizeof(msg.payload)))
454+ payload_cnt = sizeof(msg.payload);
445455
446− if (cnt > 0)
456+ if (payload_cnt > 0)
447457 regmap_raw_read(tcpci->regmap, TCPC_RX_DATA,
448− &msg.payload, cnt);
458+ &msg.payload, payload_cnt);
449459
450460 /* Read complete, clear RX status alert bit */
451461 tcpci_write16(tcpci, TCPC_ALERT, TCPC_ALERT_RX_STATUS);
drivers/usb/typec/ucsi/ucsi.h+9−9
@@ -99,15 +99,15 @@ void ucsi_connector_change(struct ucsi *ucsi, u8 num); · 98 unmodified lines
9999 #define UCSI_ENABLE_NTFY_CMD_COMPLETE BIT(16)
100100 #define UCSI_ENABLE_NTFY_EXT_PWR_SRC_CHANGE BIT(17)
101101 #define UCSI_ENABLE_NTFY_PWR_OPMODE_CHANGE BIT(18)
102−#define UCSI_ENABLE_NTFY_CAP_CHANGE BIT(19)
103−#define UCSI_ENABLE_NTFY_PWR_LEVEL_CHANGE BIT(20)
104−#define UCSI_ENABLE_NTFY_PD_RESET_COMPLETE BIT(21)
105−#define UCSI_ENABLE_NTFY_CAM_CHANGE BIT(22)
106−#define UCSI_ENABLE_NTFY_BAT_STATUS_CHANGE BIT(23)
107−#define UCSI_ENABLE_NTFY_PARTNER_CHANGE BIT(24)
108−#define UCSI_ENABLE_NTFY_PWR_DIR_CHANGE BIT(25)
109−#define UCSI_ENABLE_NTFY_CONNECTOR_CHANGE BIT(26)
110−#define UCSI_ENABLE_NTFY_ERROR BIT(27)
102+#define UCSI_ENABLE_NTFY_CAP_CHANGE BIT(21)
103+#define UCSI_ENABLE_NTFY_PWR_LEVEL_CHANGE BIT(22)
104+#define UCSI_ENABLE_NTFY_PD_RESET_COMPLETE BIT(23)
105+#define UCSI_ENABLE_NTFY_CAM_CHANGE BIT(24)
106+#define UCSI_ENABLE_NTFY_BAT_STATUS_CHANGE BIT(25)
107+#define UCSI_ENABLE_NTFY_PARTNER_CHANGE BIT(27)
108+#define UCSI_ENABLE_NTFY_PWR_DIR_CHANGE BIT(28)
109+#define UCSI_ENABLE_NTFY_CONNECTOR_CHANGE BIT(30)
110+#define UCSI_ENABLE_NTFY_ERROR BIT(31)
111111 #define UCSI_ENABLE_NTFY_ALL 0xdbe70000
112112
113113 /* SET_UOR command bits */
drivers/watchdog/Kconfig+2−0
@@ -687,6 +687,7 @@ config MAX63XX_WATCHDOG · 686 unmodified lines
687687 config MAX77620_WATCHDOG
688688 tristate "Maxim Max77620 Watchdog Timer"
689689 depends on MFD_MAX77620 || COMPILE_TEST
690+ select WATCHDOG_CORE
690691 help
691692 This is the driver for the Max77620 watchdog timer.
692693 Say 'Y' here to enable the watchdog timer support for
@@ -1444,6 +1445,7 @@ config SMSC37B787_WDT · 751 unmodified lines
14441445 config TQMX86_WDT
14451446 tristate "TQ-Systems TQMX86 Watchdog Timer"
14461447 depends on X86
1448+ select WATCHDOG_CORE
14471449 help
14481450 This is the driver for the hardware watchdog timer in the TQMX86 IO
14491451 controller found on some of their ComExpress Modules.
drivers/watchdog/imx7ulp_wdt.c+1−1
@@ -112,7 +112,7 @@ static int imx7ulp_wdt_restart(struct watchdog_device *wdog, · 111 unmodified lines
112112 {
113113 struct imx7ulp_wdt_device *wdt = watchdog_get_drvdata(wdog);
114114
115− imx7ulp_wdt_enable(wdt->base, true);
115+ imx7ulp_wdt_enable(wdog, true);
116116 imx7ulp_wdt_set_timeout(&wdt->wdd, 1);
117117
118118 /* wait for wdog to fire */
drivers/watchdog/orion_wdt.c+2−2
@@ -602,7 +602,7 @@ static int orion_wdt_probe(struct platform_device *pdev) · 601 unmodified lines
602602 set_bit(WDOG_HW_RUNNING, &dev->wdt.status);
603603
604604 /* Request the IRQ only after the watchdog is disabled */
605− irq = platform_get_irq(pdev, 0);
605+ irq = platform_get_irq_optional(pdev, 0);
606606 if (irq > 0) {
607607 /*
608608 * Not all supported platforms specify an interrupt for the
@@ -617,7 +617,7 @@ static int orion_wdt_probe(struct platform_device *pdev) · 8 unmodified lines
617617 }
618618
619619 /* Optional 2nd interrupt for pretimeout */
620− irq = platform_get_irq(pdev, 1);
620+ irq = platform_get_irq_optional(pdev, 1);
621621 if (irq > 0) {
622622 orion_wdt_info.options |= WDIOF_PRETIMEOUT;
623623 ret = devm_request_irq(&pdev->dev, irq, orion_wdt_pre_irq,
drivers/watchdog/rn5t618_wdt.c+1−0
@@ -188,6 +188,7 @@ static struct platform_driver rn5t618_wdt_driver = { · 187 unmodified lines
188188
189189 module_platform_driver(rn5t618_wdt_driver);
190190
191+MODULE_ALIAS("platform:rn5t618-wdt");
191192 MODULE_AUTHOR("Beniamino Galvani <b.galvani@gmail.com>");
192193 MODULE_DESCRIPTION("RN5T618 watchdog driver");
193194 MODULE_LICENSE("GPL v2");
drivers/watchdog/w83627hf_wdt.c+1−1
@@ -420,7 +420,7 @@ static int wdt_find(int addr) · 419 unmodified lines
420420 cr_wdt_csr = NCT6102D_WDT_CSR;
421421 break;
422422 case NCT6116_ID:
423− ret = nct6102;
423+ ret = nct6116;
424424 cr_wdt_timeout = NCT6102D_WDT_TIMEOUT;
425425 cr_wdt_control = NCT6102D_WDT_CONTROL;
426426 cr_wdt_csr = NCT6102D_WDT_CSR;
fs/btrfs/compression.c+6−1
@@ -447,7 +447,7 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start, · 446 unmodified lines
447447
448448 if (blkcg_css) {
449449 bio->bi_opf |= REQ_CGROUP_PUNT;
450− bio_associate_blkg_from_css(bio, blkcg_css);
450+ kthread_associate_blkcg(blkcg_css);
451451 }
452452 refcount_set(&cb->pending_bios, 1);
453453
@@ -491,6 +491,8 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start, · 37 unmodified lines
491491 bio->bi_opf = REQ_OP_WRITE | write_flags;
492492 bio->bi_private = cb;
493493 bio->bi_end_io = end_compressed_bio_write;
494+ if (blkcg_css)
495+ bio->bi_opf |= REQ_CGROUP_PUNT;
494496 bio_add_page(bio, page, PAGE_SIZE, 0);
495497 }
496498 if (bytes_left < PAGE_SIZE) {
@@ -517,6 +519,9 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start, · 20 unmodified lines
517519 bio_endio(bio);
518520 }
519521
522+ if (blkcg_css)
523+ kthread_associate_blkcg(NULL);
524+
520525 return 0;
521526 }
522527
fs/btrfs/inode.c+3−3
@@ -1479,10 +1479,10 @@ next_slot: · 1478 unmodified lines
14791479 disk_num_bytes =
14801480 btrfs_file_extent_disk_num_bytes(leaf, fi);
14811481 /*
1482− * If extent we got ends before our range starts, skip
1483− * to next extent
1482+ * If the extent we got ends before our current offset,
1483+ * skip to the next extent.
14841484 */
1485− if (extent_end <= start) {
1485+ if (extent_end <= cur_offset) {
14861486 path->slots[0]++;
14871487 goto next_slot;
14881488 }
fs/buffer.c+5−28
@@ -3031,11 +3031,9 @@ static void end_bio_bh_io_sync(struct bio *bio) · 3030 unmodified lines
30313031 * errors, this only handles the "we need to be able to
30323032 * do IO at the final sector" case.
30333033 */
3034−void guard_bio_eod(int op, struct bio *bio)
3034+void guard_bio_eod(struct bio *bio)
30353035 {
30363036 sector_t maxsector;
3037− struct bio_vec *bvec = bio_last_bvec_all(bio);
3038− unsigned truncated_bytes;
30393037 struct hd_struct *part;
30403038
30413039 rcu_read_lock();
@@ -3061,28 +3059,7 @@ void guard_bio_eod(int op, struct bio *bio) · 19 unmodified lines
30613059 if (likely((bio->bi_iter.bi_size >> 9) <= maxsector))
30623060 return;
30633061
3064− /* Uhhuh. We've got a bio that straddles the device size! */
3065− truncated_bytes = bio->bi_iter.bi_size - (maxsector << 9);
3066−
3067− /*
3068− * The bio contains more than one segment which spans EOD, just return
3069− * and let IO layer turn it into an EIO
3070− */
3071− if (truncated_bytes > bvec->bv_len)
3072− return;
3073−
3074− /* Truncate the bio.. */
3075− bio->bi_iter.bi_size -= truncated_bytes;
3076− bvec->bv_len -= truncated_bytes;
3077−
3078− /* ..and clear the end of the buffer for reads */
3079− if (op == REQ_OP_READ) {
3080− struct bio_vec bv;
3081−
3082− mp_bvec_last_segment(bvec, &bv);
3083− zero_user(bv.bv_page, bv.bv_offset + bv.bv_len,
3084− truncated_bytes);
3085− }
3062+ bio_truncate(bio, maxsector << 9);
30863063 }
30873064
30883065 static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
@@ -3118,15 +3095,15 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, · 29 unmodified lines
31183095 bio->bi_end_io = end_bio_bh_io_sync;
31193096 bio->bi_private = bh;
31203097
3121− /* Take care of bh's that straddle the end of the device */
3122− guard_bio_eod(op, bio);
3123−
31243098 if (buffer_meta(bh))
31253099 op_flags |= REQ_META;
31263100 if (buffer_prio(bh))
31273101 op_flags |= REQ_PRIO;
31283102 bio_set_op_attrs(bio, op, op_flags);
31293103
3104+ /* Take care of bh's that straddle the end of the device */
3105+ guard_bio_eod(bio);
3106+
31303107 if (wbc) {
31313108 wbc_init_bio(wbc, bio);
31323109 wbc_account_cgroup_owner(wbc, bh->b_page, bh->b_size);
fs/char_dev.c+1−1
@@ -352,7 +352,7 @@ static struct kobject *cdev_get(struct cdev *p) · 351 unmodified lines
352352
353353 if (owner && !try_module_get(owner))
354354 return NULL;
355− kobj = kobject_get(&p->kobj);
355+ kobj = kobject_get_unless_zero(&p->kobj);
356356 if (!kobj)
357357 module_put(owner);
358358 return kobj;
fs/cifs/cifsglob.h+1−0
@@ -1693,6 +1693,7 @@ struct cifs_fattr { · 1692 unmodified lines
16931693 struct timespec64 cf_atime;
16941694 struct timespec64 cf_mtime;
16951695 struct timespec64 cf_ctime;
1696+ u32 cf_cifstag;
16961697 };
16971698
16981699 static inline void free_dfs_info_param(struct dfs_info3_param *param)
fs/cifs/readdir.c+54−9
@@ -139,6 +139,28 @@ retry: · 138 unmodified lines
139139 dput(dentry);
140140 }
141141
142+static bool reparse_file_needs_reval(const struct cifs_fattr *fattr)
143+{
144+ if (!(fattr->cf_cifsattrs & ATTR_REPARSE))
145+ return false;
146+ /*
147+ * The DFS tags should be only intepreted by server side as per
148+ * MS-FSCC 2.1.2.1, but let's include them anyway.
149+ *
150+ * Besides, if cf_cifstag is unset (0), then we still need it to be
151+ * revalidated to know exactly what reparse point it is.
152+ */
153+ switch (fattr->cf_cifstag) {
154+ case IO_REPARSE_TAG_DFS:
155+ case IO_REPARSE_TAG_DFSR:
156+ case IO_REPARSE_TAG_SYMLINK:
157+ case IO_REPARSE_TAG_NFS:
158+ case 0:
159+ return true;
160+ }
161+ return false;
162+}
163+
142164 static void
143165 cifs_fill_common_info(struct cifs_fattr *fattr, struct cifs_sb_info *cifs_sb)
144166 {
@@ -158,7 +180,7 @@ cifs_fill_common_info(struct cifs_fattr *fattr, struct cifs_sb_info *cifs_sb) · 13 unmodified lines
158180 * is a symbolic link, DFS referral or a reparse point with a direct
159181 * access like junctions, deduplicated files, NFS symlinks.
160182 */
161− if (fattr->cf_cifsattrs & ATTR_REPARSE)
183+ if (reparse_file_needs_reval(fattr))
162184 fattr->cf_flags |= CIFS_FATTR_NEED_REVAL;
163185
164186 /* non-unix readdir doesn't provide nlink */
@@ -194,19 +216,37 @@ cifs_fill_common_info(struct cifs_fattr *fattr, struct cifs_sb_info *cifs_sb) · 29 unmodified lines
194216 }
195217 }
196218
219+static void __dir_info_to_fattr(struct cifs_fattr *fattr, const void *info)
220+{
221+ const FILE_DIRECTORY_INFO *fi = info;
222+
223+ memset(fattr, 0, sizeof(*fattr));
224+ fattr->cf_cifsattrs = le32_to_cpu(fi->ExtFileAttributes);
225+ fattr->cf_eof = le64_to_cpu(fi->EndOfFile);
226+ fattr->cf_bytes = le64_to_cpu(fi->AllocationSize);
227+ fattr->cf_createtime = le64_to_cpu(fi->CreationTime);
228+ fattr->cf_atime = cifs_NTtimeToUnix(fi->LastAccessTime);
229+ fattr->cf_ctime = cifs_NTtimeToUnix(fi->ChangeTime);
230+ fattr->cf_mtime = cifs_NTtimeToUnix(fi->LastWriteTime);
231+}
232+
197233 void
198234 cifs_dir_info_to_fattr(struct cifs_fattr *fattr, FILE_DIRECTORY_INFO *info,
199235 struct cifs_sb_info *cifs_sb)
200236 {
201− memset(fattr, 0, sizeof(*fattr));
202− fattr->cf_cifsattrs = le32_to_cpu(info->ExtFileAttributes);
203− fattr->cf_eof = le64_to_cpu(info->EndOfFile);
204− fattr->cf_bytes = le64_to_cpu(info->AllocationSize);
205− fattr->cf_createtime = le64_to_cpu(info->CreationTime);
206− fattr->cf_atime = cifs_NTtimeToUnix(info->LastAccessTime);
207− fattr->cf_ctime = cifs_NTtimeToUnix(info->ChangeTime);
208− fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime);
237+ __dir_info_to_fattr(fattr, info);
238+ cifs_fill_common_info(fattr, cifs_sb);
239+}
209240
241+static void cifs_fulldir_info_to_fattr(struct cifs_fattr *fattr,
242+ SEARCH_ID_FULL_DIR_INFO *info,
243+ struct cifs_sb_info *cifs_sb)
244+{
245+ __dir_info_to_fattr(fattr, info);
246+
247+ /* See MS-FSCC 2.4.18 FileIdFullDirectoryInformation */
248+ if (fattr->cf_cifsattrs & ATTR_REPARSE)
249+ fattr->cf_cifstag = le32_to_cpu(info->EaSize);
210250 cifs_fill_common_info(fattr, cifs_sb);
211251 }
212252
@@ -755,6 +795,11 @@ static int cifs_filldir(char *find_entry, struct file *file, · 542 unmodified lines
755795 (FIND_FILE_STANDARD_INFO *)find_entry,
756796 cifs_sb);
757797 break;
798+ case SMB_FIND_FILE_ID_FULL_DIR_INFO:
799+ cifs_fulldir_info_to_fattr(&fattr,
800+ (SEARCH_ID_FULL_DIR_INFO *)find_entry,
801+ cifs_sb);
802+ break;
758803 default:
759804 cifs_dir_info_to_fattr(&fattr,
760805 (FILE_DIRECTORY_INFO *)find_entry,
fs/cifs/smb2file.c+1−1
@@ -67,7 +67,7 @@ smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, · 66 unmodified lines
6767 goto out;
6868
6969
70− if (oparms->tcon->use_resilient) {
70+ if (oparms->tcon->use_resilient) {
7171 /* default timeout is 0, servers pick default (120 seconds) */
7272 nr_ioctl_req.Timeout =
7373 cpu_to_le32(oparms->tcon->handle_timeout);
fs/direct-io.c+2−0
@@ -39,6 +39,8 @@ · 38 unmodified lines
3939 #include <linux/atomic.h>
4040 #include <linux/prefetch.h>
4141
42+#include "internal.h"
43+
4244 /*
4345 * How many user pages to map in one call to get_user_pages(). This determines
4446 * the size of a structure in the slab cache
fs/file.c+6−1
@@ -960,7 +960,7 @@ SYSCALL_DEFINE2(dup2, unsigned int, oldfd, unsigned int, newfd) · 959 unmodified lines
960960 return ksys_dup3(oldfd, newfd, 0);
961961 }
962962
963−SYSCALL_DEFINE1(dup, unsigned int, fildes)
963+int ksys_dup(unsigned int fildes)
964964 {
965965 int ret = -EBADF;
966966 struct file *file = fget_raw(fildes);
@@ -975,6 +975,11 @@ SYSCALL_DEFINE1(dup, unsigned int, fildes) · 8 unmodified lines
975975 return ret;
976976 }
977977
978+SYSCALL_DEFINE1(dup, unsigned int, fildes)
979+{
980+ return ksys_dup(fildes);
981+}
982+
978983 int f_dupfd(unsigned int from, struct file *file, unsigned flags)
979984 {
980985 int err;
fs/hugetlbfs/inode.c+3−1
@@ -1498,8 +1498,10 @@ static int __init init_hugetlbfs_fs(void) · 1497 unmodified lines
14981498 /* other hstates are optional */
14991499 i = 0;
15001500 for_each_hstate(h) {
1501− if (i == default_hstate_idx)
1501+ if (i == default_hstate_idx) {
1502+ i++;
15021503 continue;
1504+ }
15031505
15041506 mnt = mount_one_hugetlbfs(h);
15051507 if (IS_ERR(mnt))
fs/internal.h+1−1
@@ -38,7 +38,7 @@ static inline int __sync_blockdev(struct block_device *bdev, int wait) · 37 unmodified lines
3838 /*
3939 * buffer.c
4040 */
41−extern void guard_bio_eod(int rw, struct bio *bio);
41+extern void guard_bio_eod(struct bio *bio);
4242 extern int __block_write_begin_int(struct page *page, loff_t pos, unsigned len,
4343 get_block_t *get_block, struct iomap *iomap);
4444
fs/io-wq.c+2−8
@@ -92,7 +92,6 @@ struct io_wqe { · 91 unmodified lines
9292 struct io_wqe_acct acct[2];
9393
9494 struct hlist_nulls_head free_list;
95− struct hlist_nulls_head busy_list;
9695 struct list_head all_list;
9796
9897 struct io_wq *wq;
@@ -327,7 +326,6 @@ static void __io_worker_busy(struct io_wqe *wqe, struct io_worker *worker, · 228 unmodified lines
327326 if (worker->flags & IO_WORKER_F_FREE) {
328327 worker->flags &= ~IO_WORKER_F_FREE;
329328 hlist_nulls_del_init_rcu(&worker->nulls_node);
330− hlist_nulls_add_head_rcu(&worker->nulls_node, &wqe->busy_list);
331329 }
332330
333331 /*
@@ -365,7 +363,6 @@ static bool __io_worker_idle(struct io_wqe *wqe, struct io_worker *worker) · 31 unmodified lines
365363 {
366364 if (!(worker->flags & IO_WORKER_F_FREE)) {
367365 worker->flags |= IO_WORKER_F_FREE;
368− hlist_nulls_del_init_rcu(&worker->nulls_node);
369366 hlist_nulls_add_head_rcu(&worker->nulls_node, &wqe->free_list);
370367 }
371368
@@ -432,6 +429,8 @@ next: · 60 unmodified lines
432429 if (signal_pending(current))
433430 flush_signals(current);
434431
432+ cond_resched();
433+
435434 spin_lock_irq(&worker->lock);
436435 worker->cur_work = work;
437436 spin_unlock_irq(&worker->lock);
@@ -798,10 +797,6 @@ void io_wq_cancel_all(struct io_wq *wq) · 360 unmodified lines
798797
799798 set_bit(IO_WQ_BIT_CANCEL, &wq->state);
800799
801− /*
802− * Browse both lists, as there's a gap between handing work off
803− * to a worker and the worker putting itself on the busy_list
804− */
805800 rcu_read_lock();
806801 for_each_node(node) {
807802 struct io_wqe *wqe = wq->wqes[node];
@@ -1049,7 +1044,6 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data) · 241 unmodified lines
10491044 spin_lock_init(&wqe->lock);
10501045 INIT_WQ_LIST(&wqe->work_list);
10511046 INIT_HLIST_NULLS_HEAD(&wqe->free_list, 0);
1052− INIT_HLIST_NULLS_HEAD(&wqe->busy_list, 1);
10531047 INIT_LIST_HEAD(&wqe->all_list);
10541048 }
10551049
fs/io_uring.c+355−347
@@ -330,6 +330,26 @@ struct io_timeout { · 329 unmodified lines
330330 struct file *file;
331331 u64 addr;
332332 int flags;
333+ unsigned count;
334+};
335+
336+struct io_rw {
337+ /* NOTE: kiocb has the file as the first member, so don't do it here */
338+ struct kiocb kiocb;
339+ u64 addr;
340+ u64 len;
341+};
342+
343+struct io_connect {
344+ struct file *file;
345+ struct sockaddr __user *addr;
346+ int addr_len;
347+};
348+
349+struct io_sr_msg {
350+ struct file *file;
351+ struct user_msghdr __user *msg;
352+ int msg_flags;
333353 };
334354
335355 struct io_async_connect {
@@ -351,7 +371,6 @@ struct io_async_rw { · 15 unmodified lines
351371 };
352372
353373 struct io_async_ctx {
354− struct io_uring_sqe sqe;
355374 union {
356375 struct io_async_rw rw;
357376 struct io_async_msghdr msg;
@@ -369,15 +388,16 @@ struct io_async_ctx { · 11 unmodified lines
369388 struct io_kiocb {
370389 union {
371390 struct file *file;
372− struct kiocb rw;
391+ struct io_rw rw;
373392 struct io_poll_iocb poll;
374393 struct io_accept accept;
375394 struct io_sync sync;
376395 struct io_cancel cancel;
377396 struct io_timeout timeout;
397+ struct io_connect connect;
398+ struct io_sr_msg sr_msg;
378399 };
379400
380− const struct io_uring_sqe *sqe;
381401 struct io_async_ctx *io;
382402 struct file *ring_file;
383403 int ring_fd;
@@ -411,7 +431,6 @@ struct io_kiocb { · 27 unmodified lines
411431 #define REQ_F_INFLIGHT 16384 /* on inflight list */
412432 #define REQ_F_COMP_LOCKED 32768 /* completion under lock */
413433 #define REQ_F_HARDLINK 65536 /* doesn't sever on completion < 0 */
414−#define REQ_F_PREPPED 131072 /* request already opcode prepared */
415434 u64 user_data;
416435 u32 result;
417436 u32 sequence;
@@ -609,33 +628,31 @@ static inline bool io_prep_async_work(struct io_kiocb *req, · 191 unmodified lines
609628 {
610629 bool do_hashed = false;
611630
612− if (req->sqe) {
613− switch (req->opcode) {
614− case IORING_OP_WRITEV:
615− case IORING_OP_WRITE_FIXED:
616− /* only regular files should be hashed for writes */
617− if (req->flags & REQ_F_ISREG)
618− do_hashed = true;
619− /* fall-through */
620− case IORING_OP_READV:
621− case IORING_OP_READ_FIXED:
622− case IORING_OP_SENDMSG:
623− case IORING_OP_RECVMSG:
624− case IORING_OP_ACCEPT:
625− case IORING_OP_POLL_ADD:
626− case IORING_OP_CONNECT:
627− /*
628− * We know REQ_F_ISREG is not set on some of these
629− * opcodes, but this enables us to keep the check in
630− * just one place.
631− */
632− if (!(req->flags & REQ_F_ISREG))
633− req->work.flags |= IO_WQ_WORK_UNBOUND;
634− break;
635− }
636− if (io_req_needs_user(req))
637− req->work.flags |= IO_WQ_WORK_NEEDS_USER;
631+ switch (req->opcode) {
632+ case IORING_OP_WRITEV:
633+ case IORING_OP_WRITE_FIXED:
634+ /* only regular files should be hashed for writes */
635+ if (req->flags & REQ_F_ISREG)
636+ do_hashed = true;
637+ /* fall-through */
638+ case IORING_OP_READV:
639+ case IORING_OP_READ_FIXED:
640+ case IORING_OP_SENDMSG:
641+ case IORING_OP_RECVMSG:
642+ case IORING_OP_ACCEPT:
643+ case IORING_OP_POLL_ADD:
644+ case IORING_OP_CONNECT:
645+ /*
646+ * We know REQ_F_ISREG is not set on some of these
647+ * opcodes, but this enables us to keep the check in
648+ * just one place.
649+ */
650+ if (!(req->flags & REQ_F_ISREG))
651+ req->work.flags |= IO_WQ_WORK_UNBOUND;
652+ break;
638653 }
654+ if (io_req_needs_user(req))
655+ req->work.flags |= IO_WQ_WORK_NEEDS_USER;
639656
640657 *link = io_prep_linked_timeout(req);
641658 return do_hashed;
@@ -1180,7 +1197,7 @@ static int io_do_iopoll(struct io_ring_ctx *ctx, unsigned int *nr_events, · 538 unmodified lines
11801197
11811198 ret = 0;
11821199 list_for_each_entry_safe(req, tmp, &ctx->poll_list, list) {
1183− struct kiocb *kiocb = &req->rw;
1200+ struct kiocb *kiocb = &req->rw.kiocb;
11841201
11851202 /*
11861203 * Move completed entries to our local list. If we find a
@@ -1335,7 +1352,7 @@ static inline void req_set_fail_links(struct io_kiocb *req) · 148 unmodified lines
13351352
13361353 static void io_complete_rw_common(struct kiocb *kiocb, long res)
13371354 {
1338− struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw);
1355+ struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw.kiocb);
13391356
13401357 if (kiocb->ki_flags & IOCB_WRITE)
13411358 kiocb_end_write(req);
@@ -1347,7 +1364,7 @@ static void io_complete_rw_common(struct kiocb *kiocb, long res) · 5 unmodified lines
13471364
13481365 static void io_complete_rw(struct kiocb *kiocb, long res, long res2)
13491366 {
1350− struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw);
1367+ struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw.kiocb);
13511368
13521369 io_complete_rw_common(kiocb, res);
13531370 io_put_req(req);
@@ -1355,7 +1372,7 @@ static void io_complete_rw(struct kiocb *kiocb, long res, long res2) · 1 unmodified line
13551372
13561373 static struct io_kiocb *__io_complete_rw(struct kiocb *kiocb, long res)
13571374 {
1358− struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw);
1375+ struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw.kiocb);
13591376 struct io_kiocb *nxt = NULL;
13601377
13611378 io_complete_rw_common(kiocb, res);
@@ -1366,7 +1383,7 @@ static struct io_kiocb *__io_complete_rw(struct kiocb *kiocb, long res) · 4 unmodified lines
13661383
13671384 static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2)
13681385 {
1369− struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw);
1386+ struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw.kiocb);
13701387
13711388 if (kiocb->ki_flags & IOCB_WRITE)
13721389 kiocb_end_write(req);
@@ -1400,7 +1417,7 @@ static void io_iopoll_req_issued(struct io_kiocb *req) · 27 unmodified lines
14001417
14011418 list_req = list_first_entry(&ctx->poll_list, struct io_kiocb,
14021419 list);
1403− if (list_req->rw.ki_filp != req->rw.ki_filp)
1420+ if (list_req->file != req->file)
14041421 ctx->poll_multi_file = true;
14051422 }
14061423
@@ -1471,11 +1488,11 @@ static bool io_file_supports_async(struct file *file) · 64 unmodified lines
14711488 return false;
14721489 }
14731490
1474−static int io_prep_rw(struct io_kiocb *req, bool force_nonblock)
1491+static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
1492+ bool force_nonblock)
14751493 {
1476− const struct io_uring_sqe *sqe = req->sqe;
14771494 struct io_ring_ctx *ctx = req->ctx;
1478− struct kiocb *kiocb = &req->rw;
1495+ struct kiocb *kiocb = &req->rw.kiocb;
14791496 unsigned ioprio;
14801497 int ret;
14811498
@@ -1524,6 +1541,12 @@ static int io_prep_rw(struct io_kiocb *req, bool force_nonblock) · 42 unmodified lines
15241541 return -EINVAL;
15251542 kiocb->ki_complete = io_complete_rw;
15261543 }
1544+
1545+ req->rw.addr = READ_ONCE(sqe->addr);
1546+ req->rw.len = READ_ONCE(sqe->len);
1547+ /* we own ->private, reuse it for the buffer index */
1548+ req->rw.kiocb.private = (void *) (unsigned long)
1549+ READ_ONCE(sqe->buf_index);
15271550 return 0;
15281551 }
15291552
@@ -1557,11 +1580,11 @@ static void kiocb_done(struct kiocb *kiocb, ssize_t ret, struct io_kiocb **nxt, · 27 unmodified lines
15571580 io_rw_done(kiocb, ret);
15581581 }
15591582
1560−static ssize_t io_import_fixed(struct io_ring_ctx *ctx, int rw,
1561− const struct io_uring_sqe *sqe,
1583+static ssize_t io_import_fixed(struct io_kiocb *req, int rw,
15621584 struct iov_iter *iter)
15631585 {
1564− size_t len = READ_ONCE(sqe->len);
1586+ struct io_ring_ctx *ctx = req->ctx;
1587+ size_t len = req->rw.len;
15651588 struct io_mapped_ubuf *imu;
15661589 unsigned index, buf_index;
15671590 size_t offset;
@@ -1571,13 +1594,13 @@ static ssize_t io_import_fixed(struct io_ring_ctx *ctx, int rw, · 3 unmodified lines
15711594 if (unlikely(!ctx->user_bufs))
15721595 return -EFAULT;
15731596
1574− buf_index = READ_ONCE(sqe->buf_index);
1597+ buf_index = (unsigned long) req->rw.kiocb.private;
15751598 if (unlikely(buf_index >= ctx->nr_user_bufs))
15761599 return -EFAULT;
15771600
15781601 index = array_index_nospec(buf_index, ctx->nr_user_bufs);
15791602 imu = &ctx->user_bufs[index];
1580− buf_addr = READ_ONCE(sqe->addr);
1603+ buf_addr = req->rw.addr;
15811604
15821605 /* overflow */
15831606 if (buf_addr + len < buf_addr)
@@ -1634,25 +1657,20 @@ static ssize_t io_import_fixed(struct io_ring_ctx *ctx, int rw, · 50 unmodified lines
16341657 static ssize_t io_import_iovec(int rw, struct io_kiocb *req,
16351658 struct iovec **iovec, struct iov_iter *iter)
16361659 {
1637− const struct io_uring_sqe *sqe = req->sqe;
1638− void __user *buf = u64_to_user_ptr(READ_ONCE(sqe->addr));
1639− size_t sqe_len = READ_ONCE(sqe->len);
1660+ void __user *buf = u64_to_user_ptr(req->rw.addr);
1661+ size_t sqe_len = req->rw.len;
16401662 u8 opcode;
16411663
1642− /*
1643− * We're reading ->opcode for the second time, but the first read
1644− * doesn't care whether it's _FIXED or not, so it doesn't matter
1645− * whether ->opcode changes concurrently. The first read does care
1646− * about whether it is a READ or a WRITE, so we don't trust this read
1647− * for that purpose and instead let the caller pass in the read/write
1648− * flag.
1649− */
16501664 opcode = req->opcode;
16511665 if (opcode == IORING_OP_READ_FIXED || opcode == IORING_OP_WRITE_FIXED) {
16521666 *iovec = NULL;
1653− return io_import_fixed(req->ctx, rw, sqe, iter);
1667+ return io_import_fixed(req, rw, iter);
16541668 }
16551669
1670+ /* buffer index only valid with fixed read/write */
1671+ if (req->rw.kiocb.private)
1672+ return -EINVAL;
1673+
16561674 if (req->io) {
16571675 struct io_async_rw *iorw = &req->io->rw;
16581676
@@ -1750,13 +1768,7 @@ static void io_req_map_rw(struct io_kiocb *req, ssize_t io_size, · 91 unmodified lines
17501768 static int io_alloc_async_ctx(struct io_kiocb *req)
17511769 {
17521770 req->io = kmalloc(sizeof(*req->io), GFP_KERNEL);
1753− if (req->io) {
1754− memcpy(&req->io->sqe, req->sqe, sizeof(req->io->sqe));
1755− req->sqe = &req->io->sqe;
1756− return 0;
1757− }
1758−
1759− return 1;
1771+ return req->io == NULL;
17601772 }
17611773
17621774 static void io_rw_async(struct io_wq_work **workptr)
@@ -1782,46 +1794,52 @@ static int io_setup_async_rw(struct io_kiocb *req, ssize_t io_size, · 19 unmodified lines
17821794 return 0;
17831795 }
17841796
1785−static int io_read_prep(struct io_kiocb *req, struct iovec **iovec,
1786− struct iov_iter *iter, bool force_nonblock)
1797+static int io_read_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe,
1798+ bool force_nonblock)
17871799 {
1800+ struct io_async_ctx *io;
1801+ struct iov_iter iter;
17881802 ssize_t ret;
17891803
1790− ret = io_prep_rw(req, force_nonblock);
1804+ ret = io_prep_rw(req, sqe, force_nonblock);
17911805 if (ret)
17921806 return ret;
17931807
17941808 if (unlikely(!(req->file->f_mode & FMODE_READ)))
17951809 return -EBADF;
17961810
1797− return io_import_iovec(READ, req, iovec, iter);
1811+ if (!req->io)
1812+ return 0;
1813+
1814+ io = req->io;
1815+ io->rw.iov = io->rw.fast_iov;
1816+ req->io = NULL;
1817+ ret = io_import_iovec(READ, req, &io->rw.iov, &iter);
1818+ req->io = io;
1819+ if (ret < 0)
1820+ return ret;
1821+
1822+ io_req_map_rw(req, ret, io->rw.iov, io->rw.fast_iov, &iter);
1823+ return 0;
17981824 }
17991825
18001826 static int io_read(struct io_kiocb *req, struct io_kiocb **nxt,
18011827 bool force_nonblock)
18021828 {
18031829 struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs;
1804− struct kiocb *kiocb = &req->rw;
1830+ struct kiocb *kiocb = &req->rw.kiocb;
18051831 struct iov_iter iter;
1806− struct file *file;
18071832 size_t iov_count;
18081833 ssize_t io_size, ret;
18091834
1810− if (!req->io) {
1811− ret = io_read_prep(req, &iovec, &iter, force_nonblock);
1812− if (ret < 0)
1813− return ret;
1814− } else {
1815− ret = io_import_iovec(READ, req, &iovec, &iter);
1816− if (ret < 0)
1817− return ret;
1818− }
1835+ ret = io_import_iovec(READ, req, &iovec, &iter);
1836+ if (ret < 0)
1837+ return ret;
18191838
18201839 /* Ensure we clear previously set non-block flag */
18211840 if (!force_nonblock)
1822− req->rw.ki_flags &= ~IOCB_NOWAIT;
1841+ req->rw.kiocb.ki_flags &= ~IOCB_NOWAIT;
18231842
1824− file = req->file;
18251843 io_size = ret;
18261844 if (req->flags & REQ_F_LINK)
18271845 req->result = io_size;
@@ -1830,33 +1848,21 @@ static int io_read(struct io_kiocb *req, struct io_kiocb **nxt, · 2 unmodified lines
18301848 * If the file doesn't support async, mark it as REQ_F_MUST_PUNT so
18311849 * we know to async punt it even if it was opened O_NONBLOCK
18321850 */
1833− if (force_nonblock && !io_file_supports_async(file)) {
1851+ if (force_nonblock && !io_file_supports_async(req->file)) {
18341852 req->flags |= REQ_F_MUST_PUNT;
18351853 goto copy_iov;
18361854 }
18371855
18381856 iov_count = iov_iter_count(&iter);
1839− ret = rw_verify_area(READ, file, &kiocb->ki_pos, iov_count);
1857+ ret = rw_verify_area(READ, req->file, &kiocb->ki_pos, iov_count);
18401858 if (!ret) {
18411859 ssize_t ret2;
18421860
1843− if (file->f_op->read_iter)
1844− ret2 = call_read_iter(file, kiocb, &iter);
1861+ if (req->file->f_op->read_iter)
1862+ ret2 = call_read_iter(req->file, kiocb, &iter);
18451863 else
1846− ret2 = loop_rw_iter(READ, file, kiocb, &iter);
1864+ ret2 = loop_rw_iter(READ, req->file, kiocb, &iter);
18471865
1848− /*
1849− * In case of a short read, punt to async. This can happen
1850− * if we have data partially cached. Alternatively we can
1851− * return the short read, in which case the application will
1852− * need to issue another SQE and wait for it. That SQE will
1853− * need async punt anyway, so it's more efficient to do it
1854− * here.
1855− */
1856− if (force_nonblock && !(req->flags & REQ_F_NOWAIT) &&
1857− (req->flags & REQ_F_ISREG) &&
1858− ret2 > 0 && ret2 < io_size)
1859− ret2 = -EAGAIN;
18601866 /* Catch -EAGAIN return for forced non-blocking submission */
18611867 if (!force_nonblock || ret2 != -EAGAIN) {
18621868 kiocb_done(kiocb, ret2, nxt, req->in_async);
@@ -1875,46 +1881,52 @@ out_free: · 12 unmodified lines
18751881 return ret;
18761882 }
18771883
1878−static int io_write_prep(struct io_kiocb *req, struct iovec **iovec,
1879− struct iov_iter *iter, bool force_nonblock)
1884+static int io_write_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe,
1885+ bool force_nonblock)
18801886 {
1887+ struct io_async_ctx *io;
1888+ struct iov_iter iter;
18811889 ssize_t ret;
18821890
1883− ret = io_prep_rw(req, force_nonblock);
1891+ ret = io_prep_rw(req, sqe, force_nonblock);
18841892 if (ret)
18851893 return ret;
18861894
18871895 if (unlikely(!(req->file->f_mode & FMODE_WRITE)))
18881896 return -EBADF;
18891897
1890− return io_import_iovec(WRITE, req, iovec, iter);
1898+ if (!req->io)
1899+ return 0;
1900+
1901+ io = req->io;
1902+ io->rw.iov = io->rw.fast_iov;
1903+ req->io = NULL;
1904+ ret = io_import_iovec(WRITE, req, &io->rw.iov, &iter);
1905+ req->io = io;
1906+ if (ret < 0)
1907+ return ret;
1908+
1909+ io_req_map_rw(req, ret, io->rw.iov, io->rw.fast_iov, &iter);
1910+ return 0;
18911911 }
18921912
18931913 static int io_write(struct io_kiocb *req, struct io_kiocb **nxt,
18941914 bool force_nonblock)
18951915 {
18961916 struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs;
1897− struct kiocb *kiocb = &req->rw;
1917+ struct kiocb *kiocb = &req->rw.kiocb;
18981918 struct iov_iter iter;
1899− struct file *file;
19001919 size_t iov_count;
19011920 ssize_t ret, io_size;
19021921
1903− if (!req->io) {
1904− ret = io_write_prep(req, &iovec, &iter, force_nonblock);
1905− if (ret < 0)
1906− return ret;
1907− } else {
1908− ret = io_import_iovec(WRITE, req, &iovec, &iter);
1909− if (ret < 0)
1910− return ret;
1911− }
1922+ ret = io_import_iovec(WRITE, req, &iovec, &iter);
1923+ if (ret < 0)
1924+ return ret;
19121925
19131926 /* Ensure we clear previously set non-block flag */
19141927 if (!force_nonblock)
1915− req->rw.ki_flags &= ~IOCB_NOWAIT;
1928+ req->rw.kiocb.ki_flags &= ~IOCB_NOWAIT;
19161929
1917− file = kiocb->ki_filp;
19181930 io_size = ret;
19191931 if (req->flags & REQ_F_LINK)
19201932 req->result = io_size;
@@ -1934,7 +1946,7 @@ static int io_write(struct io_kiocb *req, struct io_kiocb **nxt, · 13 unmodified lines
19341946 goto copy_iov;
19351947
19361948 iov_count = iov_iter_count(&iter);
1937− ret = rw_verify_area(WRITE, file, &kiocb->ki_pos, iov_count);
1949+ ret = rw_verify_area(WRITE, req->file, &kiocb->ki_pos, iov_count);
19381950 if (!ret) {
19391951 ssize_t ret2;
19401952
@@ -1946,17 +1958,17 @@ static int io_write(struct io_kiocb *req, struct io_kiocb **nxt, · 5 unmodified lines
19461958 * we return to userspace.
19471959 */
19481960 if (req->flags & REQ_F_ISREG) {
1949− __sb_start_write(file_inode(file)->i_sb,
1961+ __sb_start_write(file_inode(req->file)->i_sb,
19501962 SB_FREEZE_WRITE, true);
1951− __sb_writers_release(file_inode(file)->i_sb,
1963+ __sb_writers_release(file_inode(req->file)->i_sb,
19521964 SB_FREEZE_WRITE);
19531965 }
19541966 kiocb->ki_flags |= IOCB_WRITE;
19551967
1956− if (file->f_op->write_iter)
1957− ret2 = call_write_iter(file, kiocb, &iter);
1968+ if (req->file->f_op->write_iter)
1969+ ret2 = call_write_iter(req->file, kiocb, &iter);
19581970 else
1959− ret2 = loop_rw_iter(WRITE, file, kiocb, &iter);
1971+ ret2 = loop_rw_iter(WRITE, req->file, kiocb, &iter);
19601972 if (!force_nonblock || ret2 != -EAGAIN) {
19611973 kiocb_done(kiocb, ret2, nxt, req->in_async);
19621974 } else {
@@ -1989,13 +2001,10 @@ static int io_nop(struct io_kiocb *req) · 26 unmodified lines
19892001 return 0;
19902002 }
19912003
1992−static int io_prep_fsync(struct io_kiocb *req)
2004+static int io_prep_fsync(struct io_kiocb *req, const struct io_uring_sqe *sqe)
19932005 {
1994− const struct io_uring_sqe *sqe = req->sqe;
19952006 struct io_ring_ctx *ctx = req->ctx;
19962007
1997− if (req->flags & REQ_F_PREPPED)
1998− return 0;
19992008 if (!req->file)
20002009 return -EBADF;
20012010
@@ -2010,7 +2019,6 @@ static int io_prep_fsync(struct io_kiocb *req) · 8 unmodified lines
20102019
20112020 req->sync.off = READ_ONCE(sqe->off);
20122021 req->sync.len = READ_ONCE(sqe->len);
2013− req->flags |= REQ_F_PREPPED;
20142022 return 0;
20152023 }
20162024
@@ -2036,7 +2044,7 @@ static void io_fsync_finish(struct io_wq_work **workptr) · 19 unmodified lines
20362044 if (io_req_cancelled(req))
20372045 return;
20382046
2039− ret = vfs_fsync_range(req->rw.ki_filp, req->sync.off,
2047+ ret = vfs_fsync_range(req->file, req->sync.off,
20402048 end > 0 ? end : LLONG_MAX,
20412049 req->sync.flags & IORING_FSYNC_DATASYNC);
20422050 if (ret < 0)
@@ -2051,11 +2059,6 @@ static int io_fsync(struct io_kiocb *req, struct io_kiocb **nxt, · 8 unmodified lines
20512059 bool force_nonblock)
20522060 {
20532061 struct io_wq_work *work, *old_work;
2054− int ret;
2055−
2056− ret = io_prep_fsync(req);
2057− if (ret)
2058− return ret;
20592062
20602063 /* fsync always requires a blocking context */
20612064 if (force_nonblock) {
@@ -2071,13 +2074,10 @@ static int io_fsync(struct io_kiocb *req, struct io_kiocb **nxt, · 9 unmodified lines
20712074 return 0;
20722075 }
20732076
2074−static int io_prep_sfr(struct io_kiocb *req)
2077+static int io_prep_sfr(struct io_kiocb *req, const struct io_uring_sqe *sqe)
20752078 {
2076− const struct io_uring_sqe *sqe = req->sqe;
20772079 struct io_ring_ctx *ctx = req->ctx;
20782080
2079− if (req->flags & REQ_F_PREPPED)
2080− return 0;
20812081 if (!req->file)
20822082 return -EBADF;
20832083
@@ -2089,7 +2089,6 @@ static int io_prep_sfr(struct io_kiocb *req) · 5 unmodified lines
20892089 req->sync.off = READ_ONCE(sqe->off);
20902090 req->sync.len = READ_ONCE(sqe->len);
20912091 req->sync.flags = READ_ONCE(sqe->sync_range_flags);
2092− req->flags |= REQ_F_PREPPED;
20932092 return 0;
20942093 }
20952094
@@ -2102,7 +2101,7 @@ static void io_sync_file_range_finish(struct io_wq_work **workptr) · 6 unmodified lines
21022101 if (io_req_cancelled(req))
21032102 return;
21042103
2105− ret = sync_file_range(req->rw.ki_filp, req->sync.off, req->sync.len,
2104+ ret = sync_file_range(req->file, req->sync.off, req->sync.len,
21062105 req->sync.flags);
21072106 if (ret < 0)
21082107 req_set_fail_links(req);
@@ -2116,11 +2115,6 @@ static int io_sync_file_range(struct io_kiocb *req, struct io_kiocb **nxt, · 7 unmodified lines
21162115 bool force_nonblock)
21172116 {
21182117 struct io_wq_work *work, *old_work;
2119− int ret;
2120−
2121− ret = io_prep_sfr(req);
2122− if (ret)
2123− return ret;
21242118
21252119 /* sync_file_range always requires a blocking context */
21262120 if (force_nonblock) {
@@ -2149,19 +2143,23 @@ static void io_sendrecv_async(struct io_wq_work **workptr) · 22 unmodified lines
21492143 }
21502144 #endif
21512145
2152−static int io_sendmsg_prep(struct io_kiocb *req, struct io_async_ctx *io)
2146+static int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
21532147 {
21542148 #if defined(CONFIG_NET)
2155− const struct io_uring_sqe *sqe = req->sqe;
2156− struct user_msghdr __user *msg;
2157− unsigned flags;
2149+ struct io_sr_msg *sr = &req->sr_msg;
2150+ struct io_async_ctx *io = req->io;
2151+
2152+ sr->msg_flags = READ_ONCE(sqe->msg_flags);
2153+ sr->msg = u64_to_user_ptr(READ_ONCE(sqe->addr));
2154+
2155+ if (!io)
2156+ return 0;
21582157
2159− flags = READ_ONCE(sqe->msg_flags);
2160− msg = (struct user_msghdr __user *)(unsigned long) READ_ONCE(sqe->addr);
21612158 io->msg.iov = io->msg.fast_iov;
2162− return sendmsg_copy_msghdr(&io->msg.msg, msg, flags, &io->msg.iov);
2159+ return sendmsg_copy_msghdr(&io->msg.msg, sr->msg, sr->msg_flags,
2160+ &io->msg.iov);
21632161 #else
2164− return 0;
2162+ return -EOPNOTSUPP;
21652163 #endif
21662164 }
21672165
@@ -2169,7 +2167,6 @@ static int io_sendmsg(struct io_kiocb *req, struct io_kiocb **nxt, · 1 unmodified line
21692167 bool force_nonblock)
21702168 {
21712169 #if defined(CONFIG_NET)
2172− const struct io_uring_sqe *sqe = req->sqe;
21732170 struct io_async_msghdr *kmsg = NULL;
21742171 struct socket *sock;
21752172 int ret;
@@ -2183,12 +2180,6 @@ static int io_sendmsg(struct io_kiocb *req, struct io_kiocb **nxt, · 7 unmodified lines
21832180 struct sockaddr_storage addr;
21842181 unsigned flags;
21852182
2186− flags = READ_ONCE(sqe->msg_flags);
2187− if (flags & MSG_DONTWAIT)
2188− req->flags |= REQ_F_NOWAIT;
2189− else if (force_nonblock)
2190− flags |= MSG_DONTWAIT;
2191−
21922183 if (req->io) {
21932184 kmsg = &req->io->msg;
21942185 kmsg->msg.msg_name = &addr;
@@ -2197,13 +2188,24 @@ static int io_sendmsg(struct io_kiocb *req, struct io_kiocb **nxt, · 2 unmodified lines
21972188 kmsg->iov = kmsg->fast_iov;
21982189 kmsg->msg.msg_iter.iov = kmsg->iov;
21992190 } else {
2191+ struct io_sr_msg *sr = &req->sr_msg;
2192+
22002193 kmsg = &io.msg;
22012194 kmsg->msg.msg_name = &addr;
2202− ret = io_sendmsg_prep(req, &io);
2195+
2196+ io.msg.iov = io.msg.fast_iov;
2197+ ret = sendmsg_copy_msghdr(&io.msg.msg, sr->msg,
2198+ sr->msg_flags, &io.msg.iov);
22032199 if (ret)
2204− goto out;
2200+ return ret;
22052201 }
22062202
2203+ flags = req->sr_msg.msg_flags;
2204+ if (flags & MSG_DONTWAIT)
2205+ req->flags |= REQ_F_NOWAIT;
2206+ else if (force_nonblock)
2207+ flags |= MSG_DONTWAIT;
2208+
22072209 ret = __sys_sendmsg_sock(sock, &kmsg->msg, flags);
22082210 if (force_nonblock && ret == -EAGAIN) {
22092211 if (req->io)
@@ -2218,7 +2220,6 @@ static int io_sendmsg(struct io_kiocb *req, struct io_kiocb **nxt, · 8 unmodified lines
22182220 ret = -EINTR;
22192221 }
22202222
2221−out:
22222223 if (!io_wq_current_is_worker() && kmsg && kmsg->iov != kmsg->fast_iov)
22232224 kfree(kmsg->iov);
22242225 io_cqring_add_event(req, ret);
@@ -2231,20 +2232,24 @@ out: · 6 unmodified lines
22312232 #endif
22322233 }
22332234
2234−static int io_recvmsg_prep(struct io_kiocb *req, struct io_async_ctx *io)
2235+static int io_recvmsg_prep(struct io_kiocb *req,
2236+ const struct io_uring_sqe *sqe)
22352237 {
22362238 #if defined(CONFIG_NET)
2237− const struct io_uring_sqe *sqe = req->sqe;
2238− struct user_msghdr __user *msg;
2239− unsigned flags;
2239+ struct io_sr_msg *sr = &req->sr_msg;
2240+ struct io_async_ctx *io = req->io;
2241+
2242+ sr->msg_flags = READ_ONCE(sqe->msg_flags);
2243+ sr->msg = u64_to_user_ptr(READ_ONCE(sqe->addr));
2244+
2245+ if (!io)
2246+ return 0;
22402247
2241− flags = READ_ONCE(sqe->msg_flags);
2242− msg = (struct user_msghdr __user *)(unsigned long) READ_ONCE(sqe->addr);
22432248 io->msg.iov = io->msg.fast_iov;
2244− return recvmsg_copy_msghdr(&io->msg.msg, msg, flags, &io->msg.uaddr,
2245− &io->msg.iov);
2249+ return recvmsg_copy_msghdr(&io->msg.msg, sr->msg, sr->msg_flags,
2250+ &io->msg.uaddr, &io->msg.iov);
22462251 #else
2247− return 0;
2252+ return -EOPNOTSUPP;
22482253 #endif
22492254 }
22502255
@@ -2252,7 +2257,6 @@ static int io_recvmsg(struct io_kiocb *req, struct io_kiocb **nxt, · 1 unmodified line
22522257 bool force_nonblock)
22532258 {
22542259 #if defined(CONFIG_NET)
2255− const struct io_uring_sqe *sqe = req->sqe;
22562260 struct io_async_msghdr *kmsg = NULL;
22572261 struct socket *sock;
22582262 int ret;
@@ -2262,19 +2266,10 @@ static int io_recvmsg(struct io_kiocb *req, struct io_kiocb **nxt, · 3 unmodified lines
22622266
22632267 sock = sock_from_file(req->file, &ret);
22642268 if (sock) {
2265− struct user_msghdr __user *msg;
22662269 struct io_async_ctx io;
22672270 struct sockaddr_storage addr;
22682271 unsigned flags;
22692272
2270− flags = READ_ONCE(sqe->msg_flags);
2271− if (flags & MSG_DONTWAIT)
2272− req->flags |= REQ_F_NOWAIT;
2273− else if (force_nonblock)
2274− flags |= MSG_DONTWAIT;
2275−
2276− msg = (struct user_msghdr __user *) (unsigned long)
2277− READ_ONCE(sqe->addr);
22782273 if (req->io) {
22792274 kmsg = &req->io->msg;
22802275 kmsg->msg.msg_name = &addr;
@@ -2283,14 +2278,27 @@ static int io_recvmsg(struct io_kiocb *req, struct io_kiocb **nxt, · 2 unmodified lines
22832278 kmsg->iov = kmsg->fast_iov;
22842279 kmsg->msg.msg_iter.iov = kmsg->iov;
22852280 } else {
2281+ struct io_sr_msg *sr = &req->sr_msg;
2282+
22862283 kmsg = &io.msg;
22872284 kmsg->msg.msg_name = &addr;
2288− ret = io_recvmsg_prep(req, &io);
2285+
2286+ io.msg.iov = io.msg.fast_iov;
2287+ ret = recvmsg_copy_msghdr(&io.msg.msg, sr->msg,
2288+ sr->msg_flags, &io.msg.uaddr,
2289+ &io.msg.iov);
22892290 if (ret)
2290− goto out;
2291+ return ret;
22912292 }
22922293
2293− ret = __sys_recvmsg_sock(sock, &kmsg->msg, msg, kmsg->uaddr, flags);
2294+ flags = req->sr_msg.msg_flags;
2295+ if (flags & MSG_DONTWAIT)
2296+ req->flags |= REQ_F_NOWAIT;
2297+ else if (force_nonblock)
2298+ flags |= MSG_DONTWAIT;
2299+
2300+ ret = __sys_recvmsg_sock(sock, &kmsg->msg, req->sr_msg.msg,
2301+ kmsg->uaddr, flags);
22942302 if (force_nonblock && ret == -EAGAIN) {
22952303 if (req->io)
22962304 return -EAGAIN;
@@ -2304,7 +2312,6 @@ static int io_recvmsg(struct io_kiocb *req, struct io_kiocb **nxt, · 7 unmodified lines
23042312 ret = -EINTR;
23052313 }
23062314
2307−out:
23082315 if (!io_wq_current_is_worker() && kmsg && kmsg->iov != kmsg->fast_iov)
23092316 kfree(kmsg->iov);
23102317 io_cqring_add_event(req, ret);
@@ -2317,25 +2324,19 @@ out: · 6 unmodified lines
23172324 #endif
23182325 }
23192326
2320−static int io_accept_prep(struct io_kiocb *req)
2327+static int io_accept_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
23212328 {
23222329 #if defined(CONFIG_NET)
2323− const struct io_uring_sqe *sqe = req->sqe;
23242330 struct io_accept *accept = &req->accept;
23252331
2326− if (req->flags & REQ_F_PREPPED)
2327− return 0;
2328−
23292332 if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL)))
23302333 return -EINVAL;
23312334 if (sqe->ioprio || sqe->len || sqe->buf_index)
23322335 return -EINVAL;
23332336
2334− accept->addr = (struct sockaddr __user *)
2335− (unsigned long) READ_ONCE(sqe->addr);
2336− accept->addr_len = (int __user *) (unsigned long) READ_ONCE(sqe->addr2);
2337+ accept->addr = u64_to_user_ptr(READ_ONCE(sqe->addr));
2338+ accept->addr_len = u64_to_user_ptr(READ_ONCE(sqe->addr2));
23372339 accept->flags = READ_ONCE(sqe->accept_flags);
2338− req->flags |= REQ_F_PREPPED;
23392340 return 0;
23402341 #else
23412342 return -EOPNOTSUPP;
@@ -2383,10 +2384,6 @@ static int io_accept(struct io_kiocb *req, struct io_kiocb **nxt, · 41 unmodified lines
23832384 #if defined(CONFIG_NET)
23842385 int ret;
23852386
2386− ret = io_accept_prep(req);
2387− if (ret)
2388− return ret;
2389−
23902387 ret = __io_accept(req, nxt, force_nonblock);
23912388 if (ret == -EAGAIN && force_nonblock) {
23922389 req->work.func = io_accept_finish;
@@ -2400,18 +2397,27 @@ static int io_accept(struct io_kiocb *req, struct io_kiocb **nxt, · 7 unmodified lines
24002397 #endif
24012398 }
24022399
2403−static int io_connect_prep(struct io_kiocb *req, struct io_async_ctx *io)
2400+static int io_connect_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
24042401 {
24052402 #if defined(CONFIG_NET)
2406− const struct io_uring_sqe *sqe = req->sqe;
2407− struct sockaddr __user *addr;
2408− int addr_len;
2403+ struct io_connect *conn = &req->connect;
2404+ struct io_async_ctx *io = req->io;
24092405
2410− addr = (struct sockaddr __user *) (unsigned long) READ_ONCE(sqe->addr);
2411− addr_len = READ_ONCE(sqe->addr2);
2412− return move_addr_to_kernel(addr, addr_len, &io->connect.address);
2406+ if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL)))
2407+ return -EINVAL;
2408+ if (sqe->ioprio || sqe->len || sqe->buf_index || sqe->rw_flags)
2409+ return -EINVAL;
2410+
2411+ conn->addr = u64_to_user_ptr(READ_ONCE(sqe->addr));
2412+ conn->addr_len = READ_ONCE(sqe->addr2);
2413+
2414+ if (!io)
2415+ return 0;
2416+
2417+ return move_addr_to_kernel(conn->addr, conn->addr_len,
2418+ &io->connect.address);
24132419 #else
2414− return 0;
2420+ return -EOPNOTSUPP;
24152421 #endif
24162422 }
24172423
@@ -2419,30 +2425,25 @@ static int io_connect(struct io_kiocb *req, struct io_kiocb **nxt, · 1 unmodified line
24192425 bool force_nonblock)
24202426 {
24212427 #if defined(CONFIG_NET)
2422− const struct io_uring_sqe *sqe = req->sqe;
24232428 struct io_async_ctx __io, *io;
24242429 unsigned file_flags;
2425− int addr_len, ret;
2426−
2427− if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL)))
2428− return -EINVAL;
2429− if (sqe->ioprio || sqe->len || sqe->buf_index || sqe->rw_flags)
2430− return -EINVAL;
2431−
2432− addr_len = READ_ONCE(sqe->addr2);
2433− file_flags = force_nonblock ? O_NONBLOCK : 0;
2430+ int ret;
24342431
24352432 if (req->io) {
24362433 io = req->io;
24372434 } else {
2438− ret = io_connect_prep(req, &__io);
2435+ ret = move_addr_to_kernel(req->connect.addr,
2436+ req->connect.addr_len,
2437+ &__io.connect.address);
24392438 if (ret)
24402439 goto out;
24412440 io = &__io;
24422441 }
24432442
2444− ret = __sys_connect_file(req->file, &io->connect.address, addr_len,
2445− file_flags);
2443+ file_flags = force_nonblock ? O_NONBLOCK : 0;
2444+
2445+ ret = __sys_connect_file(req->file, &io->connect.address,
2446+ req->connect.addr_len, file_flags);
24462447 if ((ret == -EAGAIN || ret == -EINPROGRESS) && force_nonblock) {
24472448 if (req->io)
24482449 return -EAGAIN;
@@ -2513,12 +2514,9 @@ static int io_poll_cancel(struct io_ring_ctx *ctx, __u64 sqe_addr) · 64 unmodified lines
25132514 return -ENOENT;
25142515 }
25152516
2516−static int io_poll_remove_prep(struct io_kiocb *req)
2517+static int io_poll_remove_prep(struct io_kiocb *req,
2518+ const struct io_uring_sqe *sqe)
25172519 {
2518− const struct io_uring_sqe *sqe = req->sqe;
2519−
2520− if (req->flags & REQ_F_PREPPED)
2521− return 0;
25222520 if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
25232521 return -EINVAL;
25242522 if (sqe->ioprio || sqe->off || sqe->len || sqe->buf_index ||
@@ -2526,7 +2524,6 @@ static int io_poll_remove_prep(struct io_kiocb *req) · 1 unmodified line
25262524 return -EINVAL;
25272525
25282526 req->poll.addr = READ_ONCE(sqe->addr);
2529− req->flags |= REQ_F_PREPPED;
25302527 return 0;
25312528 }
25322529
@@ -2540,10 +2537,6 @@ static int io_poll_remove(struct io_kiocb *req) · 7 unmodified lines
25402537 u64 addr;
25412538 int ret;
25422539
2543− ret = io_poll_remove_prep(req);
2544− if (ret)
2545− return ret;
2546−
25472540 addr = req->poll.addr;
25482541 spin_lock_irq(&ctx->completion_lock);
25492542 ret = io_poll_cancel(ctx, addr);
@@ -2681,14 +2674,11 @@ static void io_poll_req_insert(struct io_kiocb *req) · 131 unmodified lines
26812674 hlist_add_head(&req->hash_node, list);
26822675 }
26832676
2684−static int io_poll_add_prep(struct io_kiocb *req)
2677+static int io_poll_add_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
26852678 {
2686− const struct io_uring_sqe *sqe = req->sqe;
26872679 struct io_poll_iocb *poll = &req->poll;
26882680 u16 events;
26892681
2690− if (req->flags & REQ_F_PREPPED)
2691− return 0;
26922682 if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
26932683 return -EINVAL;
26942684 if (sqe->addr || sqe->ioprio || sqe->off || sqe->len || sqe->buf_index)
@@ -2696,7 +2686,6 @@ static int io_poll_add_prep(struct io_kiocb *req) · 1 unmodified line
26962686 if (!poll->file)
26972687 return -EBADF;
26982688
2699− req->flags |= REQ_F_PREPPED;
27002689 events = READ_ONCE(sqe->poll_events);
27012690 poll->events = demangle_poll(events) | EPOLLERR | EPOLLHUP;
27022691 return 0;
@@ -2709,11 +2698,6 @@ static int io_poll_add(struct io_kiocb *req, struct io_kiocb **nxt) · 6 unmodified lines
27092698 struct io_poll_table ipt;
27102699 bool cancel = false;
27112700 __poll_t mask;
2712− int ret;
2713−
2714− ret = io_poll_add_prep(req);
2715− if (ret)
2716− return ret;
27172701
27182702 INIT_IO_WORK(&req->work, io_poll_complete_work);
27192703 INIT_HLIST_NODE(&req->hash_node);
@@ -2832,12 +2816,9 @@ static int io_timeout_cancel(struct io_ring_ctx *ctx, __u64 user_data) · 112 unmodified lines
28322816 return 0;
28332817 }
28342818
2835−static int io_timeout_remove_prep(struct io_kiocb *req)
2819+static int io_timeout_remove_prep(struct io_kiocb *req,
2820+ const struct io_uring_sqe *sqe)
28362821 {
2837− const struct io_uring_sqe *sqe = req->sqe;
2838−
2839− if (req->flags & REQ_F_PREPPED)
2840− return 0;
28412822 if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
28422823 return -EINVAL;
28432824 if (sqe->flags || sqe->ioprio || sqe->buf_index || sqe->len)
@@ -2848,7 +2829,6 @@ static int io_timeout_remove_prep(struct io_kiocb *req) · 4 unmodified lines
28482829 if (req->timeout.flags)
28492830 return -EINVAL;
28502831
2851− req->flags |= REQ_F_PREPPED;
28522832 return 0;
28532833 }
28542834
@@ -2860,10 +2840,6 @@ static int io_timeout_remove(struct io_kiocb *req) · 5 unmodified lines
28602840 struct io_ring_ctx *ctx = req->ctx;
28612841 int ret;
28622842
2863− ret = io_timeout_remove_prep(req);
2864− if (ret)
2865− return ret;
2866−
28672843 spin_lock_irq(&ctx->completion_lock);
28682844 ret = io_timeout_cancel(ctx, req->timeout.addr);
28692845
@@ -2877,10 +2853,9 @@ static int io_timeout_remove(struct io_kiocb *req) · 7 unmodified lines
28772853 return 0;
28782854 }
28792855
2880−static int io_timeout_prep(struct io_kiocb *req, struct io_async_ctx *io,
2856+static int io_timeout_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe,
28812857 bool is_timeout_link)
28822858 {
2883− const struct io_uring_sqe *sqe = req->sqe;
28842859 struct io_timeout_data *data;
28852860 unsigned flags;
28862861
@@ -2894,7 +2869,12 @@ static int io_timeout_prep(struct io_kiocb *req, struct io_async_ctx *io, · 7 unmodified lines
28942869 if (flags & ~IORING_TIMEOUT_ABS)
28952870 return -EINVAL;
28962871
2897− data = &io->timeout;
2872+ req->timeout.count = READ_ONCE(sqe->off);
2873+
2874+ if (!req->io && io_alloc_async_ctx(req))
2875+ return -ENOMEM;
2876+
2877+ data = &req->io->timeout;
28982878 data->req = req;
28992879 req->flags |= REQ_F_TIMEOUT;
29002880
@@ -2912,21 +2892,12 @@ static int io_timeout_prep(struct io_kiocb *req, struct io_async_ctx *io, · 11 unmodified lines
29122892
29132893 static int io_timeout(struct io_kiocb *req)
29142894 {
2915− const struct io_uring_sqe *sqe = req->sqe;
29162895 unsigned count;
29172896 struct io_ring_ctx *ctx = req->ctx;
29182897 struct io_timeout_data *data;
29192898 struct list_head *entry;
29202899 unsigned span = 0;
2921− int ret;
29222900
2923− if (!req->io) {
2924− if (io_alloc_async_ctx(req))
2925− return -ENOMEM;
2926− ret = io_timeout_prep(req, req->io, false);
2927− if (ret)
2928− return ret;
2929− }
29302901 data = &req->io->timeout;
29312902
29322903 /*
@@ -2934,7 +2905,7 @@ static int io_timeout(struct io_kiocb *req) · 1 unmodified line
29342905 * timeout event to be satisfied. If it isn't set, then this is
29352906 * a pure timeout request, sequence isn't used.
29362907 */
2937− count = READ_ONCE(sqe->off);
2908+ count = req->timeout.count;
29382909 if (!count) {
29392910 req->flags |= REQ_F_TIMEOUT_NOSEQ;
29402911 spin_lock_irq(&ctx->completion_lock);
@@ -3052,19 +3023,15 @@ done: · 111 unmodified lines
30523023 io_put_req_find_next(req, nxt);
30533024 }
30543025
3055−static int io_async_cancel_prep(struct io_kiocb *req)
3026+static int io_async_cancel_prep(struct io_kiocb *req,
3027+ const struct io_uring_sqe *sqe)
30563028 {
3057− const struct io_uring_sqe *sqe = req->sqe;
3058−
3059− if (req->flags & REQ_F_PREPPED)
3060− return 0;
30613029 if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
30623030 return -EINVAL;
30633031 if (sqe->flags || sqe->ioprio || sqe->off || sqe->len ||
30643032 sqe->cancel_flags)
30653033 return -EINVAL;
30663034
3067− req->flags |= REQ_F_PREPPED;
30683035 req->cancel.addr = READ_ONCE(sqe->addr);
30693036 return 0;
30703037 }
@@ -3072,21 +3039,14 @@ static int io_async_cancel_prep(struct io_kiocb *req) · 1 unmodified line
30723039 static int io_async_cancel(struct io_kiocb *req, struct io_kiocb **nxt)
30733040 {
30743041 struct io_ring_ctx *ctx = req->ctx;
3075− int ret;
3076−
3077− ret = io_async_cancel_prep(req);
3078− if (ret)
3079− return ret;
30803042
30813043 io_async_find_and_cancel(ctx, req, req->cancel.addr, nxt, 0);
30823044 return 0;
30833045 }
30843046
3085−static int io_req_defer_prep(struct io_kiocb *req)
3047+static int io_req_defer_prep(struct io_kiocb *req,
3048+ const struct io_uring_sqe *sqe)
30863049 {
3087− struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs;
3088− struct io_async_ctx *io = req->io;
3089− struct iov_iter iter;
30903050 ssize_t ret = 0;
30913051
30923052 switch (req->opcode) {
@@ -3094,61 +3054,47 @@ static int io_req_defer_prep(struct io_kiocb *req) · 1 unmodified line
30943054 break;
30953055 case IORING_OP_READV:
30963056 case IORING_OP_READ_FIXED:
3097− /* ensure prep does right import */
3098− req->io = NULL;
3099− ret = io_read_prep(req, &iovec, &iter, true);
3100− req->io = io;
3101− if (ret < 0)
3102− break;
3103− io_req_map_rw(req, ret, iovec, inline_vecs, &iter);
3104− ret = 0;
3057+ ret = io_read_prep(req, sqe, true);
31053058 break;
31063059 case IORING_OP_WRITEV:
31073060 case IORING_OP_WRITE_FIXED:
3108− /* ensure prep does right import */
3109− req->io = NULL;
3110− ret = io_write_prep(req, &iovec, &iter, true);
3111− req->io = io;
3112− if (ret < 0)
3113− break;
3114− io_req_map_rw(req, ret, iovec, inline_vecs, &iter);
3115− ret = 0;
3061+ ret = io_write_prep(req, sqe, true);
31163062 break;
31173063 case IORING_OP_POLL_ADD:
3118− ret = io_poll_add_prep(req);
3064+ ret = io_poll_add_prep(req, sqe);
31193065 break;
31203066 case IORING_OP_POLL_REMOVE:
3121− ret = io_poll_remove_prep(req);
3067+ ret = io_poll_remove_prep(req, sqe);
31223068 break;
31233069 case IORING_OP_FSYNC:
3124− ret = io_prep_fsync(req);
3070+ ret = io_prep_fsync(req, sqe);
31253071 break;
31263072 case IORING_OP_SYNC_FILE_RANGE:
3127− ret = io_prep_sfr(req);
3073+ ret = io_prep_sfr(req, sqe);
31283074 break;
31293075 case IORING_OP_SENDMSG:
3130− ret = io_sendmsg_prep(req, io);
3076+ ret = io_sendmsg_prep(req, sqe);
31313077 break;
31323078 case IORING_OP_RECVMSG:
3133− ret = io_recvmsg_prep(req, io);
3079+ ret = io_recvmsg_prep(req, sqe);
31343080 break;
31353081 case IORING_OP_CONNECT:
3136− ret = io_connect_prep(req, io);
3082+ ret = io_connect_prep(req, sqe);
31373083 break;
31383084 case IORING_OP_TIMEOUT:
3139− ret = io_timeout_prep(req, io, false);
3085+ ret = io_timeout_prep(req, sqe, false);
31403086 break;
31413087 case IORING_OP_TIMEOUT_REMOVE:
3142− ret = io_timeout_remove_prep(req);
3088+ ret = io_timeout_remove_prep(req, sqe);
31433089 break;
31443090 case IORING_OP_ASYNC_CANCEL:
3145− ret = io_async_cancel_prep(req);
3091+ ret = io_async_cancel_prep(req, sqe);
31463092 break;
31473093 case IORING_OP_LINK_TIMEOUT:
3148− ret = io_timeout_prep(req, io, true);
3094+ ret = io_timeout_prep(req, sqe, true);
31493095 break;
31503096 case IORING_OP_ACCEPT:
3151− ret = io_accept_prep(req);
3097+ ret = io_accept_prep(req, sqe);
31523098 break;
31533099 default:
31543100 printk_once(KERN_WARNING "io_uring: unhandled opcode %d\n",
@@ -3160,7 +3106,7 @@ static int io_req_defer_prep(struct io_kiocb *req) · 5 unmodified lines
31603106 return ret;
31613107 }
31623108
3163−static int io_req_defer(struct io_kiocb *req)
3109+static int io_req_defer(struct io_kiocb *req, const struct io_uring_sqe *sqe)
31643110 {
31653111 struct io_ring_ctx *ctx = req->ctx;
31663112 int ret;
@@ -3169,10 +3115,10 @@ static int io_req_defer(struct io_kiocb *req) · 2 unmodified lines
31693115 if (!req_need_defer(req) && list_empty(&ctx->defer_list))
31703116 return 0;
31713117
3172− if (io_alloc_async_ctx(req))
3118+ if (!req->io && io_alloc_async_ctx(req))
31733119 return -EAGAIN;
31743120
3175− ret = io_req_defer_prep(req);
3121+ ret = io_req_defer_prep(req, sqe);
31763122 if (ret < 0)
31773123 return ret;
31783124
@@ -3188,9 +3134,8 @@ static int io_req_defer(struct io_kiocb *req) · 9 unmodified lines
31883134 return -EIOCBQUEUED;
31893135 }
31903136
3191−__attribute__((nonnull))
3192−static int io_issue_sqe(struct io_kiocb *req, struct io_kiocb **nxt,
3193− bool force_nonblock)
3137+static int io_issue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe,
3138+ struct io_kiocb **nxt, bool force_nonblock)
31943139 {
31953140 struct io_ring_ctx *ctx = req->ctx;
31963141 int ret;
@@ -3200,52 +3145,109 @@ static int io_issue_sqe(struct io_kiocb *req, struct io_kiocb **nxt, · 3 unmodified lines
32003145 ret = io_nop(req);
32013146 break;
32023147 case IORING_OP_READV:
3203− if (unlikely(req->sqe->buf_index))
3204− return -EINVAL;
3205− ret = io_read(req, nxt, force_nonblock);
3206− break;
3207− case IORING_OP_WRITEV:
3208− if (unlikely(req->sqe->buf_index))
3209− return -EINVAL;
3210− ret = io_write(req, nxt, force_nonblock);
3211− break;
32123148 case IORING_OP_READ_FIXED:
3149+ if (sqe) {
3150+ ret = io_read_prep(req, sqe, force_nonblock);
3151+ if (ret < 0)
3152+ break;
3153+ }
32133154 ret = io_read(req, nxt, force_nonblock);
32143155 break;
3156+ case IORING_OP_WRITEV:
32153157 case IORING_OP_WRITE_FIXED:
3158+ if (sqe) {
3159+ ret = io_write_prep(req, sqe, force_nonblock);
3160+ if (ret < 0)
3161+ break;
3162+ }
32163163 ret = io_write(req, nxt, force_nonblock);
32173164 break;
32183165 case IORING_OP_FSYNC:
3166+ if (sqe) {
3167+ ret = io_prep_fsync(req, sqe);
3168+ if (ret < 0)
3169+ break;
3170+ }
32193171 ret = io_fsync(req, nxt, force_nonblock);
32203172 break;
32213173 case IORING_OP_POLL_ADD:
3174+ if (sqe) {
3175+ ret = io_poll_add_prep(req, sqe);
3176+ if (ret)
3177+ break;
3178+ }
32223179 ret = io_poll_add(req, nxt);
32233180 break;
32243181 case IORING_OP_POLL_REMOVE:
3182+ if (sqe) {
3183+ ret = io_poll_remove_prep(req, sqe);
3184+ if (ret < 0)
3185+ break;
3186+ }
32253187 ret = io_poll_remove(req);
32263188 break;
32273189 case IORING_OP_SYNC_FILE_RANGE:
3190+ if (sqe) {
3191+ ret = io_prep_sfr(req, sqe);
3192+ if (ret < 0)
3193+ break;
3194+ }
32283195 ret = io_sync_file_range(req, nxt, force_nonblock);
32293196 break;
32303197 case IORING_OP_SENDMSG:
3198+ if (sqe) {
3199+ ret = io_sendmsg_prep(req, sqe);
3200+ if (ret < 0)
3201+ break;
3202+ }
32313203 ret = io_sendmsg(req, nxt, force_nonblock);
32323204 break;
32333205 case IORING_OP_RECVMSG:
3206+ if (sqe) {
3207+ ret = io_recvmsg_prep(req, sqe);
3208+ if (ret)
3209+ break;
3210+ }
32343211 ret = io_recvmsg(req, nxt, force_nonblock);
32353212 break;
32363213 case IORING_OP_TIMEOUT:
3214+ if (sqe) {
3215+ ret = io_timeout_prep(req, sqe, false);
3216+ if (ret)
3217+ break;
3218+ }
32373219 ret = io_timeout(req);
32383220 break;
32393221 case IORING_OP_TIMEOUT_REMOVE:
3222+ if (sqe) {
3223+ ret = io_timeout_remove_prep(req, sqe);
3224+ if (ret)
3225+ break;
3226+ }
32403227 ret = io_timeout_remove(req);
32413228 break;
32423229 case IORING_OP_ACCEPT:
3230+ if (sqe) {
3231+ ret = io_accept_prep(req, sqe);
3232+ if (ret)
3233+ break;
3234+ }
32433235 ret = io_accept(req, nxt, force_nonblock);
32443236 break;
32453237 case IORING_OP_CONNECT:
3238+ if (sqe) {
3239+ ret = io_connect_prep(req, sqe);
3240+ if (ret)
3241+ break;
3242+ }
32463243 ret = io_connect(req, nxt, force_nonblock);
32473244 break;
32483245 case IORING_OP_ASYNC_CANCEL:
3246+ if (sqe) {
3247+ ret = io_async_cancel_prep(req, sqe);
3248+ if (ret)
3249+ break;
3250+ }
32493251 ret = io_async_cancel(req, nxt);
32503252 break;
32513253 default:
@@ -3289,7 +3291,7 @@ static void io_wq_submit_work(struct io_wq_work **workptr) · 37 unmodified lines
32893291 req->has_user = (work->flags & IO_WQ_WORK_HAS_MM) != 0;
32903292 req->in_async = true;
32913293 do {
3292− ret = io_issue_sqe(req, &nxt, false);
3294+ ret = io_issue_sqe(req, NULL, &nxt, false);
32933295 /*
32943296 * We can get EAGAIN for polled IO even though we're
32953297 * forcing a sync submission from here, since we can't
@@ -3355,14 +3357,15 @@ static inline struct file *io_file_from_index(struct io_ring_ctx *ctx, · 59 unmodified lines
33553357 return table->files[index & IORING_FILE_TABLE_MASK];
33563358 }
33573359
3358−static int io_req_set_file(struct io_submit_state *state, struct io_kiocb *req)
3360+static int io_req_set_file(struct io_submit_state *state, struct io_kiocb *req,
3361+ const struct io_uring_sqe *sqe)
33593362 {
33603363 struct io_ring_ctx *ctx = req->ctx;
33613364 unsigned flags;
33623365 int fd, ret;
33633366
3364− flags = READ_ONCE(req->sqe->flags);
3365− fd = READ_ONCE(req->sqe->fd);
3367+ flags = READ_ONCE(sqe->flags);
3368+ fd = READ_ONCE(sqe->fd);
33663369
33673370 if (flags & IOSQE_IO_DRAIN)
33683371 req->flags |= REQ_F_IO_DRAIN;
@@ -3494,7 +3497,7 @@ static struct io_kiocb *io_prep_linked_timeout(struct io_kiocb *req) · 125 unmodified lines
34943497 return nxt;
34953498 }
34963499
3497−static void __io_queue_sqe(struct io_kiocb *req)
3500+static void __io_queue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe)
34983501 {
34993502 struct io_kiocb *linked_timeout;
35003503 struct io_kiocb *nxt = NULL;
@@ -3503,7 +3506,7 @@ static void __io_queue_sqe(struct io_kiocb *req) · 2 unmodified lines
35033506 again:
35043507 linked_timeout = io_prep_linked_timeout(req);
35053508
3506− ret = io_issue_sqe(req, &nxt, true);
3509+ ret = io_issue_sqe(req, sqe, &nxt, true);
35073510
35083511 /*
35093512 * We async punt it if the file wasn't marked NOWAIT, or if the file
@@ -3550,7 +3553,7 @@ done_req: · 40 unmodified lines
35503553 }
35513554 }
35523555
3553−static void io_queue_sqe(struct io_kiocb *req)
3556+static void io_queue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe)
35543557 {
35553558 int ret;
35563559
@@ -3560,7 +3563,7 @@ static void io_queue_sqe(struct io_kiocb *req) · 3 unmodified lines
35603563 }
35613564 req->ctx->drain_next = (req->flags & REQ_F_DRAIN_LINK);
35623565
3563− ret = io_req_defer(req);
3566+ ret = io_req_defer(req, sqe);
35643567 if (ret) {
35653568 if (ret != -EIOCBQUEUED) {
35663569 io_cqring_add_event(req, ret);
@@ -3568,7 +3571,7 @@ static void io_queue_sqe(struct io_kiocb *req) · 1 unmodified line
35683571 io_double_put_req(req);
35693572 }
35703573 } else
3571− __io_queue_sqe(req);
3574+ __io_queue_sqe(req, sqe);
35723575 }
35733576
35743577 static inline void io_queue_link_head(struct io_kiocb *req)
@@ -3577,25 +3580,25 @@ static inline void io_queue_link_head(struct io_kiocb *req) · 2 unmodified lines
35773580 io_cqring_add_event(req, -ECANCELED);
35783581 io_double_put_req(req);
35793582 } else
3580− io_queue_sqe(req);
3583+ io_queue_sqe(req, NULL);
35813584 }
35823585
35833586 #define SQE_VALID_FLAGS (IOSQE_FIXED_FILE|IOSQE_IO_DRAIN|IOSQE_IO_LINK| \
35843587 IOSQE_IO_HARDLINK)
35853588
3586−static bool io_submit_sqe(struct io_kiocb *req, struct io_submit_state *state,
3587− struct io_kiocb **link)
3589+static bool io_submit_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe,
3590+ struct io_submit_state *state, struct io_kiocb **link)
35883591 {
35893592 struct io_ring_ctx *ctx = req->ctx;
35903593 int ret;
35913594
35923595 /* enforce forwards compatibility on users */
3593− if (unlikely(req->sqe->flags & ~SQE_VALID_FLAGS)) {
3596+ if (unlikely(sqe->flags & ~SQE_VALID_FLAGS)) {
35943597 ret = -EINVAL;
35953598 goto err_req;
35963599 }
35973600
3598− ret = io_req_set_file(state, req);
3601+ ret = io_req_set_file(state, req, sqe);
35993602 if (unlikely(ret)) {
36003603 err_req:
36013604 io_cqring_add_event(req, ret);
@@ -3613,10 +3616,10 @@ err_req: · 11 unmodified lines
36133616 if (*link) {
36143617 struct io_kiocb *prev = *link;
36153618
3616− if (req->sqe->flags & IOSQE_IO_DRAIN)
3619+ if (sqe->flags & IOSQE_IO_DRAIN)
36173620 (*link)->flags |= REQ_F_DRAIN_LINK | REQ_F_IO_DRAIN;
36183621
3619− if (req->sqe->flags & IOSQE_IO_HARDLINK)
3622+ if (sqe->flags & IOSQE_IO_HARDLINK)
36203623 req->flags |= REQ_F_HARDLINK;
36213624
36223625 if (io_alloc_async_ctx(req)) {
@@ -3624,7 +3627,7 @@ err_req: · 1 unmodified line
36243627 goto err_req;
36253628 }
36263629
3627− ret = io_req_defer_prep(req);
3630+ ret = io_req_defer_prep(req, sqe);
36283631 if (ret) {
36293632 /* fail even hard links since we don't submit */
36303633 prev->flags |= REQ_F_FAIL_LINK;
@@ -3632,15 +3635,18 @@ err_req: · 1 unmodified line
36323635 }
36333636 trace_io_uring_link(ctx, req, prev);
36343637 list_add_tail(&req->link_list, &prev->link_list);
3635− } else if (req->sqe->flags & (IOSQE_IO_LINK|IOSQE_IO_HARDLINK)) {
3638+ } else if (sqe->flags & (IOSQE_IO_LINK|IOSQE_IO_HARDLINK)) {
36363639 req->flags |= REQ_F_LINK;
3637− if (req->sqe->flags & IOSQE_IO_HARDLINK)
3640+ if (sqe->flags & IOSQE_IO_HARDLINK)
36383641 req->flags |= REQ_F_HARDLINK;
36393642
36403643 INIT_LIST_HEAD(&req->link_list);
3644+ ret = io_req_defer_prep(req, sqe);
3645+ if (ret)
3646+ req->flags |= REQ_F_FAIL_LINK;
36413647 *link = req;
36423648 } else {
3643− io_queue_sqe(req);
3649+ io_queue_sqe(req, sqe);
36443650 }
36453651
36463652 return true;
@@ -3685,14 +3691,15 @@ static void io_commit_sqring(struct io_ring_ctx *ctx) · 38 unmodified lines
36853691 }
36863692
36873693 /*
3688− * Fetch an sqe, if one is available. Note that req->sqe will point to memory
3694+ * Fetch an sqe, if one is available. Note that sqe_ptr will point to memory
36893695 * that is mapped by userspace. This means that care needs to be taken to
36903696 * ensure that reads are stable, as we cannot rely on userspace always
36913697 * being a good citizen. If members of the sqe are validated and then later
36923698 * used, it's important that those reads are done through READ_ONCE() to
36933699 * prevent a re-load down the line.
36943700 */
3695−static bool io_get_sqring(struct io_ring_ctx *ctx, struct io_kiocb *req)
3701+static bool io_get_sqring(struct io_ring_ctx *ctx, struct io_kiocb *req,
3702+ const struct io_uring_sqe **sqe_ptr)
36963703 {
36973704 struct io_rings *rings = ctx->rings;
36983705 u32 *sq_array = ctx->sq_array;
@@ -3719,9 +3726,9 @@ static bool io_get_sqring(struct io_ring_ctx *ctx, struct io_kiocb *req) · 20 unmodified lines
37193726 * link list.
37203727 */
37213728 req->sequence = ctx->cached_sq_head;
3722− req->sqe = &ctx->sq_sqes[head];
3723− req->opcode = READ_ONCE(req->sqe->opcode);
3724− req->user_data = READ_ONCE(req->sqe->user_data);
3729+ *sqe_ptr = &ctx->sq_sqes[head];
3730+ req->opcode = READ_ONCE((*sqe_ptr)->opcode);
3731+ req->user_data = READ_ONCE((*sqe_ptr)->user_data);
37253732 ctx->cached_sq_head++;
37263733 return true;
37273734 }
@@ -3753,6 +3760,7 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr, · 25 unmodified lines
37533760 }
37543761
37553762 for (i = 0; i < nr; i++) {
3763+ const struct io_uring_sqe *sqe;
37563764 struct io_kiocb *req;
37573765 unsigned int sqe_flags;
37583766
@@ -3762,7 +3770,7 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr, · 3 unmodified lines
37623770 submitted = -EAGAIN;
37633771 break;
37643772 }
3765− if (!io_get_sqring(ctx, req)) {
3773+ if (!io_get_sqring(ctx, req, &sqe)) {
37663774 __io_free_req(req);
37673775 break;
37683776 }
@@ -3776,7 +3784,7 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr, · 7 unmodified lines
37763784 }
37773785
37783786 submitted++;
3779− sqe_flags = req->sqe->flags;
3787+ sqe_flags = sqe->flags;
37803788
37813789 req->ring_file = ring_file;
37823790 req->ring_fd = ring_fd;
@@ -3784,7 +3792,7 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr, · 1 unmodified line
37843792 req->in_async = async;
37853793 req->needs_fixed_file = async;
37863794 trace_io_uring_submit_sqe(ctx, req->user_data, true, async);
3787− if (!io_submit_sqe(req, statep, &link))
3795+ if (!io_submit_sqe(req, sqe, statep, &link))
37883796 break;
37893797 /*
37903798 * If previous wasn't linked and we have a linked command,
@@ -4702,7 +4710,7 @@ static int io_copy_iov(struct io_ring_ctx *ctx, struct iovec *dst, · 911 unmodified lines
47024710 if (copy_from_user(&ciov, &ciovs[index], sizeof(ciov)))
47034711 return -EFAULT;
47044712
4705− dst->iov_base = (void __user *) (unsigned long) ciov.iov_base;
4713+ dst->iov_base = u64_to_user_ptr((u64)ciov.iov_base);
47064714 dst->iov_len = ciov.iov_len;
47074715 return 0;
47084716 }
fs/locks.c+1−1
@@ -2853,7 +2853,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl, · 2852 unmodified lines
28532853 }
28542854 if (inode) {
28552855 /* userspace relies on this representation of dev_t */
2856− seq_printf(f, "%d %02x:%02x:%ld ", fl_pid,
2856+ seq_printf(f, "%d %02x:%02x:%lu ", fl_pid,
28572857 MAJOR(inode->i_sb->s_dev),
28582858 MINOR(inode->i_sb->s_dev), inode->i_ino);
28592859 } else {
fs/mpage.c+1−1
@@ -62,7 +62,7 @@ static struct bio *mpage_bio_submit(int op, int op_flags, struct bio *bio) · 61 unmodified lines
6262 {
6363 bio->bi_end_io = mpage_end_io;
6464 bio_set_op_attrs(bio, op, op_flags);
65− guard_bio_eod(op, bio);
65+ guard_bio_eod(bio);
6666 submit_bio(bio);
6767 return NULL;
6868 }
fs/namespace.c+1−1
@@ -1728,7 +1728,7 @@ static bool is_mnt_ns_file(struct dentry *dentry) · 1727 unmodified lines
17281728 dentry->d_fsdata == &mntns_operations;
17291729 }
17301730
1731−struct mnt_namespace *to_mnt_ns(struct ns_common *ns)
1731+static struct mnt_namespace *to_mnt_ns(struct ns_common *ns)
17321732 {
17331733 return container_of(ns, struct mnt_namespace, ns);
17341734 }
fs/nsfs.c+3−0
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 #include <linux/pseudo_fs.h>
44 #include <linux/file.h>
55 #include <linux/fs.h>
6+#include <linux/proc_fs.h>
67 #include <linux/proc_ns.h>
78 #include <linux/magic.h>
89 #include <linux/ktime.h>
@@ -11,6 +12,8 @@ · 2 unmodified lines
1112 #include <linux/nsfs.h>
1213 #include <linux/uaccess.h>
1314
15+#include "internal.h"
16+
1417 static struct vfsmount *nsfs_mnt;
1518
1619 static long ns_ioctl(struct file *filp, unsigned int ioctl,
fs/ocfs2/dlmglue.c+1−0
@@ -3282,6 +3282,7 @@ static void ocfs2_dlm_init_debug(struct ocfs2_super *osb) · 3281 unmodified lines
32823282
32833283 debugfs_create_u32("locking_filter", 0600, osb->osb_debug_root,
32843284 &dlm_debug->d_filter_secs);
3285+ ocfs2_get_dlm_debug(dlm_debug);
32853286 }
32863287
32873288 static void ocfs2_dlm_shutdown_debug(struct ocfs2_super *osb)
fs/ocfs2/journal.c+8−0
@@ -1066,6 +1066,14 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local, int replayed) · 1065 unmodified lines
10661066
10671067 ocfs2_clear_journal_error(osb->sb, journal->j_journal, osb->slot_num);
10681068
1069+ if (replayed) {
1070+ jbd2_journal_lock_updates(journal->j_journal);
1071+ status = jbd2_journal_flush(journal->j_journal);
1072+ jbd2_journal_unlock_updates(journal->j_journal);
1073+ if (status < 0)
1074+ mlog_errno(status);
1075+ }
1076+
10691077 status = ocfs2_journal_toggle_dirty(osb, 1, replayed);
10701078 if (status < 0) {
10711079 mlog_errno(status);
fs/posix_acl.c+5−2
@@ -631,12 +631,15 @@ EXPORT_SYMBOL_GPL(posix_acl_create); · 630 unmodified lines
631631
632632 /**
633633 * posix_acl_update_mode - update mode in set_acl
634+ * @inode: target inode
635+ * @mode_p: mode (pointer) for update
636+ * @acl: acl pointer
634637 *
635638 * Update the file mode when setting an ACL: compute the new file permission
636639 * bits based on the ACL. In addition, if the ACL is equivalent to the new
637− * file mode, set *acl to NULL to indicate that no ACL should be set.
640+ * file mode, set *@acl to NULL to indicate that no ACL should be set.
638641 *
639− * As with chmod, clear the setgit bit if the caller is not in the owning group
642+ * As with chmod, clear the setgid bit if the caller is not in the owning group
640643 * or capable of CAP_FSETID (see inode_change_ok).
641644 *
642645 * Called from set_acl inode operations.
fs/pstore/ram.c+13−0
@@ -407,6 +407,17 @@ static int notrace ramoops_pstore_write(struct pstore_record *record) · 406 unmodified lines
407407
408408 prz = cxt->dprzs[cxt->dump_write_cnt];
409409
410+ /*
411+ * Since this is a new crash dump, we need to reset the buffer in
412+ * case it still has an old dump present. Without this, the new dump
413+ * will get appended, which would seriously confuse anything trying
414+ * to check dump file contents. Specifically, ramoops_read_kmsg_hdr()
415+ * expects to find a dump header in the beginning of buffer data, so
416+ * we must to reset the buffer values, in order to ensure that the
417+ * header will be written to the beginning of the buffer.
418+ */
419+ persistent_ram_zap(prz);
420+
410421 /* Build header and append record contents. */
411422 hlen = ramoops_write_kmsg_hdr(prz, record);
412423 if (!hlen)
@@ -572,6 +583,7 @@ static int ramoops_init_przs(const char *name, · 159 unmodified lines
572583 prz_ar[i] = persistent_ram_new(*paddr, zone_sz, sig,
573584 &cxt->ecc_info,
574585 cxt->memtype, flags, label);
586+ kfree(label);
575587 if (IS_ERR(prz_ar[i])) {
576588 err = PTR_ERR(prz_ar[i]);
577589 dev_err(dev, "failed to request %s mem region (0x%zx@0x%llx): %d\n",
@@ -617,6 +629,7 @@ static int ramoops_init_prz(const char *name, · 39 unmodified lines
617629 label = kasprintf(GFP_KERNEL, "ramoops:%s", name);
618630 *prz = persistent_ram_new(*paddr, sz, sig, &cxt->ecc_info,
619631 cxt->memtype, PRZ_FLAG_ZAP_OLD, label);
632+ kfree(label);
620633 if (IS_ERR(*prz)) {
621634 int err = PTR_ERR(*prz);
622635
fs/pstore/ram_core.c+1−1
@@ -574,7 +574,7 @@ struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size, · 573 unmodified lines
574574 /* Initialize general buffer state. */
575575 raw_spin_lock_init(&prz->buffer_lock);
576576 prz->flags = flags;
577− prz->label = label;
577+ prz->label = kstrdup(label, GFP_KERNEL);
578578
579579 ret = persistent_ram_buffer_map(start, size, prz, memtype);
580580 if (ret)
include/linux/ahci_platform.h+2−0
@@ -19,6 +19,8 @@ struct ahci_host_priv; · 18 unmodified lines
1919 struct platform_device;
2020 struct scsi_host_template;
2121
22+int ahci_platform_enable_phys(struct ahci_host_priv *hpriv);
23+void ahci_platform_disable_phys(struct ahci_host_priv *hpriv);
2224 int ahci_platform_enable_clks(struct ahci_host_priv *hpriv);
2325 void ahci_platform_disable_clks(struct ahci_host_priv *hpriv);
2426 int ahci_platform_enable_regulators(struct ahci_host_priv *hpriv);
include/linux/bio.h+1−0
@@ -470,6 +470,7 @@ extern struct bio *bio_copy_user_iov(struct request_queue *, · 469 unmodified lines
470470 gfp_t);
471471 extern int bio_uncopy_user(struct bio *);
472472 void zero_fill_bio_iter(struct bio *bio, struct bvec_iter iter);
473+void bio_truncate(struct bio *bio, unsigned new_size);
473474
474475 static inline void zero_fill_bio(struct bio *bio)
475476 {
include/linux/bvec.h+0−22
@@ -153,26 +153,4 @@ static inline void bvec_advance(const struct bio_vec *bvec, · 152 unmodified lines
153153 }
154154 }
155155
156−/*
157− * Get the last single-page segment from the multi-page bvec and store it
158− * in @seg
159− */
160−static inline void mp_bvec_last_segment(const struct bio_vec *bvec,
161− struct bio_vec *seg)
162−{
163− unsigned total = bvec->bv_offset + bvec->bv_len;
164− unsigned last_page = (total - 1) / PAGE_SIZE;
165−
166− seg->bv_page = bvec->bv_page + last_page;
167−
168− /* the whole segment is inside the last page */
169− if (bvec->bv_offset >= last_page * PAGE_SIZE) {
170− seg->bv_offset = bvec->bv_offset % PAGE_SIZE;
171− seg->bv_len = bvec->bv_len;
172− } else {
173− seg->bv_offset = 0;
174− seg->bv_len = total - last_page * PAGE_SIZE;
175− }
176−}
177−
178156 #endif /* __LINUX_BVEC_ITER_H */
include/linux/can/dev.h+34−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <linux/can/error.h>
1919 #include <linux/can/led.h>
2020 #include <linux/can/netlink.h>
21+#include <linux/can/skb.h>
2122 #include <linux/netdevice.h>
2223
2324 /*
@@ -91,6 +92,36 @@ struct can_priv { · 67 unmodified lines
9192 #define get_can_dlc(i) (min_t(__u8, (i), CAN_MAX_DLC))
9293 #define get_canfd_dlc(i) (min_t(__u8, (i), CANFD_MAX_DLC))
9394
95+/* Check for outgoing skbs that have not been created by the CAN subsystem */
96+static inline bool can_skb_headroom_valid(struct net_device *dev,
97+ struct sk_buff *skb)
98+{
99+ /* af_packet creates a headroom of HH_DATA_MOD bytes which is fine */
100+ if (WARN_ON_ONCE(skb_headroom(skb) < sizeof(struct can_skb_priv)))
101+ return false;
102+
103+ /* af_packet does not apply CAN skb specific settings */
104+ if (skb->ip_summed == CHECKSUM_NONE) {
105+ /* init headroom */
106+ can_skb_prv(skb)->ifindex = dev->ifindex;
107+ can_skb_prv(skb)->skbcnt = 0;
108+
109+ skb->ip_summed = CHECKSUM_UNNECESSARY;
110+
111+ /* preform proper loopback on capable devices */
112+ if (dev->flags & IFF_ECHO)
113+ skb->pkt_type = PACKET_LOOPBACK;
114+ else
115+ skb->pkt_type = PACKET_HOST;
116+
117+ skb_reset_mac_header(skb);
118+ skb_reset_network_header(skb);
119+ skb_reset_transport_header(skb);
120+ }
121+
122+ return true;
123+}
124+
94125 /* Drop a given socketbuffer if it does not contain a valid CAN frame. */
95126 static inline bool can_dropped_invalid_skb(struct net_device *dev,
96127 struct sk_buff *skb)
@@ -108,6 +139,9 @@ static inline bool can_dropped_invalid_skb(struct net_device *dev, · 11 unmodified lines
108139 } else
109140 goto inval_skb;
110141
142+ if (!can_skb_headroom_valid(dev, skb))
143+ goto inval_skb;
144+
111145 return false;
112146
113147 inval_skb:
include/linux/dmaengine.h+4−1
@@ -1364,8 +1364,11 @@ static inline int dma_get_slave_caps(struct dma_chan *chan, · 1363 unmodified lines
13641364 static inline int dmaengine_desc_set_reuse(struct dma_async_tx_descriptor *tx)
13651365 {
13661366 struct dma_slave_caps caps;
1367+ int ret;
13671368
1368− dma_get_slave_caps(tx->chan, &caps);
1369+ ret = dma_get_slave_caps(tx->chan, &caps);
1370+ if (ret)
1371+ return ret;
13691372
13701373 if (caps.descriptor_reuse) {
13711374 tx->flags |= DMA_CTRL_REUSE;
include/linux/if_ether.h+8−0
@@ -24,6 +24,14 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) · 23 unmodified lines
2424 return (struct ethhdr *)skb_mac_header(skb);
2525 }
2626
27+/* Prefer this version in TX path, instead of
28+ * skb_reset_mac_header() + eth_hdr()
29+ */
30+static inline struct ethhdr *skb_eth_hdr(const struct sk_buff *skb)
31+{
32+ return (struct ethhdr *)skb->data;
33+}
34+
2735 static inline struct ethhdr *inner_eth_hdr(const struct sk_buff *skb)
2836 {
2937 return (struct ethhdr *)skb_inner_mac_header(skb);
include/linux/kernel.h+0−9
@@ -79,15 +79,6 @@ · 78 unmodified lines
7979 */
8080 #define round_down(x, y) ((x) & ~__round_mask(x, y))
8181
82−/**
83− * FIELD_SIZEOF - get the size of a struct's field
84− * @t: the target struct
85− * @f: the target struct's field
86− * Return: the size of @f in the struct definition without having a
87− * declared instance of @t.
88− */
89−#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
90−
9182 #define typeof_member(T, m) typeof(((T*)0)->m)
9283
9384 #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
include/linux/libata.h+1−0
@@ -1175,6 +1175,7 @@ extern unsigned int ata_do_dev_read_id(struct ata_device *dev, · 1174 unmodified lines
11751175 struct ata_taskfile *tf, u16 *id);
11761176 extern void ata_qc_complete(struct ata_queued_cmd *qc);
11771177 extern int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active);
1178+extern u64 ata_qc_get_active(struct ata_port *ap);
11781179 extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd);
11791180 extern int ata_std_bios_param(struct scsi_device *sdev,
11801181 struct block_device *bdev,
include/linux/memory_hotplug.h+5−2
@@ -122,8 +122,8 @@ static inline bool movable_node_is_enabled(void) · 121 unmodified lines
122122
123123 extern void arch_remove_memory(int nid, u64 start, u64 size,
124124 struct vmem_altmap *altmap);
125−extern void __remove_pages(struct zone *zone, unsigned long start_pfn,
126− unsigned long nr_pages, struct vmem_altmap *altmap);
125+extern void __remove_pages(unsigned long start_pfn, unsigned long nr_pages,
126+ struct vmem_altmap *altmap);
127127
128128 /* reasonably generic interface to expand the physical pages */
129129 extern int __add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
@@ -342,6 +342,9 @@ extern int add_memory(int nid, u64 start, u64 size); · 212 unmodified lines
342342 extern int add_memory_resource(int nid, struct resource *resource);
343343 extern void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,
344344 unsigned long nr_pages, struct vmem_altmap *altmap);
345+extern void remove_pfn_range_from_zone(struct zone *zone,
346+ unsigned long start_pfn,
347+ unsigned long nr_pages);
345348 extern bool is_memblock_offlined(struct memory_block *mem);
346349 extern int sparse_add_section(int nid, unsigned long pfn,
347350 unsigned long nr_pages, struct vmem_altmap *altmap);
include/linux/mfd/mt6397/rtc.h+8−0
@@ -46,6 +46,14 @@ · 45 unmodified lines
4646
4747 #define RTC_AL_SEC 0x0018
4848
49+#define RTC_AL_SEC_MASK 0x003f
50+#define RTC_AL_MIN_MASK 0x003f
51+#define RTC_AL_HOU_MASK 0x001f
52+#define RTC_AL_DOM_MASK 0x001f
53+#define RTC_AL_DOW_MASK 0x0007
54+#define RTC_AL_MTH_MASK 0x000f
55+#define RTC_AL_YEA_MASK 0x007f
56+
4957 #define RTC_PDN2 0x002e
5058 #define RTC_PDN2_PWRON_ALARM BIT(4)
5159
include/linux/mtd/flashchip.h+1−1
@@ -40,7 +40,7 @@ typedef enum { · 39 unmodified lines
4040 FL_READING,
4141 FL_CACHEDPRG,
4242 /* These 4 come from onenand_state_t, which has been unified here */
43− FL_RESETING,
43+ FL_RESETTING,
4444 FL_OTPING,
4545 FL_PREPARING_ERASE,
4646 FL_VERIFYING_ERASE,
include/linux/of_mdio.h+1−1
@@ -55,7 +55,7 @@ static inline int of_mdio_parse_addr(struct device *dev, · 54 unmodified lines
5555 }
5656
5757 #else /* CONFIG_OF_MDIO */
58−static bool of_mdiobus_child_is_phy(struct device_node *child)
58+static inline bool of_mdiobus_child_is_phy(struct device_node *child)
5959 {
6060 return false;
6161 }
include/linux/posix-clock.h+11−8
@@ -69,29 +69,32 @@ struct posix_clock_operations { · 68 unmodified lines
6969 *
7070 * @ops: Functional interface to the clock
7171 * @cdev: Character device instance for this clock
72− * @kref: Reference count.
72+ * @dev: Pointer to the clock's device.
7373 * @rwsem: Protects the 'zombie' field from concurrent access.
7474 * @zombie: If 'zombie' is true, then the hardware has disappeared.
75− * @release: A function to free the structure when the reference count reaches
76− * zero. May be NULL if structure is statically allocated.
7775 *
7876 * Drivers should embed their struct posix_clock within a private
7977 * structure, obtaining a reference to it during callbacks using
8078 * container_of().
79+ *
80+ * Drivers should supply an initialized but not exposed struct device
81+ * to posix_clock_register(). It is used to manage lifetime of the
82+ * driver's private structure. It's 'release' field should be set to
83+ * a release function for this private structure.
8184 */
8285 struct posix_clock {
8386 struct posix_clock_operations ops;
8487 struct cdev cdev;
85− struct kref kref;
88+ struct device *dev;
8689 struct rw_semaphore rwsem;
8790 bool zombie;
88− void (*release)(struct posix_clock *clk);
8991 };
9092
9193 /**
9294 * posix_clock_register() - register a new clock
93− * @clk: Pointer to the clock. Caller must provide 'ops' and 'release'
94− * @devid: Allocated device id
95+ * @clk: Pointer to the clock. Caller must provide 'ops' field
96+ * @dev: Pointer to the initialized device. Caller must provide
97+ * 'release' field
9598 *
9699 * A clock driver calls this function to register itself with the
97100 * clock device subsystem. If 'clk' points to dynamically allocated
@@ -100,7 +103,7 @@ struct posix_clock { · 2 unmodified lines
100103 *
101104 * Returns zero on success, non-zero otherwise.
102105 */
103−int posix_clock_register(struct posix_clock *clk, dev_t devid);
106+int posix_clock_register(struct posix_clock *clk, struct device *dev);
104107
105108 /**
106109 * posix_clock_unregister() - unregister a clock
include/linux/spi/spi.h+2−2
@@ -689,10 +689,10 @@ extern void spi_finalize_current_transfer(struct spi_controller *ctlr); · 688 unmodified lines
689689 /* Helper calls for driver to timestamp transfer */
690690 void spi_take_timestamp_pre(struct spi_controller *ctlr,
691691 struct spi_transfer *xfer,
692− const void *tx, bool irqs_off);
692+ size_t progress, bool irqs_off);
693693 void spi_take_timestamp_post(struct spi_controller *ctlr,
694694 struct spi_transfer *xfer,
695− const void *tx, bool irqs_off);
695+ size_t progress, bool irqs_off);
696696
697697 /* the spi driver core manages memory for the spi_controller classdev */
698698 extern struct spi_controller *__spi_alloc_controller(struct device *host,
include/linux/sxgbe_platform.h+1−1
@@ -1,6 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0-only */
22 /*
3− * 10G controller driver for Samsung EXYNOS SoCs
3+ * 10G controller driver for Samsung Exynos SoCs
44 *
55 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
66 * http://www.samsung.com
include/linux/syscalls.h+1−0
@@ -1232,6 +1232,7 @@ asmlinkage long sys_ni_syscall(void); · 1231 unmodified lines
12321232 */
12331233
12341234 int ksys_umount(char __user *name, int flags);
1235+int ksys_dup(unsigned int fildes);
12351236 int ksys_chroot(const char __user *filename);
12361237 ssize_t ksys_write(unsigned int fd, const char __user *buf, size_t count);
12371238 int ksys_chdir(const char __user *filename);
include/net/dst.h+11−2
@@ -516,7 +516,16 @@ static inline void skb_dst_update_pmtu(struct sk_buff *skb, u32 mtu) · 515 unmodified lines
516516 struct dst_entry *dst = skb_dst(skb);
517517
518518 if (dst && dst->ops->update_pmtu)
519− dst->ops->update_pmtu(dst, NULL, skb, mtu);
519+ dst->ops->update_pmtu(dst, NULL, skb, mtu, true);
520+}
521+
522+/* update dst pmtu but not do neighbor confirm */
523+static inline void skb_dst_update_pmtu_no_confirm(struct sk_buff *skb, u32 mtu)
524+{
525+ struct dst_entry *dst = skb_dst(skb);
526+
527+ if (dst && dst->ops->update_pmtu)
528+ dst->ops->update_pmtu(dst, NULL, skb, mtu, false);
520529 }
521530
522531 static inline void skb_tunnel_check_pmtu(struct sk_buff *skb,
@@ -526,7 +535,7 @@ static inline void skb_tunnel_check_pmtu(struct sk_buff *skb, · 3 unmodified lines
526535 u32 encap_mtu = dst_mtu(encap_dst);
527536
528537 if (skb->len > encap_mtu - headroom)
529− skb_dst_update_pmtu(skb, encap_mtu - headroom);
538+ skb_dst_update_pmtu_no_confirm(skb, encap_mtu - headroom);
530539 }
531540
532541 #endif /* _NET_DST_H */
include/net/dst_ops.h+2−1
@@ -27,7 +27,8 @@ struct dst_ops { · 26 unmodified lines
2727 struct dst_entry * (*negative_advice)(struct dst_entry *);
2828 void (*link_failure)(struct sk_buff *);
2929 void (*update_pmtu)(struct dst_entry *dst, struct sock *sk,
30− struct sk_buff *skb, u32 mtu);
30+ struct sk_buff *skb, u32 mtu,
31+ bool confirm_neigh);
3132 void (*redirect)(struct dst_entry *dst, struct sock *sk,
3233 struct sk_buff *skb);
3334 int (*local_out)(struct net *net, struct sock *sk, struct sk_buff *skb);
include/net/netfilter/nf_flow_table.h+6−0
@@ -106,6 +106,12 @@ struct flow_offload { · 105 unmodified lines
106106 };
107107
108108 #define NF_FLOW_TIMEOUT (30 * HZ)
109+#define nf_flowtable_time_stamp (u32)jiffies
110+
111+static inline __s32 nf_flow_timeout_delta(unsigned int timeout)
112+{
113+ return (__s32)(timeout - nf_flowtable_time_stamp);
114+}
109115
110116 struct nf_flow_route {
111117 struct {
include/net/sch_generic.h+5−0
@@ -308,6 +308,7 @@ struct tcf_proto_ops { · 307 unmodified lines
308308 int (*delete)(struct tcf_proto *tp, void *arg,
309309 bool *last, bool rtnl_held,
310310 struct netlink_ext_ack *);
311+ bool (*delete_empty)(struct tcf_proto *tp);
311312 void (*walk)(struct tcf_proto *tp,
312313 struct tcf_walker *arg, bool rtnl_held);
313314 int (*reoffload)(struct tcf_proto *tp, bool add,
@@ -336,6 +337,10 @@ struct tcf_proto_ops { · 22 unmodified lines
336337 int flags;
337338 };
338339
340+/* Classifiers setting TCF_PROTO_OPS_DOIT_UNLOCKED in tcf_proto_ops->flags
341+ * are expected to implement tcf_proto_ops->delete_empty(), otherwise race
342+ * conditions can occur when filters are inserted/deleted simultaneously.
343+ */
339344 enum tcf_proto_ops_flags {
340345 TCF_PROTO_OPS_DOIT_UNLOCKED = 1,
341346 };
include/soc/sifive/sifive_l2_cache.hrenamed from arch/riscv/include/asm/sifive_l2_cache.h+3−3
@@ -4,8 +4,8 @@ · 3 unmodified lines
44 *
55 */
66
7−#ifndef _ASM_RISCV_SIFIVE_L2_CACHE_H
8−#define _ASM_RISCV_SIFIVE_L2_CACHE_H
7+#ifndef __SOC_SIFIVE_L2_CACHE_H
8+#define __SOC_SIFIVE_L2_CACHE_H
99
1010 extern int register_sifive_l2_error_notifier(struct notifier_block *nb);
1111 extern int unregister_sifive_l2_error_notifier(struct notifier_block *nb);
@@ -13,4 +13,4 @@ extern int unregister_sifive_l2_error_notifier(struct notifier_block *nb); · 1 unmodified line
1313 #define SIFIVE_L2_ERR_TYPE_CE 0
1414 #define SIFIVE_L2_ERR_TYPE_UE 1
1515
16−#endif /* _ASM_RISCV_SIFIVE_L2_CACHE_H */
16+#endif /* __SOC_SIFIVE_L2_CACHE_H */
include/trace/events/preemptirq.h+4−4
@@ -18,13 +18,13 @@ DECLARE_EVENT_CLASS(preemptirq_template, · 17 unmodified lines
1818 TP_ARGS(ip, parent_ip),
1919
2020 TP_STRUCT__entry(
21− __field(u32, caller_offs)
22− __field(u32, parent_offs)
21+ __field(s32, caller_offs)
22+ __field(s32, parent_offs)
2323 ),
2424
2525 TP_fast_assign(
26− __entry->caller_offs = (u32)(ip - (unsigned long)_stext);
27− __entry->parent_offs = (u32)(parent_ip - (unsigned long)_stext);
26+ __entry->caller_offs = (s32)(ip - (unsigned long)_stext);
27+ __entry->parent_offs = (s32)(parent_ip - (unsigned long)_stext);
2828 ),
2929
3030 TP_printk("caller=%pS parent=%pS",
include/uapi/linux/input.h+1−0
@@ -34,6 +34,7 @@ struct input_event { · 33 unmodified lines
3434 __kernel_ulong_t __sec;
3535 #if defined(__sparc__) && defined(__arch64__)
3636 unsigned int __usec;
37+ unsigned int __pad;
3738 #else
3839 __kernel_ulong_t __usec;
3940 #endif
include/uapi/linux/kcov.h+5−5
@@ -9,11 +9,11 @@ · 8 unmodified lines
99 * and the comment before kcov_remote_start() for usage details.
1010 */
1111 struct kcov_remote_arg {
12− unsigned int trace_mode; /* KCOV_TRACE_PC or KCOV_TRACE_CMP */
13− unsigned int area_size; /* Length of coverage buffer in words */
14− unsigned int num_handles; /* Size of handles array */
15− __u64 common_handle;
16− __u64 handles[0];
12+ __u32 trace_mode; /* KCOV_TRACE_PC or KCOV_TRACE_CMP */
13+ __u32 area_size; /* Length of coverage buffer in words */
14+ __u32 num_handles; /* Size of handles array */
15+ __aligned_u64 common_handle;
16+ __aligned_u64 handles[0];
1717 };
1818
1919 #define KCOV_REMOTE_MAX_HANDLES 0x100
init/main.c+6−20
@@ -93,7 +93,6 @@ · 92 unmodified lines
9393 #include <linux/rodata_test.h>
9494 #include <linux/jump_label.h>
9595 #include <linux/mem_encrypt.h>
96−#include <linux/file.h>
9796
9897 #include <asm/io.h>
9998 #include <asm/bugs.h>
@@ -1158,26 +1157,13 @@ static int __ref kernel_init(void *unused) · 1058 unmodified lines
11581157
11591158 void console_on_rootfs(void)
11601159 {
1161− struct file *file;
1162− unsigned int i;
1163−
1164− /* Open /dev/console in kernelspace, this should never fail */
1165− file = filp_open("/dev/console", O_RDWR, 0);
1166− if (IS_ERR(file))
1167− goto err_out;
1168−
1169− /* create stdin/stdout/stderr, this should never fail */
1170− for (i = 0; i < 3; i++) {
1171− if (f_dupfd(i, file, 0) != i)
1172− goto err_out;
1173− }
1174−
1175− return;
1160+ /* Open the /dev/console as stdin, this should never fail */
1161+ if (ksys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
1162+ pr_err("Warning: unable to open an initial console.\n");
11761163
1177−err_out:
1178− /* no panic -- this might not be fatal */
1179− pr_err("Warning: unable to open an initial console.\n");
1180− return;
1164+ /* create stdout/stderr */
1165+ (void) ksys_dup(0);
1166+ (void) ksys_dup(0);
11811167 }
11821168
11831169 static noinline void __init kernel_init_freeable(void)
kernel/bpf/cgroup.c+9−2
@@ -35,8 +35,8 @@ void cgroup_bpf_offline(struct cgroup *cgrp) · 34 unmodified lines
3535 */
3636 static void cgroup_bpf_release(struct work_struct *work)
3737 {
38− struct cgroup *cgrp = container_of(work, struct cgroup,
39− bpf.release_work);
38+ struct cgroup *p, *cgrp = container_of(work, struct cgroup,
39+ bpf.release_work);
4040 enum bpf_cgroup_storage_type stype;
4141 struct bpf_prog_array *old_array;
4242 unsigned int type;
@@ -65,6 +65,9 @@ static void cgroup_bpf_release(struct work_struct *work) · 22 unmodified lines
6565
6666 mutex_unlock(&cgroup_mutex);
6767
68+ for (p = cgroup_parent(cgrp); p; p = cgroup_parent(p))
69+ cgroup_bpf_put(p);
70+
6871 percpu_ref_exit(&cgrp->bpf.refcnt);
6972 cgroup_put(cgrp);
7073 }
@@ -199,6 +202,7 @@ int cgroup_bpf_inherit(struct cgroup *cgrp) · 128 unmodified lines
199202 */
200203 #define NR ARRAY_SIZE(cgrp->bpf.effective)
201204 struct bpf_prog_array *arrays[NR] = {};
205+ struct cgroup *p;
202206 int ret, i;
203207
204208 ret = percpu_ref_init(&cgrp->bpf.refcnt, cgroup_bpf_release_fn, 0,
@@ -206,6 +210,9 @@ int cgroup_bpf_inherit(struct cgroup *cgrp) · 1 unmodified line
206210 if (ret)
207211 return ret;
208212
213+ for (p = cgroup_parent(cgrp); p; p = cgroup_parent(p))
214+ cgroup_bpf_get(p);
215+
209216 for (i = 0; i < NR; i++)
210217 INIT_LIST_HEAD(&cgrp->bpf.progs[i]);
211218
kernel/bpf/verifier.c+29−23
@@ -907,7 +907,8 @@ static const int caller_saved[CALLER_SAVED_REGS] = { · 906 unmodified lines
907907 BPF_REG_0, BPF_REG_1, BPF_REG_2, BPF_REG_3, BPF_REG_4, BPF_REG_5
908908 };
909909
910−static void __mark_reg_not_init(struct bpf_reg_state *reg);
910+static void __mark_reg_not_init(const struct bpf_verifier_env *env,
911+ struct bpf_reg_state *reg);
911912
912913 /* Mark the unknown part of a register (variable offset or scalar value) as
913914 * known to have the value @imm.
@@ -945,7 +946,7 @@ static void mark_reg_known_zero(struct bpf_verifier_env *env, · 31 unmodified lines
945946 verbose(env, "mark_reg_known_zero(regs, %u)\n", regno);
946947 /* Something bad happened, let's kill all regs */
947948 for (regno = 0; regno < MAX_BPF_REG; regno++)
948− __mark_reg_not_init(regs + regno);
949+ __mark_reg_not_init(env, regs + regno);
949950 return;
950951 }
951952 __mark_reg_known_zero(regs + regno);
@@ -1054,7 +1055,8 @@ static void __mark_reg_unbounded(struct bpf_reg_state *reg) · 102 unmodified lines
10541055 }
10551056
10561057 /* Mark a register as having a completely unknown (scalar) value. */
1057−static void __mark_reg_unknown(struct bpf_reg_state *reg)
1058+static void __mark_reg_unknown(const struct bpf_verifier_env *env,
1059+ struct bpf_reg_state *reg)
10581060 {
10591061 /*
10601062 * Clear type, id, off, and union(map_ptr, range) and
@@ -1064,6 +1066,8 @@ static void __mark_reg_unknown(struct bpf_reg_state *reg) · 3 unmodified lines
10641066 reg->type = SCALAR_VALUE;
10651067 reg->var_off = tnum_unknown;
10661068 reg->frameno = 0;
1069+ reg->precise = env->subprog_cnt > 1 || !env->allow_ptr_leaks ?
1070+ true : false;
10671071 __mark_reg_unbounded(reg);
10681072 }
10691073
@@ -1074,19 +1078,16 @@ static void mark_reg_unknown(struct bpf_verifier_env *env, · 4 unmodified lines
10741078 verbose(env, "mark_reg_unknown(regs, %u)\n", regno);
10751079 /* Something bad happened, let's kill all regs except FP */
10761080 for (regno = 0; regno < BPF_REG_FP; regno++)
1077− __mark_reg_not_init(regs + regno);
1081+ __mark_reg_not_init(env, regs + regno);
10781082 return;
10791083 }
1080− regs += regno;
1081− __mark_reg_unknown(regs);
1082− /* constant backtracking is enabled for root without bpf2bpf calls */
1083− regs->precise = env->subprog_cnt > 1 || !env->allow_ptr_leaks ?
1084− true : false;
1084+ __mark_reg_unknown(env, regs + regno);
10851085 }
10861086
1087−static void __mark_reg_not_init(struct bpf_reg_state *reg)
1087+static void __mark_reg_not_init(const struct bpf_verifier_env *env,
1088+ struct bpf_reg_state *reg)
10881089 {
1089− __mark_reg_unknown(reg);
1090+ __mark_reg_unknown(env, reg);
10901091 reg->type = NOT_INIT;
10911092 }
10921093
@@ -1097,10 +1098,10 @@ static void mark_reg_not_init(struct bpf_verifier_env *env, · 4 unmodified lines
10971098 verbose(env, "mark_reg_not_init(regs, %u)\n", regno);
10981099 /* Something bad happened, let's kill all regs except FP */
10991100 for (regno = 0; regno < BPF_REG_FP; regno++)
1100− __mark_reg_not_init(regs + regno);
1101+ __mark_reg_not_init(env, regs + regno);
11011102 return;
11021103 }
1103− __mark_reg_not_init(regs + regno);
1104+ __mark_reg_not_init(env, regs + regno);
11041105 }
11051106
11061107 #define DEF_NOT_SUBREG (0)
@@ -3234,7 +3235,7 @@ static int check_stack_boundary(struct bpf_verifier_env *env, int regno, · 2127 unmodified lines
32343235 }
32353236 if (state->stack[spi].slot_type[0] == STACK_SPILL &&
32363237 state->stack[spi].spilled_ptr.type == SCALAR_VALUE) {
3237− __mark_reg_unknown(&state->stack[spi].spilled_ptr);
3238+ __mark_reg_unknown(env, &state->stack[spi].spilled_ptr);
32383239 for (j = 0; j < BPF_REG_SIZE; j++)
32393240 state->stack[spi].slot_type[j] = STACK_MISC;
32403241 goto mark;
@@ -3892,7 +3893,7 @@ static void __clear_all_pkt_pointers(struct bpf_verifier_env *env, · 651 unmodified lines
38923893 if (!reg)
38933894 continue;
38943895 if (reg_is_pkt_pointer_any(reg))
3895− __mark_reg_unknown(reg);
3896+ __mark_reg_unknown(env, reg);
38963897 }
38973898 }
38983899
@@ -3920,7 +3921,7 @@ static void release_reg_references(struct bpf_verifier_env *env, · 21 unmodified lines
39203921 if (!reg)
39213922 continue;
39223923 if (reg->ref_obj_id == ref_obj_id)
3923− __mark_reg_unknown(reg);
3924+ __mark_reg_unknown(env, reg);
39243925 }
39253926 }
39263927
@@ -4582,7 +4583,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env, · 655 unmodified lines
45824583 /* Taint dst register if offset had invalid bounds derived from
45834584 * e.g. dead branches.
45844585 */
4585− __mark_reg_unknown(dst_reg);
4586+ __mark_reg_unknown(env, dst_reg);
45864587 return 0;
45874588 }
45884589
@@ -4834,13 +4835,13 @@ static int adjust_scalar_min_max_vals(struct bpf_verifier_env *env, · 245 unmodified lines
48344835 /* Taint dst register if offset had invalid bounds derived from
48354836 * e.g. dead branches.
48364837 */
4837− __mark_reg_unknown(dst_reg);
4838+ __mark_reg_unknown(env, dst_reg);
48384839 return 0;
48394840 }
48404841
48414842 if (!src_known &&
48424843 opcode != BPF_ADD && opcode != BPF_SUB && opcode != BPF_AND) {
4843− __mark_reg_unknown(dst_reg);
4844+ __mark_reg_unknown(env, dst_reg);
48444845 return 0;
48454846 }
48464847
@@ -6263,6 +6264,7 @@ static bool may_access_skb(enum bpf_prog_type type) · 1416 unmodified lines
62636264 static int check_ld_abs(struct bpf_verifier_env *env, struct bpf_insn *insn)
62646265 {
62656266 struct bpf_reg_state *regs = cur_regs(env);
6267+ static const int ctx_reg = BPF_REG_6;
62666268 u8 mode = BPF_MODE(insn->code);
62676269 int i, err;
62686270
@@ -6296,7 +6298,7 @@ static int check_ld_abs(struct bpf_verifier_env *env, struct bpf_insn *insn) · 27 unmodified lines
62966298 }
62976299
62986300 /* check whether implicit source operand (register R6) is readable */
6299− err = check_reg_arg(env, BPF_REG_6, SRC_OP);
6301+ err = check_reg_arg(env, ctx_reg, SRC_OP);
63006302 if (err)
63016303 return err;
63026304
@@ -6315,7 +6317,7 @@ static int check_ld_abs(struct bpf_verifier_env *env, struct bpf_insn *insn) · 12 unmodified lines
63156317 return -EINVAL;
63166318 }
63176319
6318− if (regs[BPF_REG_6].type != PTR_TO_CTX) {
6320+ if (regs[ctx_reg].type != PTR_TO_CTX) {
63196321 verbose(env,
63206322 "at the time of BPF_LD_ABS|IND R6 != pointer to skb\n");
63216323 return -EINVAL;
@@ -6328,6 +6330,10 @@ static int check_ld_abs(struct bpf_verifier_env *env, struct bpf_insn *insn) · 6 unmodified lines
63286330 return err;
63296331 }
63306332
6333+ err = check_ctx_reg(env, &regs[ctx_reg], ctx_reg);
6334+ if (err < 0)
6335+ return err;
6336+
63316337 /* reset caller saved regs to unreadable */
63326338 for (i = 0; i < CALLER_SAVED_REGS; i++) {
63336339 mark_reg_not_init(env, regs, caller_saved[i]);
@@ -6982,7 +6988,7 @@ static void clean_func_state(struct bpf_verifier_env *env, · 648 unmodified lines
69826988 /* since the register is unused, clear its state
69836989 * to make further comparison simpler
69846990 */
6985− __mark_reg_not_init(&st->regs[i]);
6991+ __mark_reg_not_init(env, &st->regs[i]);
69866992 }
69876993
69886994 for (i = 0; i < st->allocated_stack / BPF_REG_SIZE; i++) {
@@ -6990,7 +6996,7 @@ static void clean_func_state(struct bpf_verifier_env *env, · 1 unmodified line
69906996 /* liveness must not touch this stack slot anymore */
69916997 st->stack[i].spilled_ptr.live |= REG_LIVE_DONE;
69926998 if (!(live & REG_LIVE_READ)) {
6993− __mark_reg_not_init(&st->stack[i].spilled_ptr);
6999+ __mark_reg_not_init(env, &st->stack[i].spilled_ptr);
69947000 for (j = 0; j < BPF_REG_SIZE; j++)
69957001 st->stack[i].slot_type[j] = STACK_INVALID;
69967002 }
kernel/cred.c+3−3
@@ -223,7 +223,7 @@ struct cred *cred_alloc_blank(void) · 222 unmodified lines
223223 new->magic = CRED_MAGIC;
224224 #endif
225225
226− if (security_cred_alloc_blank(new, GFP_KERNEL) < 0)
226+ if (security_cred_alloc_blank(new, GFP_KERNEL_ACCOUNT) < 0)
227227 goto error;
228228
229229 return new;
@@ -282,7 +282,7 @@ struct cred *prepare_creds(void) · 52 unmodified lines
282282 new->security = NULL;
283283 #endif
284284
285− if (security_prepare_creds(new, old, GFP_KERNEL) < 0)
285+ if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0)
286286 goto error;
287287 validate_creds(new);
288288 return new;
@@ -715,7 +715,7 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon) · 426 unmodified lines
715715 #ifdef CONFIG_SECURITY
716716 new->security = NULL;
717717 #endif
718− if (security_prepare_creds(new, old, GFP_KERNEL) < 0)
718+ if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0)
719719 goto error;
720720
721721 put_cred(old);
kernel/exit.c+8−4
@@ -517,10 +517,6 @@ static struct task_struct *find_child_reaper(struct task_struct *father, · 516 unmodified lines
517517 }
518518
519519 write_unlock_irq(&tasklist_lock);
520− if (unlikely(pid_ns == &init_pid_ns)) {
521− panic("Attempted to kill init! exitcode=0x%08x\n",
522− father->signal->group_exit_code ?: father->exit_code);
523− }
524520
525521 list_for_each_entry_safe(p, n, dead, ptrace_entry) {
526522 list_del_init(&p->ptrace_entry);
@@ -766,6 +762,14 @@ void __noreturn do_exit(long code) · 239 unmodified lines
766762 acct_update_integrals(tsk);
767763 group_dead = atomic_dec_and_test(&tsk->signal->live);
768764 if (group_dead) {
765+ /*
766+ * If the last thread of global init has exited, panic
767+ * immediately to get a useable coredump.
768+ */
769+ if (unlikely(is_global_init(tsk)))
770+ panic("Attempted to kill init! exitcode=0x%08x\n",
771+ tsk->signal->group_exit_code ?: (int)code);
772+
769773 #ifdef CONFIG_POSIX_TIMERS
770774 hrtimer_cancel(&tsk->signal->real_timer);
771775 exit_itimers(tsk->signal);
kernel/fork.c+10−0
@@ -2578,6 +2578,16 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, · 2577 unmodified lines
25782578 #endif
25792579
25802580 #ifdef __ARCH_WANT_SYS_CLONE3
2581+
2582+/*
2583+ * copy_thread implementations handle CLONE_SETTLS by reading the TLS value from
2584+ * the registers containing the syscall arguments for clone. This doesn't work
2585+ * with clone3 since the TLS value is passed in clone_args instead.
2586+ */
2587+#ifndef CONFIG_HAVE_COPY_THREAD_TLS
2588+#error clone3 requires copy_thread_tls support in arch
2589+#endif
2590+
25812591 noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs,
25822592 struct clone_args __user *uargs,
25832593 size_t usize)
kernel/seccomp.c+7−0
@@ -1026,6 +1026,13 @@ static long seccomp_notify_recv(struct seccomp_filter *filter, · 1025 unmodified lines
10261026 struct seccomp_notif unotif;
10271027 ssize_t ret;
10281028
1029+ /* Verify that we're not given garbage to keep struct extensible. */
1030+ ret = check_zeroed_user(buf, sizeof(unotif));
1031+ if (ret < 0)
1032+ return ret;
1033+ if (!ret)
1034+ return -EINVAL;
1035+
10291036 memset(&unotif, 0, sizeof(unotif));
10301037
10311038 ret = down_interruptible(&filter->notif->request);
kernel/taskstats.c+19−11
@@ -554,25 +554,33 @@ static int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info) · 553 unmodified lines
554554 static struct taskstats *taskstats_tgid_alloc(struct task_struct *tsk)
555555 {
556556 struct signal_struct *sig = tsk->signal;
557− struct taskstats *stats;
557+ struct taskstats *stats_new, *stats;
558558
559− if (sig->stats || thread_group_empty(tsk))
560− goto ret;
559+ /* Pairs with smp_store_release() below. */
560+ stats = smp_load_acquire(&sig->stats);
561+ if (stats || thread_group_empty(tsk))
562+ return stats;
561563
562564 /* No problem if kmem_cache_zalloc() fails */
563− stats = kmem_cache_zalloc(taskstats_cache, GFP_KERNEL);
565+ stats_new = kmem_cache_zalloc(taskstats_cache, GFP_KERNEL);
564566
565567 spin_lock_irq(&tsk->sighand->siglock);
566− if (!sig->stats) {
567− sig->stats = stats;
568− stats = NULL;
568+ stats = sig->stats;
569+ if (!stats) {
570+ /*
571+ * Pairs with smp_store_release() above and order the
572+ * kmem_cache_zalloc().
573+ */
574+ smp_store_release(&sig->stats, stats_new);
575+ stats = stats_new;
576+ stats_new = NULL;
569577 }
570578 spin_unlock_irq(&tsk->sighand->siglock);
571579
572− if (stats)
573− kmem_cache_free(taskstats_cache, stats);
574−ret:
575− return sig->stats;
580+ if (stats_new)
581+ kmem_cache_free(taskstats_cache, stats_new);
582+
583+ return stats;
576584 }
577585
578586 /* Send pid data out on exit */
kernel/time/posix-clock.c+13−18
@@ -14,8 +14,6 @@ · 13 unmodified lines
1414
1515 #include "posix-timers.h"
1616
17−static void delete_clock(struct kref *kref);
18−
1917 /*
2018 * Returns NULL if the posix_clock instance attached to 'fp' is old and stale.
2119 */
@@ -125,7 +123,7 @@ static int posix_clock_open(struct inode *inode, struct file *fp) · 103 unmodified lines
125123 err = 0;
126124
127125 if (!err) {
128− kref_get(&clk->kref);
126+ get_device(clk->dev);
129127 fp->private_data = clk;
130128 }
131129 out:
@@ -141,7 +139,7 @@ static int posix_clock_release(struct inode *inode, struct file *fp) · 9 unmodified lines
141139 if (clk->ops.release)
142140 err = clk->ops.release(clk);
143141
144− kref_put(&clk->kref, delete_clock);
142+ put_device(clk->dev);
145143
146144 fp->private_data = NULL;
147145
@@ -161,38 +159,35 @@ static const struct file_operations posix_clock_file_operations = { · 13 unmodified lines
161159 #endif
162160 };
163161
164−int posix_clock_register(struct posix_clock *clk, dev_t devid)
162+int posix_clock_register(struct posix_clock *clk, struct device *dev)
165163 {
166164 int err;
167165
168− kref_init(&clk->kref);
169166 init_rwsem(&clk->rwsem);
170167
171168 cdev_init(&clk->cdev, &posix_clock_file_operations);
169+ err = cdev_device_add(&clk->cdev, dev);
170+ if (err) {
171+ pr_err("%s unable to add device %d:%d\n",
172+ dev_name(dev), MAJOR(dev->devt), MINOR(dev->devt));
173+ return err;
174+ }
172175 clk->cdev.owner = clk->ops.owner;
173− err = cdev_add(&clk->cdev, devid, 1);
176+ clk->dev = dev;
174177
175− return err;
178+ return 0;
176179 }
177180 EXPORT_SYMBOL_GPL(posix_clock_register);
178181
179−static void delete_clock(struct kref *kref)
180−{
181− struct posix_clock *clk = container_of(kref, struct posix_clock, kref);
182−
183− if (clk->release)
184− clk->release(clk);
185−}
186−
187182 void posix_clock_unregister(struct posix_clock *clk)
188183 {
189− cdev_del(&clk->cdev);
184+ cdev_device_del(&clk->cdev, clk->dev);
190185
191186 down_write(&clk->rwsem);
192187 clk->zombie = true;
193188 up_write(&clk->rwsem);
194189
195− kref_put(&clk->kref, delete_clock);
190+ put_device(clk->dev);
196191 }
197192 EXPORT_SYMBOL_GPL(posix_clock_unregister);
198193
kernel/trace/fgraph.c+14−0
@@ -96,6 +96,20 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, · 95 unmodified lines
9696 return 0;
9797 }
9898
99+/*
100+ * Not all archs define MCOUNT_INSN_SIZE which is used to look for direct
101+ * functions. But those archs currently don't support direct functions
102+ * anyway, and ftrace_find_rec_direct() is just a stub for them.
103+ * Define MCOUNT_INSN_SIZE to keep those archs compiling.
104+ */
105+#ifndef MCOUNT_INSN_SIZE
106+/* Make sure this only works without direct calls */
107+# ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
108+# error MCOUNT_INSN_SIZE not defined with direct calls enabled
109+# endif
110+# define MCOUNT_INSN_SIZE 0
111+#endif
112+
99113 int function_graph_enter(unsigned long ret, unsigned long func,
100114 unsigned long frame_pointer, unsigned long *retp)
101115 {
kernel/trace/ftrace.c+3−3
@@ -526,8 +526,7 @@ static int function_stat_show(struct seq_file *m, void *v) · 525 unmodified lines
526526 }
527527
528528 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
529− avg = rec->time;
530− do_div(avg, rec->counter);
529+ avg = div64_ul(rec->time, rec->counter);
531530 if (tracing_thresh && (avg < tracing_thresh))
532531 goto out;
533532 #endif
@@ -553,7 +552,8 @@ static int function_stat_show(struct seq_file *m, void *v) · 19 unmodified lines
553552 * Divide only 1000 for ns^2 -> us^2 conversion.
554553 * trace_print_graph_duration will divide 1000 again.
555554 */
556− do_div(stddev, rec->counter * (rec->counter - 1) * 1000);
555+ stddev = div64_ul(stddev,
556+ rec->counter * (rec->counter - 1) * 1000);
557557 }
558558
559559 trace_seq_init(&s);
kernel/trace/trace_events_inject.c+1−1
@@ -195,7 +195,7 @@ static int parse_entry(char *str, struct trace_event_call *call, void **pentry) · 194 unmodified lines
195195 unsigned long irq_flags;
196196 void *entry = NULL;
197197 int entry_size;
198− u64 val;
198+ u64 val = 0;
199199 int len;
200200
201201 entry = trace_alloc_entry(call, &entry_size);
kernel/trace/trace_sched_wakeup.c+3−1
@@ -630,7 +630,7 @@ static void start_wakeup_tracer(struct trace_array *tr) · 629 unmodified lines
630630 if (ret) {
631631 pr_info("wakeup trace: Couldn't activate tracepoint"
632632 " probe to kernel_sched_migrate_task\n");
633− return;
633+ goto fail_deprobe_sched_switch;
634634 }
635635
636636 wakeup_reset(tr);
@@ -648,6 +648,8 @@ static void start_wakeup_tracer(struct trace_array *tr) · 11 unmodified lines
648648 printk(KERN_ERR "failed to start wakeup tracer\n");
649649
650650 return;
651+fail_deprobe_sched_switch:
652+ unregister_trace_sched_switch(probe_wakeup_sched_switch, NULL);
651653 fail_deprobe_wake_new:
652654 unregister_trace_sched_wakeup_new(probe_wakeup, NULL);
653655 fail_deprobe:
kernel/trace/trace_seq.c+1−1
@@ -381,7 +381,7 @@ int trace_seq_hex_dump(struct trace_seq *s, const char *prefix_str, · 380 unmodified lines
381381 int prefix_type, int rowsize, int groupsize,
382382 const void *buf, size_t len, bool ascii)
383383 {
384− unsigned int save_len = s->seq.len;
384+ unsigned int save_len = s->seq.len;
385385
386386 if (s->full)
387387 return 0;
kernel/trace/trace_stack.c+5−0
@@ -283,6 +283,11 @@ static void check_stack(unsigned long ip, unsigned long *stack) · 282 unmodified lines
283283 local_irq_restore(flags);
284284 }
285285
286+/* Some archs may not define MCOUNT_INSN_SIZE */
287+#ifndef MCOUNT_INSN_SIZE
288+# define MCOUNT_INSN_SIZE 0
289+#endif
290+
286291 static void
287292 stack_trace_call(unsigned long ip, unsigned long parent_ip,
288293 struct ftrace_ops *op, struct pt_regs *pt_regs)
mm/gup_benchmark.c+6−2
@@ -26,6 +26,7 @@ static int __gup_benchmark_ioctl(unsigned int cmd, · 25 unmodified lines
2626 unsigned long i, nr_pages, addr, next;
2727 int nr;
2828 struct page **pages;
29+ int ret = 0;
2930
3031 if (gup->size > ULONG_MAX)
3132 return -EINVAL;
@@ -63,7 +64,9 @@ static int __gup_benchmark_ioctl(unsigned int cmd, · 31 unmodified lines
6364 NULL);
6465 break;
6566 default:
66− return -1;
67+ kvfree(pages);
68+ ret = -EINVAL;
69+ goto out;
6770 }
6871
6972 if (nr <= 0)
@@ -85,7 +88,8 @@ static int __gup_benchmark_ioctl(unsigned int cmd, · 15 unmodified lines
8588 gup->put_delta_usec = ktime_us_delta(end_time, start_time);
8689
8790 kvfree(pages);
88− return 0;
91+out:
92+ return ret;
8993 }
9094
9195 static long gup_benchmark_ioctl(struct file *filep, unsigned int cmd,
mm/hugetlb.c+50−1
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include <linux/swapops.h>
2828 #include <linux/jhash.h>
2929 #include <linux/numa.h>
30+#include <linux/llist.h>
3031
3132 #include <asm/page.h>
3233 #include <asm/pgtable.h>
@@ -1136,7 +1137,7 @@ static inline void ClearPageHugeTemporary(struct page *page) · 1103 unmodified lines
11361137 page[2].mapping = NULL;
11371138 }
11381139
1139−void free_huge_page(struct page *page)
1140+static void __free_huge_page(struct page *page)
11401141 {
11411142 /*
11421143 * Can't pass hstate in here because it is called from the
@@ -1199,6 +1200,54 @@ void free_huge_page(struct page *page) · 56 unmodified lines
11991200 spin_unlock(&hugetlb_lock);
12001201 }
12011202
1203+/*
1204+ * As free_huge_page() can be called from a non-task context, we have
1205+ * to defer the actual freeing in a workqueue to prevent potential
1206+ * hugetlb_lock deadlock.
1207+ *
1208+ * free_hpage_workfn() locklessly retrieves the linked list of pages to
1209+ * be freed and frees them one-by-one. As the page->mapping pointer is
1210+ * going to be cleared in __free_huge_page() anyway, it is reused as the
1211+ * llist_node structure of a lockless linked list of huge pages to be freed.
1212+ */
1213+static LLIST_HEAD(hpage_freelist);
1214+
1215+static void free_hpage_workfn(struct work_struct *work)
1216+{
1217+ struct llist_node *node;
1218+ struct page *page;
1219+
1220+ node = llist_del_all(&hpage_freelist);
1221+
1222+ while (node) {
1223+ page = container_of((struct address_space **)node,
1224+ struct page, mapping);
1225+ node = node->next;
1226+ __free_huge_page(page);
1227+ }
1228+}
1229+static DECLARE_WORK(free_hpage_work, free_hpage_workfn);
1230+
1231+void free_huge_page(struct page *page)
1232+{
1233+ /*
1234+ * Defer freeing if in non-task context to avoid hugetlb_lock deadlock.
1235+ */
1236+ if (!in_task()) {
1237+ /*
1238+ * Only call schedule_work() if hpage_freelist is previously
1239+ * empty. Otherwise, schedule_work() had been called but the
1240+ * workfn hasn't retrieved the list yet.
1241+ */
1242+ if (llist_add((struct llist_node *)&page->mapping,
1243+ &hpage_freelist))
1244+ schedule_work(&free_hpage_work);
1245+ return;
1246+ }
1247+
1248+ __free_huge_page(page);
1249+}
1250+
12021251 static void prep_new_huge_page(struct hstate *h, struct page *page, int nid)
12031252 {
12041253 INIT_LIST_HEAD(&page->lru);
mm/memory_hotplug.c+16−15
@@ -483,8 +483,9 @@ static void update_pgdat_span(struct pglist_data *pgdat) · 482 unmodified lines
483483 pgdat->node_spanned_pages = node_end_pfn - node_start_pfn;
484484 }
485485
486−static void __remove_zone(struct zone *zone, unsigned long start_pfn,
487− unsigned long nr_pages)
486+void __ref remove_pfn_range_from_zone(struct zone *zone,
487+ unsigned long start_pfn,
488+ unsigned long nr_pages)
488489 {
489490 struct pglist_data *pgdat = zone->zone_pgdat;
490491 unsigned long flags;
@@ -499,28 +500,30 @@ static void __remove_zone(struct zone *zone, unsigned long start_pfn, · 8 unmodified lines
499500 return;
500501 #endif
501502
503+ clear_zone_contiguous(zone);
504+
502505 pgdat_resize_lock(zone->zone_pgdat, &flags);
503506 shrink_zone_span(zone, start_pfn, start_pfn + nr_pages);
504507 update_pgdat_span(pgdat);
505508 pgdat_resize_unlock(zone->zone_pgdat, &flags);
509+
510+ set_zone_contiguous(zone);
506511 }
507512
508−static void __remove_section(struct zone *zone, unsigned long pfn,
509− unsigned long nr_pages, unsigned long map_offset,
510− struct vmem_altmap *altmap)
513+static void __remove_section(unsigned long pfn, unsigned long nr_pages,
514+ unsigned long map_offset,
515+ struct vmem_altmap *altmap)
511516 {
512517 struct mem_section *ms = __nr_to_section(pfn_to_section_nr(pfn));
513518
514519 if (WARN_ON_ONCE(!valid_section(ms)))
515520 return;
516521
517− __remove_zone(zone, pfn, nr_pages);
518522 sparse_remove_section(ms, pfn, nr_pages, map_offset, altmap);
519523 }
520524
521525 /**
522− * __remove_pages() - remove sections of pages from a zone
523− * @zone: zone from which pages need to be removed
526+ * __remove_pages() - remove sections of pages
524527 * @pfn: starting pageframe (must be aligned to start of a section)
525528 * @nr_pages: number of pages to remove (must be multiple of section size)
526529 * @altmap: alternative device page map or %NULL if default memmap is used
@@ -530,16 +533,14 @@ static void __remove_section(struct zone *zone, unsigned long pfn, · 3 unmodified lines
530533 * sure that pages are marked reserved and zones are adjust properly by
531534 * calling offline_pages().
532535 */
533−void __remove_pages(struct zone *zone, unsigned long pfn,
534− unsigned long nr_pages, struct vmem_altmap *altmap)
536+void __remove_pages(unsigned long pfn, unsigned long nr_pages,
537+ struct vmem_altmap *altmap)
535538 {
536539 unsigned long map_offset = 0;
537540 unsigned long nr, start_sec, end_sec;
538541
539542 map_offset = vmem_altmap_offset(altmap);
540543
541− clear_zone_contiguous(zone);
542−
543544 if (check_pfn_span(pfn, nr_pages, "remove"))
544545 return;
545546
@@ -551,13 +552,11 @@ void __remove_pages(struct zone *zone, unsigned long pfn, · 5 unmodified lines
551552 cond_resched();
552553 pfns = min(nr_pages, PAGES_PER_SECTION
553554 - (pfn & ~PAGE_SECTION_MASK));
554− __remove_section(zone, pfn, pfns, map_offset, altmap);
555+ __remove_section(pfn, pfns, map_offset, altmap);
555556 pfn += pfns;
556557 nr_pages -= pfns;
557558 map_offset = 0;
558559 }
559−
560− set_zone_contiguous(zone);
561560 }
562561
563562 int set_online_page_callback(online_page_callback_t callback)
@@ -869,6 +868,7 @@ failed_addition: · 305 unmodified lines
869868 (unsigned long long) pfn << PAGE_SHIFT,
870869 (((unsigned long long) pfn + nr_pages) << PAGE_SHIFT) - 1);
871870 memory_notify(MEM_CANCEL_ONLINE, &arg);
871+ remove_pfn_range_from_zone(zone, pfn, nr_pages);
872872 mem_hotplug_done();
873873 return ret;
874874 }
@@ -1628,6 +1628,7 @@ static int __ref __offline_pages(unsigned long start_pfn, · 753 unmodified lines
16281628 writeback_set_ratelimit();
16291629
16301630 memory_notify(MEM_OFFLINE, &arg);
1631+ remove_pfn_range_from_zone(zone, start_pfn, nr_pages);
16311632 mem_hotplug_done();
16321633 return 0;
16331634
mm/memremap.c+1−1
@@ -120,7 +120,7 @@ void memunmap_pages(struct dev_pagemap *pgmap) · 119 unmodified lines
120120
121121 mem_hotplug_begin();
122122 if (pgmap->type == MEMORY_DEVICE_PRIVATE) {
123− __remove_pages(page_zone(first_page), PHYS_PFN(res->start),
123+ __remove_pages(PHYS_PFN(res->start),
124124 PHYS_PFN(resource_size(res)), NULL);
125125 } else {
126126 arch_remove_memory(nid, res->start, resource_size(res),
mm/migrate.c+17−6
@@ -1512,9 +1512,11 @@ static int do_move_pages_to_node(struct mm_struct *mm, · 1511 unmodified lines
15121512 /*
15131513 * Resolves the given address to a struct page, isolates it from the LRU and
15141514 * puts it to the given pagelist.
1515− * Returns -errno if the page cannot be found/isolated or 0 when it has been
1516− * queued or the page doesn't need to be migrated because it is already on
1517− * the target node
1515+ * Returns:
1516+ * errno - if the page cannot be found/isolated
1517+ * 0 - when it doesn't have to be migrated because it is already on the
1518+ * target node
1519+ * 1 - when it has been queued
15181520 */
15191521 static int add_page_for_migration(struct mm_struct *mm, unsigned long addr,
15201522 int node, struct list_head *pagelist, bool migrate_all)
@@ -1553,7 +1555,7 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr, · 32 unmodified lines
15531555 if (PageHuge(page)) {
15541556 if (PageHead(page)) {
15551557 isolate_huge_page(page, pagelist);
1556− err = 0;
1558+ err = 1;
15571559 }
15581560 } else {
15591561 struct page *head;
@@ -1563,7 +1565,7 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr, · 3 unmodified lines
15631565 if (err)
15641566 goto out_putpage;
15651567
1566− err = 0;
1568+ err = 1;
15671569 list_add_tail(&head->lru, pagelist);
15681570 mod_node_page_state(page_pgdat(head),
15691571 NR_ISOLATED_ANON + page_is_file_cache(head),
@@ -1640,8 +1642,17 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, · 70 unmodified lines
16401642 */
16411643 err = add_page_for_migration(mm, addr, current_node,
16421644 &pagelist, flags & MPOL_MF_MOVE_ALL);
1643− if (!err)
1645+
1646+ if (!err) {
1647+ /* The page is already on the target node */
1648+ err = store_status(status, i, current_node, 1);
1649+ if (err)
1650+ goto out_flush;
16441651 continue;
1652+ } else if (err > 0) {
1653+ /* The page is successfully queued for migration */
1654+ continue;
1655+ }
16451656
16461657 err = store_status(status, i, err, 1);
16471658 if (err)
mm/mmap.c+0−6
@@ -90,12 +90,6 @@ static void unmap_region(struct mm_struct *mm, · 89 unmodified lines
9090 * MAP_PRIVATE r: (no) no r: (yes) yes r: (no) yes r: (no) yes
9191 * w: (no) no w: (no) no w: (copy) copy w: (no) no
9292 * x: (no) no x: (no) yes x: (no) yes x: (yes) yes
93− *
94− * On arm64, PROT_EXEC has the following behaviour for both MAP_SHARED and
95− * MAP_PRIVATE:
96− * r: (no) no
97− * w: (no) no
98− * x: (yes) yes
9993 */
10094 pgprot_t protection_map[16] __ro_after_init = {
10195 __P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111,
mm/oom_kill.c+1−1
@@ -890,7 +890,7 @@ static void __oom_kill_process(struct task_struct *victim, const char *message) · 889 unmodified lines
890890 K(get_mm_counter(mm, MM_FILEPAGES)),
891891 K(get_mm_counter(mm, MM_SHMEMPAGES)),
892892 from_kuid(&init_user_ns, task_uid(victim)),
893− mm_pgtables_bytes(mm), victim->signal->oom_score_adj);
893+ mm_pgtables_bytes(mm) >> 10, victim->signal->oom_score_adj);
894894 task_unlock(victim);
895895
896896 /*
mm/zsmalloc.c+5−0
@@ -2069,6 +2069,11 @@ static int zs_page_migrate(struct address_space *mapping, struct page *newpage, · 2068 unmodified lines
20692069 zs_pool_dec_isolated(pool);
20702070 }
20712071
2072+ if (page_zone(newpage) != page_zone(page)) {
2073+ dec_zone_page_state(page, NR_ZSPAGES);
2074+ inc_zone_page_state(newpage, NR_ZSPAGES);
2075+ }
2076+
20722077 reset_page(page);
20732078 put_page(page);
20742079 page = newpage;
net/8021q/vlan.h+1−0
@@ -126,6 +126,7 @@ int vlan_check_real_dev(struct net_device *real_dev, · 125 unmodified lines
126126 void vlan_setup(struct net_device *dev);
127127 int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack);
128128 void unregister_vlan_dev(struct net_device *dev, struct list_head *head);
129+void vlan_dev_uninit(struct net_device *dev);
129130 bool vlan_dev_inherit_address(struct net_device *dev,
130131 struct net_device *real_dev);
131132
net/8021q/vlan_dev.c+2−1
@@ -586,7 +586,8 @@ static int vlan_dev_init(struct net_device *dev) · 585 unmodified lines
586586 return 0;
587587 }
588588
589−static void vlan_dev_uninit(struct net_device *dev)
589+/* Note: this function might be called multiple times for the same device. */
590+void vlan_dev_uninit(struct net_device *dev)
590591 {
591592 struct vlan_priority_tci_mapping *pm;
592593 struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
net/8021q/vlan_netlink.c+12−7
@@ -108,11 +108,13 @@ static int vlan_changelink(struct net_device *dev, struct nlattr *tb[], · 107 unmodified lines
108108 struct ifla_vlan_flags *flags;
109109 struct ifla_vlan_qos_mapping *m;
110110 struct nlattr *attr;
111− int rem;
111+ int rem, err;
112112
113113 if (data[IFLA_VLAN_FLAGS]) {
114114 flags = nla_data(data[IFLA_VLAN_FLAGS]);
115− vlan_dev_change_flags(dev, flags->flags, flags->mask);
115+ err = vlan_dev_change_flags(dev, flags->flags, flags->mask);
116+ if (err)
117+ return err;
116118 }
117119 if (data[IFLA_VLAN_INGRESS_QOS]) {
118120 nla_for_each_nested(attr, data[IFLA_VLAN_INGRESS_QOS], rem) {
@@ -123,7 +125,9 @@ static int vlan_changelink(struct net_device *dev, struct nlattr *tb[], · 4 unmodified lines
123125 if (data[IFLA_VLAN_EGRESS_QOS]) {
124126 nla_for_each_nested(attr, data[IFLA_VLAN_EGRESS_QOS], rem) {
125127 m = nla_data(attr);
126− vlan_dev_set_egress_priority(dev, m->from, m->to);
128+ err = vlan_dev_set_egress_priority(dev, m->from, m->to);
129+ if (err)
130+ return err;
127131 }
128132 }
129133 return 0;
@@ -179,10 +183,11 @@ static int vlan_newlink(struct net *src_net, struct net_device *dev, · 49 unmodified lines
179183 return -EINVAL;
180184
181185 err = vlan_changelink(dev, tb, data, extack);
182− if (err < 0)
183− return err;
184−
185− return register_vlan_dev(dev, extack);
186+ if (!err)
187+ err = register_vlan_dev(dev, extack);
188+ if (err)
189+ vlan_dev_uninit(dev);
190+ return err;
186191 }
187192
188193 static inline size_t vlan_qos_map_size(unsigned int n)
net/bridge/br_nf_core.c+2−1
@@ -22,7 +22,8 @@ · 21 unmodified lines
2222 #endif
2323
2424 static void fake_update_pmtu(struct dst_entry *dst, struct sock *sk,
25− struct sk_buff *skb, u32 mtu)
25+ struct sk_buff *skb, u32 mtu,
26+ bool confirm_neigh)
2627 {
2728 }
2829
net/bridge/netfilter/ebtables.c+16−17
@@ -1867,7 +1867,7 @@ static int ebt_buf_count(struct ebt_entries_buf_state *state, unsigned int sz) · 1866 unmodified lines
18671867 }
18681868
18691869 static int ebt_buf_add(struct ebt_entries_buf_state *state,
1870− void *data, unsigned int sz)
1870+ const void *data, unsigned int sz)
18711871 {
18721872 if (state->buf_kern_start == NULL)
18731873 goto count_only;
@@ -1901,7 +1901,7 @@ enum compat_mwt { · 27 unmodified lines
19011901 EBT_COMPAT_TARGET,
19021902 };
19031903
1904−static int compat_mtw_from_user(struct compat_ebt_entry_mwt *mwt,
1904+static int compat_mtw_from_user(const struct compat_ebt_entry_mwt *mwt,
19051905 enum compat_mwt compat_mwt,
19061906 struct ebt_entries_buf_state *state,
19071907 const unsigned char *base)
@@ -1979,22 +1979,23 @@ static int compat_mtw_from_user(struct compat_ebt_entry_mwt *mwt, · 71 unmodified lines
19791979 /* return size of all matches, watchers or target, including necessary
19801980 * alignment and padding.
19811981 */
1982−static int ebt_size_mwt(struct compat_ebt_entry_mwt *match32,
1982+static int ebt_size_mwt(const struct compat_ebt_entry_mwt *match32,
19831983 unsigned int size_left, enum compat_mwt type,
19841984 struct ebt_entries_buf_state *state, const void *base)
19851985 {
1986+ const char *buf = (const char *)match32;
19861987 int growth = 0;
1987− char *buf;
19881988
19891989 if (size_left == 0)
19901990 return 0;
19911991
1992− buf = (char *) match32;
1993−
1994− while (size_left >= sizeof(*match32)) {
1992+ do {
19951993 struct ebt_entry_match *match_kern;
19961994 int ret;
19971995
1996+ if (size_left < sizeof(*match32))
1997+ return -EINVAL;
1998+
19981999 match_kern = (struct ebt_entry_match *) state->buf_kern_start;
19992000 if (match_kern) {
20002001 char *tmp;
@@ -2031,22 +2032,18 @@ static int ebt_size_mwt(struct compat_ebt_entry_mwt *match32, · 30 unmodified lines
20312032 if (match_kern)
20322033 match_kern->match_size = ret;
20332034
2034− /* rule should have no remaining data after target */
2035− if (type == EBT_COMPAT_TARGET && size_left)
2036− return -EINVAL;
2037−
20382035 match32 = (struct compat_ebt_entry_mwt *) buf;
2039− }
2036+ } while (size_left);
20402037
20412038 return growth;
20422039 }
20432040
20442041 /* called for all ebt_entry structures. */
2045−static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base,
2042+static int size_entry_mwt(const struct ebt_entry *entry, const unsigned char *base,
20462043 unsigned int *total,
20472044 struct ebt_entries_buf_state *state)
20482045 {
2049− unsigned int i, j, startoff, new_offset = 0;
2046+ unsigned int i, j, startoff, next_expected_off, new_offset = 0;
20502047 /* stores match/watchers/targets & offset of next struct ebt_entry: */
20512048 unsigned int offsets[4];
20522049 unsigned int *offsets_update = NULL;
@@ -2132,11 +2129,13 @@ static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base, · 79 unmodified lines
21322129 return ret;
21332130 }
21342131
2135− startoff = state->buf_user_offset - startoff;
2132+ next_expected_off = state->buf_user_offset - startoff;
2133+ if (next_expected_off != entry->next_offset)
2134+ return -EINVAL;
21362135
2137− if (WARN_ON(*total < startoff))
2136+ if (*total < entry->next_offset)
21382137 return -EINVAL;
2139− *total -= startoff;
2138+ *total -= entry->next_offset;
21402139 return 0;
21412140 }
21422141
net/decnet/dn_route.c+4−2
@@ -110,7 +110,8 @@ static void dn_dst_ifdown(struct dst_entry *, struct net_device *dev, int how); · 109 unmodified lines
110110 static struct dst_entry *dn_dst_negative_advice(struct dst_entry *);
111111 static void dn_dst_link_failure(struct sk_buff *);
112112 static void dn_dst_update_pmtu(struct dst_entry *dst, struct sock *sk,
113− struct sk_buff *skb , u32 mtu);
113+ struct sk_buff *skb , u32 mtu,
114+ bool confirm_neigh);
114115 static void dn_dst_redirect(struct dst_entry *dst, struct sock *sk,
115116 struct sk_buff *skb);
116117 static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst,
@@ -251,7 +252,8 @@ static int dn_dst_gc(struct dst_ops *ops) · 134 unmodified lines
251252 * advertise to the other end).
252253 */
253254 static void dn_dst_update_pmtu(struct dst_entry *dst, struct sock *sk,
254− struct sk_buff *skb, u32 mtu)
255+ struct sk_buff *skb, u32 mtu,
256+ bool confirm_neigh)
255257 {
256258 struct dn_route *rt = (struct dn_route *) dst;
257259 struct neighbour *n = rt->n;
net/hsr/hsr_debugfs.c+40−12
@@ -20,6 +20,8 @@ · 19 unmodified lines
2020 #include "hsr_main.h"
2121 #include "hsr_framereg.h"
2222
23+static struct dentry *hsr_debugfs_root_dir;
24+
2325 static void print_mac_address(struct seq_file *sfp, unsigned char *mac)
2426 {
2527 seq_printf(sfp, "%02x:%02x:%02x:%02x:%02x:%02x:",
@@ -63,8 +65,20 @@ hsr_node_table_open(struct inode *inode, struct file *filp) · 37 unmodified lines
6365 return single_open(filp, hsr_node_table_show, inode->i_private);
6466 }
6567
68+void hsr_debugfs_rename(struct net_device *dev)
69+{
70+ struct hsr_priv *priv = netdev_priv(dev);
71+ struct dentry *d;
72+
73+ d = debugfs_rename(hsr_debugfs_root_dir, priv->node_tbl_root,
74+ hsr_debugfs_root_dir, dev->name);
75+ if (IS_ERR(d))
76+ netdev_warn(dev, "failed to rename\n");
77+ else
78+ priv->node_tbl_root = d;
79+}
80+
6681 static const struct file_operations hsr_fops = {
67− .owner = THIS_MODULE,
6882 .open = hsr_node_table_open,
6983 .read = seq_read,
7084 .llseek = seq_lseek,
@@ -78,15 +92,14 @@ static const struct file_operations hsr_fops = { · 7 unmodified lines
7892 * When debugfs is configured this routine sets up the node_table file per
7993 * hsr device for dumping the node_table entries
8094 */
81−int hsr_debugfs_init(struct hsr_priv *priv, struct net_device *hsr_dev)
95+void hsr_debugfs_init(struct hsr_priv *priv, struct net_device *hsr_dev)
8296 {
83− int rc = -1;
8497 struct dentry *de = NULL;
8598
86− de = debugfs_create_dir(hsr_dev->name, NULL);
87− if (!de) {
88− pr_err("Cannot create hsr debugfs root\n");
89− return rc;
99+ de = debugfs_create_dir(hsr_dev->name, hsr_debugfs_root_dir);
100+ if (IS_ERR(de)) {
101+ pr_err("Cannot create hsr debugfs directory\n");
102+ return;
90103 }
91104
92105 priv->node_tbl_root = de;
@@ -94,13 +107,13 @@ int hsr_debugfs_init(struct hsr_priv *priv, struct net_device *hsr_dev) · 1 unmodified line
94107 de = debugfs_create_file("node_table", S_IFREG | 0444,
95108 priv->node_tbl_root, priv,
96109 &hsr_fops);
97− if (!de) {
98− pr_err("Cannot create hsr node_table directory\n");
99− return rc;
110+ if (IS_ERR(de)) {
111+ pr_err("Cannot create hsr node_table file\n");
112+ debugfs_remove(priv->node_tbl_root);
113+ priv->node_tbl_root = NULL;
114+ return;
100115 }
101116 priv->node_tbl_file = de;
102−
103− return 0;
104117 }
105118
106119 /* hsr_debugfs_term - Tear down debugfs intrastructure
@@ -117,3 +130,18 @@ hsr_debugfs_term(struct hsr_priv *priv) · 10 unmodified lines
117130 debugfs_remove(priv->node_tbl_root);
118131 priv->node_tbl_root = NULL;
119132 }
133+
134+void hsr_debugfs_create_root(void)
135+{
136+ hsr_debugfs_root_dir = debugfs_create_dir("hsr", NULL);
137+ if (IS_ERR(hsr_debugfs_root_dir)) {
138+ pr_err("Cannot create hsr debugfs root directory\n");
139+ hsr_debugfs_root_dir = NULL;
140+ }
141+}
142+
143+void hsr_debugfs_remove_root(void)
144+{
145+ /* debugfs_remove() internally checks NULL and ERROR */
146+ debugfs_remove(hsr_debugfs_root_dir);
147+}
net/hsr/hsr_device.c+16−12
@@ -272,6 +272,8 @@ static void send_hsr_supervision_frame(struct hsr_port *master, · 271 unmodified lines
272272 skb->dev->dev_addr, skb->len) <= 0)
273273 goto out;
274274 skb_reset_mac_header(skb);
275+ skb_reset_network_header(skb);
276+ skb_reset_transport_header(skb);
275277
276278 if (hsr_ver > 0) {
277279 hsr_tag = skb_put(skb, sizeof(struct hsr_tag));
@@ -368,7 +370,7 @@ static void hsr_dev_destroy(struct net_device *hsr_dev) · 90 unmodified lines
368370 del_timer_sync(&hsr->prune_timer);
369371 del_timer_sync(&hsr->announce_timer);
370372
371− hsr_del_self_node(&hsr->self_node_db);
373+ hsr_del_self_node(hsr);
372374 hsr_del_nodes(&hsr->node_db);
373375 }
374376
@@ -440,11 +442,12 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2], · 65 unmodified lines
440442 INIT_LIST_HEAD(&hsr->ports);
441443 INIT_LIST_HEAD(&hsr->node_db);
442444 INIT_LIST_HEAD(&hsr->self_node_db);
445+ spin_lock_init(&hsr->list_lock);
443446
444447 ether_addr_copy(hsr_dev->dev_addr, slave[0]->dev_addr);
445448
446449 /* Make sure we recognize frames from ourselves in hsr_rcv() */
447− res = hsr_create_self_node(&hsr->self_node_db, hsr_dev->dev_addr,
450+ res = hsr_create_self_node(hsr, hsr_dev->dev_addr,
448451 slave[1]->dev_addr);
449452 if (res < 0)
450453 return res;
@@ -477,31 +480,32 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2], · 26 unmodified lines
477480
478481 res = hsr_add_port(hsr, hsr_dev, HSR_PT_MASTER);
479482 if (res)
480− goto err_add_port;
483+ goto err_add_master;
481484
482485 res = register_netdevice(hsr_dev);
483486 if (res)
484− goto fail;
487+ goto err_unregister;
485488
486489 res = hsr_add_port(hsr, slave[0], HSR_PT_SLAVE_A);
487490 if (res)
488− goto fail;
491+ goto err_add_slaves;
492+
489493 res = hsr_add_port(hsr, slave[1], HSR_PT_SLAVE_B);
490494 if (res)
491− goto fail;
495+ goto err_add_slaves;
492496
497+ hsr_debugfs_init(hsr, hsr_dev);
493498 mod_timer(&hsr->prune_timer, jiffies + msecs_to_jiffies(PRUNE_PERIOD));
494− res = hsr_debugfs_init(hsr, hsr_dev);
495− if (res)
496− goto fail;
497499
498500 return 0;
499501
500−fail:
502+err_add_slaves:
503+ unregister_netdevice(hsr_dev);
504+err_unregister:
501505 list_for_each_entry_safe(port, tmp, &hsr->ports, port_list)
502506 hsr_del_port(port);
503−err_add_port:
504− hsr_del_self_node(&hsr->self_node_db);
507+err_add_master:
508+ hsr_del_self_node(hsr);
505509
506510 return res;
507511 }
net/hsr/hsr_framereg.c+46−27
@@ -75,10 +75,11 @@ static struct hsr_node *find_node_by_addr_A(struct list_head *node_db, · 74 unmodified lines
7575 /* Helper for device init; the self_node_db is used in hsr_rcv() to recognize
7676 * frames from self that's been looped over the HSR ring.
7777 */
78−int hsr_create_self_node(struct list_head *self_node_db,
78+int hsr_create_self_node(struct hsr_priv *hsr,
7979 unsigned char addr_a[ETH_ALEN],
8080 unsigned char addr_b[ETH_ALEN])
8181 {
82+ struct list_head *self_node_db = &hsr->self_node_db;
8283 struct hsr_node *node, *oldnode;
8384
8485 node = kmalloc(sizeof(*node), GFP_KERNEL);
@@ -88,33 +89,33 @@ int hsr_create_self_node(struct list_head *self_node_db, · 3 unmodified lines
8889 ether_addr_copy(node->macaddress_A, addr_a);
8990 ether_addr_copy(node->macaddress_B, addr_b);
9091
91− rcu_read_lock();
92+ spin_lock_bh(&hsr->list_lock);
9293 oldnode = list_first_or_null_rcu(self_node_db,
9394 struct hsr_node, mac_list);
9495 if (oldnode) {
9596 list_replace_rcu(&oldnode->mac_list, &node->mac_list);
96− rcu_read_unlock();
97− synchronize_rcu();
98− kfree(oldnode);
97+ spin_unlock_bh(&hsr->list_lock);
98+ kfree_rcu(oldnode, rcu_head);
9999 } else {
100− rcu_read_unlock();
101100 list_add_tail_rcu(&node->mac_list, self_node_db);
101+ spin_unlock_bh(&hsr->list_lock);
102102 }
103103
104104 return 0;
105105 }
106106
107−void hsr_del_self_node(struct list_head *self_node_db)
107+void hsr_del_self_node(struct hsr_priv *hsr)
108108 {
109+ struct list_head *self_node_db = &hsr->self_node_db;
109110 struct hsr_node *node;
110111
111− rcu_read_lock();
112+ spin_lock_bh(&hsr->list_lock);
112113 node = list_first_or_null_rcu(self_node_db, struct hsr_node, mac_list);
113− rcu_read_unlock();
114114 if (node) {
115115 list_del_rcu(&node->mac_list);
116− kfree(node);
116+ kfree_rcu(node, rcu_head);
117117 }
118+ spin_unlock_bh(&hsr->list_lock);
118119 }
119120
120121 void hsr_del_nodes(struct list_head *node_db)
@@ -130,30 +131,43 @@ void hsr_del_nodes(struct list_head *node_db) · 9 unmodified lines
130131 * seq_out is used to initialize filtering of outgoing duplicate frames
131132 * originating from the newly added node.
132133 */
133−struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[],
134− u16 seq_out)
134+static struct hsr_node *hsr_add_node(struct hsr_priv *hsr,
135+ struct list_head *node_db,
136+ unsigned char addr[],
137+ u16 seq_out)
135138 {
136− struct hsr_node *node;
139+ struct hsr_node *new_node, *node;
137140 unsigned long now;
138141 int i;
139142
140− node = kzalloc(sizeof(*node), GFP_ATOMIC);
141− if (!node)
143+ new_node = kzalloc(sizeof(*new_node), GFP_ATOMIC);
144+ if (!new_node)
142145 return NULL;
143146
144− ether_addr_copy(node->macaddress_A, addr);
147+ ether_addr_copy(new_node->macaddress_A, addr);
145148
146149 /* We are only interested in time diffs here, so use current jiffies
147150 * as initialization. (0 could trigger an spurious ring error warning).
148151 */
149152 now = jiffies;
150153 for (i = 0; i < HSR_PT_PORTS; i++)
151− node->time_in[i] = now;
154+ new_node->time_in[i] = now;
152155 for (i = 0; i < HSR_PT_PORTS; i++)
153− node->seq_out[i] = seq_out;
154−
155− list_add_tail_rcu(&node->mac_list, node_db);
156+ new_node->seq_out[i] = seq_out;
156157
158+ spin_lock_bh(&hsr->list_lock);
159+ list_for_each_entry_rcu(node, node_db, mac_list) {
160+ if (ether_addr_equal(node->macaddress_A, addr))
161+ goto out;
162+ if (ether_addr_equal(node->macaddress_B, addr))
163+ goto out;
164+ }
165+ list_add_tail_rcu(&new_node->mac_list, node_db);
166+ spin_unlock_bh(&hsr->list_lock);
167+ return new_node;
168+out:
169+ spin_unlock_bh(&hsr->list_lock);
170+ kfree(new_node);
157171 return node;
158172 }
159173
@@ -163,6 +177,7 @@ struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb, · 3 unmodified lines
163177 bool is_sup)
164178 {
165179 struct list_head *node_db = &port->hsr->node_db;
180+ struct hsr_priv *hsr = port->hsr;
166181 struct hsr_node *node;
167182 struct ethhdr *ethhdr;
168183 u16 seq_out;
@@ -196,7 +211,7 @@ struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb, · 27 unmodified lines
196211 seq_out = HSR_SEQNR_START;
197212 }
198213
199− return hsr_add_node(node_db, ethhdr->h_source, seq_out);
214+ return hsr_add_node(hsr, node_db, ethhdr->h_source, seq_out);
200215 }
201216
202217 /* Use the Supervision frame's info about an eventual macaddress_B for merging
@@ -206,10 +221,11 @@ struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb, · 3 unmodified lines
206221 void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr,
207222 struct hsr_port *port_rcv)
208223 {
209− struct ethhdr *ethhdr;
210− struct hsr_node *node_real;
224+ struct hsr_priv *hsr = port_rcv->hsr;
211225 struct hsr_sup_payload *hsr_sp;
226+ struct hsr_node *node_real;
212227 struct list_head *node_db;
228+ struct ethhdr *ethhdr;
213229 int i;
214230
215231 ethhdr = (struct ethhdr *)skb_mac_header(skb);
@@ -231,7 +247,7 @@ void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr, · 15 unmodified lines
231247 node_real = find_node_by_addr_A(node_db, hsr_sp->macaddress_A);
232248 if (!node_real)
233249 /* No frame received from AddrA of this node yet */
234− node_real = hsr_add_node(node_db, hsr_sp->macaddress_A,
250+ node_real = hsr_add_node(hsr, node_db, hsr_sp->macaddress_A,
235251 HSR_SEQNR_START - 1);
236252 if (!node_real)
237253 goto done; /* No mem */
@@ -252,7 +268,9 @@ void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr, · 14 unmodified lines
252268 }
253269 node_real->addr_B_port = port_rcv->type;
254270
271+ spin_lock_bh(&hsr->list_lock);
255272 list_del_rcu(&node_curr->mac_list);
273+ spin_unlock_bh(&hsr->list_lock);
256274 kfree_rcu(node_curr, rcu_head);
257275
258276 done:
@@ -368,12 +386,13 @@ void hsr_prune_nodes(struct timer_list *t) · 109 unmodified lines
368386 {
369387 struct hsr_priv *hsr = from_timer(hsr, t, prune_timer);
370388 struct hsr_node *node;
389+ struct hsr_node *tmp;
371390 struct hsr_port *port;
372391 unsigned long timestamp;
373392 unsigned long time_a, time_b;
374393
375− rcu_read_lock();
376− list_for_each_entry_rcu(node, &hsr->node_db, mac_list) {
394+ spin_lock_bh(&hsr->list_lock);
395+ list_for_each_entry_safe(node, tmp, &hsr->node_db, mac_list) {
377396 /* Don't prune own node. Neither time_in[HSR_PT_SLAVE_A]
378397 * nor time_in[HSR_PT_SLAVE_B], will ever be updated for
379398 * the master port. Thus the master node will be repeatedly
@@ -421,7 +440,7 @@ void hsr_prune_nodes(struct timer_list *t) · 41 unmodified lines
421440 kfree_rcu(node, rcu_head);
422441 }
423442 }
424− rcu_read_unlock();
443+ spin_unlock_bh(&hsr->list_lock);
425444
426445 /* Restart timer */
427446 mod_timer(&hsr->prune_timer,
net/hsr/hsr_framereg.h+2−4
@@ -12,10 +12,8 @@ · 11 unmodified lines
1212
1313 struct hsr_node;
1414
15−void hsr_del_self_node(struct list_head *self_node_db);
15+void hsr_del_self_node(struct hsr_priv *hsr);
1616 void hsr_del_nodes(struct list_head *node_db);
17−struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[],
18− u16 seq_out);
1917 struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb,
2018 bool is_sup);
2119 void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr,
@@ -33,7 +31,7 @@ int hsr_register_frame_out(struct hsr_port *port, struct hsr_node *node, · 11 unmodified lines
3331
3432 void hsr_prune_nodes(struct timer_list *t);
3533
36−int hsr_create_self_node(struct list_head *self_node_db,
34+int hsr_create_self_node(struct hsr_priv *hsr,
3735 unsigned char addr_a[ETH_ALEN],
3836 unsigned char addr_b[ETH_ALEN]);
3937
net/hsr/hsr_main.c+6−1
@@ -45,6 +45,10 @@ static int hsr_netdev_notify(struct notifier_block *nb, unsigned long event, · 44 unmodified lines
4545 case NETDEV_CHANGE: /* Link (carrier) state changes */
4646 hsr_check_carrier_and_operstate(hsr);
4747 break;
48+ case NETDEV_CHANGENAME:
49+ if (is_hsr_master(dev))
50+ hsr_debugfs_rename(dev);
51+ break;
4852 case NETDEV_CHANGEADDR:
4953 if (port->type == HSR_PT_MASTER) {
5054 /* This should not happen since there's no
@@ -64,7 +68,7 @@ static int hsr_netdev_notify(struct notifier_block *nb, unsigned long event, · 13 unmodified lines
6468
6569 /* Make sure we recognize frames from ourselves in hsr_rcv() */
6670 port = hsr_port_get_hsr(hsr, HSR_PT_SLAVE_B);
67− res = hsr_create_self_node(&hsr->self_node_db,
71+ res = hsr_create_self_node(hsr,
6872 master->dev->dev_addr,
6973 port ?
7074 port->dev->dev_addr :
@@ -123,6 +127,7 @@ static void __exit hsr_exit(void) · 52 unmodified lines
123127 {
124128 unregister_netdevice_notifier(&hsr_nb);
125129 hsr_netlink_exit();
130+ hsr_debugfs_remove_root();
126131 }
127132
128133 module_init(hsr_init);
net/hsr/hsr_main.h+15−7
@@ -160,8 +160,9 @@ struct hsr_priv { · 159 unmodified lines
160160 int announce_count;
161161 u16 sequence_nr;
162162 u16 sup_sequence_nr; /* For HSRv1 separate seq_nr for supervision */
163− u8 prot_version; /* Indicate if HSRv0 or HSRv1. */
164− spinlock_t seqnr_lock; /* locking for sequence_nr */
163+ u8 prot_version; /* Indicate if HSRv0 or HSRv1. */
164+ spinlock_t seqnr_lock; /* locking for sequence_nr */
165+ spinlock_t list_lock; /* locking for node list */
165166 unsigned char sup_multicast_addr[ETH_ALEN];
166167 #ifdef CONFIG_DEBUG_FS
167168 struct dentry *node_tbl_root;
@@ -184,17 +185,24 @@ static inline u16 hsr_get_skb_sequence_nr(struct sk_buff *skb) · 16 unmodified lines
184185 }
185186
186187 #if IS_ENABLED(CONFIG_DEBUG_FS)
187−int hsr_debugfs_init(struct hsr_priv *priv, struct net_device *hsr_dev);
188+void hsr_debugfs_rename(struct net_device *dev);
189+void hsr_debugfs_init(struct hsr_priv *priv, struct net_device *hsr_dev);
188190 void hsr_debugfs_term(struct hsr_priv *priv);
191+void hsr_debugfs_create_root(void);
192+void hsr_debugfs_remove_root(void);
189193 #else
190−static inline int hsr_debugfs_init(struct hsr_priv *priv,
191− struct net_device *hsr_dev)
194+static inline void void hsr_debugfs_rename(struct net_device *dev)
192195 {
193− return 0;
194196 }
195−
197+static inline void hsr_debugfs_init(struct hsr_priv *priv,
198+ struct net_device *hsr_dev)
199+{}
196200 static inline void hsr_debugfs_term(struct hsr_priv *priv)
197201 {}
202+static inline void hsr_debugfs_create_root(void)
203+{}
204+static inline void hsr_debugfs_remove_root(void)
205+{}
198206 #endif
199207
200208 #endif /* __HSR_PRIVATE_H */
net/hsr/hsr_netlink.c+1−0
@@ -476,6 +476,7 @@ int __init hsr_netlink_init(void) · 475 unmodified lines
476476 if (rc)
477477 goto fail_genl_register_family;
478478
479+ hsr_debugfs_create_root();
479480 return 0;
480481
481482 fail_genl_register_family:
net/ipv4/inet_connection_sock.c+1−1
@@ -1086,7 +1086,7 @@ struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu) · 1085 unmodified lines
10861086 if (!dst)
10871087 goto out;
10881088 }
1089− dst->ops->update_pmtu(dst, sk, NULL, mtu);
1089+ dst->ops->update_pmtu(dst, sk, NULL, mtu, true);
10901090
10911091 dst = __sk_dst_check(sk, 0);
10921092 if (!dst)
net/ipv4/ip_tunnel.c+1−1
@@ -505,7 +505,7 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb, · 504 unmodified lines
505505 mtu = skb_valid_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu;
506506
507507 if (skb_valid_dst(skb))
508− skb_dst_update_pmtu(skb, mtu);
508+ skb_dst_update_pmtu_no_confirm(skb, mtu);
509509
510510 if (skb->protocol == htons(ETH_P_IP)) {
511511 if (!skb_is_gso(skb) &&
net/ipv4/ip_vti.c+1−1
@@ -214,7 +214,7 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev, · 213 unmodified lines
214214
215215 mtu = dst_mtu(dst);
216216 if (skb->len > mtu) {
217− skb_dst_update_pmtu(skb, mtu);
217+ skb_dst_update_pmtu_no_confirm(skb, mtu);
218218 if (skb->protocol == htons(ETH_P_IP)) {
219219 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
220220 htonl(mtu));
net/ipv4/netfilter/arp_tables.c+16−11
@@ -384,10 +384,11 @@ next: ; · 383 unmodified lines
384384 return 1;
385385 }
386386
387−static inline int check_target(struct arpt_entry *e, const char *name)
387+static int check_target(struct arpt_entry *e, struct net *net, const char *name)
388388 {
389389 struct xt_entry_target *t = arpt_get_target(e);
390390 struct xt_tgchk_param par = {
391+ .net = net,
391392 .table = name,
392393 .entryinfo = e,
393394 .target = t->u.kernel.target,
@@ -399,8 +400,9 @@ static inline int check_target(struct arpt_entry *e, const char *name) · 5 unmodified lines
399400 return xt_check_target(&par, t->u.target_size - sizeof(*t), 0, false);
400401 }
401402
402−static inline int
403−find_check_entry(struct arpt_entry *e, const char *name, unsigned int size,
403+static int
404+find_check_entry(struct arpt_entry *e, struct net *net, const char *name,
405+ unsigned int size,
404406 struct xt_percpu_counter_alloc_state *alloc_state)
405407 {
406408 struct xt_entry_target *t;
@@ -419,7 +421,7 @@ find_check_entry(struct arpt_entry *e, const char *name, unsigned int size, · 12 unmodified lines
419421 }
420422 t->u.kernel.target = target;
421423
422− ret = check_target(e, name);
424+ ret = check_target(e, net, name);
423425 if (ret)
424426 goto err;
425427 return 0;
@@ -512,7 +514,9 @@ static inline void cleanup_entry(struct arpt_entry *e) · 86 unmodified lines
512514 /* Checks and translates the user-supplied table segment (held in
513515 * newinfo).
514516 */
515−static int translate_table(struct xt_table_info *newinfo, void *entry0,
517+static int translate_table(struct net *net,
518+ struct xt_table_info *newinfo,
519+ void *entry0,
516520 const struct arpt_replace *repl)
517521 {
518522 struct xt_percpu_counter_alloc_state alloc_state = { 0 };
@@ -569,7 +573,7 @@ static int translate_table(struct xt_table_info *newinfo, void *entry0, · 50 unmodified lines
569573 /* Finally, each sanity check must pass */
570574 i = 0;
571575 xt_entry_foreach(iter, entry0, newinfo->size) {
572− ret = find_check_entry(iter, repl->name, repl->size,
576+ ret = find_check_entry(iter, net, repl->name, repl->size,
573577 &alloc_state);
574578 if (ret != 0)
575579 break;
@@ -974,7 +978,7 @@ static int do_replace(struct net *net, const void __user *user, · 398 unmodified lines
974978 goto free_newinfo;
975979 }
976980
977− ret = translate_table(newinfo, loc_cpu_entry, &tmp);
981+ ret = translate_table(net, newinfo, loc_cpu_entry, &tmp);
978982 if (ret != 0)
979983 goto free_newinfo;
980984
@@ -1149,7 +1153,8 @@ compat_copy_entry_from_user(struct compat_arpt_entry *e, void **dstptr, · 168 unmodified lines
11491153 }
11501154 }
11511155
1152−static int translate_compat_table(struct xt_table_info **pinfo,
1156+static int translate_compat_table(struct net *net,
1157+ struct xt_table_info **pinfo,
11531158 void **pentry0,
11541159 const struct compat_arpt_replace *compatr)
11551160 {
@@ -1217,7 +1222,7 @@ static int translate_compat_table(struct xt_table_info **pinfo, · 61 unmodified lines
12171222 repl.num_counters = 0;
12181223 repl.counters = NULL;
12191224 repl.size = newinfo->size;
1220− ret = translate_table(newinfo, entry1, &repl);
1225+ ret = translate_table(net, newinfo, entry1, &repl);
12211226 if (ret)
12221227 goto free_newinfo;
12231228
@@ -1270,7 +1275,7 @@ static int compat_do_replace(struct net *net, void __user *user, · 46 unmodified lines
12701275 goto free_newinfo;
12711276 }
12721277
1273− ret = translate_compat_table(&newinfo, &loc_cpu_entry, &tmp);
1278+ ret = translate_compat_table(net, &newinfo, &loc_cpu_entry, &tmp);
12741279 if (ret != 0)
12751280 goto free_newinfo;
12761281
@@ -1546,7 +1551,7 @@ int arpt_register_table(struct net *net, · 269 unmodified lines
15461551 loc_cpu_entry = newinfo->entries;
15471552 memcpy(loc_cpu_entry, repl->entries, repl->size);
15481553
1549− ret = translate_table(newinfo, loc_cpu_entry, repl);
1554+ ret = translate_table(net, newinfo, loc_cpu_entry, repl);
15501555 if (ret != 0)
15511556 goto out_free;
15521557
net/ipv4/route.c+6−3
@@ -139,7 +139,8 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst); · 138 unmodified lines
139139 static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst);
140140 static void ipv4_link_failure(struct sk_buff *skb);
141141 static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
142− struct sk_buff *skb, u32 mtu);
142+ struct sk_buff *skb, u32 mtu,
143+ bool confirm_neigh);
143144 static void ip_do_redirect(struct dst_entry *dst, struct sock *sk,
144145 struct sk_buff *skb);
145146 static void ipv4_dst_destroy(struct dst_entry *dst);
@@ -1043,7 +1044,8 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) · 897 unmodified lines
10431044 }
10441045
10451046 static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
1046− struct sk_buff *skb, u32 mtu)
1047+ struct sk_buff *skb, u32 mtu,
1048+ bool confirm_neigh)
10471049 {
10481050 struct rtable *rt = (struct rtable *) dst;
10491051 struct flowi4 fl4;
@@ -2687,7 +2689,8 @@ static unsigned int ipv4_blackhole_mtu(const struct dst_entry *dst) · 1637 unmodified lines
26872689 }
26882690
26892691 static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, struct sock *sk,
2690− struct sk_buff *skb, u32 mtu)
2692+ struct sk_buff *skb, u32 mtu,
2693+ bool confirm_neigh)
26912694 {
26922695 }
26932696
net/ipv4/tcp_input.c+4−1
@@ -1727,8 +1727,11 @@ tcp_sacktag_write_queue(struct sock *sk, const struct sk_buff *ack_skb, · 1726 unmodified lines
17271727 }
17281728
17291729 /* Ignore very old stuff early */
1730− if (!after(sp[used_sacks].end_seq, prior_snd_una))
1730+ if (!after(sp[used_sacks].end_seq, prior_snd_una)) {
1731+ if (i == 0)
1732+ first_sack_index = -1;
17311733 continue;
1734+ }
17321735
17331736 used_sacks++;
17341737 }
net/ipv4/tcp_output.c+3−0
@@ -72,6 +72,9 @@ static void tcp_event_new_data_sent(struct sock *sk, struct sk_buff *skb) · 71 unmodified lines
7272 __skb_unlink(skb, &sk->sk_write_queue);
7373 tcp_rbtree_insert(&sk->tcp_rtx_queue, skb);
7474
75+ if (tp->highest_sack == NULL)
76+ tp->highest_sack = skb;
77+
7578 tp->packets_out += tcp_skb_pcount(skb);
7679 if (!prior_packets || icsk->icsk_pending == ICSK_TIME_LOSS_PROBE)
7780 tcp_rearm_rto(sk);
net/ipv4/udp.c+1−1
@@ -1475,7 +1475,7 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb) · 1474 unmodified lines
14751475 * queue contains some other skb
14761476 */
14771477 rmem = atomic_add_return(size, &sk->sk_rmem_alloc);
1478− if (rmem > (size + sk->sk_rcvbuf))
1478+ if (rmem > (size + (unsigned int)sk->sk_rcvbuf))
14791479 goto uncharge_drop;
14801480
14811481 spin_lock(&list->lock);
net/ipv4/xfrm4_policy.c+3−2
@@ -100,12 +100,13 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, · 99 unmodified lines
100100 }
101101
102102 static void xfrm4_update_pmtu(struct dst_entry *dst, struct sock *sk,
103− struct sk_buff *skb, u32 mtu)
103+ struct sk_buff *skb, u32 mtu,
104+ bool confirm_neigh)
104105 {
105106 struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
106107 struct dst_entry *path = xdst->route;
107108
108− path->ops->update_pmtu(path, sk, skb, mtu);
109+ path->ops->update_pmtu(path, sk, skb, mtu, confirm_neigh);
109110 }
110111
111112 static void xfrm4_redirect(struct dst_entry *dst, struct sock *sk,
net/ipv6/inet6_connection_sock.c+1−1
@@ -146,7 +146,7 @@ struct dst_entry *inet6_csk_update_pmtu(struct sock *sk, u32 mtu) · 145 unmodified lines
146146
147147 if (IS_ERR(dst))
148148 return NULL;
149− dst->ops->update_pmtu(dst, sk, NULL, mtu);
149+ dst->ops->update_pmtu(dst, sk, NULL, mtu, true);
150150
151151 dst = inet6_csk_route_socket(sk, &fl6);
152152 return IS_ERR(dst) ? NULL : dst;
net/ipv6/ip6_gre.c+1−1
@@ -1040,7 +1040,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, · 1039 unmodified lines
10401040
10411041 /* TooBig packet may have updated dst->dev's mtu */
10421042 if (!t->parms.collect_md && dst && dst_mtu(dst) > dst->dev->mtu)
1043− dst->ops->update_pmtu(dst, NULL, skb, dst->dev->mtu);
1043+ dst->ops->update_pmtu(dst, NULL, skb, dst->dev->mtu, false);
10441044
10451045 err = ip6_tnl_xmit(skb, dev, dsfield, &fl6, encap_limit, &mtu,
10461046 NEXTHDR_GRE);
net/ipv6/ip6_tunnel.c+2−2
@@ -640,7 +640,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, · 639 unmodified lines
640640 if (rel_info > dst_mtu(skb_dst(skb2)))
641641 goto out;
642642
643− skb_dst_update_pmtu(skb2, rel_info);
643+ skb_dst_update_pmtu_no_confirm(skb2, rel_info);
644644 }
645645
646646 icmp_send(skb2, rel_type, rel_code, htonl(rel_info));
@@ -1132,7 +1132,7 @@ route_lookup: · 485 unmodified lines
11321132 mtu = max(mtu, skb->protocol == htons(ETH_P_IPV6) ?
11331133 IPV6_MIN_MTU : IPV4_MIN_MTU);
11341134
1135− skb_dst_update_pmtu(skb, mtu);
1135+ skb_dst_update_pmtu_no_confirm(skb, mtu);
11361136 if (skb->len - t->tun_hlen - eth_hlen > mtu && !skb_is_gso(skb)) {
11371137 *pmtu = mtu;
11381138 err = -EMSGSIZE;
net/ipv6/ip6_vti.c+1−1
@@ -479,7 +479,7 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) · 478 unmodified lines
479479
480480 mtu = dst_mtu(dst);
481481 if (skb->len > mtu) {
482− skb_dst_update_pmtu(skb, mtu);
482+ skb_dst_update_pmtu_no_confirm(skb, mtu);
483483
484484 if (skb->protocol == htons(ETH_P_IPV6)) {
485485 if (mtu < IPV6_MIN_MTU)
net/ipv6/route.c+15−7
@@ -95,7 +95,8 @@ static int ip6_pkt_prohibit(struct sk_buff *skb); · 94 unmodified lines
9595 static int ip6_pkt_prohibit_out(struct net *net, struct sock *sk, struct sk_buff *skb);
9696 static void ip6_link_failure(struct sk_buff *skb);
9797 static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
98− struct sk_buff *skb, u32 mtu);
98+ struct sk_buff *skb, u32 mtu,
99+ bool confirm_neigh);
99100 static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk,
100101 struct sk_buff *skb);
101102 static int rt6_score_route(const struct fib6_nh *nh, u32 fib6_flags, int oif,
@@ -264,7 +265,8 @@ static unsigned int ip6_blackhole_mtu(const struct dst_entry *dst) · 162 unmodified lines
264265 }
265266
266267 static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, struct sock *sk,
267− struct sk_buff *skb, u32 mtu)
268+ struct sk_buff *skb, u32 mtu,
269+ bool confirm_neigh)
268270 {
269271 }
270272
@@ -2692,7 +2694,8 @@ static bool rt6_cache_allowed_for_pmtu(const struct rt6_info *rt) · 2421 unmodified lines
26922694 }
26932695
26942696 static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
2695− const struct ipv6hdr *iph, u32 mtu)
2697+ const struct ipv6hdr *iph, u32 mtu,
2698+ bool confirm_neigh)
26962699 {
26972700 const struct in6_addr *daddr, *saddr;
26982701 struct rt6_info *rt6 = (struct rt6_info *)dst;
@@ -2710,7 +2713,10 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk, · 11 unmodified lines
27102713 daddr = NULL;
27112714 saddr = NULL;
27122715 }
2713− dst_confirm_neigh(dst, daddr);
2716+
2717+ if (confirm_neigh)
2718+ dst_confirm_neigh(dst, daddr);
2719+
27142720 mtu = max_t(u32, mtu, IPV6_MIN_MTU);
27152721 if (mtu >= dst_mtu(dst))
27162722 return;
@@ -2764,9 +2770,11 @@ out_unlock: · 47 unmodified lines
27642770 }
27652771
27662772 static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
2767− struct sk_buff *skb, u32 mtu)
2773+ struct sk_buff *skb, u32 mtu,
2774+ bool confirm_neigh)
27682775 {
2769− __ip6_rt_update_pmtu(dst, sk, skb ? ipv6_hdr(skb) : NULL, mtu);
2776+ __ip6_rt_update_pmtu(dst, sk, skb ? ipv6_hdr(skb) : NULL, mtu,
2777+ confirm_neigh);
27702778 }
27712779
27722780 void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu,
@@ -2785,7 +2793,7 @@ void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, · 12 unmodified lines
27852793
27862794 dst = ip6_route_output(net, NULL, &fl6);
27872795 if (!dst->error)
2788− __ip6_rt_update_pmtu(dst, NULL, iph, ntohl(mtu));
2796+ __ip6_rt_update_pmtu(dst, NULL, iph, ntohl(mtu), true);
27892797 dst_release(dst);
27902798 }
27912799 EXPORT_SYMBOL_GPL(ip6_update_pmtu);
net/ipv6/sit.c+1−1
@@ -944,7 +944,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, · 943 unmodified lines
944944 }
945945
946946 if (tunnel->parms.iph.daddr)
947− skb_dst_update_pmtu(skb, mtu);
947+ skb_dst_update_pmtu_no_confirm(skb, mtu);
948948
949949 if (skb->len > mtu && !skb_is_gso(skb)) {
950950 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
net/ipv6/xfrm6_policy.c+3−2
@@ -98,12 +98,13 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, · 97 unmodified lines
9898 }
9999
100100 static void xfrm6_update_pmtu(struct dst_entry *dst, struct sock *sk,
101− struct sk_buff *skb, u32 mtu)
101+ struct sk_buff *skb, u32 mtu,
102+ bool confirm_neigh)
102103 {
103104 struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
104105 struct dst_entry *path = xdst->route;
105106
106− path->ops->update_pmtu(path, sk, skb, mtu);
107+ path->ops->update_pmtu(path, sk, skb, mtu, confirm_neigh);
107108 }
108109
109110 static void xfrm6_redirect(struct dst_entry *dst, struct sock *sk,
net/netfilter/ipset/ip_set_core.c+2−1
@@ -1848,6 +1848,7 @@ static int ip_set_utest(struct net *net, struct sock *ctnl, struct sk_buff *skb, · 1847 unmodified lines
18481848 struct ip_set *set;
18491849 struct nlattr *tb[IPSET_ATTR_ADT_MAX + 1] = {};
18501850 int ret = 0;
1851+ u32 lineno;
18511852
18521853 if (unlikely(protocol_min_failed(attr) ||
18531854 !attr[IPSET_ATTR_SETNAME] ||
@@ -1864,7 +1865,7 @@ static int ip_set_utest(struct net *net, struct sock *ctnl, struct sk_buff *skb, · 10 unmodified lines
18641865 return -IPSET_ERR_PROTOCOL;
18651866
18661867 rcu_read_lock_bh();
1867− ret = set->variant->uadt(set, tb, IPSET_TEST, NULL, 0, 0);
1868+ ret = set->variant->uadt(set, tb, IPSET_TEST, &lineno, 0, 0);
18681869 rcu_read_unlock_bh();
18691870 /* Userspace can't trigger element to be re-added */
18701871 if (ret == -EAGAIN)
net/netfilter/ipvs/ip_vs_xmit.c+1−1
@@ -208,7 +208,7 @@ static inline void maybe_update_pmtu(int skb_af, struct sk_buff *skb, int mtu) · 207 unmodified lines
208208 struct rtable *ort = skb_rtable(skb);
209209
210210 if (!skb->dev && sk && sk_fullsock(sk))
211− ort->dst.ops->update_pmtu(&ort->dst, sk, NULL, mtu);
211+ ort->dst.ops->update_pmtu(&ort->dst, sk, NULL, mtu, true);
212212 }
213213
214214 static inline bool ensure_mtu_is_adequate(struct netns_ipvs *ipvs, int skb_af,
net/netfilter/nf_conntrack_proto_dccp.c+3−0
@@ -677,6 +677,9 @@ static int dccp_timeout_nlattr_to_obj(struct nlattr *tb[], · 676 unmodified lines
677677 unsigned int *timeouts = data;
678678 int i;
679679
680+ if (!timeouts)
681+ timeouts = dn->dccp_timeout;
682+
680683 /* set default DCCP timeouts. */
681684 for (i=0; i<CT_DCCP_MAX; i++)
682685 timeouts[i] = dn->dccp_timeout[i];
net/netfilter/nf_conntrack_proto_sctp.c+3−0
@@ -594,6 +594,9 @@ static int sctp_timeout_nlattr_to_obj(struct nlattr *tb[], · 593 unmodified lines
594594 struct nf_sctp_net *sn = nf_sctp_pernet(net);
595595 int i;
596596
597+ if (!timeouts)
598+ timeouts = sn->timeouts;
599+
597600 /* set default SCTP timeouts. */
598601 for (i=0; i<SCTP_CONNTRACK_MAX; i++)
599602 timeouts[i] = sn->timeouts[i];
net/netfilter/nf_flow_table_core.c+1−6
@@ -134,11 +134,6 @@ static void flow_offload_fixup_tcp(struct ip_ct_tcp *tcp) · 133 unmodified lines
134134 #define NF_FLOWTABLE_TCP_PICKUP_TIMEOUT (120 * HZ)
135135 #define NF_FLOWTABLE_UDP_PICKUP_TIMEOUT (30 * HZ)
136136
137−static inline __s32 nf_flow_timeout_delta(unsigned int timeout)
138−{
139− return (__s32)(timeout - (u32)jiffies);
140−}
141−
142137 static void flow_offload_fixup_ct_timeout(struct nf_conn *ct)
143138 {
144139 const struct nf_conntrack_l4proto *l4proto;
@@ -232,7 +227,7 @@ int flow_offload_add(struct nf_flowtable *flow_table, struct flow_offload *flow) · 87 unmodified lines
232227 {
233228 int err;
234229
235− flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT;
230+ flow->timeout = nf_flowtable_time_stamp + NF_FLOW_TIMEOUT;
236231
237232 err = rhashtable_insert_fast(&flow_table->rhashtable,
238233 &flow->tuplehash[0].node,
net/netfilter/nf_flow_table_ip.c+2−2
@@ -280,7 +280,7 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb, · 279 unmodified lines
280280 if (nf_flow_nat_ip(flow, skb, thoff, dir) < 0)
281281 return NF_DROP;
282282
283− flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT;
283+ flow->timeout = nf_flowtable_time_stamp + NF_FLOW_TIMEOUT;
284284 iph = ip_hdr(skb);
285285 ip_decrease_ttl(iph);
286286 skb->tstamp = 0;
@@ -509,7 +509,7 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb, · 222 unmodified lines
509509 if (nf_flow_nat_ipv6(flow, skb, dir) < 0)
510510 return NF_DROP;
511511
512− flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT;
512+ flow->timeout = nf_flowtable_time_stamp + NF_FLOW_TIMEOUT;
513513 ip6h = ipv6_hdr(skb);
514514 ip6h->hop_limit--;
515515 skb->tstamp = 0;
net/netfilter/nf_flow_table_offload.c+37−15
@@ -88,7 +88,7 @@ static int nf_flow_rule_match(struct nf_flow_match *match, · 87 unmodified lines
8888 switch (tuple->l4proto) {
8989 case IPPROTO_TCP:
9090 key->tcp.flags = 0;
91− mask->tcp.flags = TCP_FLAG_RST | TCP_FLAG_FIN;
91+ mask->tcp.flags = cpu_to_be16(be32_to_cpu(TCP_FLAG_RST | TCP_FLAG_FIN) >> 16);
9292 match->dissector.used_keys |= BIT(FLOW_DISSECTOR_KEY_TCP);
9393 break;
9494 case IPPROTO_UDP:
@@ -166,24 +166,38 @@ static int flow_offload_eth_dst(struct net *net, · 71 unmodified lines
166166 enum flow_offload_tuple_dir dir,
167167 struct nf_flow_rule *flow_rule)
168168 {
169− const struct flow_offload_tuple *tuple = &flow->tuplehash[dir].tuple;
170169 struct flow_action_entry *entry0 = flow_action_entry_next(flow_rule);
171170 struct flow_action_entry *entry1 = flow_action_entry_next(flow_rule);
171+ const void *daddr = &flow->tuplehash[!dir].tuple.src_v4;
172+ const struct dst_entry *dst_cache;
173+ unsigned char ha[ETH_ALEN];
172174 struct neighbour *n;
173175 u32 mask, val;
176+ u8 nud_state;
174177 u16 val16;
175178
176− n = dst_neigh_lookup(tuple->dst_cache, &tuple->dst_v4);
179+ dst_cache = flow->tuplehash[dir].tuple.dst_cache;
180+ n = dst_neigh_lookup(dst_cache, daddr);
177181 if (!n)
178182 return -ENOENT;
179183
184+ read_lock_bh(&n->lock);
185+ nud_state = n->nud_state;
186+ ether_addr_copy(ha, n->ha);
187+ read_unlock_bh(&n->lock);
188+
189+ if (!(nud_state & NUD_VALID)) {
190+ neigh_release(n);
191+ return -ENOENT;
192+ }
193+
180194 mask = ~0xffffffff;
181− memcpy(&val, n->ha, 4);
195+ memcpy(&val, ha, 4);
182196 flow_offload_mangle(entry0, FLOW_ACT_MANGLE_HDR_TYPE_ETH, 0,
183197 &val, &mask);
184198
185199 mask = ~0x0000ffff;
186− memcpy(&val16, n->ha + 4, 2);
200+ memcpy(&val16, ha + 4, 2);
187201 val = val16;
188202 flow_offload_mangle(entry1, FLOW_ACT_MANGLE_HDR_TYPE_ETH, 4,
189203 &val, &mask);
@@ -335,22 +349,26 @@ static void flow_offload_port_snat(struct net *net, · 145 unmodified lines
335349 struct nf_flow_rule *flow_rule)
336350 {
337351 struct flow_action_entry *entry = flow_action_entry_next(flow_rule);
338− u32 mask = ~htonl(0xffff0000), port;
352+ u32 mask, port;
339353 u32 offset;
340354
341355 switch (dir) {
342356 case FLOW_OFFLOAD_DIR_ORIGINAL:
343357 port = ntohs(flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.dst_port);
344358 offset = 0; /* offsetof(struct tcphdr, source); */
359+ port = htonl(port << 16);
360+ mask = ~htonl(0xffff0000);
345361 break;
346362 case FLOW_OFFLOAD_DIR_REPLY:
347363 port = ntohs(flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_port);
348364 offset = 0; /* offsetof(struct tcphdr, dest); */
365+ port = htonl(port);
366+ mask = ~htonl(0xffff);
349367 break;
350368 default:
351369 return;
352370 }
353− port = htonl(port << 16);
371+
354372 flow_offload_mangle(entry, flow_offload_l4proto(flow), offset,
355373 &port, &mask);
356374 }
@@ -361,22 +379,26 @@ static void flow_offload_port_dnat(struct net *net, · 4 unmodified lines
361379 struct nf_flow_rule *flow_rule)
362380 {
363381 struct flow_action_entry *entry = flow_action_entry_next(flow_rule);
364− u32 mask = ~htonl(0xffff), port;
382+ u32 mask, port;
365383 u32 offset;
366384
367385 switch (dir) {
368386 case FLOW_OFFLOAD_DIR_ORIGINAL:
369− port = ntohs(flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.dst_port);
370− offset = 0; /* offsetof(struct tcphdr, source); */
387+ port = ntohs(flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.src_port);
388+ offset = 0; /* offsetof(struct tcphdr, dest); */
389+ port = htonl(port);
390+ mask = ~htonl(0xffff);
371391 break;
372392 case FLOW_OFFLOAD_DIR_REPLY:
373− port = ntohs(flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_port);
374− offset = 0; /* offsetof(struct tcphdr, dest); */
393+ port = ntohs(flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_port);
394+ offset = 0; /* offsetof(struct tcphdr, source); */
395+ port = htonl(port << 16);
396+ mask = ~htonl(0xffff0000);
375397 break;
376398 default:
377399 return;
378400 }
379− port = htonl(port);
401+
380402 flow_offload_mangle(entry, flow_offload_l4proto(flow), offset,
381403 &port, &mask);
382404 }
@@ -759,9 +781,9 @@ void nf_flow_offload_stats(struct nf_flowtable *flowtable, · 376 unmodified lines
759781 struct flow_offload *flow)
760782 {
761783 struct flow_offload_work *offload;
762− s64 delta;
784+ __s32 delta;
763785
764− delta = flow->timeout - jiffies;
786+ delta = nf_flow_timeout_delta(flow->timeout);
765787 if ((delta >= (9 * NF_FLOW_TIMEOUT) / 10) ||
766788 flow->flags & FLOW_OFFLOAD_HW_DYING)
767789 return;
net/netfilter/nf_tables_api.c+6−2
@@ -5984,6 +5984,7 @@ nft_flowtable_type_get(struct net *net, u8 family) · 5983 unmodified lines
59845984 return ERR_PTR(-ENOENT);
59855985 }
59865986
5987+/* Only called from error and netdev event paths. */
59875988 static void nft_unregister_flowtable_hook(struct net *net,
59885989 struct nft_flowtable *flowtable,
59895990 struct nft_hook *hook)
@@ -5999,7 +6000,7 @@ static void nft_unregister_flowtable_net_hooks(struct net *net, · 9 unmodified lines
59996000 struct nft_hook *hook;
60006001
60016002 list_for_each_entry(hook, &flowtable->hook_list, list)
6002− nft_unregister_flowtable_hook(net, flowtable, hook);
6003+ nf_unregister_net_hook(net, &hook->ops);
60036004 }
60046005
60056006 static int nft_register_flowtable_net_hooks(struct net *net,
@@ -6448,12 +6449,14 @@ static void nf_tables_flowtable_destroy(struct nft_flowtable *flowtable) · 442 unmodified lines
64486449 {
64496450 struct nft_hook *hook, *next;
64506451
6452+ flowtable->data.type->free(&flowtable->data);
64516453 list_for_each_entry_safe(hook, next, &flowtable->hook_list, list) {
6454+ flowtable->data.type->setup(&flowtable->data, hook->ops.dev,
6455+ FLOW_BLOCK_UNBIND);
64526456 list_del_rcu(&hook->list);
64536457 kfree(hook);
64546458 }
64556459 kfree(flowtable->name);
6456− flowtable->data.type->free(&flowtable->data);
64576460 module_put(flowtable->data.type->owner);
64586461 kfree(flowtable);
64596462 }
@@ -6497,6 +6500,7 @@ static void nft_flowtable_event(unsigned long event, struct net_device *dev, · 37 unmodified lines
64976500 if (hook->ops.dev != dev)
64986501 continue;
64996502
6503+ /* flow_offload_netdev_event() cleans up entries for us. */
65006504 nft_unregister_flowtable_hook(dev_net(dev), flowtable, hook);
65016505 list_del_rcu(&hook->list);
65026506 kfree_rcu(hook, rcu);
net/netfilter/nft_flow_offload.c+0−3
@@ -200,9 +200,6 @@ static void nft_flow_offload_activate(const struct nft_ctx *ctx, · 199 unmodified lines
200200 static void nft_flow_offload_destroy(const struct nft_ctx *ctx,
201201 const struct nft_expr *expr)
202202 {
203− struct nft_flow_offload *priv = nft_expr_priv(expr);
204−
205− priv->flowtable->use--;
206203 nf_ct_netns_put(ctx->net, ctx->family);
207204 }
208205
net/netfilter/nft_tproxy.c+2−2
@@ -50,7 +50,7 @@ static void nft_tproxy_eval_v4(const struct nft_expr *expr, · 49 unmodified lines
5050 taddr = nf_tproxy_laddr4(skb, taddr, iph->daddr);
5151
5252 if (priv->sreg_port)
53− tport = regs->data[priv->sreg_port];
53+ tport = nft_reg_load16(&regs->data[priv->sreg_port]);
5454 if (!tport)
5555 tport = hp->dest;
5656
@@ -117,7 +117,7 @@ static void nft_tproxy_eval_v6(const struct nft_expr *expr, · 60 unmodified lines
117117 taddr = *nf_tproxy_laddr6(skb, &taddr, &iph->daddr);
118118
119119 if (priv->sreg_port)
120− tport = regs->data[priv->sreg_port];
120+ tport = nft_reg_load16(&regs->data[priv->sreg_port]);
121121 if (!tport)
122122 tport = hp->dest;
123123
net/qrtr/qrtr.c+1−1
@@ -196,7 +196,7 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb, · 195 unmodified lines
196196 hdr->size = cpu_to_le32(len);
197197 hdr->confirm_rx = 0;
198198
199− skb_put_padto(skb, ALIGN(len, 4));
199+ skb_put_padto(skb, ALIGN(len, 4) + sizeof(*hdr));
200200
201201 mutex_lock(&node->ep_lock);
202202 if (node->ep)
net/rxrpc/ar-internal.h+7−3
@@ -209,6 +209,7 @@ struct rxrpc_skb_priv { · 208 unmodified lines
209209 struct rxrpc_security {
210210 const char *name; /* name of this service */
211211 u8 security_index; /* security type provided */
212+ u32 no_key_abort; /* Abort code indicating no key */
212213
213214 /* Initialise a security service */
214215 int (*init)(void);
@@ -977,8 +978,9 @@ static inline void rxrpc_reduce_conn_timer(struct rxrpc_connection *conn, · 762 unmodified lines
977978 struct rxrpc_connection *rxrpc_find_service_conn_rcu(struct rxrpc_peer *,
978979 struct sk_buff *);
979980 struct rxrpc_connection *rxrpc_prealloc_service_connection(struct rxrpc_net *, gfp_t);
980−void rxrpc_new_incoming_connection(struct rxrpc_sock *,
981− struct rxrpc_connection *, struct sk_buff *);
981+void rxrpc_new_incoming_connection(struct rxrpc_sock *, struct rxrpc_connection *,
982+ const struct rxrpc_security *, struct key *,
983+ struct sk_buff *);
982984 void rxrpc_unpublish_service_conn(struct rxrpc_connection *);
983985
984986 /*
@@ -1103,7 +1105,9 @@ extern const struct rxrpc_security rxkad; · 118 unmodified lines
11031105 int __init rxrpc_init_security(void);
11041106 void rxrpc_exit_security(void);
11051107 int rxrpc_init_client_conn_security(struct rxrpc_connection *);
1106−int rxrpc_init_server_conn_security(struct rxrpc_connection *);
1108+bool rxrpc_look_up_server_security(struct rxrpc_local *, struct rxrpc_sock *,
1109+ const struct rxrpc_security **, struct key **,
1110+ struct sk_buff *);
11071111
11081112 /*
11091113 * sendmsg.c
net/rxrpc/call_accept.c+37−23
@@ -239,6 +239,22 @@ void rxrpc_discard_prealloc(struct rxrpc_sock *rx) · 238 unmodified lines
239239 kfree(b);
240240 }
241241
242+/*
243+ * Ping the other end to fill our RTT cache and to retrieve the rwind
244+ * and MTU parameters.
245+ */
246+static void rxrpc_send_ping(struct rxrpc_call *call, struct sk_buff *skb)
247+{
248+ struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
249+ ktime_t now = skb->tstamp;
250+
251+ if (call->peer->rtt_usage < 3 ||
252+ ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000), now))
253+ rxrpc_propose_ACK(call, RXRPC_ACK_PING, sp->hdr.serial,
254+ true, true,
255+ rxrpc_propose_ack_ping_for_params);
256+}
257+
242258 /*
243259 * Allocate a new incoming call from the prealloc pool, along with a connection
244260 * and a peer as necessary.
@@ -247,6 +263,8 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx, · 2 unmodified lines
247263 struct rxrpc_local *local,
248264 struct rxrpc_peer *peer,
249265 struct rxrpc_connection *conn,
266+ const struct rxrpc_security *sec,
267+ struct key *key,
250268 struct sk_buff *skb)
251269 {
252270 struct rxrpc_backlog *b = rx->backlog;
@@ -294,7 +312,7 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx, · 41 unmodified lines
294312 conn->params.local = rxrpc_get_local(local);
295313 conn->params.peer = peer;
296314 rxrpc_see_connection(conn);
297− rxrpc_new_incoming_connection(rx, conn, skb);
315+ rxrpc_new_incoming_connection(rx, conn, sec, key, skb);
298316 } else {
299317 rxrpc_get_connection(conn);
300318 }
@@ -333,9 +351,11 @@ struct rxrpc_call *rxrpc_new_incoming_call(struct rxrpc_local *local, · 32 unmodified lines
333351 struct sk_buff *skb)
334352 {
335353 struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
354+ const struct rxrpc_security *sec = NULL;
336355 struct rxrpc_connection *conn;
337356 struct rxrpc_peer *peer = NULL;
338− struct rxrpc_call *call;
357+ struct rxrpc_call *call = NULL;
358+ struct key *key = NULL;
339359
340360 _enter("");
341361
@@ -346,9 +366,7 @@ struct rxrpc_call *rxrpc_new_incoming_call(struct rxrpc_local *local, · 4 unmodified lines
346366 sp->hdr.seq, RX_INVALID_OPERATION, ESHUTDOWN);
347367 skb->mark = RXRPC_SKB_MARK_REJECT_ABORT;
348368 skb->priority = RX_INVALID_OPERATION;
349− _leave(" = NULL [close]");
350− call = NULL;
351− goto out;
369+ goto no_call;
352370 }
353371
354372 /* The peer, connection and call may all have sprung into existence due
@@ -358,29 +376,19 @@ struct rxrpc_call *rxrpc_new_incoming_call(struct rxrpc_local *local, · 3 unmodified lines
358376 */
359377 conn = rxrpc_find_connection_rcu(local, skb, &peer);
360378
361− call = rxrpc_alloc_incoming_call(rx, local, peer, conn, skb);
379+ if (!conn && !rxrpc_look_up_server_security(local, rx, &sec, &key, skb))
380+ goto no_call;
381+
382+ call = rxrpc_alloc_incoming_call(rx, local, peer, conn, sec, key, skb);
383+ key_put(key);
362384 if (!call) {
363385 skb->mark = RXRPC_SKB_MARK_REJECT_BUSY;
364− _leave(" = NULL [busy]");
365− call = NULL;
366− goto out;
386+ goto no_call;
367387 }
368388
369389 trace_rxrpc_receive(call, rxrpc_receive_incoming,
370390 sp->hdr.serial, sp->hdr.seq);
371391
372− /* Lock the call to prevent rxrpc_kernel_send/recv_data() and
373− * sendmsg()/recvmsg() inconveniently stealing the mutex once the
374− * notification is generated.
375− *
376− * The BUG should never happen because the kernel should be well
377− * behaved enough not to access the call before the first notification
378− * event and userspace is prevented from doing so until the state is
379− * appropriate.
380− */
381− if (!mutex_trylock(&call->user_mutex))
382− BUG();
383−
384392 /* Make the call live. */
385393 rxrpc_incoming_call(rx, call, skb);
386394 conn = call->conn;
@@ -421,6 +429,9 @@ struct rxrpc_call *rxrpc_new_incoming_call(struct rxrpc_local *local, · 34 unmodified lines
421429 BUG();
422430 }
423431 spin_unlock(&conn->state_lock);
432+ spin_unlock(&rx->incoming_lock);
433+
434+ rxrpc_send_ping(call, skb);
424435
425436 if (call->state == RXRPC_CALL_SERVER_ACCEPTING)
426437 rxrpc_notify_socket(call);
@@ -433,9 +444,12 @@ struct rxrpc_call *rxrpc_new_incoming_call(struct rxrpc_local *local, · 6 unmodified lines
433444 rxrpc_put_call(call, rxrpc_call_put);
434445
435446 _leave(" = %p{%d}", call, call->debug_id);
436−out:
437− spin_unlock(&rx->incoming_lock);
438447 return call;
448+
449+no_call:
450+ spin_unlock(&rx->incoming_lock);
451+ _leave(" = NULL [%u]", skb->mark);
452+ return NULL;
439453 }
440454
441455 /*
net/rxrpc/conn_event.c+1−15
@@ -376,21 +376,7 @@ static void rxrpc_secure_connection(struct rxrpc_connection *conn) · 375 unmodified lines
376376 _enter("{%d}", conn->debug_id);
377377
378378 ASSERT(conn->security_ix != 0);
379−
380− if (!conn->params.key) {
381− _debug("set up security");
382− ret = rxrpc_init_server_conn_security(conn);
383− switch (ret) {
384− case 0:
385− break;
386− case -ENOENT:
387− abort_code = RX_CALL_DEAD;
388− goto abort;
389− default:
390− abort_code = RXKADNOAUTH;
391− goto abort;
392− }
393− }
379+ ASSERT(conn->server_key);
394380
395381 if (conn->security->issue_challenge(conn) < 0) {
396382 abort_code = RX_CALL_DEAD;
net/rxrpc/conn_service.c+4−0
@@ -148,6 +148,8 @@ struct rxrpc_connection *rxrpc_prealloc_service_connection(struct rxrpc_net *rxn · 147 unmodified lines
148148 */
149149 void rxrpc_new_incoming_connection(struct rxrpc_sock *rx,
150150 struct rxrpc_connection *conn,
151+ const struct rxrpc_security *sec,
152+ struct key *key,
151153 struct sk_buff *skb)
152154 {
153155 struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
@@ -160,6 +162,8 @@ void rxrpc_new_incoming_connection(struct rxrpc_sock *rx, · 6 unmodified lines
160162 conn->service_id = sp->hdr.serviceId;
161163 conn->security_ix = sp->hdr.securityIndex;
162164 conn->out_clientflag = 0;
165+ conn->security = sec;
166+ conn->server_key = key_get(key);
163167 if (conn->security_ix)
164168 conn->state = RXRPC_CONN_SERVICE_UNSECURED;
165169 else
net/rxrpc/input.c+0−18
@@ -192,22 +192,6 @@ send_extra_data: · 191 unmodified lines
192192 goto out_no_clear_ca;
193193 }
194194
195−/*
196− * Ping the other end to fill our RTT cache and to retrieve the rwind
197− * and MTU parameters.
198− */
199−static void rxrpc_send_ping(struct rxrpc_call *call, struct sk_buff *skb)
200−{
201− struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
202− ktime_t now = skb->tstamp;
203−
204− if (call->peer->rtt_usage < 3 ||
205− ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000), now))
206− rxrpc_propose_ACK(call, RXRPC_ACK_PING, sp->hdr.serial,
207− true, true,
208− rxrpc_propose_ack_ping_for_params);
209−}
210−
211195 /*
212196 * Apply a hard ACK by advancing the Tx window.
213197 */
@@ -1396,8 +1380,6 @@ int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb) · 1182 unmodified lines
13961380 call = rxrpc_new_incoming_call(local, rx, skb);
13971381 if (!call)
13981382 goto reject_packet;
1399− rxrpc_send_ping(call, skb);
1400− mutex_unlock(&call->user_mutex);
14011383 }
14021384
14031385 /* Process a call packet; this either discards or passes on the ref
net/rxrpc/rxkad.c+3−2
@@ -648,9 +648,9 @@ static int rxkad_issue_challenge(struct rxrpc_connection *conn) · 647 unmodified lines
648648 u32 serial;
649649 int ret;
650650
651− _enter("{%d,%x}", conn->debug_id, key_serial(conn->params.key));
651+ _enter("{%d,%x}", conn->debug_id, key_serial(conn->server_key));
652652
653− ret = key_validate(conn->params.key);
653+ ret = key_validate(conn->server_key);
654654 if (ret < 0)
655655 return ret;
656656
@@ -1293,6 +1293,7 @@ static void rxkad_exit(void) · 636 unmodified lines
12931293 const struct rxrpc_security rxkad = {
12941294 .name = "rxkad",
12951295 .security_index = RXRPC_SECURITY_RXKAD,
1296+ .no_key_abort = RXKADUNKNOWNKEY,
12961297 .init = rxkad_init,
12971298 .exit = rxkad_exit,
12981299 .init_connection_security = rxkad_init_connection_security,
net/rxrpc/security.c+33−37
@@ -101,62 +101,58 @@ int rxrpc_init_client_conn_security(struct rxrpc_connection *conn) · 100 unmodified lines
101101 }
102102
103103 /*
104− * initialise the security on a server connection
104+ * Find the security key for a server connection.
105105 */
106−int rxrpc_init_server_conn_security(struct rxrpc_connection *conn)
106+bool rxrpc_look_up_server_security(struct rxrpc_local *local, struct rxrpc_sock *rx,
107+ const struct rxrpc_security **_sec,
108+ struct key **_key,
109+ struct sk_buff *skb)
107110 {
108111 const struct rxrpc_security *sec;
109− struct rxrpc_local *local = conn->params.local;
110− struct rxrpc_sock *rx;
111− struct key *key;
112− key_ref_t kref;
112+ struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
113+ key_ref_t kref = NULL;
113114 char kdesc[5 + 1 + 3 + 1];
114115
115116 _enter("");
116117
117− sprintf(kdesc, "%u:%u", conn->service_id, conn->security_ix);
118+ sprintf(kdesc, "%u:%u", sp->hdr.serviceId, sp->hdr.securityIndex);
118119
119− sec = rxrpc_security_lookup(conn->security_ix);
120+ sec = rxrpc_security_lookup(sp->hdr.securityIndex);
120121 if (!sec) {
121− _leave(" = -ENOKEY [lookup]");
122− return -ENOKEY;
122+ trace_rxrpc_abort(0, "SVS",
123+ sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq,
124+ RX_INVALID_OPERATION, EKEYREJECTED);
125+ skb->mark = RXRPC_SKB_MARK_REJECT_ABORT;
126+ skb->priority = RX_INVALID_OPERATION;
127+ return false;
123128 }
124129
125− /* find the service */
126− read_lock(&local->services_lock);
127− rx = rcu_dereference_protected(local->service,
128− lockdep_is_held(&local->services_lock));
129− if (rx && (rx->srx.srx_service == conn->service_id ||
130− rx->second_service == conn->service_id))
131− goto found_service;
130+ if (sp->hdr.securityIndex == RXRPC_SECURITY_NONE)
131+ goto out;
132132
133− /* the service appears to have died */
134− read_unlock(&local->services_lock);
135− _leave(" = -ENOENT");
136− return -ENOENT;
137−
138−found_service:
139133 if (!rx->securities) {
140− read_unlock(&local->services_lock);
141− _leave(" = -ENOKEY");
142− return -ENOKEY;
134+ trace_rxrpc_abort(0, "SVR",
135+ sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq,
136+ RX_INVALID_OPERATION, EKEYREJECTED);
137+ skb->mark = RXRPC_SKB_MARK_REJECT_ABORT;
138+ skb->priority = RX_INVALID_OPERATION;
139+ return false;
143140 }
144141
145142 /* look through the service's keyring */
146143 kref = keyring_search(make_key_ref(rx->securities, 1UL),
147144 &key_type_rxrpc_s, kdesc, true);
148145 if (IS_ERR(kref)) {
149− read_unlock(&local->services_lock);
150− _leave(" = %ld [search]", PTR_ERR(kref));
151− return PTR_ERR(kref);
146+ trace_rxrpc_abort(0, "SVK",
147+ sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq,
148+ sec->no_key_abort, EKEYREJECTED);
149+ skb->mark = RXRPC_SKB_MARK_REJECT_ABORT;
150+ skb->priority = sec->no_key_abort;
151+ return false;
152152 }
153153
154− key = key_ref_to_ptr(kref);
155− read_unlock(&local->services_lock);
156−
157− conn->server_key = key;
158− conn->security = sec;
159−
160− _leave(" = 0");
161− return 0;
154+out:
155+ *_sec = sec;
156+ *_key = key_ref_to_ptr(kref);
157+ return true;
162158 }
net/sched/act_mirred.c+12−10
@@ -219,8 +219,10 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a, · 218 unmodified lines
219219 bool use_reinsert;
220220 bool want_ingress;
221221 bool is_redirect;
222+ bool expects_nh;
222223 int m_eaction;
223224 int mac_len;
225+ bool at_nh;
224226
225227 rec_level = __this_cpu_inc_return(mirred_rec_level);
226228 if (unlikely(rec_level > MIRRED_RECURSION_LIMIT)) {
@@ -261,19 +263,19 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a, · 34 unmodified lines
261263 goto out;
262264 }
263265
264− /* If action's target direction differs than filter's direction,
265− * and devices expect a mac header on xmit, then mac push/pull is
266− * needed.
267− */
268266 want_ingress = tcf_mirred_act_wants_ingress(m_eaction);
269− if (skb_at_tc_ingress(skb) != want_ingress && m_mac_header_xmit) {
270− if (!skb_at_tc_ingress(skb)) {
271− /* caught at egress, act ingress: pull mac */
272− mac_len = skb_network_header(skb) - skb_mac_header(skb);
267+
268+ expects_nh = want_ingress || !m_mac_header_xmit;
269+ at_nh = skb->data == skb_network_header(skb);
270+ if (at_nh != expects_nh) {
271+ mac_len = skb_at_tc_ingress(skb) ? skb->mac_len :
272+ skb_network_header(skb) - skb_mac_header(skb);
273+ if (expects_nh) {
274+ /* target device/action expect data at nh */
273275 skb_pull_rcsum(skb2, mac_len);
274276 } else {
275− /* caught at ingress, act egress: push mac */
276− skb_push_rcsum(skb2, skb->mac_len);
277+ /* target device/action expect data at mac */
278+ skb_push_rcsum(skb2, mac_len);
277279 }
278280 }
279281
net/sched/cls_api.c+5−26
@@ -308,33 +308,12 @@ static void tcf_proto_put(struct tcf_proto *tp, bool rtnl_held, · 307 unmodified lines
308308 tcf_proto_destroy(tp, rtnl_held, true, extack);
309309 }
310310
311−static int walker_check_empty(struct tcf_proto *tp, void *fh,
312− struct tcf_walker *arg)
311+static bool tcf_proto_check_delete(struct tcf_proto *tp)
313312 {
314− if (fh) {
315− arg->nonempty = true;
316− return -1;
317− }
318− return 0;
319−}
320−
321−static bool tcf_proto_is_empty(struct tcf_proto *tp, bool rtnl_held)
322−{
323− struct tcf_walker walker = { .fn = walker_check_empty, };
324−
325− if (tp->ops->walk) {
326− tp->ops->walk(tp, &walker, rtnl_held);
327− return !walker.nonempty;
328− }
329− return true;
330−}
313+ if (tp->ops->delete_empty)
314+ return tp->ops->delete_empty(tp);
331315
332−static bool tcf_proto_check_delete(struct tcf_proto *tp, bool rtnl_held)
333−{
334− spin_lock(&tp->lock);
335− if (tcf_proto_is_empty(tp, rtnl_held))
336− tp->deleting = true;
337− spin_unlock(&tp->lock);
316+ tp->deleting = true;
338317 return tp->deleting;
339318 }
340319
@@ -1751,7 +1730,7 @@ static void tcf_chain_tp_delete_empty(struct tcf_chain *chain, · 1410 unmodified lines
17511730 * concurrently.
17521731 * Mark tp for deletion if it is empty.
17531732 */
1754− if (!tp_iter || !tcf_proto_check_delete(tp, rtnl_held)) {
1733+ if (!tp_iter || !tcf_proto_check_delete(tp)) {
17551734 mutex_unlock(&chain->filter_chain_lock);
17561735 return;
17571736 }
net/sched/cls_flower.c+12−0
@@ -2773,6 +2773,17 @@ static void fl_bind_class(void *fh, u32 classid, unsigned long cl) · 2772 unmodified lines
27732773 f->res.class = cl;
27742774 }
27752775
2776+static bool fl_delete_empty(struct tcf_proto *tp)
2777+{
2778+ struct cls_fl_head *head = fl_head_dereference(tp);
2779+
2780+ spin_lock(&tp->lock);
2781+ tp->deleting = idr_is_empty(&head->handle_idr);
2782+ spin_unlock(&tp->lock);
2783+
2784+ return tp->deleting;
2785+}
2786+
27762787 static struct tcf_proto_ops cls_fl_ops __read_mostly = {
27772788 .kind = "flower",
27782789 .classify = fl_classify,
@@ -2782,6 +2793,7 @@ static struct tcf_proto_ops cls_fl_ops __read_mostly = { · 3 unmodified lines
27822793 .put = fl_put,
27832794 .change = fl_change,
27842795 .delete = fl_delete,
2796+ .delete_empty = fl_delete_empty,
27852797 .walk = fl_walk,
27862798 .reoffload = fl_reoffload,
27872799 .hw_add = fl_hw_add,
net/sched/cls_u32.c+0−25
@@ -1108,33 +1108,10 @@ erridr: · 1107 unmodified lines
11081108 return err;
11091109 }
11101110
1111−static bool u32_hnode_empty(struct tc_u_hnode *ht, bool *non_root_ht)
1112−{
1113− int i;
1114−
1115− if (!ht)
1116− return true;
1117− if (!ht->is_root) {
1118− *non_root_ht = true;
1119− return false;
1120− }
1121− if (*non_root_ht)
1122− return false;
1123− if (ht->refcnt < 2)
1124− return true;
1125−
1126− for (i = 0; i <= ht->divisor; i++) {
1127− if (rtnl_dereference(ht->ht[i]))
1128− return false;
1129− }
1130− return true;
1131−}
1132−
11331111 static void u32_walk(struct tcf_proto *tp, struct tcf_walker *arg,
11341112 bool rtnl_held)
11351113 {
11361114 struct tc_u_common *tp_c = tp->data;
1137− bool non_root_ht = false;
11381115 struct tc_u_hnode *ht;
11391116 struct tc_u_knode *n;
11401117 unsigned int h;
@@ -1147,8 +1124,6 @@ static void u32_walk(struct tcf_proto *tp, struct tcf_walker *arg, · 6 unmodified lines
11471124 ht = rtnl_dereference(ht->next)) {
11481125 if (ht->prio != tp->prio)
11491126 continue;
1150− if (u32_hnode_empty(ht, &non_root_ht))
1151− return;
11521127 if (arg->count >= arg->skip) {
11531128 if (arg->fn(tp, ht, arg) < 0) {
11541129 arg->stop = 1;
net/sched/sch_cake.c+1−1
@@ -1769,7 +1769,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 1768 unmodified lines
17691769 q->avg_window_begin));
17701770 u64 b = q->avg_window_bytes * (u64)NSEC_PER_SEC;
17711771
1772− do_div(b, window_interval);
1772+ b = div64_u64(b, window_interval);
17731773 q->avg_peak_bandwidth =
17741774 cake_ewma(q->avg_peak_bandwidth, b,
17751775 b > q->avg_peak_bandwidth ? 2 : 8);
net/sched/sch_fq.c+12−11
@@ -301,6 +301,9 @@ static struct fq_flow *fq_classify(struct sk_buff *skb, struct fq_sched_data *q) · 300 unmodified lines
301301 f->socket_hash != sk->sk_hash)) {
302302 f->credit = q->initial_quantum;
303303 f->socket_hash = sk->sk_hash;
304+ if (q->rate_enable)
305+ smp_store_release(&sk->sk_pacing_status,
306+ SK_PACING_FQ);
304307 if (fq_flow_is_throttled(f))
305308 fq_flow_unset_throttled(q, f);
306309 f->time_next_packet = 0ULL;
@@ -322,8 +325,12 @@ static struct fq_flow *fq_classify(struct sk_buff *skb, struct fq_sched_data *q) · 15 unmodified lines
322325
323326 fq_flow_set_detached(f);
324327 f->sk = sk;
325− if (skb->sk == sk)
328+ if (skb->sk == sk) {
326329 f->socket_hash = sk->sk_hash;
330+ if (q->rate_enable)
331+ smp_store_release(&sk->sk_pacing_status,
332+ SK_PACING_FQ);
333+ }
327334 f->credit = q->initial_quantum;
328335
329336 rb_link_node(&f->fq_node, parent, p);
@@ -428,17 +435,9 @@ static int fq_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 98 unmodified lines
428435 f->qlen++;
429436 qdisc_qstats_backlog_inc(sch, skb);
430437 if (fq_flow_is_detached(f)) {
431− struct sock *sk = skb->sk;
432−
433438 fq_flow_add_tail(&q->new_flows, f);
434439 if (time_after(jiffies, f->age + q->flow_refill_delay))
435440 f->credit = max_t(u32, f->credit, q->quantum);
436− if (sk && q->rate_enable) {
437− if (unlikely(smp_load_acquire(&sk->sk_pacing_status) !=
438− SK_PACING_FQ))
439− smp_store_release(&sk->sk_pacing_status,
440− SK_PACING_FQ);
441− }
442441 q->inactive_flows--;
443442 }
444443
@@ -787,10 +786,12 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt, · 342 unmodified lines
787786 if (tb[TCA_FQ_QUANTUM]) {
788787 u32 quantum = nla_get_u32(tb[TCA_FQ_QUANTUM]);
789788
790− if (quantum > 0)
789+ if (quantum > 0 && quantum <= (1 << 20)) {
791790 q->quantum = quantum;
792− else
791+ } else {
792+ NL_SET_ERR_MSG_MOD(extack, "invalid quantum");
793793 err = -EINVAL;
794+ }
794795 }
795796
796797 if (tb[TCA_FQ_INITIAL_QUANTUM])
net/sched/sch_prio.c+8−2
@@ -292,8 +292,14 @@ static int prio_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, · 291 unmodified lines
292292 struct tc_prio_qopt_offload graft_offload;
293293 unsigned long band = arg - 1;
294294
295− if (new == NULL)
296− new = &noop_qdisc;
295+ if (!new) {
296+ new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
297+ TC_H_MAKE(sch->handle, arg), extack);
298+ if (!new)
299+ new = &noop_qdisc;
300+ else
301+ qdisc_hash_add(new, true);
302+ }
297303
298304 *old = qdisc_replace(sch, new, &q->queues[band]);
299305
net/sctp/sm_sideeffect.c+18−10
@@ -1363,8 +1363,10 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type, · 1362 unmodified lines
13631363 /* Generate an INIT ACK chunk. */
13641364 new_obj = sctp_make_init_ack(asoc, chunk, GFP_ATOMIC,
13651365 0);
1366− if (!new_obj)
1367− goto nomem;
1366+ if (!new_obj) {
1367+ error = -ENOMEM;
1368+ break;
1369+ }
13681370
13691371 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
13701372 SCTP_CHUNK(new_obj));
@@ -1386,7 +1388,8 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type, · 15 unmodified lines
13861388 if (!new_obj) {
13871389 if (cmd->obj.chunk)
13881390 sctp_chunk_free(cmd->obj.chunk);
1389− goto nomem;
1391+ error = -ENOMEM;
1392+ break;
13901393 }
13911394 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
13921395 SCTP_CHUNK(new_obj));
@@ -1433,8 +1436,10 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type, · 40 unmodified lines
14331436
14341437 /* Generate a SHUTDOWN chunk. */
14351438 new_obj = sctp_make_shutdown(asoc, chunk);
1436− if (!new_obj)
1437− goto nomem;
1439+ if (!new_obj) {
1440+ error = -ENOMEM;
1441+ break;
1442+ }
14381443 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
14391444 SCTP_CHUNK(new_obj));
14401445 break;
@@ -1770,11 +1775,17 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type, · 329 unmodified lines
17701775 break;
17711776 }
17721777
1773− if (error)
1778+ if (error) {
1779+ cmd = sctp_next_cmd(commands);
1780+ while (cmd) {
1781+ if (cmd->verb == SCTP_CMD_REPLY)
1782+ sctp_chunk_free(cmd->obj.chunk);
1783+ cmd = sctp_next_cmd(commands);
1784+ }
17741785 break;
1786+ }
17751787 }
17761788
1777−out:
17781789 /* If this is in response to a received chunk, wait until
17791790 * we are done with the packet to open the queue so that we don't
17801791 * send multiple packets in response to a single request.
@@ -1789,7 +1800,4 @@ out: · 8 unmodified lines
17891800 sp->data_ready_signalled = 0;
17901801
17911802 return error;
1792−nomem:
1793− error = -ENOMEM;
1794− goto out;
17951803 }
net/sctp/stream.c+15−15
@@ -84,10 +84,8 @@ static int sctp_stream_alloc_out(struct sctp_stream *stream, __u16 outcnt, · 83 unmodified lines
8484 return 0;
8585
8686 ret = genradix_prealloc(&stream->out, outcnt, gfp);
87− if (ret) {
88− genradix_free(&stream->out);
87+ if (ret)
8988 return ret;
90− }
9189
9290 stream->outcnt = outcnt;
9391 return 0;
@@ -102,10 +100,8 @@ static int sctp_stream_alloc_in(struct sctp_stream *stream, __u16 incnt, · 8 unmodified lines
102100 return 0;
103101
104102 ret = genradix_prealloc(&stream->in, incnt, gfp);
105− if (ret) {
106− genradix_free(&stream->in);
103+ if (ret)
107104 return ret;
108− }
109105
110106 stream->incnt = incnt;
111107 return 0;
@@ -123,7 +119,7 @@ int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt, · 11 unmodified lines
123119 * a new one with new outcnt to save memory if needed.
124120 */
125121 if (outcnt == stream->outcnt)
126− goto in;
122+ goto handle_in;
127123
128124 /* Filter out chunks queued on streams that won't exist anymore */
129125 sched->unsched_all(stream);
@@ -132,24 +128,28 @@ int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt, · 2 unmodified lines
132128
133129 ret = sctp_stream_alloc_out(stream, outcnt, gfp);
134130 if (ret)
135− goto out;
131+ goto out_err;
136132
137133 for (i = 0; i < stream->outcnt; i++)
138134 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN;
139135
140−in:
136+handle_in:
141137 sctp_stream_interleave_init(stream);
142138 if (!incnt)
143139 goto out;
144140
145141 ret = sctp_stream_alloc_in(stream, incnt, gfp);
146− if (ret) {
147− sched->free(stream);
148− genradix_free(&stream->out);
149− stream->outcnt = 0;
150− goto out;
151− }
142+ if (ret)
143+ goto in_err;
144+
145+ goto out;
152146
147+in_err:
148+ sched->free(stream);
149+ genradix_free(&stream->in);
150+out_err:
151+ genradix_free(&stream->out);
152+ stream->outcnt = 0;
153153 out:
154154 return ret;
155155 }
net/sctp/transport.c+1−1
@@ -263,7 +263,7 @@ bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) · 262 unmodified lines
263263
264264 pf->af->from_sk(&addr, sk);
265265 pf->to_sk_daddr(&t->ipaddr, sk);
266− dst->ops->update_pmtu(dst, sk, NULL, pmtu);
266+ dst->ops->update_pmtu(dst, sk, NULL, pmtu, true);
267267 pf->to_sk_daddr(&addr, sk);
268268
269269 dst = sctp_transport_dst_check(t);
net/tipc/Makefile+1−3
@@ -9,7 +9,7 @@ tipc-y += addr.o bcast.o bearer.o \ · 8 unmodified lines
99 core.o link.o discover.o msg.o \
1010 name_distr.o subscr.o monitor.o name_table.o net.o \
1111 netlink.o netlink_compat.o node.o socket.o eth_media.o \
12− topsrv.o socket.o group.o trace.o
12+ topsrv.o group.o trace.o
1313
1414 CFLAGS_trace.o += -I$(src)
1515
@@ -20,5 +20,3 @@ tipc-$(CONFIG_TIPC_CRYPTO) += crypto.o · 4 unmodified lines
2020
2121
2222 obj-$(CONFIG_TIPC_DIAG) += diag.o
23−
24−tipc_diag-y := diag.o
net/tipc/netlink_compat.c+2−2
@@ -204,8 +204,8 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd, · 203 unmodified lines
204204 return -ENOMEM;
205205 }
206206
207− attrbuf = kmalloc_array(tipc_genl_family.maxattr + 1,
208− sizeof(struct nlattr *), GFP_KERNEL);
207+ attrbuf = kcalloc(tipc_genl_family.maxattr + 1,
208+ sizeof(struct nlattr *), GFP_KERNEL);
209209 if (!attrbuf) {
210210 err = -ENOMEM;
211211 goto err_out;
net/tipc/socket.c+34−23
@@ -287,12 +287,12 @@ static void tipc_sk_respond(struct sock *sk, struct sk_buff *skb, int err) · 286 unmodified lines
287287 *
288288 * Caller must hold socket lock
289289 */
290−static void tsk_rej_rx_queue(struct sock *sk)
290+static void tsk_rej_rx_queue(struct sock *sk, int error)
291291 {
292292 struct sk_buff *skb;
293293
294294 while ((skb = __skb_dequeue(&sk->sk_receive_queue)))
295− tipc_sk_respond(sk, skb, TIPC_ERR_NO_PORT);
295+ tipc_sk_respond(sk, skb, error);
296296 }
297297
298298 static bool tipc_sk_connected(struct sock *sk)
@@ -545,34 +545,45 @@ static void __tipc_shutdown(struct socket *sock, int error) · 246 unmodified lines
545545 /* Remove pending SYN */
546546 __skb_queue_purge(&sk->sk_write_queue);
547547
548− /* Reject all unreceived messages, except on an active connection
549− * (which disconnects locally & sends a 'FIN+' to peer).
550− */
551− while ((skb = __skb_dequeue(&sk->sk_receive_queue)) != NULL) {
552− if (TIPC_SKB_CB(skb)->bytes_read) {
553− kfree_skb(skb);
554− continue;
555− }
556− if (!tipc_sk_type_connectionless(sk) &&
557− sk->sk_state != TIPC_DISCONNECTING) {
558− tipc_set_sk_state(sk, TIPC_DISCONNECTING);
559− tipc_node_remove_conn(net, dnode, tsk->portid);
560− }
561− tipc_sk_respond(sk, skb, error);
548+ /* Remove partially received buffer if any */
549+ skb = skb_peek(&sk->sk_receive_queue);
550+ if (skb && TIPC_SKB_CB(skb)->bytes_read) {
551+ __skb_unlink(skb, &sk->sk_receive_queue);
552+ kfree_skb(skb);
562553 }
563554
564− if (tipc_sk_type_connectionless(sk))
555+ /* Reject all unreceived messages if connectionless */
556+ if (tipc_sk_type_connectionless(sk)) {
557+ tsk_rej_rx_queue(sk, error);
565558 return;
559+ }
566560
567− if (sk->sk_state != TIPC_DISCONNECTING) {
561+ switch (sk->sk_state) {
562+ case TIPC_CONNECTING:
563+ case TIPC_ESTABLISHED:
564+ tipc_set_sk_state(sk, TIPC_DISCONNECTING);
565+ tipc_node_remove_conn(net, dnode, tsk->portid);
566+ /* Send a FIN+/- to its peer */
567+ skb = __skb_dequeue(&sk->sk_receive_queue);
568+ if (skb) {
569+ __skb_queue_purge(&sk->sk_receive_queue);
570+ tipc_sk_respond(sk, skb, error);
571+ break;
572+ }
568573 skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE,
569574 TIPC_CONN_MSG, SHORT_H_SIZE, 0, dnode,
570575 tsk_own_node(tsk), tsk_peer_port(tsk),
571576 tsk->portid, error);
572577 if (skb)
573578 tipc_node_xmit_skb(net, skb, dnode, tsk->portid);
574− tipc_node_remove_conn(net, dnode, tsk->portid);
575− tipc_set_sk_state(sk, TIPC_DISCONNECTING);
579+ break;
580+ case TIPC_LISTEN:
581+ /* Reject all SYN messages */
582+ tsk_rej_rx_queue(sk, error);
583+ break;
584+ default:
585+ __skb_queue_purge(&sk->sk_receive_queue);
586+ break;
576587 }
577588 }
578589
@@ -2432,8 +2443,8 @@ static int tipc_wait_for_connect(struct socket *sock, long *timeo_p) · 1853 unmodified lines
24322443 return sock_intr_errno(*timeo_p);
24332444
24342445 add_wait_queue(sk_sleep(sk), &wait);
2435− done = sk_wait_event(sk, timeo_p,
2436− sk->sk_state != TIPC_CONNECTING, &wait);
2446+ done = sk_wait_event(sk, timeo_p, tipc_sk_connected(sk),
2447+ &wait);
24372448 remove_wait_queue(sk_sleep(sk), &wait);
24382449 } while (!done);
24392450 return 0;
@@ -2643,7 +2654,7 @@ static int tipc_accept(struct socket *sock, struct socket *new_sock, int flags, · 203 unmodified lines
26432654 * Reject any stray messages received by new socket
26442655 * before the socket lock was taken (very, very unlikely)
26452656 */
2646− tsk_rej_rx_queue(new_sk);
2657+ tsk_rej_rx_queue(new_sk, TIPC_ERR_NO_PORT);
26472658
26482659 /* Connect new socket to it's peer */
26492660 tipc_sk_finish_conn(new_tsock, msg_origport(msg), msg_orignode(msg));
samples/seccomp/user-trap.c+2−2
@@ -298,14 +298,14 @@ int main(void) · 297 unmodified lines
298298 req = malloc(sizes.seccomp_notif);
299299 if (!req)
300300 goto out_close;
301− memset(req, 0, sizeof(*req));
302301
303302 resp = malloc(sizes.seccomp_notif_resp);
304303 if (!resp)
305304 goto out_req;
306− memset(resp, 0, sizeof(*resp));
305+ memset(resp, 0, sizes.seccomp_notif_resp);
307306
308307 while (1) {
308+ memset(req, 0, sizes.seccomp_notif);
309309 if (ioctl(listener, SECCOMP_IOCTL_NOTIF_RECV, req)) {
310310 perror("ioctl recv");
311311 goto out_resp;
scripts/gcc-plugins/Kconfig+4−5
@@ -14,8 +14,8 @@ config HAVE_GCC_PLUGINS · 13 unmodified lines
1414 An arch should select this symbol if it supports building with
1515 GCC plugins.
1616
17−config GCC_PLUGINS
18− bool
17+menuconfig GCC_PLUGINS
18+ bool "GCC plugins"
1919 depends on HAVE_GCC_PLUGINS
2020 depends on PLUGIN_HOSTCC != ""
2121 default y
@@ -25,8 +25,7 @@ config GCC_PLUGINS · 3 unmodified lines
2525
2626 See Documentation/core-api/gcc-plugins.rst for details.
2727
28−menu "GCC plugins"
29− depends on GCC_PLUGINS
28+if GCC_PLUGINS
3029
3130 config GCC_PLUGIN_CYC_COMPLEXITY
3231 bool "Compute the cyclomatic complexity of a function" if EXPERT
@@ -113,4 +112,4 @@ config GCC_PLUGIN_ARM_SSP_PER_TASK · 80 unmodified lines
113112 bool
114113 depends on GCC_PLUGINS && ARM
115114
116−endmenu
115+endif
scripts/package/mkdebian+1−1
@@ -136,7 +136,7 @@ mkdir -p debian/source/ · 135 unmodified lines
136136 echo "1.0" > debian/source/format
137137
138138 echo $debarch > debian/arch
139−extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev)"
139+extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev:native)"
140140 extra_build_depends="$extra_build_depends, $(if_enabled_echo CONFIG_SYSTEM_TRUSTED_KEYRING libssl-dev:native)"
141141
142142 # Generate a simple changelog template
security/apparmor/apparmorfs.c+1−1
@@ -623,7 +623,7 @@ static __poll_t ns_revision_poll(struct file *file, poll_table *pt) · 622 unmodified lines
623623
624624 void __aa_bump_ns_revision(struct aa_ns *ns)
625625 {
626− ns->revision++;
626+ WRITE_ONCE(ns->revision, ns->revision + 1);
627627 wake_up_interruptible(&ns->wait);
628628 }
629629
security/apparmor/domain.c+43−39
@@ -317,6 +317,7 @@ static int aa_xattrs_match(const struct linux_binprm *bprm, · 316 unmodified lines
317317
318318 if (!bprm || !profile->xattr_count)
319319 return 0;
320+ might_sleep();
320321
321322 /* transition from exec match to xattr set */
322323 state = aa_dfa_null_transition(profile->xmatch, state);
@@ -361,10 +362,11 @@ out: · 38 unmodified lines
361362 }
362363
363364 /**
364− * __attach_match_ - find an attachment match
365+ * find_attach - do attachment search for unconfined processes
365366 * @bprm - binprm structure of transitioning task
366− * @name - to match against (NOT NULL)
367+ * @ns: the current namespace (NOT NULL)
367368 * @head - profile list to walk (NOT NULL)
369+ * @name - to match against (NOT NULL)
368370 * @info - info message if there was an error (NOT NULL)
369371 *
370372 * Do a linear search on the profiles in the list. There is a matching
@@ -374,12 +376,11 @@ out: · 3 unmodified lines
374376 *
375377 * Requires: @head not be shared or have appropriate locks held
376378 *
377− * Returns: profile or NULL if no match found
379+ * Returns: label or NULL if no match found
378380 */
379−static struct aa_profile *__attach_match(const struct linux_binprm *bprm,
380− const char *name,
381− struct list_head *head,
382− const char **info)
381+static struct aa_label *find_attach(const struct linux_binprm *bprm,
382+ struct aa_ns *ns, struct list_head *head,
383+ const char *name, const char **info)
383384 {
384385 int candidate_len = 0, candidate_xattrs = 0;
385386 bool conflict = false;
@@ -388,6 +389,8 @@ static struct aa_profile *__attach_match(const struct linux_binprm *bprm, · 2 unmodified lines
388389 AA_BUG(!name);
389390 AA_BUG(!head);
390391
392+ rcu_read_lock();
393+restart:
391394 list_for_each_entry_rcu(profile, head, base.list) {
392395 if (profile->label.flags & FLAG_NULL &&
393396 &profile->label == ns_unconfined(profile->ns))
@@ -413,16 +416,32 @@ static struct aa_profile *__attach_match(const struct linux_binprm *bprm, · 19 unmodified lines
413416 perm = dfa_user_allow(profile->xmatch, state);
414417 /* any accepting state means a valid match. */
415418 if (perm & MAY_EXEC) {
416− int ret;
419+ int ret = 0;
417420
418421 if (count < candidate_len)
419422 continue;
420423
421− ret = aa_xattrs_match(bprm, profile, state);
422− /* Fail matching if the xattrs don't match */
423− if (ret < 0)
424− continue;
425−
424+ if (bprm && profile->xattr_count) {
425+ long rev = READ_ONCE(ns->revision);
426+
427+ if (!aa_get_profile_not0(profile))
428+ goto restart;
429+ rcu_read_unlock();
430+ ret = aa_xattrs_match(bprm, profile,
431+ state);
432+ rcu_read_lock();
433+ aa_put_profile(profile);
434+ if (rev !=
435+ READ_ONCE(ns->revision))
436+ /* policy changed */
437+ goto restart;
438+ /*
439+ * Fail matching if the xattrs don't
440+ * match
441+ */
442+ if (ret < 0)
443+ continue;
444+ }
426445 /*
427446 * TODO: allow for more flexible best match
428447 *
@@ -445,43 +464,28 @@ static struct aa_profile *__attach_match(const struct linux_binprm *bprm, · 16 unmodified lines
445464 candidate_xattrs = ret;
446465 conflict = false;
447466 }
448− } else if (!strcmp(profile->base.name, name))
467+ } else if (!strcmp(profile->base.name, name)) {
449468 /*
450469 * old exact non-re match, without conditionals such
451470 * as xattrs. no more searching required
452471 */
453− return profile;
472+ candidate = profile;
473+ goto out;
474+ }
454475 }
455476
456− if (conflict) {
457− *info = "conflicting profile attachments";
477+ if (!candidate || conflict) {
478+ if (conflict)
479+ *info = "conflicting profile attachments";
480+ rcu_read_unlock();
458481 return NULL;
459482 }
460483
461− return candidate;
462−}
463−
464−/**
465− * find_attach - do attachment search for unconfined processes
466− * @bprm - binprm structure of transitioning task
467− * @ns: the current namespace (NOT NULL)
468− * @list: list to search (NOT NULL)
469− * @name: the executable name to match against (NOT NULL)
470− * @info: info message if there was an error
471− *
472− * Returns: label or NULL if no match found
473− */
474−static struct aa_label *find_attach(const struct linux_binprm *bprm,
475− struct aa_ns *ns, struct list_head *list,
476− const char *name, const char **info)
477−{
478− struct aa_profile *profile;
479−
480− rcu_read_lock();
481− profile = aa_get_profile(__attach_match(bprm, name, list, info));
484+out:
485+ candidate = aa_get_newest_profile(candidate);
482486 rcu_read_unlock();
483487
484− return profile ? &profile->label : NULL;
488+ return &candidate->label;
485489 }
486490
487491 static const char *next_name(int xtype, const char *name)
security/apparmor/file.c+8−4
@@ -618,8 +618,7 @@ int aa_file_perm(const char *op, struct aa_label *label, struct file *file, · 617 unmodified lines
618618 fctx = file_ctx(file);
619619
620620 rcu_read_lock();
621− flabel = aa_get_newest_label(rcu_dereference(fctx->label));
622− rcu_read_unlock();
621+ flabel = rcu_dereference(fctx->label);
623622 AA_BUG(!flabel);
624623
625624 /* revalidate access, if task is unconfined, or the cached cred
@@ -631,9 +630,13 @@ int aa_file_perm(const char *op, struct aa_label *label, struct file *file, · 5 unmodified lines
631630 */
632631 denied = request & ~fctx->allow;
633632 if (unconfined(label) || unconfined(flabel) ||
634− (!denied && aa_label_is_subset(flabel, label)))
633+ (!denied && aa_label_is_subset(flabel, label))) {
634+ rcu_read_unlock();
635635 goto done;
636+ }
636637
638+ flabel = aa_get_newest_label(flabel);
639+ rcu_read_unlock();
637640 /* TODO: label cross check */
638641
639642 if (file->f_path.mnt && path_mediated_fs(file->f_path.dentry))
@@ -643,8 +646,9 @@ int aa_file_perm(const char *op, struct aa_label *label, struct file *file, · 3 unmodified lines
643646 else if (S_ISSOCK(file_inode(file)->i_mode))
644647 error = __file_sock_perm(op, label, flabel, file, request,
645648 denied);
646−done:
647649 aa_put_label(flabel);
650+
651+done:
648652 return error;
649653 }
650654
security/apparmor/mount.c+1−1
@@ -442,7 +442,7 @@ int aa_bind_mount(struct aa_label *label, const struct path *path, · 441 unmodified lines
442442 buffer = aa_get_buffer(false);
443443 old_buffer = aa_get_buffer(false);
444444 error = -ENOMEM;
445− if (!buffer || old_buffer)
445+ if (!buffer || !old_buffer)
446446 goto out;
447447
448448 error = fn_for_each_confined(label, profile,
security/apparmor/policy.c+2−2
@@ -1125,8 +1125,8 @@ ssize_t aa_remove_profiles(struct aa_ns *policy_ns, struct aa_label *subj, · 1124 unmodified lines
11251125 if (!name) {
11261126 /* remove namespace - can only happen if fqname[0] == ':' */
11271127 mutex_lock_nested(&ns->parent->lock, ns->level);
1128− __aa_remove_ns(ns);
11291128 __aa_bump_ns_revision(ns);
1129+ __aa_remove_ns(ns);
11301130 mutex_unlock(&ns->parent->lock);
11311131 } else {
11321132 /* remove profile */
@@ -1138,9 +1138,9 @@ ssize_t aa_remove_profiles(struct aa_ns *policy_ns, struct aa_label *subj, · 5 unmodified lines
11381138 goto fail_ns_lock;
11391139 }
11401140 name = profile->base.hname;
1141+ __aa_bump_ns_revision(ns);
11411142 __remove_profile(profile);
11421143 __aa_labelset_update_subtree(ns);
1143− __aa_bump_ns_revision(ns);
11441144 mutex_unlock(&ns->lock);
11451145 }
11461146
security/tomoyo/common.c+6−3
@@ -951,7 +951,8 @@ static bool tomoyo_manager(void) · 950 unmodified lines
951951 exe = tomoyo_get_exe();
952952 if (!exe)
953953 return false;
954− list_for_each_entry_rcu(ptr, &tomoyo_kernel_namespace.policy_list[TOMOYO_ID_MANAGER], head.list) {
954+ list_for_each_entry_rcu(ptr, &tomoyo_kernel_namespace.policy_list[TOMOYO_ID_MANAGER], head.list,
955+ srcu_read_lock_held(&tomoyo_ss)) {
955956 if (!ptr->head.is_deleted &&
956957 (!tomoyo_pathcmp(domainname, ptr->manager) ||
957958 !strcmp(exe, ptr->manager->name))) {
@@ -1095,7 +1096,8 @@ static int tomoyo_delete_domain(char *domainname) · 137 unmodified lines
10951096 if (mutex_lock_interruptible(&tomoyo_policy_lock))
10961097 return -EINTR;
10971098 /* Is there an active domain? */
1098− list_for_each_entry_rcu(domain, &tomoyo_domain_list, list) {
1099+ list_for_each_entry_rcu(domain, &tomoyo_domain_list, list,
1100+ srcu_read_lock_held(&tomoyo_ss)) {
10991101 /* Never delete tomoyo_kernel_domain */
11001102 if (domain == &tomoyo_kernel_domain)
11011103 continue;
@@ -2778,7 +2780,8 @@ void tomoyo_check_profile(void) · 1676 unmodified lines
27782780
27792781 tomoyo_policy_loaded = true;
27802782 pr_info("TOMOYO: 2.6.0\n");
2781− list_for_each_entry_rcu(domain, &tomoyo_domain_list, list) {
2783+ list_for_each_entry_rcu(domain, &tomoyo_domain_list, list,
2784+ srcu_read_lock_held(&tomoyo_ss)) {
27822785 const u8 profile = domain->profile;
27832786 struct tomoyo_policy_namespace *ns = domain->ns;
27842787
security/tomoyo/domain.c+10−5
@@ -41,7 +41,8 @@ int tomoyo_update_policy(struct tomoyo_acl_head *new_entry, const int size, · 40 unmodified lines
4141
4242 if (mutex_lock_interruptible(&tomoyo_policy_lock))
4343 return -ENOMEM;
44− list_for_each_entry_rcu(entry, list, list) {
44+ list_for_each_entry_rcu(entry, list, list,
45+ srcu_read_lock_held(&tomoyo_ss)) {
4546 if (entry->is_deleted == TOMOYO_GC_IN_PROGRESS)
4647 continue;
4748 if (!check_duplicate(entry, new_entry))
@@ -119,7 +120,8 @@ int tomoyo_update_domain(struct tomoyo_acl_info *new_entry, const int size, · 71 unmodified lines
119120 }
120121 if (mutex_lock_interruptible(&tomoyo_policy_lock))
121122 goto out;
122− list_for_each_entry_rcu(entry, list, list) {
123+ list_for_each_entry_rcu(entry, list, list,
124+ srcu_read_lock_held(&tomoyo_ss)) {
123125 if (entry->is_deleted == TOMOYO_GC_IN_PROGRESS)
124126 continue;
125127 if (!tomoyo_same_acl_head(entry, new_entry) ||
@@ -166,7 +168,8 @@ void tomoyo_check_acl(struct tomoyo_request_info *r, · 40 unmodified lines
166168 u16 i = 0;
167169
168170 retry:
169− list_for_each_entry_rcu(ptr, list, list) {
171+ list_for_each_entry_rcu(ptr, list, list,
172+ srcu_read_lock_held(&tomoyo_ss)) {
170173 if (ptr->is_deleted || ptr->type != r->param_type)
171174 continue;
172175 if (!check_entry(r, ptr))
@@ -298,7 +301,8 @@ static inline bool tomoyo_scan_transition · 125 unmodified lines
298301 {
299302 const struct tomoyo_transition_control *ptr;
300303
301− list_for_each_entry_rcu(ptr, list, head.list) {
304+ list_for_each_entry_rcu(ptr, list, head.list,
305+ srcu_read_lock_held(&tomoyo_ss)) {
302306 if (ptr->head.is_deleted || ptr->type != type)
303307 continue;
304308 if (ptr->domainname) {
@@ -735,7 +739,8 @@ retry: · 430 unmodified lines
735739
736740 /* Check 'aggregator' directive. */
737741 candidate = &exename;
738− list_for_each_entry_rcu(ptr, list, head.list) {
742+ list_for_each_entry_rcu(ptr, list, head.list,
743+ srcu_read_lock_held(&tomoyo_ss)) {
739744 if (ptr->head.is_deleted ||
740745 !tomoyo_path_matches_pattern(&exename,
741746 ptr->original_name))
security/tomoyo/group.c+6−3
@@ -133,7 +133,8 @@ tomoyo_path_matches_group(const struct tomoyo_path_info *pathname, · 132 unmodified lines
133133 {
134134 struct tomoyo_path_group *member;
135135
136− list_for_each_entry_rcu(member, &group->member_list, head.list) {
136+ list_for_each_entry_rcu(member, &group->member_list, head.list,
137+ srcu_read_lock_held(&tomoyo_ss)) {
137138 if (member->head.is_deleted)
138139 continue;
139140 if (!tomoyo_path_matches_pattern(pathname, member->member_name))
@@ -161,7 +162,8 @@ bool tomoyo_number_matches_group(const unsigned long min, · 21 unmodified lines
161162 struct tomoyo_number_group *member;
162163 bool matched = false;
163164
164− list_for_each_entry_rcu(member, &group->member_list, head.list) {
165+ list_for_each_entry_rcu(member, &group->member_list, head.list,
166+ srcu_read_lock_held(&tomoyo_ss)) {
165167 if (member->head.is_deleted)
166168 continue;
167169 if (min > member->number.values[1] ||
@@ -191,7 +193,8 @@ bool tomoyo_address_matches_group(const bool is_ipv6, const __be32 *address, · 23 unmodified lines
191193 bool matched = false;
192194 const u8 size = is_ipv6 ? 16 : 4;
193195
194− list_for_each_entry_rcu(member, &group->member_list, head.list) {
196+ list_for_each_entry_rcu(member, &group->member_list, head.list,
197+ srcu_read_lock_held(&tomoyo_ss)) {
195198 if (member->head.is_deleted)
196199 continue;
197200 if (member->address.is_ipv6 != is_ipv6)
security/tomoyo/realpath.c+1−31
@@ -217,31 +217,6 @@ out: · 216 unmodified lines
217217 return ERR_PTR(-ENOMEM);
218218 }
219219
220−/**
221− * tomoyo_get_socket_name - Get the name of a socket.
222− *
223− * @path: Pointer to "struct path".
224− * @buffer: Pointer to buffer to return value in.
225− * @buflen: Sizeof @buffer.
226− *
227− * Returns the buffer.
228− */
229−static char *tomoyo_get_socket_name(const struct path *path, char * const buffer,
230− const int buflen)
231−{
232− struct inode *inode = d_backing_inode(path->dentry);
233− struct socket *sock = inode ? SOCKET_I(inode) : NULL;
234− struct sock *sk = sock ? sock->sk : NULL;
235−
236− if (sk) {
237− snprintf(buffer, buflen, "socket:[family=%u:type=%u:protocol=%u]",
238− sk->sk_family, sk->sk_type, sk->sk_protocol);
239− } else {
240− snprintf(buffer, buflen, "socket:[unknown]");
241− }
242− return buffer;
243−}
244−
245220 /**
246221 * tomoyo_realpath_from_path - Returns realpath(3) of the given pathname but ignores chroot'ed root.
247222 *
@@ -279,12 +254,7 @@ char *tomoyo_realpath_from_path(const struct path *path) · 31 unmodified lines
279254 break;
280255 /* To make sure that pos is '\0' terminated. */
281256 buf[buf_len - 1] = '\0';
282− /* Get better name for socket. */
283− if (sb->s_magic == SOCKFS_MAGIC) {
284− pos = tomoyo_get_socket_name(path, buf, buf_len - 1);
285− goto encode;
286− }
287− /* For "pipe:[\$]". */
257+ /* For "pipe:[\$]" and "socket:[\$]". */
288258 if (dentry->d_op && dentry->d_op->d_dname) {
289259 pos = dentry->d_op->d_dname(dentry, buf, buf_len - 1);
290260 goto encode;
security/tomoyo/util.c+4−2
@@ -594,7 +594,8 @@ struct tomoyo_domain_info *tomoyo_find_domain(const char *domainname) · 593 unmodified lines
594594
595595 name.name = domainname;
596596 tomoyo_fill_path_info(&name);
597− list_for_each_entry_rcu(domain, &tomoyo_domain_list, list) {
597+ list_for_each_entry_rcu(domain, &tomoyo_domain_list, list,
598+ srcu_read_lock_held(&tomoyo_ss)) {
598599 if (!domain->is_deleted &&
599600 !tomoyo_pathcmp(&name, domain->domainname))
600601 return domain;
@@ -1028,7 +1029,8 @@ bool tomoyo_domain_quota_is_ok(struct tomoyo_request_info *r) · 427 unmodified lines
10281029 return false;
10291030 if (!domain)
10301031 return true;
1031− list_for_each_entry_rcu(ptr, &domain->acl_info_list, list) {
1032+ list_for_each_entry_rcu(ptr, &domain->acl_info_list, list,
1033+ srcu_read_lock_held(&tomoyo_ss)) {
10321034 u16 perm;
10331035 u8 i;
10341036
sound/hda/hdac_regmap.c+0−1
@@ -363,7 +363,6 @@ static const struct regmap_config hda_regmap_cfg = { · 362 unmodified lines
363363 .reg_write = hda_reg_write,
364364 .use_single_read = true,
365365 .use_single_write = true,
366− .disable_locking = true,
367366 };
368367
369368 /**
sound/pci/hda/hda_intel.c+16−5
@@ -282,12 +282,13 @@ enum { · 281 unmodified lines
282282
283283 /* quirks for old Intel chipsets */
284284 #define AZX_DCAPS_INTEL_ICH \
285− (AZX_DCAPS_OLD_SSYNC | AZX_DCAPS_NO_ALIGN_BUFSIZE)
285+ (AZX_DCAPS_OLD_SSYNC | AZX_DCAPS_NO_ALIGN_BUFSIZE |\
286+ AZX_DCAPS_SYNC_WRITE)
286287
287288 /* quirks for Intel PCH */
288289 #define AZX_DCAPS_INTEL_PCH_BASE \
289290 (AZX_DCAPS_NO_ALIGN_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY |\
290− AZX_DCAPS_SNOOP_TYPE(SCH))
291+ AZX_DCAPS_SNOOP_TYPE(SCH) | AZX_DCAPS_SYNC_WRITE)
291292
292293 /* PCH up to IVB; no runtime PM; bind with i915 gfx */
293294 #define AZX_DCAPS_INTEL_PCH_NOPM \
@@ -302,13 +303,13 @@ enum { · 8 unmodified lines
302303 #define AZX_DCAPS_INTEL_HASWELL \
303304 (/*AZX_DCAPS_ALIGN_BUFSIZE |*/ AZX_DCAPS_COUNT_LPIB_DELAY |\
304305 AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_COMPONENT |\
305− AZX_DCAPS_SNOOP_TYPE(SCH))
306+ AZX_DCAPS_SNOOP_TYPE(SCH) | AZX_DCAPS_SYNC_WRITE)
306307
307308 /* Broadwell HDMI can't use position buffer reliably, force to use LPIB */
308309 #define AZX_DCAPS_INTEL_BROADWELL \
309310 (/*AZX_DCAPS_ALIGN_BUFSIZE |*/ AZX_DCAPS_POSFIX_LPIB |\
310311 AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_COMPONENT |\
311− AZX_DCAPS_SNOOP_TYPE(SCH))
312+ AZX_DCAPS_SNOOP_TYPE(SCH) | AZX_DCAPS_SYNC_WRITE)
312313
313314 #define AZX_DCAPS_INTEL_BAYTRAIL \
314315 (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_I915_COMPONENT)
@@ -1410,7 +1411,17 @@ static bool atpx_present(void) · 1095 unmodified lines
14101411 acpi_handle dhandle, atpx_handle;
14111412 acpi_status status;
14121413
1413− while ((pdev = pci_get_class(PCI_BASE_CLASS_DISPLAY << 16, pdev)) != NULL) {
1414+ while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
1415+ dhandle = ACPI_HANDLE(&pdev->dev);
1416+ if (dhandle) {
1417+ status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
1418+ if (!ACPI_FAILURE(status)) {
1419+ pci_dev_put(pdev);
1420+ return true;
1421+ }
1422+ }
1423+ }
1424+ while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
14141425 dhandle = ACPI_HANDLE(&pdev->dev);
14151426 if (dhandle) {
14161427 status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
sound/pci/hda/patch_realtek.c+36−13
@@ -412,6 +412,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) · 411 unmodified lines
412412 case 0x10ec0672:
413413 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
414414 break;
415+ case 0x10ec0222:
415416 case 0x10ec0623:
416417 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
417418 break;
@@ -430,6 +431,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) · 12 unmodified lines
430431 break;
431432 case 0x10ec0899:
432433 case 0x10ec0900:
434+ case 0x10ec0b00:
433435 case 0x10ec1168:
434436 case 0x10ec1220:
435437 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
@@ -501,6 +503,7 @@ static void alc_shutup_pins(struct hda_codec *codec) · 65 unmodified lines
501503 struct alc_spec *spec = codec->spec;
502504
503505 switch (codec->core.vendor_id) {
506+ case 0x10ec0283:
504507 case 0x10ec0286:
505508 case 0x10ec0288:
506509 case 0x10ec0298:
@@ -2525,6 +2528,7 @@ static int patch_alc882(struct hda_codec *codec) · 2018 unmodified lines
25252528 case 0x10ec0882:
25262529 case 0x10ec0885:
25272530 case 0x10ec0900:
2531+ case 0x10ec0b00:
25282532 case 0x10ec1220:
25292533 break;
25302534 default:
@@ -5904,9 +5908,12 @@ enum { · 3373 unmodified lines
59045908 ALC256_FIXUP_ASUS_HEADSET_MIC,
59055909 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
59065910 ALC299_FIXUP_PREDATOR_SPK,
5907− ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC,
59085911 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
5909− ALC294_FIXUP_ASUS_INTSPK_GPIO,
5912+ ALC289_FIXUP_DELL_SPK2,
5913+ ALC289_FIXUP_DUAL_SPK,
5914+ ALC294_FIXUP_SPK2_TO_DAC1,
5915+ ALC294_FIXUP_ASUS_DUAL_SPK,
5916+
59105917 };
59115918
59125919 static const struct hda_fixup alc269_fixups[] = {
@@ -6981,33 +6988,45 @@ static const struct hda_fixup alc269_fixups[] = { · 1068 unmodified lines
69816988 { }
69826989 }
69836990 },
6984− [ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC] = {
6991+ [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
69856992 .type = HDA_FIXUP_PINS,
69866993 .v.pins = (const struct hda_pintbl[]) {
6987− { 0x14, 0x411111f0 }, /* disable confusing internal speaker */
6988− { 0x19, 0x04a11150 }, /* use as headset mic, without its own jack detect */
6994+ { 0x19, 0x04a11040 },
6995+ { 0x21, 0x04211020 },
69896996 { }
69906997 },
69916998 .chained = true,
6992− .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6999+ .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
69937000 },
6994− [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
7001+ [ALC289_FIXUP_DELL_SPK2] = {
69957002 .type = HDA_FIXUP_PINS,
69967003 .v.pins = (const struct hda_pintbl[]) {
6997− { 0x19, 0x04a11040 },
6998− { 0x21, 0x04211020 },
7004+ { 0x17, 0x90170130 }, /* bass spk */
69997005 { }
70007006 },
70017007 .chained = true,
7002− .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7008+ .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
70037009 },
7004− [ALC294_FIXUP_ASUS_INTSPK_GPIO] = {
7010+ [ALC289_FIXUP_DUAL_SPK] = {
7011+ .type = HDA_FIXUP_FUNC,
7012+ .v.func = alc285_fixup_speaker2_to_dac1,
7013+ .chained = true,
7014+ .chain_id = ALC289_FIXUP_DELL_SPK2
7015+ },
7016+ [ALC294_FIXUP_SPK2_TO_DAC1] = {
7017+ .type = HDA_FIXUP_FUNC,
7018+ .v.func = alc285_fixup_speaker2_to_dac1,
7019+ .chained = true,
7020+ .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7021+ },
7022+ [ALC294_FIXUP_ASUS_DUAL_SPK] = {
70057023 .type = HDA_FIXUP_FUNC,
70067024 /* The GPIO must be pulled to initialize the AMP */
70077025 .v.func = alc_fixup_gpio4,
70087026 .chained = true,
7009− .chain_id = ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC
7027+ .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
70107028 },
7029+
70117030 };
70127031
70137032 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7080,6 +7099,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 66 unmodified lines
70807099 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
70817100 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
70827101 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
7102+ SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
7103+ SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
70837104 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
70847105 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
70857106 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
@@ -7167,7 +7188,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 81 unmodified lines
71677188 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
71687189 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
71697190 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
7170− SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_INTSPK_GPIO),
7191+ SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
71717192 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
71727193 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
71737194 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
@@ -7239,6 +7260,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 65 unmodified lines
72397260 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
72407261 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
72417262 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7263+ SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1),
72427264 SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1),
72437265 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
72447266 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
@@ -9237,6 +9259,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = { · 1992 unmodified lines
92379259 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
92389260 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
92399261 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
9262+ HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
92409263 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
92419264 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
92429265 {} /* terminator */
sound/pci/ice1712/ice1724.c+6−3
@@ -647,6 +647,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, · 646 unmodified lines
647647 unsigned long flags;
648648 unsigned char mclk_change;
649649 unsigned int i, old_rate;
650+ bool call_set_rate = false;
650651
651652 if (rate > ice->hw_rates->list[ice->hw_rates->count - 1])
652653 return -EINVAL;
@@ -670,7 +671,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, · 17 unmodified lines
670671 * setting clock rate for internal clock mode */
671672 old_rate = ice->get_rate(ice);
672673 if (force || (old_rate != rate))
673− ice->set_rate(ice, rate);
674+ call_set_rate = true;
674675 else if (rate == ice->cur_rate) {
675676 spin_unlock_irqrestore(&ice->reg_lock, flags);
676677 return 0;
@@ -678,12 +679,14 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, · 1 unmodified line
678679 }
679680
680681 ice->cur_rate = rate;
682+ spin_unlock_irqrestore(&ice->reg_lock, flags);
683+
684+ if (call_set_rate)
685+ ice->set_rate(ice, rate);
681686
682687 /* setting master clock */
683688 mclk_change = ice->set_mclk(ice, rate);
684689
685− spin_unlock_irqrestore(&ice->reg_lock, flags);
686−
687690 if (mclk_change && ice->gpio.i2s_mclk_changed)
688691 ice->gpio.i2s_mclk_changed(ice);
689692 if (ice->gpio.set_pro_rate)
sound/soc/fsl/fsl_audmix.c+8−1
@@ -505,15 +505,20 @@ static int fsl_audmix_probe(struct platform_device *pdev) · 504 unmodified lines
505505 ARRAY_SIZE(fsl_audmix_dai));
506506 if (ret) {
507507 dev_err(dev, "failed to register ASoC DAI\n");
508− return ret;
508+ goto err_disable_pm;
509509 }
510510
511511 priv->pdev = platform_device_register_data(dev, mdrv, 0, NULL, 0);
512512 if (IS_ERR(priv->pdev)) {
513513 ret = PTR_ERR(priv->pdev);
514514 dev_err(dev, "failed to register platform %s: %d\n", mdrv, ret);
515+ goto err_disable_pm;
515516 }
516517
518+ return 0;
519+
520+err_disable_pm:
521+ pm_runtime_disable(dev);
517522 return ret;
518523 }
519524
@@ -521,6 +526,8 @@ static int fsl_audmix_remove(struct platform_device *pdev) · 1 unmodified line
521526 {
522527 struct fsl_audmix *priv = dev_get_drvdata(&pdev->dev);
523528
529+ pm_runtime_disable(&pdev->dev);
530+
524531 if (priv->pdev)
525532 platform_device_unregister(priv->pdev);
526533
sound/soc/intel/boards/cml_rt1011_rt5682.c+0−1
@@ -11,7 +11,6 @@ · 10 unmodified lines
1111 #include <linux/clk.h>
1212 #include <linux/dmi.h>
1313 #include <linux/slab.h>
14−#include <asm/cpu_device_id.h>
1514 #include <linux/acpi.h>
1615 #include <sound/core.h>
1716 #include <sound/jack.h>
sound/soc/soc-core.c+8−6
@@ -479,6 +479,12 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( · 478 unmodified lines
479479 goto free_rtd;
480480
481481 rtd->dev = dev;
482+ INIT_LIST_HEAD(&rtd->list);
483+ INIT_LIST_HEAD(&rtd->component_list);
484+ INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients);
485+ INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].be_clients);
486+ INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].fe_clients);
487+ INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].fe_clients);
482488 dev_set_drvdata(dev, rtd);
483489 INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work);
484490
@@ -494,12 +500,6 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( · 9 unmodified lines
494500 /*
495501 * rtd remaining settings
496502 */
497− INIT_LIST_HEAD(&rtd->component_list);
498− INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients);
499− INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].be_clients);
500− INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].fe_clients);
501− INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].fe_clients);
502−
503503 rtd->card = card;
504504 rtd->dai_link = dai_link;
505505 if (!rtd->dai_link->ops)
@@ -1871,6 +1871,8 @@ match: · 1365 unmodified lines
18711871
18721872 /* convert non BE into BE */
18731873 dai_link->no_pcm = 1;
1874+ dai_link->dpcm_playback = 1;
1875+ dai_link->dpcm_capture = 1;
18741876
18751877 /* override any BE fixups */
18761878 dai_link->be_hw_params_fixup =
sound/soc/soc-topology.c+3−3
@@ -548,12 +548,12 @@ static void remove_link(struct snd_soc_component *comp, · 547 unmodified lines
548548 if (dobj->ops && dobj->ops->link_unload)
549549 dobj->ops->link_unload(comp, dobj);
550550
551+ list_del(&dobj->list);
552+ snd_soc_remove_dai_link(comp->card, link);
553+
551554 kfree(link->name);
552555 kfree(link->stream_name);
553556 kfree(link->cpus->dai_name);
554−
555− list_del(&dobj->list);
556− snd_soc_remove_dai_link(comp->card, link);
557557 kfree(link);
558558 }
559559
sound/soc/sof/imx/imx8.c+4−1
@@ -209,7 +209,7 @@ static int imx8_probe(struct snd_sof_dev *sdev) · 208 unmodified lines
209209
210210 priv->pd_dev = devm_kmalloc_array(&pdev->dev, priv->num_domains,
211211 sizeof(*priv->pd_dev), GFP_KERNEL);
212− if (!priv)
212+ if (!priv->pd_dev)
213213 return -ENOMEM;
214214
215215 priv->link = devm_kmalloc_array(&pdev->dev, priv->num_domains,
@@ -304,6 +304,9 @@ static int imx8_probe(struct snd_sof_dev *sdev) · 88 unmodified lines
304304 }
305305 sdev->mailbox_bar = SOF_FW_BLK_TYPE_SRAM;
306306
307+ /* set default mailbox offset for FW ready message */
308+ sdev->dsp_box.offset = MBOX_OFFSET;
309+
307310 return 0;
308311
309312 exit_pdev_unregister:
sound/soc/sof/intel/hda-dai.c+9−2
@@ -216,6 +216,8 @@ static int hda_link_hw_params(struct snd_pcm_substream *substream, · 215 unmodified lines
216216 link_dev = hda_link_stream_assign(bus, substream);
217217 if (!link_dev)
218218 return -EBUSY;
219+
220+ snd_soc_dai_set_dma_data(dai, substream, (void *)link_dev);
219221 }
220222
221223 stream_tag = hdac_stream(link_dev)->stream_tag;
@@ -228,8 +230,6 @@ static int hda_link_hw_params(struct snd_pcm_substream *substream, · 6 unmodified lines
228230 if (ret < 0)
229231 return ret;
230232
231− snd_soc_dai_set_dma_data(dai, substream, (void *)link_dev);
232−
233233 link = snd_hdac_ext_bus_get_link(bus, codec_dai->component->name);
234234 if (!link)
235235 return -EINVAL;
@@ -361,6 +361,13 @@ static int hda_link_hw_free(struct snd_pcm_substream *substream, · 125 unmodified lines
361361 bus = hstream->bus;
362362 rtd = snd_pcm_substream_chip(substream);
363363 link_dev = snd_soc_dai_get_dma_data(dai, substream);
364+
365+ if (!link_dev) {
366+ dev_dbg(dai->dev,
367+ "%s: link_dev is not assigned\n", __func__);
368+ return -EINVAL;
369+ }
370+
364371 hda_stream = hstream_to_sof_hda_stream(link_dev);
365372
366373 /* free the link DMA channel in the FW */
sound/soc/sof/ipc.c+3−0
@@ -826,6 +826,9 @@ void snd_sof_ipc_free(struct snd_sof_dev *sdev) · 825 unmodified lines
826826 {
827827 struct snd_sof_ipc *ipc = sdev->ipc;
828828
829+ if (!ipc)
830+ return;
831+
829832 /* disable sending of ipc's */
830833 mutex_lock(&ipc->tx_mutex);
831834 ipc->disable_ipc_tx = true;
sound/soc/stm/stm32_spdifrx.c+26−14
@@ -12,7 +12,6 @@ · 11 unmodified lines
1212 #include <linux/delay.h>
1313 #include <linux/module.h>
1414 #include <linux/of_platform.h>
15−#include <linux/pinctrl/consumer.h>
1615 #include <linux/regmap.h>
1716 #include <linux/reset.h>
1817
@@ -220,6 +219,7 @@ · 201 unmodified lines
220219 * @slave_config: dma slave channel runtime config pointer
221220 * @phys_addr: SPDIFRX registers physical base address
222221 * @lock: synchronization enabling lock
222+ * @irq_lock: prevent race condition with IRQ on stream state
223223 * @cs: channel status buffer
224224 * @ub: user data buffer
225225 * @irq: SPDIFRX interrupt line
@@ -240,6 +240,7 @@ struct stm32_spdifrx_data { · 14 unmodified lines
240240 struct dma_slave_config slave_config;
241241 dma_addr_t phys_addr;
242242 spinlock_t lock; /* Sync enabling lock */
243+ spinlock_t irq_lock; /* Prevent race condition on stream state */
243244 unsigned char cs[SPDIFRX_CS_BYTES_NB];
244245 unsigned char ub[SPDIFRX_UB_BYTES_NB];
245246 int irq;
@@ -320,6 +321,7 @@ static void stm32_spdifrx_dma_ctrl_stop(struct stm32_spdifrx_data *spdifrx) · 74 unmodified lines
320321 static int stm32_spdifrx_start_sync(struct stm32_spdifrx_data *spdifrx)
321322 {
322323 int cr, cr_mask, imr, ret;
324+ unsigned long flags;
323325
324326 /* Enable IRQs */
325327 imr = SPDIFRX_IMR_IFEIE | SPDIFRX_IMR_SYNCDIE | SPDIFRX_IMR_PERRIE;
@@ -327,7 +329,7 @@ static int stm32_spdifrx_start_sync(struct stm32_spdifrx_data *spdifrx) · 1 unmodified line
327329 if (ret)
328330 return ret;
329331
330− spin_lock(&spdifrx->lock);
332+ spin_lock_irqsave(&spdifrx->lock, flags);
331333
332334 spdifrx->refcount++;
333335
@@ -362,7 +364,7 @@ static int stm32_spdifrx_start_sync(struct stm32_spdifrx_data *spdifrx) · 28 unmodified lines
362364 "Failed to start synchronization\n");
363365 }
364366
365− spin_unlock(&spdifrx->lock);
367+ spin_unlock_irqrestore(&spdifrx->lock, flags);
366368
367369 return ret;
368370 }
@@ -370,11 +372,12 @@ static int stm32_spdifrx_start_sync(struct stm32_spdifrx_data *spdifrx) · 1 unmodified line
370372 static void stm32_spdifrx_stop(struct stm32_spdifrx_data *spdifrx)
371373 {
372374 int cr, cr_mask, reg;
375+ unsigned long flags;
373376
374− spin_lock(&spdifrx->lock);
377+ spin_lock_irqsave(&spdifrx->lock, flags);
375378
376379 if (--spdifrx->refcount) {
377− spin_unlock(&spdifrx->lock);
380+ spin_unlock_irqrestore(&spdifrx->lock, flags);
378381 return;
379382 }
380383
@@ -393,7 +396,7 @@ static void stm32_spdifrx_stop(struct stm32_spdifrx_data *spdifrx) · 12 unmodified lines
393396 regmap_read(spdifrx->regmap, STM32_SPDIFRX_DR, &reg);
394397 regmap_read(spdifrx->regmap, STM32_SPDIFRX_CSR, &reg);
395398
396− spin_unlock(&spdifrx->lock);
399+ spin_unlock_irqrestore(&spdifrx->lock, flags);
397400 }
398401
399402 static int stm32_spdifrx_dma_ctrl_register(struct device *dev,
@@ -480,8 +483,6 @@ static int stm32_spdifrx_get_ctrl_data(struct stm32_spdifrx_data *spdifrx) · 80 unmodified lines
480483 memset(spdifrx->cs, 0, SPDIFRX_CS_BYTES_NB);
481484 memset(spdifrx->ub, 0, SPDIFRX_UB_BYTES_NB);
482485
483− pinctrl_pm_select_default_state(&spdifrx->pdev->dev);
484−
485486 ret = stm32_spdifrx_dma_ctrl_start(spdifrx);
486487 if (ret < 0)
487488 return ret;
@@ -513,7 +514,6 @@ static int stm32_spdifrx_get_ctrl_data(struct stm32_spdifrx_data *spdifrx) · 25 unmodified lines
513514
514515 end:
515516 clk_disable_unprepare(spdifrx->kclk);
516− pinctrl_pm_select_sleep_state(&spdifrx->pdev->dev);
517517
518518 return ret;
519519 }
@@ -665,7 +665,6 @@ static const struct regmap_config stm32_h7_spdifrx_regmap_conf = { · 145 unmodified lines
665665 static irqreturn_t stm32_spdifrx_isr(int irq, void *devid)
666666 {
667667 struct stm32_spdifrx_data *spdifrx = (struct stm32_spdifrx_data *)devid;
668− struct snd_pcm_substream *substream = spdifrx->substream;
669668 struct platform_device *pdev = spdifrx->pdev;
670669 unsigned int cr, mask, sr, imr;
671670 unsigned int flags, sync_state;
@@ -745,14 +744,19 @@ static irqreturn_t stm32_spdifrx_isr(int irq, void *devid) · 73 unmodified lines
745744 return IRQ_HANDLED;
746745 }
747746
748− if (substream)
749− snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED);
747+ spin_lock(&spdifrx->irq_lock);
748+ if (spdifrx->substream)
749+ snd_pcm_stop(spdifrx->substream,
750+ SNDRV_PCM_STATE_DISCONNECTED);
751+ spin_unlock(&spdifrx->irq_lock);
750752
751753 return IRQ_HANDLED;
752754 }
753755
754− if (err_xrun && substream)
755− snd_pcm_stop_xrun(substream);
756+ spin_lock(&spdifrx->irq_lock);
757+ if (err_xrun && spdifrx->substream)
758+ snd_pcm_stop_xrun(spdifrx->substream);
759+ spin_unlock(&spdifrx->irq_lock);
756760
757761 return IRQ_HANDLED;
758762 }
@@ -761,9 +765,12 @@ static int stm32_spdifrx_startup(struct snd_pcm_substream *substream, · 2 unmodified lines
761765 struct snd_soc_dai *cpu_dai)
762766 {
763767 struct stm32_spdifrx_data *spdifrx = snd_soc_dai_get_drvdata(cpu_dai);
768+ unsigned long flags;
764769 int ret;
765770
771+ spin_lock_irqsave(&spdifrx->irq_lock, flags);
766772 spdifrx->substream = substream;
773+ spin_unlock_irqrestore(&spdifrx->irq_lock, flags);
767774
768775 ret = clk_prepare_enable(spdifrx->kclk);
769776 if (ret)
@@ -839,8 +846,12 @@ static void stm32_spdifrx_shutdown(struct snd_pcm_substream *substream, · 69 unmodified lines
839846 struct snd_soc_dai *cpu_dai)
840847 {
841848 struct stm32_spdifrx_data *spdifrx = snd_soc_dai_get_drvdata(cpu_dai);
849+ unsigned long flags;
842850
851+ spin_lock_irqsave(&spdifrx->irq_lock, flags);
843852 spdifrx->substream = NULL;
853+ spin_unlock_irqrestore(&spdifrx->irq_lock, flags);
854+
844855 clk_disable_unprepare(spdifrx->kclk);
845856 }
846857
@@ -944,6 +955,7 @@ static int stm32_spdifrx_probe(struct platform_device *pdev) · 97 unmodified lines
944955 spdifrx->pdev = pdev;
945956 init_completion(&spdifrx->cs_completion);
946957 spin_lock_init(&spdifrx->lock);
958+ spin_lock_init(&spdifrx->irq_lock);
947959
948960 platform_set_drvdata(pdev, spdifrx);
949961
sound/usb/card.h+1−0
@@ -145,6 +145,7 @@ struct snd_usb_substream { · 144 unmodified lines
145145 struct snd_usb_endpoint *sync_endpoint;
146146 unsigned long flags;
147147 bool need_setup_ep; /* (re)configure EP at prepare? */
148+ bool need_setup_fmt; /* (re)configure fmt after resume? */
148149 unsigned int speed; /* USB_SPEED_XXX */
149150
150151 u64 formats; /* format bitmasks (all or'ed) */
sound/usb/pcm.c+21−4
@@ -506,15 +506,15 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) · 505 unmodified lines
506506 if (WARN_ON(!iface))
507507 return -EINVAL;
508508 alts = usb_altnum_to_altsetting(iface, fmt->altsetting);
509− altsd = get_iface_desc(alts);
510− if (WARN_ON(altsd->bAlternateSetting != fmt->altsetting))
509+ if (WARN_ON(!alts))
511510 return -EINVAL;
511+ altsd = get_iface_desc(alts);
512512
513− if (fmt == subs->cur_audiofmt)
513+ if (fmt == subs->cur_audiofmt && !subs->need_setup_fmt)
514514 return 0;
515515
516516 /* close the old interface */
517− if (subs->interface >= 0 && subs->interface != fmt->iface) {
517+ if (subs->interface >= 0 && (subs->interface != fmt->iface || subs->need_setup_fmt)) {
518518 if (!subs->stream->chip->keep_iface) {
519519 err = usb_set_interface(subs->dev, subs->interface, 0);
520520 if (err < 0) {
@@ -528,6 +528,9 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) · 7 unmodified lines
528528 subs->altset_idx = 0;
529529 }
530530
531+ if (subs->need_setup_fmt)
532+ subs->need_setup_fmt = false;
533+
531534 /* set interface */
532535 if (iface->cur_altsetting != alts) {
533536 err = snd_usb_select_mode_quirk(subs, fmt);
@@ -1728,6 +1731,13 @@ static int snd_usb_substream_playback_trigger(struct snd_pcm_substream *substrea · 1194 unmodified lines
17281731 subs->data_endpoint->retire_data_urb = retire_playback_urb;
17291732 subs->running = 0;
17301733 return 0;
1734+ case SNDRV_PCM_TRIGGER_SUSPEND:
1735+ if (subs->stream->chip->setup_fmt_after_resume_quirk) {
1736+ stop_endpoints(subs, true);
1737+ subs->need_setup_fmt = true;
1738+ return 0;
1739+ }
1740+ break;
17311741 }
17321742
17331743 return -EINVAL;
@@ -1760,6 +1770,13 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream · 26 unmodified lines
17601770 subs->data_endpoint->retire_data_urb = retire_capture_urb;
17611771 subs->running = 1;
17621772 return 0;
1773+ case SNDRV_PCM_TRIGGER_SUSPEND:
1774+ if (subs->stream->chip->setup_fmt_after_resume_quirk) {
1775+ stop_endpoints(subs, true);
1776+ subs->need_setup_fmt = true;
1777+ return 0;
1778+ }
1779+ break;
17631780 }
17641781
17651782 return -EINVAL;
sound/usb/quirks-table.h+2−1
@@ -3466,7 +3466,8 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), · 3465 unmodified lines
34663466 .vendor_name = "Dell",
34673467 .product_name = "WD19 Dock",
34683468 .profile_name = "Dell-WD15-Dock",
3469− .ifnum = QUIRK_NO_INTERFACE
3469+ .ifnum = QUIRK_ANY_INTERFACE,
3470+ .type = QUIRK_SETUP_FMT_AFTER_RESUME
34703471 }
34713472 },
34723473 /* MOTU Microbook II */
sound/usb/quirks.c+12−0
@@ -508,6 +508,16 @@ static int create_standard_mixer_quirk(struct snd_usb_audio *chip, · 507 unmodified lines
508508 return snd_usb_create_mixer(chip, quirk->ifnum, 0);
509509 }
510510
511+
512+static int setup_fmt_after_resume_quirk(struct snd_usb_audio *chip,
513+ struct usb_interface *iface,
514+ struct usb_driver *driver,
515+ const struct snd_usb_audio_quirk *quirk)
516+{
517+ chip->setup_fmt_after_resume_quirk = 1;
518+ return 1; /* Continue with creating streams and mixer */
519+}
520+
511521 /*
512522 * audio-interface quirks
513523 *
@@ -546,6 +556,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip, · 32 unmodified lines
546556 [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk,
547557 [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk,
548558 [QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk,
559+ [QUIRK_SETUP_FMT_AFTER_RESUME] = setup_fmt_after_resume_quirk,
549560 };
550561
551562 if (quirk->type < QUIRK_TYPE_COUNT) {
@@ -1386,6 +1397,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) · 834 unmodified lines
13861397 case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */
13871398 case USB_ID(0x0556, 0x0014): /* Phoenix Audio TMX320VC */
13881399 case USB_ID(0x05A3, 0x9420): /* ELP HD USB Camera */
1400+ case USB_ID(0x05a7, 0x1020): /* Bose Companion 5 */
13891401 case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */
13901402 case USB_ID(0x1395, 0x740a): /* Sennheiser DECT */
13911403 case USB_ID(0x1901, 0x0191): /* GE B850V3 CP2114 audio interface */
sound/usb/usbaudio.h+2−1
@@ -33,7 +33,7 @@ struct snd_usb_audio { · 32 unmodified lines
3333 wait_queue_head_t shutdown_wait;
3434 unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */
3535 unsigned int tx_length_quirk:1; /* Put length specifier in transfers */
36−
36+ unsigned int setup_fmt_after_resume_quirk:1; /* setup the format to interface after resume */
3737 int num_interfaces;
3838 int num_suspended_intf;
3939 int sample_rate_read_error;
@@ -98,6 +98,7 @@ enum quirk_type { · 58 unmodified lines
9898 QUIRK_AUDIO_EDIROL_UAXX,
9999 QUIRK_AUDIO_ALIGN_TRANSFER,
100100 QUIRK_AUDIO_STANDARD_MIXER,
101+ QUIRK_SETUP_FMT_AFTER_RESUME,
101102
102103 QUIRK_TYPE_COUNT
103104 };
tools/lib/bpf/Makefile+8−7
@@ -138,6 +138,7 @@ STATIC_OBJDIR := $(OUTPUT)staticobjs/ · 137 unmodified lines
138138 BPF_IN_SHARED := $(SHARED_OBJDIR)libbpf-in.o
139139 BPF_IN_STATIC := $(STATIC_OBJDIR)libbpf-in.o
140140 VERSION_SCRIPT := libbpf.map
141+BPF_HELPER_DEFS := $(OUTPUT)bpf_helper_defs.h
141142
142143 LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET))
143144 LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
@@ -159,7 +160,7 @@ all: fixdep · 15 unmodified lines
159160
160161 all_cmd: $(CMD_TARGETS) check
161162
162−$(BPF_IN_SHARED): force elfdep bpfdep bpf_helper_defs.h
163+$(BPF_IN_SHARED): force elfdep bpfdep $(BPF_HELPER_DEFS)
163164 @(test -f ../../include/uapi/linux/bpf.h -a -f ../../../include/uapi/linux/bpf.h && ( \
164165 (diff -B ../../include/uapi/linux/bpf.h ../../../include/uapi/linux/bpf.h >/dev/null) || \
165166 echo "Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h'" >&2 )) || true
@@ -177,12 +178,12 @@ $(BPF_IN_SHARED): force elfdep bpfdep bpf_helper_defs.h · 11 unmodified lines
177178 echo "Warning: Kernel ABI header at 'tools/include/uapi/linux/if_xdp.h' differs from latest version at 'include/uapi/linux/if_xdp.h'" >&2 )) || true
178179 $(Q)$(MAKE) $(build)=libbpf OUTPUT=$(SHARED_OBJDIR) CFLAGS="$(CFLAGS) $(SHLIB_FLAGS)"
179180
180−$(BPF_IN_STATIC): force elfdep bpfdep bpf_helper_defs.h
181+$(BPF_IN_STATIC): force elfdep bpfdep $(BPF_HELPER_DEFS)
181182 $(Q)$(MAKE) $(build)=libbpf OUTPUT=$(STATIC_OBJDIR)
182183
183−bpf_helper_defs.h: $(srctree)/tools/include/uapi/linux/bpf.h
184+$(BPF_HELPER_DEFS): $(srctree)/tools/include/uapi/linux/bpf.h
184185 $(Q)$(srctree)/scripts/bpf_helpers_doc.py --header \
185− --file $(srctree)/tools/include/uapi/linux/bpf.h > bpf_helper_defs.h
186+ --file $(srctree)/tools/include/uapi/linux/bpf.h > $(BPF_HELPER_DEFS)
186187
187188 $(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION)
188189
@@ -243,7 +244,7 @@ install_lib: all_cmd · 54 unmodified lines
243244 $(call do_install_mkdir,$(libdir_SQ)); \
244245 cp -fpR $(LIB_FILE) $(DESTDIR)$(libdir_SQ)
245246
246−install_headers: bpf_helper_defs.h
247+install_headers: $(BPF_HELPER_DEFS)
247248 $(call QUIET_INSTALL, headers) \
248249 $(call do_install,bpf.h,$(prefix)/include/bpf,644); \
249250 $(call do_install,libbpf.h,$(prefix)/include/bpf,644); \
@@ -251,7 +252,7 @@ install_headers: bpf_helper_defs.h · 1 unmodified line
251252 $(call do_install,libbpf_util.h,$(prefix)/include/bpf,644); \
252253 $(call do_install,xsk.h,$(prefix)/include/bpf,644); \
253254 $(call do_install,bpf_helpers.h,$(prefix)/include/bpf,644); \
254− $(call do_install,bpf_helper_defs.h,$(prefix)/include/bpf,644); \
255+ $(call do_install,$(BPF_HELPER_DEFS),$(prefix)/include/bpf,644); \
255256 $(call do_install,bpf_tracing.h,$(prefix)/include/bpf,644); \
256257 $(call do_install,bpf_endian.h,$(prefix)/include/bpf,644); \
257258 $(call do_install,bpf_core_read.h,$(prefix)/include/bpf,644);
@@ -271,7 +272,7 @@ config-clean: · 13 unmodified lines
271272 clean:
272273 $(call QUIET_CLEAN, libbpf) $(RM) -rf $(CMD_TARGETS) \
273274 *.o *~ *.a *.so *.so.$(LIBBPF_MAJOR_VERSION) .*.d .*.cmd \
274− *.pc LIBBPF-CFLAGS bpf_helper_defs.h \
275+ *.pc LIBBPF-CFLAGS $(BPF_HELPER_DEFS) \
275276 $(SHARED_OBJDIR) $(STATIC_OBJDIR)
276277 $(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
277278
tools/testing/kunit/kunit.py+11−7
@@ -31,15 +31,12 @@ class KunitStatus(Enum): · 30 unmodified lines
3131 TEST_FAILURE = auto()
3232
3333 def create_default_kunitconfig():
34− if not os.path.exists(kunit_kernel.KUNITCONFIG_PATH):
34+ if not os.path.exists(kunit_kernel.kunitconfig_path):
3535 shutil.copyfile('arch/um/configs/kunit_defconfig',
36− kunit_kernel.KUNITCONFIG_PATH)
36+ kunit_kernel.kunitconfig_path)
3737
3838 def run_tests(linux: kunit_kernel.LinuxSourceTree,
3939 request: KunitRequest) -> KunitResult:
40− if request.defconfig:
41− create_default_kunitconfig()
42−
4340 config_start = time.time()
4441 success = linux.build_reconfig(request.build_dir)
4542 config_end = time.time()
@@ -108,15 +105,22 @@ def main(argv, linux=None): · 62 unmodified lines
108105 run_parser.add_argument('--build_dir',
109106 help='As in the make command, it specifies the build '
110107 'directory.',
111− type=str, default=None, metavar='build_dir')
108+ type=str, default='', metavar='build_dir')
112109
113110 run_parser.add_argument('--defconfig',
114− help='Uses a default kunitconfig.',
111+ help='Uses a default .kunitconfig.',
115112 action='store_true')
116113
117114 cli_args = parser.parse_args(argv)
118115
119116 if cli_args.subcommand == 'run':
117+ if cli_args.build_dir:
118+ if not os.path.exists(cli_args.build_dir):
119+ os.mkdir(cli_args.build_dir)
120+ kunit_kernel.kunitconfig_path = os.path.join(
121+ cli_args.build_dir,
122+ kunit_kernel.kunitconfig_path)
123+
120124 if cli_args.defconfig:
121125 create_default_kunitconfig()
122126
tools/testing/kunit/kunit_kernel.py+5−5
@@ -14,7 +14,7 @@ import os · 13 unmodified lines
1414 import kunit_config
1515
1616 KCONFIG_PATH = '.config'
17−KUNITCONFIG_PATH = 'kunitconfig'
17+kunitconfig_path = '.kunitconfig'
1818
1919 class ConfigError(Exception):
2020 """Represents an error trying to configure the Linux kernel."""
@@ -82,7 +82,7 @@ class LinuxSourceTree(object): · 61 unmodified lines
8282
8383 def __init__(self):
8484 self._kconfig = kunit_config.Kconfig()
85− self._kconfig.read_from_file(KUNITCONFIG_PATH)
85+ self._kconfig.read_from_file(kunitconfig_path)
8686 self._ops = LinuxSourceTreeOperations()
8787
8888 def clean(self):
@@ -111,7 +111,7 @@ class LinuxSourceTree(object): · 22 unmodified lines
111111 return True
112112
113113 def build_reconfig(self, build_dir):
114− """Creates a new .config if it is not a subset of the kunitconfig."""
114+ """Creates a new .config if it is not a subset of the .kunitconfig."""
115115 kconfig_path = get_kconfig_path(build_dir)
116116 if os.path.exists(kconfig_path):
117117 existing_kconfig = kunit_config.Kconfig()
@@ -140,10 +140,10 @@ class LinuxSourceTree(object): · 22 unmodified lines
140140 return False
141141 return True
142142
143− def run_kernel(self, args=[], timeout=None, build_dir=None):
143+ def run_kernel(self, args=[], timeout=None, build_dir=''):
144144 args.extend(['mem=256M'])
145145 process = self._ops.linux_bin(args, timeout, build_dir)
146− with open('test.log', 'w') as f:
146+ with open(os.path.join(build_dir, 'test.log'), 'w') as f:
147147 for line in process.stdout:
148148 f.write(line.rstrip().decode('ascii') + '\n')
149149 yield line.rstrip().decode('ascii')
tools/testing/kunit/kunit_tool_test.py+9−1
@@ -174,6 +174,7 @@ class KUnitMainTest(unittest.TestCase): · 173 unmodified lines
174174 kunit.main(['run'], self.linux_source_mock)
175175 assert self.linux_source_mock.build_reconfig.call_count == 1
176176 assert self.linux_source_mock.run_kernel.call_count == 1
177+ self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='', timeout=300)
177178 self.print_mock.assert_any_call(StrContains('Testing complete.'))
178179
179180 def test_run_passes_args_fail(self):
@@ -199,7 +200,14 @@ class KUnitMainTest(unittest.TestCase): · 19 unmodified lines
199200 timeout = 3453
200201 kunit.main(['run', '--timeout', str(timeout)], self.linux_source_mock)
201202 assert self.linux_source_mock.build_reconfig.call_count == 1
202− self.linux_source_mock.run_kernel.assert_called_once_with(build_dir=None, timeout=timeout)
203+ self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='', timeout=timeout)
204+ self.print_mock.assert_any_call(StrContains('Testing complete.'))
205+
206+ def test_run_builddir(self):
207+ build_dir = '.kunit'
208+ kunit.main(['run', '--build_dir', build_dir], self.linux_source_mock)
209+ assert self.linux_source_mock.build_reconfig.call_count == 1
210+ self.linux_source_mock.run_kernel.assert_called_once_with(build_dir=build_dir, timeout=300)
203211 self.print_mock.assert_any_call(StrContains('Testing complete.'))
204212
205213 if __name__ == '__main__':
tools/testing/selftests/bpf/.gitignore+1−0
@@ -40,3 +40,4 @@ xdping · 39 unmodified lines
4040 test_cpp
4141 /no_alu32
4242 /bpf_gcc
43+bpf_helper_defs.h
tools/testing/selftests/bpf/Makefile+3−3
@@ -120,9 +120,9 @@ force: · 119 unmodified lines
120120 $(BPFOBJ): force
121121 $(MAKE) -C $(BPFDIR) OUTPUT=$(OUTPUT)/
122122
123−BPF_HELPERS := $(BPFDIR)/bpf_helper_defs.h $(wildcard $(BPFDIR)/bpf_*.h)
124−$(BPFDIR)/bpf_helper_defs.h:
125− $(MAKE) -C $(BPFDIR) OUTPUT=$(OUTPUT)/ bpf_helper_defs.h
123+BPF_HELPERS := $(OUTPUT)/bpf_helper_defs.h $(wildcard $(BPFDIR)/bpf_*.h)
124+$(OUTPUT)/bpf_helper_defs.h:
125+ $(MAKE) -C $(BPFDIR) OUTPUT=$(OUTPUT)/ $(OUTPUT)/bpf_helper_defs.h
126126
127127 # Get Clang's default includes on this system, as opposed to those seen by
128128 # '-target bpf'. This fixes "missing" files on some architectures/distros,
tools/testing/selftests/filesystems/epoll/Makefile+1−1
@@ -1,7 +1,7 @@
11 # SPDX-License-Identifier: GPL-2.0
22
33 CFLAGS += -I../../../../../usr/include/
4−LDFLAGS += -lpthread
4+LDLIBS += -lpthread
55 TEST_GEN_PROGS := epoll_wakeup_test
66
77 include ../../lib.mk
tools/testing/selftests/firmware/fw_lib.sh+6−0
@@ -34,6 +34,12 @@ test_modprobe() · 33 unmodified lines
3434
3535 check_mods()
3636 {
37+ local uid=$(id -u)
38+ if [ $uid -ne 0 ]; then
39+ echo "skip all tests: must be run as root" >&2
40+ exit $ksft_skip
41+ fi
42+
3743 trap "test_modprobe" EXIT
3844 if [ ! -d $DIR ]; then
3945 modprobe test_firmware
tools/testing/selftests/livepatch/functions.sh+14−1
@@ -7,6 +7,9 @@ · 6 unmodified lines
77 MAX_RETRIES=600
88 RETRY_INTERVAL=".1" # seconds
99
10+# Kselftest framework requirement - SKIP code is 4
11+ksft_skip=4
12+
1013 # log(msg) - write message to kernel log
1114 # msg - insightful words
1215 function log() {
@@ -18,7 +21,16 @@ function log() { · 5 unmodified lines
1821 function skip() {
1922 log "SKIP: $1"
2023 echo "SKIP: $1" >&2
21− exit 4
24+ exit $ksft_skip
25+}
26+
27+# root test
28+function is_root() {
29+ uid=$(id -u)
30+ if [ $uid -ne 0 ]; then
31+ echo "skip all tests: must be run as root" >&2
32+ exit $ksft_skip
33+ fi
2234 }
2335
2436 # die(msg) - game over, man
@@ -62,6 +74,7 @@ function set_ftrace_enabled() { · 37 unmodified lines
6274 # for verbose livepatching output and turn on
6375 # the ftrace_enabled sysctl.
6476 function setup_config() {
77+ is_root
6578 push_config
6679 set_dynamic_debug
6780 set_ftrace_enabled 1
tools/testing/selftests/livepatch/test-state.sh+1−2
@@ -8,8 +8,7 @@ MOD_LIVEPATCH=test_klp_state · 7 unmodified lines
88 MOD_LIVEPATCH2=test_klp_state2
99 MOD_LIVEPATCH3=test_klp_state3
1010
11−set_dynamic_debug
12−
11+setup_config
1312
1413 # TEST: Loading and removing a module that modifies the system state
1514
tools/testing/selftests/net/forwarding/loopback.sh+8−0
@@ -1,6 +1,9 @@
11 #!/bin/bash
22 # SPDX-License-Identifier: GPL-2.0
33
4+# Kselftest framework requirement - SKIP code is 4.
5+ksft_skip=4
6+
47 ALL_TESTS="loopback_test"
58 NUM_NETIFS=2
69 source tc_common.sh
@@ -72,6 +75,11 @@ setup_prepare() · 65 unmodified lines
7275
7376 h1_create
7477 h2_create
78+
79+ if ethtool -k $h1 | grep loopback | grep -q fixed; then
80+ log_test "SKIP: dev $h1 does not support loopback feature"
81+ exit $ksft_skip
82+ fi
7583 }
7684
7785 cleanup()
tools/testing/selftests/netfilter/nft_flowtable.sh+34−5
@@ -226,17 +226,19 @@ check_transfer() · 225 unmodified lines
226226 return 0
227227 }
228228
229−test_tcp_forwarding()
229+test_tcp_forwarding_ip()
230230 {
231231 local nsa=$1
232232 local nsb=$2
233+ local dstip=$3
234+ local dstport=$4
233235 local lret=0
234236
235237 ip netns exec $nsb nc -w 5 -l -p 12345 < "$ns2in" > "$ns2out" &
236238 lpid=$!
237239
238240 sleep 1
239− ip netns exec $nsa nc -w 4 10.0.2.99 12345 < "$ns1in" > "$ns1out" &
241+ ip netns exec $nsa nc -w 4 "$dstip" "$dstport" < "$ns1in" > "$ns1out" &
240242 cpid=$!
241243
242244 sleep 3
@@ -258,6 +260,28 @@ test_tcp_forwarding() · 15 unmodified lines
258260 return $lret
259261 }
260262
263+test_tcp_forwarding()
264+{
265+ test_tcp_forwarding_ip "$1" "$2" 10.0.2.99 12345
266+
267+ return $?
268+}
269+
270+test_tcp_forwarding_nat()
271+{
272+ local lret
273+
274+ test_tcp_forwarding_ip "$1" "$2" 10.0.2.99 12345
275+ lret=$?
276+
277+ if [ $lret -eq 0 ] ; then
278+ test_tcp_forwarding_ip "$1" "$2" 10.6.6.6 1666
279+ lret=$?
280+ fi
281+
282+ return $lret
283+}
284+
261285 make_file "$ns1in" "ns1"
262286 make_file "$ns2in" "ns2"
263287
@@ -283,14 +307,19 @@ ip -net ns2 route add 192.168.10.1 via 10.0.2.1 · 19 unmodified lines
283307 # Same, but with NAT enabled.
284308 ip netns exec nsr1 nft -f - <<EOF
285309 table ip nat {
310+ chain prerouting {
311+ type nat hook prerouting priority 0; policy accept;
312+ meta iif "veth0" ip daddr 10.6.6.6 tcp dport 1666 counter dnat ip to 10.0.2.99:12345
313+ }
314+
286315 chain postrouting {
287316 type nat hook postrouting priority 0; policy accept;
288− meta oifname "veth1" masquerade
317+ meta oifname "veth1" counter masquerade
289318 }
290319 }
291320 EOF
292321
293−test_tcp_forwarding ns1 ns2
322+test_tcp_forwarding_nat ns1 ns2
294323
295324 if [ $? -eq 0 ] ;then
296325 echo "PASS: flow offloaded for ns1/ns2 with NAT"
@@ -313,7 +342,7 @@ fi · 16 unmodified lines
313342 ip netns exec ns1 sysctl net.ipv4.ip_no_pmtu_disc=0 > /dev/null
314343 ip netns exec ns2 sysctl net.ipv4.ip_no_pmtu_disc=0 > /dev/null
315344
316−test_tcp_forwarding ns1 ns2
345+test_tcp_forwarding_nat ns1 ns2
317346 if [ $? -eq 0 ] ;then
318347 echo "PASS: flow offloaded for ns1/ns2 with NAT and pmtu discovery"
319348 else
tools/testing/selftests/rseq/param_test.c+10−8
@@ -15,7 +15,7 @@ · 14 unmodified lines
1515 #include <errno.h>
1616 #include <stddef.h>
1717
18−static inline pid_t gettid(void)
18+static inline pid_t rseq_gettid(void)
1919 {
2020 return syscall(__NR_gettid);
2121 }
@@ -373,11 +373,12 @@ void *test_percpu_spinlock_thread(void *arg) · 351 unmodified lines
373373 rseq_percpu_unlock(&data->lock, cpu);
374374 #ifndef BENCHMARK
375375 if (i != 0 && !(i % (reps / 10)))
376− printf_verbose("tid %d: count %lld\n", (int) gettid(), i);
376+ printf_verbose("tid %d: count %lld\n",
377+ (int) rseq_gettid(), i);
377378 #endif
378379 }
379380 printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n",
380− (int) gettid(), nr_abort, signals_delivered);
381+ (int) rseq_gettid(), nr_abort, signals_delivered);
381382 if (!opt_disable_rseq && thread_data->reg &&
382383 rseq_unregister_current_thread())
383384 abort();
@@ -454,11 +455,12 @@ void *test_percpu_inc_thread(void *arg) · 70 unmodified lines
454455 } while (rseq_unlikely(ret));
455456 #ifndef BENCHMARK
456457 if (i != 0 && !(i % (reps / 10)))
457− printf_verbose("tid %d: count %lld\n", (int) gettid(), i);
458+ printf_verbose("tid %d: count %lld\n",
459+ (int) rseq_gettid(), i);
458460 #endif
459461 }
460462 printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n",
461− (int) gettid(), nr_abort, signals_delivered);
463+ (int) rseq_gettid(), nr_abort, signals_delivered);
462464 if (!opt_disable_rseq && thread_data->reg &&
463465 rseq_unregister_current_thread())
464466 abort();
@@ -605,7 +607,7 @@ void *test_percpu_list_thread(void *arg) · 140 unmodified lines
605607 }
606608
607609 printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n",
608− (int) gettid(), nr_abort, signals_delivered);
610+ (int) rseq_gettid(), nr_abort, signals_delivered);
609611 if (!opt_disable_rseq && rseq_unregister_current_thread())
610612 abort();
611613
@@ -796,7 +798,7 @@ void *test_percpu_buffer_thread(void *arg) · 184 unmodified lines
796798 }
797799
798800 printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n",
799− (int) gettid(), nr_abort, signals_delivered);
801+ (int) rseq_gettid(), nr_abort, signals_delivered);
800802 if (!opt_disable_rseq && rseq_unregister_current_thread())
801803 abort();
802804
@@ -1011,7 +1013,7 @@ void *test_percpu_memcpy_buffer_thread(void *arg) · 208 unmodified lines
10111013 }
10121014
10131015 printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n",
1014− (int) gettid(), nr_abort, signals_delivered);
1016+ (int) rseq_gettid(), nr_abort, signals_delivered);
10151017 if (!opt_disable_rseq && rseq_unregister_current_thread())
10161018 abort();
10171019
tools/testing/selftests/rseq/rseq.h+7−5
@@ -149,11 +149,13 @@ static inline void rseq_clear_rseq_cs(void) · 148 unmodified lines
149149 /*
150150 * rseq_prepare_unload() should be invoked by each thread executing a rseq
151151 * critical section at least once between their last critical section and
152− * library unload of the library defining the rseq critical section
153− * (struct rseq_cs). This also applies to use of rseq in code generated by
154− * JIT: rseq_prepare_unload() should be invoked at least once by each
155− * thread executing a rseq critical section before reclaim of the memory
156− * holding the struct rseq_cs.
152+ * library unload of the library defining the rseq critical section (struct
153+ * rseq_cs) or the code referred to by the struct rseq_cs start_ip and
154+ * post_commit_offset fields. This also applies to use of rseq in code
155+ * generated by JIT: rseq_prepare_unload() should be invoked at least once by
156+ * each thread executing a rseq critical section before reclaim of the memory
157+ * holding the struct rseq_cs or reclaim of the code pointed to by struct
158+ * rseq_cs start_ip and post_commit_offset fields.
157159 */
158160 static inline void rseq_prepare_unload(void)
159161 {
tools/testing/selftests/rseq/settings+1−0
@@ -0,0 +1 @@
1+timeout=0
tools/testing/selftests/seccomp/seccomp_bpf.c+14−1
@@ -3158,7 +3158,18 @@ TEST(user_notification_basic) · 3157 unmodified lines
31583158 EXPECT_GT(poll(&pollfd, 1, -1), 0);
31593159 EXPECT_EQ(pollfd.revents, POLLIN);
31603160
3161− EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_RECV, &req), 0);
3161+ /* Test that we can't pass garbage to the kernel. */
3162+ memset(&req, 0, sizeof(req));
3163+ req.pid = -1;
3164+ errno = 0;
3165+ ret = ioctl(listener, SECCOMP_IOCTL_NOTIF_RECV, &req);
3166+ EXPECT_EQ(-1, ret);
3167+ EXPECT_EQ(EINVAL, errno);
3168+
3169+ if (ret) {
3170+ req.pid = 0;
3171+ EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_RECV, &req), 0);
3172+ }
31623173
31633174 pollfd.fd = listener;
31643175 pollfd.events = POLLIN | POLLOUT;
@@ -3278,6 +3289,7 @@ TEST(user_notification_signal) · 113 unmodified lines
32783289
32793290 close(sk_pair[1]);
32803291
3292+ memset(&req, 0, sizeof(req));
32813293 EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_RECV, &req), 0);
32823294
32833295 EXPECT_EQ(kill(pid, SIGUSR1), 0);
@@ -3296,6 +3308,7 @@ TEST(user_notification_signal) · 12 unmodified lines
32963308 EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_SEND, &resp), -1);
32973309 EXPECT_EQ(errno, ENOENT);
32983310
3311+ memset(&req, 0, sizeof(req));
32993312 EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_RECV, &req), 0);
33003313
33013314 resp.id = req.id;
usr/gen_initramfs_list.sh+1−1
@@ -128,7 +128,7 @@ parse() { · 127 unmodified lines
128128 str="${ftype} ${name} ${location} ${str}"
129129 ;;
130130 "nod")
131− local dev=`LC_ALL=C ls -l "${location}"`
131+ local dev="`LC_ALL=C ls -l "${location}"`"
132132 local maj=`field 5 ${dev}`
133133 local min=`field 6 ${dev}`
134134 maj=${maj%,}