History

Merge 5.7-rc7 into staging-next

We need the staging/iio fixes in here as well.

Greg Kroah-Hartman committed 6 years ago

Commit c2312ff2 parents a3975de 9cb1fd0609 files · +5047 −2480Browse files

Unified · Split

609 files
  1. .mailmap +2 −0
  2. Documentation/core-api/printk-formats.rst +14 −0
  3. Documentation/devicetree/bindings/dma/fsl-edma.txt +2 −1
  4. Documentation/devicetree/bindings/net/dsa/b53.txt +3 −0
  5. Documentation/usb/raw-gadget.rst +30 −7
  6. MAINTAINERS +20 −5
  7. Makefile +1 −1
  8. arch/arc/configs/hsdk_defconfig +1 −0
  9. arch/arc/include/asm/dsp-impl.h +2 −0
  10. arch/arc/include/asm/entry-arcv2.h +2 −0
  11. arch/arc/kernel/Makefile +0 −3
  12. arch/arc/kernel/ptrace.c +1 −1
  13. arch/arc/kernel/setup.c +3 −2
  14. arch/arc/kernel/troubleshoot.c +6 −8
  15. arch/arc/kernel/unwind.c +0 −2
  16. arch/arc/plat-eznps/Kconfig +1 −0
  17. arch/arm/Kconfig +1 −0
  18. arch/arm/boot/dts/am574x-idk.dts +4 −0
  19. arch/arm/boot/dts/dra7.dtsi +2 −2
  20. arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts +2 −2
  21. arch/arm/boot/dts/imx6dl-yapp4-ursa.dts +1 −1
  22. arch/arm/boot/dts/iwg20d-q7-dbcm-ca.dtsi +0 −2
  23. arch/arm/boot/dts/motorola-mapphone-common.dtsi +40 −3
  24. arch/arm/boot/dts/r7s9210.dtsi +0 −3
  25. arch/arm/boot/dts/r8a73a4.dtsi +8 −1
  26. arch/arm/boot/dts/r8a7740.dtsi +1 −1
  27. arch/arm/boot/dts/r8a7745-iwg22d-sodimm-dbhd-ca.dts +0 −2
  28. arch/arm/boot/dts/r8a7790-lager.dts +0 −2
  29. arch/arm/boot/dts/r8a7790-stout.dts +0 −2
  30. arch/arm/boot/dts/r8a7791-koelsch.dts +0 −2
  31. arch/arm/boot/dts/r8a7791-porter.dts +0 −2
  32. arch/arm/boot/dts/r8a7792-blanche.dts +0 −2
  33. arch/arm/boot/dts/r8a7792-wheat.dts +4 −8
  34. arch/arm/boot/dts/r8a7793-gose.dts +0 −2
  35. arch/arm/boot/dts/r8a7794-silk.dts +0 −2
  36. arch/arm/boot/dts/rk3036.dtsi +1 −1
  37. arch/arm/boot/dts/rk3228-evb.dts +1 −1
  38. arch/arm/boot/dts/rk3229-xms6.dts +1 −1
  39. arch/arm/boot/dts/rk322x.dtsi +3 −3
  40. arch/arm/boot/dts/rk3xxx.dtsi +1 −1
  41. arch/arm/configs/keystone_defconfig +1 −0
  42. arch/arm/configs/omap2plus_defconfig +1 −0
  43. arch/arm/mach-oxnas/platsmp.c +2 −1
  44. arch/arm64/Kconfig +1 −0
  45. arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dts +1 −1
  46. arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +0 −18
  47. arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +1 −1
  48. arch/arm64/boot/dts/amlogic/meson-g12.dtsi +0 −1
  49. arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi +4 −0
  50. arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts +1 −1
  51. arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +1 −1
  52. arch/arm64/boot/dts/freescale/imx8mm.dtsi +4 −4
  53. arch/arm64/boot/dts/freescale/imx8mn.dtsi +5 −5
  54. arch/arm64/boot/dts/freescale/imx8mp-pinfunc.h +23 −23
  55. arch/arm64/boot/dts/freescale/imx8mp.dtsi +3 −3
  56. arch/arm64/boot/dts/freescale/imx8mq.dtsi +4 −4
  57. arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi +20 −3
  58. arch/arm64/boot/dts/qcom/msm8996.dtsi +2 −0
  59. arch/arm64/boot/dts/qcom/sdm845-db845c.dts +0 −3
  60. arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts +0 −2
  61. arch/arm64/boot/dts/renesas/r8a77970-eagle.dts +0 −2
  62. arch/arm64/boot/dts/renesas/r8a77970-v3msk.dts +0 −2
  63. arch/arm64/boot/dts/renesas/r8a77980-condor.dts +0 −2
  64. arch/arm64/boot/dts/renesas/r8a77980-v3hsk.dts +0 −2
  65. arch/arm64/boot/dts/renesas/r8a77980.dtsi +2 −0
  66. arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts +0 −2
  67. arch/arm64/boot/dts/renesas/r8a77995-draak.dts +2 −4
  68. arch/arm64/boot/dts/rockchip/px30.dtsi +1 −1
  69. arch/arm64/boot/dts/rockchip/rk3308.dtsi +1 −1
  70. arch/arm64/boot/dts/rockchip/rk3328-evb.dts +2 −3
  71. arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +1 −1
  72. arch/arm64/boot/dts/rockchip/rk3328.dtsi +0 −18
  73. arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts +5 −4
  74. arch/arm64/boot/dts/rockchip/rk3399.dtsi +6 −8
  75. arch/arm64/configs/defconfig +6 −3
  76. arch/arm64/include/asm/uaccess.h +1 −1
  77. arch/arm64/kernel/machine_kexec.c +1 −0
  78. arch/arm64/kernel/ptrace.c +4 −3
  79. arch/csky/Kconfig +2 −0
  80. arch/csky/Makefile +1 −1
  81. arch/csky/abiv1/inc/abi/entry.h +2 −2
  82. arch/csky/abiv2/inc/abi/entry.h +2 −2
  83. arch/csky/abiv2/mcount.S +2 −0
  84. arch/csky/include/asm/processor.h +2 −4
  85. arch/csky/include/asm/ptrace.h +10 −0
  86. arch/csky/include/asm/thread_info.h +11 −5
  87. arch/csky/include/asm/uaccess.h +26 −23
  88. arch/csky/kernel/Makefile +1 −1
  89. arch/csky/kernel/asm-offsets.c +1 −2
  90. arch/csky/kernel/dumpstack.c +0 −49
  91. arch/csky/kernel/entry.S +2 −10
  92. arch/csky/kernel/ftrace.c +2 −0
  93. arch/csky/kernel/perf_callchain.c +7 −2
  94. arch/csky/kernel/probes/uprobes.c +5 −0
  95. arch/csky/kernel/process.c +3 −34
  96. arch/csky/kernel/ptrace.c +6 −0
  97. arch/csky/kernel/stacktrace.c +139 −37
  98. arch/csky/lib/usercopy.c +2 −6
  99. arch/powerpc/Kconfig +1 −1
  100. arch/powerpc/include/asm/book3s/32/hash.h +4 −4
  101. arch/powerpc/include/asm/book3s/32/kup.h +1 −1
  102. arch/powerpc/include/asm/hw_irq.h +19 −1
  103. arch/powerpc/include/asm/uaccess.h +35 −14
  104. arch/powerpc/kernel/entry_64.S +3 −1
  105. arch/powerpc/kernel/exceptions-64s.S +1 −0
  106. arch/powerpc/kernel/head_32.S +6 −3
  107. arch/powerpc/kernel/head_40x.S +2 −1
  108. arch/powerpc/kernel/ima_arch.c +3 −3
  109. arch/powerpc/kernel/syscall_64.c +11 −9
  110. arch/powerpc/kernel/vdso32/gettimeofday.S +3 −3
  111. arch/powerpc/mm/book3s32/hash_low.S +8 −6
  112. arch/riscv/Kconfig +2 −1
  113. arch/riscv/Kconfig.socs +9 −8
  114. arch/riscv/include/asm/mmio.h +2 −0
  115. arch/riscv/include/asm/mmiowb.h +1 −0
  116. arch/riscv/include/asm/perf_event.h +2 −6
  117. arch/riscv/include/asm/pgtable.h +3 −0
  118. arch/riscv/kernel/Makefile +1 −1
  119. arch/riscv/kernel/perf_event.c +4 −4
  120. arch/riscv/kernel/process.c +1 −1
  121. arch/riscv/kernel/stacktrace.c +1 −1
  122. arch/riscv/mm/init.c +1 −1
  123. arch/s390/include/asm/pci_io.h +8 −2
  124. arch/s390/kernel/machine_kexec_file.c +1 −1
  125. arch/s390/kernel/machine_kexec_reloc.c +1 −0
  126. arch/s390/mm/hugetlbpage.c +6 −3
  127. arch/s390/pci/pci_mmio.c +211 −2
  128. arch/sh/include/uapi/asm/sockios.h +2 −0
  129. arch/sparc/mm/srmmu.c +3 −3
  130. arch/um/drivers/vector_user.h +1 −1
  131. arch/um/include/asm/xor.h +1 −1
  132. arch/um/kernel/skas/syscall.c +1 −0
  133. arch/x86/Kconfig +1 −0
  134. arch/x86/boot/tools/build.c +8 −8
  135. arch/x86/hyperv/hv_init.c +17 −2
  136. arch/x86/include/asm/bitops.h +6 −6
  137. arch/x86/include/asm/ftrace.h +6 −0
  138. arch/x86/include/asm/kvm_host.h +2 −2
  139. arch/x86/include/asm/stackprotector.h +6 −1
  140. arch/x86/kernel/ftrace.c +28 −1
  141. arch/x86/kernel/smpboot.c +8 −0
  142. arch/x86/kernel/unwind_orc.c +16 −7
  143. arch/x86/kvm/hyperv.c +1 −1
  144. arch/x86/kvm/svm/nested.c +31 −8
  145. arch/x86/kvm/svm/svm.c +22 −14
  146. arch/x86/kvm/vmx/vmx.c +4 −37
  147. arch/x86/kvm/x86.c +37 −23
  148. arch/x86/mm/init_64.c +3 −0
  149. arch/x86/mm/mmio-mod.c +2 −2
  150. arch/x86/xen/smp_pv.c +1 −0
  151. drivers/acpi/ec.c +18 −6
  152. drivers/acpi/internal.h +0 −1
  153. drivers/acpi/sleep.c +6 −23
  154. drivers/base/core.c +37 −18
  155. drivers/block/null_blk_main.c +7 −0
  156. drivers/block/null_blk_zoned.c +4 −0
  157. drivers/bus/mhi/core/init.c +2 −0
  158. drivers/char/ipmi/ipmi_ssif.c +2 −2
  159. drivers/clk/clk.c +3 −0
  160. drivers/clk/rockchip/clk-rk3228.c +4 −13
  161. drivers/clk/tegra/clk-tegra124.c +1 −1
  162. drivers/clk/ti/clk-33xx.c +1 −1
  163. drivers/clk/ti/clkctrl.c +48 −51
  164. drivers/clk/versatile/clk-impd1.c +1 −0
  165. drivers/dax/kmem.c +11 −3
  166. drivers/dma/dmatest.c +5 −4
  167. drivers/dma/idxd/device.c +7 −0
  168. drivers/dma/idxd/irq.c +19 −7
  169. drivers/dma/owl-dma.c +3 −5
  170. drivers/dma/tegra210-adma.c +1 −1
  171. drivers/dma/ti/k3-udma.c +4 −2
  172. drivers/dma/xilinx/zynqmp_dma.c +1 −2
  173. drivers/firmware/efi/cper.c +62 −0
  174. drivers/firmware/efi/earlycon.c +8 −6
  175. drivers/firmware/efi/efi.c +1 −4
  176. drivers/firmware/efi/libstub/arm-stub.c +5 −1
  177. drivers/firmware/efi/libstub/efistub.h +13 −0
  178. drivers/firmware/efi/libstub/mem.c +0 −2
  179. drivers/firmware/efi/libstub/tpm.c +3 −2
  180. drivers/firmware/efi/libstub/x86-stub.c +9 −15
  181. drivers/firmware/efi/tpm.c +4 −1
  182. drivers/gpio/gpio-pca953x.c +1 −1
  183. drivers/gpio/gpio-tegra.c +1 −0
  184. drivers/gpio/gpiolib.c +29 −5
  185. drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 −0
  186. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +3 −2
  187. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 −0
  188. drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +1 −2
  189. drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +16 −6
  190. drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +5 −9
  191. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +79 −84
  192. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c +5 −5
  193. drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +27 −0
  194. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +68 −1
  195. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h +5 −0
  196. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_init.c +1 −0
  197. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_init.c +1 −0
  198. drivers/gpu/drm/amd/display/dc/dcn21/dcn21_init.c +1 −0
  199. drivers/gpu/drm/amd/display/dc/dml/Makefile +0 −2
  200. drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.h +0 −1
  201. drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.h +0 −1
  202. drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.h +1 −1
  203. drivers/gpu/drm/amd/display/dc/dml/display_mode_lib.h +4 −2
  204. drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h +0 −2
  205. drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_helpers.h +0 −1
  206. drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.h +0 −2
  207. drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c +0 −43
  208. drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h +0 −37
  209. drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h +13 −2
  210. drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +5 −0
  211. drivers/gpu/drm/amd/powerplay/amd_powerplay.c +3 −3
  212. drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 −4
  213. drivers/gpu/drm/drm_edid.c +2 −1
  214. drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +3 −1
  215. drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +1 −1
  216. drivers/gpu/drm/i915/display/intel_fbc.c +1 −2
  217. drivers/gpu/drm/i915/gem/i915_gem_domain.c +1 −6
  218. drivers/gpu/drm/i915/gt/intel_context_types.h +7 −1
  219. drivers/gpu/drm/i915/gt/intel_engine.h +0 −9
  220. drivers/gpu/drm/i915/gt/intel_engine_cs.c +6 −0
  221. drivers/gpu/drm/i915/gt/intel_engine_types.h +29 −6
  222. drivers/gpu/drm/i915/gt/intel_gt_irq.c +13 −2
  223. drivers/gpu/drm/i915/gt/intel_lrc.c +81 −39
  224. drivers/gpu/drm/i915/gt/selftest_lrc.c +18 −16
  225. drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +1 −1
  226. drivers/gpu/drm/i915/gvt/display.c +44 −5
  227. drivers/gpu/drm/i915/gvt/scheduler.c +7 −3
  228. drivers/gpu/drm/i915/i915_gem_evict.c +12 −14
  229. drivers/gpu/drm/i915/i915_gpu_error.c +7 −5
  230. drivers/gpu/drm/i915/i915_irq.c +3 −13
  231. drivers/gpu/drm/i915/i915_perf.c +2 −4
  232. drivers/gpu/drm/i915/i915_reg.h +1 −0
  233. drivers/gpu/drm/i915/i915_request.c +9 −3
  234. drivers/gpu/drm/i915/i915_scheduler.c +3 −3
  235. drivers/gpu/drm/i915/i915_scheduler.h +2 −1
  236. drivers/gpu/drm/i915/i915_scheduler_types.h +1 −0
  237. drivers/gpu/drm/i915/i915_vma.c +9 −16
  238. drivers/gpu/drm/i915/intel_pm.c +1 −1
  239. drivers/gpu/drm/i915/selftests/i915_vma.c +1 −1
  240. drivers/gpu/drm/meson/meson_drv.c +1 −3
  241. drivers/gpu/drm/tegra/drm.c +2 −1
  242. drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +1 −1
  243. drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +1 −1
  244. drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +1 −1
  245. drivers/gpu/host1x/dev.c +55 −4
  246. drivers/hwmon/da9052-hwmon.c +2 −2
  247. drivers/hwmon/drivetemp.c +1 −1
  248. drivers/hwmon/nct7904.c +11 −1
  249. drivers/hwtracing/coresight/coresight-cti-platform.c +2 −2
  250. drivers/i2c/algos/i2c-algo-pca.c +1 −1
  251. drivers/i2c/busses/i2c-altera.c +9 −1
  252. drivers/i2c/busses/i2c-at91-master.c +17 −3
  253. drivers/i2c/i2c-core-base.c +17 −7
  254. drivers/i2c/i2c-core-of.c +1 −1
  255. drivers/i2c/muxes/i2c-demux-pinctrl.c +1 −0
  256. drivers/iio/accel/sca3000.c +1 −1
  257. drivers/iio/adc/stm32-adc.c +4 −4
  258. drivers/iio/adc/stm32-dfsdm-adc.c +11 −10
  259. drivers/iio/adc/ti-ads8344.c +5 −3
  260. drivers/iio/chemical/atlas-sensor.c +13 −1
  261. drivers/iio/dac/vf610_dac.c +1 −0
  262. drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c +5 −2
  263. drivers/infiniband/core/cache.c +5 −2
  264. drivers/infiniband/core/nldev.c +1 −2
  265. drivers/infiniband/core/rdma_core.c +2 −1
  266. drivers/infiniband/core/uverbs.h +4 −0
  267. drivers/infiniband/core/uverbs_main.c +4 −8
  268. drivers/infiniband/core/uverbs_std_types_async_fd.c +29 −1
  269. drivers/infiniband/hw/cxgb4/cm.c +3 −4
  270. drivers/infiniband/hw/hfi1/user_sdma.c +0 −4
  271. drivers/infiniband/hw/i40iw/i40iw_cm.c +0 −8
  272. drivers/infiniband/hw/i40iw/i40iw_hw.c +1 −1
  273. drivers/infiniband/hw/mlx4/qp.c +11 −3
  274. drivers/infiniband/sw/rxe/rxe_mmap.c +1 −1
  275. drivers/infiniband/sw/rxe/rxe_queue.c +7 −4
  276. drivers/iommu/amd_iommu.c +2 −1
  277. drivers/iommu/amd_iommu_init.c +5 −4
  278. drivers/iommu/iommu.c +11 −6
  279. drivers/ipack/carriers/tpci200.c +1 −0
  280. drivers/misc/cardreader/rtsx_pcr.c +3 −0
  281. drivers/misc/mei/client.c +2 −0
  282. drivers/mmc/core/block.c +2 −1
  283. drivers/mmc/core/queue.c +5 −11
  284. drivers/mmc/host/alcor.c +5 −1
  285. drivers/mmc/host/sdhci-acpi.c +6 −4
  286. drivers/mmc/host/sdhci-pci-gli.c +23 −0
  287. drivers/mtd/mtdcore.c +1 −1
  288. drivers/mtd/nand/raw/brcmnand/brcmnand.c +1 −2
  289. drivers/mtd/nand/spi/core.c +4 −0
  290. drivers/mtd/ubi/debug.c +2 −10
  291. drivers/net/bareudp.c +4 −14
  292. drivers/net/can/ifi_canfd/ifi_canfd.c +4 −1
  293. drivers/net/can/sun4i_can.c +1 −1
  294. drivers/net/dsa/b53/b53_srab.c +1 −1
  295. drivers/net/dsa/dsa_loop.c +1 −0
  296. drivers/net/dsa/mt7530.c +2 −7
  297. drivers/net/dsa/mt7530.h +1 −0
  298. drivers/net/dsa/ocelot/felix.c +11 −12
  299. drivers/net/dsa/ocelot/felix.h +3 −3
  300. drivers/net/dsa/ocelot/felix_vsc9959.c +10 −12
  301. drivers/net/ethernet/apple/bmac.c +1 −1
  302. drivers/net/ethernet/broadcom/Kconfig +1 −0
  303. drivers/net/ethernet/freescale/Kconfig +2 −0
  304. drivers/net/ethernet/freescale/dpaa/Kconfig +1 −0
  305. drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +17 −12
  306. drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +1 −0
  307. drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c +1 −1
  308. drivers/net/ethernet/freescale/ucc_geth.c +7 −6
  309. drivers/net/ethernet/hisilicon/Kconfig +1 −1
  310. drivers/net/ethernet/huawei/hinic/hinic_hw_mgmt.c +12 −4
  311. drivers/net/ethernet/huawei/hinic/hinic_main.c +2 −14
  312. drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c +1 −1
  313. drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +6 −2
  314. drivers/net/ethernet/marvell/pxa168_eth.c +1 −1
  315. drivers/net/ethernet/mellanox/mlx4/fw.c +1 −1
  316. drivers/net/ethernet/mellanox/mlx5/core/cmd.c +55 −4
  317. drivers/net/ethernet/mellanox/mlx5/core/en.h +1 −1
  318. drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +3 −2
  319. drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h +3 −1
  320. drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c +1 −1
  321. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +7 −5
  322. drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +4 −8
  323. drivers/net/ethernet/mellanox/mlx5/core/en_rep.h +6 −1
  324. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +33 −7
  325. drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +6 −3
  326. drivers/net/ethernet/mellanox/mlx5/core/eq.c +3 −0
  327. drivers/net/ethernet/mellanox/mlx5/core/events.c +3 −1
  328. drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +19 −11
  329. drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +2 −2
  330. drivers/net/ethernet/mellanox/mlx5/core/main.c +6 −1
  331. drivers/net/ethernet/mellanox/mlxsw/spectrum.c +12 −2
  332. drivers/net/ethernet/mellanox/mlxsw/switchx2.c +8 −0
  333. drivers/net/ethernet/microchip/encx24j600.c +4 −1
  334. drivers/net/ethernet/mscc/ocelot.c +1 −1
  335. drivers/net/ethernet/netronome/nfp/abm/main.c +3 −1
  336. drivers/net/ethernet/pensando/ionic/ionic_lif.c +12 −7
  337. drivers/net/ethernet/pensando/ionic/ionic_main.c +9 −9
  338. drivers/net/ethernet/realtek/r8169_main.c +17 −2
  339. drivers/net/ethernet/sgi/ioc3-eth.c +4 −4
  340. drivers/net/ethernet/smsc/smsc911x.c +5 −4
  341. drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +13 −0
  342. drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +15 −2
  343. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 −2
  344. drivers/net/ethernet/sun/cassini.c +1 −2
  345. drivers/net/ethernet/ti/Kconfig +6 −10
  346. drivers/net/ethernet/ti/Makefile +1 −1
  347. drivers/net/ethernet/ti/am65-cpsw-nuss.c +2 −1
  348. drivers/net/ethernet/ti/cpsw.c +4 −0
  349. drivers/net/ethernet/ti/cpsw_ale.c +1 −1
  350. drivers/net/ethernet/ti/cpsw_priv.c +2 −2
  351. drivers/net/ethernet/ti/netcp_ethss.c +2 −2
  352. drivers/net/hamradio/bpqether.c +2 −1
  353. drivers/net/ipa/gsi.c +1 −0
  354. drivers/net/ipa/gsi_trans.c +3 −2
  355. drivers/net/ipa/ipa_cmd.c +3 −11
  356. drivers/net/ipa/ipa_smp2p.c +1 −1
  357. drivers/net/netdevsim/dev.c +1 −2
  358. drivers/net/phy/broadcom.c +6 −2
  359. drivers/net/phy/mscc/mscc.h +2 −0
  360. drivers/net/phy/mscc/mscc_mac.h +3 −3
  361. drivers/net/phy/mscc/mscc_macsec.c +10 −6
  362. drivers/net/phy/mscc/mscc_macsec.h +2 −1
  363. drivers/net/phy/mscc/mscc_main.c +4 −0
  364. drivers/net/phy/phy.c +5 −3
  365. drivers/net/phy/phy_device.c +2 −2
  366. drivers/net/ppp/pppoe.c +3 −0
  367. drivers/net/usb/cdc_ether.c +9 −2
  368. drivers/net/usb/hso.c +1 −1
  369. drivers/net/usb/r8152.c +1 −0
  370. drivers/net/virtio_net.c +4 −2
  371. drivers/net/wireguard/messages.h +1 −1
  372. drivers/net/wireguard/noise.c +9 −13
  373. drivers/net/wireguard/noise.h +6 −8
  374. drivers/net/wireguard/queueing.h +9 −1
  375. drivers/net/wireguard/receive.c +22 −22
  376. drivers/net/wireguard/selftest/counter.c +12 −5
  377. drivers/net/wireguard/send.c +11 −8
  378. drivers/net/wireless/intel/iwlwifi/pcie/drv.c +4 −0
  379. drivers/nvme/host/pci.c +5 −0
  380. drivers/pinctrl/actions/pinctrl-s700.c +1 −1
  381. drivers/pinctrl/intel/pinctrl-baytrail.c +1 −0
  382. drivers/pinctrl/intel/pinctrl-cherryview.c +4 −0
  383. drivers/pinctrl/intel/pinctrl-sunrisepoint.c +8 −7
  384. drivers/pinctrl/mediatek/pinctrl-paris.c +0 −2
  385. drivers/pinctrl/qcom/pinctrl-msm.c +26 −1
  386. drivers/rapidio/devices/rio_mport_cdev.c +5 −0
  387. drivers/s390/net/ism_drv.c +3 −1
  388. drivers/scsi/qla2xxx/qla_attr.c +0 −3
  389. drivers/scsi/scsi_pm.c +8 −2
  390. drivers/staging/greybus/uart.c +2 −2
  391. drivers/staging/iio/resolver/ad2s1210.c +12 −5
  392. drivers/staging/kpc2000/kpc2000/core.c +4 −5
  393. drivers/staging/wfx/scan.c +3 −1
  394. drivers/target/target_core_transport.c +1 −0
  395. drivers/tty/serial/sifive.c +1 −0
  396. drivers/usb/cdns3/gadget.c +11 −11
  397. drivers/usb/core/devio.c +13 −3
  398. drivers/usb/core/hub.c +5 −1
  399. drivers/usb/dwc3/Kconfig +1 −0
  400. drivers/usb/dwc3/dwc3-pci.c +1 −0
  401. drivers/usb/dwc3/gadget.c +0 −3
  402. drivers/usb/gadget/configfs.c +3 −0
  403. drivers/usb/gadget/legacy/audio.c +3 −1
  404. drivers/usb/gadget/legacy/cdc2.c +3 −1
  405. drivers/usb/gadget/legacy/inode.c +1 −2
  406. drivers/usb/gadget/legacy/ncm.c +3 −1
  407. drivers/usb/gadget/legacy/raw_gadget.c +252 −63
  408. drivers/usb/gadget/udc/atmel_usba_udc.c +2 −2
  409. drivers/usb/gadget/udc/net2272.c +2 −0
  410. drivers/usb/gadget/udc/tegra-xudc.c +4 −4
  411. drivers/usb/host/xhci-plat.c +3 −1
  412. drivers/usb/host/xhci-ring.c +2 −2
  413. drivers/usb/mtu3/mtu3_debugfs.c +2 −2
  414. drivers/usb/phy/phy-twl6030-usb.c +9 −3
  415. drivers/usb/typec/mux/intel_pmc_mux.c +3 −3
  416. drivers/vdpa/vdpa_sim/vdpa_sim.c +7 −8
  417. drivers/vhost/vhost.c +2 −2
  418. fs/afs/fs_probe.c +5 −13
  419. fs/afs/fsclient.c +4 −4
  420. fs/afs/vl_probe.c +5 −13
  421. fs/afs/yfsclient.c +4 −4
  422. fs/cachefiles/rdwr.c +6 −6
  423. fs/cifs/cifssmb.c +1 −1
  424. fs/cifs/file.c +1 −1
  425. fs/cifs/inode.c +1 −1
  426. fs/eventpoll.c +28 −20
  427. fs/exec.c +2 −2
  428. fs/exfat/file.c +7 −6
  429. fs/exfat/namei.c +1 −0
  430. fs/exfat/super.c +19 −0
  431. fs/ext4/ext4.h +1 −1
  432. fs/ext4/extents.c +31 −0
  433. fs/ext4/ioctl.c +2 −31
  434. fs/file.c +1 −1
  435. fs/gfs2/bmap.c +9 −7
  436. fs/gfs2/glock.c +2 −4
  437. fs/gfs2/inode.c +4 −3
  438. fs/gfs2/log.c +8 −3
  439. fs/gfs2/lops.c +12 −7
  440. fs/gfs2/meta_io.c +1 −1
  441. fs/gfs2/quota.c +5 −8
  442. fs/gfs2/quota.h +2 −1
  443. fs/gfs2/super.c +0 −1
  444. fs/gfs2/util.c +6 −4
  445. fs/io_uring.c +38 −31
  446. fs/nfs/fscache.c +18 −21
  447. fs/nfs/mount_clnt.c +2 −1
  448. fs/nfs/nfs4proc.c +1 −1
  449. fs/nfs/nfs4state.c +1 −1
  450. fs/nfs/pagelist.c +3 −2
  451. fs/nfs/pnfs_nfs.c +2 −1
  452. fs/nfs/super.c +0 −1
  453. fs/nfs/write.c +2 −2
  454. fs/overlayfs/export.c +3 −0
  455. fs/overlayfs/inode.c +18 −0
  456. fs/splice.c +1 −1
  457. fs/ubifs/auth.c +4 −13
  458. fs/ubifs/file.c +1 −5
  459. fs/ubifs/replay.c +2 −11
  460. include/drm/drm_modes.h +1 −1
  461. include/linux/brcmphy.h +1 −0
  462. include/linux/compiler.h +6 −0
  463. include/linux/cper.h +9 −0
  464. include/linux/efi.h +2 −0
  465. include/linux/ftrace.h +23 −0
  466. include/linux/host1x.h +3 −0
  467. include/linux/i2c-mux.h +1 −1
  468. include/linux/i2c.h +1 −1
  469. include/linux/kvm_host.h +3 −0
  470. include/linux/lsm_hook_defs.h +1 −1
  471. include/linux/memcontrol.h +2 −0
  472. include/linux/mlx5/driver.h +16 −0
  473. include/linux/ptp_clock_kernel.h +4 −4
  474. include/linux/skmsg.h +1 −0
  475. include/linux/sunrpc/gss_api.h +3 −0
  476. include/linux/sunrpc/gss_krb5.h +3 −3
  477. include/linux/sunrpc/xdr.h +1 −0
  478. include/net/act_api.h +2 −1
  479. include/net/af_rxrpc.h +1 −1
  480. include/net/ip_fib.h +0 −1
  481. include/net/netfilter/nf_conntrack.h +1 −1
  482. include/net/netfilter/nf_flow_table.h +1 −0
  483. include/net/tcp.h +13 −1
  484. include/net/udp_tunnel.h +0 −2
  485. include/sound/rawmidi.h +1 −0
  486. include/trace/events/rxrpc.h +42 −10
  487. include/uapi/linux/usb/raw_gadget.h +95 −13
  488. init/Kconfig +3 −0
  489. init/main.c +8 −4
  490. ipc/util.c +6 −6
  491. kernel/bpf/arraymap.c +6 −1
  492. kernel/bpf/syscall.c +17 −4
  493. kernel/bpf/verifier.c +20 −1
  494. kernel/fork.c +7 −6
  495. kernel/sched/debug.c +2 −2
  496. kernel/sched/fair.c +37 −12
  497. kernel/trace/bpf_trace.c +66 −34
  498. kernel/trace/ftrace_internal.h +0 −22
  499. kernel/trace/preemptirq_delay_test.c +10 −2
  500. kernel/trace/ring_buffer.c +13 −21
  501. kernel/umh.c +6 −0
  502. lib/test_printf.c +18 −1
  503. lib/vsprintf.c +19 −0
  504. mm/gup.c +7 −5
  505. mm/kasan/Makefile +14 −9
  506. mm/kasan/generic.c +0 −1
  507. mm/kasan/kasan.h +32 −2
  508. mm/kasan/tags.c +0 −1
  509. mm/mremap.c +1 −1
  510. mm/z3fold.c +6 −5
  511. net/ax25/af_ax25.c +4 −2
  512. net/core/dev.c +18 −6
  513. net/core/filter.c +1 −1
  514. net/core/flow_dissector.c +21 −5
  515. net/core/netprio_cgroup.c +2 −0
  516. net/dsa/tag_mtk.c +15 −0
  517. net/ethtool/netlink.c +2 −2
  518. net/ethtool/strset.c +0 −1
  519. net/ipv4/cipso_ipv4.c +4 −2
  520. net/ipv4/fib_frontend.c +1 −2
  521. net/ipv4/inet_connection_sock.c +24 −19
  522. net/ipv4/ipip.c +1 −1
  523. net/ipv4/ipmr.c +5 −3
  524. net/ipv4/nexthop.c +2 −1
  525. net/ipv4/route.c +7 −9
  526. net/ipv4/tcp.c +19 −8
  527. net/ipv4/tcp_bpf.c +6 −4
  528. net/ipv4/tcp_input.c +2 −1
  529. net/ipv6/calipso.c +2 −1
  530. net/ipv6/ip6_fib.c +1 −1
  531. net/ipv6/ip6mr.c +3 −2
  532. net/ipv6/route.c +4 −2
  533. net/mptcp/crypto.c +9 −15
  534. net/mptcp/options.c +5 −4
  535. net/mptcp/protocol.c +2 −0
  536. net/mptcp/protocol.h +0 −1
  537. net/mptcp/subflow.c +20 −5
  538. net/netfilter/nf_conntrack_core.c +14 −3
  539. net/netfilter/nf_flow_table_core.c +5 −3
  540. net/netfilter/nf_flow_table_offload.c +8 −2
  541. net/netfilter/nft_set_rbtree.c +11 −0
  542. net/netlabel/netlabel_kapi.c +6 −0
  543. net/qrtr/qrtr.c +1 −1
  544. net/rxrpc/Makefile +1 −0
  545. net/rxrpc/ar-internal.h +17 −8
  546. net/rxrpc/call_accept.c +1 −1
  547. net/rxrpc/call_event.c +8 −14
  548. net/rxrpc/input.c +37 −7
  549. net/rxrpc/misc.c +0 −5
  550. net/rxrpc/output.c +3 −6
  551. net/rxrpc/peer_event.c +0 −46
  552. net/rxrpc/peer_object.c +7 −5
  553. net/rxrpc/proc.c +4 −4
  554. net/rxrpc/rtt.c +195 −0
  555. net/rxrpc/rxkad.c +1 −2
  556. net/rxrpc/sendmsg.c +9 −17
  557. net/rxrpc/sysctl.c +0 −9
  558. net/sctp/sm_sideeffect.c +11 −3
  559. net/sctp/sm_statefuns.c +5 −4
  560. net/sunrpc/auth_gss/auth_gss.c +5 −7
  561. net/sunrpc/auth_gss/gss_krb5_crypto.c +4 −4
  562. net/sunrpc/auth_gss/gss_krb5_wrap.c +29 −15
  563. net/sunrpc/auth_gss/gss_mech_switch.c +2 −1
  564. net/sunrpc/auth_gss/svcauth_gss.c +3 −7
  565. net/sunrpc/clnt.c +7 −2
  566. net/sunrpc/xdr.c +41 −0
  567. net/tipc/socket.c +31 −11
  568. net/tipc/subscr.h +10 −0
  569. net/tipc/topsrv.c +8 −5
  570. net/tipc/udp_media.c +5 −1
  571. net/tls/tls_sw.c +10 −7
  572. samples/bpf/lwt_len_hist_user.c +0 −2
  573. security/apparmor/apparmorfs.c +2 −1
  574. security/apparmor/audit.c +2 −1
  575. security/apparmor/domain.c +1 −2
  576. security/integrity/evm/evm_crypto.c +23 −23
  577. security/integrity/evm/evm_main.c +2 −2
  578. security/integrity/evm/evm_secfs.c +8 −1
  579. security/integrity/ima/ima_crypto.c +6 −6
  580. security/integrity/ima/ima_fs.c +1 −2
  581. security/security.c +14 −2
  582. sound/core/pcm_lib.c +1 −0
  583. sound/core/rawmidi.c +27 −4
  584. sound/firewire/amdtp-stream-trace.h +1 −2
  585. sound/pci/hda/patch_realtek.c +75 −3
  586. sound/pci/ice1712/ice1712.c +2 −1
  587. sound/usb/mixer_maps.c +5 −0
  588. sound/usb/quirks-table.h +1 −0
  589. sound/usb/quirks.c +5 −4
  590. tools/bootconfig/main.c +1 −0
  591. tools/lib/bpf/bpf_tracing.h +2 −2
  592. tools/testing/selftests/bpf/prog_tests/mmap.c +20 −1
  593. tools/testing/selftests/bpf/progs/test_mmap.c +8 −0
  594. tools/testing/selftests/bpf/progs/test_overhead.c +2 −2
  595. tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c +1 −0
  596. tools/testing/selftests/drivers/net/mlxsw/qos_mc_aware.sh +1 −1
  597. tools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh +4 −0
  598. tools/testing/selftests/ftrace/test.d/preemptirq/irqsoff_tracer.tc +8 −1
  599. tools/testing/selftests/kvm/Makefile +1 −0
  600. tools/testing/selftests/kvm/include/kvm_util.h +2 −0
  601. tools/testing/selftests/kvm/lib/kvm_util.c +9 −0
  602. tools/testing/selftests/kvm/x86_64/debug_regs.c +202 −0
  603. tools/testing/selftests/lkdtm/run.sh +12 −10
  604. tools/testing/selftests/net/mptcp/pm_netlink.sh +1 −1
  605. tools/testing/selftests/nsfs/pidns.c +1 −1
  606. tools/testing/selftests/vm/.gitignore +1 −0
  607. tools/testing/selftests/vm/write_to_hugetlbfs.c +0 −2
  608. tools/testing/selftests/wireguard/qemu/Makefile +1 −1
  609. virt/kvm/kvm_main.c +11 −3
.mailmap+2−0
@@ -288,6 +288,8 @@ Vladimir Davydov <vdavydov.dev@gmail.com> <vdavydov@virtuozzo.com> · 287 unmodified lines
288288 Vladimir Davydov <vdavydov.dev@gmail.com> <vdavydov@parallels.com>
289289 Takashi YOSHII <takashi.yoshii.zj@renesas.com>
290290 Will Deacon <will@kernel.org> <will.deacon@arm.com>
291+Wolfram Sang <wsa@kernel.org> <wsa@the-dreams.de>
292+Wolfram Sang <wsa@kernel.org> <w.sang@pengutronix.de>
291293 Yakir Yang <kuankuan.y@gmail.com> <ykk@rock-chips.com>
292294 Yusuke Goda <goda.yusuke@renesas.com>
293295 Gustavo Padovan <gustavo@las.ic.unicamp.br>
Documentation/core-api/printk-formats.rst+14−0
@@ -112,6 +112,20 @@ used when printing stack backtraces. The specifier takes into · 111 unmodified lines
112112 consideration the effect of compiler optimisations which may occur
113113 when tail-calls are used and marked with the noreturn GCC attribute.
114114
115+Probed Pointers from BPF / tracing
116+----------------------------------
117+
118+::
119+
120+ %pks kernel string
121+ %pus user string
122+
123+The ``k`` and ``u`` specifiers are used for printing prior probed memory from
124+either kernel memory (k) or user memory (u). The subsequent ``s`` specifier
125+results in printing a string. For direct use in regular vsnprintf() the (k)
126+and (u) annotation is ignored, however, when used out of BPF's bpf_trace_printk(),
127+for example, it reads the memory it is pointing to without faulting.
128+
115129 Kernel Pointers
116130 ---------------
117131
Documentation/devicetree/bindings/dma/fsl-edma.txt+2−1
@@ -10,7 +10,8 @@ Required properties: · 9 unmodified lines
1010 - compatible :
1111 - "fsl,vf610-edma" for eDMA used similar to that on Vybrid vf610 SoC
1212 - "fsl,imx7ulp-edma" for eDMA2 used similar to that on i.mx7ulp
13− - "fsl,fsl,ls1028a-edma" for eDMA used similar to that on Vybrid vf610 SoC
13+ - "fsl,ls1028a-edma" followed by "fsl,vf610-edma" for eDMA used on the
14+ LS1028A SoC.
1415 - reg : Specifies base physical address(s) and size of the eDMA registers.
1516 The 1st region is eDMA control register's address and size.
1617 The 2nd and the 3rd regions are programmable channel multiplexing
Documentation/devicetree/bindings/net/dsa/b53.txt+3−0
@@ -110,6 +110,9 @@ Ethernet switch connected via MDIO to the host, CPU port wired to eth0: · 109 unmodified lines
110110 #size-cells = <0>;
111111
112112 ports {
113+ #address-cells = <1>;
114+ #size-cells = <0>;
115+
113116 port0@0 {
114117 reg = <0>;
115118 label = "lan1";
Documentation/usb/raw-gadget.rst+30−7
@@ -27,9 +27,8 @@ differences are: · 26 unmodified lines
2727 3. Raw Gadget provides a way to select a UDC device/driver to bind to,
2828 while GadgetFS currently binds to the first available UDC.
2929
30−4. Raw Gadget uses predictable endpoint names (handles) across different
31− UDCs (as long as UDCs have enough endpoints of each required transfer
32− type).
30+4. Raw Gadget explicitly exposes information about endpoints addresses and
31+ capabilities allowing a user to write UDC-agnostic gadgets.
3332
3433 5. Raw Gadget has ioctl-based interface instead of a filesystem-based one.
3534
@@ -50,12 +49,36 @@ The typical usage of Raw Gadget looks like: · 14 unmodified lines
5049 Raw Gadget and react to those depending on what kind of USB device
5150 needs to be emulated.
5251
52+Note, that some UDC drivers have fixed addresses assigned to endpoints, and
53+therefore arbitrary endpoint addresses can't be used in the descriptors.
54+Nevertheles, Raw Gadget provides a UDC-agnostic way to write USB gadgets.
55+Once a USB_RAW_EVENT_CONNECT event is received via USB_RAW_IOCTL_EVENT_FETCH,
56+the USB_RAW_IOCTL_EPS_INFO ioctl can be used to find out information about
57+endpoints that the UDC driver has. Based on that information, the user must
58+chose UDC endpoints that will be used for the gadget being emulated, and
59+properly assign addresses in endpoint descriptors.
60+
61+You can find usage examples (along with a test suite) here:
62+
63+https://github.com/xairy/raw-gadget
64+
65+Internal details
66+~~~~~~~~~~~~~~~~
67+
68+Currently every endpoint read/write ioctl submits a USB request and waits until
69+its completion. This is the desired mode for coverage-guided fuzzing (as we'd
70+like all USB request processing happen during the lifetime of a syscall),
71+and must be kept in the implementation. (This might be slow for real world
72+applications, thus the O_NONBLOCK improvement suggestion below.)
73+
5374 Potential future improvements
5475 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5576
56−- Implement ioctl's for setting/clearing halt status on endpoints.
57−
58−- Reporting more events (suspend, resume, etc.) through
59− USB_RAW_IOCTL_EVENT_FETCH.
77+- Report more events (suspend, resume, etc.) through USB_RAW_IOCTL_EVENT_FETCH.
6078
6179 - Support O_NONBLOCK I/O.
80+
81+- Support USB 3 features (accept SS endpoint companion descriptor when
82+ enabling endpoints; allow providing stream_id for bulk transfers).
83+
84+- Support ISO transfer features (expose frame_number for completed requests).
MAINTAINERS+20−5
@@ -5516,10 +5516,10 @@ F: drivers/gpu/drm/vboxvideo/ · 5515 unmodified lines
55165516
55175517 DRM DRIVER FOR VMWARE VIRTUAL GPU
55185518 M: "VMware Graphics" <linux-graphics-maintainer@vmware.com>
5519−M: Thomas Hellstrom <thellstrom@vmware.com>
5519+M: Roland Scheidegger <sroland@vmware.com>
55205520 L: dri-devel@lists.freedesktop.org
55215521 S: Supported
5522−T: git git://people.freedesktop.org/~thomash/linux
5522+T: git git://people.freedesktop.org/~sroland/linux
55235523 F: drivers/gpu/drm/vmwgfx/
55245524 F: include/uapi/drm/vmwgfx_drm.h
55255525
@@ -7839,7 +7839,7 @@ T: git git://linuxtv.org/media_tree.git · 2313 unmodified lines
78397839 F: drivers/media/platform/sti/hva
78407840
78417841 HWPOISON MEMORY FAILURE HANDLING
7842−M: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
7842+M: Naoya Horiguchi <naoya.horiguchi@nec.com>
78437843 L: linux-mm@kvack.org
78447844 S: Maintained
78457845 F: mm/hwpoison-inject.c
@@ -7951,7 +7951,7 @@ F: Documentation/i2c/busses/i2c-parport.rst · 105 unmodified lines
79517951 F: drivers/i2c/busses/i2c-parport.c
79527952
79537953 I2C SUBSYSTEM
7954−M: Wolfram Sang <wsa@the-dreams.de>
7954+M: Wolfram Sang <wsa@kernel.org>
79557955 L: linux-i2c@vger.kernel.org
79567956 S: Maintained
79577957 W: https://i2c.wiki.kernel.org/
@@ -9195,6 +9195,11 @@ L: kexec@lists.infradead.org · 1237 unmodified lines
91959195 S: Maintained
91969196 W: http://lse.sourceforge.net/kdump/
91979197 F: Documentation/admin-guide/kdump/
9198+F: fs/proc/vmcore.c
9199+F: include/linux/crash_core.h
9200+F: include/linux/crash_dump.h
9201+F: include/uapi/linux/vmcore.h
9202+F: kernel/crash_*.c
91989203
91999204 KEENE FM RADIO TRANSMITTER DRIVER
92009205 M: Hans Verkuil <hverkuil@xs4all.nl>
@@ -10672,6 +10677,13 @@ L: netdev@vger.kernel.org · 1471 unmodified lines
1067210677 S: Maintained
1067310678 F: drivers/net/ethernet/mediatek/
1067410679
10680+MEDIATEK I2C CONTROLLER DRIVER
10681+M: Qii Wang <qii.wang@mediatek.com>
10682+L: linux-i2c@vger.kernel.org
10683+S: Maintained
10684+F: Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt
10685+F: drivers/i2c/busses/i2c-mt65xx.c
10686+
1067510687 MEDIATEK JPEG DRIVER
1067610688 M: Rick Chang <rick.chang@mediatek.com>
1067710689 M: Bin Liu <bin.liu@mediatek.com>
@@ -11720,8 +11732,9 @@ F: net/core/drop_monitor.c · 1042 unmodified lines
1172011732
1172111733 NETWORKING DRIVERS
1172211734 M: "David S. Miller" <davem@davemloft.net>
11735+M: Jakub Kicinski <kuba@kernel.org>
1172311736 L: netdev@vger.kernel.org
11724−S: Odd Fixes
11737+S: Maintained
1172511738 W: http://www.linuxfoundation.org/en/Net
1172611739 Q: http://patchwork.ozlabs.org/project/netdev/list/
1172711740 T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
@@ -14644,6 +14657,7 @@ F: drivers/iommu/s390-iommu.c · 2916 unmodified lines
1464414657
1464514658 S390 IUCV NETWORK LAYER
1464614659 M: Julian Wiedmann <jwi@linux.ibm.com>
14660+M: Karsten Graul <kgraul@linux.ibm.com>
1464714661 M: Ursula Braun <ubraun@linux.ibm.com>
1464814662 L: linux-s390@vger.kernel.org
1464914663 S: Supported
@@ -14654,6 +14668,7 @@ F: net/iucv/ · 4 unmodified lines
1465414668
1465514669 S390 NETWORK DRIVERS
1465614670 M: Julian Wiedmann <jwi@linux.ibm.com>
14671+M: Karsten Graul <kgraul@linux.ibm.com>
1465714672 M: Ursula Braun <ubraun@linux.ibm.com>
1465814673 L: linux-s390@vger.kernel.org
1465914674 S: Supported
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 7
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc5
5+EXTRAVERSION = -rc7
66 NAME = Kleptomaniac Octopus
77
88 # *DOCUMENTATION*
arch/arc/configs/hsdk_defconfig+1−0
@@ -65,6 +65,7 @@ CONFIG_DRM_UDL=y · 64 unmodified lines
6565 CONFIG_DRM_ETNAVIV=y
6666 CONFIG_FB=y
6767 CONFIG_FRAMEBUFFER_CONSOLE=y
68+CONFIG_USB=y
6869 CONFIG_USB_EHCI_HCD=y
6970 CONFIG_USB_EHCI_HCD_PLATFORM=y
7071 CONFIG_USB_OHCI_HCD=y
arch/arc/include/asm/dsp-impl.h+2−0
@@ -15,12 +15,14 @@ · 14 unmodified lines
1515
1616 /* clobbers r5 register */
1717 .macro DSP_EARLY_INIT
18+#ifdef CONFIG_ISA_ARCV2
1819 lr r5, [ARC_AUX_DSP_BUILD]
1920 bmsk r5, r5, 7
2021 breq r5, 0, 1f
2122 mov r5, DSP_CTRL_DISABLED_ALL
2223 sr r5, [ARC_AUX_DSP_CTRL]
2324 1:
25+#endif
2426 .endm
2527
2628 /* clobbers r10, r11 registers pair */
arch/arc/include/asm/entry-arcv2.h+2−0
@@ -233,6 +233,8 @@ · 232 unmodified lines
233233
234234 #ifdef CONFIG_ARC_IRQ_NO_AUTOSAVE
235235 __RESTORE_REGFILE_HARD
236+
237+ ; SP points to PC/STAT32: hw restores them despite NO_AUTOSAVE
236238 add sp, sp, SZ_PT_REGS - 8
237239 #else
238240 add sp, sp, PT_r0
arch/arc/kernel/Makefile+0−3
@@ -3,9 +3,6 @@ · 2 unmodified lines
33 # Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
44 #
55
6−# Pass UTS_MACHINE for user_regset definition
7−CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'
8−
96 obj-y := arcksyms.o setup.o irq.o reset.o ptrace.o process.o devtree.o
107 obj-y += signal.o traps.o sys.o troubleshoot.o stacktrace.o disasm.o
118 obj-$(CONFIG_ISA_ARCOMPACT) += entry-compact.o intc-compact.o
arch/arc/kernel/ptrace.c+1−1
@@ -253,7 +253,7 @@ static const struct user_regset arc_regsets[] = { · 252 unmodified lines
253253 };
254254
255255 static const struct user_regset_view user_arc_view = {
256− .name = UTS_MACHINE,
256+ .name = "arc",
257257 .e_machine = EM_ARC_INUSE,
258258 .regsets = arc_regsets,
259259 .n = ARRAY_SIZE(arc_regsets)
arch/arc/kernel/setup.c+3−2
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/clocksource.h>
1212 #include <linux/console.h>
1313 #include <linux/module.h>
14+#include <linux/sizes.h>
1415 #include <linux/cpu.h>
1516 #include <linux/of_clk.h>
1617 #include <linux/of_fdt.h>
@@ -424,12 +425,12 @@ static void arc_chk_core_config(void) · 407 unmodified lines
424425 if ((unsigned int)__arc_dccm_base != cpu->dccm.base_addr)
425426 panic("Linux built with incorrect DCCM Base address\n");
426427
427− if (CONFIG_ARC_DCCM_SZ != cpu->dccm.sz)
428+ if (CONFIG_ARC_DCCM_SZ * SZ_1K != cpu->dccm.sz)
428429 panic("Linux built with incorrect DCCM Size\n");
429430 #endif
430431
431432 #ifdef CONFIG_ARC_HAS_ICCM
432− if (CONFIG_ARC_ICCM_SZ != cpu->iccm.sz)
433+ if (CONFIG_ARC_ICCM_SZ * SZ_1K != cpu->iccm.sz)
433434 panic("Linux built with incorrect ICCM Size\n");
434435 #endif
435436
arch/arc/kernel/troubleshoot.c+6−8
@@ -191,10 +191,9 @@ void show_regs(struct pt_regs *regs) · 190 unmodified lines
191191 if (user_mode(regs))
192192 show_faulting_vma(regs->ret); /* faulting code, not data */
193193
194− pr_info("ECR: 0x%08lx EFA: 0x%08lx ERET: 0x%08lx\n",
195− regs->event, current->thread.fault_address, regs->ret);
196−
197− pr_info("STAT32: 0x%08lx", regs->status32);
194+ pr_info("ECR: 0x%08lx EFA: 0x%08lx ERET: 0x%08lx\nSTAT: 0x%08lx",
195+ regs->event, current->thread.fault_address, regs->ret,
196+ regs->status32);
198197
199198 #define STS_BIT(r, bit) r->status32 & STATUS_##bit##_MASK ? #bit" " : ""
200199
@@ -210,11 +209,10 @@ void show_regs(struct pt_regs *regs) · 9 unmodified lines
210209 (regs->status32 & STATUS_U_MASK) ? "U " : "K ",
211210 STS_BIT(regs, DE), STS_BIT(regs, AE));
212211 #endif
213− pr_cont(" BTA: 0x%08lx\n", regs->bta);
214− pr_info("BLK: %pS\n SP: 0x%08lx FP: 0x%08lx\n",
215− (void *)regs->blink, regs->sp, regs->fp);
212+ pr_cont(" BTA: 0x%08lx\n SP: 0x%08lx FP: 0x%08lx BLK: %pS\n",
213+ regs->bta, regs->sp, regs->fp, (void *)regs->blink);
216214 pr_info("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n",
217− regs->lp_start, regs->lp_end, regs->lp_count);
215+ regs->lp_start, regs->lp_end, regs->lp_count);
218216
219217 /* print regs->r0 thru regs->r12
220218 * Sequential printing was generating horrible code
arch/arc/kernel/unwind.c+0−2
@@ -1178,11 +1178,9 @@ int arc_unwind(struct unwind_frame_info *frame) · 1177 unmodified lines
11781178 #endif
11791179
11801180 /* update frame */
1181−#ifndef CONFIG_AS_CFI_SIGNAL_FRAME
11821181 if (frame->call_frame
11831182 && !UNW_DEFAULT_RA(state.regs[retAddrReg], state.dataAlign))
11841183 frame->call_frame = 0;
1185−#endif
11861184 cfa = FRAME_REG(state.cfa.reg, unsigned long) + state.cfa.offs;
11871185 startLoc = min_t(unsigned long, UNW_SP(frame), cfa);
11881186 endLoc = max_t(unsigned long, UNW_SP(frame), cfa);
arch/arc/plat-eznps/Kconfig+1−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
66
77 menuconfig ARC_PLAT_EZNPS
88 bool "\"EZchip\" ARC dev platform"
9+ depends on ISA_ARCOMPACT
910 select CPU_BIG_ENDIAN
1011 select CLKSRC_NPS if !PHYS_ADDR_T_64BIT
1112 select EZNPS_GIC
arch/arm/Kconfig+1−0
@@ -12,6 +12,7 @@ config ARM · 11 unmodified lines
1212 select ARCH_HAS_KEEPINITRD
1313 select ARCH_HAS_KCOV
1414 select ARCH_HAS_MEMBARRIER_SYNC_CORE
15+ select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
1516 select ARCH_HAS_PTE_SPECIAL if ARM_LPAE
1617 select ARCH_HAS_PHYS_TO_DMA
1718 select ARCH_HAS_SETUP_DMA_OPS
arch/arm/boot/dts/am574x-idk.dts+4−0
@@ -40,3 +40,7 @@ · 39 unmodified lines
4040 status = "okay";
4141 dual_emac;
4242 };
43+
44+&m_can0 {
45+ status = "disabled";
46+};
arch/arm/boot/dts/dra7.dtsi+2−2
@@ -172,6 +172,7 @@ · 171 unmodified lines
172172 #address-cells = <1>;
173173 ranges = <0x51000000 0x51000000 0x3000
174174 0x0 0x20000000 0x10000000>;
175+ dma-ranges;
175176 /**
176177 * To enable PCI endpoint mode, disable the pcie1_rc
177178 * node and enable pcie1_ep mode.
@@ -185,7 +186,6 @@ · 7 unmodified lines
185186 device_type = "pci";
186187 ranges = <0x81000000 0 0 0x03000 0 0x00010000
187188 0x82000000 0 0x20013000 0x13000 0 0xffed000>;
188− dma-ranges = <0x02000000 0x0 0x00000000 0x00000000 0x1 0x00000000>;
189189 bus-range = <0x00 0xff>;
190190 #interrupt-cells = <1>;
191191 num-lanes = <1>;
@@ -230,6 +230,7 @@ · 38 unmodified lines
230230 #address-cells = <1>;
231231 ranges = <0x51800000 0x51800000 0x3000
232232 0x0 0x30000000 0x10000000>;
233+ dma-ranges;
233234 status = "disabled";
234235 pcie2_rc: pcie@51800000 {
235236 reg = <0x51800000 0x2000>, <0x51802000 0x14c>, <0x1000 0x2000>;
@@ -240,7 +241,6 @@ · 4 unmodified lines
240241 device_type = "pci";
241242 ranges = <0x81000000 0 0 0x03000 0 0x00010000
242243 0x82000000 0 0x30013000 0x13000 0 0xffed000>;
243− dma-ranges = <0x02000000 0x0 0x00000000 0x00000000 0x1 0x00000000>;
244244 bus-range = <0x00 0xff>;
245245 #interrupt-cells = <1>;
246246 num-lanes = <1>;
arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts+2−2
@@ -75,8 +75,8 @@ · 74 unmodified lines
7575 imx27-phycard-s-rdk {
7676 pinctrl_i2c1: i2c1grp {
7777 fsl,pins = <
78− MX27_PAD_I2C2_SDA__I2C2_SDA 0x0
79− MX27_PAD_I2C2_SCL__I2C2_SCL 0x0
78+ MX27_PAD_I2C_DATA__I2C_DATA 0x0
79+ MX27_PAD_I2C_CLK__I2C_CLK 0x0
8080 >;
8181 };
8282
arch/arm/boot/dts/imx6dl-yapp4-ursa.dts+1−1
@@ -38,7 +38,7 @@ · 37 unmodified lines
3838 };
3939
4040 &switch_ports {
41− /delete-node/ port@2;
41+ /delete-node/ port@3;
4242 };
4343
4444 &touchscreen {
arch/arm/boot/dts/iwg20d-q7-dbcm-ca.dtsi+0−2
@@ -72,8 +72,6 @@ · 71 unmodified lines
7272 adi,input-depth = <8>;
7373 adi,input-colorspace = "rgb";
7474 adi,input-clock = "1x";
75− adi,input-style = <1>;
76− adi,input-justification = "evenly";
7775
7876 ports {
7977 #address-cells = <1>;
arch/arm/boot/dts/motorola-mapphone-common.dtsi+40−3
@@ -367,6 +367,8 @@ · 366 unmodified lines
367367 };
368368
369369 &mmc3 {
370+ pinctrl-names = "default";
371+ pinctrl-0 = <&mmc3_pins>;
370372 vmmc-supply = <&wl12xx_vmmc>;
371373 /* uart2_tx.sdmmc3_dat1 pad as wakeirq */
372374 interrupts-extended = <&wakeupgen GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH
@@ -472,6 +474,37 @@ · 99 unmodified lines
472474 >;
473475 };
474476
477+ /*
478+ * Android uses PIN_OFF_INPUT_PULLDOWN | PIN_INPUT_PULLUP | MUX_MODE3
479+ * for gpio_100, but the internal pull makes wlan flakey on some
480+ * devices. Off mode value should be tested if we have off mode working
481+ * later on.
482+ */
483+ mmc3_pins: pinmux_mmc3_pins {
484+ pinctrl-single,pins = <
485+ /* 0x4a10008e gpmc_wait2.gpio_100 d23 */
486+ OMAP4_IOPAD(0x08e, PIN_INPUT | MUX_MODE3)
487+
488+ /* 0x4a100102 abe_mcbsp1_dx.sdmmc3_dat2 ab25 */
489+ OMAP4_IOPAD(0x102, PIN_INPUT_PULLUP | MUX_MODE1)
490+
491+ /* 0x4a100104 abe_mcbsp1_fsx.sdmmc3_dat3 ac27 */
492+ OMAP4_IOPAD(0x104, PIN_INPUT_PULLUP | MUX_MODE1)
493+
494+ /* 0x4a100118 uart2_cts.sdmmc3_clk ab26 */
495+ OMAP4_IOPAD(0x118, PIN_INPUT | MUX_MODE1)
496+
497+ /* 0x4a10011a uart2_rts.sdmmc3_cmd ab27 */
498+ OMAP4_IOPAD(0x11a, PIN_INPUT_PULLUP | MUX_MODE1)
499+
500+ /* 0x4a10011c uart2_rx.sdmmc3_dat0 aa25 */
501+ OMAP4_IOPAD(0x11c, PIN_INPUT_PULLUP | MUX_MODE1)
502+
503+ /* 0x4a10011e uart2_tx.sdmmc3_dat1 aa26 */
504+ OMAP4_IOPAD(0x11e, PIN_INPUT_PULLUP | MUX_MODE1)
505+ >;
506+ };
507+
475508 /* gpmc_ncs0.gpio_50 */
476509 poweroff_gpio: pinmux_poweroff_pins {
477510 pinctrl-single,pins = <
@@ -690,14 +723,18 @@ · 212 unmodified lines
690723 };
691724
692725 /*
693− * As uart1 is wired to mdm6600 with rts and cts, we can use the cts pin for
694− * uart1 wakeirq.
726+ * The uart1 port is wired to mdm6600 with rts and cts. The modem uses gpio_149
727+ * for wake-up events for both the USB PHY and the UART. We can use gpio_149
728+ * pad as the shared wakeirq for the UART rather than the RX or CTS pad as we
729+ * have gpio_149 trigger before the UART transfer starts.
695730 */
696731 &uart1 {
697732 pinctrl-names = "default";
698733 pinctrl-0 = <&uart1_pins>;
699734 interrupts-extended = <&wakeupgen GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH
700− &omap4_pmx_core 0xfc>;
735+ &omap4_pmx_core 0x110>;
736+ uart-has-rtscts;
737+ current-speed = <115200>;
701738 };
702739
703740 &uart3 {
arch/arm/boot/dts/r7s9210.dtsi+0−3
@@ -304,7 +304,6 @@ · 303 unmodified lines
304304 reg = <0xe803b000 0x30>;
305305 interrupts = <GIC_SPI 56 IRQ_TYPE_EDGE_RISING>;
306306 clocks = <&cpg CPG_MOD 36>;
307− clock-names = "ostm0";
308307 power-domains = <&cpg>;
309308 status = "disabled";
310309 };
@@ -314,7 +313,6 @@ · 3 unmodified lines
314313 reg = <0xe803c000 0x30>;
315314 interrupts = <GIC_SPI 57 IRQ_TYPE_EDGE_RISING>;
316315 clocks = <&cpg CPG_MOD 35>;
317− clock-names = "ostm1";
318316 power-domains = <&cpg>;
319317 status = "disabled";
320318 };
@@ -324,7 +322,6 @@ · 3 unmodified lines
324322 reg = <0xe803d000 0x30>;
325323 interrupts = <GIC_SPI 58 IRQ_TYPE_EDGE_RISING>;
326324 clocks = <&cpg CPG_MOD 34>;
327− clock-names = "ostm2";
328325 power-domains = <&cpg>;
329326 status = "disabled";
330327 };
arch/arm/boot/dts/r8a73a4.dtsi+8−1
@@ -131,7 +131,14 @@ · 130 unmodified lines
131131 cmt1: timer@e6130000 {
132132 compatible = "renesas,r8a73a4-cmt1", "renesas,rcar-gen2-cmt1";
133133 reg = <0 0xe6130000 0 0x1004>;
134− interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
134+ interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>,
135+ <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
136+ <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>,
137+ <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>,
138+ <GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>,
139+ <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>,
140+ <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>,
141+ <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
135142 clocks = <&mstp3_clks R8A73A4_CLK_CMT1>;
136143 clock-names = "fck";
137144 power-domains = <&pd_c5>;
arch/arm/boot/dts/r8a7740.dtsi+1−1
@@ -479,7 +479,7 @@ · 478 unmodified lines
479479 cpg_clocks: cpg_clocks@e6150000 {
480480 compatible = "renesas,r8a7740-cpg-clocks";
481481 reg = <0xe6150000 0x10000>;
482− clocks = <&extal1_clk>, <&extalr_clk>;
482+ clocks = <&extal1_clk>, <&extal2_clk>, <&extalr_clk>;
483483 #clock-cells = <1>;
484484 clock-output-names = "system", "pllc0", "pllc1",
485485 "pllc2", "r",
arch/arm/boot/dts/r8a7745-iwg22d-sodimm-dbhd-ca.dts+0−2
@@ -84,8 +84,6 @@ · 83 unmodified lines
8484 adi,input-depth = <8>;
8585 adi,input-colorspace = "rgb";
8686 adi,input-clock = "1x";
87− adi,input-style = <1>;
88− adi,input-justification = "evenly";
8987
9088 ports {
9189 #address-cells = <1>;
arch/arm/boot/dts/r8a7790-lager.dts+0−2
@@ -364,8 +364,6 @@ · 363 unmodified lines
364364 adi,input-depth = <8>;
365365 adi,input-colorspace = "rgb";
366366 adi,input-clock = "1x";
367− adi,input-style = <1>;
368− adi,input-justification = "evenly";
369367
370368 ports {
371369 #address-cells = <1>;
arch/arm/boot/dts/r8a7790-stout.dts+0−2
@@ -297,8 +297,6 @@ · 296 unmodified lines
297297 adi,input-depth = <8>;
298298 adi,input-colorspace = "rgb";
299299 adi,input-clock = "1x";
300− adi,input-style = <1>;
301− adi,input-justification = "evenly";
302300
303301 ports {
304302 #address-cells = <1>;
arch/arm/boot/dts/r8a7791-koelsch.dts+0−2
@@ -387,8 +387,6 @@ · 386 unmodified lines
387387 adi,input-depth = <8>;
388388 adi,input-colorspace = "rgb";
389389 adi,input-clock = "1x";
390− adi,input-style = <1>;
391− adi,input-justification = "evenly";
392390
393391 ports {
394392 #address-cells = <1>;
arch/arm/boot/dts/r8a7791-porter.dts+0−2
@@ -181,8 +181,6 @@ · 180 unmodified lines
181181 adi,input-depth = <8>;
182182 adi,input-colorspace = "rgb";
183183 adi,input-clock = "1x";
184− adi,input-style = <1>;
185− adi,input-justification = "evenly";
186184
187185 ports {
188186 #address-cells = <1>;
arch/arm/boot/dts/r8a7792-blanche.dts+0−2
@@ -289,8 +289,6 @@ · 288 unmodified lines
289289 adi,input-depth = <8>;
290290 adi,input-colorspace = "rgb";
291291 adi,input-clock = "1x";
292− adi,input-style = <1>;
293− adi,input-justification = "evenly";
294292
295293 ports {
296294 #address-cells = <1>;
arch/arm/boot/dts/r8a7792-wheat.dts+4−8
@@ -249,14 +249,12 @@ · 248 unmodified lines
249249 */
250250 hdmi@3d {
251251 compatible = "adi,adv7513";
252− reg = <0x3d>, <0x2d>, <0x4d>, <0x5d>;
253− reg-names = "main", "cec", "edid", "packet";
252+ reg = <0x3d>, <0x4d>, <0x2d>, <0x5d>;
253+ reg-names = "main", "edid", "cec", "packet";
254254
255255 adi,input-depth = <8>;
256256 adi,input-colorspace = "rgb";
257257 adi,input-clock = "1x";
258− adi,input-style = <1>;
259− adi,input-justification = "evenly";
260258
261259 ports {
262260 #address-cells = <1>;
@@ -280,14 +278,12 @@ · 17 unmodified lines
280278
281279 hdmi@39 {
282280 compatible = "adi,adv7513";
283− reg = <0x39>, <0x29>, <0x49>, <0x59>;
284− reg-names = "main", "cec", "edid", "packet";
281+ reg = <0x39>, <0x49>, <0x29>, <0x59>;
282+ reg-names = "main", "edid", "cec", "packet";
285283
286284 adi,input-depth = <8>;
287285 adi,input-colorspace = "rgb";
288286 adi,input-clock = "1x";
289− adi,input-style = <1>;
290− adi,input-justification = "evenly";
291287
292288 ports {
293289 #address-cells = <1>;
arch/arm/boot/dts/r8a7793-gose.dts+0−2
@@ -366,8 +366,6 @@ · 365 unmodified lines
366366 adi,input-depth = <8>;
367367 adi,input-colorspace = "rgb";
368368 adi,input-clock = "1x";
369− adi,input-style = <1>;
370− adi,input-justification = "evenly";
371369
372370 ports {
373371 #address-cells = <1>;
arch/arm/boot/dts/r8a7794-silk.dts+0−2
@@ -255,8 +255,6 @@ · 254 unmodified lines
255255 adi,input-depth = <8>;
256256 adi,input-colorspace = "rgb";
257257 adi,input-clock = "1x";
258− adi,input-style = <1>;
259− adi,input-justification = "evenly";
260258
261259 ports {
262260 #address-cells = <1>;
arch/arm/boot/dts/rk3036.dtsi+1−1
@@ -128,7 +128,7 @@ · 127 unmodified lines
128128 assigned-clocks = <&cru SCLK_GPU>;
129129 assigned-clock-rates = <100000000>;
130130 clocks = <&cru SCLK_GPU>, <&cru SCLK_GPU>;
131− clock-names = "core", "bus";
131+ clock-names = "bus", "core";
132132 resets = <&cru SRST_GPU>;
133133 status = "disabled";
134134 };
arch/arm/boot/dts/rk3228-evb.dts+1−1
@@ -46,7 +46,7 @@ · 45 unmodified lines
4646 #address-cells = <1>;
4747 #size-cells = <0>;
4848
49− phy: phy@0 {
49+ phy: ethernet-phy@0 {
5050 compatible = "ethernet-phy-id1234.d400", "ethernet-phy-ieee802.3-c22";
5151 reg = <0>;
5252 clocks = <&cru SCLK_MAC_PHY>;
arch/arm/boot/dts/rk3229-xms6.dts+1−1
@@ -150,7 +150,7 @@ · 149 unmodified lines
150150 #address-cells = <1>;
151151 #size-cells = <0>;
152152
153− phy: phy@0 {
153+ phy: ethernet-phy@0 {
154154 compatible = "ethernet-phy-id1234.d400",
155155 "ethernet-phy-ieee802.3-c22";
156156 reg = <0>;
arch/arm/boot/dts/rk322x.dtsi+3−3
@@ -555,7 +555,7 @@ · 554 unmodified lines
555555 "pp1",
556556 "ppmmu1";
557557 clocks = <&cru ACLK_GPU>, <&cru ACLK_GPU>;
558− clock-names = "core", "bus";
558+ clock-names = "bus", "core";
559559 resets = <&cru SRST_GPU_A>;
560560 status = "disabled";
561561 };
@@ -1020,7 +1020,7 @@ · 458 unmodified lines
10201020 };
10211021 };
10221022
1023− spi-0 {
1023+ spi0 {
10241024 spi0_clk: spi0-clk {
10251025 rockchip,pins = <0 RK_PB1 2 &pcfg_pull_up>;
10261026 };
@@ -1038,7 +1038,7 @@ · 11 unmodified lines
10381038 };
10391039 };
10401040
1041− spi-1 {
1041+ spi1 {
10421042 spi1_clk: spi1-clk {
10431043 rockchip,pins = <0 RK_PC7 2 &pcfg_pull_up>;
10441044 };
arch/arm/boot/dts/rk3xxx.dtsi+1−1
@@ -84,7 +84,7 @@ · 83 unmodified lines
8484 compatible = "arm,mali-400";
8585 reg = <0x10090000 0x10000>;
8686 clocks = <&cru ACLK_GPU>, <&cru ACLK_GPU>;
87− clock-names = "core", "bus";
87+ clock-names = "bus", "core";
8888 assigned-clocks = <&cru ACLK_GPU>;
8989 assigned-clock-rates = <100000000>;
9090 resets = <&cru SRST_GPU>;
arch/arm/configs/keystone_defconfig+1−0
@@ -147,6 +147,7 @@ CONFIG_I2C_DAVINCI=y · 146 unmodified lines
147147 CONFIG_SPI=y
148148 CONFIG_SPI_DAVINCI=y
149149 CONFIG_SPI_SPIDEV=y
150+CONFIG_PTP_1588_CLOCK=y
150151 CONFIG_PINCTRL_SINGLE=y
151152 CONFIG_GPIOLIB=y
152153 CONFIG_GPIO_SYSFS=y
arch/arm/configs/omap2plus_defconfig+1−0
@@ -274,6 +274,7 @@ CONFIG_SPI_TI_QSPI=m · 273 unmodified lines
274274 CONFIG_HSI=m
275275 CONFIG_OMAP_SSI=m
276276 CONFIG_SSI_PROTOCOL=m
277+CONFIG_PTP_1588_CLOCK=y
277278 CONFIG_PINCTRL_SINGLE=y
278279 CONFIG_DEBUG_GPIO=y
279280 CONFIG_GPIO_SYSFS=y
arch/arm/mach-oxnas/platsmp.c+2−1
@@ -27,7 +27,8 @@ static void __iomem *gic_cpu_ctrl; · 26 unmodified lines
2727 #define GIC_CPU_CTRL 0x00
2828 #define GIC_CPU_CTRL_ENABLE 1
2929
30−int __init ox820_boot_secondary(unsigned int cpu, struct task_struct *idle)
30+static int __init ox820_boot_secondary(unsigned int cpu,
31+ struct task_struct *idle)
3132 {
3233 /*
3334 * Write the address of secondary startup into the
arch/arm64/Kconfig+1−0
@@ -20,6 +20,7 @@ config ARM64 · 19 unmodified lines
2020 select ARCH_HAS_KCOV
2121 select ARCH_HAS_KEEPINITRD
2222 select ARCH_HAS_MEMBARRIER_SYNC_CORE
23+ select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
2324 select ARCH_HAS_PTE_DEVMAP
2425 select ARCH_HAS_PTE_SPECIAL
2526 select ARCH_HAS_SETUP_DMA_OPS
arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dts+1−1
@@ -98,7 +98,7 @@ · 97 unmodified lines
9898 };
9999
100100 &codec_analog {
101− hpvcc-supply = <&reg_eldo1>;
101+ cpvdd-supply = <&reg_eldo1>;
102102 status = "okay";
103103 };
104104
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi+0−18
@@ -154,24 +154,6 @@ · 153 unmodified lines
154154 };
155155 };
156156
157− sound_spdif {
158− compatible = "simple-audio-card";
159− simple-audio-card,name = "On-board SPDIF";
160−
161− simple-audio-card,cpu {
162− sound-dai = <&spdif>;
163− };
164−
165− simple-audio-card,codec {
166− sound-dai = <&spdif_out>;
167− };
168− };
169−
170− spdif_out: spdif-out {
171− #sound-dai-cells = <0>;
172− compatible = "linux,spdif-dit";
173− };
174−
175157 timer {
176158 compatible = "arm,armv8-timer";
177159 allwinner,erratum-unknown1;
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi+1−1
@@ -2319,7 +2319,7 @@ · 2318 unmodified lines
23192319 reg = <0x0 0xff400000 0x0 0x40000>;
23202320 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
23212321 clocks = <&clkc CLKID_USB1_DDR_BRIDGE>;
2322− clock-names = "ddr";
2322+ clock-names = "otg";
23232323 phys = <&usb2_phy1>;
23242324 phy-names = "usb2-phy";
23252325 dr_mode = "peripheral";
arch/arm64/boot/dts/amlogic/meson-g12.dtsi+0−1
@@ -1,4 +1,3 @@
1−
21 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
32 /*
43 * Copyright (c) 2019 BayLibre, SAS
arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi+4−0
@@ -154,6 +154,10 @@ · 153 unmodified lines
154154 clock-latency = <50000>;
155155 };
156156
157+&frddr_a {
158+ status = "okay";
159+};
160+
157161 &frddr_b {
158162 status = "okay";
159163 };
arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts+1−1
@@ -545,7 +545,7 @@ · 544 unmodified lines
545545 &usb {
546546 status = "okay";
547547 dr_mode = "host";
548− vbus-regulator = <&usb_pwr_en>;
548+ vbus-supply = <&usb_pwr_en>;
549549 };
550550
551551 &usb2_phy0 {
arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi+1−1
@@ -447,7 +447,7 @@ · 446 unmodified lines
447447
448448 edma0: dma-controller@22c0000 {
449449 #dma-cells = <2>;
450− compatible = "fsl,ls1028a-edma";
450+ compatible = "fsl,ls1028a-edma", "fsl,vf610-edma";
451451 reg = <0x0 0x22c0000 0x0 0x10000>,
452452 <0x0 0x22d0000 0x0 0x10000>,
453453 <0x0 0x22e0000 0x0 0x10000>;
arch/arm64/boot/dts/freescale/imx8mm.dtsi+4−4
@@ -264,7 +264,7 @@ · 263 unmodified lines
264264
265265 aips1: bus@30000000 {
266266 compatible = "fsl,aips-bus", "simple-bus";
267− reg = <0x301f0000 0x10000>;
267+ reg = <0x30000000 0x400000>;
268268 #address-cells = <1>;
269269 #size-cells = <1>;
270270 ranges = <0x30000000 0x30000000 0x400000>;
@@ -543,7 +543,7 @@ · 272 unmodified lines
543543
544544 aips2: bus@30400000 {
545545 compatible = "fsl,aips-bus", "simple-bus";
546− reg = <0x305f0000 0x10000>;
546+ reg = <0x30400000 0x400000>;
547547 #address-cells = <1>;
548548 #size-cells = <1>;
549549 ranges = <0x30400000 0x30400000 0x400000>;
@@ -603,7 +603,7 @@ · 53 unmodified lines
603603
604604 aips3: bus@30800000 {
605605 compatible = "fsl,aips-bus", "simple-bus";
606− reg = <0x309f0000 0x10000>;
606+ reg = <0x30800000 0x400000>;
607607 #address-cells = <1>;
608608 #size-cells = <1>;
609609 ranges = <0x30800000 0x30800000 0x400000>,
@@ -863,7 +863,7 @@ · 253 unmodified lines
863863
864864 aips4: bus@32c00000 {
865865 compatible = "fsl,aips-bus", "simple-bus";
866− reg = <0x32df0000 0x10000>;
866+ reg = <0x32c00000 0x400000>;
867867 #address-cells = <1>;
868868 #size-cells = <1>;
869869 ranges = <0x32c00000 0x32c00000 0x400000>;
arch/arm64/boot/dts/freescale/imx8mn.dtsi+5−5
@@ -241,7 +241,7 @@ · 240 unmodified lines
241241
242242 aips1: bus@30000000 {
243243 compatible = "fsl,aips-bus", "simple-bus";
244− reg = <0x301f0000 0x10000>;
244+ reg = <0x30000000 0x400000>;
245245 #address-cells = <1>;
246246 #size-cells = <1>;
247247 ranges;
@@ -448,7 +448,7 @@ · 200 unmodified lines
448448
449449 aips2: bus@30400000 {
450450 compatible = "fsl,aips-bus", "simple-bus";
451− reg = <0x305f0000 0x10000>;
451+ reg = <0x30400000 0x400000>;
452452 #address-cells = <1>;
453453 #size-cells = <1>;
454454 ranges;
@@ -508,7 +508,7 @@ · 53 unmodified lines
508508
509509 aips3: bus@30800000 {
510510 compatible = "fsl,aips-bus", "simple-bus";
511− reg = <0x309f0000 0x10000>;
511+ reg = <0x30800000 0x400000>;
512512 #address-cells = <1>;
513513 #size-cells = <1>;
514514 ranges;
@@ -718,7 +718,7 @@ · 203 unmodified lines
718718 reg = <0x30bd0000 0x10000>;
719719 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
720720 clocks = <&clk IMX8MN_CLK_SDMA1_ROOT>,
721− <&clk IMX8MN_CLK_SDMA1_ROOT>;
721+ <&clk IMX8MN_CLK_AHB>;
722722 clock-names = "ipg", "ahb";
723723 #dma-cells = <3>;
724724 fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
@@ -754,7 +754,7 @@ · 29 unmodified lines
754754
755755 aips4: bus@32c00000 {
756756 compatible = "fsl,aips-bus", "simple-bus";
757− reg = <0x32df0000 0x10000>;
757+ reg = <0x32c00000 0x400000>;
758758 #address-cells = <1>;
759759 #size-cells = <1>;
760760 ranges;
arch/arm64/boot/dts/freescale/imx8mp-pinfunc.h+23−23
@@ -151,26 +151,26 @@ · 150 unmodified lines
151151 #define MX8MP_IOMUXC_ENET_TXC__SIM_M_HADDR22 0x070 0x2D0 0x000 0x7 0x0
152152 #define MX8MP_IOMUXC_ENET_RX_CTL__ENET_QOS_RGMII_RX_CTL 0x074 0x2D4 0x000 0x0 0x0
153153 #define MX8MP_IOMUXC_ENET_RX_CTL__AUDIOMIX_SAI7_TX_SYNC 0x074 0x2D4 0x540 0x2 0x0
154−#define MX8MP_IOMUXC_ENET_RX_CTL__AUDIOMIX_BIT_STREAM03 0x074 0x2D4 0x4CC 0x3 0x0
154+#define MX8MP_IOMUXC_ENET_RX_CTL__AUDIOMIX_BIT_STREAM03 0x074 0x2D4 0x4CC 0x3 0x1
155155 #define MX8MP_IOMUXC_ENET_RX_CTL__GPIO1_IO24 0x074 0x2D4 0x000 0x5 0x0
156156 #define MX8MP_IOMUXC_ENET_RX_CTL__USDHC3_DATA2 0x074 0x2D4 0x618 0x6 0x0
157157 #define MX8MP_IOMUXC_ENET_RX_CTL__SIM_M_HADDR23 0x074 0x2D4 0x000 0x7 0x0
158158 #define MX8MP_IOMUXC_ENET_RXC__CCM_ENET_QOS_CLOCK_GENERATE_RX_CLK 0x078 0x2D8 0x000 0x0 0x0
159159 #define MX8MP_IOMUXC_ENET_RXC__ENET_QOS_RX_ER 0x078 0x2D8 0x000 0x1 0x0
160160 #define MX8MP_IOMUXC_ENET_RXC__AUDIOMIX_SAI7_TX_BCLK 0x078 0x2D8 0x53C 0x2 0x0
161−#define MX8MP_IOMUXC_ENET_RXC__AUDIOMIX_BIT_STREAM02 0x078 0x2D8 0x4C8 0x3 0x0
161+#define MX8MP_IOMUXC_ENET_RXC__AUDIOMIX_BIT_STREAM02 0x078 0x2D8 0x4C8 0x3 0x1
162162 #define MX8MP_IOMUXC_ENET_RXC__GPIO1_IO25 0x078 0x2D8 0x000 0x5 0x0
163163 #define MX8MP_IOMUXC_ENET_RXC__USDHC3_DATA3 0x078 0x2D8 0x61C 0x6 0x0
164164 #define MX8MP_IOMUXC_ENET_RXC__SIM_M_HADDR24 0x078 0x2D8 0x000 0x7 0x0
165165 #define MX8MP_IOMUXC_ENET_RD0__ENET_QOS_RGMII_RD0 0x07C 0x2DC 0x000 0x0 0x0
166166 #define MX8MP_IOMUXC_ENET_RD0__AUDIOMIX_SAI7_RX_DATA00 0x07C 0x2DC 0x534 0x2 0x0
167−#define MX8MP_IOMUXC_ENET_RD0__AUDIOMIX_BIT_STREAM01 0x07C 0x2DC 0x4C4 0x3 0x0
167+#define MX8MP_IOMUXC_ENET_RD0__AUDIOMIX_BIT_STREAM01 0x07C 0x2DC 0x4C4 0x3 0x1
168168 #define MX8MP_IOMUXC_ENET_RD0__GPIO1_IO26 0x07C 0x2DC 0x000 0x5 0x0
169169 #define MX8MP_IOMUXC_ENET_RD0__USDHC3_DATA4 0x07C 0x2DC 0x620 0x6 0x0
170170 #define MX8MP_IOMUXC_ENET_RD0__SIM_M_HADDR25 0x07C 0x2DC 0x000 0x7 0x0
171171 #define MX8MP_IOMUXC_ENET_RD1__ENET_QOS_RGMII_RD1 0x080 0x2E0 0x000 0x0 0x0
172172 #define MX8MP_IOMUXC_ENET_RD1__AUDIOMIX_SAI7_RX_SYNC 0x080 0x2E0 0x538 0x2 0x0
173−#define MX8MP_IOMUXC_ENET_RD1__AUDIOMIX_BIT_STREAM00 0x080 0x2E0 0x4C0 0x3 0x0
173+#define MX8MP_IOMUXC_ENET_RD1__AUDIOMIX_BIT_STREAM00 0x080 0x2E0 0x4C0 0x3 0x1
174174 #define MX8MP_IOMUXC_ENET_RD1__GPIO1_IO27 0x080 0x2E0 0x000 0x5 0x0
175175 #define MX8MP_IOMUXC_ENET_RD1__USDHC3_RESET_B 0x080 0x2E0 0x000 0x6 0x0
176176 #define MX8MP_IOMUXC_ENET_RD1__SIM_M_HADDR26 0x080 0x2E0 0x000 0x7 0x0
@@ -291,7 +291,7 @@ · 114 unmodified lines
291291 #define MX8MP_IOMUXC_SD2_DATA0__I2C4_SDA 0x0C8 0x328 0x5C0 0x2 0x1
292292 #define MX8MP_IOMUXC_SD2_DATA0__UART2_DCE_RX 0x0C8 0x328 0x5F0 0x3 0x2
293293 #define MX8MP_IOMUXC_SD2_DATA0__UART2_DTE_TX 0x0C8 0x328 0x000 0x3 0x0
294−#define MX8MP_IOMUXC_SD2_DATA0__AUDIOMIX_BIT_STREAM00 0x0C8 0x328 0x4C0 0x4 0x1
294+#define MX8MP_IOMUXC_SD2_DATA0__AUDIOMIX_BIT_STREAM00 0x0C8 0x328 0x4C0 0x4 0x2
295295 #define MX8MP_IOMUXC_SD2_DATA0__GPIO2_IO15 0x0C8 0x328 0x000 0x5 0x0
296296 #define MX8MP_IOMUXC_SD2_DATA0__CCMSRCGPCMIX_OBSERVE2 0x0C8 0x328 0x000 0x6 0x0
297297 #define MX8MP_IOMUXC_SD2_DATA0__OBSERVE_MUX_OUT02 0x0C8 0x328 0x000 0x7 0x0
@@ -313,7 +313,7 @@ · 15 unmodified lines
313313 #define MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3 0x0D4 0x334 0x000 0x0 0x0
314314 #define MX8MP_IOMUXC_SD2_DATA3__ECSPI2_MISO 0x0D4 0x334 0x56C 0x2 0x0
315315 #define MX8MP_IOMUXC_SD2_DATA3__AUDIOMIX_SPDIF_IN 0x0D4 0x334 0x544 0x3 0x1
316−#define MX8MP_IOMUXC_SD2_DATA3__AUDIOMIX_BIT_STREAM03 0x0D4 0x334 0x4CC 0x4 0x1
316+#define MX8MP_IOMUXC_SD2_DATA3__AUDIOMIX_BIT_STREAM03 0x0D4 0x334 0x4CC 0x4 0x2
317317 #define MX8MP_IOMUXC_SD2_DATA3__GPIO2_IO18 0x0D4 0x334 0x000 0x5 0x0
318318 #define MX8MP_IOMUXC_SD2_DATA3__CCMSRCGPCMIX_EARLY_RESET 0x0D4 0x334 0x000 0x6 0x0
319319 #define MX8MP_IOMUXC_SD2_RESET_B__USDHC2_RESET_B 0x0D8 0x338 0x000 0x0 0x0
@@ -487,27 +487,27 @@ · 167 unmodified lines
487487 #define MX8MP_IOMUXC_SAI5_RXD0__AUDIOMIX_SAI1_TX_DATA02 0x134 0x394 0x000 0x1 0x0
488488 #define MX8MP_IOMUXC_SAI5_RXD0__PWM2_OUT 0x134 0x394 0x000 0x2 0x0
489489 #define MX8MP_IOMUXC_SAI5_RXD0__I2C5_SCL 0x134 0x394 0x5C4 0x3 0x1
490−#define MX8MP_IOMUXC_SAI5_RXD0__AUDIOMIX_BIT_STREAM00 0x134 0x394 0x4C0 0x4 0x2
490+#define MX8MP_IOMUXC_SAI5_RXD0__AUDIOMIX_BIT_STREAM00 0x134 0x394 0x4C0 0x4 0x3
491491 #define MX8MP_IOMUXC_SAI5_RXD0__GPIO3_IO21 0x134 0x394 0x000 0x5 0x0
492492 #define MX8MP_IOMUXC_SAI5_RXD1__AUDIOMIX_SAI5_RX_DATA01 0x138 0x398 0x4FC 0x0 0x0
493493 #define MX8MP_IOMUXC_SAI5_RXD1__AUDIOMIX_SAI1_TX_DATA03 0x138 0x398 0x000 0x1 0x0
494494 #define MX8MP_IOMUXC_SAI5_RXD1__AUDIOMIX_SAI1_TX_SYNC 0x138 0x398 0x4D8 0x2 0x0
495495 #define MX8MP_IOMUXC_SAI5_RXD1__AUDIOMIX_SAI5_TX_SYNC 0x138 0x398 0x510 0x3 0x0
496−#define MX8MP_IOMUXC_SAI5_RXD1__AUDIOMIX_BIT_STREAM01 0x138 0x398 0x4C4 0x4 0x2
496+#define MX8MP_IOMUXC_SAI5_RXD1__AUDIOMIX_BIT_STREAM01 0x138 0x398 0x4C4 0x4 0x3
497497 #define MX8MP_IOMUXC_SAI5_RXD1__GPIO3_IO22 0x138 0x398 0x000 0x5 0x0
498498 #define MX8MP_IOMUXC_SAI5_RXD1__CAN1_TX 0x138 0x398 0x000 0x6 0x0
499499 #define MX8MP_IOMUXC_SAI5_RXD2__AUDIOMIX_SAI5_RX_DATA02 0x13C 0x39C 0x500 0x0 0x0
500500 #define MX8MP_IOMUXC_SAI5_RXD2__AUDIOMIX_SAI1_TX_DATA04 0x13C 0x39C 0x000 0x1 0x0
501501 #define MX8MP_IOMUXC_SAI5_RXD2__AUDIOMIX_SAI1_TX_SYNC 0x13C 0x39C 0x4D8 0x2 0x1
502502 #define MX8MP_IOMUXC_SAI5_RXD2__AUDIOMIX_SAI5_TX_BCLK 0x13C 0x39C 0x50C 0x3 0x0
503−#define MX8MP_IOMUXC_SAI5_RXD2__AUDIOMIX_BIT_STREAM02 0x13C 0x39C 0x4C8 0x4 0x2
503+#define MX8MP_IOMUXC_SAI5_RXD2__AUDIOMIX_BIT_STREAM02 0x13C 0x39C 0x4C8 0x4 0x3
504504 #define MX8MP_IOMUXC_SAI5_RXD2__GPIO3_IO23 0x13C 0x39C 0x000 0x5 0x0
505505 #define MX8MP_IOMUXC_SAI5_RXD2__CAN1_RX 0x13C 0x39C 0x54C 0x6 0x0
506506 #define MX8MP_IOMUXC_SAI5_RXD3__AUDIOMIX_SAI5_RX_DATA03 0x140 0x3A0 0x504 0x0 0x0
507507 #define MX8MP_IOMUXC_SAI5_RXD3__AUDIOMIX_SAI1_TX_DATA05 0x140 0x3A0 0x000 0x1 0x0
508508 #define MX8MP_IOMUXC_SAI5_RXD3__AUDIOMIX_SAI1_TX_SYNC 0x140 0x3A0 0x4D8 0x2 0x2
509509 #define MX8MP_IOMUXC_SAI5_RXD3__AUDIOMIX_SAI5_TX_DATA00 0x140 0x3A0 0x000 0x3 0x0
510−#define MX8MP_IOMUXC_SAI5_RXD3__AUDIOMIX_BIT_STREAM03 0x140 0x3A0 0x4CC 0x4 0x2
510+#define MX8MP_IOMUXC_SAI5_RXD3__AUDIOMIX_BIT_STREAM03 0x140 0x3A0 0x4CC 0x4 0x3
511511 #define MX8MP_IOMUXC_SAI5_RXD3__GPIO3_IO24 0x140 0x3A0 0x000 0x5 0x0
512512 #define MX8MP_IOMUXC_SAI5_RXD3__CAN2_TX 0x140 0x3A0 0x000 0x6 0x0
513513 #define MX8MP_IOMUXC_SAI5_MCLK__AUDIOMIX_SAI5_MCLK 0x144 0x3A4 0x4F0 0x0 0x0
@@ -528,22 +528,22 @@ · 14 unmodified lines
528528 #define MX8MP_IOMUXC_SAI1_RXD0__AUDIOMIX_SAI1_RX_DATA00 0x150 0x3B0 0x000 0x0 0x0
529529 #define MX8MP_IOMUXC_SAI1_RXD0__AUDIOMIX_SAI5_RX_DATA00 0x150 0x3B0 0x4F8 0x1 0x1
530530 #define MX8MP_IOMUXC_SAI1_RXD0__AUDIOMIX_SAI1_TX_DATA01 0x150 0x3B0 0x000 0x2 0x0
531−#define MX8MP_IOMUXC_SAI1_RXD0__AUDIOMIX_BIT_STREAM00 0x150 0x3B0 0x4C0 0x3 0x3
531+#define MX8MP_IOMUXC_SAI1_RXD0__AUDIOMIX_BIT_STREAM00 0x150 0x3B0 0x4C0 0x3 0x4
532532 #define MX8MP_IOMUXC_SAI1_RXD0__ENET1_1588_EVENT1_IN 0x150 0x3B0 0x000 0x4 0x0
533533 #define MX8MP_IOMUXC_SAI1_RXD0__GPIO4_IO02 0x150 0x3B0 0x000 0x5 0x0
534534 #define MX8MP_IOMUXC_SAI1_RXD1__AUDIOMIX_SAI1_RX_DATA01 0x154 0x3B4 0x000 0x0 0x0
535535 #define MX8MP_IOMUXC_SAI1_RXD1__AUDIOMIX_SAI5_RX_DATA01 0x154 0x3B4 0x4FC 0x1 0x1
536−#define MX8MP_IOMUXC_SAI1_RXD1__AUDIOMIX_BIT_STREAM01 0x154 0x3B4 0x4C4 0x3 0x3
536+#define MX8MP_IOMUXC_SAI1_RXD1__AUDIOMIX_BIT_STREAM01 0x154 0x3B4 0x4C4 0x3 0x4
537537 #define MX8MP_IOMUXC_SAI1_RXD1__ENET1_1588_EVENT1_OUT 0x154 0x3B4 0x000 0x4 0x0
538538 #define MX8MP_IOMUXC_SAI1_RXD1__GPIO4_IO03 0x154 0x3B4 0x000 0x5 0x0
539539 #define MX8MP_IOMUXC_SAI1_RXD2__AUDIOMIX_SAI1_RX_DATA02 0x158 0x3B8 0x000 0x0 0x0
540540 #define MX8MP_IOMUXC_SAI1_RXD2__AUDIOMIX_SAI5_RX_DATA02 0x158 0x3B8 0x500 0x1 0x1
541−#define MX8MP_IOMUXC_SAI1_RXD2__AUDIOMIX_BIT_STREAM02 0x158 0x3B8 0x4C8 0x3 0x3
541+#define MX8MP_IOMUXC_SAI1_RXD2__AUDIOMIX_BIT_STREAM02 0x158 0x3B8 0x4C8 0x3 0x4
542542 #define MX8MP_IOMUXC_SAI1_RXD2__ENET1_MDC 0x158 0x3B8 0x000 0x4 0x0
543543 #define MX8MP_IOMUXC_SAI1_RXD2__GPIO4_IO04 0x158 0x3B8 0x000 0x5 0x0
544544 #define MX8MP_IOMUXC_SAI1_RXD3__AUDIOMIX_SAI1_RX_DATA03 0x15C 0x3BC 0x000 0x0 0x0
545545 #define MX8MP_IOMUXC_SAI1_RXD3__AUDIOMIX_SAI5_RX_DATA03 0x15C 0x3BC 0x504 0x1 0x1
546−#define MX8MP_IOMUXC_SAI1_RXD3__AUDIOMIX_BIT_STREAM03 0x15C 0x3BC 0x4CC 0x3 0x3
546+#define MX8MP_IOMUXC_SAI1_RXD3__AUDIOMIX_BIT_STREAM03 0x15C 0x3BC 0x4CC 0x3 0x4
547547 #define MX8MP_IOMUXC_SAI1_RXD3__ENET1_MDIO 0x15C 0x3BC 0x57C 0x4 0x1
548548 #define MX8MP_IOMUXC_SAI1_RXD3__GPIO4_IO05 0x15C 0x3BC 0x000 0x5 0x0
549549 #define MX8MP_IOMUXC_SAI1_RXD4__AUDIOMIX_SAI1_RX_DATA04 0x160 0x3C0 0x000 0x0 0x0
@@ -624,7 +624,7 @@ · 74 unmodified lines
624624 #define MX8MP_IOMUXC_SAI2_RXFS__UART1_DCE_TX 0x19C 0x3FC 0x000 0x4 0x0
625625 #define MX8MP_IOMUXC_SAI2_RXFS__UART1_DTE_RX 0x19C 0x3FC 0x5E8 0x4 0x2
626626 #define MX8MP_IOMUXC_SAI2_RXFS__GPIO4_IO21 0x19C 0x3FC 0x000 0x5 0x0
627−#define MX8MP_IOMUXC_SAI2_RXFS__AUDIOMIX_BIT_STREAM02 0x19C 0x3FC 0x4C8 0x6 0x4
627+#define MX8MP_IOMUXC_SAI2_RXFS__AUDIOMIX_BIT_STREAM02 0x19C 0x3FC 0x4C8 0x6 0x5
628628 #define MX8MP_IOMUXC_SAI2_RXFS__SIM_M_HSIZE00 0x19C 0x3FC 0x000 0x7 0x0
629629 #define MX8MP_IOMUXC_SAI2_RXC__AUDIOMIX_SAI2_RX_BCLK 0x1A0 0x400 0x000 0x0 0x0
630630 #define MX8MP_IOMUXC_SAI2_RXC__AUDIOMIX_SAI5_TX_BCLK 0x1A0 0x400 0x50C 0x1 0x2
@@ -632,7 +632,7 @@ · 1 unmodified line
632632 #define MX8MP_IOMUXC_SAI2_RXC__UART1_DCE_RX 0x1A0 0x400 0x5E8 0x4 0x3
633633 #define MX8MP_IOMUXC_SAI2_RXC__UART1_DTE_TX 0x1A0 0x400 0x000 0x4 0x0
634634 #define MX8MP_IOMUXC_SAI2_RXC__GPIO4_IO22 0x1A0 0x400 0x000 0x5 0x0
635−#define MX8MP_IOMUXC_SAI2_RXC__AUDIOMIX_BIT_STREAM01 0x1A0 0x400 0x4C4 0x6 0x4
635+#define MX8MP_IOMUXC_SAI2_RXC__AUDIOMIX_BIT_STREAM01 0x1A0 0x400 0x4C4 0x6 0x5
636636 #define MX8MP_IOMUXC_SAI2_RXC__SIM_M_HSIZE01 0x1A0 0x400 0x000 0x7 0x0
637637 #define MX8MP_IOMUXC_SAI2_RXD0__AUDIOMIX_SAI2_RX_DATA00 0x1A4 0x404 0x000 0x0 0x0
638638 #define MX8MP_IOMUXC_SAI2_RXD0__AUDIOMIX_SAI5_TX_DATA00 0x1A4 0x404 0x000 0x1 0x0
@@ -641,7 +641,7 @@ · 2 unmodified lines
641641 #define MX8MP_IOMUXC_SAI2_RXD0__UART1_DCE_RTS 0x1A4 0x404 0x5E4 0x4 0x2
642642 #define MX8MP_IOMUXC_SAI2_RXD0__UART1_DTE_CTS 0x1A4 0x404 0x000 0x4 0x0
643643 #define MX8MP_IOMUXC_SAI2_RXD0__GPIO4_IO23 0x1A4 0x404 0x000 0x5 0x0
644−#define MX8MP_IOMUXC_SAI2_RXD0__AUDIOMIX_BIT_STREAM03 0x1A4 0x404 0x4CC 0x6 0x4
644+#define MX8MP_IOMUXC_SAI2_RXD0__AUDIOMIX_BIT_STREAM03 0x1A4 0x404 0x4CC 0x6 0x5
645645 #define MX8MP_IOMUXC_SAI2_RXD0__SIM_M_HSIZE02 0x1A4 0x404 0x000 0x7 0x0
646646 #define MX8MP_IOMUXC_SAI2_TXFS__AUDIOMIX_SAI2_TX_SYNC 0x1A8 0x408 0x000 0x0 0x0
647647 #define MX8MP_IOMUXC_SAI2_TXFS__AUDIOMIX_SAI5_TX_DATA01 0x1A8 0x408 0x000 0x1 0x0
@@ -650,13 +650,13 @@ · 2 unmodified lines
650650 #define MX8MP_IOMUXC_SAI2_TXFS__UART1_DCE_CTS 0x1A8 0x408 0x000 0x4 0x0
651651 #define MX8MP_IOMUXC_SAI2_TXFS__UART1_DTE_RTS 0x1A8 0x408 0x5E4 0x4 0x3
652652 #define MX8MP_IOMUXC_SAI2_TXFS__GPIO4_IO24 0x1A8 0x408 0x000 0x5 0x0
653−#define MX8MP_IOMUXC_SAI2_TXFS__AUDIOMIX_BIT_STREAM02 0x1A8 0x408 0x4C8 0x6 0x5
653+#define MX8MP_IOMUXC_SAI2_TXFS__AUDIOMIX_BIT_STREAM02 0x1A8 0x408 0x4C8 0x6 0x6
654654 #define MX8MP_IOMUXC_SAI2_TXFS__SIM_M_HWRITE 0x1A8 0x408 0x000 0x7 0x0
655655 #define MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_SAI2_TX_BCLK 0x1AC 0x40C 0x000 0x0 0x0
656656 #define MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_SAI5_TX_DATA02 0x1AC 0x40C 0x000 0x1 0x0
657657 #define MX8MP_IOMUXC_SAI2_TXC__CAN1_RX 0x1AC 0x40C 0x54C 0x3 0x1
658658 #define MX8MP_IOMUXC_SAI2_TXC__GPIO4_IO25 0x1AC 0x40C 0x000 0x5 0x0
659−#define MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_BIT_STREAM01 0x1AC 0x40C 0x4C4 0x6 0x5
659+#define MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_BIT_STREAM01 0x1AC 0x40C 0x4C4 0x6 0x6
660660 #define MX8MP_IOMUXC_SAI2_TXC__SIM_M_HREADYOUT 0x1AC 0x40C 0x000 0x7 0x0
661661 #define MX8MP_IOMUXC_SAI2_TXD0__AUDIOMIX_SAI2_TX_DATA00 0x1B0 0x410 0x000 0x0 0x0
662662 #define MX8MP_IOMUXC_SAI2_TXD0__AUDIOMIX_SAI5_TX_DATA03 0x1B0 0x410 0x000 0x1 0x0
@@ -680,7 +680,7 @@ · 17 unmodified lines
680680 #define MX8MP_IOMUXC_SAI3_RXFS__AUDIOMIX_SAI3_RX_DATA01 0x1B8 0x418 0x000 0x3 0x0
681681 #define MX8MP_IOMUXC_SAI3_RXFS__AUDIOMIX_SPDIF_IN 0x1B8 0x418 0x544 0x4 0x2
682682 #define MX8MP_IOMUXC_SAI3_RXFS__GPIO4_IO28 0x1B8 0x418 0x000 0x5 0x0
683−#define MX8MP_IOMUXC_SAI3_RXFS__AUDIOMIX_BIT_STREAM00 0x1B8 0x418 0x4C0 0x6 0x4
683+#define MX8MP_IOMUXC_SAI3_RXFS__AUDIOMIX_BIT_STREAM00 0x1B8 0x418 0x4C0 0x6 0x5
684684 #define MX8MP_IOMUXC_SAI3_RXFS__TPSMP_HTRANS00 0x1B8 0x418 0x000 0x7 0x0
685685 #define MX8MP_IOMUXC_SAI3_RXC__AUDIOMIX_SAI3_RX_BCLK 0x1BC 0x41C 0x000 0x0 0x0
686686 #define MX8MP_IOMUXC_SAI3_RXC__AUDIOMIX_SAI2_RX_DATA02 0x1BC 0x41C 0x000 0x1 0x0
@@ -697,7 +697,7 @@ · 10 unmodified lines
697697 #define MX8MP_IOMUXC_SAI3_RXD__UART2_DCE_RTS 0x1C0 0x420 0x5EC 0x4 0x3
698698 #define MX8MP_IOMUXC_SAI3_RXD__UART2_DTE_CTS 0x1C0 0x420 0x000 0x4 0x0
699699 #define MX8MP_IOMUXC_SAI3_RXD__GPIO4_IO30 0x1C0 0x420 0x000 0x5 0x0
700−#define MX8MP_IOMUXC_SAI3_RXD__AUDIOMIX_BIT_STREAM01 0x1C0 0x420 0x4C4 0x6 0x6
700+#define MX8MP_IOMUXC_SAI3_RXD__AUDIOMIX_BIT_STREAM01 0x1C0 0x420 0x4C4 0x6 0x7
701701 #define MX8MP_IOMUXC_SAI3_RXD__TPSMP_HDATA00 0x1C0 0x420 0x000 0x7 0x0
702702 #define MX8MP_IOMUXC_SAI3_TXFS__AUDIOMIX_SAI3_TX_SYNC 0x1C4 0x424 0x4EC 0x0 0x1
703703 #define MX8MP_IOMUXC_SAI3_TXFS__AUDIOMIX_SAI2_TX_DATA01 0x1C4 0x424 0x000 0x1 0x0
@@ -706,7 +706,7 @@ · 2 unmodified lines
706706 #define MX8MP_IOMUXC_SAI3_TXFS__UART2_DCE_RX 0x1C4 0x424 0x5F0 0x4 0x4
707707 #define MX8MP_IOMUXC_SAI3_TXFS__UART2_DTE_TX 0x1C4 0x424 0x000 0x4 0x0
708708 #define MX8MP_IOMUXC_SAI3_TXFS__GPIO4_IO31 0x1C4 0x424 0x000 0x5 0x0
709−#define MX8MP_IOMUXC_SAI3_TXFS__AUDIOMIX_BIT_STREAM03 0x1C4 0x424 0x4CC 0x6 0x5
709+#define MX8MP_IOMUXC_SAI3_TXFS__AUDIOMIX_BIT_STREAM03 0x1C4 0x424 0x4CC 0x6 0x6
710710 #define MX8MP_IOMUXC_SAI3_TXFS__TPSMP_HDATA01 0x1C4 0x424 0x000 0x7 0x0
711711 #define MX8MP_IOMUXC_SAI3_TXC__AUDIOMIX_SAI3_TX_BCLK 0x1C8 0x428 0x4E8 0x0 0x1
712712 #define MX8MP_IOMUXC_SAI3_TXC__AUDIOMIX_SAI2_TX_DATA02 0x1C8 0x428 0x000 0x1 0x0
@@ -715,7 +715,7 @@ · 2 unmodified lines
715715 #define MX8MP_IOMUXC_SAI3_TXC__UART2_DCE_TX 0x1C8 0x428 0x000 0x4 0x0
716716 #define MX8MP_IOMUXC_SAI3_TXC__UART2_DTE_RX 0x1C8 0x428 0x5F0 0x4 0x5
717717 #define MX8MP_IOMUXC_SAI3_TXC__GPIO5_IO00 0x1C8 0x428 0x000 0x5 0x0
718−#define MX8MP_IOMUXC_SAI3_TXC__AUDIOMIX_BIT_STREAM02 0x1C8 0x428 0x4C8 0x6 0x6
718+#define MX8MP_IOMUXC_SAI3_TXC__AUDIOMIX_BIT_STREAM02 0x1C8 0x428 0x4C8 0x6 0x7
719719 #define MX8MP_IOMUXC_SAI3_TXC__TPSMP_HDATA02 0x1C8 0x428 0x000 0x7 0x0
720720 #define MX8MP_IOMUXC_SAI3_TXD__AUDIOMIX_SAI3_TX_DATA00 0x1CC 0x42C 0x000 0x0 0x0
721721 #define MX8MP_IOMUXC_SAI3_TXD__AUDIOMIX_SAI2_TX_DATA03 0x1CC 0x42C 0x000 0x1 0x0
arch/arm64/boot/dts/freescale/imx8mp.dtsi+3−3
@@ -145,7 +145,7 @@ · 144 unmodified lines
145145
146146 aips1: bus@30000000 {
147147 compatible = "fsl,aips-bus", "simple-bus";
148− reg = <0x301f0000 0x10000>;
148+ reg = <0x30000000 0x400000>;
149149 #address-cells = <1>;
150150 #size-cells = <1>;
151151 ranges;
@@ -318,7 +318,7 @@ · 166 unmodified lines
318318
319319 aips2: bus@30400000 {
320320 compatible = "fsl,aips-bus", "simple-bus";
321− reg = <0x305f0000 0x400000>;
321+ reg = <0x30400000 0x400000>;
322322 #address-cells = <1>;
323323 #size-cells = <1>;
324324 ranges;
@@ -378,7 +378,7 @@ · 53 unmodified lines
378378
379379 aips3: bus@30800000 {
380380 compatible = "fsl,aips-bus", "simple-bus";
381− reg = <0x309f0000 0x400000>;
381+ reg = <0x30800000 0x400000>;
382382 #address-cells = <1>;
383383 #size-cells = <1>;
384384 ranges;
arch/arm64/boot/dts/freescale/imx8mq.dtsi+4−4
@@ -291,7 +291,7 @@ · 290 unmodified lines
291291
292292 bus@30000000 { /* AIPS1 */
293293 compatible = "fsl,aips-bus", "simple-bus";
294− reg = <0x301f0000 0x10000>;
294+ reg = <0x30000000 0x400000>;
295295 #address-cells = <1>;
296296 #size-cells = <1>;
297297 ranges = <0x30000000 0x30000000 0x400000>;
@@ -696,7 +696,7 @@ · 398 unmodified lines
696696
697697 bus@30400000 { /* AIPS2 */
698698 compatible = "fsl,aips-bus", "simple-bus";
699− reg = <0x305f0000 0x10000>;
699+ reg = <0x30400000 0x400000>;
700700 #address-cells = <1>;
701701 #size-cells = <1>;
702702 ranges = <0x30400000 0x30400000 0x400000>;
@@ -756,7 +756,7 @@ · 53 unmodified lines
756756
757757 bus@30800000 { /* AIPS3 */
758758 compatible = "fsl,aips-bus", "simple-bus";
759− reg = <0x309f0000 0x10000>;
759+ reg = <0x30800000 0x400000>;
760760 #address-cells = <1>;
761761 #size-cells = <1>;
762762 ranges = <0x30800000 0x30800000 0x400000>,
@@ -1029,7 +1029,7 @@ · 266 unmodified lines
10291029
10301030 bus@32c00000 { /* AIPS4 */
10311031 compatible = "fsl,aips-bus", "simple-bus";
1032− reg = <0x32df0000 0x10000>;
1032+ reg = <0x32c00000 0x400000>;
10331033 #address-cells = <1>;
10341034 #size-cells = <1>;
10351035 ranges = <0x32c00000 0x32c00000 0x400000>;
arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi+20−3
@@ -658,8 +658,8 @@ · 657 unmodified lines
658658 s11 {
659659 qcom,saw-leader;
660660 regulator-always-on;
661− regulator-min-microvolt = <1230000>;
662− regulator-max-microvolt = <1230000>;
661+ regulator-min-microvolt = <980000>;
662+ regulator-max-microvolt = <980000>;
663663 };
664664 };
665665
@@ -908,10 +908,27 @@ · 242 unmodified lines
908908 status = "okay";
909909 };
910910
911+&q6asmdai {
912+ dai@0 {
913+ reg = <0>;
914+ };
915+
916+ dai@1 {
917+ reg = <1>;
918+ };
919+
920+ dai@2 {
921+ reg = <2>;
922+ };
923+};
924+
911925 &sound {
912926 compatible = "qcom,apq8096-sndcard";
913927 model = "DB820c";
914− audio-routing = "RX_BIAS", "MCLK";
928+ audio-routing = "RX_BIAS", "MCLK",
929+ "MM_DL1", "MultiMedia1 Playback",
930+ "MM_DL2", "MultiMedia2 Playback",
931+ "MultiMedia3 Capture", "MM_UL3";
915932
916933 mm1-dai-link {
917934 link-name = "MultiMedia1";
arch/arm64/boot/dts/qcom/msm8996.dtsi+2−0
@@ -2066,6 +2066,8 @@ · 2065 unmodified lines
20662066 reg = <APR_SVC_ASM>;
20672067 q6asmdai: dais {
20682068 compatible = "qcom,q6asm-dais";
2069+ #address-cells = <1>;
2070+ #size-cells = <0>;
20692071 #sound-dai-cells = <1>;
20702072 iommus = <&lpass_q6_smmu 1>;
20712073 };
arch/arm64/boot/dts/qcom/sdm845-db845c.dts+0−3
@@ -442,17 +442,14 @@ · 441 unmodified lines
442442 &q6asmdai {
443443 dai@0 {
444444 reg = <0>;
445− direction = <2>;
446445 };
447446
448447 dai@1 {
449448 reg = <1>;
450− direction = <2>;
451449 };
452450
453451 dai@2 {
454452 reg = <2>;
455− direction = <1>;
456453 };
457454
458455 dai@3 {
arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts+0−2
@@ -359,12 +359,10 @@ · 358 unmodified lines
359359 &q6asmdai {
360360 dai@0 {
361361 reg = <0>;
362− direction = <2>;
363362 };
364363
365364 dai@1 {
366365 reg = <1>;
367− direction = <1>;
368366 };
369367 };
370368
arch/arm64/boot/dts/renesas/r8a77970-eagle.dts+0−2
@@ -137,8 +137,6 @@ · 136 unmodified lines
137137 adi,input-depth = <8>;
138138 adi,input-colorspace = "rgb";
139139 adi,input-clock = "1x";
140− adi,input-style = <1>;
141− adi,input-justification = "evenly";
142140
143141 ports {
144142 #address-cells = <1>;
arch/arm64/boot/dts/renesas/r8a77970-v3msk.dts+0−2
@@ -150,8 +150,6 @@ · 149 unmodified lines
150150 adi,input-depth = <8>;
151151 adi,input-colorspace = "rgb";
152152 adi,input-clock = "1x";
153− adi,input-style = <1>;
154− adi,input-justification = "evenly";
155153
156154 ports {
157155 #address-cells = <1>;
arch/arm64/boot/dts/renesas/r8a77980-condor.dts+0−2
@@ -174,8 +174,6 @@ · 173 unmodified lines
174174 adi,input-depth = <8>;
175175 adi,input-colorspace = "rgb";
176176 adi,input-clock = "1x";
177− adi,input-style = <1>;
178− adi,input-justification = "evenly";
179177
180178 ports {
181179 #address-cells = <1>;
arch/arm64/boot/dts/renesas/r8a77980-v3hsk.dts+0−2
@@ -141,8 +141,6 @@ · 140 unmodified lines
141141 adi,input-depth = <8>;
142142 adi,input-colorspace = "rgb";
143143 adi,input-clock = "1x";
144− adi,input-style = <1>;
145− adi,input-justification = "evenly";
146144
147145 ports {
148146 #address-cells = <1>;
arch/arm64/boot/dts/renesas/r8a77980.dtsi+2−0
@@ -1318,6 +1318,7 @@ · 1317 unmodified lines
13181318 ipmmu_vip0: mmu@e7b00000 {
13191319 compatible = "renesas,ipmmu-r8a77980";
13201320 reg = <0 0xe7b00000 0 0x1000>;
1321+ renesas,ipmmu-main = <&ipmmu_mm 4>;
13211322 power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
13221323 #iommu-cells = <1>;
13231324 };
@@ -1325,6 +1326,7 @@ · 1 unmodified line
13251326 ipmmu_vip1: mmu@e7960000 {
13261327 compatible = "renesas,ipmmu-r8a77980";
13271328 reg = <0 0xe7960000 0 0x1000>;
1329+ renesas,ipmmu-main = <&ipmmu_mm 11>;
13281330 power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
13291331 #iommu-cells = <1>;
13301332 };
arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts+0−2
@@ -360,8 +360,6 @@ · 359 unmodified lines
360360 adi,input-depth = <8>;
361361 adi,input-colorspace = "rgb";
362362 adi,input-clock = "1x";
363− adi,input-style = <1>;
364− adi,input-justification = "evenly";
365363
366364 ports {
367365 #address-cells = <1>;
arch/arm64/boot/dts/renesas/r8a77995-draak.dts+2−4
@@ -272,8 +272,8 @@ · 271 unmodified lines
272272
273273 hdmi-encoder@39 {
274274 compatible = "adi,adv7511w";
275− reg = <0x39>, <0x3f>, <0x38>, <0x3c>;
276− reg-names = "main", "edid", "packet", "cec";
275+ reg = <0x39>, <0x3f>, <0x3c>, <0x38>;
276+ reg-names = "main", "edid", "cec", "packet";
277277 interrupt-parent = <&gpio1>;
278278 interrupts = <28 IRQ_TYPE_LEVEL_LOW>;
279279
@@ -284,8 +284,6 @@ · 4 unmodified lines
284284 adi,input-depth = <8>;
285285 adi,input-colorspace = "rgb";
286286 adi,input-clock = "1x";
287− adi,input-style = <1>;
288− adi,input-justification = "evenly";
289287
290288 ports {
291289 #address-cells = <1>;
arch/arm64/boot/dts/rockchip/px30.dtsi+1−1
@@ -143,7 +143,7 @@ · 142 unmodified lines
143143 };
144144
145145 arm-pmu {
146− compatible = "arm,cortex-a53-pmu";
146+ compatible = "arm,cortex-a35-pmu";
147147 interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
148148 <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>,
149149 <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,
arch/arm64/boot/dts/rockchip/rk3308.dtsi+1−1
@@ -127,7 +127,7 @@ · 126 unmodified lines
127127 };
128128
129129 arm-pmu {
130− compatible = "arm,cortex-a53-pmu";
130+ compatible = "arm,cortex-a35-pmu";
131131 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>,
132132 <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>,
133133 <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>,
arch/arm64/boot/dts/rockchip/rk3328-evb.dts+2−3
@@ -82,17 +82,16 @@ · 81 unmodified lines
8282 &gmac2phy {
8383 phy-supply = <&vcc_phy>;
8484 clock_in_out = "output";
85− assigned-clocks = <&cru SCLK_MAC2PHY_SRC>;
8685 assigned-clock-rate = <50000000>;
8786 assigned-clocks = <&cru SCLK_MAC2PHY>;
8887 assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>;
89−
88+ status = "okay";
9089 };
9190
9291 &i2c1 {
9392 status = "okay";
9493
95− rk805: rk805@18 {
94+ rk805: pmic@18 {
9695 compatible = "rockchip,rk805";
9796 reg = <0x18>;
9897 interrupt-parent = <&gpio2>;
arch/arm64/boot/dts/rockchip/rk3328-rock64.dts+1−1
@@ -170,7 +170,7 @@ · 169 unmodified lines
170170 &i2c1 {
171171 status = "okay";
172172
173− rk805: rk805@18 {
173+ rk805: pmic@18 {
174174 compatible = "rockchip,rk805";
175175 reg = <0x18>;
176176 interrupt-parent = <&gpio2>;
arch/arm64/boot/dts/rockchip/rk3328.dtsi+0−18
@@ -299,8 +299,6 @@ · 298 unmodified lines
299299 grf: syscon@ff100000 {
300300 compatible = "rockchip,rk3328-grf", "syscon", "simple-mfd";
301301 reg = <0x0 0xff100000 0x0 0x1000>;
302− #address-cells = <1>;
303− #size-cells = <1>;
304302
305303 io_domains: io-domains {
306304 compatible = "rockchip,rk3328-io-voltage-domain";
@@ -1794,10 +1792,6 @@ · 1487 unmodified lines
17941792 };
17951793
17961794 gmac2phy {
1797− fephyled_speed100: fephyled-speed100 {
1798− rockchip,pins = <0 RK_PD7 1 &pcfg_pull_none>;
1799− };
1800−
18011795 fephyled_speed10: fephyled-speed10 {
18021796 rockchip,pins = <0 RK_PD6 1 &pcfg_pull_none>;
18031797 };
@@ -1806,18 +1800,6 @@ · 2 unmodified lines
18061800 rockchip,pins = <0 RK_PD6 2 &pcfg_pull_none>;
18071801 };
18081802
1809− fephyled_rxm0: fephyled-rxm0 {
1810− rockchip,pins = <0 RK_PD5 1 &pcfg_pull_none>;
1811− };
1812−
1813− fephyled_txm0: fephyled-txm0 {
1814− rockchip,pins = <0 RK_PD5 2 &pcfg_pull_none>;
1815− };
1816−
1817− fephyled_linkm0: fephyled-linkm0 {
1818− rockchip,pins = <0 RK_PD4 1 &pcfg_pull_none>;
1819− };
1820−
18211803 fephyled_rxm1: fephyled-rxm1 {
18221804 rockchip,pins = <2 RK_PD1 2 &pcfg_pull_none>;
18231805 };
arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts+5−4
@@ -147,7 +147,7 @@ · 146 unmodified lines
147147 "Speaker", "Speaker Amplifier OUTL",
148148 "Speaker", "Speaker Amplifier OUTR";
149149
150− simple-audio-card,hp-det-gpio = <&gpio0 RK_PB0 GPIO_ACTIVE_LOW>;
150+ simple-audio-card,hp-det-gpio = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>;
151151 simple-audio-card,aux-devs = <&speaker_amp>;
152152 simple-audio-card,pin-switches = "Speaker";
153153
@@ -690,7 +690,8 @@ · 536 unmodified lines
690690 fusb0: fusb30x@22 {
691691 compatible = "fcs,fusb302";
692692 reg = <0x22>;
693− fcs,int_n = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>;
693+ interrupt-parent = <&gpio1>;
694+ interrupts = <RK_PA2 IRQ_TYPE_LEVEL_LOW>;
694695 pinctrl-names = "default";
695696 pinctrl-0 = <&fusb0_int_gpio>;
696697 vbus-supply = <&vbus_typec>;
@@ -788,13 +789,13 @@ · 91 unmodified lines
788789
789790 dc-charger {
790791 dc_det_gpio: dc-det-gpio {
791− rockchip,pins = <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
792+ rockchip,pins = <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>;
792793 };
793794 };
794795
795796 es8316 {
796797 hp_det_gpio: hp-det-gpio {
797− rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_down>;
798+ rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>;
798799 };
799800 };
800801
arch/arm64/boot/dts/rockchip/rk3399.dtsi+6−8
@@ -403,7 +403,7 @@ · 402 unmodified lines
403403 reset-names = "usb3-otg";
404404 status = "disabled";
405405
406− usbdrd_dwc3_0: dwc3 {
406+ usbdrd_dwc3_0: usb@fe800000 {
407407 compatible = "snps,dwc3";
408408 reg = <0x0 0xfe800000 0x0 0x100000>;
409409 interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH 0>;
@@ -439,7 +439,7 @@ · 29 unmodified lines
439439 reset-names = "usb3-otg";
440440 status = "disabled";
441441
442− usbdrd_dwc3_1: dwc3 {
442+ usbdrd_dwc3_1: usb@fe900000 {
443443 compatible = "snps,dwc3";
444444 reg = <0x0 0xfe900000 0x0 0x100000>;
445445 interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH 0>;
@@ -1124,8 +1124,6 @@ · 678 unmodified lines
11241124 pmugrf: syscon@ff320000 {
11251125 compatible = "rockchip,rk3399-pmugrf", "syscon", "simple-mfd";
11261126 reg = <0x0 0xff320000 0x0 0x1000>;
1127− #address-cells = <1>;
1128− #size-cells = <1>;
11291127
11301128 pmu_io_domains: io-domains {
11311129 compatible = "rockchip,rk3399-pmu-io-voltage-domain";
@@ -1883,10 +1881,10 @@ · 751 unmodified lines
18831881 gpu: gpu@ff9a0000 {
18841882 compatible = "rockchip,rk3399-mali", "arm,mali-t860";
18851883 reg = <0x0 0xff9a0000 0x0 0x10000>;
1886− interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH 0>,
1887− <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH 0>,
1888− <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH 0>;
1889− interrupt-names = "gpu", "job", "mmu";
1884+ interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH 0>,
1885+ <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH 0>,
1886+ <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH 0>;
1887+ interrupt-names = "job", "mmu", "gpu";
18901888 clocks = <&cru ACLK_GPU>;
18911889 #cooling-cells = <2>;
18921890 power-domains = <&power RK3399_PD_GPU>;
arch/arm64/configs/defconfig+6−3
@@ -208,7 +208,7 @@ CONFIG_PCIE_QCOM=y · 207 unmodified lines
208208 CONFIG_PCIE_ARMADA_8K=y
209209 CONFIG_PCIE_KIRIN=y
210210 CONFIG_PCIE_HISI_STB=y
211−CONFIG_PCIE_TEGRA194=m
211+CONFIG_PCIE_TEGRA194_HOST=m
212212 CONFIG_DEVTMPFS=y
213213 CONFIG_DEVTMPFS_MOUNT=y
214214 CONFIG_FW_LOADER_USER_HELPER=y
@@ -567,6 +567,7 @@ CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y · 352 unmodified lines
567567 CONFIG_MEDIA_SDR_SUPPORT=y
568568 CONFIG_MEDIA_CONTROLLER=y
569569 CONFIG_VIDEO_V4L2_SUBDEV_API=y
570+CONFIG_MEDIA_PLATFORM_SUPPORT=y
570571 # CONFIG_DVB_NET is not set
571572 CONFIG_MEDIA_USB_SUPPORT=y
572573 CONFIG_USB_VIDEO_CLASS=m
@@ -610,8 +611,9 @@ CONFIG_DRM_MSM=m · 37 unmodified lines
610611 CONFIG_DRM_TEGRA=m
611612 CONFIG_DRM_PANEL_LVDS=m
612613 CONFIG_DRM_PANEL_SIMPLE=m
613−CONFIG_DRM_DUMB_VGA_DAC=m
614+CONFIG_DRM_SIMPLE_BRIDGE=m
614615 CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA=m
616+CONFIG_DRM_DISPLAY_CONNECTOR=m
615617 CONFIG_DRM_SII902X=m
616618 CONFIG_DRM_THINE_THC63LVD1024=m
617619 CONFIG_DRM_TI_SN65DSI86=m
@@ -848,7 +850,8 @@ CONFIG_QCOM_APR=m · 230 unmodified lines
848850 CONFIG_ARCH_R8A774A1=y
849851 CONFIG_ARCH_R8A774B1=y
850852 CONFIG_ARCH_R8A774C0=y
851−CONFIG_ARCH_R8A7795=y
853+CONFIG_ARCH_R8A77950=y
854+CONFIG_ARCH_R8A77951=y
852855 CONFIG_ARCH_R8A77960=y
853856 CONFIG_ARCH_R8A77961=y
854857 CONFIG_ARCH_R8A77965=y
arch/arm64/include/asm/uaccess.h+1−1
@@ -304,7 +304,7 @@ do { \ · 303 unmodified lines
304304 __p = uaccess_mask_ptr(__p); \
305305 __raw_get_user((x), __p, (err)); \
306306 } else { \
307− (x) = 0; (err) = -EFAULT; \
307+ (x) = (__force __typeof__(x))0; (err) = -EFAULT; \
308308 } \
309309 } while (0)
310310
arch/arm64/kernel/machine_kexec.c+1−0
@@ -177,6 +177,7 @@ void machine_kexec(struct kimage *kimage) · 176 unmodified lines
177177 * the offline CPUs. Therefore, we must use the __* variant here.
178178 */
179179 __flush_icache_range((uintptr_t)reboot_code_buffer,
180+ (uintptr_t)reboot_code_buffer +
180181 arm64_relocate_new_kernel_size);
181182
182183 /* Flush the kimage list and its buffers. */
arch/arm64/kernel/ptrace.c+4−3
@@ -1829,10 +1829,11 @@ static void tracehook_report_syscall(struct pt_regs *regs, · 1828 unmodified lines
18291829
18301830 int syscall_trace_enter(struct pt_regs *regs)
18311831 {
1832− if (test_thread_flag(TIF_SYSCALL_TRACE) ||
1833− test_thread_flag(TIF_SYSCALL_EMU)) {
1832+ unsigned long flags = READ_ONCE(current_thread_info()->flags);
1833+
1834+ if (flags & (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE)) {
18341835 tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
1835− if (!in_syscall(regs) || test_thread_flag(TIF_SYSCALL_EMU))
1836+ if (!in_syscall(regs) || (flags & _TIF_SYSCALL_EMU))
18361837 return -1;
18371838 }
18381839
arch/csky/Kconfig+2−0
@@ -8,6 +8,7 @@ config CSKY · 7 unmodified lines
88 select ARCH_HAS_SYNC_DMA_FOR_DEVICE
99 select ARCH_USE_BUILTIN_BSWAP
1010 select ARCH_USE_QUEUED_RWLOCKS if NR_CPUS>2
11+ select ARCH_WANT_FRAME_POINTERS if !CPU_CK610
1112 select COMMON_CLK
1213 select CLKSRC_MMIO
1314 select CSKY_MPINTC if CPU_CK860
@@ -38,6 +39,7 @@ config CSKY · 24 unmodified lines
3839 select HAVE_ARCH_TRACEHOOK
3940 select HAVE_ARCH_AUDITSYSCALL
4041 select HAVE_COPY_THREAD_TLS
42+ select HAVE_DEBUG_BUGVERBOSE
4143 select HAVE_DYNAMIC_FTRACE
4244 select HAVE_DYNAMIC_FTRACE_WITH_REGS
4345 select HAVE_FUNCTION_TRACER
arch/csky/Makefile+1−1
@@ -47,7 +47,7 @@ ifeq ($(CSKYABI),abiv2) · 46 unmodified lines
4747 KBUILD_CFLAGS += -mno-stack-size
4848 endif
4949
50−ifdef CONFIG_STACKTRACE
50+ifdef CONFIG_FRAME_POINTER
5151 KBUILD_CFLAGS += -mbacktrace
5252 endif
5353
arch/csky/abiv1/inc/abi/entry.h+2−2
@@ -167,8 +167,8 @@ · 166 unmodified lines
167167 * BA Reserved C D V
168168 */
169169 cprcr r6, cpcr30
170− lsri r6, 28
171− lsli r6, 28
170+ lsri r6, 29
171+ lsli r6, 29
172172 addi r6, 0xe
173173 cpwcr r6, cpcr30
174174
arch/csky/abiv2/inc/abi/entry.h+2−2
@@ -285,8 +285,8 @@ · 284 unmodified lines
285285 */
286286 mfcr r6, cr<30, 15> /* Get MSA0 */
287287 2:
288− lsri r6, 28
289− lsli r6, 28
288+ lsri r6, 29
289+ lsli r6, 29
290290 addi r6, 0x1ce
291291 mtcr r6, cr<30, 15> /* Set MSA0 */
292292
arch/csky/abiv2/mcount.S+2−0
@@ -103,6 +103,8 @@ ENTRY(_mcount) · 102 unmodified lines
103103 mov a0, lr
104104 subi a0, 4
105105 ldw a1, (sp, 24)
106+ lrw a2, function_trace_op
107+ ldw a2, (a2, 0)
106108
107109 jsr r26
108110
arch/csky/include/asm/processor.h+2−4
@@ -41,8 +41,7 @@ extern struct cpuinfo_csky cpu_data[]; · 40 unmodified lines
4141 #define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
4242
4343 struct thread_struct {
44− unsigned long ksp; /* kernel stack pointer */
45− unsigned long sr; /* saved status register */
44+ unsigned long sp; /* kernel stack pointer */
4645 unsigned long trap_no; /* saved status register */
4746
4847 /* FPU regs */
@@ -50,8 +49,7 @@ struct thread_struct { · 1 unmodified line
5049 };
5150
5251 #define INIT_THREAD { \
53− .ksp = sizeof(init_stack) + (unsigned long) &init_stack, \
54− .sr = DEFAULT_PSR_VALUE, \
52+ .sp = sizeof(init_stack) + (unsigned long) &init_stack, \
5553 }
5654
5755 /*
arch/csky/include/asm/ptrace.h+10−0
@@ -58,6 +58,16 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs) · 57 unmodified lines
5858 return regs->usp;
5959 }
6060
61+static inline unsigned long frame_pointer(struct pt_regs *regs)
62+{
63+ return regs->regs[4];
64+}
65+static inline void frame_pointer_set(struct pt_regs *regs,
66+ unsigned long val)
67+{
68+ regs->regs[4] = val;
69+}
70+
6171 extern int regs_query_register_offset(const char *name);
6272 extern unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
6373 unsigned int n);
arch/csky/include/asm/thread_info.h+11−5
@@ -38,7 +38,13 @@ struct thread_info { · 37 unmodified lines
3838 #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT)
3939
4040 #define thread_saved_fp(tsk) \
41− ((unsigned long)(((struct switch_stack *)(tsk->thread.ksp))->r8))
41+ ((unsigned long)(((struct switch_stack *)(tsk->thread.sp))->r8))
42+
43+#define thread_saved_sp(tsk) \
44+ ((unsigned long)(tsk->thread.sp))
45+
46+#define thread_saved_lr(tsk) \
47+ ((unsigned long)(((struct switch_stack *)(tsk->thread.sp))->r15))
4248
4349 static inline struct thread_info *current_thread_info(void)
4450 {
@@ -54,10 +60,10 @@ static inline struct thread_info *current_thread_info(void) · 9 unmodified lines
5460 #define TIF_SIGPENDING 0 /* signal pending */
5561 #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
5662 #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
57−#define TIF_SYSCALL_TRACE 3 /* syscall trace active */
58−#define TIF_SYSCALL_TRACEPOINT 4 /* syscall tracepoint instrumentation */
59−#define TIF_SYSCALL_AUDIT 5 /* syscall auditing */
60−#define TIF_UPROBE 6 /* uprobe breakpoint or singlestep */
63+#define TIF_UPROBE 3 /* uprobe breakpoint or singlestep */
64+#define TIF_SYSCALL_TRACE 4 /* syscall trace active */
65+#define TIF_SYSCALL_TRACEPOINT 5 /* syscall tracepoint instrumentation */
66+#define TIF_SYSCALL_AUDIT 6 /* syscall auditing */
6167 #define TIF_POLLING_NRFLAG 16 /* poll_idle() is TIF_NEED_RESCHED */
6268 #define TIF_MEMDIE 18 /* is terminating due to OOM killer */
6369 #define TIF_RESTORE_SIGMASK 20 /* restore signal mask in do_signal() */
arch/csky/include/asm/uaccess.h+26−23
@@ -253,7 +253,7 @@ do { \ · 252 unmodified lines
253253
254254 extern int __get_user_bad(void);
255255
256−#define __copy_user(to, from, n) \
256+#define ___copy_to_user(to, from, n) \
257257 do { \
258258 int w0, w1, w2, w3; \
259259 asm volatile( \
@@ -288,31 +288,34 @@ do { \ · 28 unmodified lines
288288 " subi %0, 4 \n" \
289289 " br 3b \n" \
290290 "5: cmpnei %0, 0 \n" /* 1B */ \
291− " bf 8f \n" \
291+ " bf 13f \n" \
292292 " ldb %3, (%2, 0) \n" \
293293 "6: stb %3, (%1, 0) \n" \
294294 " addi %2, 1 \n" \
295295 " addi %1, 1 \n" \
296296 " subi %0, 1 \n" \
297297 " br 5b \n" \
298− "7: br 8f \n" \
298+ "7: subi %0, 4 \n" \
299+ "8: subi %0, 4 \n" \
300+ "12: subi %0, 4 \n" \
301+ " br 13f \n" \
299302 ".section __ex_table, \"a\" \n" \
300303 ".align 2 \n" \
301− ".long 2b, 7b \n" \
302− ".long 9b, 7b \n" \
303− ".long 10b, 7b \n" \
304+ ".long 2b, 13f \n" \
305+ ".long 4b, 13f \n" \
306+ ".long 6b, 13f \n" \
307+ ".long 9b, 12b \n" \
308+ ".long 10b, 8b \n" \
304309 ".long 11b, 7b \n" \
305− ".long 4b, 7b \n" \
306− ".long 6b, 7b \n" \
307310 ".previous \n" \
308− "8: \n" \
311+ "13: \n" \
309312 : "=r"(n), "=r"(to), "=r"(from), "=r"(w0), \
310313 "=r"(w1), "=r"(w2), "=r"(w3) \
311314 : "0"(n), "1"(to), "2"(from) \
312315 : "memory"); \
313316 } while (0)
314317
315−#define __copy_user_zeroing(to, from, n) \
318+#define ___copy_from_user(to, from, n) \
316319 do { \
317320 int tmp; \
318321 int nsave; \
@@ -355,22 +358,22 @@ do { \ · 36 unmodified lines
355358 " addi %1, 1 \n" \
356359 " subi %0, 1 \n" \
357360 " br 5b \n" \
358− "8: mov %3, %0 \n" \
359− " movi %4, 0 \n" \
360− "9: stb %4, (%1, 0) \n" \
361− " addi %1, 1 \n" \
362− " subi %3, 1 \n" \
363− " cmpnei %3, 0 \n" \
364− " bt 9b \n" \
365− " br 7f \n" \
361+ "8: stw %3, (%1, 0) \n" \
362+ " subi %0, 4 \n" \
363+ " bf 7f \n" \
364+ "9: subi %0, 8 \n" \
365+ " bf 7f \n" \
366+ "13: stw %3, (%1, 8) \n" \
367+ " subi %0, 12 \n" \
368+ " bf 7f \n" \
366369 ".section __ex_table, \"a\" \n" \
367370 ".align 2 \n" \
368− ".long 2b, 8b \n" \
371+ ".long 2b, 7f \n" \
372+ ".long 4b, 7f \n" \
373+ ".long 6b, 7f \n" \
369374 ".long 10b, 8b \n" \
370− ".long 11b, 8b \n" \
371− ".long 12b, 8b \n" \
372− ".long 4b, 8b \n" \
373− ".long 6b, 8b \n" \
375+ ".long 11b, 9b \n" \
376+ ".long 12b,13b \n" \
374377 ".previous \n" \
375378 "7: \n" \
376379 : "=r"(n), "=r"(to), "=r"(from), "=r"(nsave), \
arch/csky/kernel/Makefile+1−1
@@ -3,7 +3,7 @@ extra-y := head.o vmlinux.lds · 2 unmodified lines
33
44 obj-y += entry.o atomic.o signal.o traps.o irq.o time.o vdso.o
55 obj-y += power.o syscall.o syscall_table.o setup.o
6−obj-y += process.o cpu-probe.o ptrace.o dumpstack.o
6+obj-y += process.o cpu-probe.o ptrace.o stacktrace.o
77 obj-y += probes/
88
99 obj-$(CONFIG_MODULES) += module.o
arch/csky/kernel/asm-offsets.c+1−2
@@ -18,8 +18,7 @@ int main(void) · 17 unmodified lines
1818 DEFINE(TASK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
1919
2020 /* offsets into the thread struct */
21− DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp));
22− DEFINE(THREAD_SR, offsetof(struct thread_struct, sr));
21+ DEFINE(THREAD_KSP, offsetof(struct thread_struct, sp));
2322 DEFINE(THREAD_FESR, offsetof(struct thread_struct, user_fp.fesr));
2423 DEFINE(THREAD_FCR, offsetof(struct thread_struct, user_fp.fcr));
2524 DEFINE(THREAD_FPREG, offsetof(struct thread_struct, user_fp.vr));
arch/csky/kernel/dumpstack.c+0−49
@@ -1,49 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0
2−// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
3−
4−#include <linux/ptrace.h>
5−
6−int kstack_depth_to_print = 48;
7−
8−void show_trace(unsigned long *stack)
9−{
10− unsigned long *stack_end;
11− unsigned long *stack_start;
12− unsigned long *fp;
13− unsigned long addr;
14−
15− addr = (unsigned long) stack & THREAD_MASK;
16− stack_start = (unsigned long *) addr;
17− stack_end = (unsigned long *) (addr + THREAD_SIZE);
18−
19− fp = stack;
20− pr_info("\nCall Trace:");
21−
22− while (fp > stack_start && fp < stack_end) {
23−#ifdef CONFIG_STACKTRACE
24− addr = fp[1];
25− fp = (unsigned long *) fp[0];
26−#else
27− addr = *fp++;
28−#endif
29− if (__kernel_text_address(addr))
30− pr_cont("\n[<%08lx>] %pS", addr, (void *)addr);
31− }
32− pr_cont("\n");
33−}
34−
35−void show_stack(struct task_struct *task, unsigned long *stack)
36−{
37− if (!stack) {
38− if (task)
39− stack = (unsigned long *)thread_saved_fp(task);
40− else
41−#ifdef CONFIG_STACKTRACE
42− asm volatile("mov %0, r8\n":"=r"(stack)::"memory");
43−#else
44− stack = (unsigned long *)&stack;
45−#endif
46− }
47−
48− show_trace(stack);
49−}
arch/csky/kernel/entry.S+2−10
@@ -330,11 +330,6 @@ ENTRY(__switch_to) · 329 unmodified lines
330330 lrw a3, TASK_THREAD
331331 addu a3, a0
332332
333− mfcr a2, psr /* Save PSR value */
334− stw a2, (a3, THREAD_SR) /* Save PSR in task struct */
335− bclri a2, 6 /* Disable interrupts */
336− mtcr a2, psr
337−
338333 SAVE_SWITCH_STACK
339334
340335 stw sp, (a3, THREAD_KSP)
@@ -345,12 +340,9 @@ ENTRY(__switch_to) · 4 unmodified lines
345340
346341 ldw sp, (a3, THREAD_KSP) /* Set next kernel sp */
347342
348− ldw a2, (a3, THREAD_SR) /* Set next PSR */
349− mtcr a2, psr
350−
351343 #if defined(__CSKYABIV2__)
352− addi r7, a1, TASK_THREAD_INFO
353− ldw tls, (r7, TINFO_TP_VALUE)
344+ addi a3, a1, TASK_THREAD_INFO
345+ ldw tls, (a3, TINFO_TP_VALUE)
354346 #endif
355347
356348 RESTORE_SWITCH_STACK
arch/csky/kernel/ftrace.c+2−0
@@ -202,6 +202,7 @@ int ftrace_disable_ftrace_graph_caller(void) · 201 unmodified lines
202202 #endif /* CONFIG_DYNAMIC_FTRACE */
203203 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
204204
205+#ifdef CONFIG_DYNAMIC_FTRACE
205206 #ifndef CONFIG_CPU_HAS_ICACHE_INS
206207 struct ftrace_modify_param {
207208 int command;
@@ -231,6 +232,7 @@ void arch_ftrace_update_code(int command) · 23 unmodified lines
231232 stop_machine(__ftrace_modify_code, &param, cpu_online_mask);
232233 }
233234 #endif
235+#endif /* CONFIG_DYNAMIC_FTRACE */
234236
235237 /* _mcount is defined in abi's mcount.S */
236238 EXPORT_SYMBOL(_mcount);
arch/csky/kernel/perf_callchain.c+7−2
@@ -12,12 +12,17 @@ struct stackframe { · 11 unmodified lines
1212
1313 static int unwind_frame_kernel(struct stackframe *frame)
1414 {
15− if (kstack_end((void *)frame->fp))
15+ unsigned long low = (unsigned long)task_stack_page(current);
16+ unsigned long high = low + THREAD_SIZE;
17+
18+ if (unlikely(frame->fp < low || frame->fp > high))
1619 return -EPERM;
17− if (frame->fp & 0x3 || frame->fp < TASK_SIZE)
20+
21+ if (kstack_end((void *)frame->fp) || frame->fp & 0x3)
1822 return -EPERM;
1923
2024 *frame = *(struct stackframe *)frame->fp;
25+
2126 if (__kernel_text_address(frame->lr)) {
2227 int graph = 0;
2328
arch/csky/kernel/probes/uprobes.c+5−0
@@ -11,6 +11,11 @@ · 10 unmodified lines
1111
1212 #define UPROBE_TRAP_NR UINT_MAX
1313
14+bool is_swbp_insn(uprobe_opcode_t *insn)
15+{
16+ return (*insn & 0xffff) == UPROBE_SWBP_INSN;
17+}
18+
1419 unsigned long uprobe_get_swbp_addr(struct pt_regs *regs)
1520 {
1621 return instruction_pointer(regs);
arch/csky/kernel/process.c+3−34
@@ -35,7 +35,7 @@ void flush_thread(void){} · 34 unmodified lines
3535 */
3636 unsigned long thread_saved_pc(struct task_struct *tsk)
3737 {
38− struct switch_stack *sw = (struct switch_stack *)tsk->thread.ksp;
38+ struct switch_stack *sw = (struct switch_stack *)tsk->thread.sp;
3939
4040 return sw->r15;
4141 }
@@ -56,8 +56,8 @@ int copy_thread_tls(unsigned long clone_flags, · 14 unmodified lines
5656 childstack = ((struct switch_stack *) childregs) - 1;
5757 memset(childstack, 0, sizeof(struct switch_stack));
5858
59− /* setup ksp for switch_to !!! */
60− p->thread.ksp = (unsigned long)childstack;
59+ /* setup thread.sp for switch_to !!! */
60+ p->thread.sp = (unsigned long)childstack;
6161
6262 if (unlikely(p->flags & PF_KTHREAD)) {
6363 memset(childregs, 0, sizeof(struct pt_regs));
@@ -98,37 +98,6 @@ int dump_task_regs(struct task_struct *tsk, elf_gregset_t *pr_regs) · 34 unmodified lines
9898 return 1;
9999 }
100100
101−unsigned long get_wchan(struct task_struct *p)
102−{
103− unsigned long lr;
104− unsigned long *fp, *stack_start, *stack_end;
105− int count = 0;
106−
107− if (!p || p == current || p->state == TASK_RUNNING)
108− return 0;
109−
110− stack_start = (unsigned long *)end_of_stack(p);
111− stack_end = (unsigned long *)(task_stack_page(p) + THREAD_SIZE);
112−
113− fp = (unsigned long *) thread_saved_fp(p);
114− do {
115− if (fp < stack_start || fp > stack_end)
116− return 0;
117−#ifdef CONFIG_STACKTRACE
118− lr = fp[1];
119− fp = (unsigned long *)fp[0];
120−#else
121− lr = *fp++;
122−#endif
123− if (!in_sched_functions(lr) &&
124− __kernel_text_address(lr))
125− return lr;
126− } while (count++ < 16);
127−
128− return 0;
129−}
130−EXPORT_SYMBOL(get_wchan);
131−
132101 #ifndef CONFIG_CPU_PM_NONE
133102 void arch_cpu_idle(void)
134103 {
arch/csky/kernel/ptrace.c+6−0
@@ -41,6 +41,9 @@ static void singlestep_disable(struct task_struct *tsk) · 40 unmodified lines
4141
4242 regs = task_pt_regs(tsk);
4343 regs->sr = (regs->sr & TRACE_MODE_MASK) | TRACE_MODE_RUN;
44+
45+ /* Enable irq */
46+ regs->sr |= BIT(6);
4447 }
4548
4649 static void singlestep_enable(struct task_struct *tsk)
@@ -49,6 +52,9 @@ static void singlestep_enable(struct task_struct *tsk) · 2 unmodified lines
4952
5053 regs = task_pt_regs(tsk);
5154 regs->sr = (regs->sr & TRACE_MODE_MASK) | TRACE_MODE_SI;
55+
56+ /* Disable irq */
57+ regs->sr &= ~BIT(6);
5258 }
5359
5460 /*
arch/csky/kernel/stacktrace.c+139−37
@@ -1,57 +1,159 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. */
32
43 #include <linux/sched/debug.h>
54 #include <linux/sched/task_stack.h>
65 #include <linux/stacktrace.h>
76 #include <linux/ftrace.h>
7+#include <linux/ptrace.h>
88
9−void save_stack_trace(struct stack_trace *trace)
9+#ifdef CONFIG_FRAME_POINTER
10+
11+struct stackframe {
12+ unsigned long fp;
13+ unsigned long ra;
14+};
15+
16+void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
17+ bool (*fn)(unsigned long, void *), void *arg)
1018 {
11− save_stack_trace_tsk(current, trace);
19+ unsigned long fp, sp, pc;
20+
21+ if (regs) {
22+ fp = frame_pointer(regs);
23+ sp = user_stack_pointer(regs);
24+ pc = instruction_pointer(regs);
25+ } else if (task == NULL || task == current) {
26+ const register unsigned long current_sp __asm__ ("sp");
27+ const register unsigned long current_fp __asm__ ("r8");
28+ fp = current_fp;
29+ sp = current_sp;
30+ pc = (unsigned long)walk_stackframe;
31+ } else {
32+ /* task blocked in __switch_to */
33+ fp = thread_saved_fp(task);
34+ sp = thread_saved_sp(task);
35+ pc = thread_saved_lr(task);
36+ }
37+
38+ for (;;) {
39+ unsigned long low, high;
40+ struct stackframe *frame;
41+
42+ if (unlikely(!__kernel_text_address(pc) || fn(pc, arg)))
43+ break;
44+
45+ /* Validate frame pointer */
46+ low = sp;
47+ high = ALIGN(sp, THREAD_SIZE);
48+ if (unlikely(fp < low || fp > high || fp & 0x3))
49+ break;
50+ /* Unwind stack frame */
51+ frame = (struct stackframe *)fp;
52+ sp = fp;
53+ fp = frame->fp;
54+ pc = ftrace_graph_ret_addr(current, NULL, frame->ra,
55+ (unsigned long *)(fp - 8));
56+ }
1257 }
13−EXPORT_SYMBOL_GPL(save_stack_trace);
1458
15−void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
59+#else /* !CONFIG_FRAME_POINTER */
60+
61+static void notrace walk_stackframe(struct task_struct *task,
62+ struct pt_regs *regs, bool (*fn)(unsigned long, void *), void *arg)
1663 {
17− unsigned long *fp, *stack_start, *stack_end;
18− unsigned long addr;
19− int skip = trace->skip;
20− int savesched;
21− int graph_idx = 0;
64+ unsigned long sp, pc;
65+ unsigned long *ksp;
2266
23− if (tsk == current) {
24− asm volatile("mov %0, r8\n":"=r"(fp));
25− savesched = 1;
67+ if (regs) {
68+ sp = user_stack_pointer(regs);
69+ pc = instruction_pointer(regs);
70+ } else if (task == NULL || task == current) {
71+ const register unsigned long current_sp __asm__ ("sp");
72+ sp = current_sp;
73+ pc = (unsigned long)walk_stackframe;
2674 } else {
27− fp = (unsigned long *)thread_saved_fp(tsk);
28− savesched = 0;
75+ /* task blocked in __switch_to */
76+ sp = thread_saved_sp(task);
77+ pc = thread_saved_lr(task);
2978 }
3079
31− addr = (unsigned long) fp & THREAD_MASK;
32− stack_start = (unsigned long *) addr;
33− stack_end = (unsigned long *) (addr + THREAD_SIZE);
34−
35− while (fp > stack_start && fp < stack_end) {
36− unsigned long lpp, fpp;
80+ if (unlikely(sp & 0x3))
81+ return;
3782
38− fpp = fp[0];
39− lpp = fp[1];
40− if (!__kernel_text_address(lpp))
83+ ksp = (unsigned long *)sp;
84+ while (!kstack_end(ksp)) {
85+ if (__kernel_text_address(pc) && unlikely(fn(pc, arg)))
4186 break;
42− else
43− lpp = ftrace_graph_ret_addr(tsk, &graph_idx, lpp, NULL);
44−
45− if (savesched || !in_sched_functions(lpp)) {
46− if (skip) {
47− skip--;
48− } else {
49− trace->entries[trace->nr_entries++] = lpp;
50− if (trace->nr_entries >= trace->max_entries)
51− break;
52− }
53− }
54− fp = (unsigned long *)fpp;
87+ pc = (*ksp++) - 0x4;
5588 }
5689 }
90+#endif /* CONFIG_FRAME_POINTER */
91+
92+static bool print_trace_address(unsigned long pc, void *arg)
93+{
94+ print_ip_sym(pc);
95+ return false;
96+}
97+
98+void show_stack(struct task_struct *task, unsigned long *sp)
99+{
100+ pr_cont("Call Trace:\n");
101+ walk_stackframe(task, NULL, print_trace_address, NULL);
102+}
103+
104+static bool save_wchan(unsigned long pc, void *arg)
105+{
106+ if (!in_sched_functions(pc)) {
107+ unsigned long *p = arg;
108+ *p = pc;
109+ return true;
110+ }
111+ return false;
112+}
113+
114+unsigned long get_wchan(struct task_struct *task)
115+{
116+ unsigned long pc = 0;
117+
118+ if (likely(task && task != current && task->state != TASK_RUNNING))
119+ walk_stackframe(task, NULL, save_wchan, &pc);
120+ return pc;
121+}
122+
123+#ifdef CONFIG_STACKTRACE
124+static bool __save_trace(unsigned long pc, void *arg, bool nosched)
125+{
126+ struct stack_trace *trace = arg;
127+
128+ if (unlikely(nosched && in_sched_functions(pc)))
129+ return false;
130+ if (unlikely(trace->skip > 0)) {
131+ trace->skip--;
132+ return false;
133+ }
134+
135+ trace->entries[trace->nr_entries++] = pc;
136+ return (trace->nr_entries >= trace->max_entries);
137+}
138+
139+static bool save_trace(unsigned long pc, void *arg)
140+{
141+ return __save_trace(pc, arg, false);
142+}
143+
144+/*
145+ * Save stack-backtrace addresses into a stack_trace buffer.
146+ */
147+void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
148+{
149+ walk_stackframe(tsk, NULL, save_trace, trace);
150+}
57151 EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
152+
153+void save_stack_trace(struct stack_trace *trace)
154+{
155+ save_stack_trace_tsk(NULL, trace);
156+}
157+EXPORT_SYMBOL_GPL(save_stack_trace);
158+
159+#endif /* CONFIG_STACKTRACE */
arch/csky/lib/usercopy.c+2−6
@@ -7,10 +7,7 @@ · 6 unmodified lines
77 unsigned long raw_copy_from_user(void *to, const void *from,
88 unsigned long n)
99 {
10− if (access_ok(from, n))
11− __copy_user_zeroing(to, from, n);
12− else
13− memset(to, 0, n);
10+ ___copy_from_user(to, from, n);
1411 return n;
1512 }
1613 EXPORT_SYMBOL(raw_copy_from_user);
@@ -18,8 +15,7 @@ EXPORT_SYMBOL(raw_copy_from_user); · 1 unmodified line
1815 unsigned long raw_copy_to_user(void *to, const void *from,
1916 unsigned long n)
2017 {
21− if (access_ok(to, n))
22− __copy_user(to, from, n);
18+ ___copy_to_user(to, from, n);
2319 return n;
2420 }
2521 EXPORT_SYMBOL(raw_copy_to_user);
arch/powerpc/Kconfig+1−1
@@ -130,7 +130,7 @@ config PPC · 129 unmodified lines
130130 select ARCH_HAS_PTE_SPECIAL
131131 select ARCH_HAS_MEMBARRIER_CALLBACKS
132132 select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE && PPC_BOOK3S_64
133− select ARCH_HAS_STRICT_KERNEL_RWX if ((PPC_BOOK3S_64 || PPC32) && !HIBERNATION)
133+ select ARCH_HAS_STRICT_KERNEL_RWX if (PPC32 && !HIBERNATION)
134134 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
135135 select ARCH_HAS_UACCESS_FLUSHCACHE
136136 select ARCH_HAS_UACCESS_MCSAFE if PPC64
arch/powerpc/include/asm/book3s/32/hash.h+4−4
@@ -17,9 +17,9 @@ · 16 unmodified lines
1717 * updating the accessed and modified bits in the page table tree.
1818 */
1919
20−#define _PAGE_USER 0x001 /* usermode access allowed */
21−#define _PAGE_RW 0x002 /* software: user write access allowed */
22−#define _PAGE_PRESENT 0x004 /* software: pte contains a translation */
20+#define _PAGE_PRESENT 0x001 /* software: pte contains a translation */
21+#define _PAGE_HASHPTE 0x002 /* hash_page has made an HPTE for this pte */
22+#define _PAGE_USER 0x004 /* usermode access allowed */
2323 #define _PAGE_GUARDED 0x008 /* G: prohibit speculative access */
2424 #define _PAGE_COHERENT 0x010 /* M: enforce memory coherence (SMP systems) */
2525 #define _PAGE_NO_CACHE 0x020 /* I: cache inhibit */
@@ -27,7 +27,7 @@ · 1 unmodified line
2727 #define _PAGE_DIRTY 0x080 /* C: page changed */
2828 #define _PAGE_ACCESSED 0x100 /* R: page referenced */
2929 #define _PAGE_EXEC 0x200 /* software: exec allowed */
30−#define _PAGE_HASHPTE 0x400 /* hash_page has made an HPTE for this pte */
30+#define _PAGE_RW 0x400 /* software: user write access allowed */
3131 #define _PAGE_SPECIAL 0x800 /* software: Special page */
3232
3333 #ifdef CONFIG_PTE_64BIT
arch/powerpc/include/asm/book3s/32/kup.h+1−1
@@ -75,7 +75,7 @@ · 74 unmodified lines
7575
7676 .macro kuap_check current, gpr
7777 #ifdef CONFIG_PPC_KUAP_DEBUG
78− lwz \gpr2, KUAP(thread)
78+ lwz \gpr, KUAP(thread)
7979 999: twnei \gpr, 0
8080 EMIT_BUG_ENTRY 999b, __FILE__, __LINE__, (BUGFLAG_WARNING | BUGFLAG_ONCE)
8181 #endif
arch/powerpc/include/asm/hw_irq.h+19−1
@@ -250,9 +250,27 @@ static inline bool arch_irqs_disabled(void) · 249 unmodified lines
250250 } \
251251 } while(0)
252252
253+static inline bool __lazy_irq_pending(u8 irq_happened)
254+{
255+ return !!(irq_happened & ~PACA_IRQ_HARD_DIS);
256+}
257+
258+/*
259+ * Check if a lazy IRQ is pending. Should be called with IRQs hard disabled.
260+ */
253261 static inline bool lazy_irq_pending(void)
254262 {
255− return !!(get_paca()->irq_happened & ~PACA_IRQ_HARD_DIS);
263+ return __lazy_irq_pending(get_paca()->irq_happened);
264+}
265+
266+/*
267+ * Check if a lazy IRQ is pending, with no debugging checks.
268+ * Should be called with IRQs hard disabled.
269+ * For use in RI disabled code or other constrained situations.
270+ */
271+static inline bool lazy_irq_pending_nocheck(void)
272+{
273+ return __lazy_irq_pending(local_paca->irq_happened);
256274 }
257275
258276 /*
arch/powerpc/include/asm/uaccess.h+35−14
@@ -166,13 +166,17 @@ do { \ · 165 unmodified lines
166166 ({ \
167167 long __pu_err; \
168168 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
169+ __typeof__(*(ptr)) __pu_val = (x); \
170+ __typeof__(size) __pu_size = (size); \
171+ \
169172 if (!is_kernel_addr((unsigned long)__pu_addr)) \
170173 might_fault(); \
171− __chk_user_ptr(ptr); \
174+ __chk_user_ptr(__pu_addr); \
172175 if (do_allow) \
173− __put_user_size((x), __pu_addr, (size), __pu_err); \
176+ __put_user_size(__pu_val, __pu_addr, __pu_size, __pu_err); \
174177 else \
175− __put_user_size_allowed((x), __pu_addr, (size), __pu_err); \
178+ __put_user_size_allowed(__pu_val, __pu_addr, __pu_size, __pu_err); \
179+ \
176180 __pu_err; \
177181 })
178182
@@ -180,9 +184,13 @@ do { \ · 1 unmodified line
180184 ({ \
181185 long __pu_err = -EFAULT; \
182186 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
187+ __typeof__(*(ptr)) __pu_val = (x); \
188+ __typeof__(size) __pu_size = (size); \
189+ \
183190 might_fault(); \
184− if (access_ok(__pu_addr, size)) \
185− __put_user_size((x), __pu_addr, (size), __pu_err); \
191+ if (access_ok(__pu_addr, __pu_size)) \
192+ __put_user_size(__pu_val, __pu_addr, __pu_size, __pu_err); \
193+ \
186194 __pu_err; \
187195 })
188196
@@ -190,8 +198,12 @@ do { \ · 1 unmodified line
190198 ({ \
191199 long __pu_err; \
192200 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
193− __chk_user_ptr(ptr); \
194− __put_user_size((x), __pu_addr, (size), __pu_err); \
201+ __typeof__(*(ptr)) __pu_val = (x); \
202+ __typeof__(size) __pu_size = (size); \
203+ \
204+ __chk_user_ptr(__pu_addr); \
205+ __put_user_size(__pu_val, __pu_addr, __pu_size, __pu_err); \
206+ \
195207 __pu_err; \
196208 })
197209
@@ -283,15 +295,18 @@ do { \ · 85 unmodified lines
283295 long __gu_err; \
284296 __long_type(*(ptr)) __gu_val; \
285297 __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
286− __chk_user_ptr(ptr); \
298+ __typeof__(size) __gu_size = (size); \
299+ \
300+ __chk_user_ptr(__gu_addr); \
287301 if (!is_kernel_addr((unsigned long)__gu_addr)) \
288302 might_fault(); \
289303 barrier_nospec(); \
290304 if (do_allow) \
291− __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
305+ __get_user_size(__gu_val, __gu_addr, __gu_size, __gu_err); \
292306 else \
293− __get_user_size_allowed(__gu_val, __gu_addr, (size), __gu_err); \
307+ __get_user_size_allowed(__gu_val, __gu_addr, __gu_size, __gu_err); \
294308 (x) = (__typeof__(*(ptr)))__gu_val; \
309+ \
295310 __gu_err; \
296311 })
297312
@@ -300,12 +315,15 @@ do { \ · 2 unmodified lines
300315 long __gu_err = -EFAULT; \
301316 __long_type(*(ptr)) __gu_val = 0; \
302317 __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
318+ __typeof__(size) __gu_size = (size); \
319+ \
303320 might_fault(); \
304− if (access_ok(__gu_addr, (size))) { \
321+ if (access_ok(__gu_addr, __gu_size)) { \
305322 barrier_nospec(); \
306− __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
323+ __get_user_size(__gu_val, __gu_addr, __gu_size, __gu_err); \
307324 } \
308325 (x) = (__force __typeof__(*(ptr)))__gu_val; \
326+ \
309327 __gu_err; \
310328 })
311329
@@ -314,10 +332,13 @@ do { \ · 2 unmodified lines
314332 long __gu_err; \
315333 __long_type(*(ptr)) __gu_val; \
316334 __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
317− __chk_user_ptr(ptr); \
335+ __typeof__(size) __gu_size = (size); \
336+ \
337+ __chk_user_ptr(__gu_addr); \
318338 barrier_nospec(); \
319− __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
339+ __get_user_size(__gu_val, __gu_addr, __gu_size, __gu_err); \
320340 (x) = (__force __typeof__(*(ptr)))__gu_val; \
341+ \
321342 __gu_err; \
322343 })
323344
arch/powerpc/kernel/entry_64.S+3−1
@@ -472,15 +472,17 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) · 471 unmodified lines
472472 #ifdef CONFIG_PPC_BOOK3S
473473 /*
474474 * If MSR EE/RI was never enabled, IRQs not reconciled, NVGPRs not
475− * touched, AMR not set, no exit work created, then this can be used.
475+ * touched, no exit work created, then this can be used.
476476 */
477477 .balign IFETCH_ALIGN_BYTES
478478 .globl fast_interrupt_return
479479 fast_interrupt_return:
480480 _ASM_NOKPROBE_SYMBOL(fast_interrupt_return)
481+ kuap_check_amr r3, r4
481482 ld r4,_MSR(r1)
482483 andi. r0,r4,MSR_PR
483484 bne .Lfast_user_interrupt_return
485+ kuap_restore_amr r3
484486 andi. r0,r4,MSR_RI
485487 li r3,0 /* 0 return value, no EMULATE_STACK_STORE */
486488 bne+ .Lfast_kernel_interrupt_return
arch/powerpc/kernel/exceptions-64s.S+1−0
@@ -971,6 +971,7 @@ EXC_COMMON_BEGIN(system_reset_common) · 970 unmodified lines
971971 ld r10,SOFTE(r1)
972972 stb r10,PACAIRQSOFTMASK(r13)
973973
974+ kuap_restore_amr r10
974975 EXCEPTION_RESTORE_REGS
975976 RFI_TO_USER_OR_KERNEL
976977
arch/powerpc/kernel/head_32.S+6−3
@@ -348,7 +348,7 @@ BEGIN_MMU_FTR_SECTION · 347 unmodified lines
348348 andis. r0, r5, (DSISR_BAD_FAULT_32S | DSISR_DABRMATCH)@h
349349 #endif
350350 bne handle_page_fault_tramp_2 /* if not, try to put a PTE */
351− rlwinm r3, r5, 32 - 24, 30, 30 /* DSISR_STORE -> _PAGE_RW */
351+ rlwinm r3, r5, 32 - 15, 21, 21 /* DSISR_STORE -> _PAGE_RW */
352352 bl hash_page
353353 b handle_page_fault_tramp_1
354354 FTR_SECTION_ELSE
@@ -497,6 +497,7 @@ InstructionTLBMiss: · 142 unmodified lines
497497 andc. r1,r1,r0 /* check access & ~permission */
498498 bne- InstructionAddressInvalid /* return if access not permitted */
499499 /* Convert linux-style PTE to low word of PPC-style PTE */
500+ rlwimi r0,r0,32-2,31,31 /* _PAGE_USER -> PP lsb */
500501 ori r1, r1, 0xe06 /* clear out reserved bits */
501502 andc r1, r0, r1 /* PP = user? 1 : 0 */
502503 BEGIN_FTR_SECTION
@@ -564,8 +565,9 @@ DataLoadTLBMiss: · 61 unmodified lines
564565 * we would need to update the pte atomically with lwarx/stwcx.
565566 */
566567 /* Convert linux-style PTE to low word of PPC-style PTE */
567− rlwinm r1,r0,0,30,30 /* _PAGE_RW -> PP msb */
568− rlwimi r0,r0,1,30,30 /* _PAGE_USER -> PP msb */
568+ rlwinm r1,r0,32-9,30,30 /* _PAGE_RW -> PP msb */
569+ rlwimi r0,r0,32-1,30,30 /* _PAGE_USER -> PP msb */
570+ rlwimi r0,r0,32-1,31,31 /* _PAGE_USER -> PP lsb */
569571 ori r1,r1,0xe04 /* clear out reserved bits */
570572 andc r1,r0,r1 /* PP = user? rw? 1: 3: 0 */
571573 BEGIN_FTR_SECTION
@@ -643,6 +645,7 @@ DataStoreTLBMiss: · 71 unmodified lines
643645 * we would need to update the pte atomically with lwarx/stwcx.
644646 */
645647 /* Convert linux-style PTE to low word of PPC-style PTE */
648+ rlwimi r0,r0,32-2,31,31 /* _PAGE_USER -> PP lsb */
646649 li r1,0xe06 /* clear out reserved bits & PP msb */
647650 andc r1,r0,r1 /* PP = user? 1: 0 */
648651 BEGIN_FTR_SECTION
arch/powerpc/kernel/head_40x.S+2−1
@@ -344,8 +344,9 @@ _ENTRY(saved_ksp_limit) · 343 unmodified lines
344344 /* 0x0C00 - System Call Exception */
345345 START_EXCEPTION(0x0C00, SystemCall)
346346 SYSCALL_ENTRY 0xc00
347+/* Trap_0D is commented out to get more space for system call exception */
347348
348− EXCEPTION(0x0D00, Trap_0D, unknown_exception, EXC_XFER_STD)
349+/* EXCEPTION(0x0D00, Trap_0D, unknown_exception, EXC_XFER_STD) */
349350 EXCEPTION(0x0E00, Trap_0E, unknown_exception, EXC_XFER_STD)
350351 EXCEPTION(0x0F00, Trap_0F, unknown_exception, EXC_XFER_STD)
351352
arch/powerpc/kernel/ima_arch.c+3−3
@@ -19,12 +19,12 @@ bool arch_ima_get_secureboot(void) · 18 unmodified lines
1919 * to be stored as an xattr or as an appended signature.
2020 *
2121 * To avoid duplicate signature verification as much as possible, the IMA
22− * policy rule for module appraisal is added only if CONFIG_MODULE_SIG_FORCE
22+ * policy rule for module appraisal is added only if CONFIG_MODULE_SIG
2323 * is not enabled.
2424 */
2525 static const char *const secure_rules[] = {
2626 "appraise func=KEXEC_KERNEL_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
27−#ifndef CONFIG_MODULE_SIG_FORCE
27+#ifndef CONFIG_MODULE_SIG
2828 "appraise func=MODULE_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
2929 #endif
3030 NULL
@@ -50,7 +50,7 @@ static const char *const secure_and_trusted_rules[] = { · 19 unmodified lines
5050 "measure func=KEXEC_KERNEL_CHECK template=ima-modsig",
5151 "measure func=MODULE_CHECK template=ima-modsig",
5252 "appraise func=KEXEC_KERNEL_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
53−#ifndef CONFIG_MODULE_SIG_FORCE
53+#ifndef CONFIG_MODULE_SIG
5454 "appraise func=MODULE_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
5555 #endif
5656 NULL
arch/powerpc/kernel/syscall_64.c+11−9
@@ -35,6 +35,8 @@ notrace long system_call_exception(long r3, long r4, long r5, · 34 unmodified lines
3535 BUG_ON(!FULL_REGS(regs));
3636 BUG_ON(regs->softe != IRQS_ENABLED);
3737
38+ kuap_check_amr();
39+
3840 account_cpu_user_entry();
3941
4042 #ifdef CONFIG_PPC_SPLPAR
@@ -47,8 +49,6 @@ notrace long system_call_exception(long r3, long r4, long r5, · 6 unmodified lines
4749 }
4850 #endif
4951
50− kuap_check_amr();
51−
5252 /*
5353 * This is not required for the syscall exit path, but makes the
5454 * stack frame look nicer. If this was initialised in the first stack
@@ -117,6 +117,8 @@ notrace unsigned long syscall_exit_prepare(unsigned long r3, · 62 unmodified lines
117117 unsigned long ti_flags;
118118 unsigned long ret = 0;
119119
120+ kuap_check_amr();
121+
120122 regs->result = r3;
121123
122124 /* Check whether the syscall is issued inside a restartable sequence */
@@ -189,7 +191,7 @@ again: · 66 unmodified lines
189191
190192 /* This pattern matches prep_irq_for_idle */
191193 __hard_EE_RI_disable();
192− if (unlikely(lazy_irq_pending())) {
194+ if (unlikely(lazy_irq_pending_nocheck())) {
193195 __hard_RI_enable();
194196 trace_hardirqs_off();
195197 local_paca->irq_happened |= PACA_IRQ_HARD_DIS;
@@ -204,8 +206,6 @@ again: · 8 unmodified lines
204206 local_paca->tm_scratch = regs->msr;
205207 #endif
206208
207− kuap_check_amr();
208−
209209 account_cpu_user_exit();
210210
211211 return ret;
@@ -228,6 +228,8 @@ notrace unsigned long interrupt_exit_user_prepare(struct pt_regs *regs, unsigned · 16 unmodified lines
228228 BUG_ON(!FULL_REGS(regs));
229229 BUG_ON(regs->softe != IRQS_ENABLED);
230230
231+ kuap_check_amr();
232+
231233 local_irq_save(flags);
232234
233235 again:
@@ -264,7 +266,7 @@ again: · 30 unmodified lines
264266
265267 trace_hardirqs_on();
266268 __hard_EE_RI_disable();
267− if (unlikely(lazy_irq_pending())) {
269+ if (unlikely(lazy_irq_pending_nocheck())) {
268270 __hard_RI_enable();
269271 trace_hardirqs_off();
270272 local_paca->irq_happened |= PACA_IRQ_HARD_DIS;
@@ -292,8 +294,6 @@ again: · 21 unmodified lines
292294 local_paca->tm_scratch = regs->msr;
293295 #endif
294296
295− kuap_check_amr();
296−
297297 account_cpu_user_exit();
298298
299299 return ret;
@@ -313,6 +313,8 @@ notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs, unsign · 13 unmodified lines
313313 BUG_ON(regs->msr & MSR_PR);
314314 BUG_ON(!FULL_REGS(regs));
315315
316+ kuap_check_amr();
317+
316318 if (unlikely(*ti_flagsp & _TIF_EMULATE_STACK_STORE)) {
317319 clear_bits(_TIF_EMULATE_STACK_STORE, ti_flagsp);
318320 ret = 1;
@@ -334,7 +336,7 @@ again: · 15 unmodified lines
334336
335337 trace_hardirqs_on();
336338 __hard_EE_RI_disable();
337− if (unlikely(lazy_irq_pending())) {
339+ if (unlikely(lazy_irq_pending_nocheck())) {
338340 __hard_RI_enable();
339341 irq_soft_mask_set(IRQS_ALL_DISABLED);
340342 trace_hardirqs_off();
arch/powerpc/kernel/vdso32/gettimeofday.S+3−3
@@ -218,11 +218,11 @@ V_FUNCTION_BEGIN(__kernel_clock_getres) · 217 unmodified lines
218218 blr
219219
220220 /*
221− * invalid clock
221+ * syscall fallback
222222 */
223223 99:
224− li r3, EINVAL
225− crset so
224+ li r0,__NR_clock_getres
225+ sc
226226 blr
227227 .cfi_endproc
228228 V_FUNCTION_END(__kernel_clock_getres)
arch/powerpc/mm/book3s32/hash_low.S+8−6
@@ -35,7 +35,7 @@ mmu_hash_lock: · 34 unmodified lines
3535 /*
3636 * Load a PTE into the hash table, if possible.
3737 * The address is in r4, and r3 contains an access flag:
38− * _PAGE_RW (0x002) if a write.
38+ * _PAGE_RW (0x400) if a write.
3939 * r9 contains the SRR1 value, from which we use the MSR_PR bit.
4040 * SPRG_THREAD contains the physical address of the current task's thread.
4141 *
@@ -69,7 +69,7 @@ _GLOBAL(hash_page) · 27 unmodified lines
6969 blt+ 112f /* assume user more likely */
7070 lis r5, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
7171 addi r5 ,r5 ,(swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */
72− rlwimi r3,r9,32-14,31,31 /* MSR_PR -> _PAGE_USER */
72+ rlwimi r3,r9,32-12,29,29 /* MSR_PR -> _PAGE_USER */
7373 112:
7474 #ifndef CONFIG_PTE_64BIT
7575 rlwimi r5,r4,12,20,29 /* insert top 10 bits of address */
@@ -94,7 +94,7 @@ _GLOBAL(hash_page) · 18 unmodified lines
9494 #else
9595 rlwimi r8,r4,23,20,28 /* compute pte address */
9696 #endif
97− rlwinm r0,r3,6,24,24 /* _PAGE_RW access -> _PAGE_DIRTY */
97+ rlwinm r0,r3,32-3,24,24 /* _PAGE_RW access -> _PAGE_DIRTY */
9898 ori r0,r0,_PAGE_ACCESSED|_PAGE_HASHPTE
9999
100100 /*
@@ -310,9 +310,11 @@ Hash_msk = (((1 << Hash_bits) - 1) * 64) · 209 unmodified lines
310310
311311 _GLOBAL(create_hpte)
312312 /* Convert linux-style PTE (r5) to low word of PPC-style PTE (r8) */
313+ rlwinm r8,r5,32-9,30,30 /* _PAGE_RW -> PP msb */
313314 rlwinm r0,r5,32-6,30,30 /* _PAGE_DIRTY -> PP msb */
314− and r8,r5,r0 /* writable if _RW & _DIRTY */
315− rlwimi r5,r5,1,30,30 /* _PAGE_USER -> PP msb */
315+ and r8,r8,r0 /* writable if _RW & _DIRTY */
316+ rlwimi r5,r5,32-1,30,30 /* _PAGE_USER -> PP msb */
317+ rlwimi r5,r5,32-2,31,31 /* _PAGE_USER -> PP lsb */
316318 ori r8,r8,0xe04 /* clear out reserved bits */
317319 andc r8,r5,r8 /* PP = user? (rw&dirty? 1: 3): 0 */
318320 BEGIN_FTR_SECTION
@@ -564,7 +566,7 @@ _GLOBAL(flush_hash_pages) · 245 unmodified lines
564566 33: lwarx r8,0,r5 /* fetch the pte flags word */
565567 andi. r0,r8,_PAGE_HASHPTE
566568 beq 8f /* done if HASHPTE is already clear */
567− rlwinm r8,r8,0,~_PAGE_HASHPTE /* clear HASHPTE bit */
569+ rlwinm r8,r8,0,31,29 /* clear HASHPTE bit */
568570 stwcx. r8,0,r5 /* update the pte */
569571 bne- 33b
570572
arch/riscv/Kconfig+2−1
@@ -54,7 +54,7 @@ config RISCV · 53 unmodified lines
5454 select GENERIC_ARCH_TOPOLOGY if SMP
5555 select ARCH_HAS_PTE_SPECIAL
5656 select ARCH_HAS_MMIOWB
57− select ARCH_HAS_DEBUG_VIRTUAL
57+ select ARCH_HAS_DEBUG_VIRTUAL if MMU
5858 select HAVE_EBPF_JIT if MMU
5959 select EDAC_SUPPORT
6060 select ARCH_HAS_GIGANTIC_PAGE
@@ -136,6 +136,7 @@ config ARCH_SUPPORTS_DEBUG_PAGEALLOC · 75 unmodified lines
136136 def_bool y
137137
138138 config SYS_SUPPORTS_HUGETLBFS
139+ depends on MMU
139140 def_bool y
140141
141142 config STACKTRACE_SUPPORT
arch/riscv/Kconfig.socs+9−8
@@ -11,14 +11,15 @@ config SOC_SIFIVE · 10 unmodified lines
1111 This enables support for SiFive SoC platform hardware.
1212
1313 config SOC_VIRT
14− bool "QEMU Virt Machine"
15− select POWER_RESET_SYSCON
16− select POWER_RESET_SYSCON_POWEROFF
17− select GOLDFISH
18− select RTC_DRV_GOLDFISH
19− select SIFIVE_PLIC
20− help
21− This enables support for QEMU Virt Machine.
14+ bool "QEMU Virt Machine"
15+ select POWER_RESET
16+ select POWER_RESET_SYSCON
17+ select POWER_RESET_SYSCON_POWEROFF
18+ select GOLDFISH
19+ select RTC_DRV_GOLDFISH if RTC_CLASS
20+ select SIFIVE_PLIC
21+ help
22+ This enables support for QEMU Virt Machine.
2223
2324 config SOC_KENDRYTE
2425 bool "Kendryte K210 SoC"
arch/riscv/include/asm/mmio.h+2−0
@@ -16,6 +16,8 @@ · 15 unmodified lines
1616
1717 #ifndef CONFIG_MMU
1818 #define pgprot_noncached(x) (x)
19+#define pgprot_writecombine(x) (x)
20+#define pgprot_device(x) (x)
1921 #endif /* CONFIG_MMU */
2022
2123 /* Generic IO read/write. These perform native-endian accesses. */
arch/riscv/include/asm/mmiowb.h+1−0
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 */
1010 #define mmiowb() __asm__ __volatile__ ("fence o,w" : : : "memory");
1111
12+#include <linux/smp.h>
1213 #include <asm-generic/mmiowb.h>
1314
1415 #endif /* _ASM_RISCV_MMIOWB_H */
arch/riscv/include/asm/perf_event.h+2−6
@@ -12,19 +12,14 @@ · 11 unmodified lines
1212 #include <linux/ptrace.h>
1313 #include <linux/interrupt.h>
1414
15+#ifdef CONFIG_RISCV_BASE_PMU
1516 #define RISCV_BASE_COUNTERS 2
1617
1718 /*
1819 * The RISCV_MAX_COUNTERS parameter should be specified.
1920 */
2021
21−#ifdef CONFIG_RISCV_BASE_PMU
2222 #define RISCV_MAX_COUNTERS 2
23−#endif
24−
25−#ifndef RISCV_MAX_COUNTERS
26−#error "Please provide a valid RISCV_MAX_COUNTERS for the PMU."
27−#endif
2823
2924 /*
3025 * These are the indexes of bits in counteren register *minus* 1,
@@ -82,6 +77,7 @@ struct riscv_pmu { · 51 unmodified lines
8277 int irq;
8378 };
8479
80+#endif
8581 #ifdef CONFIG_PERF_EVENTS
8682 #define perf_arch_bpf_user_pt_regs(regs) (struct user_regs_struct *)regs
8783 #endif
arch/riscv/include/asm/pgtable.h+3−0
@@ -470,12 +470,15 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma, · 469 unmodified lines
470470
471471 #else /* CONFIG_MMU */
472472
473+#define PAGE_SHARED __pgprot(0)
473474 #define PAGE_KERNEL __pgprot(0)
474475 #define swapper_pg_dir NULL
475476 #define VMALLOC_START 0
476477
477478 #define TASK_SIZE 0xffffffffUL
478479
480+static inline void __kernel_map_pages(struct page *page, int numpages, int enable) {}
481+
479482 #endif /* !CONFIG_MMU */
480483
481484 #define kern_addr_valid(addr) (1) /* FIXME */
arch/riscv/kernel/Makefile+1−1
@@ -43,7 +43,7 @@ obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o · 42 unmodified lines
4343 obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o
4444 obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o
4545
46−obj-$(CONFIG_PERF_EVENTS) += perf_event.o
46+obj-$(CONFIG_RISCV_BASE_PMU) += perf_event.o
4747 obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o
4848 obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o
4949 obj-$(CONFIG_RISCV_SBI) += sbi.o
arch/riscv/kernel/perf_event.c+4−4
@@ -147,7 +147,7 @@ static int riscv_map_hw_event(u64 config) · 146 unmodified lines
147147 return riscv_pmu->hw_events[config];
148148 }
149149
150−int riscv_map_cache_decode(u64 config, unsigned int *type,
150+static int riscv_map_cache_decode(u64 config, unsigned int *type,
151151 unsigned int *op, unsigned int *result)
152152 {
153153 return -ENOENT;
@@ -342,7 +342,7 @@ static void riscv_pmu_del(struct perf_event *event, int flags) · 188 unmodified lines
342342
343343 static DEFINE_MUTEX(pmc_reserve_mutex);
344344
345−irqreturn_t riscv_base_pmu_handle_irq(int irq_num, void *dev)
345+static irqreturn_t riscv_base_pmu_handle_irq(int irq_num, void *dev)
346346 {
347347 return IRQ_NONE;
348348 }
@@ -361,7 +361,7 @@ static int reserve_pmc_hardware(void) · 12 unmodified lines
361361 return err;
362362 }
363363
364−void release_pmc_hardware(void)
364+static void release_pmc_hardware(void)
365365 {
366366 mutex_lock(&pmc_reserve_mutex);
367367 if (riscv_pmu->irq >= 0)
@@ -464,7 +464,7 @@ static const struct of_device_id riscv_pmu_of_ids[] = { · 96 unmodified lines
464464 { /* sentinel value */ }
465465 };
466466
467−int __init init_hw_perf_events(void)
467+static int __init init_hw_perf_events(void)
468468 {
469469 struct device_node *node = of_find_node_by_type(NULL, "pmu");
470470 const struct of_device_id *of_id;
arch/riscv/kernel/process.c+1−1
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222 #include <asm/switch_to.h>
2323 #include <asm/thread_info.h>
2424
25−unsigned long gp_in_global __asm__("gp");
25+register unsigned long gp_in_global __asm__("gp");
2626
2727 extern asmlinkage void ret_from_fork(void);
2828 extern asmlinkage void ret_from_kernel_thread(void);
arch/riscv/kernel/stacktrace.c+1−1
@@ -65,7 +65,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, · 64 unmodified lines
6565
6666 #else /* !CONFIG_FRAME_POINTER */
6767
68−static void notrace walk_stackframe(struct task_struct *task,
68+void notrace walk_stackframe(struct task_struct *task,
6969 struct pt_regs *regs, bool (*fn)(unsigned long, void *), void *arg)
7070 {
7171 unsigned long sp, pc;
arch/riscv/mm/init.c+1−1
@@ -47,7 +47,7 @@ static void setup_zero_page(void) · 46 unmodified lines
4747 memset((void *)empty_zero_page, 0, PAGE_SIZE);
4848 }
4949
50−#ifdef CONFIG_DEBUG_VM
50+#if defined(CONFIG_MMU) && defined(CONFIG_DEBUG_VM)
5151 static inline void print_mlk(char *name, unsigned long b, unsigned long t)
5252 {
5353 pr_notice("%12s : 0x%08lx - 0x%08lx (%4ld kB)\n", name, b, t,
arch/s390/include/asm/pci_io.h+8−2
@@ -8,6 +8,10 @@ · 7 unmodified lines
88 #include <linux/slab.h>
99 #include <asm/pci_insn.h>
1010
11+/* I/O size constraints */
12+#define ZPCI_MAX_READ_SIZE 8
13+#define ZPCI_MAX_WRITE_SIZE 128
14+
1115 /* I/O Map */
1216 #define ZPCI_IOMAP_SHIFT 48
1317 #define ZPCI_IOMAP_ADDR_BASE 0x8000000000000000UL
@@ -140,7 +144,8 @@ static inline int zpci_memcpy_fromio(void *dst, · 126 unmodified lines
140144
141145 while (n > 0) {
142146 size = zpci_get_max_write_size((u64 __force) src,
143− (u64) dst, n, 8);
147+ (u64) dst, n,
148+ ZPCI_MAX_READ_SIZE);
144149 rc = zpci_read_single(dst, src, size);
145150 if (rc)
146151 break;
@@ -161,7 +166,8 @@ static inline int zpci_memcpy_toio(volatile void __iomem *dst, · 14 unmodified lines
161166
162167 while (n > 0) {
163168 size = zpci_get_max_write_size((u64 __force) dst,
164− (u64) src, n, 128);
169+ (u64) src, n,
170+ ZPCI_MAX_WRITE_SIZE);
165171 if (size > 8) /* main path */
166172 rc = zpci_write_block(dst, src, size);
167173 else
arch/s390/kernel/machine_kexec_file.c+1−1
@@ -151,7 +151,7 @@ static int kexec_file_add_initrd(struct kimage *image, · 150 unmodified lines
151151 buf.mem += crashk_res.start;
152152 buf.memsz = buf.bufsz;
153153
154− data->parm->initrd_start = buf.mem;
154+ data->parm->initrd_start = data->memsz;
155155 data->parm->initrd_size = buf.memsz;
156156 data->memsz += buf.memsz;
157157
arch/s390/kernel/machine_kexec_reloc.c+1−0
@@ -28,6 +28,7 @@ int arch_kexec_do_relocs(int r_type, void *loc, unsigned long val, · 27 unmodified lines
2828 break;
2929 case R_390_64: /* Direct 64 bit. */
3030 case R_390_GLOB_DAT:
31+ case R_390_JMP_SLOT:
3132 *(u64 *)loc = val;
3233 break;
3334 case R_390_PC16: /* PC relative 16 bit. */
arch/s390/mm/hugetlbpage.c+6−3
@@ -159,10 +159,13 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, · 158 unmodified lines
159159 rste &= ~_SEGMENT_ENTRY_NOEXEC;
160160
161161 /* Set correct table type for 2G hugepages */
162− if ((pte_val(*ptep) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R3)
163− rste |= _REGION_ENTRY_TYPE_R3 | _REGION3_ENTRY_LARGE;
164− else
162+ if ((pte_val(*ptep) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R3) {
163+ if (likely(pte_present(pte)))
164+ rste |= _REGION3_ENTRY_LARGE;
165+ rste |= _REGION_ENTRY_TYPE_R3;
166+ } else if (likely(pte_present(pte)))
165167 rste |= _SEGMENT_ENTRY_LARGE;
168+
166169 clear_huge_pte_skeys(mm, rste);
167170 pte_val(*ptep) = rste;
168171 }
arch/s390/pci/pci_mmio.c+211−2
@@ -11,6 +11,113 @@ · 10 unmodified lines
1111 #include <linux/mm.h>
1212 #include <linux/errno.h>
1313 #include <linux/pci.h>
14+#include <asm/pci_io.h>
15+#include <asm/pci_debug.h>
16+
17+static inline void zpci_err_mmio(u8 cc, u8 status, u64 offset)
18+{
19+ struct {
20+ u64 offset;
21+ u8 cc;
22+ u8 status;
23+ } data = {offset, cc, status};
24+
25+ zpci_err_hex(&data, sizeof(data));
26+}
27+
28+static inline int __pcistb_mio_inuser(
29+ void __iomem *ioaddr, const void __user *src,
30+ u64 len, u8 *status)
31+{
32+ int cc = -ENXIO;
33+
34+ asm volatile (
35+ " sacf 256\n"
36+ "0: .insn rsy,0xeb00000000d4,%[len],%[ioaddr],%[src]\n"
37+ "1: ipm %[cc]\n"
38+ " srl %[cc],28\n"
39+ "2: sacf 768\n"
40+ EX_TABLE(0b, 2b) EX_TABLE(1b, 2b)
41+ : [cc] "+d" (cc), [len] "+d" (len)
42+ : [ioaddr] "a" (ioaddr), [src] "Q" (*((u8 __force *)src))
43+ : "cc", "memory");
44+ *status = len >> 24 & 0xff;
45+ return cc;
46+}
47+
48+static inline int __pcistg_mio_inuser(
49+ void __iomem *ioaddr, const void __user *src,
50+ u64 ulen, u8 *status)
51+{
52+ register u64 addr asm("2") = (u64 __force) ioaddr;
53+ register u64 len asm("3") = ulen;
54+ int cc = -ENXIO;
55+ u64 val = 0;
56+ u64 cnt = ulen;
57+ u8 tmp;
58+
59+ /*
60+ * copy 0 < @len <= 8 bytes from @src into the right most bytes of
61+ * a register, then store it to PCI at @ioaddr while in secondary
62+ * address space. pcistg then uses the user mappings.
63+ */
64+ asm volatile (
65+ " sacf 256\n"
66+ "0: llgc %[tmp],0(%[src])\n"
67+ " sllg %[val],%[val],8\n"
68+ " aghi %[src],1\n"
69+ " ogr %[val],%[tmp]\n"
70+ " brctg %[cnt],0b\n"
71+ "1: .insn rre,0xb9d40000,%[val],%[ioaddr]\n"
72+ "2: ipm %[cc]\n"
73+ " srl %[cc],28\n"
74+ "3: sacf 768\n"
75+ EX_TABLE(0b, 3b) EX_TABLE(1b, 3b) EX_TABLE(2b, 3b)
76+ :
77+ [src] "+a" (src), [cnt] "+d" (cnt),
78+ [val] "+d" (val), [tmp] "=d" (tmp),
79+ [len] "+d" (len), [cc] "+d" (cc),
80+ [ioaddr] "+a" (addr)
81+ :: "cc", "memory");
82+ *status = len >> 24 & 0xff;
83+
84+ /* did we read everything from user memory? */
85+ if (!cc && cnt != 0)
86+ cc = -EFAULT;
87+
88+ return cc;
89+}
90+
91+static inline int __memcpy_toio_inuser(void __iomem *dst,
92+ const void __user *src, size_t n)
93+{
94+ int size, rc = 0;
95+ u8 status = 0;
96+ mm_segment_t old_fs;
97+
98+ if (!src)
99+ return -EINVAL;
100+
101+ old_fs = enable_sacf_uaccess();
102+ while (n > 0) {
103+ size = zpci_get_max_write_size((u64 __force) dst,
104+ (u64 __force) src, n,
105+ ZPCI_MAX_WRITE_SIZE);
106+ if (size > 8) /* main path */
107+ rc = __pcistb_mio_inuser(dst, src, size, &status);
108+ else
109+ rc = __pcistg_mio_inuser(dst, src, size, &status);
110+ if (rc)
111+ break;
112+ src += size;
113+ dst += size;
114+ n -= size;
115+ }
116+ disable_sacf_uaccess(old_fs);
117+ if (rc)
118+ zpci_err_mmio(rc, status, (__force u64) dst);
119+ return rc;
120+}
14121
15122 static long get_pfn(unsigned long user_addr, unsigned long access,
16123 unsigned long *pfn)
@@ -46,6 +153,20 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr, · 29 unmodified lines
46153
47154 if (length <= 0 || PAGE_SIZE - (mmio_addr & ~PAGE_MASK) < length)
48155 return -EINVAL;
156+
157+ /*
158+ * Only support read access to MIO capable devices on a MIO enabled
159+ * system. Otherwise we would have to check for every address if it is
160+ * a special ZPCI_ADDR and we would have to do a get_pfn() which we
161+ * don't need for MIO capable devices.
162+ */
163+ if (static_branch_likely(&have_mio)) {
164+ ret = __memcpy_toio_inuser((void __iomem *) mmio_addr,
165+ user_buffer,
166+ length);
167+ return ret;
168+ }
169+
49170 if (length > 64) {
50171 buf = kmalloc(length, GFP_KERNEL);
51172 if (!buf)
@@ -56,7 +177,8 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr, · 4 unmodified lines
56177 ret = get_pfn(mmio_addr, VM_WRITE, &pfn);
57178 if (ret)
58179 goto out;
59− io_addr = (void __iomem *)((pfn << PAGE_SHIFT) | (mmio_addr & ~PAGE_MASK));
180+ io_addr = (void __iomem *)((pfn << PAGE_SHIFT) |
181+ (mmio_addr & ~PAGE_MASK));
60182
61183 ret = -EFAULT;
62184 if ((unsigned long) io_addr < ZPCI_IOMAP_ADDR_BASE)
@@ -72,6 +194,78 @@ out: · 9 unmodified lines
72194 return ret;
73195 }
74196
197+static inline int __pcilg_mio_inuser(
198+ void __user *dst, const void __iomem *ioaddr,
199+ u64 ulen, u8 *status)
200+{
201+ register u64 addr asm("2") = (u64 __force) ioaddr;
202+ register u64 len asm("3") = ulen;
203+ u64 cnt = ulen;
204+ int shift = ulen * 8;
205+ int cc = -ENXIO;
206+ u64 val, tmp;
207+
208+ /*
209+ * read 0 < @len <= 8 bytes from the PCI memory mapped at @ioaddr (in
210+ * user space) into a register using pcilg then store these bytes at
211+ * user address @dst
212+ */
213+ asm volatile (
214+ " sacf 256\n"
215+ "0: .insn rre,0xb9d60000,%[val],%[ioaddr]\n"
216+ "1: ipm %[cc]\n"
217+ " srl %[cc],28\n"
218+ " ltr %[cc],%[cc]\n"
219+ " jne 4f\n"
220+ "2: ahi %[shift],-8\n"
221+ " srlg %[tmp],%[val],0(%[shift])\n"
222+ "3: stc %[tmp],0(%[dst])\n"
223+ " aghi %[dst],1\n"
224+ " brctg %[cnt],2b\n"
225+ "4: sacf 768\n"
226+ EX_TABLE(0b, 4b) EX_TABLE(1b, 4b) EX_TABLE(3b, 4b)
227+ :
228+ [cc] "+d" (cc), [val] "=d" (val), [len] "+d" (len),
229+ [dst] "+a" (dst), [cnt] "+d" (cnt), [tmp] "=d" (tmp),
230+ [shift] "+d" (shift)
231+ :
232+ [ioaddr] "a" (addr)
233+ : "cc", "memory");
234+
235+ /* did we write everything to the user space buffer? */
236+ if (!cc && cnt != 0)
237+ cc = -EFAULT;
238+
239+ *status = len >> 24 & 0xff;
240+ return cc;
241+}
242+
243+static inline int __memcpy_fromio_inuser(void __user *dst,
244+ const void __iomem *src,
245+ unsigned long n)
246+{
247+ int size, rc = 0;
248+ u8 status;
249+ mm_segment_t old_fs;
250+
251+ old_fs = enable_sacf_uaccess();
252+ while (n > 0) {
253+ size = zpci_get_max_write_size((u64 __force) src,
254+ (u64 __force) dst, n,
255+ ZPCI_MAX_READ_SIZE);
256+ rc = __pcilg_mio_inuser(dst, src, size, &status);
257+ if (rc)
258+ break;
259+ src += size;
260+ dst += size;
261+ n -= size;
262+ }
263+ disable_sacf_uaccess(old_fs);
264+ if (rc)
265+ zpci_err_mmio(rc, status, (__force u64) dst);
266+ return rc;
267+}
268+
75269 SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr,
76270 void __user *, user_buffer, size_t, length)
77271 {
@@ -86,12 +280,27 @@ SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr, · 8 unmodified lines
86280
87281 if (length <= 0 || PAGE_SIZE - (mmio_addr & ~PAGE_MASK) < length)
88282 return -EINVAL;
283+
284+ /*
285+ * Only support write access to MIO capable devices on a MIO enabled
286+ * system. Otherwise we would have to check for every address if it is
287+ * a special ZPCI_ADDR and we would have to do a get_pfn() which we
288+ * don't need for MIO capable devices.
289+ */
290+ if (static_branch_likely(&have_mio)) {
291+ ret = __memcpy_fromio_inuser(
292+ user_buffer, (const void __iomem *)mmio_addr,
293+ length);
294+ return ret;
295+ }
296+
89297 if (length > 64) {
90298 buf = kmalloc(length, GFP_KERNEL);
91299 if (!buf)
92300 return -ENOMEM;
93− } else
301+ } else {
94302 buf = local_buf;
303+ }
95304
96305 ret = get_pfn(mmio_addr, VM_READ, &pfn);
97306 if (ret)
arch/sh/include/uapi/asm/sockios.h+2−0
@@ -2,6 +2,8 @@ · 1 unmodified line
22 #ifndef __ASM_SH_SOCKIOS_H
33 #define __ASM_SH_SOCKIOS_H
44
5+#include <linux/time_types.h>
6+
57 /* Socket-level I/O control calls. */
68 #define FIOGETOWN _IOR('f', 123, int)
79 #define FIOSETOWN _IOW('f', 124, int)
arch/sparc/mm/srmmu.c+3−3
@@ -331,9 +331,9 @@ static void __init srmmu_nocache_init(void) · 330 unmodified lines
331331
332332 while (vaddr < srmmu_nocache_end) {
333333 pgd = pgd_offset_k(vaddr);
334− p4d = p4d_offset(__nocache_fix(pgd), vaddr);
335− pud = pud_offset(__nocache_fix(p4d), vaddr);
336− pmd = pmd_offset(__nocache_fix(pgd), vaddr);
334+ p4d = p4d_offset(pgd, vaddr);
335+ pud = pud_offset(p4d, vaddr);
336+ pmd = pmd_offset(__nocache_fix(pud), vaddr);
337337 pte = pte_offset_kernel(__nocache_fix(pmd), vaddr);
338338
339339 pteval = ((paddr >> 4) | SRMMU_ET_PTE | SRMMU_PRIV);
arch/um/drivers/vector_user.h+1−1
@@ -17,7 +17,7 @@ · 16 unmodified lines
1717 #define TRANS_TAP_LEN strlen(TRANS_TAP)
1818
1919 #define TRANS_GRE "gre"
20−#define TRANS_GRE_LEN strlen(TRANS_RAW)
20+#define TRANS_GRE_LEN strlen(TRANS_GRE)
2121
2222 #define TRANS_L2TPV3 "l2tpv3"
2323 #define TRANS_L2TPV3_LEN strlen(TRANS_L2TPV3)
arch/um/include/asm/xor.h+1−1
@@ -1,6 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 #include <asm-generic/xor.h>
3−#include <shared/timer-internal.h>
3+#include <linux/time-internal.h>
44
55 /* pick an arbitrary one - measuring isn't possible with inf-cpu */
66 #define XOR_SELECT_TEMPLATE(x) \
arch/um/kernel/skas/syscall.c+1−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <sysdep/ptrace_user.h>
1212 #include <sysdep/syscalls.h>
1313 #include <linux/time-internal.h>
14+#include <asm/unistd.h>
1415
1516 void handle_syscall(struct uml_pt_regs *r)
1617 {
arch/x86/Kconfig+1−0
@@ -68,6 +68,7 @@ config X86 · 67 unmodified lines
6868 select ARCH_HAS_KCOV if X86_64
6969 select ARCH_HAS_MEM_ENCRYPT
7070 select ARCH_HAS_MEMBARRIER_SYNC_CORE
71+ select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
7172 select ARCH_HAS_PMEM_API if X86_64
7273 select ARCH_HAS_PTE_DEVMAP if X86_64
7374 select ARCH_HAS_PTE_SPECIAL
arch/x86/boot/tools/build.c+8−8
@@ -59,14 +59,14 @@ u8 buf[SETUP_SECT_MAX*512]; · 58 unmodified lines
5959 #define PECOFF_COMPAT_RESERVE 0x0
6060 #endif
6161
62−unsigned long efi32_stub_entry;
63−unsigned long efi64_stub_entry;
64−unsigned long efi_pe_entry;
65−unsigned long efi32_pe_entry;
66−unsigned long kernel_info;
67−unsigned long startup_64;
68−unsigned long _ehead;
69−unsigned long _end;
62+static unsigned long efi32_stub_entry;
63+static unsigned long efi64_stub_entry;
64+static unsigned long efi_pe_entry;
65+static unsigned long efi32_pe_entry;
66+static unsigned long kernel_info;
67+static unsigned long startup_64;
68+static unsigned long _ehead;
69+static unsigned long _end;
7070
7171 /*----------------------------------------------------------------------*/
7272
arch/x86/hyperv/hv_init.c+17−2
@@ -226,10 +226,18 @@ static int hv_cpu_die(unsigned int cpu) · 225 unmodified lines
226226
227227 rdmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)&re_ctrl));
228228 if (re_ctrl.target_vp == hv_vp_index[cpu]) {
229− /* Reassign to some other online CPU */
229+ /*
230+ * Reassign reenlightenment notifications to some other online
231+ * CPU or just disable the feature if there are no online CPUs
232+ * left (happens on hibernation).
233+ */
230234 new_cpu = cpumask_any_but(cpu_online_mask, cpu);
231235
232− re_ctrl.target_vp = hv_vp_index[new_cpu];
236+ if (new_cpu < nr_cpu_ids)
237+ re_ctrl.target_vp = hv_vp_index[new_cpu];
238+ else
239+ re_ctrl.enabled = 0;
240+
233241 wrmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)&re_ctrl));
234242 }
235243
@@ -293,6 +301,13 @@ static void hv_resume(void) · 57 unmodified lines
293301
294302 hv_hypercall_pg = hv_hypercall_pg_saved;
295303 hv_hypercall_pg_saved = NULL;
304+
305+ /*
306+ * Reenlightenment notifications are disabled by hv_cpu_die(0),
307+ * reenable them here if hv_reenlightenment_cb was previously set.
308+ */
309+ if (hv_reenlightenment_cb)
310+ set_hv_tscchange_cb(hv_reenlightenment_cb);
296311 }
297312
298313 /* Note: when the ops are called, only CPU0 is online and IRQs are disabled. */
arch/x86/include/asm/bitops.h+6−6
@@ -52,9 +52,9 @@ static __always_inline void · 51 unmodified lines
5252 arch_set_bit(long nr, volatile unsigned long *addr)
5353 {
5454 if (__builtin_constant_p(nr)) {
55− asm volatile(LOCK_PREFIX "orb %1,%0"
55+ asm volatile(LOCK_PREFIX "orb %b1,%0"
5656 : CONST_MASK_ADDR(nr, addr)
57− : "iq" (CONST_MASK(nr) & 0xff)
57+ : "iq" (CONST_MASK(nr))
5858 : "memory");
5959 } else {
6060 asm volatile(LOCK_PREFIX __ASM_SIZE(bts) " %1,%0"
@@ -72,9 +72,9 @@ static __always_inline void · 11 unmodified lines
7272 arch_clear_bit(long nr, volatile unsigned long *addr)
7373 {
7474 if (__builtin_constant_p(nr)) {
75− asm volatile(LOCK_PREFIX "andb %1,%0"
75+ asm volatile(LOCK_PREFIX "andb %b1,%0"
7676 : CONST_MASK_ADDR(nr, addr)
77− : "iq" (CONST_MASK(nr) ^ 0xff));
77+ : "iq" (~CONST_MASK(nr)));
7878 } else {
7979 asm volatile(LOCK_PREFIX __ASM_SIZE(btr) " %1,%0"
8080 : : RLONG_ADDR(addr), "Ir" (nr) : "memory");
@@ -123,9 +123,9 @@ static __always_inline void · 42 unmodified lines
123123 arch_change_bit(long nr, volatile unsigned long *addr)
124124 {
125125 if (__builtin_constant_p(nr)) {
126− asm volatile(LOCK_PREFIX "xorb %1,%0"
126+ asm volatile(LOCK_PREFIX "xorb %b1,%0"
127127 : CONST_MASK_ADDR(nr, addr)
128− : "iq" ((u8)CONST_MASK(nr)));
128+ : "iq" (CONST_MASK(nr)));
129129 } else {
130130 asm volatile(LOCK_PREFIX __ASM_SIZE(btc) " %1,%0"
131131 : : RLONG_ADDR(addr), "Ir" (nr) : "memory");
arch/x86/include/asm/ftrace.h+6−0
@@ -56,6 +56,12 @@ struct dyn_arch_ftrace { · 55 unmodified lines
5656
5757 #ifndef __ASSEMBLY__
5858
59+#if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_DYNAMIC_FTRACE)
60+extern void set_ftrace_ops_ro(void);
61+#else
62+static inline void set_ftrace_ops_ro(void) { }
63+#endif
64+
5965 #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
6066 static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
6167 {
arch/x86/include/asm/kvm_host.h+2−2
@@ -578,6 +578,7 @@ struct kvm_vcpu_arch { · 577 unmodified lines
578578 unsigned long cr4;
579579 unsigned long cr4_guest_owned_bits;
580580 unsigned long cr8;
581+ u32 host_pkru;
581582 u32 pkru;
582583 u32 hflags;
583584 u64 efer;
@@ -1093,8 +1094,6 @@ struct kvm_x86_ops { · 509 unmodified lines
10931094 void (*set_idt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt);
10941095 void (*get_gdt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt);
10951096 void (*set_gdt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt);
1096− u64 (*get_dr6)(struct kvm_vcpu *vcpu);
1097− void (*set_dr6)(struct kvm_vcpu *vcpu, unsigned long value);
10981097 void (*sync_dirty_debug_regs)(struct kvm_vcpu *vcpu);
10991098 void (*set_dr7)(struct kvm_vcpu *vcpu, unsigned long value);
11001099 void (*cache_reg)(struct kvm_vcpu *vcpu, enum kvm_reg reg);
@@ -1449,6 +1448,7 @@ bool kvm_rdpmc(struct kvm_vcpu *vcpu); · 348 unmodified lines
14491448
14501449 void kvm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr);
14511450 void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code);
1451+void kvm_queue_exception_p(struct kvm_vcpu *vcpu, unsigned nr, unsigned long payload);
14521452 void kvm_requeue_exception(struct kvm_vcpu *vcpu, unsigned nr);
14531453 void kvm_requeue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code);
14541454 void kvm_inject_page_fault(struct kvm_vcpu *vcpu, struct x86_exception *fault);
arch/x86/include/asm/stackprotector.h+6−1
@@ -55,8 +55,13 @@ · 54 unmodified lines
5555 /*
5656 * Initialize the stackprotector canary value.
5757 *
58− * NOTE: this must only be called from functions that never return,
58+ * NOTE: this must only be called from functions that never return
5959 * and it must always be inlined.
60+ *
61+ * In addition, it should be called from a compilation unit for which
62+ * stack protector is disabled. Alternatively, the caller should not end
63+ * with a function call which gets tail-call optimized as that would
64+ * lead to checking a modified canary value.
6065 */
6166 static __always_inline void boot_init_stack_canary(void)
6267 {
arch/x86/kernel/ftrace.c+28−1
@@ -407,7 +407,8 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size) · 406 unmodified lines
407407
408408 set_vm_flush_reset_perms(trampoline);
409409
410− set_memory_ro((unsigned long)trampoline, npages);
410+ if (likely(system_state != SYSTEM_BOOTING))
411+ set_memory_ro((unsigned long)trampoline, npages);
411412 set_memory_x((unsigned long)trampoline, npages);
412413 return (unsigned long)trampoline;
413414 fail:
@@ -415,6 +416,32 @@ fail: · 1 unmodified line
415416 return 0;
416417 }
417418
419+void set_ftrace_ops_ro(void)
420+{
421+ struct ftrace_ops *ops;
422+ unsigned long start_offset;
423+ unsigned long end_offset;
424+ unsigned long npages;
425+ unsigned long size;
426+
427+ do_for_each_ftrace_op(ops, ftrace_ops_list) {
428+ if (!(ops->flags & FTRACE_OPS_FL_ALLOC_TRAMP))
429+ continue;
430+
431+ if (ops->flags & FTRACE_OPS_FL_SAVE_REGS) {
432+ start_offset = (unsigned long)ftrace_regs_caller;
433+ end_offset = (unsigned long)ftrace_regs_caller_end;
434+ } else {
435+ start_offset = (unsigned long)ftrace_caller;
436+ end_offset = (unsigned long)ftrace_epilogue;
437+ }
438+ size = end_offset - start_offset;
439+ size = size + RET_SIZE + sizeof(void *);
440+ npages = DIV_ROUND_UP(size, PAGE_SIZE);
441+ set_memory_ro((unsigned long)ops->trampoline, npages);
442+ } while_for_each_ftrace_op(ops);
443+}
444+
418445 static unsigned long calc_trampoline_call_offset(bool save_regs)
419446 {
420447 unsigned long start_offset;
arch/x86/kernel/smpboot.c+8−0
@@ -266,6 +266,14 @@ static void notrace start_secondary(void *unused) · 265 unmodified lines
266266
267267 wmb();
268268 cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
269+
270+ /*
271+ * Prevent tail call to cpu_startup_entry() because the stack protector
272+ * guard has been changed a couple of function calls up, in
273+ * boot_init_stack_canary() and must not be checked before tail calling
274+ * another function.
275+ */
276+ prevent_tail_call_optimization();
269277 }
270278
271279 /**
arch/x86/kernel/unwind_orc.c+16−7
@@ -320,12 +320,19 @@ EXPORT_SYMBOL_GPL(unwind_get_return_address); · 319 unmodified lines
320320
321321 unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
322322 {
323+ struct task_struct *task = state->task;
324+
323325 if (unwind_done(state))
324326 return NULL;
325327
326328 if (state->regs)
327329 return &state->regs->ip;
328330
331+ if (task != current && state->sp == task->thread.sp) {
332+ struct inactive_task_frame *frame = (void *)task->thread.sp;
333+ return &frame->ret_addr;
334+ }
335+
329336 if (state->sp)
330337 return (unsigned long *)state->sp - 1;
331338
@@ -617,23 +624,23 @@ EXPORT_SYMBOL_GPL(unwind_next_frame); · 285 unmodified lines
617624 void __unwind_start(struct unwind_state *state, struct task_struct *task,
618625 struct pt_regs *regs, unsigned long *first_frame)
619626 {
620− if (!orc_init)
621− goto done;
622−
623627 memset(state, 0, sizeof(*state));
624628 state->task = task;
625629
630+ if (!orc_init)
631+ goto err;
632+
626633 /*
627634 * Refuse to unwind the stack of a task while it's executing on another
628635 * CPU. This check is racy, but that's ok: the unwinder has other
629636 * checks to prevent it from going off the rails.
630637 */
631638 if (task_on_another_cpu(task))
632− goto done;
639+ goto err;
633640
634641 if (regs) {
635642 if (user_mode(regs))
636− goto done;
643+ goto the_end;
637644
638645 state->ip = regs->ip;
639646 state->sp = regs->sp;
@@ -666,6 +673,7 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task, · 26 unmodified lines
666673 * generate some kind of backtrace if this happens.
667674 */
668675 void *next_page = (void *)PAGE_ALIGN((unsigned long)state->sp);
676+ state->error = true;
669677 if (get_stack_info(next_page, state->task, &state->stack_info,
670678 &state->stack_mask))
671679 return;
@@ -691,8 +699,9 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task, · 19 unmodified lines
691699
692700 return;
693701
694−done:
702+err:
703+ state->error = true;
704+the_end:
695705 state->stack_info.type = STACK_TYPE_UNKNOWN;
696− return;
697706 }
698707 EXPORT_SYMBOL_GPL(__unwind_start);
arch/x86/kvm/hyperv.c+1−1
@@ -1427,7 +1427,7 @@ static u64 kvm_hv_flush_tlb(struct kvm_vcpu *current_vcpu, u64 ingpa, · 1426 unmodified lines
14271427 */
14281428 kvm_make_vcpus_request_mask(kvm,
14291429 KVM_REQ_TLB_FLUSH | KVM_REQUEST_NO_WAKEUP,
1430− vcpu_mask, &hv_vcpu->tlb_flush);
1430+ NULL, vcpu_mask, &hv_vcpu->tlb_flush);
14311431
14321432 ret_success:
14331433 /* We always do full TLB flush, set rep_done = rep_cnt. */
arch/x86/kvm/svm/nested.c+31−8
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include <linux/kernel.h>
2020
2121 #include <asm/msr-index.h>
22+#include <asm/debugreg.h>
2223
2324 #include "kvm_emulate.h"
2425 #include "trace.h"
@@ -267,7 +268,7 @@ void enter_svm_guest_mode(struct vcpu_svm *svm, u64 vmcb_gpa, · 242 unmodified lines
267268 svm->vmcb->save.rsp = nested_vmcb->save.rsp;
268269 svm->vmcb->save.rip = nested_vmcb->save.rip;
269270 svm->vmcb->save.dr7 = nested_vmcb->save.dr7;
270− svm->vmcb->save.dr6 = nested_vmcb->save.dr6;
271+ svm->vcpu.arch.dr6 = nested_vmcb->save.dr6;
271272 svm->vmcb->save.cpl = nested_vmcb->save.cpl;
272273
273274 svm->nested.vmcb_msrpm = nested_vmcb->control.msrpm_base_pa & ~0x0fffULL;
@@ -482,7 +483,7 @@ int nested_svm_vmexit(struct vcpu_svm *svm) · 208 unmodified lines
482483 nested_vmcb->save.rsp = vmcb->save.rsp;
483484 nested_vmcb->save.rax = vmcb->save.rax;
484485 nested_vmcb->save.dr7 = vmcb->save.dr7;
485− nested_vmcb->save.dr6 = vmcb->save.dr6;
486+ nested_vmcb->save.dr6 = svm->vcpu.arch.dr6;
486487 nested_vmcb->save.cpl = vmcb->save.cpl;
487488
488489 nested_vmcb->control.int_ctl = vmcb->control.int_ctl;
@@ -606,26 +607,45 @@ static int nested_svm_exit_handled_msr(struct vcpu_svm *svm) · 117 unmodified lines
606607 /* DB exceptions for our internal use must not cause vmexit */
607608 static int nested_svm_intercept_db(struct vcpu_svm *svm)
608609 {
609− unsigned long dr6;
610+ unsigned long dr6 = svm->vmcb->save.dr6;
611+
612+ /* Always catch it and pass it to userspace if debugging. */
613+ if (svm->vcpu.guest_debug &
614+ (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))
615+ return NESTED_EXIT_HOST;
610616
611617 /* if we're not singlestepping, it's not ours */
612618 if (!svm->nmi_singlestep)
613− return NESTED_EXIT_DONE;
619+ goto reflected_db;
614620
615621 /* if it's not a singlestep exception, it's not ours */
616− if (kvm_get_dr(&svm->vcpu, 6, &dr6))
617− return NESTED_EXIT_DONE;
618622 if (!(dr6 & DR6_BS))
619− return NESTED_EXIT_DONE;
623+ goto reflected_db;
620624
621625 /* if the guest is singlestepping, it should get the vmexit */
622626 if (svm->nmi_singlestep_guest_rflags & X86_EFLAGS_TF) {
623627 disable_nmi_singlestep(svm);
624− return NESTED_EXIT_DONE;
628+ goto reflected_db;
625629 }
626630
627631 /* it's ours, the nested hypervisor must not see this one */
628632 return NESTED_EXIT_HOST;
633+
634+reflected_db:
635+ /*
636+ * Synchronize guest DR6 here just like in kvm_deliver_exception_payload;
637+ * it will be moved into the nested VMCB by nested_svm_vmexit. Once
638+ * exceptions will be moved to svm_check_nested_events, all this stuff
639+ * will just go away and we could just return NESTED_EXIT_HOST
640+ * unconditionally. db_interception will queue the exception, which
641+ * will be processed by svm_check_nested_events if a nested vmexit is
642+ * required, and we will just use kvm_deliver_exception_payload to copy
643+ * the payload to DR6 before vmexit.
644+ */
645+ WARN_ON(svm->vcpu.arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT);
646+ svm->vcpu.arch.dr6 &= ~(DR_TRAP_BITS | DR6_RTM);
647+ svm->vcpu.arch.dr6 |= dr6 & ~DR6_FIXED_1;
648+ return NESTED_EXIT_DONE;
629649 }
630650
631651 static int nested_svm_intercept_ioio(struct vcpu_svm *svm)
@@ -682,6 +702,9 @@ static int nested_svm_intercept(struct vcpu_svm *svm) · 50 unmodified lines
682702 if (svm->nested.intercept_exceptions & excp_bits) {
683703 if (exit_code == SVM_EXIT_EXCP_BASE + DB_VECTOR)
684704 vmexit = nested_svm_intercept_db(svm);
705+ else if (exit_code == SVM_EXIT_EXCP_BASE + BP_VECTOR &&
706+ svm->vcpu.guest_debug & KVM_GUESTDBG_USE_SW_BP)
707+ vmexit = NESTED_EXIT_HOST;
685708 else
686709 vmexit = NESTED_EXIT_DONE;
687710 }
arch/x86/kvm/svm/svm.c+22−14
@@ -1672,17 +1672,14 @@ static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *sd) · 1671 unmodified lines
16721672 mark_dirty(svm->vmcb, VMCB_ASID);
16731673 }
16741674
1675−static u64 svm_get_dr6(struct kvm_vcpu *vcpu)
1675+static void svm_set_dr6(struct vcpu_svm *svm, unsigned long value)
16761676 {
1677− return to_svm(vcpu)->vmcb->save.dr6;
1678−}
1679−
1680−static void svm_set_dr6(struct kvm_vcpu *vcpu, unsigned long value)
1681−{
1682− struct vcpu_svm *svm = to_svm(vcpu);
1677+ struct vmcb *vmcb = svm->vmcb;
16831678
1684− svm->vmcb->save.dr6 = value;
1685− mark_dirty(svm->vmcb, VMCB_DR);
1679+ if (unlikely(value != vmcb->save.dr6)) {
1680+ vmcb->save.dr6 = value;
1681+ mark_dirty(vmcb, VMCB_DR);
1682+ }
16861683 }
16871684
16881685 static void svm_sync_dirty_debug_regs(struct kvm_vcpu *vcpu)
@@ -1693,9 +1690,12 @@ static void svm_sync_dirty_debug_regs(struct kvm_vcpu *vcpu) · 4 unmodified lines
16931690 get_debugreg(vcpu->arch.db[1], 1);
16941691 get_debugreg(vcpu->arch.db[2], 2);
16951692 get_debugreg(vcpu->arch.db[3], 3);
1696− vcpu->arch.dr6 = svm_get_dr6(vcpu);
1693+ /*
1694+ * We cannot reset svm->vmcb->save.dr6 to DR6_FIXED_1|DR6_RTM here,
1695+ * because db_interception might need it. We can do it before vmentry.
1696+ */
1697+ vcpu->arch.dr6 = svm->vmcb->save.dr6;
16971698 vcpu->arch.dr7 = svm->vmcb->save.dr7;
1698−
16991699 vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_WONT_EXIT;
17001700 set_dr_intercepts(svm);
17011701 }
@@ -1739,7 +1739,8 @@ static int db_interception(struct vcpu_svm *svm) · 37 unmodified lines
17391739 if (!(svm->vcpu.guest_debug &
17401740 (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP)) &&
17411741 !svm->nmi_singlestep) {
1742− kvm_queue_exception(&svm->vcpu, DB_VECTOR);
1742+ u32 payload = (svm->vmcb->save.dr6 ^ DR6_RTM) & ~DR6_FIXED_1;
1743+ kvm_queue_exception_p(&svm->vcpu, DB_VECTOR, payload);
17431744 return 1;
17441745 }
17451746
@@ -3317,6 +3318,15 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) · 1571 unmodified lines
33173318
33183319 svm->vmcb->save.cr2 = vcpu->arch.cr2;
33193320
3321+ /*
3322+ * Run with all-zero DR6 unless needed, so that we can get the exact cause
3323+ * of a #DB.
3324+ */
3325+ if (unlikely(svm->vcpu.arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT))
3326+ svm_set_dr6(svm, vcpu->arch.dr6);
3327+ else
3328+ svm_set_dr6(svm, DR6_FIXED_1 | DR6_RTM);
3329+
33203330 clgi();
33213331 kvm_load_guest_xsave_state(vcpu);
33223332
@@ -3931,8 +3941,6 @@ static struct kvm_x86_ops svm_x86_ops __initdata = { · 608 unmodified lines
39313941 .set_idt = svm_set_idt,
39323942 .get_gdt = svm_get_gdt,
39333943 .set_gdt = svm_set_gdt,
3934− .get_dr6 = svm_get_dr6,
3935− .set_dr6 = svm_set_dr6,
39363944 .set_dr7 = svm_set_dr7,
39373945 .sync_dirty_debug_regs = svm_sync_dirty_debug_regs,
39383946 .cache_reg = svm_cache_reg,
arch/x86/kvm/vmx/vmx.c+4−37
@@ -1372,7 +1372,6 @@ void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu) · 1371 unmodified lines
13721372
13731373 vmx_vcpu_pi_load(vcpu, cpu);
13741374
1375− vmx->host_pkru = read_pkru();
13761375 vmx->host_debugctlmsr = get_debugctlmsr();
13771376 }
13781377
@@ -4677,15 +4676,13 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu) · 3298 unmodified lines
46774676 dr6 = vmcs_readl(EXIT_QUALIFICATION);
46784677 if (!(vcpu->guest_debug &
46794678 (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))) {
4680− vcpu->arch.dr6 &= ~DR_TRAP_BITS;
4681− vcpu->arch.dr6 |= dr6 | DR6_RTM;
46824679 if (is_icebp(intr_info))
46834680 WARN_ON(!skip_emulated_instruction(vcpu));
46844681
4685− kvm_queue_exception(vcpu, DB_VECTOR);
4682+ kvm_queue_exception_p(vcpu, DB_VECTOR, dr6);
46864683 return 1;
46874684 }
4688− kvm_run->debug.arch.dr6 = dr6 | DR6_FIXED_1;
4685+ kvm_run->debug.arch.dr6 = dr6 | DR6_FIXED_1 | DR6_RTM;
46894686 kvm_run->debug.arch.dr7 = vmcs_readl(GUEST_DR7);
46904687 /* fall through */
46914688 case BP_VECTOR:
@@ -4929,16 +4926,14 @@ static int handle_dr(struct kvm_vcpu *vcpu) · 237 unmodified lines
49294926 * guest debugging itself.
49304927 */
49314928 if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP) {
4932− vcpu->run->debug.arch.dr6 = vcpu->arch.dr6;
4929+ vcpu->run->debug.arch.dr6 = DR6_BD | DR6_RTM | DR6_FIXED_1;
49334930 vcpu->run->debug.arch.dr7 = dr7;
49344931 vcpu->run->debug.arch.pc = kvm_get_linear_rip(vcpu);
49354932 vcpu->run->debug.arch.exception = DB_VECTOR;
49364933 vcpu->run->exit_reason = KVM_EXIT_DEBUG;
49374934 return 0;
49384935 } else {
4939− vcpu->arch.dr6 &= ~DR_TRAP_BITS;
4940− vcpu->arch.dr6 |= DR6_BD | DR6_RTM;
4941− kvm_queue_exception(vcpu, DB_VECTOR);
4936+ kvm_queue_exception_p(vcpu, DB_VECTOR, DR6_BD);
49424937 return 1;
49434938 }
49444939 }
@@ -4969,15 +4964,6 @@ static int handle_dr(struct kvm_vcpu *vcpu) · 24 unmodified lines
49694964 return kvm_skip_emulated_instruction(vcpu);
49704965 }
49714966
4972−static u64 vmx_get_dr6(struct kvm_vcpu *vcpu)
4973−{
4974− return vcpu->arch.dr6;
4975−}
4976−
4977−static void vmx_set_dr6(struct kvm_vcpu *vcpu, unsigned long val)
4978−{
4979−}
4980−
49814967 static void vmx_sync_dirty_debug_regs(struct kvm_vcpu *vcpu)
49824968 {
49834969 get_debugreg(vcpu->arch.db[0], 0);
@@ -6577,11 +6563,6 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu) · 1593 unmodified lines
65776563
65786564 kvm_load_guest_xsave_state(vcpu);
65796565
6580− if (static_cpu_has(X86_FEATURE_PKU) &&
6581− kvm_read_cr4_bits(vcpu, X86_CR4_PKE) &&
6582− vcpu->arch.pkru != vmx->host_pkru)
6583− __write_pkru(vcpu->arch.pkru);
6584−
65856566 pt_guest_enter(vmx);
65866567
65876568 if (vcpu_to_pmu(vcpu)->version)
@@ -6671,18 +6652,6 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu) · 83 unmodified lines
66716652
66726653 pt_guest_exit(vmx);
66736654
6674− /*
6675− * eager fpu is enabled if PKEY is supported and CR4 is switched
6676− * back on host, so it is safe to read guest PKRU from current
6677− * XSAVE.
6678− */
6679− if (static_cpu_has(X86_FEATURE_PKU) &&
6680− kvm_read_cr4_bits(vcpu, X86_CR4_PKE)) {
6681− vcpu->arch.pkru = rdpkru();
6682− if (vcpu->arch.pkru != vmx->host_pkru)
6683− __write_pkru(vmx->host_pkru);
6684− }
6685−
66866655 kvm_load_host_xsave_state(vcpu);
66876656
66886657 vmx->nested.nested_run_pending = 0;
@@ -7740,8 +7709,6 @@ static struct kvm_x86_ops vmx_x86_ops __initdata = { · 1051 unmodified lines
77407709 .set_idt = vmx_set_idt,
77417710 .get_gdt = vmx_get_gdt,
77427711 .set_gdt = vmx_set_gdt,
7743− .get_dr6 = vmx_get_dr6,
7744− .set_dr6 = vmx_set_dr6,
77457712 .set_dr7 = vmx_set_dr7,
77467713 .sync_dirty_debug_regs = vmx_sync_dirty_debug_regs,
77477714 .cache_reg = vmx_cache_reg,
arch/x86/kvm/x86.c+37−23
@@ -572,11 +572,12 @@ void kvm_requeue_exception(struct kvm_vcpu *vcpu, unsigned nr) · 571 unmodified lines
572572 }
573573 EXPORT_SYMBOL_GPL(kvm_requeue_exception);
574574
575−static void kvm_queue_exception_p(struct kvm_vcpu *vcpu, unsigned nr,
576− unsigned long payload)
575+void kvm_queue_exception_p(struct kvm_vcpu *vcpu, unsigned nr,
576+ unsigned long payload)
577577 {
578578 kvm_multiple_exception(vcpu, nr, false, 0, true, payload, false);
579579 }
580+EXPORT_SYMBOL_GPL(kvm_queue_exception_p);
580581
581582 static void kvm_queue_exception_e_p(struct kvm_vcpu *vcpu, unsigned nr,
582583 u32 error_code, unsigned long payload)
@@ -836,11 +837,25 @@ void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu) · 253 unmodified lines
836837 vcpu->arch.ia32_xss != host_xss)
837838 wrmsrl(MSR_IA32_XSS, vcpu->arch.ia32_xss);
838839 }
840+
841+ if (static_cpu_has(X86_FEATURE_PKU) &&
842+ (kvm_read_cr4_bits(vcpu, X86_CR4_PKE) ||
843+ (vcpu->arch.xcr0 & XFEATURE_MASK_PKRU)) &&
844+ vcpu->arch.pkru != vcpu->arch.host_pkru)
845+ __write_pkru(vcpu->arch.pkru);
839846 }
840847 EXPORT_SYMBOL_GPL(kvm_load_guest_xsave_state);
841848
842849 void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu)
843850 {
851+ if (static_cpu_has(X86_FEATURE_PKU) &&
852+ (kvm_read_cr4_bits(vcpu, X86_CR4_PKE) ||
853+ (vcpu->arch.xcr0 & XFEATURE_MASK_PKRU))) {
854+ vcpu->arch.pkru = rdpkru();
855+ if (vcpu->arch.pkru != vcpu->arch.host_pkru)
856+ __write_pkru(vcpu->arch.host_pkru);
857+ }
858+
844859 if (kvm_read_cr4_bits(vcpu, X86_CR4_OSXSAVE)) {
845860
846861 if (vcpu->arch.xcr0 != host_xcr0)
@@ -1045,12 +1060,6 @@ static void kvm_update_dr0123(struct kvm_vcpu *vcpu) · 198 unmodified lines
10451060 }
10461061 }
10471062
1048−static void kvm_update_dr6(struct kvm_vcpu *vcpu)
1049−{
1050− if (!(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP))
1051− kvm_x86_ops.set_dr6(vcpu, vcpu->arch.dr6);
1052−}
1053−
10541063 static void kvm_update_dr7(struct kvm_vcpu *vcpu)
10551064 {
10561065 unsigned long dr7;
@@ -1090,7 +1099,6 @@ static int __kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val) · 33 unmodified lines
10901099 if (val & 0xffffffff00000000ULL)
10911100 return -1; /* #GP */
10921101 vcpu->arch.dr6 = (val & DR6_VOLATILE) | kvm_dr6_fixed(vcpu);
1093− kvm_update_dr6(vcpu);
10941102 break;
10951103 case 5:
10961104 /* fall through */
@@ -1126,10 +1134,7 @@ int kvm_get_dr(struct kvm_vcpu *vcpu, int dr, unsigned long *val) · 29 unmodified lines
11261134 case 4:
11271135 /* fall through */
11281136 case 6:
1129− if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP)
1130− *val = vcpu->arch.dr6;
1131− else
1132− *val = kvm_x86_ops.get_dr6(vcpu);
1137+ *val = vcpu->arch.dr6;
11331138 break;
11341139 case 5:
11351140 /* fall through */
@@ -3558,6 +3563,9 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) · 2422 unmodified lines
35583563
35593564 kvm_x86_ops.vcpu_load(vcpu, cpu);
35603565
3566+ /* Save host pkru register if supported */
3567+ vcpu->arch.host_pkru = read_pkru();
3568+
35613569 /* Apply any externally detected TSC adjustments (due to suspend) */
35623570 if (unlikely(vcpu->arch.tsc_offset_adjustment)) {
35633571 adjust_tsc_offset_host(vcpu, vcpu->arch.tsc_offset_adjustment);
@@ -3751,7 +3759,7 @@ static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu, · 187 unmodified lines
37513759 unsigned bank_num = mcg_cap & 0xff, bank;
37523760
37533761 r = -EINVAL;
3754− if (!bank_num || bank_num >= KVM_MAX_MCE_BANKS)
3762+ if (!bank_num || bank_num > KVM_MAX_MCE_BANKS)
37553763 goto out;
37563764 if (mcg_cap & ~(kvm_mce_cap_supported | 0xff | 0xff0000))
37573765 goto out;
@@ -4009,7 +4017,6 @@ static int kvm_vcpu_ioctl_x86_set_debugregs(struct kvm_vcpu *vcpu, · 251 unmodified lines
40094017 memcpy(vcpu->arch.db, dbgregs->db, sizeof(vcpu->arch.db));
40104018 kvm_update_dr0123(vcpu);
40114019 vcpu->arch.dr6 = dbgregs->dr6;
4012− kvm_update_dr6(vcpu);
40134020 vcpu->arch.dr7 = dbgregs->dr7;
40144021 kvm_update_dr7(vcpu);
40154022
@@ -6659,7 +6666,7 @@ static int kvm_vcpu_do_singlestep(struct kvm_vcpu *vcpu) · 2643 unmodified lines
66596666
66606667 if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) {
66616668 kvm_run->debug.arch.dr6 = DR6_BS | DR6_FIXED_1 | DR6_RTM;
6662− kvm_run->debug.arch.pc = vcpu->arch.singlestep_rip;
6669+ kvm_run->debug.arch.pc = kvm_get_linear_rip(vcpu);
66636670 kvm_run->debug.arch.exception = DB_VECTOR;
66646671 kvm_run->exit_reason = KVM_EXIT_DEBUG;
66656672 return 0;
@@ -6719,9 +6726,7 @@ static bool kvm_vcpu_check_breakpoint(struct kvm_vcpu *vcpu, int *r) · 53 unmodified lines
67196726 vcpu->arch.db);
67206727
67216728 if (dr6 != 0) {
6722− vcpu->arch.dr6 &= ~DR_TRAP_BITS;
6723− vcpu->arch.dr6 |= dr6 | DR6_RTM;
6724− kvm_queue_exception(vcpu, DB_VECTOR);
6729+ kvm_queue_exception_p(vcpu, DB_VECTOR, dr6);
67256730 *r = 1;
67266731 return true;
67276732 }
@@ -8042,7 +8047,7 @@ void kvm_make_scan_ioapic_request_mask(struct kvm *kvm, · 1314 unmodified lines
80428047 zalloc_cpumask_var(&cpus, GFP_ATOMIC);
80438048
80448049 kvm_make_vcpus_request_mask(kvm, KVM_REQ_SCAN_IOAPIC,
8045− vcpu_bitmap, cpus);
8050+ NULL, vcpu_bitmap, cpus);
80468051
80478052 free_cpumask_var(cpus);
80488053 }
@@ -8072,6 +8077,7 @@ EXPORT_SYMBOL_GPL(kvm_vcpu_update_apicv); · 23 unmodified lines
80728077 */
80738078 void kvm_request_apicv_update(struct kvm *kvm, bool activate, ulong bit)
80748079 {
8080+ struct kvm_vcpu *except;
80758081 unsigned long old, new, expected;
80768082
80778083 if (!kvm_x86_ops.check_apicv_inhibit_reasons ||
@@ -8096,7 +8102,17 @@ void kvm_request_apicv_update(struct kvm *kvm, bool activate, ulong bit) · 18 unmodified lines
80968102 trace_kvm_apicv_update_request(activate, bit);
80978103 if (kvm_x86_ops.pre_update_apicv_exec_ctrl)
80988104 kvm_x86_ops.pre_update_apicv_exec_ctrl(kvm, activate);
8099− kvm_make_all_cpus_request(kvm, KVM_REQ_APICV_UPDATE);
8105+
8106+ /*
8107+ * Sending request to update APICV for all other vcpus,
8108+ * while update the calling vcpu immediately instead of
8109+ * waiting for another #VMEXIT to handle the request.
8110+ */
8111+ except = kvm_get_running_vcpu();
8112+ kvm_make_all_cpus_request_except(kvm, KVM_REQ_APICV_UPDATE,
8113+ except);
8114+ if (except)
8115+ kvm_vcpu_update_apicv(except);
81008116 }
81018117 EXPORT_SYMBOL_GPL(kvm_request_apicv_update);
81028118
@@ -8420,7 +8436,6 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 317 unmodified lines
84208436 WARN_ON(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP);
84218437 kvm_x86_ops.sync_dirty_debug_regs(vcpu);
84228438 kvm_update_dr0123(vcpu);
8423− kvm_update_dr6(vcpu);
84248439 kvm_update_dr7(vcpu);
84258440 vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_RELOAD;
84268441 }
@@ -9481,7 +9496,6 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) · 1054 unmodified lines
94819496 memset(vcpu->arch.db, 0, sizeof(vcpu->arch.db));
94829497 kvm_update_dr0123(vcpu);
94839498 vcpu->arch.dr6 = DR6_INIT;
9484− kvm_update_dr6(vcpu);
94859499 vcpu->arch.dr7 = DR7_FIXED_1;
94869500 kvm_update_dr7(vcpu);
94879501
arch/x86/mm/init_64.c+3−0
@@ -54,6 +54,7 @@ · 53 unmodified lines
5454 #include <asm/init.h>
5555 #include <asm/uv/uv.h>
5656 #include <asm/setup.h>
57+#include <asm/ftrace.h>
5758
5859 #include "mm_internal.h"
5960
@@ -1291,6 +1292,8 @@ void mark_rodata_ro(void) · 1231 unmodified lines
12911292 all_end = roundup((unsigned long)_brk_end, PMD_SIZE);
12921293 set_memory_nx(text_end, (all_end - text_end) >> PAGE_SHIFT);
12931294
1295+ set_ftrace_ops_ro();
1296+
12941297 #ifdef CONFIG_CPA_DEBUG
12951298 printk(KERN_INFO "Testing CPA: undo %lx-%lx\n", start, end);
12961299 set_memory_rw(start, (end-start) >> PAGE_SHIFT);
arch/x86/mm/mmio-mod.c+2−2
@@ -372,7 +372,7 @@ static void enter_uniprocessor(void) · 371 unmodified lines
372372 int cpu;
373373 int err;
374374
375− if (downed_cpus == NULL &&
375+ if (!cpumask_available(downed_cpus) &&
376376 !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) {
377377 pr_notice("Failed to allocate mask\n");
378378 goto out;
@@ -402,7 +402,7 @@ static void leave_uniprocessor(void) · 23 unmodified lines
402402 int cpu;
403403 int err;
404404
405− if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
405+ if (!cpumask_available(downed_cpus) || cpumask_weight(downed_cpus) == 0)
406406 return;
407407 pr_notice("Re-enabling CPUs...\n");
408408 for_each_cpu(cpu, downed_cpus) {
arch/x86/xen/smp_pv.c+1−0
@@ -93,6 +93,7 @@ asmlinkage __visible void cpu_bringup_and_idle(void) · 92 unmodified lines
9393 cpu_bringup();
9494 boot_init_stack_canary();
9595 cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
96+ prevent_tail_call_optimization();
9697 }
9798
9899 void xen_smp_intr_free_pv(unsigned int cpu)
drivers/acpi/ec.c+18−6
@@ -1994,23 +1994,35 @@ void acpi_ec_set_gpe_wake_mask(u8 action) · 1993 unmodified lines
19941994 acpi_set_gpe_wake_mask(NULL, first_ec->gpe, action);
19951995 }
19961996
1997−bool acpi_ec_other_gpes_active(void)
1998−{
1999− return acpi_any_gpe_status_set(first_ec ? first_ec->gpe : U32_MAX);
2000−}
2001−
20021997 bool acpi_ec_dispatch_gpe(void)
20031998 {
20041999 u32 ret;
20052000
20062001 if (!first_ec)
2002+ return acpi_any_gpe_status_set(U32_MAX);
2003+
2004+ /*
2005+ * Report wakeup if the status bit is set for any enabled GPE other
2006+ * than the EC one.
2007+ */
2008+ if (acpi_any_gpe_status_set(first_ec->gpe))
2009+ return true;
2010+
2011+ if (ec_no_wakeup)
20072012 return false;
20082013
2014+ /*
2015+ * Dispatch the EC GPE in-band, but do not report wakeup in any case
2016+ * to allow the caller to process events properly after that.
2017+ */
20092018 ret = acpi_dispatch_gpe(NULL, first_ec->gpe);
20102019 if (ret == ACPI_INTERRUPT_HANDLED) {
20112020 pm_pr_dbg("EC GPE dispatched\n");
2012− return true;
2021+
2022+ /* Flush the event and query workqueues. */
2023+ acpi_ec_flush_work();
20132024 }
2025+
20142026 return false;
20152027 }
20162028 #endif /* CONFIG_PM_SLEEP */
drivers/acpi/internal.h+0−1
@@ -202,7 +202,6 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit); · 201 unmodified lines
202202
203203 #ifdef CONFIG_PM_SLEEP
204204 void acpi_ec_flush_work(void);
205−bool acpi_ec_other_gpes_active(void);
206205 bool acpi_ec_dispatch_gpe(void);
207206 #endif
208207
drivers/acpi/sleep.c+6−23
@@ -980,13 +980,6 @@ static int acpi_s2idle_prepare_late(void) · 979 unmodified lines
980980 return 0;
981981 }
982982
983−static void acpi_s2idle_sync(void)
984−{
985− /* The EC driver uses special workqueues that need to be flushed. */
986− acpi_ec_flush_work();
987− acpi_os_wait_events_complete(); /* synchronize Notify handling */
988−}
989−
990983 static bool acpi_s2idle_wake(void)
991984 {
992985 if (!acpi_sci_irq_valid())
@@ -1013,22 +1006,12 @@ static bool acpi_s2idle_wake(void) · 20 unmodified lines
10131006 if (acpi_check_wakeup_handlers())
10141007 return true;
10151008
1016− /*
1017− * If the status bit is set for any enabled GPE other than the
1018− * EC one, the wakeup is regarded as a genuine one.
1019− */
1020− if (acpi_ec_other_gpes_active())
1009+ /* Check non-EC GPE wakeups and dispatch the EC GPE. */
1010+ if (acpi_ec_dispatch_gpe())
10211011 return true;
10221012
10231013 /*
1024− * If the EC GPE status bit has not been set, the wakeup is
1025− * regarded as a spurious one.
1026− */
1027− if (!acpi_ec_dispatch_gpe())
1028− return false;
1029−
1030− /*
1031− * Cancel the wakeup and process all pending events in case
1014+ * Cancel the SCI wakeup and process all pending events in case
10321015 * there are any wakeup ones in there.
10331016 *
10341017 * Note that if any non-EC GPEs are active at this point, the
@@ -1036,8 +1019,7 @@ static bool acpi_s2idle_wake(void) · 1 unmodified line
10361019 * should be missed by canceling the wakeup here.
10371020 */
10381021 pm_system_cancel_wakeup();
1039−
1040− acpi_s2idle_sync();
1022+ acpi_os_wait_events_complete();
10411023
10421024 /*
10431025 * The SCI is in the "suspended" state now and it cannot produce
@@ -1070,7 +1052,8 @@ static void acpi_s2idle_restore(void) · 26 unmodified lines
10701052 * of GPEs.
10711053 */
10721054 acpi_os_wait_events_complete(); /* synchronize GPE processing */
1073− acpi_s2idle_sync();
1055+ acpi_ec_flush_work(); /* flush the EC driver's workqueues */
1056+ acpi_os_wait_events_complete(); /* synchronize Notify handling */
10741057
10751058 s2idle_wakeup = false;
10761059
drivers/base/core.c+37−18
@@ -365,6 +365,7 @@ struct device_link *device_link_add(struct device *consumer, · 364 unmodified lines
365365 link->flags |= DL_FLAG_STATELESS;
366366 goto reorder;
367367 } else {
368+ link->flags |= DL_FLAG_STATELESS;
368369 goto out;
369370 }
370371 }
@@ -433,12 +434,16 @@ struct device_link *device_link_add(struct device *consumer, · 62 unmodified lines
433434 flags & DL_FLAG_PM_RUNTIME)
434435 pm_runtime_resume(supplier);
435436
437+ list_add_tail_rcu(&link->s_node, &supplier->links.consumers);
438+ list_add_tail_rcu(&link->c_node, &consumer->links.suppliers);
439+
436440 if (flags & DL_FLAG_SYNC_STATE_ONLY) {
437441 dev_dbg(consumer,
438442 "Linked as a sync state only consumer to %s\n",
439443 dev_name(supplier));
440444 goto out;
441445 }
446+
442447 reorder:
443448 /*
444449 * Move the consumer and all of the devices depending on it to the end
@@ -449,12 +454,9 @@ reorder: · 4 unmodified lines
449454 */
450455 device_reorder_to_tail(consumer, NULL);
451456
452− list_add_tail_rcu(&link->s_node, &supplier->links.consumers);
453− list_add_tail_rcu(&link->c_node, &consumer->links.suppliers);
454−
455457 dev_dbg(consumer, "Linked as a consumer to %s\n", dev_name(supplier));
456458
457− out:
459+out:
458460 device_pm_unlock();
459461 device_links_write_unlock();
460462
@@ -829,6 +831,13 @@ static void __device_links_supplier_defer_sync(struct device *sup) · 368 unmodified lines
829831 list_add_tail(&sup->links.defer_sync, &deferred_sync);
830832 }
831833
834+static void device_link_drop_managed(struct device_link *link)
835+{
836+ link->flags &= ~DL_FLAG_MANAGED;
837+ WRITE_ONCE(link->status, DL_STATE_NONE);
838+ kref_put(&link->kref, __device_link_del);
839+}
840+
832841 /**
833842 * device_links_driver_bound - Update device links after probing its driver.
834843 * @dev: Device to update the links for.
@@ -842,7 +851,7 @@ static void __device_links_supplier_defer_sync(struct device *sup) · 7 unmodified lines
842851 */
843852 void device_links_driver_bound(struct device *dev)
844853 {
845− struct device_link *link;
854+ struct device_link *link, *ln;
846855 LIST_HEAD(sync_list);
847856
848857 /*
@@ -882,18 +891,35 @@ void device_links_driver_bound(struct device *dev) · 33 unmodified lines
882891 else
883892 __device_links_queue_sync_state(dev, &sync_list);
884893
885− list_for_each_entry(link, &dev->links.suppliers, c_node) {
894+ list_for_each_entry_safe(link, ln, &dev->links.suppliers, c_node) {
895+ struct device *supplier;
896+
886897 if (!(link->flags & DL_FLAG_MANAGED))
887898 continue;
888899
889− WARN_ON(link->status != DL_STATE_CONSUMER_PROBE);
890− WRITE_ONCE(link->status, DL_STATE_ACTIVE);
900+ supplier = link->supplier;
901+ if (link->flags & DL_FLAG_SYNC_STATE_ONLY) {
902+ /*
903+ * When DL_FLAG_SYNC_STATE_ONLY is set, it means no
904+ * other DL_MANAGED_LINK_FLAGS have been set. So, it's
905+ * save to drop the managed link completely.
906+ */
907+ device_link_drop_managed(link);
908+ } else {
909+ WARN_ON(link->status != DL_STATE_CONSUMER_PROBE);
910+ WRITE_ONCE(link->status, DL_STATE_ACTIVE);
911+ }
891912
913+ /*
914+ * This needs to be done even for the deleted
915+ * DL_FLAG_SYNC_STATE_ONLY device link in case it was the last
916+ * device link that was preventing the supplier from getting a
917+ * sync_state() call.
918+ */
892919 if (defer_sync_state_count)
893− __device_links_supplier_defer_sync(link->supplier);
920+ __device_links_supplier_defer_sync(supplier);
894921 else
895− __device_links_queue_sync_state(link->supplier,
896− &sync_list);
922+ __device_links_queue_sync_state(supplier, &sync_list);
897923 }
898924
899925 dev->links.status = DL_DEV_DRIVER_BOUND;
@@ -903,13 +929,6 @@ void device_links_driver_bound(struct device *dev) · 3 unmodified lines
903929 device_links_flush_sync_list(&sync_list, dev);
904930 }
905931
906−static void device_link_drop_managed(struct device_link *link)
907−{
908− link->flags &= ~DL_FLAG_MANAGED;
909− WRITE_ONCE(link->status, DL_STATE_NONE);
910− kref_put(&link->kref, __device_link_del);
911−}
912−
913932 /**
914933 * __device_links_no_driver - Update links of a device without a driver.
915934 * @dev: Device without a drvier.
drivers/block/null_blk_main.c+7−0
@@ -1535,6 +1535,13 @@ static void null_config_discard(struct nullb *nullb) · 1534 unmodified lines
15351535 {
15361536 if (nullb->dev->discard == false)
15371537 return;
1538+
1539+ if (nullb->dev->zoned) {
1540+ nullb->dev->discard = false;
1541+ pr_info("discard option is ignored in zoned mode\n");
1542+ return;
1543+ }
1544+
15381545 nullb->q->limits.discard_granularity = nullb->dev->blocksize;
15391546 nullb->q->limits.discard_alignment = nullb->dev->blocksize;
15401547 blk_queue_max_discard_sectors(nullb->q, UINT_MAX >> 9);
drivers/block/null_blk_zoned.c+4−0
@@ -23,6 +23,10 @@ int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q) · 22 unmodified lines
2323 pr_err("zone_size must be power-of-two\n");
2424 return -EINVAL;
2525 }
26+ if (dev->zone_size > dev->size) {
27+ pr_err("Zone size larger than device capacity\n");
28+ return -EINVAL;
29+ }
2630
2731 dev->zone_size_sects = dev->zone_size << ZONE_SIZE_SHIFT;
2832 dev->nr_zones = dev_size >>
drivers/bus/mhi/core/init.c+2−0
@@ -291,6 +291,7 @@ int mhi_init_dev_ctxt(struct mhi_controller *mhi_cntrl) · 290 unmodified lines
291291 }
292292
293293 /* Setup cmd context */
294+ ret = -ENOMEM;
294295 mhi_ctxt->cmd_ctxt = mhi_alloc_coherent(mhi_cntrl,
295296 sizeof(*mhi_ctxt->cmd_ctxt) *
296297 NR_OF_CMD_RINGS,
@@ -1100,6 +1101,7 @@ static int mhi_driver_probe(struct device *dev) · 803 unmodified lines
11001101 }
11011102 }
11021103
1104+ ret = -EINVAL;
11031105 if (dl_chan) {
11041106 /*
11051107 * If channel supports LPM notifications then status_cb should
drivers/char/ipmi/ipmi_ssif.c+2−2
@@ -1947,8 +1947,8 @@ static int ssif_adapter_handler(struct device *adev, void *opaque) · 1946 unmodified lines
19471947 if (adev->type != &i2c_adapter_type)
19481948 return 0;
19491949
1950− addr_info->added_client = i2c_new_device(to_i2c_adapter(adev),
1951− &addr_info->binfo);
1950+ addr_info->added_client = i2c_new_client_device(to_i2c_adapter(adev),
1951+ &addr_info->binfo);
19521952
19531953 if (!addr_info->adapter_name)
19541954 return 1; /* Only try the first I2C adapter by default. */
drivers/clk/clk.c+3−0
@@ -3519,6 +3519,9 @@ static int __clk_core_init(struct clk_core *core) · 3518 unmodified lines
35193519 out:
35203520 clk_pm_runtime_put(core);
35213521 unlock:
3522+ if (ret)
3523+ hlist_del_init(&core->child_node);
3524+
35223525 clk_prepare_unlock();
35233526
35243527 if (!ret)
drivers/clk/rockchip/clk-rk3228.c+4−13
@@ -156,8 +156,6 @@ PNAME(mux_i2s_out_p) = { "i2s1_pre", "xin12m" }; · 155 unmodified lines
156156 PNAME(mux_i2s2_p) = { "i2s2_src", "i2s2_frac", "xin12m" };
157157 PNAME(mux_sclk_spdif_p) = { "sclk_spdif_src", "spdif_frac", "xin12m" };
158158
159−PNAME(mux_aclk_gpu_pre_p) = { "cpll_gpu", "gpll_gpu", "hdmiphy_gpu", "usb480m_gpu" };
160−
161159 PNAME(mux_uart0_p) = { "uart0_src", "uart0_frac", "xin24m" };
162160 PNAME(mux_uart1_p) = { "uart1_src", "uart1_frac", "xin24m" };
163161 PNAME(mux_uart2_p) = { "uart2_src", "uart2_frac", "xin24m" };
@@ -468,16 +466,9 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { · 304 unmodified lines
468466 RK2928_CLKSEL_CON(24), 6, 10, DFLAGS,
469467 RK2928_CLKGATE_CON(2), 8, GFLAGS),
470468
471− GATE(0, "cpll_gpu", "cpll", 0,
472− RK2928_CLKGATE_CON(3), 13, GFLAGS),
473− GATE(0, "gpll_gpu", "gpll", 0,
474− RK2928_CLKGATE_CON(3), 13, GFLAGS),
475− GATE(0, "hdmiphy_gpu", "hdmiphy", 0,
476− RK2928_CLKGATE_CON(3), 13, GFLAGS),
477− GATE(0, "usb480m_gpu", "usb480m", 0,
469+ COMPOSITE(0, "aclk_gpu_pre", mux_pll_src_4plls_p, 0,
470+ RK2928_CLKSEL_CON(34), 5, 2, MFLAGS, 0, 5, DFLAGS,
478471 RK2928_CLKGATE_CON(3), 13, GFLAGS),
479− COMPOSITE_NOGATE(0, "aclk_gpu_pre", mux_aclk_gpu_pre_p, 0,
480− RK2928_CLKSEL_CON(34), 5, 2, MFLAGS, 0, 5, DFLAGS),
481472
482473 COMPOSITE(SCLK_SPI0, "sclk_spi0", mux_pll_src_2plls_p, 0,
483474 RK2928_CLKSEL_CON(25), 8, 1, MFLAGS, 0, 7, DFLAGS,
@@ -582,8 +573,8 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { · 98 unmodified lines
582573 GATE(0, "pclk_peri_noc", "pclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(12), 2, GFLAGS),
583574
584575 /* PD_GPU */
585− GATE(ACLK_GPU, "aclk_gpu", "aclk_gpu_pre", 0, RK2928_CLKGATE_CON(13), 14, GFLAGS),
586− GATE(0, "aclk_gpu_noc", "aclk_gpu_pre", 0, RK2928_CLKGATE_CON(13), 15, GFLAGS),
576+ GATE(ACLK_GPU, "aclk_gpu", "aclk_gpu_pre", 0, RK2928_CLKGATE_CON(7), 14, GFLAGS),
577+ GATE(0, "aclk_gpu_noc", "aclk_gpu_pre", 0, RK2928_CLKGATE_CON(7), 15, GFLAGS),
587578
588579 /* PD_BUS */
589580 GATE(0, "sclk_initmem_mbist", "aclk_cpu", 0, RK2928_CLKGATE_CON(8), 1, GFLAGS),
drivers/clk/tegra/clk-tegra124.c+1−1
@@ -1292,7 +1292,7 @@ static struct tegra_clk_init_table common_init_table[] __initdata = { · 1291 unmodified lines
12921292 { TEGRA124_CLK_UARTB, TEGRA124_CLK_PLL_P, 408000000, 0 },
12931293 { TEGRA124_CLK_UARTC, TEGRA124_CLK_PLL_P, 408000000, 0 },
12941294 { TEGRA124_CLK_UARTD, TEGRA124_CLK_PLL_P, 408000000, 0 },
1295− { TEGRA124_CLK_PLL_A, TEGRA124_CLK_CLK_MAX, 564480000, 0 },
1295+ { TEGRA124_CLK_PLL_A, TEGRA124_CLK_CLK_MAX, 282240000, 0 },
12961296 { TEGRA124_CLK_PLL_A_OUT0, TEGRA124_CLK_CLK_MAX, 11289600, 0 },
12971297 { TEGRA124_CLK_I2S0, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0 },
12981298 { TEGRA124_CLK_I2S1, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0 },
drivers/clk/ti/clk-33xx.c+1−1
@@ -212,7 +212,7 @@ static const struct omap_clkctrl_reg_data am3_mpu_clkctrl_regs[] __initconst = { · 211 unmodified lines
212212 };
213213
214214 static const struct omap_clkctrl_reg_data am3_l4_rtc_clkctrl_regs[] __initconst = {
215− { AM3_L4_RTC_RTC_CLKCTRL, NULL, CLKF_SW_SUP, "clk_32768_ck" },
215+ { AM3_L4_RTC_RTC_CLKCTRL, NULL, CLKF_SW_SUP, "clk-24mhz-clkctrl:0000:0" },
216216 { 0 },
217217 };
218218
drivers/clk/ti/clkctrl.c+48−51
@@ -255,24 +255,53 @@ static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec, · 254 unmodified lines
255255 return entry->clk;
256256 }
257257
258+/* Get clkctrl clock base name based on clkctrl_name or dts node */
259+static const char * __init clkctrl_get_clock_name(struct device_node *np,
260+ const char *clkctrl_name,
261+ int offset, int index,
262+ bool legacy_naming)
263+{
264+ char *clock_name;
265+
266+ /* l4per-clkctrl:1234:0 style naming based on clkctrl_name */
267+ if (clkctrl_name && !legacy_naming) {
268+ clock_name = kasprintf(GFP_KERNEL, "%s-clkctrl:%04x:%d",
269+ clkctrl_name, offset, index);
270+ strreplace(clock_name, '_', '-');
271+
272+ return clock_name;
273+ }
274+
275+ /* l4per:1234:0 old style naming based on clkctrl_name */
276+ if (clkctrl_name)
277+ return kasprintf(GFP_KERNEL, "%s_cm:clk:%04x:%d",
278+ clkctrl_name, offset, index);
279+
280+ /* l4per_cm:1234:0 old style naming based on parent node name */
281+ if (legacy_naming)
282+ return kasprintf(GFP_KERNEL, "%pOFn:clk:%04x:%d",
283+ np->parent, offset, index);
284+
285+ /* l4per-clkctrl:1234:0 style naming based on node name */
286+ return kasprintf(GFP_KERNEL, "%pOFn:%04x:%d", np, offset, index);
287+}
288+
258289 static int __init
259290 _ti_clkctrl_clk_register(struct omap_clkctrl_provider *provider,
260291 struct device_node *node, struct clk_hw *clk_hw,
261292 u16 offset, u8 bit, const char * const *parents,
262− int num_parents, const struct clk_ops *ops)
293+ int num_parents, const struct clk_ops *ops,
294+ const char *clkctrl_name)
263295 {
264296 struct clk_init_data init = { NULL };
265297 struct clk *clk;
266298 struct omap_clkctrl_clk *clkctrl_clk;
267299 int ret = 0;
268300
269− if (ti_clk_get_features()->flags & TI_CLK_CLKCTRL_COMPAT)
270− init.name = kasprintf(GFP_KERNEL, "%pOFn:%pOFn:%04x:%d",
271− node->parent, node, offset,
272− bit);
273− else
274− init.name = kasprintf(GFP_KERNEL, "%pOFn:%04x:%d", node,
275− offset, bit);
301+ init.name = clkctrl_get_clock_name(node, clkctrl_name, offset, bit,
302+ ti_clk_get_features()->flags &
303+ TI_CLK_CLKCTRL_COMPAT);
304+
276305 clkctrl_clk = kzalloc(sizeof(*clkctrl_clk), GFP_KERNEL);
277306 if (!init.name || !clkctrl_clk) {
278307 ret = -ENOMEM;
@@ -309,7 +338,7 @@ static void __init · 30 unmodified lines
309338 _ti_clkctrl_setup_gate(struct omap_clkctrl_provider *provider,
310339 struct device_node *node, u16 offset,
311340 const struct omap_clkctrl_bit_data *data,
312− void __iomem *reg)
341+ void __iomem *reg, const char *clkctrl_name)
313342 {
314343 struct clk_hw_omap *clk_hw;
315344
@@ -322,7 +351,7 @@ _ti_clkctrl_setup_gate(struct omap_clkctrl_provider *provider, · 6 unmodified lines
322351
323352 if (_ti_clkctrl_clk_register(provider, node, &clk_hw->hw, offset,
324353 data->bit, data->parents, 1,
325− &omap_gate_clk_ops))
354+ &omap_gate_clk_ops, clkctrl_name))
326355 kfree(clk_hw);
327356 }
328357
@@ -330,7 +359,7 @@ static void __init · 1 unmodified line
330359 _ti_clkctrl_setup_mux(struct omap_clkctrl_provider *provider,
331360 struct device_node *node, u16 offset,
332361 const struct omap_clkctrl_bit_data *data,
333− void __iomem *reg)
362+ void __iomem *reg, const char *clkctrl_name)
334363 {
335364 struct clk_omap_mux *mux;
336365 int num_parents = 0;
@@ -357,7 +386,7 @@ _ti_clkctrl_setup_mux(struct omap_clkctrl_provider *provider, · 20 unmodified lines
357386
358387 if (_ti_clkctrl_clk_register(provider, node, &mux->hw, offset,
359388 data->bit, data->parents, num_parents,
360− &ti_clk_mux_ops))
389+ &ti_clk_mux_ops, clkctrl_name))
361390 kfree(mux);
362391 }
363392
@@ -365,7 +394,7 @@ static void __init · 1 unmodified line
365394 _ti_clkctrl_setup_div(struct omap_clkctrl_provider *provider,
366395 struct device_node *node, u16 offset,
367396 const struct omap_clkctrl_bit_data *data,
368− void __iomem *reg)
397+ void __iomem *reg, const char *clkctrl_name)
369398 {
370399 struct clk_omap_divider *div;
371400 const struct omap_clkctrl_div_data *div_data = data->data;
@@ -393,7 +422,7 @@ _ti_clkctrl_setup_div(struct omap_clkctrl_provider *provider, · 21 unmodified lines
393422
394423 if (_ti_clkctrl_clk_register(provider, node, &div->hw, offset,
395424 data->bit, data->parents, 1,
396− &ti_clk_divider_ops))
425+ &ti_clk_divider_ops, clkctrl_name))
397426 kfree(div);
398427 }
399428
@@ -401,7 +430,7 @@ static void __init · 1 unmodified line
401430 _ti_clkctrl_setup_subclks(struct omap_clkctrl_provider *provider,
402431 struct device_node *node,
403432 const struct omap_clkctrl_reg_data *data,
404− void __iomem *reg)
433+ void __iomem *reg, const char *clkctrl_name)
405434 {
406435 const struct omap_clkctrl_bit_data *bits = data->bit_data;
407436
@@ -412,17 +441,17 @@ _ti_clkctrl_setup_subclks(struct omap_clkctrl_provider *provider, · 4 unmodified lines
412441 switch (bits->type) {
413442 case TI_CLK_GATE:
414443 _ti_clkctrl_setup_gate(provider, node, data->offset,
415− bits, reg);
444+ bits, reg, clkctrl_name);
416445 break;
417446
418447 case TI_CLK_DIVIDER:
419448 _ti_clkctrl_setup_div(provider, node, data->offset,
420− bits, reg);
449+ bits, reg, clkctrl_name);
421450 break;
422451
423452 case TI_CLK_MUX:
424453 _ti_clkctrl_setup_mux(provider, node, data->offset,
425− bits, reg);
454+ bits, reg, clkctrl_name);
426455 break;
427456
428457 default:
@@ -461,42 +490,10 @@ static char * __init clkctrl_get_name(struct device_node *np) · 32 unmodified lines
461490 return name;
462491 }
463492 }
464− of_node_put(np);
465493
466494 return NULL;
467495 }
468496
469−/* Get clkctrl clock base name based on clkctrl_name or dts node */
470−static const char * __init clkctrl_get_clock_name(struct device_node *np,
471− const char *clkctrl_name,
472− int offset, int index,
473− bool legacy_naming)
474−{
475− char *clock_name;
476−
477− /* l4per-clkctrl:1234:0 style naming based on clkctrl_name */
478− if (clkctrl_name && !legacy_naming) {
479− clock_name = kasprintf(GFP_KERNEL, "%s-clkctrl:%04x:%d",
480− clkctrl_name, offset, index);
481− strreplace(clock_name, '_', '-');
482−
483− return clock_name;
484− }
485−
486− /* l4per:1234:0 old style naming based on clkctrl_name */
487− if (clkctrl_name)
488− return kasprintf(GFP_KERNEL, "%s_cm:clk:%04x:%d",
489− clkctrl_name, offset, index);
490−
491− /* l4per_cm:1234:0 old style naming based on parent node name */
492− if (legacy_naming)
493− return kasprintf(GFP_KERNEL, "%pOFn:clk:%04x:%d",
494− np->parent, offset, index);
495−
496− /* l4per-clkctrl:1234:0 style naming based on node name */
497− return kasprintf(GFP_KERNEL, "%pOFn:%04x:%d", np, offset, index);
498−}
499−
500497 static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
501498 {
502499 struct omap_clkctrl_provider *provider;
@@ -664,7 +661,7 @@ clkdm_found: · 161 unmodified lines
664661 hw->enable_reg.ptr = provider->base + reg_data->offset;
665662
666663 _ti_clkctrl_setup_subclks(provider, node, reg_data,
667− hw->enable_reg.ptr);
664+ hw->enable_reg.ptr, clkctrl_name);
668665
669666 if (reg_data->flags & CLKF_SW_SUP)
670667 hw->enable_bit = MODULEMODE_SWCTRL;
drivers/clk/versatile/clk-impd1.c+1−0
@@ -206,6 +206,7 @@ static int integrator_impd1_clk_spawn(struct device *dev, · 205 unmodified lines
206206 return -ENODEV;
207207 }
208208
209+ of_property_read_string(np, "clock-output-names", &name);
209210 parent_name = of_clk_get_parent_name(np, 0);
210211 clk = icst_clk_setup(NULL, desc, name, parent_name, map,
211212 ICST_INTEGRATOR_IM_PD1);
drivers/dax/kmem.c+11−3
@@ -22,6 +22,7 @@ int dev_dax_kmem_probe(struct device *dev) · 21 unmodified lines
2222 resource_size_t kmem_size;
2323 resource_size_t kmem_end;
2424 struct resource *new_res;
25+ const char *new_res_name;
2526 int numa_node;
2627 int rc;
2728
@@ -48,11 +49,16 @@ int dev_dax_kmem_probe(struct device *dev) · 20 unmodified lines
4849 kmem_size &= ~(memory_block_size_bytes() - 1);
4950 kmem_end = kmem_start + kmem_size;
5051
51− /* Region is permanently reserved. Hot-remove not yet implemented. */
52− new_res = request_mem_region(kmem_start, kmem_size, dev_name(dev));
52+ new_res_name = kstrdup(dev_name(dev), GFP_KERNEL);
53+ if (!new_res_name)
54+ return -ENOMEM;
55+
56+ /* Region is permanently reserved if hotremove fails. */
57+ new_res = request_mem_region(kmem_start, kmem_size, new_res_name);
5358 if (!new_res) {
5459 dev_warn(dev, "could not reserve region [%pa-%pa]\n",
5560 &kmem_start, &kmem_end);
61+ kfree(new_res_name);
5662 return -EBUSY;
5763 }
5864
@@ -63,12 +69,12 @@ int dev_dax_kmem_probe(struct device *dev) · 4 unmodified lines
6369 * unknown to us that will break add_memory() below.
6470 */
6571 new_res->flags = IORESOURCE_SYSTEM_RAM;
66− new_res->name = dev_name(dev);
6772
6873 rc = add_memory(numa_node, new_res->start, resource_size(new_res));
6974 if (rc) {
7075 release_resource(new_res);
7176 kfree(new_res);
77+ kfree(new_res_name);
7278 return rc;
7379 }
7480 dev_dax->dax_kmem_res = new_res;
@@ -83,6 +89,7 @@ static int dev_dax_kmem_remove(struct device *dev) · 8 unmodified lines
8389 struct resource *res = dev_dax->dax_kmem_res;
8490 resource_size_t kmem_start = res->start;
8591 resource_size_t kmem_size = resource_size(res);
92+ const char *res_name = res->name;
8693 int rc;
8794
8895 /*
@@ -102,6 +109,7 @@ static int dev_dax_kmem_remove(struct device *dev) · 13 unmodified lines
102109 /* Release and free dax resources */
103110 release_resource(res);
104111 kfree(res);
112+ kfree(res_name);
105113 dev_dax->dax_kmem_res = NULL;
106114
107115 return 0;
drivers/dma/dmatest.c+5−4
@@ -1166,10 +1166,11 @@ static int dmatest_run_set(const char *val, const struct kernel_param *kp) · 1165 unmodified lines
11661166 mutex_unlock(&info->lock);
11671167 return ret;
11681168 } else if (dmatest_run) {
1169− if (is_threaded_test_pending(info))
1170− start_threaded_tests(info);
1171− else
1172− pr_info("Could not start test, no channels configured\n");
1169+ if (!is_threaded_test_pending(info)) {
1170+ pr_info("No channels configured, continue with any\n");
1171+ add_threaded_test(info);
1172+ }
1173+ start_threaded_tests(info);
11731174 } else {
11741175 stop_threaded_test(info);
11751176 }
drivers/dma/idxd/device.c+7−0
@@ -62,6 +62,13 @@ int idxd_unmask_msix_vector(struct idxd_device *idxd, int vec_id) · 61 unmodified lines
6262 perm.ignore = 0;
6363 iowrite32(perm.bits, idxd->reg_base + offset);
6464
65+ /*
66+ * A readback from the device ensures that any previously generated
67+ * completion record writes are visible to software based on PCI
68+ * ordering rules.
69+ */
70+ perm.bits = ioread32(idxd->reg_base + offset);
71+
6572 return 0;
6673 }
6774
drivers/dma/idxd/irq.c+19−7
@@ -173,6 +173,7 @@ static int irq_process_pending_llist(struct idxd_irq_entry *irq_entry, · 172 unmodified lines
173173 struct llist_node *head;
174174 int queued = 0;
175175
176+ *processed = 0;
176177 head = llist_del_all(&irq_entry->pending_llist);
177178 if (!head)
178179 return 0;
@@ -197,6 +198,7 @@ static int irq_process_work_list(struct idxd_irq_entry *irq_entry, · 18 unmodified lines
197198 struct list_head *node, *next;
198199 int queued = 0;
199200
201+ *processed = 0;
200202 if (list_empty(&irq_entry->work_list))
201203 return 0;
202204
@@ -218,10 +220,9 @@ static int irq_process_work_list(struct idxd_irq_entry *irq_entry, · 15 unmodified lines
218220 return queued;
219221 }
220222
221−irqreturn_t idxd_wq_thread(int irq, void *data)
223+static int idxd_desc_process(struct idxd_irq_entry *irq_entry)
222224 {
223− struct idxd_irq_entry *irq_entry = data;
224− int rc, processed = 0, retry = 0;
225+ int rc, processed, total = 0;
225226
226227 /*
227228 * There are two lists we are processing. The pending_llist is where
@@ -244,15 +245,26 @@ irqreturn_t idxd_wq_thread(int irq, void *data) · 16 unmodified lines
244245 */
245246 do {
246247 rc = irq_process_work_list(irq_entry, &processed);
247− if (rc != 0) {
248− retry++;
248+ total += processed;
249+ if (rc != 0)
249250 continue;
250− }
251251
252252 rc = irq_process_pending_llist(irq_entry, &processed);
253− } while (rc != 0 && retry != 10);
253+ total += processed;
254+ } while (rc != 0);
255+
256+ return total;
257+}
258+
259+irqreturn_t idxd_wq_thread(int irq, void *data)
260+{
261+ struct idxd_irq_entry *irq_entry = data;
262+ int processed;
254263
264+ processed = idxd_desc_process(irq_entry);
255265 idxd_unmask_msix_vector(irq_entry->idxd, irq_entry->id);
266+ /* catch anything unprocessed after unmasking */
267+ processed += idxd_desc_process(irq_entry);
256268
257269 if (processed == 0)
258270 return IRQ_NONE;
drivers/dma/owl-dma.c+3−5
@@ -175,13 +175,11 @@ struct owl_dma_txd { · 174 unmodified lines
175175 * @id: physical index to this channel
176176 * @base: virtual memory base for the dma channel
177177 * @vchan: the virtual channel currently being served by this physical channel
178− * @lock: a lock to use when altering an instance of this struct
179178 */
180179 struct owl_dma_pchan {
181180 u32 id;
182181 void __iomem *base;
183182 struct owl_dma_vchan *vchan;
184− spinlock_t lock;
185183 };
186184
187185 /**
@@ -437,14 +435,14 @@ static struct owl_dma_pchan *owl_dma_get_pchan(struct owl_dma *od, · 249 unmodified lines
437435 for (i = 0; i < od->nr_pchans; i++) {
438436 pchan = &od->pchans[i];
439437
440− spin_lock_irqsave(&pchan->lock, flags);
438+ spin_lock_irqsave(&od->lock, flags);
441439 if (!pchan->vchan) {
442440 pchan->vchan = vchan;
443− spin_unlock_irqrestore(&pchan->lock, flags);
441+ spin_unlock_irqrestore(&od->lock, flags);
444442 break;
445443 }
446444
447− spin_unlock_irqrestore(&pchan->lock, flags);
445+ spin_unlock_irqrestore(&od->lock, flags);
448446 }
449447
450448 return pchan;
drivers/dma/tegra210-adma.c+1−1
@@ -900,7 +900,7 @@ static int tegra_adma_probe(struct platform_device *pdev) · 899 unmodified lines
900900 ret = dma_async_device_register(&tdma->dma_dev);
901901 if (ret < 0) {
902902 dev_err(&pdev->dev, "ADMA registration failed: %d\n", ret);
903− goto irq_dispose;
903+ goto rpm_put;
904904 }
905905
906906 ret = of_dma_controller_register(pdev->dev.of_node,
drivers/dma/ti/k3-udma.c+4−2
@@ -2156,7 +2156,8 @@ udma_prep_slave_sg_tr(struct udma_chan *uc, struct scatterlist *sgl, · 2155 unmodified lines
21562156 d->residue += sg_dma_len(sgent);
21572157 }
21582158
2159− cppi5_tr_csf_set(&tr_req[tr_idx - 1].flags, CPPI5_TR_CSF_EOP);
2159+ cppi5_tr_csf_set(&tr_req[tr_idx - 1].flags,
2160+ CPPI5_TR_CSF_SUPR_EVT | CPPI5_TR_CSF_EOP);
21602161
21612162 return d;
21622163 }
@@ -2733,7 +2734,8 @@ udma_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src, · 570 unmodified lines
27332734 tr_req[1].dicnt3 = 1;
27342735 }
27352736
2736− cppi5_tr_csf_set(&tr_req[num_tr - 1].flags, CPPI5_TR_CSF_EOP);
2737+ cppi5_tr_csf_set(&tr_req[num_tr - 1].flags,
2738+ CPPI5_TR_CSF_SUPR_EVT | CPPI5_TR_CSF_EOP);
27372739
27382740 if (uc->config.metadata_size)
27392741 d->vd.tx.metadata_ops = &metadata_ops;
drivers/dma/xilinx/zynqmp_dma.c+1−2
@@ -434,6 +434,7 @@ static void zynqmp_dma_free_descriptor(struct zynqmp_dma_chan *chan, · 433 unmodified lines
434434 struct zynqmp_dma_desc_sw *child, *next;
435435
436436 chan->desc_free_cnt++;
437+ list_del(&sdesc->node);
437438 list_add_tail(&sdesc->node, &chan->free_list);
438439 list_for_each_entry_safe(child, next, &sdesc->tx_list, node) {
439440 chan->desc_free_cnt++;
@@ -608,8 +609,6 @@ static void zynqmp_dma_chan_desc_cleanup(struct zynqmp_dma_chan *chan) · 168 unmodified lines
608609 dma_async_tx_callback callback;
609610 void *callback_param;
610611
611− list_del(&desc->node);
612−
613612 callback = desc->async_tx.callback;
614613 callback_param = desc->async_tx.callback_param;
615614 if (callback) {
drivers/firmware/efi/cper.c+62−0
@@ -407,6 +407,58 @@ static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie, · 406 unmodified lines
407407 }
408408 }
409409
410+static const char * const fw_err_rec_type_strs[] = {
411+ "IPF SAL Error Record",
412+ "SOC Firmware Error Record Type1 (Legacy CrashLog Support)",
413+ "SOC Firmware Error Record Type2",
414+};
415+
416+static void cper_print_fw_err(const char *pfx,
417+ struct acpi_hest_generic_data *gdata,
418+ const struct cper_sec_fw_err_rec_ref *fw_err)
419+{
420+ void *buf = acpi_hest_get_payload(gdata);
421+ u32 offset, length = gdata->error_data_length;
422+
423+ printk("%s""Firmware Error Record Type: %s\n", pfx,
424+ fw_err->record_type < ARRAY_SIZE(fw_err_rec_type_strs) ?
425+ fw_err_rec_type_strs[fw_err->record_type] : "unknown");
426+ printk("%s""Revision: %d\n", pfx, fw_err->revision);
427+
428+ /* Record Type based on UEFI 2.7 */
429+ if (fw_err->revision == 0) {
430+ printk("%s""Record Identifier: %08llx\n", pfx,
431+ fw_err->record_identifier);
432+ } else if (fw_err->revision == 2) {
433+ printk("%s""Record Identifier: %pUl\n", pfx,
434+ &fw_err->record_identifier_guid);
435+ }
436+
437+ /*
438+ * The FW error record may contain trailing data beyond the
439+ * structure defined by the specification. As the fields
440+ * defined (and hence the offset of any trailing data) vary
441+ * with the revision, set the offset to account for this
442+ * variation.
443+ */
444+ if (fw_err->revision == 0) {
445+ /* record_identifier_guid not defined */
446+ offset = offsetof(struct cper_sec_fw_err_rec_ref,
447+ record_identifier_guid);
448+ } else if (fw_err->revision == 1) {
449+ /* record_identifier not defined */
450+ offset = offsetof(struct cper_sec_fw_err_rec_ref,
451+ record_identifier);
452+ } else {
453+ offset = sizeof(*fw_err);
454+ }
455+
456+ buf += offset;
457+ length -= offset;
458+
459+ print_hex_dump(pfx, "", DUMP_PREFIX_OFFSET, 16, 4, buf, length, true);
460+}
461+
410462 static void cper_print_tstamp(const char *pfx,
411463 struct acpi_hest_generic_data_v300 *gdata)
412464 {
@@ -494,6 +546,16 @@ cper_estatus_print_section(const char *pfx, struct acpi_hest_generic_data *gdata · 81 unmodified lines
494546 else
495547 goto err_section_too_small;
496548 #endif
549+ } else if (guid_equal(sec_type, &CPER_SEC_FW_ERR_REC_REF)) {
550+ struct cper_sec_fw_err_rec_ref *fw_err = acpi_hest_get_payload(gdata);
551+
552+ printk("%ssection_type: Firmware Error Record Reference\n",
553+ newpfx);
554+ /* The minimal FW Error Record contains 16 bytes */
555+ if (gdata->error_data_length >= SZ_16)
556+ cper_print_fw_err(newpfx, gdata, fw_err);
557+ else
558+ goto err_section_too_small;
497559 } else {
498560 const void *err = acpi_hest_get_payload(gdata);
499561
drivers/firmware/efi/earlycon.c+8−6
@@ -114,14 +114,16 @@ static void efi_earlycon_write_char(u32 *dst, unsigned char c, unsigned int h) · 113 unmodified lines
114114 const u32 color_black = 0x00000000;
115115 const u32 color_white = 0x00ffffff;
116116 const u8 *src;
117− u8 s8;
118− int m;
117+ int m, n, bytes;
118+ u8 x;
119119
120− src = font->data + c * font->height;
121− s8 = *(src + h);
120+ bytes = BITS_TO_BYTES(font->width);
121+ src = font->data + c * font->height * bytes + h * bytes;
122122
123− for (m = 0; m < 8; m++) {
124− if ((s8 >> (7 - m)) & 1)
123+ for (m = 0; m < font->width; m++) {
124+ n = m % 8;
125+ x = *(src + m / 8);
126+ if ((x >> (7 - n)) & 1)
125127 *dst = color_white;
126128 else
127129 *dst = color_black;
drivers/firmware/efi/efi.c+1−4
@@ -130,11 +130,8 @@ static ssize_t systab_show(struct kobject *kobj, · 129 unmodified lines
130130 if (efi.smbios != EFI_INVALID_TABLE_ADDR)
131131 str += sprintf(str, "SMBIOS=0x%lx\n", efi.smbios);
132132
133− if (IS_ENABLED(CONFIG_IA64) || IS_ENABLED(CONFIG_X86)) {
134− extern char *efi_systab_show_arch(char *str);
135−
133+ if (IS_ENABLED(CONFIG_IA64) || IS_ENABLED(CONFIG_X86))
136134 str = efi_systab_show_arch(str);
137− }
138135
139136 return str - buf;
140137 }
drivers/firmware/efi/libstub/arm-stub.c+5−1
@@ -60,7 +60,11 @@ static struct screen_info *setup_graphics(void) · 59 unmodified lines
6060 si = alloc_screen_info();
6161 if (!si)
6262 return NULL;
63− efi_setup_gop(si, &gop_proto, size);
63+ status = efi_setup_gop(si, &gop_proto, size);
64+ if (status != EFI_SUCCESS) {
65+ free_screen_info(si);
66+ return NULL;
67+ }
6468 }
6569 return si;
6670 }
drivers/firmware/efi/libstub/efistub.h+13−0
@@ -92,6 +92,19 @@ extern __pure efi_system_table_t *efi_system_table(void); · 91 unmodified lines
9292 #define EFI_LOCATE_BY_REGISTER_NOTIFY 1
9393 #define EFI_LOCATE_BY_PROTOCOL 2
9494
95+/*
96+ * An efi_boot_memmap is used by efi_get_memory_map() to return the
97+ * EFI memory map in a dynamically allocated buffer.
98+ *
99+ * The buffer allocated for the EFI memory map includes extra room for
100+ * a minimum of EFI_MMAP_NR_SLACK_SLOTS additional EFI memory descriptors.
101+ * This facilitates the reuse of the EFI memory map buffer when a second
102+ * call to ExitBootServices() is needed because of intervening changes to
103+ * the EFI memory map. Other related structures, e.g. x86 e820ext, need
104+ * to factor in this headroom requirement as well.
105+ */
106+#define EFI_MMAP_NR_SLACK_SLOTS 8
107+
95108 struct efi_boot_memmap {
96109 efi_memory_desc_t **map;
97110 unsigned long *map_size;
drivers/firmware/efi/libstub/mem.c+0−2
@@ -5,8 +5,6 @@ · 4 unmodified lines
55
66 #include "efistub.h"
77
8−#define EFI_MMAP_NR_SLACK_SLOTS 8
9−
108 static inline bool mmap_has_headroom(unsigned long buff_size,
119 unsigned long map_size,
1210 unsigned long desc_size)
drivers/firmware/efi/libstub/tpm.c+3−2
@@ -54,7 +54,7 @@ void efi_retrieve_tpm2_eventlog(void) · 53 unmodified lines
5454 efi_status_t status;
5555 efi_physical_addr_t log_location = 0, log_last_entry = 0;
5656 struct linux_efi_tpm_eventlog *log_tbl = NULL;
57− struct efi_tcg2_final_events_table *final_events_table;
57+ struct efi_tcg2_final_events_table *final_events_table = NULL;
5858 unsigned long first_entry_addr, last_entry_addr;
5959 size_t log_size, last_entry_size;
6060 efi_bool_t truncated;
@@ -127,7 +127,8 @@ void efi_retrieve_tpm2_eventlog(void) · 66 unmodified lines
127127 * Figure out whether any events have already been logged to the
128128 * final events structure, and if so how much space they take up
129129 */
130− final_events_table = get_efi_config_table(LINUX_EFI_TPM_FINAL_LOG_GUID);
130+ if (version == EFI_TCG2_EVENT_LOG_FORMAT_TCG_2)
131+ final_events_table = get_efi_config_table(LINUX_EFI_TPM_FINAL_LOG_GUID);
131132 if (final_events_table && final_events_table->nr_events) {
132133 struct tcg_pcr_event2_head *header;
133134 int offset;
drivers/firmware/efi/libstub/x86-stub.c+9−15
@@ -606,24 +606,18 @@ static efi_status_t allocate_e820(struct boot_params *params, · 605 unmodified lines
606606 struct setup_data **e820ext,
607607 u32 *e820ext_size)
608608 {
609− unsigned long map_size, desc_size, buff_size;
610− struct efi_boot_memmap boot_map;
611− efi_memory_desc_t *map;
609+ unsigned long map_size, desc_size, map_key;
612610 efi_status_t status;
613− __u32 nr_desc;
611+ __u32 nr_desc, desc_version;
614612
615− boot_map.map = &map;
616− boot_map.map_size = &map_size;
617− boot_map.desc_size = &desc_size;
618− boot_map.desc_ver = NULL;
619− boot_map.key_ptr = NULL;
620− boot_map.buff_size = &buff_size;
613+ /* Only need the size of the mem map and size of each mem descriptor */
614+ map_size = 0;
615+ status = efi_bs_call(get_memory_map, &map_size, NULL, &map_key,
616+ &desc_size, &desc_version);
617+ if (status != EFI_BUFFER_TOO_SMALL)
618+ return (status != EFI_SUCCESS) ? status : EFI_UNSUPPORTED;
621619
622− status = efi_get_memory_map(&boot_map);
623− if (status != EFI_SUCCESS)
624− return status;
625−
626− nr_desc = buff_size / desc_size;
620+ nr_desc = map_size / desc_size + EFI_MMAP_NR_SLACK_SLOTS;
627621
628622 if (nr_desc > ARRAY_SIZE(params->e820_table)) {
629623 u32 nr_e820ext = nr_desc - ARRAY_SIZE(params->e820_table);
drivers/firmware/efi/tpm.c+4−1
@@ -62,8 +62,11 @@ int __init efi_tpm_eventlog_init(void) · 61 unmodified lines
6262 tbl_size = sizeof(*log_tbl) + log_tbl->size;
6363 memblock_reserve(efi.tpm_log, tbl_size);
6464
65− if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR)
65+ if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR ||
66+ log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
67+ pr_warn(FW_BUG "TPM Final Events table missing or invalid\n");
6668 goto out;
69+ }
6770
6871 final_tbl = early_memremap(efi.tpm_final_log, sizeof(*final_tbl));
6972
drivers/gpio/gpio-pca953x.c+1−1
@@ -531,7 +531,7 @@ static int pca953x_gpio_set_config(struct gpio_chip *gc, unsigned int offset, · 530 unmodified lines
531531 {
532532 struct pca953x_chip *chip = gpiochip_get_data(gc);
533533
534− switch (config) {
534+ switch (pinconf_to_config_param(config)) {
535535 case PIN_CONFIG_BIAS_PULL_UP:
536536 case PIN_CONFIG_BIAS_PULL_DOWN:
537537 return pca953x_gpio_set_pull_up_down(chip, offset, config);
drivers/gpio/gpio-tegra.c+1−0
@@ -368,6 +368,7 @@ static void tegra_gpio_irq_shutdown(struct irq_data *d) · 367 unmodified lines
368368 struct tegra_gpio_info *tgi = bank->tgi;
369369 unsigned int gpio = d->hwirq;
370370
371+ tegra_gpio_irq_mask(d);
371372 gpiochip_unlock_as_irq(&tgi->gc, gpio);
372373 }
373374
drivers/gpio/gpiolib.c+29−5
@@ -1158,8 +1158,19 @@ static void gpio_desc_to_lineinfo(struct gpio_desc *desc, · 1157 unmodified lines
11581158 struct gpioline_info *info)
11591159 {
11601160 struct gpio_chip *gc = desc->gdev->chip;
1161+ bool ok_for_pinctrl;
11611162 unsigned long flags;
11621163
1164+ /*
1165+ * This function takes a mutex so we must check this before taking
1166+ * the spinlock.
1167+ *
1168+ * FIXME: find a non-racy way to retrieve this information. Maybe a
1169+ * lock common to both frameworks?
1170+ */
1171+ ok_for_pinctrl =
1172+ pinctrl_gpio_can_use_line(gc->base + info->line_offset);
1173+
11631174 spin_lock_irqsave(&gpio_lock, flags);
11641175
11651176 if (desc->name) {
@@ -1186,7 +1197,7 @@ static void gpio_desc_to_lineinfo(struct gpio_desc *desc, · 20 unmodified lines
11861197 test_bit(FLAG_USED_AS_IRQ, &desc->flags) ||
11871198 test_bit(FLAG_EXPORT, &desc->flags) ||
11881199 test_bit(FLAG_SYSFS, &desc->flags) ||
1189− !pinctrl_gpio_can_use_line(gc->base + info->line_offset))
1200+ !ok_for_pinctrl)
11901201 info->flags |= GPIOLINE_FLAG_KERNEL;
11911202 if (test_bit(FLAG_IS_OUT, &desc->flags))
11921203 info->flags |= GPIOLINE_FLAG_IS_OUT;
@@ -1227,6 +1238,7 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) · 34 unmodified lines
12271238 void __user *ip = (void __user *)arg;
12281239 struct gpio_desc *desc;
12291240 __u32 offset;
1241+ int hwgpio;
12301242
12311243 /* We fail any subsequent ioctl():s when the chip is gone */
12321244 if (!gc)
@@ -1259,13 +1271,19 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) · 26 unmodified lines
12591271 if (IS_ERR(desc))
12601272 return PTR_ERR(desc);
12611273
1274+ hwgpio = gpio_chip_hwgpio(desc);
1275+
1276+ if (cmd == GPIO_GET_LINEINFO_WATCH_IOCTL &&
1277+ test_bit(hwgpio, priv->watched_lines))
1278+ return -EBUSY;
1279+
12621280 gpio_desc_to_lineinfo(desc, &lineinfo);
12631281
12641282 if (copy_to_user(ip, &lineinfo, sizeof(lineinfo)))
12651283 return -EFAULT;
12661284
12671285 if (cmd == GPIO_GET_LINEINFO_WATCH_IOCTL)
1268− set_bit(gpio_chip_hwgpio(desc), priv->watched_lines);
1286+ set_bit(hwgpio, priv->watched_lines);
12691287
12701288 return 0;
12711289 } else if (cmd == GPIO_GET_LINEHANDLE_IOCTL) {
@@ -1280,7 +1298,12 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) · 8 unmodified lines
12801298 if (IS_ERR(desc))
12811299 return PTR_ERR(desc);
12821300
1283− clear_bit(gpio_chip_hwgpio(desc), priv->watched_lines);
1301+ hwgpio = gpio_chip_hwgpio(desc);
1302+
1303+ if (!test_bit(hwgpio, priv->watched_lines))
1304+ return -EBUSY;
1305+
1306+ clear_bit(hwgpio, priv->watched_lines);
12841307 return 0;
12851308 }
12861309 return -EINVAL;
@@ -5289,8 +5312,9 @@ static int __init gpiolib_dev_init(void) · 4002 unmodified lines
52895312 gpiolib_initialized = true;
52905313 gpiochip_setup_devs();
52915314
5292− if (IS_ENABLED(CONFIG_OF_DYNAMIC))
5293− WARN_ON(of_reconfig_notifier_register(&gpio_of_notifier));
5315+#if IS_ENABLED(CONFIG_OF_DYNAMIC) && IS_ENABLED(CONFIG_OF_GPIO)
5316+ WARN_ON(of_reconfig_notifier_register(&gpio_of_notifier));
5317+#endif /* CONFIG_OF_DYNAMIC && CONFIG_OF_GPIO */
52945318
52955319 return ret;
52965320 }
drivers/gpu/drm/amd/amdgpu/amdgpu.h+1−0
@@ -945,6 +945,7 @@ struct amdgpu_device { · 944 unmodified lines
945945
946946 /* s3/s4 mask */
947947 bool in_suspend;
948+ bool in_hibernate;
948949
949950 /* record last mm index being written through WREG32*/
950951 unsigned long last_mm_index;
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c+3−2
@@ -1343,7 +1343,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu( · 1342 unmodified lines
13431343 }
13441344
13451345 /* Free the BO*/
1346− amdgpu_bo_unref(&mem->bo);
1346+ drm_gem_object_put_unlocked(&mem->bo->tbo.base);
13471347 mutex_destroy(&mem->lock);
13481348 kfree(mem);
13491349
@@ -1688,7 +1688,8 @@ int amdgpu_amdkfd_gpuvm_import_dmabuf(struct kgd_dev *kgd, · 338 unmodified lines
16881688 | KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE
16891689 | KFD_IOC_ALLOC_MEM_FLAGS_EXECUTABLE;
16901690
1691− (*mem)->bo = amdgpu_bo_ref(bo);
1691+ drm_gem_object_get(&bo->tbo.base);
1692+ (*mem)->bo = bo;
16921693 (*mem)->va = va;
16931694 (*mem)->domain = (bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM) ?
16941695 AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+2−0
@@ -1181,7 +1181,9 @@ static int amdgpu_pmops_freeze(struct device *dev) · 1180 unmodified lines
11811181 struct amdgpu_device *adev = drm_dev->dev_private;
11821182 int r;
11831183
1184+ adev->in_hibernate = true;
11841185 r = amdgpu_device_suspend(drm_dev, true);
1186+ adev->in_hibernate = false;
11851187 if (r)
11861188 return r;
11871189 return amdgpu_asic_reset(adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c+1−2
@@ -133,8 +133,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev, · 132 unmodified lines
133133 u32 cpp;
134134 u64 flags = AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
135135 AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |
136− AMDGPU_GEM_CREATE_VRAM_CLEARED |
137− AMDGPU_GEM_CREATE_CPU_GTT_USWC;
136+ AMDGPU_GEM_CREATE_VRAM_CLEARED;
138137
139138 info = drm_get_format_info(adev->ddev, mode_cmd);
140139 cpp = info->cpp[0];
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c+16−6
@@ -4273,7 +4273,7 @@ static int gfx_v10_0_update_gfx_clock_gating(struct amdgpu_device *adev, · 4272 unmodified lines
42734273 /* === CGCG /CGLS for GFX 3D Only === */
42744274 gfx_v10_0_update_3d_clock_gating(adev, enable);
42754275 /* === MGCG + MGLS === */
4276− /* gfx_v10_0_update_medium_grain_clock_gating(adev, enable); */
4276+ gfx_v10_0_update_medium_grain_clock_gating(adev, enable);
42774277 }
42784278
42794279 if (adev->cg_flags &
@@ -4353,11 +4353,7 @@ static int gfx_v10_0_set_powergating_state(void *handle, · 73 unmodified lines
43534353 switch (adev->asic_type) {
43544354 case CHIP_NAVI10:
43554355 case CHIP_NAVI14:
4356− if (!enable) {
4357− amdgpu_gfx_off_ctrl(adev, false);
4358− cancel_delayed_work_sync(&adev->gfx.gfx_off_delay_work);
4359− } else
4360− amdgpu_gfx_off_ctrl(adev, true);
4356+ amdgpu_gfx_off_ctrl(adev, enable);
43614357 break;
43624358 default:
43634359 break;
@@ -4918,6 +4914,19 @@ static void gfx_v10_0_ring_emit_reg_write_reg_wait(struct amdgpu_ring *ring, · 554 unmodified lines
49184914 ref, mask);
49194915 }
49204916
4917+static void gfx_v10_0_ring_soft_recovery(struct amdgpu_ring *ring,
4918+ unsigned vmid)
4919+{
4920+ struct amdgpu_device *adev = ring->adev;
4921+ uint32_t value = 0;
4922+
4923+ value = REG_SET_FIELD(value, SQ_CMD, CMD, 0x03);
4924+ value = REG_SET_FIELD(value, SQ_CMD, MODE, 0x01);
4925+ value = REG_SET_FIELD(value, SQ_CMD, CHECK_VMID, 1);
4926+ value = REG_SET_FIELD(value, SQ_CMD, VM_ID, vmid);
4927+ WREG32_SOC15(GC, 0, mmSQ_CMD, value);
4928+}
4929+
49214930 static void
49224931 gfx_v10_0_set_gfx_eop_interrupt_state(struct amdgpu_device *adev,
49234932 uint32_t me, uint32_t pipe,
@@ -5309,6 +5318,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = { · 385 unmodified lines
53095318 .emit_wreg = gfx_v10_0_ring_emit_wreg,
53105319 .emit_reg_wait = gfx_v10_0_ring_emit_reg_wait,
53115320 .emit_reg_write_reg_wait = gfx_v10_0_ring_emit_reg_write_reg_wait,
5321+ .soft_recovery = gfx_v10_0_ring_soft_recovery,
53125322 };
53135323
53145324 static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = {
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c+5−9
@@ -1236,6 +1236,8 @@ static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = { · 1235 unmodified lines
12361236 { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 },
12371237 /* https://bugzilla.kernel.org/show_bug.cgi?id=207171 */
12381238 { 0x1002, 0x15dd, 0x103c, 0x83e7, 0xd3 },
1239+ /* GFXOFF is unstable on C6 parts with a VBIOS 113-RAVEN-114 */
1240+ { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc6 },
12391241 { 0, 0, 0, 0, 0 },
12401242 };
12411243
@@ -5025,10 +5027,9 @@ static int gfx_v9_0_set_powergating_state(void *handle, · 3783 unmodified lines
50255027 switch (adev->asic_type) {
50265028 case CHIP_RAVEN:
50275029 case CHIP_RENOIR:
5028− if (!enable) {
5030+ if (!enable)
50295031 amdgpu_gfx_off_ctrl(adev, false);
5030− cancel_delayed_work_sync(&adev->gfx.gfx_off_delay_work);
5031− }
5032+
50325033 if (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS) {
50335034 gfx_v9_0_enable_sck_slow_down_on_power_up(adev, true);
50345035 gfx_v9_0_enable_sck_slow_down_on_power_down(adev, true);
@@ -5052,12 +5053,7 @@ static int gfx_v9_0_set_powergating_state(void *handle, · 17 unmodified lines
50525053 amdgpu_gfx_off_ctrl(adev, true);
50535054 break;
50545055 case CHIP_VEGA12:
5055− if (!enable) {
5056− amdgpu_gfx_off_ctrl(adev, false);
5057− cancel_delayed_work_sync(&adev->gfx.gfx_off_delay_work);
5058− } else {
5059− amdgpu_gfx_off_ctrl(adev, true);
5060− }
5056+ amdgpu_gfx_off_ctrl(adev, enable);
50615057 break;
50625058 default:
50635059 break;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+79−84
@@ -441,7 +441,7 @@ static void dm_vupdate_high_irq(void *interrupt_params) · 440 unmodified lines
441441
442442 /**
443443 * dm_crtc_high_irq() - Handles CRTC interrupt
444− * @interrupt_params: ignored
444+ * @interrupt_params: used for determining the CRTC instance
445445 *
446446 * Handles the CRTC/VSYNC interrupt by notfying DRM's VBLANK
447447 * event handler.
@@ -455,70 +455,6 @@ static void dm_crtc_high_irq(void *interrupt_params) · 7 unmodified lines
455455 unsigned long flags;
456456
457457 acrtc = get_crtc_by_otg_inst(adev, irq_params->irq_src - IRQ_TYPE_VBLANK);
458−
459− if (acrtc) {
460− acrtc_state = to_dm_crtc_state(acrtc->base.state);
461−
462− DRM_DEBUG_VBL("crtc:%d, vupdate-vrr:%d\n",
463− acrtc->crtc_id,
464− amdgpu_dm_vrr_active(acrtc_state));
465−
466− /* Core vblank handling at start of front-porch is only possible
467− * in non-vrr mode, as only there vblank timestamping will give
468− * valid results while done in front-porch. Otherwise defer it
469− * to dm_vupdate_high_irq after end of front-porch.
470− */
471− if (!amdgpu_dm_vrr_active(acrtc_state))
472− drm_crtc_handle_vblank(&acrtc->base);
473−
474− /* Following stuff must happen at start of vblank, for crc
475− * computation and below-the-range btr support in vrr mode.
476− */
477− amdgpu_dm_crtc_handle_crc_irq(&acrtc->base);
478−
479− if (acrtc_state->stream && adev->family >= AMDGPU_FAMILY_AI &&
480− acrtc_state->vrr_params.supported &&
481− acrtc_state->freesync_config.state == VRR_STATE_ACTIVE_VARIABLE) {
482− spin_lock_irqsave(&adev->ddev->event_lock, flags);
483− mod_freesync_handle_v_update(
484− adev->dm.freesync_module,
485− acrtc_state->stream,
486− &acrtc_state->vrr_params);
487−
488− dc_stream_adjust_vmin_vmax(
489− adev->dm.dc,
490− acrtc_state->stream,
491− &acrtc_state->vrr_params.adjust);
492− spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
493− }
494− }
495−}
496−
497−#if defined(CONFIG_DRM_AMD_DC_DCN)
498−/**
499− * dm_dcn_crtc_high_irq() - Handles VStartup interrupt for DCN generation ASICs
500− * @interrupt params - interrupt parameters
501− *
502− * Notify DRM's vblank event handler at VSTARTUP
503− *
504− * Unlike DCE hardware, we trigger the handler at VSTARTUP. at which:
505− * * We are close enough to VUPDATE - the point of no return for hw
506− * * We are in the fixed portion of variable front porch when vrr is enabled
507− * * We are before VUPDATE, where double-buffered vrr registers are swapped
508− *
509− * It is therefore the correct place to signal vblank, send user flip events,
510− * and update VRR.
511− */
512−static void dm_dcn_crtc_high_irq(void *interrupt_params)
513−{
514− struct common_irq_params *irq_params = interrupt_params;
515− struct amdgpu_device *adev = irq_params->adev;
516− struct amdgpu_crtc *acrtc;
517− struct dm_crtc_state *acrtc_state;
518− unsigned long flags;
519−
520− acrtc = get_crtc_by_otg_inst(adev, irq_params->irq_src - IRQ_TYPE_VBLANK);
521−
522458 if (!acrtc)
523459 return;
524460
@@ -528,22 +464,35 @@ static void dm_dcn_crtc_high_irq(void *interrupt_params) · 3 unmodified lines
528464 amdgpu_dm_vrr_active(acrtc_state),
529465 acrtc_state->active_planes);
530466
467+ /**
468+ * Core vblank handling at start of front-porch is only possible
469+ * in non-vrr mode, as only there vblank timestamping will give
470+ * valid results while done in front-porch. Otherwise defer it
471+ * to dm_vupdate_high_irq after end of front-porch.
472+ */
473+ if (!amdgpu_dm_vrr_active(acrtc_state))
474+ drm_crtc_handle_vblank(&acrtc->base);
475+
476+ /**
477+ * Following stuff must happen at start of vblank, for crc
478+ * computation and below-the-range btr support in vrr mode.
479+ */
531480 amdgpu_dm_crtc_handle_crc_irq(&acrtc->base);
532− drm_crtc_handle_vblank(&acrtc->base);
481+
482+ /* BTR updates need to happen before VUPDATE on Vega and above. */
483+ if (adev->family < AMDGPU_FAMILY_AI)
484+ return;
533485
534486 spin_lock_irqsave(&adev->ddev->event_lock, flags);
535487
536− if (acrtc_state->vrr_params.supported &&
488+ if (acrtc_state->stream && acrtc_state->vrr_params.supported &&
537489 acrtc_state->freesync_config.state == VRR_STATE_ACTIVE_VARIABLE) {
538− mod_freesync_handle_v_update(
539− adev->dm.freesync_module,
540− acrtc_state->stream,
541− &acrtc_state->vrr_params);
490+ mod_freesync_handle_v_update(adev->dm.freesync_module,
491+ acrtc_state->stream,
492+ &acrtc_state->vrr_params);
542493
543− dc_stream_adjust_vmin_vmax(
544− adev->dm.dc,
545− acrtc_state->stream,
546− &acrtc_state->vrr_params.adjust);
494+ dc_stream_adjust_vmin_vmax(adev->dm.dc, acrtc_state->stream,
495+ &acrtc_state->vrr_params.adjust);
547496 }
548497
549498 /*
@@ -556,7 +505,8 @@ static void dm_dcn_crtc_high_irq(void *interrupt_params) · 6 unmodified lines
556505 * avoid race conditions between flip programming and completion,
557506 * which could cause too early flip completion events.
558507 */
559− if (acrtc->pflip_status == AMDGPU_FLIP_SUBMITTED &&
508+ if (adev->family >= AMDGPU_FAMILY_RV &&
509+ acrtc->pflip_status == AMDGPU_FLIP_SUBMITTED &&
560510 acrtc_state->active_planes == 0) {
561511 if (acrtc->event) {
562512 drm_crtc_send_vblank_event(&acrtc->base, acrtc->event);
@@ -568,7 +518,6 @@ static void dm_dcn_crtc_high_irq(void *interrupt_params) · 5 unmodified lines
568518
569519 spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
570520 }
571−#endif
572521
573522 static int dm_set_clockgating_state(void *handle,
574523 enum amd_clockgating_state state)
@@ -2445,8 +2394,36 @@ static int dcn10_register_irq_handlers(struct amdgpu_device *adev) · 1870 unmodified lines
24452394 c_irq_params->adev = adev;
24462395 c_irq_params->irq_src = int_params.irq_source;
24472396
2397+ amdgpu_dm_irq_register_interrupt(
2398+ adev, &int_params, dm_crtc_high_irq, c_irq_params);
2399+ }
2400+
2401+ /* Use VUPDATE_NO_LOCK interrupt on DCN, which seems to correspond to
2402+ * the regular VUPDATE interrupt on DCE. We want DC_IRQ_SOURCE_VUPDATEx
2403+ * to trigger at end of each vblank, regardless of state of the lock,
2404+ * matching DCE behaviour.
2405+ */
2406+ for (i = DCN_1_0__SRCID__OTG0_IHC_V_UPDATE_NO_LOCK_INTERRUPT;
2407+ i <= DCN_1_0__SRCID__OTG0_IHC_V_UPDATE_NO_LOCK_INTERRUPT + adev->mode_info.num_crtc - 1;
2408+ i++) {
2409+ r = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_DCE, i, &adev->vupdate_irq);
2410+
2411+ if (r) {
2412+ DRM_ERROR("Failed to add vupdate irq id!\n");
2413+ return r;
2414+ }
2415+
2416+ int_params.int_context = INTERRUPT_HIGH_IRQ_CONTEXT;
2417+ int_params.irq_source =
2418+ dc_interrupt_to_irq_source(dc, i, 0);
2419+
2420+ c_irq_params = &adev->dm.vupdate_params[int_params.irq_source - DC_IRQ_SOURCE_VUPDATE1];
2421+
2422+ c_irq_params->adev = adev;
2423+ c_irq_params->irq_src = int_params.irq_source;
2424+
24482425 amdgpu_dm_irq_register_interrupt(adev, &int_params,
2449− dm_dcn_crtc_high_irq, c_irq_params);
2426+ dm_vupdate_high_irq, c_irq_params);
24502427 }
24512428
24522429 /* Use GRPH_PFLIP interrupt */
@@ -4453,10 +4430,6 @@ static inline int dm_set_vupdate_irq(struct drm_crtc *crtc, bool enable) · 2000 unmodified lines
44534430 struct amdgpu_device *adev = crtc->dev->dev_private;
44544431 int rc;
44554432
4456− /* Do not set vupdate for DCN hardware */
4457− if (adev->family > AMDGPU_FAMILY_AI)
4458− return 0;
4459−
44604433 irq_source = IRQ_TYPE_VUPDATE + acrtc->otg_inst;
44614434
44624435 rc = dc_interrupt_set(adev->dm.dc, irq_source, enable) ? 0 : -EBUSY;
@@ -7882,6 +7855,7 @@ static int dm_update_plane_state(struct dc *dc, · 3419 unmodified lines
78827855 struct drm_crtc_state *old_crtc_state, *new_crtc_state;
78837856 struct dm_crtc_state *dm_new_crtc_state, *dm_old_crtc_state;
78847857 struct dm_plane_state *dm_new_plane_state, *dm_old_plane_state;
7858+ struct amdgpu_crtc *new_acrtc;
78857859 bool needs_reset;
78867860 int ret = 0;
78877861
@@ -7891,9 +7865,30 @@ static int dm_update_plane_state(struct dc *dc, · 3 unmodified lines
78917865 dm_new_plane_state = to_dm_plane_state(new_plane_state);
78927866 dm_old_plane_state = to_dm_plane_state(old_plane_state);
78937867
7894− /*TODO Implement atomic check for cursor plane */
7895− if (plane->type == DRM_PLANE_TYPE_CURSOR)
7868+ /*TODO Implement better atomic check for cursor plane */
7869+ if (plane->type == DRM_PLANE_TYPE_CURSOR) {
7870+ if (!enable || !new_plane_crtc ||
7871+ drm_atomic_plane_disabling(plane->state, new_plane_state))
7872+ return 0;
7873+
7874+ new_acrtc = to_amdgpu_crtc(new_plane_crtc);
7875+
7876+ if ((new_plane_state->crtc_w > new_acrtc->max_cursor_width) ||
7877+ (new_plane_state->crtc_h > new_acrtc->max_cursor_height)) {
7878+ DRM_DEBUG_ATOMIC("Bad cursor size %d x %d\n",
7879+ new_plane_state->crtc_w, new_plane_state->crtc_h);
7880+ return -EINVAL;
7881+ }
7882+
7883+ if (new_plane_state->crtc_x <= -new_acrtc->max_cursor_width ||
7884+ new_plane_state->crtc_y <= -new_acrtc->max_cursor_height) {
7885+ DRM_DEBUG_ATOMIC("Bad cursor position %d, %d\n",
7886+ new_plane_state->crtc_x, new_plane_state->crtc_y);
7887+ return -EINVAL;
7888+ }
7889+
78967890 return 0;
7891+ }
78977892
78987893 needs_reset = should_reset_plane(state, plane, old_plane_state,
78997894 new_plane_state);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c+5−5
@@ -398,15 +398,15 @@ static void update_config(void *handle, struct cp_psp_stream_config *config) · 397 unmodified lines
398398 struct mod_hdcp_display *display = &hdcp_work[link_index].display;
399399 struct mod_hdcp_link *link = &hdcp_work[link_index].link;
400400
401− memset(display, 0, sizeof(*display));
402− memset(link, 0, sizeof(*link));
403−
404− display->index = aconnector->base.index;
405−
406401 if (config->dpms_off) {
407402 hdcp_remove_display(hdcp_work, link_index, aconnector);
408403 return;
409404 }
405+
406+ memset(display, 0, sizeof(*display));
407+ memset(link, 0, sizeof(*link));
408+
409+ display->index = aconnector->base.index;
410410 display->state = MOD_HDCP_DISPLAY_ACTIVE;
411411
412412 if (aconnector->dc_sink != NULL)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c+27−0
@@ -220,6 +220,30 @@ static enum dpcd_training_patterns · 219 unmodified lines
220220 return dpcd_tr_pattern;
221221 }
222222
223+static uint8_t dc_dp_initialize_scrambling_data_symbols(
224+ struct dc_link *link,
225+ enum dc_dp_training_pattern pattern)
226+{
227+ uint8_t disable_scrabled_data_symbols = 0;
228+
229+ switch (pattern) {
230+ case DP_TRAINING_PATTERN_SEQUENCE_1:
231+ case DP_TRAINING_PATTERN_SEQUENCE_2:
232+ case DP_TRAINING_PATTERN_SEQUENCE_3:
233+ disable_scrabled_data_symbols = 1;
234+ break;
235+ case DP_TRAINING_PATTERN_SEQUENCE_4:
236+ disable_scrabled_data_symbols = 0;
237+ break;
238+ default:
239+ ASSERT(0);
240+ DC_LOG_HW_LINK_TRAINING("%s: Invalid HW Training pattern: %d\n",
241+ __func__, pattern);
242+ break;
243+ }
244+ return disable_scrabled_data_symbols;
245+}
246+
223247 static inline bool is_repeater(struct dc_link *link, uint32_t offset)
224248 {
225249 return (!link->is_lttpr_mode_transparent && offset != 0);
@@ -252,6 +276,9 @@ static void dpcd_set_lt_pattern_and_lane_settings( · 26 unmodified lines
252276 dpcd_pattern.v1_4.TRAINING_PATTERN_SET =
253277 dc_dp_training_pattern_to_dpcd_training_pattern(link, pattern);
254278
279+ dpcd_pattern.v1_4.SCRAMBLING_DISABLE =
280+ dc_dp_initialize_scrambling_data_symbols(link, pattern);
281+
255282 dpcd_lt_buffer[DP_TRAINING_PATTERN_SET - DP_TRAINING_PATTERN_SET]
256283 = dpcd_pattern.raw;
257284
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c+68−1
@@ -1625,12 +1625,79 @@ void dcn10_pipe_control_lock( · 1624 unmodified lines
16251625 hws->funcs.verify_allow_pstate_change_high(dc);
16261626 }
16271627
1628+/**
1629+ * delay_cursor_until_vupdate() - Delay cursor update if too close to VUPDATE.
1630+ *
1631+ * Software keepout workaround to prevent cursor update locking from stalling
1632+ * out cursor updates indefinitely or from old values from being retained in
1633+ * the case where the viewport changes in the same frame as the cursor.
1634+ *
1635+ * The idea is to calculate the remaining time from VPOS to VUPDATE. If it's
1636+ * too close to VUPDATE, then stall out until VUPDATE finishes.
1637+ *
1638+ * TODO: Optimize cursor programming to be once per frame before VUPDATE
1639+ * to avoid the need for this workaround.
1640+ */
1641+static void delay_cursor_until_vupdate(struct dc *dc, struct pipe_ctx *pipe_ctx)
1642+{
1643+ struct dc_stream_state *stream = pipe_ctx->stream;
1644+ struct crtc_position position;
1645+ uint32_t vupdate_start, vupdate_end;
1646+ unsigned int lines_to_vupdate, us_to_vupdate, vpos;
1647+ unsigned int us_per_line, us_vupdate;
1648+
1649+ if (!dc->hwss.calc_vupdate_position || !dc->hwss.get_position)
1650+ return;
1651+
1652+ if (!pipe_ctx->stream_res.stream_enc || !pipe_ctx->stream_res.tg)
1653+ return;
1654+
1655+ dc->hwss.calc_vupdate_position(dc, pipe_ctx, &vupdate_start,
1656+ &vupdate_end);
1657+
1658+ dc->hwss.get_position(&pipe_ctx, 1, &position);
1659+ vpos = position.vertical_count;
1660+
1661+ /* Avoid wraparound calculation issues */
1662+ vupdate_start += stream->timing.v_total;
1663+ vupdate_end += stream->timing.v_total;
1664+ vpos += stream->timing.v_total;
1665+
1666+ if (vpos <= vupdate_start) {
1667+ /* VPOS is in VACTIVE or back porch. */
1668+ lines_to_vupdate = vupdate_start - vpos;
1669+ } else if (vpos > vupdate_end) {
1670+ /* VPOS is in the front porch. */
1671+ return;
1672+ } else {
1673+ /* VPOS is in VUPDATE. */
1674+ lines_to_vupdate = 0;
1675+ }
1676+
1677+ /* Calculate time until VUPDATE in microseconds. */
1678+ us_per_line =
1679+ stream->timing.h_total * 10000u / stream->timing.pix_clk_100hz;
1680+ us_to_vupdate = lines_to_vupdate * us_per_line;
1681+
1682+ /* 70 us is a conservative estimate of cursor update time*/
1683+ if (us_to_vupdate > 70)
1684+ return;
1685+
1686+ /* Stall out until the cursor update completes. */
1687+ us_vupdate = (vupdate_end - vupdate_start + 1) * us_per_line;
1688+ udelay(us_to_vupdate + us_vupdate);
1689+}
1690+
16281691 void dcn10_cursor_lock(struct dc *dc, struct pipe_ctx *pipe, bool lock)
16291692 {
16301693 /* cursor lock is per MPCC tree, so only need to lock one pipe per stream */
16311694 if (!pipe || pipe->top_pipe)
16321695 return;
16331696
1697+ /* Prevent cursor lock from stalling out cursor updates. */
1698+ if (lock)
1699+ delay_cursor_until_vupdate(dc, pipe);
1700+
16341701 dc->res_pool->mpc->funcs->cursor_lock(dc->res_pool->mpc,
16351702 pipe->stream_res.opp->inst, lock);
16361703 }
@@ -3236,7 +3303,7 @@ int dcn10_get_vupdate_offset_from_vsync(struct pipe_ctx *pipe_ctx) · 1599 unmodified lines
32363303 return vertical_line_start;
32373304 }
32383305
3239−static void dcn10_calc_vupdate_position(
3306+void dcn10_calc_vupdate_position(
32403307 struct dc *dc,
32413308 struct pipe_ctx *pipe_ctx,
32423309 uint32_t *start_line,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h+5−0
@@ -34,6 +34,11 @@ struct dc; · 33 unmodified lines
3434 void dcn10_hw_sequencer_construct(struct dc *dc);
3535
3636 int dcn10_get_vupdate_offset_from_vsync(struct pipe_ctx *pipe_ctx);
37+void dcn10_calc_vupdate_position(
38+ struct dc *dc,
39+ struct pipe_ctx *pipe_ctx,
40+ uint32_t *start_line,
41+ uint32_t *end_line);
3742 void dcn10_setup_vupdate_interrupt(struct dc *dc, struct pipe_ctx *pipe_ctx);
3843 enum dc_status dcn10_enable_stream_timing(
3944 struct pipe_ctx *pipe_ctx,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_init.c+1−0
@@ -72,6 +72,7 @@ static const struct hw_sequencer_funcs dcn10_funcs = { · 71 unmodified lines
7272 .set_clock = dcn10_set_clock,
7373 .get_clock = dcn10_get_clock,
7474 .get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync,
75+ .calc_vupdate_position = dcn10_calc_vupdate_position,
7576 };
7677
7778 static const struct hwseq_private_funcs dcn10_private_funcs = {
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_init.c+1−0
@@ -83,6 +83,7 @@ static const struct hw_sequencer_funcs dcn20_funcs = { · 82 unmodified lines
8383 .init_vm_ctx = dcn20_init_vm_ctx,
8484 .set_flip_control_gsl = dcn20_set_flip_control_gsl,
8585 .get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync,
86+ .calc_vupdate_position = dcn10_calc_vupdate_position,
8687 };
8788
8889 static const struct hwseq_private_funcs dcn20_private_funcs = {
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_init.c+1−0
@@ -86,6 +86,7 @@ static const struct hw_sequencer_funcs dcn21_funcs = { · 85 unmodified lines
8686 .optimize_pwr_state = dcn21_optimize_pwr_state,
8787 .exit_optimized_pwr_state = dcn21_exit_optimized_pwr_state,
8888 .get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync,
89+ .calc_vupdate_position = dcn10_calc_vupdate_position,
8990 .set_cursor_position = dcn10_set_cursor_position,
9091 .set_cursor_attribute = dcn10_set_cursor_attribute,
9192 .set_cursor_sdr_white_level = dcn10_set_cursor_sdr_white_level,
drivers/gpu/drm/amd/display/dc/dml/Makefile+0−2
@@ -63,10 +63,8 @@ CFLAGS_$(AMDDALPATH)/dc/dml/dcn21/display_rq_dlg_calc_21.o := $(dml_ccflags) · 62 unmodified lines
6363 endif
6464 CFLAGS_$(AMDDALPATH)/dc/dml/dml1_display_rq_dlg_calc.o := $(dml_ccflags)
6565 CFLAGS_$(AMDDALPATH)/dc/dml/display_rq_dlg_helpers.o := $(dml_ccflags)
66−CFLAGS_$(AMDDALPATH)/dc/dml/dml_common_defs.o := $(dml_ccflags)
6766
6867 DML = display_mode_lib.o display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o \
69− dml_common_defs.o
7068
7169 ifdef CONFIG_DRM_AMD_DC_DCN
7270 DML += display_mode_vba.o dcn20/display_rq_dlg_calc_20.o dcn20/display_mode_vba_20.o
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.h+0−1
@@ -26,7 +26,6 @@ · 25 unmodified lines
2626 #ifndef __DML20_DISPLAY_RQ_DLG_CALC_H__
2727 #define __DML20_DISPLAY_RQ_DLG_CALC_H__
2828
29−#include "../dml_common_defs.h"
3029 #include "../display_rq_dlg_helpers.h"
3130
3231 struct display_mode_lib;
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.h+0−1
@@ -26,7 +26,6 @@ · 25 unmodified lines
2626 #ifndef __DML20V2_DISPLAY_RQ_DLG_CALC_H__
2727 #define __DML20V2_DISPLAY_RQ_DLG_CALC_H__
2828
29−#include "../dml_common_defs.h"
3029 #include "../display_rq_dlg_helpers.h"
3130
3231 struct display_mode_lib;
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.h+1−1
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626 #ifndef __DML21_DISPLAY_RQ_DLG_CALC_H__
2727 #define __DML21_DISPLAY_RQ_DLG_CALC_H__
2828
29−#include "../dml_common_defs.h"
29+#include "dm_services.h"
3030 #include "../display_rq_dlg_helpers.h"
3131
3232 struct display_mode_lib;
drivers/gpu/drm/amd/display/dc/dml/display_mode_lib.h+4−2
@@ -25,8 +25,10 @@ · 24 unmodified lines
2525 #ifndef __DISPLAY_MODE_LIB_H__
2626 #define __DISPLAY_MODE_LIB_H__
2727
28−
29−#include "dml_common_defs.h"
28+#include "dm_services.h"
29+#include "dc_features.h"
30+#include "display_mode_structs.h"
31+#include "display_mode_enums.h"
3032 #include "display_mode_vba.h"
3133
3234 enum dml_project {
drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h+0−2
@@ -27,8 +27,6 @@ · 26 unmodified lines
2727 #ifndef __DML2_DISPLAY_MODE_VBA_H__
2828 #define __DML2_DISPLAY_MODE_VBA_H__
2929
30−#include "dml_common_defs.h"
31−
3230 struct display_mode_lib;
3331
3432 void ModeSupportAndSystemConfiguration(struct display_mode_lib *mode_lib);
drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_helpers.h+0−1
@@ -26,7 +26,6 @@ · 25 unmodified lines
2626 #ifndef __DISPLAY_RQ_DLG_HELPERS_H__
2727 #define __DISPLAY_RQ_DLG_HELPERS_H__
2828
29−#include "dml_common_defs.h"
3029 #include "display_mode_lib.h"
3130
3231 /* Function: Printer functions
drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.h+0−2
@@ -26,8 +26,6 @@ · 25 unmodified lines
2626 #ifndef __DISPLAY_RQ_DLG_CALC_H__
2727 #define __DISPLAY_RQ_DLG_CALC_H__
2828
29−#include "dml_common_defs.h"
30−
3129 struct display_mode_lib;
3230
3331 #include "display_rq_dlg_helpers.h"
drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c+0−43
@@ -1,43 +0,0 @@
1−/*
2− * Copyright 2017 Advanced Micro Devices, Inc.
3− *
4− * Permission is hereby granted, free of charge, to any person obtaining a
5− * copy of this software and associated documentation files (the "Software"),
6− * to deal in the Software without restriction, including without limitation
7− * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8− * and/or sell copies of the Software, and to permit persons to whom the
9− * Software is furnished to do so, subject to the following conditions:
10− *
11− * The above copyright notice and this permission notice shall be included in
12− * all copies or substantial portions of the Software.
13− *
14− * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15− * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16− * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17− * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18− * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19− * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20− * OTHER DEALINGS IN THE SOFTWARE.
21− *
22− * Authors: AMD
23− *
24− */
25−
26−#include "dml_common_defs.h"
27−#include "dcn_calc_math.h"
28−
29−#include "dml_inline_defs.h"
30−
31−double dml_round(double a)
32−{
33− double round_pt = 0.5;
34− double ceil = dml_ceil(a, 1);
35− double floor = dml_floor(a, 1);
36−
37− if (a - floor >= round_pt)
38− return ceil;
39− else
40− return floor;
41−}
42−
43−
drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h+0−37
@@ -1,37 +0,0 @@
1−/*
2− * Copyright 2017 Advanced Micro Devices, Inc.
3− *
4− * Permission is hereby granted, free of charge, to any person obtaining a
5− * copy of this software and associated documentation files (the "Software"),
6− * to deal in the Software without restriction, including without limitation
7− * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8− * and/or sell copies of the Software, and to permit persons to whom the
9− * Software is furnished to do so, subject to the following conditions:
10− *
11− * The above copyright notice and this permission notice shall be included in
12− * all copies or substantial portions of the Software.
13− *
14− * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15− * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16− * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17− * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18− * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19− * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20− * OTHER DEALINGS IN THE SOFTWARE.
21− *
22− * Authors: AMD
23− *
24− */
25−
26−#ifndef __DC_COMMON_DEFS_H__
27−#define __DC_COMMON_DEFS_H__
28−
29−#include "dm_services.h"
30−#include "dc_features.h"
31−#include "display_mode_structs.h"
32−#include "display_mode_enums.h"
33−
34−
35−double dml_round(double a);
36−
37−#endif /* __DC_COMMON_DEFS_H__ */
drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h+13−2
@@ -26,7 +26,6 @@ · 25 unmodified lines
2626 #ifndef __DML_INLINE_DEFS_H__
2727 #define __DML_INLINE_DEFS_H__
2828
29−#include "dml_common_defs.h"
3029 #include "dcn_calc_math.h"
3130 #include "dml_logger.h"
3231
@@ -75,6 +74,18 @@ static inline double dml_floor(double a, double granularity) · 42 unmodified lines
7574 return (double) dcn_bw_floor2(a, granularity);
7675 }
7776
77+static inline double dml_round(double a)
78+{
79+ double round_pt = 0.5;
80+ double ceil = dml_ceil(a, 1);
81+ double floor = dml_floor(a, 1);
82+
83+ if (a - floor >= round_pt)
84+ return ceil;
85+ else
86+ return floor;
87+}
88+
7889 static inline int dml_log2(double x)
7990 {
8091 return dml_round((double)dcn_bw_log(x, 2));
@@ -112,7 +123,7 @@ static inline double dml_log(double x, double base) · 31 unmodified lines
112123
113124 static inline unsigned int dml_round_to_multiple(unsigned int num,
114125 unsigned int multiple,
115− bool up)
126+ unsigned char up)
116127 {
117128 unsigned int remainder;
118129
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h+5−0
@@ -92,6 +92,11 @@ struct hw_sequencer_funcs { · 91 unmodified lines
9292 void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes,
9393 struct crtc_position *position);
9494 int (*get_vupdate_offset_from_vsync)(struct pipe_ctx *pipe_ctx);
95+ void (*calc_vupdate_position)(
96+ struct dc *dc,
97+ struct pipe_ctx *pipe_ctx,
98+ uint32_t *start_line,
99+ uint32_t *end_line);
95100 void (*enable_per_frame_crtc_position_reset)(struct dc *dc,
96101 int group_size, struct pipe_ctx *grouped_pipes[]);
97102 void (*enable_timing_synchronization)(struct dc *dc,
drivers/gpu/drm/amd/powerplay/amd_powerplay.c+3−3
@@ -319,12 +319,12 @@ static void pp_dpm_en_umd_pstate(struct pp_hwmgr *hwmgr, · 318 unmodified lines
319319 if (*level & profile_mode_mask) {
320320 hwmgr->saved_dpm_level = hwmgr->dpm_level;
321321 hwmgr->en_umd_pstate = true;
322− amdgpu_device_ip_set_clockgating_state(hwmgr->adev,
323− AMD_IP_BLOCK_TYPE_GFX,
324− AMD_CG_STATE_UNGATE);
325322 amdgpu_device_ip_set_powergating_state(hwmgr->adev,
326323 AMD_IP_BLOCK_TYPE_GFX,
327324 AMD_PG_STATE_UNGATE);
325+ amdgpu_device_ip_set_clockgating_state(hwmgr->adev,
326+ AMD_IP_BLOCK_TYPE_GFX,
327+ AMD_CG_STATE_UNGATE);
328328 }
329329 } else {
330330 /* exit umd pstate, restore level, enable gfx cg*/
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c+4−4
@@ -1476,7 +1476,7 @@ static int smu_disable_dpm(struct smu_context *smu) · 1475 unmodified lines
14761476 bool use_baco = !smu->is_apu &&
14771477 ((adev->in_gpu_reset &&
14781478 (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)) ||
1479− (adev->in_runpm && amdgpu_asic_supports_baco(adev)));
1479+ ((adev->in_runpm || adev->in_hibernate) && amdgpu_asic_supports_baco(adev)));
14801480
14811481 ret = smu_get_smc_version(smu, NULL, &smu_version);
14821482 if (ret) {
@@ -1744,12 +1744,12 @@ static int smu_enable_umd_pstate(void *handle, · 261 unmodified lines
17441744 if (*level & profile_mode_mask) {
17451745 smu_dpm_ctx->saved_dpm_level = smu_dpm_ctx->dpm_level;
17461746 smu_dpm_ctx->enable_umd_pstate = true;
1747− amdgpu_device_ip_set_clockgating_state(smu->adev,
1748− AMD_IP_BLOCK_TYPE_GFX,
1749− AMD_CG_STATE_UNGATE);
17501747 amdgpu_device_ip_set_powergating_state(smu->adev,
17511748 AMD_IP_BLOCK_TYPE_GFX,
17521749 AMD_PG_STATE_UNGATE);
1750+ amdgpu_device_ip_set_clockgating_state(smu->adev,
1751+ AMD_IP_BLOCK_TYPE_GFX,
1752+ AMD_CG_STATE_UNGATE);
17531753 }
17541754 } else {
17551755 /* exit umd pstate, restore level, enable gfx cg*/
drivers/gpu/drm/drm_edid.c+2−1
@@ -191,10 +191,11 @@ static const struct edid_quirk { · 190 unmodified lines
191191 { "HVR", 0xaa01, EDID_QUIRK_NON_DESKTOP },
192192 { "HVR", 0xaa02, EDID_QUIRK_NON_DESKTOP },
193193
194− /* Oculus Rift DK1, DK2, and CV1 VR Headsets */
194+ /* Oculus Rift DK1, DK2, CV1 and Rift S VR Headsets */
195195 { "OVR", 0x0001, EDID_QUIRK_NON_DESKTOP },
196196 { "OVR", 0x0003, EDID_QUIRK_NON_DESKTOP },
197197 { "OVR", 0x0004, EDID_QUIRK_NON_DESKTOP },
198+ { "OVR", 0x0012, EDID_QUIRK_NON_DESKTOP },
198199
199200 /* Windows Mixed Reality Headsets */
200201 { "ACR", 0x7fce, EDID_QUIRK_NON_DESKTOP },
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c+3−1
@@ -238,8 +238,10 @@ static int submit_pin_objects(struct etnaviv_gem_submit *submit) · 237 unmodified lines
238238 }
239239
240240 if ((submit->flags & ETNA_SUBMIT_SOFTPIN) &&
241− submit->bos[i].va != mapping->iova)
241+ submit->bos[i].va != mapping->iova) {
242+ etnaviv_gem_mapping_unreference(mapping);
242243 return -EINVAL;
244+ }
243245
244246 atomic_inc(&etnaviv_obj->gpu_active);
245247
drivers/gpu/drm/etnaviv/etnaviv_perfmon.c+1−1
@@ -453,7 +453,7 @@ static const struct etnaviv_pm_domain *pm_domain(const struct etnaviv_gpu *gpu, · 452 unmodified lines
453453 if (!(gpu->identity.features & meta->feature))
454454 continue;
455455
456− if (meta->nr_domains < (index - offset)) {
456+ if (index - offset >= meta->nr_domains) {
457457 offset += meta->nr_domains;
458458 continue;
459459 }
drivers/gpu/drm/i915/display/intel_fbc.c+1−2
@@ -485,8 +485,7 @@ static int intel_fbc_alloc_cfb(struct drm_i915_private *dev_priv, · 484 unmodified lines
485485 if (!ret)
486486 goto err_llb;
487487 else if (ret > 1) {
488− DRM_INFO("Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS.\n");
489−
488+ DRM_INFO_ONCE("Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS.\n");
490489 }
491490
492491 fbc->threshold = ret;
drivers/gpu/drm/i915/gem/i915_gem_domain.c+1−6
@@ -368,7 +368,6 @@ static void i915_gem_object_bump_inactive_ggtt(struct drm_i915_gem_object *obj) · 367 unmodified lines
368368 struct drm_i915_private *i915 = to_i915(obj->base.dev);
369369 struct i915_vma *vma;
370370
371− GEM_BUG_ON(!i915_gem_object_has_pinned_pages(obj));
372371 if (!atomic_read(&obj->bind_count))
373372 return;
374373
@@ -400,12 +399,8 @@ static void i915_gem_object_bump_inactive_ggtt(struct drm_i915_gem_object *obj) · 25 unmodified lines
400399 void
401400 i915_gem_object_unpin_from_display_plane(struct i915_vma *vma)
402401 {
403− struct drm_i915_gem_object *obj = vma->obj;
404−
405− assert_object_held(obj);
406−
407402 /* Bump the LRU to try and avoid premature eviction whilst flipping */
408− i915_gem_object_bump_inactive_ggtt(obj);
403+ i915_gem_object_bump_inactive_ggtt(vma->obj);
409404
410405 i915_vma_unpin(vma);
411406 }
drivers/gpu/drm/i915/gt/intel_context_types.h+7−1
@@ -69,7 +69,13 @@ struct intel_context { · 68 unmodified lines
6969 #define CONTEXT_NOPREEMPT 7
7070
7171 u32 *lrc_reg_state;
72− u64 lrc_desc;
72+ union {
73+ struct {
74+ u32 lrca;
75+ u32 ccid;
76+ };
77+ u64 desc;
78+ } lrc;
7379 u32 tag; /* cookie passed to HW to track this context on submission */
7480
7581 /* Time on GPU as tracked by the hw. */
drivers/gpu/drm/i915/gt/intel_engine.h+0−9
@@ -333,13 +333,4 @@ intel_engine_has_preempt_reset(const struct intel_engine_cs *engine) · 332 unmodified lines
333333 return intel_engine_has_preemption(engine);
334334 }
335335
336−static inline bool
337−intel_engine_has_timeslices(const struct intel_engine_cs *engine)
338−{
339− if (!IS_ACTIVE(CONFIG_DRM_I915_TIMESLICE_DURATION))
340− return false;
341−
342− return intel_engine_has_semaphores(engine);
343−}
344−
345336 #endif /* _INTEL_RINGBUFFER_H_ */
drivers/gpu/drm/i915/gt/intel_engine_cs.c+6−0
@@ -1295,6 +1295,12 @@ static void intel_engine_print_registers(struct intel_engine_cs *engine, · 1294 unmodified lines
12951295
12961296 if (engine->id == RENDER_CLASS && IS_GEN_RANGE(dev_priv, 4, 7))
12971297 drm_printf(m, "\tCCID: 0x%08x\n", ENGINE_READ(engine, CCID));
1298+ if (HAS_EXECLISTS(dev_priv)) {
1299+ drm_printf(m, "\tEL_STAT_HI: 0x%08x\n",
1300+ ENGINE_READ(engine, RING_EXECLIST_STATUS_HI));
1301+ drm_printf(m, "\tEL_STAT_LO: 0x%08x\n",
1302+ ENGINE_READ(engine, RING_EXECLIST_STATUS_LO));
1303+ }
12981304 drm_printf(m, "\tRING_START: 0x%08x\n",
12991305 ENGINE_READ(engine, RING_START));
13001306 drm_printf(m, "\tRING_HEAD: 0x%08x\n",
drivers/gpu/drm/i915/gt/intel_engine_types.h+29−6
@@ -156,6 +156,20 @@ struct intel_engine_execlists { · 155 unmodified lines
156156 */
157157 struct i915_priolist default_priolist;
158158
159+ /**
160+ * @ccid: identifier for contexts submitted to this engine
161+ */
162+ u32 ccid;
163+
164+ /**
165+ * @yield: CCID at the time of the last semaphore-wait interrupt.
166+ *
167+ * Instead of leaving a semaphore busy-spinning on an engine, we would
168+ * like to switch to another ready context, i.e. yielding the semaphore
169+ * timeslice.
170+ */
171+ u32 yield;
172+
159173 /**
160174 * @error_interrupt: CS Master EIR
161175 *
@@ -295,8 +309,7 @@ struct intel_engine_cs { · 133 unmodified lines
295309 u32 context_size;
296310 u32 mmio_base;
297311
298− unsigned int context_tag;
299−#define NUM_CONTEXT_TAG roundup_pow_of_two(2 * EXECLIST_MAX_PORTS)
312+ unsigned long context_tag;
300313
301314 struct rb_node uabi_node;
302315
@@ -483,10 +496,11 @@ struct intel_engine_cs { · 180 unmodified lines
483496 #define I915_ENGINE_SUPPORTS_STATS BIT(1)
484497 #define I915_ENGINE_HAS_PREEMPTION BIT(2)
485498 #define I915_ENGINE_HAS_SEMAPHORES BIT(3)
486−#define I915_ENGINE_NEEDS_BREADCRUMB_TASKLET BIT(4)
487−#define I915_ENGINE_IS_VIRTUAL BIT(5)
488−#define I915_ENGINE_HAS_RELATIVE_MMIO BIT(6)
489−#define I915_ENGINE_REQUIRES_CMD_PARSER BIT(7)
499+#define I915_ENGINE_HAS_TIMESLICES BIT(4)
500+#define I915_ENGINE_NEEDS_BREADCRUMB_TASKLET BIT(5)
501+#define I915_ENGINE_IS_VIRTUAL BIT(6)
502+#define I915_ENGINE_HAS_RELATIVE_MMIO BIT(7)
503+#define I915_ENGINE_REQUIRES_CMD_PARSER BIT(8)
490504 unsigned int flags;
491505
492506 /*
@@ -584,6 +598,15 @@ intel_engine_has_semaphores(const struct intel_engine_cs *engine) · 91 unmodified lines
584598 return engine->flags & I915_ENGINE_HAS_SEMAPHORES;
585599 }
586600
601+static inline bool
602+intel_engine_has_timeslices(const struct intel_engine_cs *engine)
603+{
604+ if (!IS_ACTIVE(CONFIG_DRM_I915_TIMESLICE_DURATION))
605+ return false;
606+
607+ return engine->flags & I915_ENGINE_HAS_TIMESLICES;
608+}
609+
587610 static inline bool
588611 intel_engine_needs_breadcrumb_tasklet(const struct intel_engine_cs *engine)
589612 {
drivers/gpu/drm/i915/gt/intel_gt_irq.c+13−2
@@ -39,6 +39,15 @@ cs_irq_handler(struct intel_engine_cs *engine, u32 iir) · 38 unmodified lines
3939 }
4040 }
4141
42+ if (iir & GT_WAIT_SEMAPHORE_INTERRUPT) {
43+ WRITE_ONCE(engine->execlists.yield,
44+ ENGINE_READ_FW(engine, RING_EXECLIST_STATUS_HI));
45+ ENGINE_TRACE(engine, "semaphore yield: %08x\n",
46+ engine->execlists.yield);
47+ if (del_timer(&engine->execlists.timer))
48+ tasklet = true;
49+ }
50+
4251 if (iir & GT_CONTEXT_SWITCH_INTERRUPT)
4352 tasklet = true;
4453
@@ -228,7 +237,8 @@ void gen11_gt_irq_postinstall(struct intel_gt *gt) · 183 unmodified lines
228237 const u32 irqs =
229238 GT_CS_MASTER_ERROR_INTERRUPT |
230239 GT_RENDER_USER_INTERRUPT |
231− GT_CONTEXT_SWITCH_INTERRUPT;
240+ GT_CONTEXT_SWITCH_INTERRUPT |
241+ GT_WAIT_SEMAPHORE_INTERRUPT;
232242 struct intel_uncore *uncore = gt->uncore;
233243 const u32 dmask = irqs << 16 | irqs;
234244 const u32 smask = irqs << 16;
@@ -366,7 +376,8 @@ void gen8_gt_irq_postinstall(struct intel_gt *gt) · 131 unmodified lines
366376 const u32 irqs =
367377 GT_CS_MASTER_ERROR_INTERRUPT |
368378 GT_RENDER_USER_INTERRUPT |
369− GT_CONTEXT_SWITCH_INTERRUPT;
379+ GT_CONTEXT_SWITCH_INTERRUPT |
380+ GT_WAIT_SEMAPHORE_INTERRUPT;
370381 const u32 gt_interrupts[] = {
371382 irqs << GEN8_RCS_IRQ_SHIFT | irqs << GEN8_BCS_IRQ_SHIFT,
372383 irqs << GEN8_VCS0_IRQ_SHIFT | irqs << GEN8_VCS1_IRQ_SHIFT,
drivers/gpu/drm/i915/gt/intel_lrc.c+81−39
@@ -456,10 +456,10 @@ assert_priority_queue(const struct i915_request *prev, · 455 unmodified lines
456456 * engine info, SW context ID and SW counter need to form a unique number
457457 * (Context ID) per lrc.
458458 */
459−static u64
459+static u32
460460 lrc_descriptor(struct intel_context *ce, struct intel_engine_cs *engine)
461461 {
462− u64 desc;
462+ u32 desc;
463463
464464 desc = INTEL_LEGACY_32B_CONTEXT;
465465 if (i915_vm_is_4lvl(ce->vm))
@@ -470,21 +470,7 @@ lrc_descriptor(struct intel_context *ce, struct intel_engine_cs *engine) · 4 unmodified lines
470470 if (IS_GEN(engine->i915, 8))
471471 desc |= GEN8_CTX_L3LLC_COHERENT;
472472
473− desc |= i915_ggtt_offset(ce->state); /* bits 12-31 */
474− /*
475− * The following 32bits are copied into the OA reports (dword 2).
476− * Consider updating oa_get_render_ctx_id in i915_perf.c when changing
477− * anything below.
478− */
479− if (INTEL_GEN(engine->i915) >= 11) {
480− desc |= (u64)engine->instance << GEN11_ENGINE_INSTANCE_SHIFT;
481− /* bits 48-53 */
482−
483− desc |= (u64)engine->class << GEN11_ENGINE_CLASS_SHIFT;
484− /* bits 61-63 */
485− }
486−
487− return desc;
473+ return i915_ggtt_offset(ce->state) | desc;
488474 }
489475
490476 static inline unsigned int dword_in_page(void *addr)
@@ -1192,7 +1178,7 @@ static void reset_active(struct i915_request *rq, · 701 unmodified lines
11921178 __execlists_update_reg_state(ce, engine, head);
11931179
11941180 /* We've switched away, so this should be a no-op, but intent matters */
1195− ce->lrc_desc |= CTX_DESC_FORCE_RESTORE;
1181+ ce->lrc.desc |= CTX_DESC_FORCE_RESTORE;
11961182 }
11971183
11981184 static u32 intel_context_get_runtime(const struct intel_context *ce)
@@ -1251,18 +1237,23 @@ __execlists_schedule_in(struct i915_request *rq) · 52 unmodified lines
12511237 if (IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM))
12521238 execlists_check_context(ce, engine);
12531239
1254− ce->lrc_desc &= ~GENMASK_ULL(47, 37);
12551240 if (ce->tag) {
12561241 /* Use a fixed tag for OA and friends */
1257− ce->lrc_desc |= (u64)ce->tag << 32;
1242+ GEM_BUG_ON(ce->tag <= BITS_PER_LONG);
1243+ ce->lrc.ccid = ce->tag;
12581244 } else {
12591245 /* We don't need a strict matching tag, just different values */
1260− ce->lrc_desc |=
1261− (u64)(++engine->context_tag % NUM_CONTEXT_TAG) <<
1262− GEN11_SW_CTX_ID_SHIFT;
1263− BUILD_BUG_ON(NUM_CONTEXT_TAG > GEN12_MAX_CONTEXT_HW_ID);
1246+ unsigned int tag = ffs(engine->context_tag);
1247+
1248+ GEM_BUG_ON(tag == 0 || tag >= BITS_PER_LONG);
1249+ clear_bit(tag - 1, &engine->context_tag);
1250+ ce->lrc.ccid = tag << (GEN11_SW_CTX_ID_SHIFT - 32);
1251+
1252+ BUILD_BUG_ON(BITS_PER_LONG > GEN12_MAX_CONTEXT_HW_ID);
12641253 }
12651254
1255+ ce->lrc.ccid |= engine->execlists.ccid;
1256+
12661257 __intel_gt_pm_get(engine->gt);
12671258 execlists_context_status_change(rq, INTEL_CONTEXT_SCHEDULE_IN);
12681259 intel_engine_context_in(engine);
@@ -1302,7 +1293,8 @@ static void kick_siblings(struct i915_request *rq, struct intel_context *ce) · 33 unmodified lines
13021293
13031294 static inline void
13041295 __execlists_schedule_out(struct i915_request *rq,
1305− struct intel_engine_cs * const engine)
1296+ struct intel_engine_cs * const engine,
1297+ unsigned int ccid)
13061298 {
13071299 struct intel_context * const ce = rq->context;
13081300
@@ -1320,6 +1312,14 @@ __execlists_schedule_out(struct i915_request *rq, · 11 unmodified lines
13201312 i915_request_completed(rq))
13211313 intel_engine_add_retire(engine, ce->timeline);
13221314
1315+ ccid >>= GEN11_SW_CTX_ID_SHIFT - 32;
1316+ ccid &= GEN12_MAX_CONTEXT_HW_ID;
1317+ if (ccid < BITS_PER_LONG) {
1318+ GEM_BUG_ON(ccid == 0);
1319+ GEM_BUG_ON(test_bit(ccid - 1, &engine->context_tag));
1320+ set_bit(ccid - 1, &engine->context_tag);
1321+ }
1322+
13231323 intel_context_update_runtime(ce);
13241324 intel_engine_context_out(engine);
13251325 execlists_context_status_change(rq, INTEL_CONTEXT_SCHEDULE_OUT);
@@ -1345,15 +1345,17 @@ execlists_schedule_out(struct i915_request *rq) · 19 unmodified lines
13451345 {
13461346 struct intel_context * const ce = rq->context;
13471347 struct intel_engine_cs *cur, *old;
1348+ u32 ccid;
13481349
13491350 trace_i915_request_out(rq);
13501351
1352+ ccid = rq->context->lrc.ccid;
13511353 old = READ_ONCE(ce->inflight);
13521354 do
13531355 cur = ptr_unmask_bits(old, 2) ? ptr_dec(old) : NULL;
13541356 while (!try_cmpxchg(&ce->inflight, &old, cur));
13551357 if (!cur)
1356− __execlists_schedule_out(rq, old);
1358+ __execlists_schedule_out(rq, old, ccid);
13571359
13581360 i915_request_put(rq);
13591361 }
@@ -1361,7 +1363,7 @@ execlists_schedule_out(struct i915_request *rq) · 1 unmodified line
13611363 static u64 execlists_update_context(struct i915_request *rq)
13621364 {
13631365 struct intel_context *ce = rq->context;
1364− u64 desc = ce->lrc_desc;
1366+ u64 desc = ce->lrc.desc;
13651367 u32 tail, prev;
13661368
13671369 /*
@@ -1400,7 +1402,7 @@ static u64 execlists_update_context(struct i915_request *rq) · 32 unmodified lines
14001402 */
14011403 wmb();
14021404
1403− ce->lrc_desc &= ~CTX_DESC_FORCE_RESTORE;
1405+ ce->lrc.desc &= ~CTX_DESC_FORCE_RESTORE;
14041406 return desc;
14051407 }
14061408
@@ -1719,6 +1721,9 @@ static void defer_request(struct i915_request *rq, struct list_head * const pl) · 312 unmodified lines
17191721 struct i915_request *w =
17201722 container_of(p->waiter, typeof(*w), sched);
17211723
1724+ if (p->flags & I915_DEPENDENCY_WEAK)
1725+ continue;
1726+
17221727 /* Leave semaphores spinning on the other engines */
17231728 if (w->engine != rq->engine)
17241729 continue;
@@ -1754,7 +1759,8 @@ static void defer_active(struct intel_engine_cs *engine) · 29 unmodified lines
17541759 }
17551760
17561761 static bool
1757−need_timeslice(struct intel_engine_cs *engine, const struct i915_request *rq)
1762+need_timeslice(const struct intel_engine_cs *engine,
1763+ const struct i915_request *rq)
17581764 {
17591765 int hint;
17601766
@@ -1768,6 +1774,32 @@ need_timeslice(struct intel_engine_cs *engine, const struct i915_request *rq) · 7 unmodified lines
17681774 return hint >= effective_prio(rq);
17691775 }
17701776
1777+static bool
1778+timeslice_yield(const struct intel_engine_execlists *el,
1779+ const struct i915_request *rq)
1780+{
1781+ /*
1782+ * Once bitten, forever smitten!
1783+ *
1784+ * If the active context ever busy-waited on a semaphore,
1785+ * it will be treated as a hog until the end of its timeslice (i.e.
1786+ * until it is scheduled out and replaced by a new submission,
1787+ * possibly even its own lite-restore). The HW only sends an interrupt
1788+ * on the first miss, and we do know if that semaphore has been
1789+ * signaled, or even if it is now stuck on another semaphore. Play
1790+ * safe, yield if it might be stuck -- it will be given a fresh
1791+ * timeslice in the near future.
1792+ */
1793+ return rq->context->lrc.ccid == READ_ONCE(el->yield);
1794+}
1795+
1796+static bool
1797+timeslice_expired(const struct intel_engine_execlists *el,
1798+ const struct i915_request *rq)
1799+{
1800+ return timer_expired(&el->timer) || timeslice_yield(el, rq);
1801+}
1802+
17711803 static int
17721804 switch_prio(struct intel_engine_cs *engine, const struct i915_request *rq)
17731805 {
@@ -1783,8 +1815,7 @@ timeslice(const struct intel_engine_cs *engine) · 9 unmodified lines
17831815 return READ_ONCE(engine->props.timeslice_duration_ms);
17841816 }
17851817
1786−static unsigned long
1787−active_timeslice(const struct intel_engine_cs *engine)
1818+static unsigned long active_timeslice(const struct intel_engine_cs *engine)
17881819 {
17891820 const struct intel_engine_execlists *execlists = &engine->execlists;
17901821 const struct i915_request *rq = *execlists->active;
@@ -1946,13 +1977,14 @@ static void execlists_dequeue(struct intel_engine_cs *engine) · 155 unmodified lines
19461977
19471978 last = NULL;
19481979 } else if (need_timeslice(engine, last) &&
1949− timer_expired(&engine->execlists.timer)) {
1980+ timeslice_expired(execlists, last)) {
19501981 ENGINE_TRACE(engine,
1951− "expired last=%llx:%lld, prio=%d, hint=%d\n",
1982+ "expired last=%llx:%lld, prio=%d, hint=%d, yield?=%s\n",
19521983 last->fence.context,
19531984 last->fence.seqno,
19541985 last->sched.attr.priority,
1955− execlists->queue_priority_hint);
1986+ execlists->queue_priority_hint,
1987+ yesno(timeslice_yield(execlists, last)));
19561988
19571989 ring_set_paused(engine, 1);
19581990 defer_active(engine);
@@ -2213,6 +2245,7 @@ done: · 254 unmodified lines
22132245 }
22142246 clear_ports(port + 1, last_port - port);
22152247
2248+ WRITE_ONCE(execlists->yield, -1);
22162249 execlists_submit_ports(engine);
22172250 set_preempt_timeout(engine, *active);
22182251 } else {
@@ -3043,7 +3076,7 @@ __execlists_context_pin(struct intel_context *ce, · 824 unmodified lines
30433076 if (IS_ERR(vaddr))
30443077 return PTR_ERR(vaddr);
30453078
3046− ce->lrc_desc = lrc_descriptor(ce, engine) | CTX_DESC_FORCE_RESTORE;
3079+ ce->lrc.lrca = lrc_descriptor(ce, engine) | CTX_DESC_FORCE_RESTORE;
30473080 ce->lrc_reg_state = vaddr + LRC_STATE_PN * PAGE_SIZE;
30483081 __execlists_update_reg_state(ce, engine, ce->ring->tail);
30493082
@@ -3072,7 +3105,7 @@ static void execlists_context_reset(struct intel_context *ce) · 22 unmodified lines
30723105 ce, ce->engine, ce->ring, true);
30733106 __execlists_update_reg_state(ce, ce->engine, ce->ring->tail);
30743107
3075− ce->lrc_desc |= CTX_DESC_FORCE_RESTORE;
3108+ ce->lrc.desc |= CTX_DESC_FORCE_RESTORE;
30763109 }
30773110
30783111 static const struct intel_context_ops execlists_context_ops = {
@@ -3541,7 +3574,7 @@ static void enable_execlists(struct intel_engine_cs *engine) · 462 unmodified lines
35413574
35423575 enable_error_interrupt(engine);
35433576
3544− engine->context_tag = 0;
3577+ engine->context_tag = GENMASK(BITS_PER_LONG - 2, 0);
35453578 }
35463579
35473580 static bool unexpected_starting_state(struct intel_engine_cs *engine)
@@ -3753,7 +3786,7 @@ out_replay: · 205 unmodified lines
37533786 head, ce->ring->tail);
37543787 __execlists_reset_reg_state(ce, engine);
37553788 __execlists_update_reg_state(ce, engine, head);
3756− ce->lrc_desc |= CTX_DESC_FORCE_RESTORE; /* paranoid: GPU was reset! */
3789+ ce->lrc.desc |= CTX_DESC_FORCE_RESTORE; /* paranoid: GPU was reset! */
37573790
37583791 unwind:
37593792 /* Push back any incomplete requests for replay after the reset. */
@@ -4369,8 +4402,11 @@ void intel_execlists_set_default_submission(struct intel_engine_cs *engine) · 609 unmodified lines
43694402 engine->flags |= I915_ENGINE_SUPPORTS_STATS;
43704403 if (!intel_vgpu_active(engine->i915)) {
43714404 engine->flags |= I915_ENGINE_HAS_SEMAPHORES;
4372− if (HAS_LOGICAL_RING_PREEMPTION(engine->i915))
4405+ if (HAS_LOGICAL_RING_PREEMPTION(engine->i915)) {
43734406 engine->flags |= I915_ENGINE_HAS_PREEMPTION;
4407+ if (IS_ACTIVE(CONFIG_DRM_I915_TIMESLICE_DURATION))
4408+ engine->flags |= I915_ENGINE_HAS_TIMESLICES;
4409+ }
43744410 }
43754411
43764412 if (INTEL_GEN(engine->i915) >= 12)
@@ -4449,6 +4485,7 @@ logical_ring_default_irqs(struct intel_engine_cs *engine) · 72 unmodified lines
44494485 engine->irq_enable_mask = GT_RENDER_USER_INTERRUPT << shift;
44504486 engine->irq_keep_mask = GT_CONTEXT_SWITCH_INTERRUPT << shift;
44514487 engine->irq_keep_mask |= GT_CS_MASTER_ERROR_INTERRUPT << shift;
4488+ engine->irq_keep_mask |= GT_WAIT_SEMAPHORE_INTERRUPT << shift;
44524489 }
44534490
44544491 static void rcs_submission_override(struct intel_engine_cs *engine)
@@ -4516,6 +4553,11 @@ int intel_execlists_submission_setup(struct intel_engine_cs *engine) · 61 unmodified lines
45164553 else
45174554 execlists->csb_size = GEN11_CSB_ENTRIES;
45184555
4556+ if (INTEL_GEN(engine->i915) >= 11) {
4557+ execlists->ccid |= engine->instance << (GEN11_ENGINE_INSTANCE_SHIFT - 32);
4558+ execlists->ccid |= engine->class << (GEN11_ENGINE_CLASS_SHIFT - 32);
4559+ }
4560+
45194561 reset_csb_pointers(engine);
45204562
45214563 /* Finally, take ownership and responsibility for cleanup! */
drivers/gpu/drm/i915/gt/selftest_lrc.c+18−16
@@ -929,7 +929,7 @@ create_rewinder(struct intel_context *ce, · 928 unmodified lines
929929 goto err;
930930 }
931931
932− cs = intel_ring_begin(rq, 10);
932+ cs = intel_ring_begin(rq, 14);
933933 if (IS_ERR(cs)) {
934934 err = PTR_ERR(cs);
935935 goto err;
@@ -941,8 +941,8 @@ create_rewinder(struct intel_context *ce, · 5 unmodified lines
941941 *cs++ = MI_SEMAPHORE_WAIT |
942942 MI_SEMAPHORE_GLOBAL_GTT |
943943 MI_SEMAPHORE_POLL |
944− MI_SEMAPHORE_SAD_NEQ_SDD;
945− *cs++ = 0;
944+ MI_SEMAPHORE_SAD_GTE_SDD;
945+ *cs++ = idx;
946946 *cs++ = offset;
947947 *cs++ = 0;
948948
@@ -951,6 +951,11 @@ create_rewinder(struct intel_context *ce, · 2 unmodified lines
951951 *cs++ = offset + idx * sizeof(u32);
952952 *cs++ = 0;
953953
954+ *cs++ = MI_STORE_DWORD_IMM_GEN4 | MI_USE_GGTT;
955+ *cs++ = offset;
956+ *cs++ = 0;
957+ *cs++ = idx + 1;
958+
954959 intel_ring_advance(rq, cs);
955960
956961 rq->sched.attr.priority = I915_PRIORITY_MASK;
@@ -984,7 +989,7 @@ static int live_timeslice_rewind(void *arg) · 27 unmodified lines
984989
985990 for_each_engine(engine, gt, id) {
986991 enum { A1, A2, B1 };
987− enum { X = 1, Y, Z };
992+ enum { X = 1, Z, Y };
988993 struct i915_request *rq[3] = {};
989994 struct intel_context *ce;
990995 unsigned long heartbeat;
@@ -1017,13 +1022,13 @@ static int live_timeslice_rewind(void *arg) · 26 unmodified lines
10171022 goto err;
10181023 }
10191024
1020− rq[0] = create_rewinder(ce, NULL, slot, 1);
1025+ rq[0] = create_rewinder(ce, NULL, slot, X);
10211026 if (IS_ERR(rq[0])) {
10221027 intel_context_put(ce);
10231028 goto err;
10241029 }
10251030
1026− rq[1] = create_rewinder(ce, NULL, slot, 2);
1031+ rq[1] = create_rewinder(ce, NULL, slot, Y);
10271032 intel_context_put(ce);
10281033 if (IS_ERR(rq[1]))
10291034 goto err;
@@ -1041,7 +1046,7 @@ static int live_timeslice_rewind(void *arg) · 11 unmodified lines
10411046 goto err;
10421047 }
10431048
1044− rq[2] = create_rewinder(ce, rq[0], slot, 3);
1049+ rq[2] = create_rewinder(ce, rq[0], slot, Z);
10451050 intel_context_put(ce);
10461051 if (IS_ERR(rq[2]))
10471052 goto err;
@@ -1055,15 +1060,12 @@ static int live_timeslice_rewind(void *arg) · 7 unmodified lines
10551060 GEM_BUG_ON(!timer_pending(&engine->execlists.timer));
10561061
10571062 /* ELSP[] = { { A:rq1, A:rq2 }, { B:rq1 } } */
1058− GEM_BUG_ON(!i915_request_is_active(rq[A1]));
1059− GEM_BUG_ON(!i915_request_is_active(rq[A2]));
1060− GEM_BUG_ON(!i915_request_is_active(rq[B1]));
1061−
1062− /* Wait for the timeslice to kick in */
1063− del_timer(&engine->execlists.timer);
1064− tasklet_hi_schedule(&engine->execlists.tasklet);
1065− intel_engine_flush_submission(engine);
1066−
1063+ if (i915_request_is_active(rq[A2])) { /* semaphore yielded! */
1064+ /* Wait for the timeslice to kick in */
1065+ del_timer(&engine->execlists.timer);
1066+ tasklet_hi_schedule(&engine->execlists.tasklet);
1067+ intel_engine_flush_submission(engine);
1068+ }
10671069 /* -> ELSP[] = { { A:rq1 }, { B:rq1 } } */
10681070 GEM_BUG_ON(!i915_request_is_active(rq[A1]));
10691071 GEM_BUG_ON(!i915_request_is_active(rq[B1]));
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c+1−1
@@ -217,7 +217,7 @@ static void guc_wq_item_append(struct intel_guc *guc, · 216 unmodified lines
217217 static void guc_add_request(struct intel_guc *guc, struct i915_request *rq)
218218 {
219219 struct intel_engine_cs *engine = rq->engine;
220− u32 ctx_desc = lower_32_bits(rq->context->lrc_desc);
220+ u32 ctx_desc = rq->context->lrc.ccid;
221221 u32 ring_tail = intel_ring_set_tail(rq->ring, rq->tail) / sizeof(u64);
222222
223223 guc_wq_item_append(guc, engine->guc_id, ctx_desc,
drivers/gpu/drm/i915/gvt/display.c+44−5
@@ -208,14 +208,41 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu) · 207 unmodified lines
208208 SKL_FUSE_PG_DIST_STATUS(SKL_PG0) |
209209 SKL_FUSE_PG_DIST_STATUS(SKL_PG1) |
210210 SKL_FUSE_PG_DIST_STATUS(SKL_PG2);
211− vgpu_vreg_t(vgpu, LCPLL1_CTL) |=
212− LCPLL_PLL_ENABLE |
213− LCPLL_PLL_LOCK;
214− vgpu_vreg_t(vgpu, LCPLL2_CTL) |= LCPLL_PLL_ENABLE;
215−
211+ /*
212+ * Only 1 PIPE enabled in current vGPU display and PIPE_A is
213+ * tied to TRANSCODER_A in HW, so it's safe to assume PIPE_A,
214+ * TRANSCODER_A can be enabled. PORT_x depends on the input of
215+ * setup_virtual_dp_monitor, we can bind DPLL0 to any PORT_x
216+ * so we fixed to DPLL0 here.
217+ * Setup DPLL0: DP link clk 1620 MHz, non SSC, DP Mode
218+ */
219+ vgpu_vreg_t(vgpu, DPLL_CTRL1) =
220+ DPLL_CTRL1_OVERRIDE(DPLL_ID_SKL_DPLL0);
221+ vgpu_vreg_t(vgpu, DPLL_CTRL1) |=
222+ DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_1620, DPLL_ID_SKL_DPLL0);
223+ vgpu_vreg_t(vgpu, LCPLL1_CTL) =
224+ LCPLL_PLL_ENABLE | LCPLL_PLL_LOCK;
225+ vgpu_vreg_t(vgpu, DPLL_STATUS) = DPLL_LOCK(DPLL_ID_SKL_DPLL0);
226+ /*
227+ * Golden M/N are calculated based on:
228+ * 24 bpp, 4 lanes, 154000 pixel clk (from virtual EDID),
229+ * DP link clk 1620 MHz and non-constant_n.
230+ * TODO: calculate DP link symbol clk and stream clk m/n.
231+ */
232+ vgpu_vreg_t(vgpu, PIPE_DATA_M1(TRANSCODER_A)) = 63 << TU_SIZE_SHIFT;
233+ vgpu_vreg_t(vgpu, PIPE_DATA_M1(TRANSCODER_A)) |= 0x5b425e;
234+ vgpu_vreg_t(vgpu, PIPE_DATA_N1(TRANSCODER_A)) = 0x800000;
235+ vgpu_vreg_t(vgpu, PIPE_LINK_M1(TRANSCODER_A)) = 0x3cd6e;
236+ vgpu_vreg_t(vgpu, PIPE_LINK_N1(TRANSCODER_A)) = 0x80000;
216237 }
217238
218239 if (intel_vgpu_has_monitor_on_port(vgpu, PORT_B)) {
240+ vgpu_vreg_t(vgpu, DPLL_CTRL2) &=
241+ ~DPLL_CTRL2_DDI_CLK_OFF(PORT_B);
242+ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
243+ DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_B);
244+ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
245+ DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_B);
219246 vgpu_vreg_t(vgpu, SFUSE_STRAP) |= SFUSE_STRAP_DDIB_DETECTED;
220247 vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &=
221248 ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
@@ -236,6 +263,12 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu) · 14 unmodified lines
236263 }
237264
238265 if (intel_vgpu_has_monitor_on_port(vgpu, PORT_C)) {
266+ vgpu_vreg_t(vgpu, DPLL_CTRL2) &=
267+ ~DPLL_CTRL2_DDI_CLK_OFF(PORT_C);
268+ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
269+ DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_C);
270+ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
271+ DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_C);
239272 vgpu_vreg_t(vgpu, SDEISR) |= SDE_PORTC_HOTPLUG_CPT;
240273 vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &=
241274 ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
@@ -256,6 +289,12 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu) · 14 unmodified lines
256289 }
257290
258291 if (intel_vgpu_has_monitor_on_port(vgpu, PORT_D)) {
292+ vgpu_vreg_t(vgpu, DPLL_CTRL2) &=
293+ ~DPLL_CTRL2_DDI_CLK_OFF(PORT_D);
294+ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
295+ DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_D);
296+ vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
297+ DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_D);
259298 vgpu_vreg_t(vgpu, SDEISR) |= SDE_PORTD_HOTPLUG_CPT;
260299 vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &=
261300 ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
drivers/gpu/drm/i915/gvt/scheduler.c+7−3
@@ -290,7 +290,7 @@ static void · 289 unmodified lines
290290 shadow_context_descriptor_update(struct intel_context *ce,
291291 struct intel_vgpu_workload *workload)
292292 {
293− u64 desc = ce->lrc_desc;
293+ u64 desc = ce->lrc.desc;
294294
295295 /*
296296 * Update bits 0-11 of the context descriptor which includes flags
@@ -300,7 +300,7 @@ shadow_context_descriptor_update(struct intel_context *ce, · 3 unmodified lines
300300 desc |= (u64)workload->ctx_desc.addressing_mode <<
301301 GEN8_CTX_ADDRESSING_MODE_SHIFT;
302302
303− ce->lrc_desc = desc;
303+ ce->lrc.desc = desc;
304304 }
305305
306306 static int copy_workload_to_ring_buffer(struct intel_vgpu_workload *workload)
@@ -379,7 +379,11 @@ static void set_context_ppgtt_from_shadow(struct intel_vgpu_workload *workload, · 72 unmodified lines
379379 for (i = 0; i < GVT_RING_CTX_NR_PDPS; i++) {
380380 struct i915_page_directory * const pd =
381381 i915_pd_entry(ppgtt->pd, i);
382−
382+ /* skip now as current i915 ppgtt alloc won't allocate
383+ top level pdp for non 4-level table, won't impact
384+ shadow ppgtt. */
385+ if (!pd)
386+ break;
383387 px_dma(pd) = mm->ppgtt_mm.shadow_pdps[i];
384388 }
385389 }
drivers/gpu/drm/i915/i915_gem_evict.c+12−14
@@ -128,6 +128,13 @@ search_again: · 127 unmodified lines
128128 active = NULL;
129129 INIT_LIST_HEAD(&eviction_list);
130130 list_for_each_entry_safe(vma, next, &vm->bound_list, vm_link) {
131+ if (vma == active) { /* now seen this vma twice */
132+ if (flags & PIN_NONBLOCK)
133+ break;
134+
135+ active = ERR_PTR(-EAGAIN);
136+ }
137+
131138 /*
132139 * We keep this list in a rough least-recently scanned order
133140 * of active elements (inactive elements are cheap to reap).
@@ -143,21 +150,12 @@ search_again: · 9 unmodified lines
143150 * To notice when we complete one full cycle, we record the
144151 * first active element seen, before moving it to the tail.
145152 */
146− if (i915_vma_is_active(vma)) {
147− if (vma == active) {
148− if (flags & PIN_NONBLOCK)
149− break;
150−
151− active = ERR_PTR(-EAGAIN);
152− }
153−
154− if (active != ERR_PTR(-EAGAIN)) {
155− if (!active)
156− active = vma;
153+ if (active != ERR_PTR(-EAGAIN) && i915_vma_is_active(vma)) {
154+ if (!active)
155+ active = vma;
157156
158− list_move_tail(&vma->vm_link, &vm->bound_list);
159− continue;
160− }
157+ list_move_tail(&vma->vm_link, &vm->bound_list);
158+ continue;
161159 }
162160
163161 if (mark_free(&scan, vma, flags, &eviction_list))
drivers/gpu/drm/i915/i915_gpu_error.c+7−5
@@ -1207,8 +1207,6 @@ static void engine_record_registers(struct intel_engine_coredump *ee) · 1206 unmodified lines
12071207 static void record_request(const struct i915_request *request,
12081208 struct i915_request_coredump *erq)
12091209 {
1210− const struct i915_gem_context *ctx;
1211−
12121210 erq->flags = request->fence.flags;
12131211 erq->context = request->fence.context;
12141212 erq->seqno = request->fence.seqno;
@@ -1219,9 +1217,13 @@ static void record_request(const struct i915_request *request, · 4 unmodified lines
12191217
12201218 erq->pid = 0;
12211219 rcu_read_lock();
1222− ctx = rcu_dereference(request->context->gem_context);
1223− if (ctx)
1224− erq->pid = pid_nr(ctx->pid);
1220+ if (!intel_context_is_closed(request->context)) {
1221+ const struct i915_gem_context *ctx;
1222+
1223+ ctx = rcu_dereference(request->context->gem_context);
1224+ if (ctx)
1225+ erq->pid = pid_nr(ctx->pid);
1226+ }
12251227 rcu_read_unlock();
12261228 }
12271229
drivers/gpu/drm/i915/i915_irq.c+3−13
@@ -3361,7 +3361,7 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv) · 3360 unmodified lines
33613361 u32 de_pipe_masked = gen8_de_pipe_fault_mask(dev_priv) |
33623362 GEN8_PIPE_CDCLK_CRC_DONE;
33633363 u32 de_pipe_enables;
3364− u32 de_port_masked = GEN8_AUX_CHANNEL_A;
3364+ u32 de_port_masked = gen8_de_port_aux_mask(dev_priv);
33653365 u32 de_port_enables;
33663366 u32 de_misc_masked = GEN8_DE_EDP_PSR;
33673367 enum pipe pipe;
@@ -3369,18 +3369,8 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv) · 1 unmodified line
33693369 if (INTEL_GEN(dev_priv) <= 10)
33703370 de_misc_masked |= GEN8_DE_MISC_GSE;
33713371
3372− if (INTEL_GEN(dev_priv) >= 9) {
3373− de_port_masked |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
3374− GEN9_AUX_CHANNEL_D;
3375− if (IS_GEN9_LP(dev_priv))
3376− de_port_masked |= BXT_DE_PORT_GMBUS;
3377− }
3378−
3379− if (INTEL_GEN(dev_priv) >= 11)
3380− de_port_masked |= ICL_AUX_CHANNEL_E;
3381−
3382− if (IS_CNL_WITH_PORT_F(dev_priv) || INTEL_GEN(dev_priv) >= 11)
3383− de_port_masked |= CNL_AUX_CHANNEL_F;
3372+ if (IS_GEN9_LP(dev_priv))
3373+ de_port_masked |= BXT_DE_PORT_GMBUS;
33843374
33853375 de_pipe_enables = de_pipe_masked | GEN8_PIPE_VBLANK |
33863376 GEN8_PIPE_FIFO_UNDERRUN;
drivers/gpu/drm/i915/i915_perf.c+2−4
@@ -1310,8 +1310,7 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream) · 1309 unmodified lines
13101310 * dropped by GuC. They won't be part of the context
13111311 * ID in the OA reports, so squash those lower bits.
13121312 */
1313− stream->specific_ctx_id =
1314− lower_32_bits(ce->lrc_desc) >> 12;
1313+ stream->specific_ctx_id = ce->lrc.lrca >> 12;
13151314
13161315 /*
13171316 * GuC uses the top bit to signal proxy submission, so
@@ -1328,11 +1327,10 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream) · 10 unmodified lines
13281327 ((1U << GEN11_SW_CTX_ID_WIDTH) - 1) << (GEN11_SW_CTX_ID_SHIFT - 32);
13291328 /*
13301329 * Pick an unused context id
1331− * 0 - (NUM_CONTEXT_TAG - 1) are used by other contexts
1330+ * 0 - BITS_PER_LONG are used by other contexts
13321331 * GEN12_MAX_CONTEXT_HW_ID (0x7ff) is used by idle context
13331332 */
13341333 stream->specific_ctx_id = (GEN12_MAX_CONTEXT_HW_ID - 1) << (GEN11_SW_CTX_ID_SHIFT - 32);
1335− BUILD_BUG_ON((GEN12_MAX_CONTEXT_HW_ID - 1) < NUM_CONTEXT_TAG);
13361334 break;
13371335 }
13381336
drivers/gpu/drm/i915/i915_reg.h+1−0
@@ -3094,6 +3094,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) · 3093 unmodified lines
30943094 #define GT_BSD_CS_ERROR_INTERRUPT (1 << 15)
30953095 #define GT_BSD_USER_INTERRUPT (1 << 12)
30963096 #define GT_RENDER_L3_PARITY_ERROR_INTERRUPT_S1 (1 << 11) /* hsw+; rsvd on snb, ivb, vlv */
3097+#define GT_WAIT_SEMAPHORE_INTERRUPT REG_BIT(11) /* bdw+ */
30973098 #define GT_CONTEXT_SWITCH_INTERRUPT (1 << 8)
30983099 #define GT_RENDER_L3_PARITY_ERROR_INTERRUPT (1 << 5) /* !snb */
30993100 #define GT_RENDER_PIPECTL_NOTIFY_INTERRUPT (1 << 4)
drivers/gpu/drm/i915/i915_request.c+9−3
@@ -1017,11 +1017,15 @@ i915_request_await_request(struct i915_request *to, struct i915_request *from) · 1016 unmodified lines
10171017 GEM_BUG_ON(to == from);
10181018 GEM_BUG_ON(to->timeline == from->timeline);
10191019
1020− if (i915_request_completed(from))
1020+ if (i915_request_completed(from)) {
1021+ i915_sw_fence_set_error_once(&to->submit, from->fence.error);
10211022 return 0;
1023+ }
10221024
10231025 if (to->engine->schedule) {
1024− ret = i915_sched_node_add_dependency(&to->sched, &from->sched);
1026+ ret = i915_sched_node_add_dependency(&to->sched,
1027+ &from->sched,
1028+ I915_DEPENDENCY_EXTERNAL);
10251029 if (ret < 0)
10261030 return ret;
10271031 }
@@ -1183,7 +1187,9 @@ __i915_request_await_execution(struct i915_request *to, · 155 unmodified lines
11831187
11841188 /* Couple the dependency tree for PI on this exposed to->fence */
11851189 if (to->engine->schedule) {
1186− err = i915_sched_node_add_dependency(&to->sched, &from->sched);
1190+ err = i915_sched_node_add_dependency(&to->sched,
1191+ &from->sched,
1192+ I915_DEPENDENCY_WEAK);
11871193 if (err < 0)
11881194 return err;
11891195 }
drivers/gpu/drm/i915/i915_scheduler.c+3−3
@@ -456,7 +456,8 @@ bool __i915_sched_node_add_dependency(struct i915_sched_node *node, · 455 unmodified lines
456456 }
457457
458458 int i915_sched_node_add_dependency(struct i915_sched_node *node,
459− struct i915_sched_node *signal)
459+ struct i915_sched_node *signal,
460+ unsigned long flags)
460461 {
461462 struct i915_dependency *dep;
462463
@@ -465,8 +466,7 @@ int i915_sched_node_add_dependency(struct i915_sched_node *node, · 2 unmodified lines
465466 return -ENOMEM;
466467
467468 if (!__i915_sched_node_add_dependency(node, signal, dep,
468− I915_DEPENDENCY_EXTERNAL |
469− I915_DEPENDENCY_ALLOC))
469+ flags | I915_DEPENDENCY_ALLOC))
470470 i915_dependency_free(dep);
471471
472472 return 0;
drivers/gpu/drm/i915/i915_scheduler.h+2−1
@@ -34,7 +34,8 @@ bool __i915_sched_node_add_dependency(struct i915_sched_node *node, · 33 unmodified lines
3434 unsigned long flags);
3535
3636 int i915_sched_node_add_dependency(struct i915_sched_node *node,
37− struct i915_sched_node *signal);
37+ struct i915_sched_node *signal,
38+ unsigned long flags);
3839
3940 void i915_sched_node_fini(struct i915_sched_node *node);
4041
drivers/gpu/drm/i915/i915_scheduler_types.h+1−0
@@ -78,6 +78,7 @@ struct i915_dependency { · 77 unmodified lines
7878 unsigned long flags;
7979 #define I915_DEPENDENCY_ALLOC BIT(0)
8080 #define I915_DEPENDENCY_EXTERNAL BIT(1)
81+#define I915_DEPENDENCY_WEAK BIT(2)
8182 };
8283
8384 #endif /* _I915_SCHEDULER_TYPES_H_ */
drivers/gpu/drm/i915/i915_vma.c+9−16
@@ -1228,18 +1228,6 @@ int __i915_vma_unbind(struct i915_vma *vma) · 1227 unmodified lines
12281228
12291229 lockdep_assert_held(&vma->vm->mutex);
12301230
1231− /*
1232− * First wait upon any activity as retiring the request may
1233− * have side-effects such as unpinning or even unbinding this vma.
1234− *
1235− * XXX Actually waiting under the vm->mutex is a hinderance and
1236− * should be pipelined wherever possible. In cases where that is
1237− * unavoidable, we should lift the wait to before the mutex.
1238− */
1239− ret = i915_vma_sync(vma);
1240− if (ret)
1241− return ret;
1242−
12431231 if (i915_vma_is_pinned(vma)) {
12441232 vma_print_allocator(vma, "is pinned");
12451233 return -EAGAIN;
@@ -1313,15 +1301,20 @@ int i915_vma_unbind(struct i915_vma *vma) · 67 unmodified lines
13131301 if (!drm_mm_node_allocated(&vma->node))
13141302 return 0;
13151303
1316− if (i915_vma_is_bound(vma, I915_VMA_GLOBAL_BIND))
1317− /* XXX not always required: nop_clear_range */
1318− wakeref = intel_runtime_pm_get(&vm->i915->runtime_pm);
1319−
13201304 /* Optimistic wait before taking the mutex */
13211305 err = i915_vma_sync(vma);
13221306 if (err)
13231307 goto out_rpm;
13241308
1309+ if (i915_vma_is_pinned(vma)) {
1310+ vma_print_allocator(vma, "is pinned");
1311+ return -EAGAIN;
1312+ }
1313+
1314+ if (i915_vma_is_bound(vma, I915_VMA_GLOBAL_BIND))
1315+ /* XXX not always required: nop_clear_range */
1316+ wakeref = intel_runtime_pm_get(&vm->i915->runtime_pm);
1317+
13251318 err = mutex_lock_interruptible(&vm->mutex);
13261319 if (err)
13271320 goto out_rpm;
drivers/gpu/drm/i915/intel_pm.c+1−1
@@ -4992,7 +4992,7 @@ static void skl_compute_plane_wm(const struct intel_crtc_state *crtc_state, · 4991 unmodified lines
49924992 * WaIncreaseLatencyIPCEnabled: kbl,cfl
49934993 * Display WA #1141: kbl,cfl
49944994 */
4995− if ((IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv)) ||
4995+ if ((IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv)) &&
49964996 dev_priv->ipc_enabled)
49974997 latency += 4;
49984998
drivers/gpu/drm/i915/selftests/i915_vma.c+1−1
@@ -173,7 +173,7 @@ static int igt_vma_create(void *arg) · 172 unmodified lines
173173 }
174174
175175 nc = 0;
176− for_each_prime_number(num_ctx, 2 * NUM_CONTEXT_TAG) {
176+ for_each_prime_number(num_ctx, 2 * BITS_PER_LONG) {
177177 for (; nc < num_ctx; nc++) {
178178 ctx = mock_context(i915, "mock");
179179 if (!ctx)
drivers/gpu/drm/meson/meson_drv.c+1−3
@@ -412,9 +412,7 @@ static int __maybe_unused meson_drv_pm_resume(struct device *dev) · 411 unmodified lines
412412 if (priv->afbcd.ops)
413413 priv->afbcd.ops->init(priv);
414414
415− drm_mode_config_helper_resume(priv->drm);
416−
417− return 0;
415+ return drm_mode_config_helper_resume(priv->drm);
418416 }
419417
420418 static int compare_of(struct device *dev, void *data)
drivers/gpu/drm/tegra/drm.c+2−1
@@ -1039,6 +1039,7 @@ void tegra_drm_free(struct tegra_drm *tegra, size_t size, void *virt, · 1038 unmodified lines
10391039
10401040 static bool host1x_drm_wants_iommu(struct host1x_device *dev)
10411041 {
1042+ struct host1x *host1x = dev_get_drvdata(dev->dev.parent);
10421043 struct iommu_domain *domain;
10431044
10441045 /*
@@ -1076,7 +1077,7 @@ static bool host1x_drm_wants_iommu(struct host1x_device *dev) · 31 unmodified lines
10761077 * sufficient and whether or not the host1x is attached to an IOMMU
10771078 * doesn't matter.
10781079 */
1079− if (!domain && dma_get_mask(dev->dev.parent) <= DMA_BIT_MASK(32))
1080+ if (!domain && host1x_get_dma_mask(host1x) <= DMA_BIT_MASK(32))
10801081 return true;
10811082
10821083 return domain != NULL;
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h+1−1
@@ -850,7 +850,7 @@ extern void vmw_bo_bo_free(struct ttm_buffer_object *bo); · 849 unmodified lines
850850 extern int vmw_bo_init(struct vmw_private *dev_priv,
851851 struct vmw_buffer_object *vmw_bo,
852852 size_t size, struct ttm_placement *placement,
853− bool interuptable,
853+ bool interruptible,
854854 void (*bo_free)(struct ttm_buffer_object *bo));
855855 extern int vmw_user_bo_verify_access(struct ttm_buffer_object *bo,
856856 struct ttm_object_file *tfile);
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c+1−1
@@ -515,7 +515,7 @@ bool vmw_fence_obj_signaled(struct vmw_fence_obj *fence) · 514 unmodified lines
515515 struct vmw_fence_manager *fman = fman_from_fence(fence);
516516
517517 if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->base.flags))
518− return 1;
518+ return true;
519519
520520 vmw_fences_update(fman);
521521
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c+1−1
@@ -1651,7 +1651,7 @@ vmw_gb_surface_reference_internal(struct drm_device *dev, · 1650 unmodified lines
16511651 struct vmw_surface_metadata *metadata;
16521652 struct ttm_base_object *base;
16531653 uint32_t backup_handle;
1654− int ret = -EINVAL;
1654+ int ret;
16551655
16561656 ret = vmw_surface_handle_reference(dev_priv, file_priv, req->sid,
16571657 req->handle_type, &base);
drivers/gpu/host1x/dev.c+55−4
@@ -192,17 +192,55 @@ static void host1x_setup_sid_table(struct host1x *host) · 191 unmodified lines
192192 }
193193 }
194194
195+static bool host1x_wants_iommu(struct host1x *host1x)
196+{
197+ /*
198+ * If we support addressing a maximum of 32 bits of physical memory
199+ * and if the host1x firewall is enabled, there's no need to enable
200+ * IOMMU support. This can happen for example on Tegra20, Tegra30
201+ * and Tegra114.
202+ *
203+ * Tegra124 and later can address up to 34 bits of physical memory and
204+ * many platforms come equipped with more than 2 GiB of system memory,
205+ * which requires crossing the 4 GiB boundary. But there's a catch: on
206+ * SoCs before Tegra186 (i.e. Tegra124 and Tegra210), the host1x can
207+ * only address up to 32 bits of memory in GATHER opcodes, which means
208+ * that command buffers need to either be in the first 2 GiB of system
209+ * memory (which could quickly lead to memory exhaustion), or command
210+ * buffers need to be treated differently from other buffers (which is
211+ * not possible with the current ABI).
212+ *
213+ * A third option is to use the IOMMU in these cases to make sure all
214+ * buffers will be mapped into a 32-bit IOVA space that host1x can
215+ * address. This allows all of the system memory to be used and works
216+ * within the limitations of the host1x on these SoCs.
217+ *
218+ * In summary, default to enable IOMMU on Tegra124 and later. For any
219+ * of the earlier SoCs, only use the IOMMU for additional safety when
220+ * the host1x firewall is disabled.
221+ */
222+ if (host1x->info->dma_mask <= DMA_BIT_MASK(32)) {
223+ if (IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL))
224+ return false;
225+ }
226+
227+ return true;
228+}
229+
195230 static struct iommu_domain *host1x_iommu_attach(struct host1x *host)
196231 {
197232 struct iommu_domain *domain = iommu_get_domain_for_dev(host->dev);
198233 int err;
199234
200235 /*
201− * If the host1x firewall is enabled, there's no need to enable IOMMU
202− * support. Similarly, if host1x is already attached to an IOMMU (via
203− * the DMA API), don't try to attach again.
236+ * We may not always want to enable IOMMU support (for example if the
237+ * host1x firewall is already enabled and we don't support addressing
238+ * more than 32 bits of physical memory), so check for that first.
239+ *
240+ * Similarly, if host1x is already attached to an IOMMU (via the DMA
241+ * API), don't try to attach again.
204242 */
205− if (IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL) || domain)
243+ if (!host1x_wants_iommu(host) || domain)
206244 return domain;
207245
208246 host->group = iommu_group_get(host->dev);
@@ -502,6 +540,19 @@ static void __exit tegra_host1x_exit(void) · 293 unmodified lines
502540 }
503541 module_exit(tegra_host1x_exit);
504542
543+/**
544+ * host1x_get_dma_mask() - query the supported DMA mask for host1x
545+ * @host1x: host1x instance
546+ *
547+ * Note that this returns the supported DMA mask for host1x, which can be
548+ * different from the applicable DMA mask under certain circumstances.
549+ */
550+u64 host1x_get_dma_mask(struct host1x *host1x)
551+{
552+ return host1x->info->dma_mask;
553+}
554+EXPORT_SYMBOL(host1x_get_dma_mask);
555+
505556 MODULE_AUTHOR("Thierry Reding <thierry.reding@avionic-design.de>");
506557 MODULE_AUTHOR("Terje Bergstrom <tbergstrom@nvidia.com>");
507558 MODULE_DESCRIPTION("Host1x driver for Tegra products");
drivers/hwmon/da9052-hwmon.c+2−2
@@ -244,9 +244,9 @@ static ssize_t da9052_tsi_show(struct device *dev, · 243 unmodified lines
244244 int channel = to_sensor_dev_attr(devattr)->index;
245245 int ret;
246246
247− mutex_lock(&hwmon->hwmon_lock);
247+ mutex_lock(&hwmon->da9052->auxadc_lock);
248248 ret = __da9052_read_tsi(dev, channel);
249− mutex_unlock(&hwmon->hwmon_lock);
249+ mutex_unlock(&hwmon->da9052->auxadc_lock);
250250
251251 if (ret < 0)
252252 return ret;
drivers/hwmon/drivetemp.c+1−1
@@ -346,7 +346,7 @@ static int drivetemp_identify_sata(struct drivetemp_data *st) · 345 unmodified lines
346346 st->have_temp_highest = temp_is_valid(buf[SCT_STATUS_TEMP_HIGHEST]);
347347
348348 if (!have_sct_data_table)
349− goto skip_sct;
349+ goto skip_sct_data;
350350
351351 /* Request and read temperature history table */
352352 memset(buf, '\0', sizeof(st->smartdata));
drivers/hwmon/nct7904.c+11−1
@@ -41,6 +41,7 @@ · 40 unmodified lines
4141 #define FANCTL_MAX 4 /* Counted from 1 */
4242 #define TCPU_MAX 8 /* Counted from 1 */
4343 #define TEMP_MAX 4 /* Counted from 1 */
44+#define SMI_STS_MAX 10 /* Counted from 1 */
4445
4546 #define VT_ADC_CTRL0_REG 0x20 /* Bank 0 */
4647 #define VT_ADC_CTRL1_REG 0x21 /* Bank 0 */
@@ -361,6 +362,7 @@ static int nct7904_read_temp(struct device *dev, u32 attr, int channel, · 314 unmodified lines
361362 struct nct7904_data *data = dev_get_drvdata(dev);
362363 int ret, temp;
363364 unsigned int reg1, reg2, reg3;
365+ s8 temps;
364366
365367 switch (attr) {
366368 case hwmon_temp_input:
@@ -466,7 +468,8 @@ static int nct7904_read_temp(struct device *dev, u32 attr, int channel, · 99 unmodified lines
466468
467469 if (ret < 0)
468470 return ret;
469− *val = ret * 1000;
471+ temps = ret;
472+ *val = temps * 1000;
470473 return 0;
471474 }
472475
@@ -1009,6 +1012,13 @@ static int nct7904_probe(struct i2c_client *client, · 536 unmodified lines
10091012 data->fan_mode[i] = ret;
10101013 }
10111014
1015+ /* Read all of SMI status register to clear alarms */
1016+ for (i = 0; i < SMI_STS_MAX; i++) {
1017+ ret = nct7904_read_reg(data, BANK_0, SMI_STS1_REG + i);
1018+ if (ret < 0)
1019+ return ret;
1020+ }
1021+
10121022 hwmon_dev =
10131023 devm_hwmon_device_register_with_info(dev, client->name, data,
10141024 &nct7904_chip_info, NULL);
drivers/hwtracing/coresight/coresight-cti-platform.c+2−2
@@ -120,7 +120,7 @@ static int cti_plat_create_v8_etm_connection(struct device *dev, · 119 unmodified lines
120120
121121 /* Can optionally have an etm node - return if not */
122122 cs_fwnode = fwnode_find_reference(root_fwnode, CTI_DT_CSDEV_ASSOC, 0);
123− if (IS_ERR_OR_NULL(cs_fwnode))
123+ if (IS_ERR(cs_fwnode))
124124 return 0;
125125
126126 /* allocate memory */
@@ -393,7 +393,7 @@ static int cti_plat_create_connection(struct device *dev, · 266 unmodified lines
393393 /* associated device ? */
394394 cs_fwnode = fwnode_find_reference(fwnode,
395395 CTI_DT_CSDEV_ASSOC, 0);
396− if (!IS_ERR_OR_NULL(cs_fwnode)) {
396+ if (!IS_ERR(cs_fwnode)) {
397397 assoc_name = cti_plat_get_csdev_or_node_name(cs_fwnode,
398398 &csdev);
399399 fwnode_handle_put(cs_fwnode);
drivers/i2c/algos/i2c-algo-pca.c+1−1
@@ -542,7 +542,7 @@ int i2c_pca_add_numbered_bus(struct i2c_adapter *adap) · 541 unmodified lines
542542 EXPORT_SYMBOL(i2c_pca_add_numbered_bus);
543543
544544 MODULE_AUTHOR("Ian Campbell <icampbell@arcom.com>, "
545− "Wolfram Sang <w.sang@pengutronix.de>");
545+ "Wolfram Sang <kernel@pengutronix.de>");
546546 MODULE_DESCRIPTION("I2C-Bus PCA9564/PCA9665 algorithm");
547547 MODULE_LICENSE("GPL");
548548
drivers/i2c/busses/i2c-altera.c+9−1
@@ -70,6 +70,7 @@ · 69 unmodified lines
7070 * @isr_mask: cached copy of local ISR enables.
7171 * @isr_status: cached copy of local ISR status.
7272 * @lock: spinlock for IRQ synchronization.
73+ * @isr_mutex: mutex for IRQ thread.
7374 */
7475 struct altr_i2c_dev {
7576 void __iomem *base;
@@ -86,6 +87,7 @@ struct altr_i2c_dev { · 10 unmodified lines
8687 u32 isr_mask;
8788 u32 isr_status;
8889 spinlock_t lock; /* IRQ synchronization */
90+ struct mutex isr_mutex;
8991 };
9092
9193 static void
@@ -245,10 +247,11 @@ static irqreturn_t altr_i2c_isr(int irq, void *_dev) · 153 unmodified lines
245247 struct altr_i2c_dev *idev = _dev;
246248 u32 status = idev->isr_status;
247249
250+ mutex_lock(&idev->isr_mutex);
248251 if (!idev->msg) {
249252 dev_warn(idev->dev, "unexpected interrupt\n");
250253 altr_i2c_int_clear(idev, ALTR_I2C_ALL_IRQ);
251− return IRQ_HANDLED;
254+ goto out;
252255 }
253256 read = (idev->msg->flags & I2C_M_RD) != 0;
254257
@@ -301,6 +304,8 @@ static irqreturn_t altr_i2c_isr(int irq, void *_dev) · 46 unmodified lines
301304 complete(&idev->msg_complete);
302305 dev_dbg(idev->dev, "Message Complete\n");
303306 }
307+out:
308+ mutex_unlock(&idev->isr_mutex);
304309
305310 return IRQ_HANDLED;
306311 }
@@ -312,6 +317,7 @@ static int altr_i2c_xfer_msg(struct altr_i2c_dev *idev, struct i2c_msg *msg) · 5 unmodified lines
312317 u32 value;
313318 u8 addr = i2c_8bit_addr_from_msg(msg);
314319
320+ mutex_lock(&idev->isr_mutex);
315321 idev->msg = msg;
316322 idev->msg_len = msg->len;
317323 idev->buf = msg->buf;
@@ -336,6 +342,7 @@ static int altr_i2c_xfer_msg(struct altr_i2c_dev *idev, struct i2c_msg *msg) · 18 unmodified lines
336342 altr_i2c_int_enable(idev, imask, true);
337343 altr_i2c_fill_tx_fifo(idev);
338344 }
345+ mutex_unlock(&idev->isr_mutex);
339346
340347 time_left = wait_for_completion_timeout(&idev->msg_complete,
341348 ALTR_I2C_XFER_TIMEOUT);
@@ -409,6 +416,7 @@ static int altr_i2c_probe(struct platform_device *pdev) · 67 unmodified lines
409416 idev->dev = &pdev->dev;
410417 init_completion(&idev->msg_complete);
411418 spin_lock_init(&idev->lock);
419+ mutex_init(&idev->isr_mutex);
412420
413421 ret = device_property_read_u32(idev->dev, "fifo-size",
414422 &idev->fifo_size);
drivers/i2c/busses/i2c-at91-master.c+17−3
@@ -845,6 +845,18 @@ static int at91_init_twi_recovery_info(struct platform_device *pdev, · 844 unmodified lines
845845 PINCTRL_STATE_DEFAULT);
846846 dev->pinctrl_pins_gpio = pinctrl_lookup_state(dev->pinctrl,
847847 "gpio");
848+ if (IS_ERR(dev->pinctrl_pins_default) ||
849+ IS_ERR(dev->pinctrl_pins_gpio)) {
850+ dev_info(&pdev->dev, "pinctrl states incomplete for recovery\n");
851+ return -EINVAL;
852+ }
853+
854+ /*
855+ * pins will be taken as GPIO, so we might as well inform pinctrl about
856+ * this and move the state to GPIO
857+ */
858+ pinctrl_select_state(dev->pinctrl, dev->pinctrl_pins_gpio);
859+
848860 rinfo->sda_gpiod = devm_gpiod_get(&pdev->dev, "sda", GPIOD_IN);
849861 if (PTR_ERR(rinfo->sda_gpiod) == -EPROBE_DEFER)
850862 return -EPROBE_DEFER;
@@ -855,9 +867,7 @@ static int at91_init_twi_recovery_info(struct platform_device *pdev, · 4 unmodified lines
855867 return -EPROBE_DEFER;
856868
857869 if (IS_ERR(rinfo->sda_gpiod) ||
858− IS_ERR(rinfo->scl_gpiod) ||
859− IS_ERR(dev->pinctrl_pins_default) ||
860− IS_ERR(dev->pinctrl_pins_gpio)) {
870+ IS_ERR(rinfo->scl_gpiod)) {
861871 dev_info(&pdev->dev, "recovery information incomplete\n");
862872 if (!IS_ERR(rinfo->sda_gpiod)) {
863873 gpiod_put(rinfo->sda_gpiod);
@@ -867,9 +877,13 @@ static int at91_init_twi_recovery_info(struct platform_device *pdev, · 3 unmodified lines
867877 gpiod_put(rinfo->scl_gpiod);
868878 rinfo->scl_gpiod = NULL;
869879 }
880+ pinctrl_select_state(dev->pinctrl, dev->pinctrl_pins_default);
870881 return -EINVAL;
871882 }
872883
884+ /* change the state of the pins back to their default state */
885+ pinctrl_select_state(dev->pinctrl, dev->pinctrl_pins_default);
886+
873887 dev_info(&pdev->dev, "using scl, sda for recovery\n");
874888
875889 rinfo->prepare_recovery = at91_prepare_twi_recovery;
drivers/i2c/i2c-core-base.c+17−7
@@ -7,7 +7,7 @@ · 6 unmodified lines
77 * Mux support by Rodolfo Giometti <giometti@enneenne.com> and
88 * Michael Lawnick <michael.lawnick.ext@nsn.com>
99 *
10− * Copyright (C) 2013-2017 Wolfram Sang <wsa@the-dreams.de>
10+ * Copyright (C) 2013-2017 Wolfram Sang <wsa@kernel.org>
1111 */
1212
1313 #define pr_fmt(fmt) "i2c-core: " fmt
@@ -338,8 +338,10 @@ static int i2c_device_probe(struct device *dev) · 324 unmodified lines
338338 } else if (ACPI_COMPANION(dev)) {
339339 irq = i2c_acpi_get_irq(client);
340340 }
341− if (irq == -EPROBE_DEFER)
342− return irq;
341+ if (irq == -EPROBE_DEFER) {
342+ status = irq;
343+ goto put_sync_adapter;
344+ }
343345
344346 if (irq < 0)
345347 irq = 0;
@@ -353,15 +355,19 @@ static int i2c_device_probe(struct device *dev) · 7 unmodified lines
353355 */
354356 if (!driver->id_table &&
355357 !i2c_acpi_match_device(dev->driver->acpi_match_table, client) &&
356− !i2c_of_match_device(dev->driver->of_match_table, client))
357− return -ENODEV;
358+ !i2c_of_match_device(dev->driver->of_match_table, client)) {
359+ status = -ENODEV;
360+ goto put_sync_adapter;
361+ }
358362
359363 if (client->flags & I2C_CLIENT_WAKE) {
360364 int wakeirq;
361365
362366 wakeirq = of_irq_get_byname(dev->of_node, "wakeup");
363− if (wakeirq == -EPROBE_DEFER)
364− return wakeirq;
367+ if (wakeirq == -EPROBE_DEFER) {
368+ status = wakeirq;
369+ goto put_sync_adapter;
370+ }
365371
366372 device_init_wakeup(&client->dev, true);
367373
@@ -408,6 +414,10 @@ err_detach_pm_domain: · 40 unmodified lines
408414 err_clear_wakeup_irq:
409415 dev_pm_clear_wake_irq(&client->dev);
410416 device_init_wakeup(&client->dev, false);
417+put_sync_adapter:
418+ if (client->flags & I2C_CLIENT_HOST_NOTIFY)
419+ pm_runtime_put_sync(&client->adapter->dev);
420+
411421 return status;
412422 }
413423
drivers/i2c/i2c-core-of.c+1−1
@@ -5,7 +5,7 @@ · 4 unmodified lines
55 * Copyright (C) 2008 Jochen Friedrich <jochen@scram.de>
66 * based on a previous patch from Jon Smirl <jonsmirl@gmail.com>
77 *
8− * Copyright (C) 2013, 2018 Wolfram Sang <wsa@the-dreams.de>
8+ * Copyright (C) 2013, 2018 Wolfram Sang <wsa@kernel.org>
99 */
1010
1111 #include <dt-bindings/i2c/i2c.h>
drivers/i2c/muxes/i2c-demux-pinctrl.c+1−0
@@ -272,6 +272,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) · 271 unmodified lines
272272 err_rollback_available:
273273 device_remove_file(&pdev->dev, &dev_attr_available_masters);
274274 err_rollback:
275+ i2c_demux_deactivate_master(priv);
275276 for (j = 0; j < i; j++) {
276277 of_node_put(priv->chan[j].parent_np);
277278 of_changeset_destroy(&priv->chan[j].chgset);
drivers/iio/accel/sca3000.c+1−1
@@ -980,7 +980,7 @@ static int sca3000_read_data(struct sca3000_state *st, · 979 unmodified lines
980980 st->tx[0] = SCA3000_READ_REG(reg_address_high);
981981 ret = spi_sync_transfer(st->us, xfer, ARRAY_SIZE(xfer));
982982 if (ret) {
983− dev_err(get_device(&st->us->dev), "problem reading register");
983+ dev_err(&st->us->dev, "problem reading register\n");
984984 return ret;
985985 }
986986
drivers/iio/adc/stm32-adc.c+4−4
@@ -1812,18 +1812,18 @@ static int stm32_adc_chan_of_init(struct iio_dev *indio_dev) · 1811 unmodified lines
18121812 return 0;
18131813 }
18141814
1815−static int stm32_adc_dma_request(struct iio_dev *indio_dev)
1815+static int stm32_adc_dma_request(struct device *dev, struct iio_dev *indio_dev)
18161816 {
18171817 struct stm32_adc *adc = iio_priv(indio_dev);
18181818 struct dma_slave_config config;
18191819 int ret;
18201820
1821− adc->dma_chan = dma_request_chan(&indio_dev->dev, "rx");
1821+ adc->dma_chan = dma_request_chan(dev, "rx");
18221822 if (IS_ERR(adc->dma_chan)) {
18231823 ret = PTR_ERR(adc->dma_chan);
18241824 if (ret != -ENODEV) {
18251825 if (ret != -EPROBE_DEFER)
1826− dev_err(&indio_dev->dev,
1826+ dev_err(dev,
18271827 "DMA channel request failed with %d\n",
18281828 ret);
18291829 return ret;
@@ -1930,7 +1930,7 @@ static int stm32_adc_probe(struct platform_device *pdev) · 100 unmodified lines
19301930 if (ret < 0)
19311931 return ret;
19321932
1933− ret = stm32_adc_dma_request(indio_dev);
1933+ ret = stm32_adc_dma_request(dev, indio_dev);
19341934 if (ret < 0)
19351935 return ret;
19361936
drivers/iio/adc/stm32-dfsdm-adc.c+11−10
@@ -62,7 +62,7 @@ enum sd_converter_type { · 61 unmodified lines
6262
6363 struct stm32_dfsdm_dev_data {
6464 int type;
65− int (*init)(struct iio_dev *indio_dev);
65+ int (*init)(struct device *dev, struct iio_dev *indio_dev);
6666 unsigned int num_channels;
6767 const struct regmap_config *regmap_cfg;
6868 };
@@ -1365,11 +1365,12 @@ static void stm32_dfsdm_dma_release(struct iio_dev *indio_dev) · 1296 unmodified lines
13651365 }
13661366 }
13671367
1368−static int stm32_dfsdm_dma_request(struct iio_dev *indio_dev)
1368+static int stm32_dfsdm_dma_request(struct device *dev,
1369+ struct iio_dev *indio_dev)
13691370 {
13701371 struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
13711372
1372− adc->dma_chan = dma_request_chan(&indio_dev->dev, "rx");
1373+ adc->dma_chan = dma_request_chan(dev, "rx");
13731374 if (IS_ERR(adc->dma_chan)) {
13741375 int ret = PTR_ERR(adc->dma_chan);
13751376
@@ -1425,7 +1426,7 @@ static int stm32_dfsdm_adc_chan_init_one(struct iio_dev *indio_dev, · 49 unmodified lines
14251426 &adc->dfsdm->ch_list[ch->channel]);
14261427 }
14271428
1428−static int stm32_dfsdm_audio_init(struct iio_dev *indio_dev)
1429+static int stm32_dfsdm_audio_init(struct device *dev, struct iio_dev *indio_dev)
14291430 {
14301431 struct iio_chan_spec *ch;
14311432 struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
@@ -1452,10 +1453,10 @@ static int stm32_dfsdm_audio_init(struct iio_dev *indio_dev) · 20 unmodified lines
14521453 indio_dev->num_channels = 1;
14531454 indio_dev->channels = ch;
14541455
1455− return stm32_dfsdm_dma_request(indio_dev);
1456+ return stm32_dfsdm_dma_request(dev, indio_dev);
14561457 }
14571458
1458−static int stm32_dfsdm_adc_init(struct iio_dev *indio_dev)
1459+static int stm32_dfsdm_adc_init(struct device *dev, struct iio_dev *indio_dev)
14591460 {
14601461 struct iio_chan_spec *ch;
14611462 struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
@@ -1499,17 +1500,17 @@ static int stm32_dfsdm_adc_init(struct iio_dev *indio_dev) · 37 unmodified lines
14991500 init_completion(&adc->completion);
15001501
15011502 /* Optionally request DMA */
1502− ret = stm32_dfsdm_dma_request(indio_dev);
1503+ ret = stm32_dfsdm_dma_request(dev, indio_dev);
15031504 if (ret) {
15041505 if (ret != -ENODEV) {
15051506 if (ret != -EPROBE_DEFER)
1506− dev_err(&indio_dev->dev,
1507+ dev_err(dev,
15071508 "DMA channel request failed with %d\n",
15081509 ret);
15091510 return ret;
15101511 }
15111512
1512− dev_dbg(&indio_dev->dev, "No DMA support\n");
1513+ dev_dbg(dev, "No DMA support\n");
15131514 return 0;
15141515 }
15151516
@@ -1622,7 +1623,7 @@ static int stm32_dfsdm_adc_probe(struct platform_device *pdev) · 106 unmodified lines
16221623 adc->dfsdm->fl_list[adc->fl_id].sync_mode = val;
16231624
16241625 adc->dev_data = dev_data;
1625− ret = dev_data->init(iio);
1626+ ret = dev_data->init(dev, iio);
16261627 if (ret < 0)
16271628 return ret;
16281629
drivers/iio/adc/ti-ads8344.c+5−3
@@ -32,16 +32,17 @@ struct ads8344 { · 31 unmodified lines
3232 u8 rx_buf[3];
3333 };
3434
35−#define ADS8344_VOLTAGE_CHANNEL(chan, si) \
35+#define ADS8344_VOLTAGE_CHANNEL(chan, addr) \
3636 { \
3737 .type = IIO_VOLTAGE, \
3838 .indexed = 1, \
3939 .channel = chan, \
4040 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
4141 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
42+ .address = addr, \
4243 }
4344
44−#define ADS8344_VOLTAGE_CHANNEL_DIFF(chan1, chan2, si) \
45+#define ADS8344_VOLTAGE_CHANNEL_DIFF(chan1, chan2, addr) \
4546 { \
4647 .type = IIO_VOLTAGE, \
4748 .indexed = 1, \
@@ -50,6 +51,7 @@ struct ads8344 { · 2 unmodified lines
5051 .differential = 1, \
5152 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
5253 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
54+ .address = addr, \
5355 }
5456
5557 static const struct iio_chan_spec ads8344_channels[] = {
@@ -105,7 +107,7 @@ static int ads8344_read_raw(struct iio_dev *iio, · 49 unmodified lines
105107 switch (mask) {
106108 case IIO_CHAN_INFO_RAW:
107109 mutex_lock(&adc->lock);
108− *value = ads8344_adc_conversion(adc, channel->scan_index,
110+ *value = ads8344_adc_conversion(adc, channel->address,
109111 channel->differential);
110112 mutex_unlock(&adc->lock);
111113 if (*value < 0)
drivers/iio/chemical/atlas-sensor.c+13−1
@@ -198,7 +198,19 @@ static const struct iio_chan_spec atlas_orp_channels[] = { · 197 unmodified lines
198198 };
199199
200200 static const struct iio_chan_spec atlas_do_channels[] = {
201− ATLAS_CONCENTRATION_CHANNEL(0, ATLAS_REG_DO_DATA),
201+ {
202+ .type = IIO_CONCENTRATION,
203+ .address = ATLAS_REG_DO_DATA,
204+ .info_mask_separate =
205+ BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
206+ .scan_index = 0,
207+ .scan_type = {
208+ .sign = 'u',
209+ .realbits = 32,
210+ .storagebits = 32,
211+ .endianness = IIO_BE,
212+ },
213+ },
202214 IIO_CHAN_SOFT_TIMESTAMP(1),
203215 {
204216 .type = IIO_TEMP,
drivers/iio/dac/vf610_dac.c+1−0
@@ -226,6 +226,7 @@ static int vf610_dac_probe(struct platform_device *pdev) · 225 unmodified lines
226226 return 0;
227227
228228 error_iio_device_register:
229+ vf610_dac_exit(info);
229230 clk_disable_unprepare(info->clk);
230231
231232 return ret;
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c+5−2
@@ -637,8 +637,10 @@ st_lsm6dsx_shub_write_raw(struct iio_dev *iio_dev, · 636 unmodified lines
637637
638638 ref_sensor = iio_priv(hw->iio_devs[ST_LSM6DSX_ID_ACC]);
639639 odr = st_lsm6dsx_check_odr(ref_sensor, val, &odr_val);
640− if (odr < 0)
641− return odr;
640+ if (odr < 0) {
641+ err = odr;
642+ goto release;
643+ }
642644
643645 sensor->ext_info.slv_odr = val;
644646 sensor->odr = odr;
@@ -653,6 +655,7 @@ st_lsm6dsx_shub_write_raw(struct iio_dev *iio_dev, · 8 unmodified lines
653655 break;
654656 }
655657
658+release:
656659 iio_device_release_direct_mode(iio_dev);
657660
658661 return err;
drivers/infiniband/core/cache.c+5−2
@@ -1553,8 +1553,11 @@ int ib_cache_setup_one(struct ib_device *device) · 1552 unmodified lines
15531553 if (err)
15541554 return err;
15551555
1556− rdma_for_each_port (device, p)
1557− ib_cache_update(device, p, true);
1556+ rdma_for_each_port (device, p) {
1557+ err = ib_cache_update(device, p, true);
1558+ if (err)
1559+ return err;
1560+ }
15581561
15591562 return 0;
15601563 }
drivers/infiniband/core/nldev.c+1−2
@@ -1292,11 +1292,10 @@ static int res_get_common_doit(struct sk_buff *skb, struct nlmsghdr *nlh, · 1291 unmodified lines
12921292 has_cap_net_admin = netlink_capable(skb, CAP_NET_ADMIN);
12931293
12941294 ret = fill_func(msg, has_cap_net_admin, res, port);
1295−
1296− rdma_restrack_put(res);
12971295 if (ret)
12981296 goto err_free;
12991297
1298+ rdma_restrack_put(res);
13001299 nlmsg_end(msg, nlh);
13011300 ib_device_put(device);
13021301 return rdma_nl_unicast(sock_net(skb->sk), msg, NETLINK_CB(skb).portid);
drivers/infiniband/core/rdma_core.c+2−1
@@ -459,7 +459,8 @@ alloc_begin_fd_uobject(const struct uverbs_api_object *obj, · 458 unmodified lines
459459 struct ib_uobject *uobj;
460460 struct file *filp;
461461
462− if (WARN_ON(fd_type->fops->release != &uverbs_uobject_fd_release))
462+ if (WARN_ON(fd_type->fops->release != &uverbs_uobject_fd_release &&
463+ fd_type->fops->release != &uverbs_async_event_release))
463464 return ERR_PTR(-EINVAL);
464465
465466 new_fd = get_unused_fd_flags(O_CLOEXEC);
drivers/infiniband/core/uverbs.h+4−0
@@ -219,6 +219,7 @@ void ib_uverbs_init_event_queue(struct ib_uverbs_event_queue *ev_queue); · 218 unmodified lines
219219 void ib_uverbs_init_async_event_file(struct ib_uverbs_async_event_file *ev_file);
220220 void ib_uverbs_free_event_queue(struct ib_uverbs_event_queue *event_queue);
221221 void ib_uverbs_flow_resources_free(struct ib_uflow_resources *uflow_res);
222+int uverbs_async_event_release(struct inode *inode, struct file *filp);
222223
223224 int ib_alloc_ucontext(struct uverbs_attr_bundle *attrs);
224225 int ib_init_ucontext(struct uverbs_attr_bundle *attrs);
@@ -227,6 +228,9 @@ void ib_uverbs_release_ucq(struct ib_uverbs_completion_event_file *ev_file, · 2 unmodified lines
227228 struct ib_ucq_object *uobj);
228229 void ib_uverbs_release_uevent(struct ib_uevent_object *uobj);
229230 void ib_uverbs_release_file(struct kref *ref);
231+void ib_uverbs_async_handler(struct ib_uverbs_async_event_file *async_file,
232+ __u64 element, __u64 event,
233+ struct list_head *obj_list, u32 *counter);
230234
231235 void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context);
232236 void ib_uverbs_cq_event_handler(struct ib_event *event, void *context_ptr);
drivers/infiniband/core/uverbs_main.c+4−8
@@ -346,7 +346,7 @@ const struct file_operations uverbs_async_event_fops = { · 345 unmodified lines
346346 .owner = THIS_MODULE,
347347 .read = ib_uverbs_async_event_read,
348348 .poll = ib_uverbs_async_event_poll,
349− .release = uverbs_uobject_fd_release,
349+ .release = uverbs_async_event_release,
350350 .fasync = ib_uverbs_async_event_fasync,
351351 .llseek = no_llseek,
352352 };
@@ -386,10 +386,9 @@ void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context) · 33 unmodified lines
386386 kill_fasync(&ev_queue->async_queue, SIGIO, POLL_IN);
387387 }
388388
389−static void
390−ib_uverbs_async_handler(struct ib_uverbs_async_event_file *async_file,
391− __u64 element, __u64 event, struct list_head *obj_list,
392− u32 *counter)
389+void ib_uverbs_async_handler(struct ib_uverbs_async_event_file *async_file,
390+ __u64 element, __u64 event,
391+ struct list_head *obj_list, u32 *counter)
393392 {
394393 struct ib_uverbs_event *entry;
395394 unsigned long flags;
@@ -1187,9 +1186,6 @@ static void ib_uverbs_free_hw_resources(struct ib_uverbs_device *uverbs_dev, · 791 unmodified lines
11871186 */
11881187 mutex_unlock(&uverbs_dev->lists_mutex);
11891188
1190− ib_uverbs_async_handler(READ_ONCE(file->async_file), 0,
1191− IB_EVENT_DEVICE_FATAL, NULL, NULL);
1192−
11931189 uverbs_destroy_ufile_hw(file, RDMA_REMOVE_DRIVER_REMOVE);
11941190 kref_put(&file->ref, ib_uverbs_release_file);
11951191
drivers/infiniband/core/uverbs_std_types_async_fd.c+29−1
@@ -26,10 +26,38 @@ static int uverbs_async_event_destroy_uobj(struct ib_uobject *uobj, · 25 unmodified lines
2626 container_of(uobj, struct ib_uverbs_async_event_file, uobj);
2727
2828 ib_unregister_event_handler(&event_file->event_handler);
29− ib_uverbs_free_event_queue(&event_file->ev_queue);
29+
30+ if (why == RDMA_REMOVE_DRIVER_REMOVE)
31+ ib_uverbs_async_handler(event_file, 0, IB_EVENT_DEVICE_FATAL,
32+ NULL, NULL);
3033 return 0;
3134 }
3235
36+int uverbs_async_event_release(struct inode *inode, struct file *filp)
37+{
38+ struct ib_uverbs_async_event_file *event_file;
39+ struct ib_uobject *uobj = filp->private_data;
40+ int ret;
41+
42+ if (!uobj)
43+ return uverbs_uobject_fd_release(inode, filp);
44+
45+ event_file =
46+ container_of(uobj, struct ib_uverbs_async_event_file, uobj);
47+
48+ /*
49+ * The async event FD has to deliver IB_EVENT_DEVICE_FATAL even after
50+ * disassociation, so cleaning the event list must only happen after
51+ * release. The user knows it has reached the end of the event stream
52+ * when it sees IB_EVENT_DEVICE_FATAL.
53+ */
54+ uverbs_uobject_get(uobj);
55+ ret = uverbs_uobject_fd_release(inode, filp);
56+ ib_uverbs_free_event_queue(&event_file->ev_queue);
57+ uverbs_uobject_put(uobj);
58+ return ret;
59+}
60+
3361 DECLARE_UVERBS_NAMED_METHOD(
3462 UVERBS_METHOD_ASYNC_EVENT_ALLOC,
3563 UVERBS_ATTR_FD(UVERBS_ATTR_ASYNC_EVENT_ALLOC_FD_HANDLE,
drivers/infiniband/hw/cxgb4/cm.c+3−4
@@ -2891,8 +2891,7 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb) · 2890 unmodified lines
28912891 srqidx = ABORT_RSS_SRQIDX_G(
28922892 be32_to_cpu(req->srqidx_status));
28932893 if (srqidx) {
2894− complete_cached_srq_buffers(ep,
2895− req->srqidx_status);
2894+ complete_cached_srq_buffers(ep, srqidx);
28962895 } else {
28972896 /* Hold ep ref until finish_peer_abort() */
28982897 c4iw_get_ep(&ep->com);
@@ -3878,8 +3877,8 @@ static int read_tcb_rpl(struct c4iw_dev *dev, struct sk_buff *skb) · 979 unmodified lines
38783877 return 0;
38793878 }
38803879
3881− ep->srqe_idx = t4_tcb_get_field32(tcb, TCB_RQ_START_W, TCB_RQ_START_W,
3882− TCB_RQ_START_S);
3880+ ep->srqe_idx = t4_tcb_get_field32(tcb, TCB_RQ_START_W, TCB_RQ_START_M,
3881+ TCB_RQ_START_S);
38833882 cleanup:
38843883 pr_debug("ep %p tid %u %016x\n", ep, ep->hwtid, ep->srqe_idx);
38853884
drivers/infiniband/hw/hfi1/user_sdma.c+0−4
@@ -589,10 +589,6 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, · 588 unmodified lines
589589
590590 set_comp_state(pq, cq, info.comp_idx, QUEUED, 0);
591591 pq->state = SDMA_PKT_Q_ACTIVE;
592− /* Send the first N packets in the request to buy us some time */
593− ret = user_sdma_send_pkts(req, pcount);
594− if (unlikely(ret < 0 && ret != -EBUSY))
595− goto free_req;
596592
597593 /*
598594 * This is a somewhat blocking send implementation.
drivers/infiniband/hw/i40iw/i40iw_cm.c+0−8
@@ -1987,7 +1987,6 @@ static int i40iw_addr_resolve_neigh(struct i40iw_device *iwdev, · 1986 unmodified lines
19871987 struct rtable *rt;
19881988 struct neighbour *neigh;
19891989 int rc = arpindex;
1990− struct net_device *netdev = iwdev->netdev;
19911990 __be32 dst_ipaddr = htonl(dst_ip);
19921991 __be32 src_ipaddr = htonl(src_ip);
19931992
@@ -1997,9 +1996,6 @@ static int i40iw_addr_resolve_neigh(struct i40iw_device *iwdev, · 3 unmodified lines
19971996 return rc;
19981997 }
19991998
2000− if (netif_is_bond_slave(netdev))
2001− netdev = netdev_master_upper_dev_get(netdev);
2002−
20031999 neigh = dst_neigh_lookup(&rt->dst, &dst_ipaddr);
20042000
20052001 rcu_read_lock();
@@ -2065,7 +2061,6 @@ static int i40iw_addr_resolve_neigh_ipv6(struct i40iw_device *iwdev, · 59 unmodified lines
20652061 {
20662062 struct neighbour *neigh;
20672063 int rc = arpindex;
2068− struct net_device *netdev = iwdev->netdev;
20692064 struct dst_entry *dst;
20702065 struct sockaddr_in6 dst_addr;
20712066 struct sockaddr_in6 src_addr;
@@ -2086,9 +2081,6 @@ static int i40iw_addr_resolve_neigh_ipv6(struct i40iw_device *iwdev, · 14 unmodified lines
20862081 return rc;
20872082 }
20882083
2089− if (netif_is_bond_slave(netdev))
2090− netdev = netdev_master_upper_dev_get(netdev);
2091−
20922084 neigh = dst_neigh_lookup(dst, dst_addr.sin6_addr.in6_u.u6_addr32);
20932085
20942086 rcu_read_lock();
drivers/infiniband/hw/i40iw/i40iw_hw.c+1−1
@@ -534,7 +534,7 @@ void i40iw_manage_arp_cache(struct i40iw_device *iwdev, · 533 unmodified lines
534534 int arp_index;
535535
536536 arp_index = i40iw_arp_table(iwdev, ip_addr, ipv4, mac_addr, action);
537− if (arp_index == -1)
537+ if (arp_index < 0)
538538 return;
539539 cqp_request = i40iw_get_cqp_request(&iwdev->cqp, false);
540540 if (!cqp_request)
drivers/infiniband/hw/mlx4/qp.c+11−3
@@ -2891,6 +2891,7 @@ static int build_sriov_qp0_header(struct mlx4_ib_sqp *sqp, · 2890 unmodified lines
28912891 int send_size;
28922892 int header_size;
28932893 int spc;
2894+ int err;
28942895 int i;
28952896
28962897 if (wr->wr.opcode != IB_WR_SEND)
@@ -2925,7 +2926,9 @@ static int build_sriov_qp0_header(struct mlx4_ib_sqp *sqp, · 28 unmodified lines
29252926
29262927 sqp->ud_header.lrh.virtual_lane = 0;
29272928 sqp->ud_header.bth.solicited_event = !!(wr->wr.send_flags & IB_SEND_SOLICITED);
2928− ib_get_cached_pkey(ib_dev, sqp->qp.port, 0, &pkey);
2929+ err = ib_get_cached_pkey(ib_dev, sqp->qp.port, 0, &pkey);
2930+ if (err)
2931+ return err;
29292932 sqp->ud_header.bth.pkey = cpu_to_be16(pkey);
29302933 if (sqp->qp.mlx4_ib_qp_type == MLX4_IB_QPT_TUN_SMI_OWNER)
29312934 sqp->ud_header.bth.destination_qpn = cpu_to_be32(wr->remote_qpn);
@@ -3212,9 +3215,14 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, const struct ib_ud_wr *wr, · 280 unmodified lines
32123215 }
32133216 sqp->ud_header.bth.solicited_event = !!(wr->wr.send_flags & IB_SEND_SOLICITED);
32143217 if (!sqp->qp.ibqp.qp_num)
3215− ib_get_cached_pkey(ib_dev, sqp->qp.port, sqp->pkey_index, &pkey);
3218+ err = ib_get_cached_pkey(ib_dev, sqp->qp.port, sqp->pkey_index,
3219+ &pkey);
32163220 else
3217− ib_get_cached_pkey(ib_dev, sqp->qp.port, wr->pkey_index, &pkey);
3221+ err = ib_get_cached_pkey(ib_dev, sqp->qp.port, wr->pkey_index,
3222+ &pkey);
3223+ if (err)
3224+ return err;
3225+
32183226 sqp->ud_header.bth.pkey = cpu_to_be16(pkey);
32193227 sqp->ud_header.bth.destination_qpn = cpu_to_be32(wr->remote_qpn);
32203228 sqp->ud_header.bth.psn = cpu_to_be32((sqp->send_psn++) & ((1 << 24) - 1));
drivers/infiniband/sw/rxe/rxe_mmap.c+1−1
@@ -151,7 +151,7 @@ struct rxe_mmap_info *rxe_create_mmap_info(struct rxe_dev *rxe, u32 size, · 150 unmodified lines
151151
152152 ip = kmalloc(sizeof(*ip), GFP_KERNEL);
153153 if (!ip)
154− return NULL;
154+ return ERR_PTR(-ENOMEM);
155155
156156 size = PAGE_ALIGN(size);
157157
drivers/infiniband/sw/rxe/rxe_queue.c+7−4
@@ -45,12 +45,15 @@ int do_mmap_info(struct rxe_dev *rxe, struct mminfo __user *outbuf, · 44 unmodified lines
4545
4646 if (outbuf) {
4747 ip = rxe_create_mmap_info(rxe, buf_size, udata, buf);
48− if (!ip)
48+ if (IS_ERR(ip)) {
49+ err = PTR_ERR(ip);
4950 goto err1;
51+ }
5052
51− err = copy_to_user(outbuf, &ip->info, sizeof(ip->info));
52− if (err)
53+ if (copy_to_user(outbuf, &ip->info, sizeof(ip->info))) {
54+ err = -EFAULT;
5355 goto err2;
56+ }
5457
5558 spin_lock_bh(&rxe->pending_lock);
5659 list_add(&ip->pending_mmaps, &rxe->pending_mmaps);
@@ -64,7 +67,7 @@ int do_mmap_info(struct rxe_dev *rxe, struct mminfo __user *outbuf, · 7 unmodified lines
6467 err2:
6568 kfree(ip);
6669 err1:
67− return -EINVAL;
70+ return err;
6871 }
6972
7073 inline void rxe_queue_reset(struct rxe_queue *q)
drivers/iommu/amd_iommu.c+2−1
@@ -127,7 +127,8 @@ static inline int get_acpihid_device_id(struct device *dev, · 126 unmodified lines
127127 return -ENODEV;
128128
129129 list_for_each_entry(p, &acpihid_map, list) {
130− if (acpi_dev_hid_uid_match(adev, p->hid, p->uid)) {
130+ if (acpi_dev_hid_uid_match(adev, p->hid,
131+ p->uid[0] ? p->uid : NULL)) {
131132 if (entry)
132133 *entry = p;
133134 return p->devid;
drivers/iommu/amd_iommu_init.c+5−4
@@ -1329,8 +1329,8 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu, · 1328 unmodified lines
13291329 }
13301330 case IVHD_DEV_ACPI_HID: {
13311331 u16 devid;
1332− u8 hid[ACPIHID_HID_LEN] = {0};
1333− u8 uid[ACPIHID_UID_LEN] = {0};
1332+ u8 hid[ACPIHID_HID_LEN];
1333+ u8 uid[ACPIHID_UID_LEN];
13341334 int ret;
13351335
13361336 if (h->type != 0x40) {
@@ -1347,6 +1347,7 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu, · 10 unmodified lines
13471347 break;
13481348 }
13491349
1350+ uid[0] = '\0';
13501351 switch (e->uidf) {
13511352 case UID_NOT_PRESENT:
13521353
@@ -1361,8 +1362,8 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu, · 8 unmodified lines
13611362 break;
13621363 case UID_IS_CHARACTER:
13631364
1364− memcpy(uid, (u8 *)(&e->uid), ACPIHID_UID_LEN - 1);
1365− uid[ACPIHID_UID_LEN - 1] = '\0';
1365+ memcpy(uid, &e->uid, e->uidl);
1366+ uid[e->uidl] = '\0';
13661367
13671368 break;
13681369 default:
drivers/iommu/iommu.c+11−6
@@ -693,6 +693,15 @@ out: · 692 unmodified lines
693693 return ret;
694694 }
695695
696+static bool iommu_is_attach_deferred(struct iommu_domain *domain,
697+ struct device *dev)
698+{
699+ if (domain->ops->is_attach_deferred)
700+ return domain->ops->is_attach_deferred(domain, dev);
701+
702+ return false;
703+}
704+
696705 /**
697706 * iommu_group_add_device - add a device to an iommu group
698707 * @group: the group into which to add the device (reference should be held)
@@ -747,7 +756,7 @@ rename: · 48 unmodified lines
747756
748757 mutex_lock(&group->mutex);
749758 list_add_tail(&device->list, &group->devices);
750− if (group->domain)
759+ if (group->domain && !iommu_is_attach_deferred(group->domain, dev))
751760 ret = __iommu_attach_device(group->domain, dev);
752761 mutex_unlock(&group->mutex);
753762 if (ret)
@@ -1653,9 +1662,6 @@ static int __iommu_attach_device(struct iommu_domain *domain, · 899 unmodified lines
16531662 struct device *dev)
16541663 {
16551664 int ret;
1656− if ((domain->ops->is_attach_deferred != NULL) &&
1657− domain->ops->is_attach_deferred(domain, dev))
1658− return 0;
16591665
16601666 if (unlikely(domain->ops->attach_dev == NULL))
16611667 return -ENODEV;
@@ -1727,8 +1733,7 @@ EXPORT_SYMBOL_GPL(iommu_sva_unbind_gpasid); · 65 unmodified lines
17271733 static void __iommu_detach_device(struct iommu_domain *domain,
17281734 struct device *dev)
17291735 {
1730− if ((domain->ops->is_attach_deferred != NULL) &&
1731− domain->ops->is_attach_deferred(domain, dev))
1736+ if (iommu_is_attach_deferred(domain, dev))
17321737 return;
17331738
17341739 if (unlikely(domain->ops->detach_dev == NULL))
drivers/ipack/carriers/tpci200.c+1−0
@@ -306,6 +306,7 @@ static int tpci200_register(struct tpci200_board *tpci200) · 305 unmodified lines
306306 "(bn 0x%X, sn 0x%X) failed to map driver user space!",
307307 tpci200->info->pdev->bus->number,
308308 tpci200->info->pdev->devfn);
309+ res = -ENOMEM;
309310 goto out_release_mem8_space;
310311 }
311312
drivers/misc/cardreader/rtsx_pcr.c+3−0
@@ -142,6 +142,9 @@ static void rtsx_comm_pm_full_on(struct rtsx_pcr *pcr) · 141 unmodified lines
142142
143143 rtsx_disable_aspm(pcr);
144144
145+ /* Fixes DMA transfer timout issue after disabling ASPM on RTS5260 */
146+ msleep(1);
147+
145148 if (option->ltr_enabled)
146149 rtsx_set_ltr_latency(pcr, option->ltr_active_latency);
147150
drivers/misc/mei/client.c+2−0
@@ -266,6 +266,7 @@ void mei_me_cl_rm_by_uuid(struct mei_device *dev, const uuid_le *uuid) · 265 unmodified lines
266266 down_write(&dev->me_clients_rwsem);
267267 me_cl = __mei_me_cl_by_uuid(dev, uuid);
268268 __mei_me_cl_del(dev, me_cl);
269+ mei_me_cl_put(me_cl);
269270 up_write(&dev->me_clients_rwsem);
270271 }
271272
@@ -287,6 +288,7 @@ void mei_me_cl_rm_by_uuid_id(struct mei_device *dev, const uuid_le *uuid, u8 id) · 15 unmodified lines
287288 down_write(&dev->me_clients_rwsem);
288289 me_cl = __mei_me_cl_by_uuid_id(dev, uuid, id);
289290 __mei_me_cl_del(dev, me_cl);
291+ mei_me_cl_put(me_cl);
290292 up_write(&dev->me_clients_rwsem);
291293 }
292294
drivers/mmc/core/block.c+2−1
@@ -1370,6 +1370,7 @@ static void mmc_blk_cqe_complete_rq(struct mmc_queue *mq, struct request *req) · 1369 unmodified lines
13701370 struct mmc_request *mrq = &mqrq->brq.mrq;
13711371 struct request_queue *q = req->q;
13721372 struct mmc_host *host = mq->card->host;
1373+ enum mmc_issue_type issue_type = mmc_issue_type(mq, req);
13731374 unsigned long flags;
13741375 bool put_card;
13751376 int err;
@@ -1399,7 +1400,7 @@ static void mmc_blk_cqe_complete_rq(struct mmc_queue *mq, struct request *req) · 23 unmodified lines
13991400
14001401 spin_lock_irqsave(&mq->lock, flags);
14011402
1402− mq->in_flight[mmc_issue_type(mq, req)] -= 1;
1403+ mq->in_flight[issue_type] -= 1;
14031404
14041405 put_card = (mmc_tot_in_flight(mq) == 0);
14051406
drivers/mmc/core/queue.c+5−11
@@ -107,11 +107,10 @@ static enum blk_eh_timer_return mmc_cqe_timed_out(struct request *req) · 106 unmodified lines
107107 case MMC_ISSUE_DCMD:
108108 if (host->cqe_ops->cqe_timeout(host, mrq, &recovery_needed)) {
109109 if (recovery_needed)
110− __mmc_cqe_recovery_notifier(mq);
110+ mmc_cqe_recovery_notifier(mrq);
111111 return BLK_EH_RESET_TIMER;
112112 }
113− /* No timeout (XXX: huh? comment doesn't make much sense) */
114− blk_mq_complete_request(req);
113+ /* The request has gone already */
115114 return BLK_EH_DONE;
116115 default:
117116 /* Timeout is handled by mmc core */
@@ -127,18 +126,13 @@ static enum blk_eh_timer_return mmc_mq_timed_out(struct request *req, · 9 unmodified lines
127126 struct mmc_card *card = mq->card;
128127 struct mmc_host *host = card->host;
129128 unsigned long flags;
130− int ret;
129+ bool ignore_tout;
131130
132131 spin_lock_irqsave(&mq->lock, flags);
133−
134− if (mq->recovery_needed || !mq->use_cqe || host->hsq_enabled)
135− ret = BLK_EH_RESET_TIMER;
136− else
137− ret = mmc_cqe_timed_out(req);
138−
132+ ignore_tout = mq->recovery_needed || !mq->use_cqe || host->hsq_enabled;
139133 spin_unlock_irqrestore(&mq->lock, flags);
140134
141− return ret;
135+ return ignore_tout ? BLK_EH_RESET_TIMER : mmc_cqe_timed_out(req);
142136 }
143137
144138 static void mmc_mq_recovery_handler(struct work_struct *work)
drivers/mmc/host/alcor.c+5−1
@@ -1104,7 +1104,7 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev) · 1103 unmodified lines
11041104
11051105 if (ret) {
11061106 dev_err(&pdev->dev, "Failed to get irq for data line\n");
1107− return ret;
1107+ goto free_host;
11081108 }
11091109
11101110 mutex_init(&host->cmd_mutex);
@@ -1116,6 +1116,10 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev) · 5 unmodified lines
11161116 dev_set_drvdata(&pdev->dev, host);
11171117 mmc_add_host(mmc);
11181118 return 0;
1119+
1120+free_host:
1121+ mmc_free_host(mmc);
1122+ return ret;
11191123 }
11201124
11211125 static int alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)
drivers/mmc/host/sdhci-acpi.c+6−4
@@ -605,10 +605,12 @@ static int sdhci_acpi_emmc_amd_probe_slot(struct platform_device *pdev, · 604 unmodified lines
605605 }
606606
607607 static const struct sdhci_acpi_slot sdhci_acpi_slot_amd_emmc = {
608− .chip = &sdhci_acpi_chip_amd,
609− .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
610− .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR | SDHCI_QUIRK_32BIT_DMA_SIZE |
611− SDHCI_QUIRK_32BIT_ADMA_SIZE,
608+ .chip = &sdhci_acpi_chip_amd,
609+ .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
610+ .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR |
611+ SDHCI_QUIRK_32BIT_DMA_SIZE |
612+ SDHCI_QUIRK_32BIT_ADMA_SIZE,
613+ .quirks2 = SDHCI_QUIRK2_BROKEN_64_BIT_DMA,
612614 .probe_slot = sdhci_acpi_emmc_amd_probe_slot,
613615 };
614616
drivers/mmc/host/sdhci-pci-gli.c+23−0
@@ -26,6 +26,9 @@ · 25 unmodified lines
2626 #define SDHCI_GLI_9750_DRIVING_2 GENMASK(27, 26)
2727 #define GLI_9750_DRIVING_1_VALUE 0xFFF
2828 #define GLI_9750_DRIVING_2_VALUE 0x3
29+#define SDHCI_GLI_9750_SEL_1 BIT(29)
30+#define SDHCI_GLI_9750_SEL_2 BIT(31)
31+#define SDHCI_GLI_9750_ALL_RST (BIT(24)|BIT(25)|BIT(28)|BIT(30))
2932
3033 #define SDHCI_GLI_9750_PLL 0x864
3134 #define SDHCI_GLI_9750_PLL_TX2_INV BIT(23)
@@ -122,6 +125,8 @@ static void gli_set_9750(struct sdhci_host *host) · 90 unmodified lines
122125 GLI_9750_DRIVING_1_VALUE);
123126 driving_value |= FIELD_PREP(SDHCI_GLI_9750_DRIVING_2,
124127 GLI_9750_DRIVING_2_VALUE);
128+ driving_value &= ~(SDHCI_GLI_9750_SEL_1|SDHCI_GLI_9750_SEL_2|SDHCI_GLI_9750_ALL_RST);
129+ driving_value |= SDHCI_GLI_9750_SEL_2;
125130 sdhci_writel(host, driving_value, SDHCI_GLI_9750_DRIVING);
126131
127132 sw_ctrl_value &= ~SDHCI_GLI_9750_SW_CTRL_4;
@@ -334,6 +339,18 @@ static u32 sdhci_gl9750_readl(struct sdhci_host *host, int reg) · 206 unmodified lines
334339 return value;
335340 }
336341
342+#ifdef CONFIG_PM_SLEEP
343+static int sdhci_pci_gli_resume(struct sdhci_pci_chip *chip)
344+{
345+ struct sdhci_pci_slot *slot = chip->slots[0];
346+
347+ pci_free_irq_vectors(slot->chip->pdev);
348+ gli_pcie_enable_msi(slot);
349+
350+ return sdhci_pci_resume_host(chip);
351+}
352+#endif
353+
337354 static const struct sdhci_ops sdhci_gl9755_ops = {
338355 .set_clock = sdhci_set_clock,
339356 .enable_dma = sdhci_pci_enable_dma,
@@ -348,6 +365,9 @@ const struct sdhci_pci_fixes sdhci_gl9755 = { · 8 unmodified lines
348365 .quirks2 = SDHCI_QUIRK2_BROKEN_DDR50,
349366 .probe_slot = gli_probe_slot_gl9755,
350367 .ops = &sdhci_gl9755_ops,
368+#ifdef CONFIG_PM_SLEEP
369+ .resume = sdhci_pci_gli_resume,
370+#endif
351371 };
352372
353373 static const struct sdhci_ops sdhci_gl9750_ops = {
@@ -366,4 +386,7 @@ const struct sdhci_pci_fixes sdhci_gl9750 = { · 12 unmodified lines
366386 .quirks2 = SDHCI_QUIRK2_BROKEN_DDR50,
367387 .probe_slot = gli_probe_slot_gl9750,
368388 .ops = &sdhci_gl9750_ops,
389+#ifdef CONFIG_PM_SLEEP
390+ .resume = sdhci_pci_gli_resume,
391+#endif
369392 };
drivers/mtd/mtdcore.c+1−1
@@ -555,7 +555,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd) · 554 unmodified lines
555555
556556 config.id = -1;
557557 config.dev = &mtd->dev;
558− config.name = mtd->name;
558+ config.name = dev_name(&mtd->dev);
559559 config.owner = THIS_MODULE;
560560 config.reg_read = mtd_nvmem_reg_read;
561561 config.size = mtd->size;
drivers/mtd/nand/raw/brcmnand/brcmnand.c+1−2
@@ -2728,9 +2728,8 @@ static int brcmnand_resume(struct device *dev) · 2727 unmodified lines
27282728 flash_dma_writel(ctrl, FLASH_DMA_ERROR_STATUS, 0);
27292729 }
27302730
2731− if (has_edu(ctrl))
2731+ if (has_edu(ctrl)) {
27322732 ctrl->edu_config = edu_readl(ctrl, EDU_CONFIG);
2733− else {
27342733 edu_writel(ctrl, EDU_CONFIG, ctrl->edu_config);
27352734 edu_readl(ctrl, EDU_CONFIG);
27362735 brcmnand_edu_init(ctrl);
drivers/mtd/nand/spi/core.c+4−0
@@ -1089,6 +1089,10 @@ static int spinand_init(struct spinand_device *spinand) · 1088 unmodified lines
10891089
10901090 mtd->oobavail = ret;
10911091
1092+ /* Propagate ECC information to mtd_info */
1093+ mtd->ecc_strength = nand->eccreq.strength;
1094+ mtd->ecc_step_size = nand->eccreq.step_size;
1095+
10921096 return 0;
10931097
10941098 err_cleanup_nanddev:
drivers/mtd/ubi/debug.c+2−10
@@ -393,9 +393,6 @@ static void *eraseblk_count_seq_start(struct seq_file *s, loff_t *pos) · 392 unmodified lines
393393 {
394394 struct ubi_device *ubi = s->private;
395395
396− if (*pos == 0)
397− return SEQ_START_TOKEN;
398−
399396 if (*pos < ubi->peb_count)
400397 return pos;
401398
@@ -409,8 +406,6 @@ static void *eraseblk_count_seq_next(struct seq_file *s, void *v, loff_t *pos) · 7 unmodified lines
409406 {
410407 struct ubi_device *ubi = s->private;
411408
412− if (v == SEQ_START_TOKEN)
413− return pos;
414409 (*pos)++;
415410
416411 if (*pos < ubi->peb_count)
@@ -432,11 +427,8 @@ static int eraseblk_count_seq_show(struct seq_file *s, void *iter) · 15 unmodified lines
432427 int err;
433428
434429 /* If this is the start, print a header */
435− if (iter == SEQ_START_TOKEN) {
436− seq_puts(s,
437− "physical_block_number\terase_count\tblock_status\tread_status\n");
438− return 0;
439− }
430+ if (*block_number == 0)
431+ seq_puts(s, "physical_block_number\terase_count\n");
440432
441433 err = ubi_io_is_bad(ubi, *block_number);
442434 if (err)
drivers/net/bareudp.c+4−14
@@ -136,25 +136,21 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb) · 135 unmodified lines
136136 oiph = skb_network_header(skb);
137137 skb_reset_network_header(skb);
138138
139− if (family == AF_INET)
139+ if (!IS_ENABLED(CONFIG_IPV6) || family == AF_INET)
140140 err = IP_ECN_decapsulate(oiph, skb);
141−#if IS_ENABLED(CONFIG_IPV6)
142141 else
143142 err = IP6_ECN_decapsulate(oiph, skb);
144−#endif
145143
146144 if (unlikely(err)) {
147145 if (log_ecn_error) {
148− if (family == AF_INET)
146+ if (!IS_ENABLED(CONFIG_IPV6) || family == AF_INET)
149147 net_info_ratelimited("non-ECT from %pI4 "
150148 "with TOS=%#x\n",
151149 &((struct iphdr *)oiph)->saddr,
152150 ((struct iphdr *)oiph)->tos);
153−#if IS_ENABLED(CONFIG_IPV6)
154151 else
155152 net_info_ratelimited("non-ECT from %pI6\n",
156153 &((struct ipv6hdr *)oiph)->saddr);
157−#endif
158154 }
159155 if (err > 1) {
160156 ++bareudp->dev->stats.rx_frame_errors;
@@ -350,7 +346,6 @@ free_dst: · 189 unmodified lines
350346 return err;
351347 }
352348
353−#if IS_ENABLED(CONFIG_IPV6)
354349 static int bareudp6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
355350 struct bareudp_dev *bareudp,
356351 const struct ip_tunnel_info *info)
@@ -411,7 +406,6 @@ free_dst: · 54 unmodified lines
411406 dst_release(dst);
412407 return err;
413408 }
414−#endif
415409
416410 static netdev_tx_t bareudp_xmit(struct sk_buff *skb, struct net_device *dev)
417411 {
@@ -435,11 +429,9 @@ static netdev_tx_t bareudp_xmit(struct sk_buff *skb, struct net_device *dev) · 17 unmodified lines
435429 }
436430
437431 rcu_read_lock();
438−#if IS_ENABLED(CONFIG_IPV6)
439− if (info->mode & IP_TUNNEL_INFO_IPV6)
432+ if (IS_ENABLED(CONFIG_IPV6) && info->mode & IP_TUNNEL_INFO_IPV6)
440433 err = bareudp6_xmit_skb(skb, dev, bareudp, info);
441434 else
442−#endif
443435 err = bareudp_xmit_skb(skb, dev, bareudp, info);
444436
445437 rcu_read_unlock();
@@ -467,7 +459,7 @@ static int bareudp_fill_metadata_dst(struct net_device *dev, · 21 unmodified lines
467459
468460 use_cache = ip_tunnel_dst_cache_usable(skb, info);
469461
470− if (ip_tunnel_info_af(info) == AF_INET) {
462+ if (!IS_ENABLED(CONFIG_IPV6) || ip_tunnel_info_af(info) == AF_INET) {
471463 struct rtable *rt;
472464 __be32 saddr;
473465
@@ -478,7 +470,6 @@ static int bareudp_fill_metadata_dst(struct net_device *dev, · 4 unmodified lines
478470
479471 ip_rt_put(rt);
480472 info->key.u.ipv4.src = saddr;
481−#if IS_ENABLED(CONFIG_IPV6)
482473 } else if (ip_tunnel_info_af(info) == AF_INET6) {
483474 struct dst_entry *dst;
484475 struct in6_addr saddr;
@@ -492,7 +483,6 @@ static int bareudp_fill_metadata_dst(struct net_device *dev, · 7 unmodified lines
492483
493484 dst_release(dst);
494485 info->key.u.ipv6.src = saddr;
495−#endif
496486 } else {
497487 return -EINVAL;
498488 }
drivers/net/can/ifi_canfd/ifi_canfd.c+4−1
@@ -947,8 +947,11 @@ static int ifi_canfd_plat_probe(struct platform_device *pdev) · 946 unmodified lines
947947 u32 id, rev;
948948
949949 addr = devm_platform_ioremap_resource(pdev, 0);
950+ if (IS_ERR(addr))
951+ return PTR_ERR(addr);
952+
950953 irq = platform_get_irq(pdev, 0);
951− if (IS_ERR(addr) || irq < 0)
954+ if (irq < 0)
952955 return -EINVAL;
953956
954957 id = readl(addr + IFI_CANFD_IP_ID);
drivers/net/can/sun4i_can.c+1−1
@@ -792,7 +792,7 @@ static int sun4ican_probe(struct platform_device *pdev) · 791 unmodified lines
792792
793793 addr = devm_platform_ioremap_resource(pdev, 0);
794794 if (IS_ERR(addr)) {
795− err = -EBUSY;
795+ err = PTR_ERR(addr);
796796 goto exit;
797797 }
798798
drivers/net/dsa/b53/b53_srab.c+1−1
@@ -609,7 +609,7 @@ static int b53_srab_probe(struct platform_device *pdev) · 608 unmodified lines
609609
610610 priv->regs = devm_platform_ioremap_resource(pdev, 0);
611611 if (IS_ERR(priv->regs))
612− return -ENOMEM;
612+ return PTR_ERR(priv->regs);
613613
614614 dev = b53_switch_alloc(&pdev->dev, &b53_srab_ops, priv);
615615 if (!dev)
drivers/net/dsa/dsa_loop.c+1−0
@@ -360,6 +360,7 @@ static void __exit dsa_loop_exit(void) · 359 unmodified lines
360360 }
361361 module_exit(dsa_loop_exit);
362362
363+MODULE_SOFTDEP("pre: dsa_loop_bdinfo");
363364 MODULE_LICENSE("GPL");
364365 MODULE_AUTHOR("Florian Fainelli");
365366 MODULE_DESCRIPTION("DSA loopback driver");
drivers/net/dsa/mt7530.c+2−7
@@ -628,11 +628,8 @@ mt7530_cpu_port_enable(struct mt7530_priv *priv, · 627 unmodified lines
628628 mt7530_write(priv, MT7530_PVC_P(port),
629629 PORT_SPEC_TAG);
630630
631− /* Disable auto learning on the cpu port */
632− mt7530_set(priv, MT7530_PSC_P(port), SA_DIS);
633−
634− /* Unknown unicast frame fordwarding to the cpu port */
635− mt7530_set(priv, MT7530_MFC, UNU_FFP(BIT(port)));
631+ /* Unknown multicast frame forwarding to the cpu port */
632+ mt7530_rmw(priv, MT7530_MFC, UNM_FFP_MASK, UNM_FFP(BIT(port)));
636633
637634 /* Set CPU port number */
638635 if (priv->id == ID_MT7621)
@@ -1294,8 +1291,6 @@ mt7530_setup(struct dsa_switch *ds) · 655 unmodified lines
12941291 /* Enable and reset MIB counters */
12951292 mt7530_mib_reset(ds);
12961293
1297− mt7530_clear(priv, MT7530_MFC, UNU_FFP_MASK);
1298−
12991294 for (i = 0; i < MT7530_NUM_PORTS; i++) {
13001295 /* Disable forwarding by default on all ports */
13011296 mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK,
drivers/net/dsa/mt7530.h+1−0
@@ -31,6 +31,7 @@ enum { · 30 unmodified lines
3131 #define MT7530_MFC 0x10
3232 #define BC_FFP(x) (((x) & 0xff) << 24)
3333 #define UNM_FFP(x) (((x) & 0xff) << 16)
34+#define UNM_FFP_MASK UNM_FFP(~0)
3435 #define UNU_FFP(x) (((x) & 0xff) << 8)
3536 #define UNU_FFP_MASK UNU_FFP(~0)
3637 #define CPU_EN BIT(7)
drivers/net/dsa/ocelot/felix.c+11−12
@@ -388,6 +388,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) · 387 unmodified lines
388388 struct ocelot *ocelot = &felix->ocelot;
389389 phy_interface_t *port_phy_modes;
390390 resource_size_t switch_base;
391+ struct resource res;
391392 int port, i, err;
392393
393394 ocelot->num_phys_ports = num_phys_ports;
@@ -422,17 +423,16 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) · 28 unmodified lines
422423
423424 for (i = 0; i < TARGET_MAX; i++) {
424425 struct regmap *target;
425− struct resource *res;
426426
427427 if (!felix->info->target_io_res[i].name)
428428 continue;
429429
430− res = &felix->info->target_io_res[i];
431− res->flags = IORESOURCE_MEM;
432− res->start += switch_base;
433− res->end += switch_base;
430+ memcpy(&res, &felix->info->target_io_res[i], sizeof(res));
431+ res.flags = IORESOURCE_MEM;
432+ res.start += switch_base;
433+ res.end += switch_base;
434434
435− target = ocelot_regmap_init(ocelot, res);
435+ target = ocelot_regmap_init(ocelot, &res);
436436 if (IS_ERR(target)) {
437437 dev_err(ocelot->dev,
438438 "Failed to map device memory space\n");
@@ -453,7 +453,6 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) · 14 unmodified lines
453453 for (port = 0; port < num_phys_ports; port++) {
454454 struct ocelot_port *ocelot_port;
455455 void __iomem *port_regs;
456− struct resource *res;
457456
458457 ocelot_port = devm_kzalloc(ocelot->dev,
459458 sizeof(struct ocelot_port),
@@ -465,12 +464,12 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) · 5 unmodified lines
465464 return -ENOMEM;
466465 }
467466
468− res = &felix->info->port_io_res[port];
469− res->flags = IORESOURCE_MEM;
470− res->start += switch_base;
471− res->end += switch_base;
467+ memcpy(&res, &felix->info->port_io_res[port], sizeof(res));
468+ res.flags = IORESOURCE_MEM;
469+ res.start += switch_base;
470+ res.end += switch_base;
472471
473− port_regs = devm_ioremap_resource(ocelot->dev, res);
472+ port_regs = devm_ioremap_resource(ocelot->dev, &res);
474473 if (IS_ERR(port_regs)) {
475474 dev_err(ocelot->dev,
476475 "failed to map registers for port %d\n", port);
drivers/net/dsa/ocelot/felix.h+3−3
@@ -8,9 +8,9 @@ · 7 unmodified lines
88
99 /* Platform-specific information */
1010 struct felix_info {
11− struct resource *target_io_res;
12− struct resource *port_io_res;
13− struct resource *imdio_res;
11+ const struct resource *target_io_res;
12+ const struct resource *port_io_res;
13+ const struct resource *imdio_res;
1414 const struct reg_field *regfields;
1515 const u32 *const *map;
1616 const struct ocelot_ops *ops;
drivers/net/dsa/ocelot/felix_vsc9959.c+10−12
@@ -333,10 +333,8 @@ static const u32 *vsc9959_regmap[] = { · 332 unmodified lines
333333 [GCB] = vsc9959_gcb_regmap,
334334 };
335335
336−/* Addresses are relative to the PCI device's base address and
337− * will be fixed up at ioremap time.
338− */
339−static struct resource vsc9959_target_io_res[] = {
336+/* Addresses are relative to the PCI device's base address */
337+static const struct resource vsc9959_target_io_res[] = {
340338 [ANA] = {
341339 .start = 0x0280000,
342340 .end = 0x028ffff,
@@ -379,7 +377,7 @@ static struct resource vsc9959_target_io_res[] = { · 36 unmodified lines
379377 },
380378 };
381379
382−static struct resource vsc9959_port_io_res[] = {
380+static const struct resource vsc9959_port_io_res[] = {
383381 {
384382 .start = 0x0100000,
385383 .end = 0x010ffff,
@@ -415,7 +413,7 @@ static struct resource vsc9959_port_io_res[] = { · 29 unmodified lines
415413 /* Port MAC 0 Internal MDIO bus through which the SerDes acting as an
416414 * SGMII/QSGMII MAC PCS can be found.
417415 */
418−static struct resource vsc9959_imdio_res = {
416+static const struct resource vsc9959_imdio_res = {
419417 .start = 0x8030,
420418 .end = 0x8040,
421419 .name = "imdio",
@@ -1111,7 +1109,7 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot) · 689 unmodified lines
11111109 struct device *dev = ocelot->dev;
11121110 resource_size_t imdio_base;
11131111 void __iomem *imdio_regs;
1114− struct resource *res;
1112+ struct resource res;
11151113 struct enetc_hw *hw;
11161114 struct mii_bus *bus;
11171115 int port;
@@ -1128,12 +1126,12 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot) · 10 unmodified lines
11281126 imdio_base = pci_resource_start(felix->pdev,
11291127 felix->info->imdio_pci_bar);
11301128
1131− res = felix->info->imdio_res;
1132− res->flags = IORESOURCE_MEM;
1133− res->start += imdio_base;
1134− res->end += imdio_base;
1129+ memcpy(&res, felix->info->imdio_res, sizeof(res));
1130+ res.flags = IORESOURCE_MEM;
1131+ res.start += imdio_base;
1132+ res.end += imdio_base;
11351133
1136− imdio_regs = devm_ioremap_resource(dev, res);
1134+ imdio_regs = devm_ioremap_resource(dev, &res);
11371135 if (IS_ERR(imdio_regs)) {
11381136 dev_err(dev, "failed to map internal MDIO registers\n");
11391137 return PTR_ERR(imdio_regs);
drivers/net/ethernet/apple/bmac.c+1−1
@@ -1182,7 +1182,7 @@ bmac_get_station_address(struct net_device *dev, unsigned char *ea) · 1181 unmodified lines
11821182 int i;
11831183 unsigned short data;
11841184
1185− for (i = 0; i < 6; i++)
1185+ for (i = 0; i < 3; i++)
11861186 {
11871187 reset_and_select_srom(dev);
11881188 data = read_srom(dev, i + EnetAddressOffset/2, SROMAddressBits);
drivers/net/ethernet/broadcom/Kconfig+1−0
@@ -69,6 +69,7 @@ config BCMGENET · 68 unmodified lines
6969 select BCM7XXX_PHY
7070 select MDIO_BCM_UNIMAC
7171 select DIMLIB
72+ select BROADCOM_PHY if ARCH_BCM2835
7273 help
7374 This driver supports the built-in Ethernet MACs found in the
7475 Broadcom BCM7xxx Set Top Box family chipset.
drivers/net/ethernet/freescale/Kconfig+2−0
@@ -77,6 +77,7 @@ config UCC_GETH · 76 unmodified lines
7777 depends on QUICC_ENGINE && PPC32
7878 select FSL_PQ_MDIO
7979 select PHYLIB
80+ select FIXED_PHY
8081 ---help---
8182 This driver supports the Gigabit Ethernet mode of the QUICC Engine,
8283 which is available on some Freescale SOCs.
@@ -90,6 +91,7 @@ config GIANFAR · 7 unmodified lines
9091 depends on HAS_DMA
9192 select FSL_PQ_MDIO
9293 select PHYLIB
94+ select FIXED_PHY
9395 select CRC32
9496 ---help---
9597 This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx,
drivers/net/ethernet/freescale/dpaa/Kconfig+1−0
@@ -3,6 +3,7 @@ menuconfig FSL_DPAA_ETH · 2 unmodified lines
33 tristate "DPAA Ethernet"
44 depends on FSL_DPAA && FSL_FMAN
55 select PHYLIB
6+ select FIXED_PHY
67 select FSL_FMAN_MAC
78 ---help---
89 Data Path Acceleration Architecture Ethernet driver,
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c+17−12
@@ -86,7 +86,7 @@ static void free_rx_fd(struct dpaa2_eth_priv *priv, · 85 unmodified lines
8686 for (i = 1; i < DPAA2_ETH_MAX_SG_ENTRIES; i++) {
8787 addr = dpaa2_sg_get_addr(&sgt[i]);
8888 sg_vaddr = dpaa2_iova_to_virt(priv->iommu_domain, addr);
89− dma_unmap_page(dev, addr, DPAA2_ETH_RX_BUF_SIZE,
89+ dma_unmap_page(dev, addr, priv->rx_buf_size,
9090 DMA_BIDIRECTIONAL);
9191
9292 free_pages((unsigned long)sg_vaddr, 0);
@@ -144,7 +144,7 @@ static struct sk_buff *build_frag_skb(struct dpaa2_eth_priv *priv, · 51 unmodified lines
144144 /* Get the address and length from the S/G entry */
145145 sg_addr = dpaa2_sg_get_addr(sge);
146146 sg_vaddr = dpaa2_iova_to_virt(priv->iommu_domain, sg_addr);
147− dma_unmap_page(dev, sg_addr, DPAA2_ETH_RX_BUF_SIZE,
147+ dma_unmap_page(dev, sg_addr, priv->rx_buf_size,
148148 DMA_BIDIRECTIONAL);
149149
150150 sg_length = dpaa2_sg_get_len(sge);
@@ -185,7 +185,7 @@ static struct sk_buff *build_frag_skb(struct dpaa2_eth_priv *priv, · 34 unmodified lines
185185 (page_address(page) - page_address(head_page));
186186
187187 skb_add_rx_frag(skb, i - 1, head_page, page_offset,
188− sg_length, DPAA2_ETH_RX_BUF_SIZE);
188+ sg_length, priv->rx_buf_size);
189189 }
190190
191191 if (dpaa2_sg_is_final(sge))
@@ -211,7 +211,7 @@ static void free_bufs(struct dpaa2_eth_priv *priv, u64 *buf_array, int count) · 19 unmodified lines
211211
212212 for (i = 0; i < count; i++) {
213213 vaddr = dpaa2_iova_to_virt(priv->iommu_domain, buf_array[i]);
214− dma_unmap_page(dev, buf_array[i], DPAA2_ETH_RX_BUF_SIZE,
214+ dma_unmap_page(dev, buf_array[i], priv->rx_buf_size,
215215 DMA_BIDIRECTIONAL);
216216 free_pages((unsigned long)vaddr, 0);
217217 }
@@ -335,7 +335,7 @@ static u32 run_xdp(struct dpaa2_eth_priv *priv, · 117 unmodified lines
335335 break;
336336 case XDP_REDIRECT:
337337 dma_unmap_page(priv->net_dev->dev.parent, addr,
338− DPAA2_ETH_RX_BUF_SIZE, DMA_BIDIRECTIONAL);
338+ priv->rx_buf_size, DMA_BIDIRECTIONAL);
339339 ch->buf_count--;
340340 xdp.data_hard_start = vaddr;
341341 err = xdp_do_redirect(priv->net_dev, &xdp, xdp_prog);
@@ -374,7 +374,7 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, · 32 unmodified lines
374374 trace_dpaa2_rx_fd(priv->net_dev, fd);
375375
376376 vaddr = dpaa2_iova_to_virt(priv->iommu_domain, addr);
377− dma_sync_single_for_cpu(dev, addr, DPAA2_ETH_RX_BUF_SIZE,
377+ dma_sync_single_for_cpu(dev, addr, priv->rx_buf_size,
378378 DMA_BIDIRECTIONAL);
379379
380380 fas = dpaa2_get_fas(vaddr, false);
@@ -393,13 +393,13 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, · 12 unmodified lines
393393 return;
394394 }
395395
396− dma_unmap_page(dev, addr, DPAA2_ETH_RX_BUF_SIZE,
396+ dma_unmap_page(dev, addr, priv->rx_buf_size,
397397 DMA_BIDIRECTIONAL);
398398 skb = build_linear_skb(ch, fd, vaddr);
399399 } else if (fd_format == dpaa2_fd_sg) {
400400 WARN_ON(priv->xdp_prog);
401401
402− dma_unmap_page(dev, addr, DPAA2_ETH_RX_BUF_SIZE,
402+ dma_unmap_page(dev, addr, priv->rx_buf_size,
403403 DMA_BIDIRECTIONAL);
404404 skb = build_frag_skb(priv, ch, buf_data);
405405 free_pages((unsigned long)vaddr, 0);
@@ -974,7 +974,7 @@ static int add_bufs(struct dpaa2_eth_priv *priv, · 568 unmodified lines
974974 if (!page)
975975 goto err_alloc;
976976
977− addr = dma_map_page(dev, page, 0, DPAA2_ETH_RX_BUF_SIZE,
977+ addr = dma_map_page(dev, page, 0, priv->rx_buf_size,
978978 DMA_BIDIRECTIONAL);
979979 if (unlikely(dma_mapping_error(dev, addr)))
980980 goto err_map;
@@ -984,7 +984,7 @@ static int add_bufs(struct dpaa2_eth_priv *priv, · 3 unmodified lines
984984 /* tracing point */
985985 trace_dpaa2_eth_buf_seed(priv->net_dev,
986986 page, DPAA2_ETH_RX_BUF_RAW_SIZE,
987− addr, DPAA2_ETH_RX_BUF_SIZE,
987+ addr, priv->rx_buf_size,
988988 bpid);
989989 }
990990
@@ -1720,7 +1720,7 @@ static bool xdp_mtu_valid(struct dpaa2_eth_priv *priv, int mtu) · 729 unmodified lines
17201720 int mfl, linear_mfl;
17211721
17221722 mfl = DPAA2_ETH_L2_MAX_FRM(mtu);
1723− linear_mfl = DPAA2_ETH_RX_BUF_SIZE - DPAA2_ETH_RX_HWA_SIZE -
1723+ linear_mfl = priv->rx_buf_size - DPAA2_ETH_RX_HWA_SIZE -
17241724 dpaa2_eth_rx_head_room(priv) - XDP_PACKET_HEADROOM;
17251725
17261726 if (mfl > linear_mfl) {
@@ -2462,6 +2462,11 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv) · 735 unmodified lines
24622462 else
24632463 rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN;
24642464
2465+ /* We need to ensure that the buffer size seen by WRIOP is a multiple
2466+ * of 64 or 256 bytes depending on the WRIOP version.
2467+ */
2468+ priv->rx_buf_size = ALIGN_DOWN(DPAA2_ETH_RX_BUF_SIZE, rx_buf_align);
2469+
24652470 /* tx buffer */
24662471 buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE;
24672472 buf_layout.pass_timestamp = true;
@@ -3126,7 +3131,7 @@ static int bind_dpni(struct dpaa2_eth_priv *priv) · 658 unmodified lines
31263131 pools_params.num_dpbp = 1;
31273132 pools_params.pools[0].dpbp_id = priv->dpbp_dev->obj_desc.id;
31283133 pools_params.pools[0].backup_pool = 0;
3129− pools_params.pools[0].buffer_size = DPAA2_ETH_RX_BUF_SIZE;
3134+ pools_params.pools[0].buffer_size = priv->rx_buf_size;
31303135 err = dpni_set_pools(priv->mc_io, 0, priv->mc_token, &pools_params);
31313136 if (err) {
31323137 dev_err(dev, "dpni_set_pools() failed\n");
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h+1−0
@@ -382,6 +382,7 @@ struct dpaa2_eth_priv { · 381 unmodified lines
382382 u16 tx_data_offset;
383383
384384 struct fsl_mc_device *dpbp_dev;
385+ u16 rx_buf_size;
385386 u16 bpid;
386387 struct iommu_domain *iommu_domain;
387388
drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c+1−1
@@ -635,7 +635,7 @@ static int num_rules(struct dpaa2_eth_priv *priv) · 634 unmodified lines
635635
636636 static int update_cls_rule(struct net_device *net_dev,
637637 struct ethtool_rx_flow_spec *new_fs,
638− int location)
638+ unsigned int location)
639639 {
640640 struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
641641 struct dpaa2_eth_cls_rule *rule;
drivers/net/ethernet/freescale/ucc_geth.c+7−6
@@ -42,6 +42,7 @@ · 41 unmodified lines
4242 #include <soc/fsl/qe/ucc.h>
4343 #include <soc/fsl/qe/ucc_fast.h>
4444 #include <asm/machdep.h>
45+#include <net/sch_generic.h>
4546
4647 #include "ucc_geth.h"
4748
@@ -1548,11 +1549,8 @@ static int ugeth_disable(struct ucc_geth_private *ugeth, enum comm_dir mode) · 1500 unmodified lines
15481549
15491550 static void ugeth_quiesce(struct ucc_geth_private *ugeth)
15501551 {
1551− /* Prevent any further xmits, plus detach the device. */
1552− netif_device_detach(ugeth->ndev);
1553−
1554− /* Wait for any current xmits to finish. */
1555− netif_tx_disable(ugeth->ndev);
1552+ /* Prevent any further xmits */
1553+ netif_tx_stop_all_queues(ugeth->ndev);
15561554
15571555 /* Disable the interrupt to avoid NAPI rescheduling. */
15581556 disable_irq(ugeth->ug_info->uf_info.irq);
@@ -1565,7 +1563,10 @@ static void ugeth_activate(struct ucc_geth_private *ugeth) · 6 unmodified lines
15651563 {
15661564 napi_enable(&ugeth->napi);
15671565 enable_irq(ugeth->ug_info->uf_info.irq);
1568− netif_device_attach(ugeth->ndev);
1566+
1567+ /* allow to xmit again */
1568+ netif_tx_wake_all_queues(ugeth->ndev);
1569+ __netdev_watchdog_up(ugeth->ndev);
15691570 }
15701571
15711572 /* Called every time the controller might need to be made
drivers/net/ethernet/hisilicon/Kconfig+1−1
@@ -64,7 +64,7 @@ config HNS_MDIO · 63 unmodified lines
6464 the PHY
6565
6666 config HNS
67− tristate "Hisilicon Network Subsystem Support (Framework)"
67+ tristate
6868 ---help---
6969 This selects the framework support for Hisilicon Network Subsystem. It
7070 is needed by any driver which provides HNS acceleration engine or make
drivers/net/ethernet/huawei/hinic/hinic_hw_mgmt.c+12−4
@@ -45,6 +45,8 @@ · 44 unmodified lines
4545
4646 #define MGMT_MSG_TIMEOUT 5000
4747
48+#define SET_FUNC_PORT_MGMT_TIMEOUT 25000
49+
4850 #define mgmt_to_pfhwdev(pf_mgmt) \
4951 container_of(pf_mgmt, struct hinic_pfhwdev, pf_to_mgmt)
5052
@@ -238,12 +240,13 @@ static int msg_to_mgmt_sync(struct hinic_pf_to_mgmt *pf_to_mgmt, · 187 unmodified lines
238240 u8 *buf_in, u16 in_size,
239241 u8 *buf_out, u16 *out_size,
240242 enum mgmt_direction_type direction,
241− u16 resp_msg_id)
243+ u16 resp_msg_id, u32 timeout)
242244 {
243245 struct hinic_hwif *hwif = pf_to_mgmt->hwif;
244246 struct pci_dev *pdev = hwif->pdev;
245247 struct hinic_recv_msg *recv_msg;
246248 struct completion *recv_done;
249+ unsigned long timeo;
247250 u16 msg_id;
248251 int err;
249252
@@ -267,8 +270,9 @@ static int msg_to_mgmt_sync(struct hinic_pf_to_mgmt *pf_to_mgmt, · 17 unmodified lines
267270 goto unlock_sync_msg;
268271 }
269272
270− if (!wait_for_completion_timeout(recv_done,
271− msecs_to_jiffies(MGMT_MSG_TIMEOUT))) {
273+ timeo = msecs_to_jiffies(timeout ? timeout : MGMT_MSG_TIMEOUT);
274+
275+ if (!wait_for_completion_timeout(recv_done, timeo)) {
272276 dev_err(&pdev->dev, "MGMT timeout, MSG id = %d\n", msg_id);
273277 err = -ETIMEDOUT;
274278 goto unlock_sync_msg;
@@ -342,6 +346,7 @@ int hinic_msg_to_mgmt(struct hinic_pf_to_mgmt *pf_to_mgmt, · 67 unmodified lines
342346 {
343347 struct hinic_hwif *hwif = pf_to_mgmt->hwif;
344348 struct pci_dev *pdev = hwif->pdev;
349+ u32 timeout = 0;
345350
346351 if (sync != HINIC_MGMT_MSG_SYNC) {
347352 dev_err(&pdev->dev, "Invalid MGMT msg type\n");
@@ -353,9 +358,12 @@ int hinic_msg_to_mgmt(struct hinic_pf_to_mgmt *pf_to_mgmt, · 5 unmodified lines
353358 return -EINVAL;
354359 }
355360
361+ if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE)
362+ timeout = SET_FUNC_PORT_MGMT_TIMEOUT;
363+
356364 return msg_to_mgmt_sync(pf_to_mgmt, mod, cmd, buf_in, in_size,
357365 buf_out, out_size, MGMT_DIRECT_SEND,
358− MSG_NOT_RESP);
366+ MSG_NOT_RESP, timeout);
359367 }
360368
361369 /**
drivers/net/ethernet/huawei/hinic/hinic_main.c+2−14
@@ -483,7 +483,6 @@ static int hinic_close(struct net_device *netdev) · 482 unmodified lines
483483 {
484484 struct hinic_dev *nic_dev = netdev_priv(netdev);
485485 unsigned int flags;
486− int err;
487486
488487 down(&nic_dev->mgmt_lock);
489488
@@ -497,20 +496,9 @@ static int hinic_close(struct net_device *netdev) · 7 unmodified lines
497496
498497 up(&nic_dev->mgmt_lock);
499498
500− err = hinic_port_set_func_state(nic_dev, HINIC_FUNC_PORT_DISABLE);
501− if (err) {
502− netif_err(nic_dev, drv, netdev,
503− "Failed to set func port state\n");
504− nic_dev->flags |= (flags & HINIC_INTF_UP);
505− return err;
506− }
499+ hinic_port_set_state(nic_dev, HINIC_PORT_DISABLE);
507500
508− err = hinic_port_set_state(nic_dev, HINIC_PORT_DISABLE);
509− if (err) {
510− netif_err(nic_dev, drv, netdev, "Failed to set port state\n");
511− nic_dev->flags |= (flags & HINIC_INTF_UP);
512− return err;
513− }
501+ hinic_port_set_func_state(nic_dev, HINIC_FUNC_PORT_DISABLE);
514502
515503 if (nic_dev->flags & HINIC_RSS_ENABLE) {
516504 hinic_rss_deinit(nic_dev);
drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c+1−1
@@ -1070,7 +1070,7 @@ void mvpp2_cls_oversize_rxq_set(struct mvpp2_port *port) · 1069 unmodified lines
10701070 (port->first_rxq >> MVPP2_CLS_OVERSIZE_RXQ_LOW_BITS));
10711071
10721072 val = mvpp2_read(port->priv, MVPP2_CLS_SWFWD_PCTRL_REG);
1073− val |= MVPP2_CLS_SWFWD_PCTRL_MASK(port->id);
1073+ val &= ~MVPP2_CLS_SWFWD_PCTRL_MASK(port->id);
10741074 mvpp2_write(port->priv, MVPP2_CLS_SWFWD_PCTRL_REG, val);
10751075 }
10761076
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c+6−2
@@ -497,13 +497,17 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 496 unmodified lines
497497
498498 hw->irq_name = devm_kmalloc_array(&hw->pdev->dev, num_vec, NAME_SIZE,
499499 GFP_KERNEL);
500− if (!hw->irq_name)
500+ if (!hw->irq_name) {
501+ err = -ENOMEM;
501502 goto err_free_netdev;
503+ }
502504
503505 hw->affinity_mask = devm_kcalloc(&hw->pdev->dev, num_vec,
504506 sizeof(cpumask_var_t), GFP_KERNEL);
505− if (!hw->affinity_mask)
507+ if (!hw->affinity_mask) {
508+ err = -ENOMEM;
506509 goto err_free_netdev;
510+ }
507511
508512 err = pci_alloc_irq_vectors(hw->pdev, num_vec, num_vec, PCI_IRQ_MSIX);
509513 if (err < 0) {
drivers/net/ethernet/marvell/pxa168_eth.c+1−1
@@ -1418,7 +1418,7 @@ static int pxa168_eth_probe(struct platform_device *pdev) · 1417 unmodified lines
14181418
14191419 pep->base = devm_platform_ioremap_resource(pdev, 0);
14201420 if (IS_ERR(pep->base)) {
1421− err = -ENOMEM;
1421+ err = PTR_ERR(pep->base);
14221422 goto err_netdev;
14231423 }
14241424
drivers/net/ethernet/mellanox/mlx4/fw.c+1−1
@@ -2734,7 +2734,7 @@ void mlx4_opreq_action(struct work_struct *work) · 2733 unmodified lines
27342734 if (err) {
27352735 mlx4_err(dev, "Failed to retrieve required operation: %d\n",
27362736 err);
2737− return;
2737+ goto out;
27382738 }
27392739 MLX4_GET(modifier, outbox, GET_OP_REQ_MODIFIER_OFFSET);
27402740 MLX4_GET(token, outbox, GET_OP_REQ_TOKEN_OFFSET);
drivers/net/ethernet/mellanox/mlx5/core/cmd.c+55−4
@@ -848,6 +848,14 @@ static void free_msg(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *msg); · 847 unmodified lines
848848 static void mlx5_free_cmd_msg(struct mlx5_core_dev *dev,
849849 struct mlx5_cmd_msg *msg);
850850
851+static bool opcode_allowed(struct mlx5_cmd *cmd, u16 opcode)
852+{
853+ if (cmd->allowed_opcode == CMD_ALLOWED_OPCODE_ALL)
854+ return true;
855+
856+ return cmd->allowed_opcode == opcode;
857+}
858+
851859 static void cmd_work_handler(struct work_struct *work)
852860 {
853861 struct mlx5_cmd_work_ent *ent = container_of(work, struct mlx5_cmd_work_ent, work);
@@ -861,6 +869,7 @@ static void cmd_work_handler(struct work_struct *work) · 7 unmodified lines
861869 int alloc_ret;
862870 int cmd_mode;
863871
872+ complete(&ent->handling);
864873 sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem;
865874 down(sem);
866875 if (!ent->page_queue) {
@@ -913,7 +922,9 @@ static void cmd_work_handler(struct work_struct *work) · 46 unmodified lines
913922
914923 /* Skip sending command to fw if internal error */
915924 if (pci_channel_offline(dev->pdev) ||
916− dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
925+ dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR ||
926+ cmd->state != MLX5_CMDIF_STATE_UP ||
927+ !opcode_allowed(&dev->cmd, ent->op)) {
917928 u8 status = 0;
918929 u32 drv_synd;
919930
@@ -978,6 +989,11 @@ static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) · 58 unmodified lines
978989 struct mlx5_cmd *cmd = &dev->cmd;
979990 int err;
980991
992+ if (!wait_for_completion_timeout(&ent->handling, timeout) &&
993+ cancel_work_sync(&ent->work)) {
994+ ent->ret = -ECANCELED;
995+ goto out_err;
996+ }
981997 if (cmd->mode == CMD_MODE_POLLING || ent->polling) {
982998 wait_for_completion(&ent->done);
983999 } else if (!wait_for_completion_timeout(&ent->done, timeout)) {
@@ -985,12 +1001,17 @@ static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) · 1 unmodified line
9851001 mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true);
9861002 }
9871003
1004+out_err:
9881005 err = ent->ret;
9891006
9901007 if (err == -ETIMEDOUT) {
9911008 mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n",
9921009 mlx5_command_str(msg_to_opcode(ent->in)),
9931010 msg_to_opcode(ent->in));
1011+ } else if (err == -ECANCELED) {
1012+ mlx5_core_warn(dev, "%s(0x%x) canceled on out of queue timeout.\n",
1013+ mlx5_command_str(msg_to_opcode(ent->in)),
1014+ msg_to_opcode(ent->in));
9941015 }
9951016 mlx5_core_dbg(dev, "err %d, delivery status %s(%d)\n",
9961017 err, deliv_status_to_str(ent->status), ent->status);
@@ -1026,6 +1047,7 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, · 29 unmodified lines
10261047 ent->token = token;
10271048 ent->polling = force_polling;
10281049
1050+ init_completion(&ent->handling);
10291051 if (!callback)
10301052 init_completion(&ent->done);
10311053
@@ -1045,6 +1067,8 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, · 13 unmodified lines
10451067 err = wait_func(dev, ent);
10461068 if (err == -ETIMEDOUT)
10471069 goto out;
1070+ if (err == -ECANCELED)
1071+ goto out_free;
10481072
10491073 ds = ent->ts2 - ent->ts1;
10501074 op = MLX5_GET(mbox_in, in->first.data, opcode);
@@ -1391,6 +1415,22 @@ static void create_debugfs_files(struct mlx5_core_dev *dev) · 340 unmodified lines
13911415 mlx5_cmdif_debugfs_init(dev);
13921416 }
13931417
1418+void mlx5_cmd_allowed_opcode(struct mlx5_core_dev *dev, u16 opcode)
1419+{
1420+ struct mlx5_cmd *cmd = &dev->cmd;
1421+ int i;
1422+
1423+ for (i = 0; i < cmd->max_reg_cmds; i++)
1424+ down(&cmd->sem);
1425+ down(&cmd->pages_sem);
1426+
1427+ cmd->allowed_opcode = opcode;
1428+
1429+ up(&cmd->pages_sem);
1430+ for (i = 0; i < cmd->max_reg_cmds; i++)
1431+ up(&cmd->sem);
1432+}
1433+
13941434 static void mlx5_cmd_change_mod(struct mlx5_core_dev *dev, int mode)
13951435 {
13961436 struct mlx5_cmd *cmd = &dev->cmd;
@@ -1667,12 +1707,14 @@ static int cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, · 270 unmodified lines
16671707 int err;
16681708 u8 status = 0;
16691709 u32 drv_synd;
1710+ u16 opcode;
16701711 u8 token;
16711712
1713+ opcode = MLX5_GET(mbox_in, in, opcode);
16721714 if (pci_channel_offline(dev->pdev) ||
1673− dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
1674− u16 opcode = MLX5_GET(mbox_in, in, opcode);
1675−
1715+ dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR ||
1716+ dev->cmd.state != MLX5_CMDIF_STATE_UP ||
1717+ !opcode_allowed(&dev->cmd, opcode)) {
16761718 err = mlx5_internal_err_ret_value(dev, opcode, &drv_synd, &status);
16771719 MLX5_SET(mbox_out, out, status, status);
16781720 MLX5_SET(mbox_out, out, syndrome, drv_synd);
@@ -1937,6 +1979,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) · 258 unmodified lines
19371979 goto err_free_page;
19381980 }
19391981
1982+ cmd->state = MLX5_CMDIF_STATE_DOWN;
19401983 cmd->checksum_disabled = 1;
19411984 cmd->max_reg_cmds = (1 << cmd->log_sz) - 1;
19421985 cmd->bitmask = (1UL << cmd->max_reg_cmds) - 1;
@@ -1974,6 +2017,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) · 31 unmodified lines
19742017 mlx5_core_dbg(dev, "descriptor at dma 0x%llx\n", (unsigned long long)(cmd->dma));
19752018
19762019 cmd->mode = CMD_MODE_POLLING;
2020+ cmd->allowed_opcode = CMD_ALLOWED_OPCODE_ALL;
19772021
19782022 create_msg_cache(dev);
19792023
@@ -2013,3 +2057,10 @@ void mlx5_cmd_cleanup(struct mlx5_core_dev *dev) · 33 unmodified lines
20132057 dma_pool_destroy(cmd->pool);
20142058 }
20152059 EXPORT_SYMBOL(mlx5_cmd_cleanup);
2060+
2061+void mlx5_cmd_set_state(struct mlx5_core_dev *dev,
2062+ enum mlx5_cmdif_state cmdif_state)
2063+{
2064+ dev->cmd.state = cmdif_state;
2065+}
2066+EXPORT_SYMBOL(mlx5_cmd_set_state);
drivers/net/ethernet/mellanox/mlx5/core/en.h+1−1
@@ -1121,7 +1121,7 @@ void mlx5e_close_drop_rq(struct mlx5e_rq *drop_rq); · 1120 unmodified lines
11211121 int mlx5e_create_indirect_rqt(struct mlx5e_priv *priv);
11221122
11231123 int mlx5e_create_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc);
1124−void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc);
1124+void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv);
11251125
11261126 int mlx5e_create_direct_rqts(struct mlx5e_priv *priv, struct mlx5e_tir *tirs);
11271127 void mlx5e_destroy_direct_rqts(struct mlx5e_priv *priv, struct mlx5e_tir *tirs);
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c+3−2
@@ -699,6 +699,7 @@ mlx5_tc_ct_parse_match(struct mlx5e_priv *priv, · 698 unmodified lines
699699 struct netlink_ext_ack *extack)
700700 {
701701 struct mlx5_tc_ct_priv *ct_priv = mlx5_tc_ct_get_ct_priv(priv);
702+ struct flow_rule *rule = flow_cls_offload_flow_rule(f);
702703 struct flow_dissector_key_ct *mask, *key;
703704 bool trk, est, untrk, unest, new;
704705 u32 ctstate = 0, ctstate_mask = 0;
@@ -706,7 +707,7 @@ mlx5_tc_ct_parse_match(struct mlx5e_priv *priv, · 1 unmodified line
706707 u16 ct_state, ct_state_mask;
707708 struct flow_match_ct match;
708709
709− if (!flow_rule_match_key(f->rule, FLOW_DISSECTOR_KEY_CT))
710+ if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CT))
710711 return 0;
711712
712713 if (!ct_priv) {
@@ -715,7 +716,7 @@ mlx5_tc_ct_parse_match(struct mlx5e_priv *priv, · 2 unmodified lines
715716 return -EOPNOTSUPP;
716717 }
717718
718− flow_rule_match_ct(f->rule, &match);
719+ flow_rule_match_ct(rule, &match);
719720
720721 key = match.key;
721722 mask = match.mask;
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h+3−1
@@ -130,7 +130,9 @@ mlx5_tc_ct_parse_match(struct mlx5e_priv *priv, · 129 unmodified lines
130130 struct flow_cls_offload *f,
131131 struct netlink_ext_ack *extack)
132132 {
133− if (!flow_rule_match_key(f->rule, FLOW_DISSECTOR_KEY_CT))
133+ struct flow_rule *rule = flow_cls_offload_flow_rule(f);
134+
135+ if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CT))
134136 return 0;
135137
136138 NL_SET_ERR_MSG_MOD(extack, "mlx5 tc ct offload isn't enabled.");
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c+1−1
@@ -69,8 +69,8 @@ static void mlx5e_ktls_del(struct net_device *netdev, · 68 unmodified lines
6969 struct mlx5e_ktls_offload_context_tx *tx_priv =
7070 mlx5e_get_ktls_tx_priv_ctx(tls_ctx);
7171
72− mlx5_ktls_destroy_key(priv->mdev, tx_priv->key_id);
7372 mlx5e_destroy_tis(priv->mdev, tx_priv->tisn);
73+ mlx5_ktls_destroy_key(priv->mdev, tx_priv->key_id);
7474 kvfree(tx_priv);
7575 }
7676
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+7−5
@@ -2717,7 +2717,8 @@ void mlx5e_modify_tirs_hash(struct mlx5e_priv *priv, void *in, int inlen) · 2716 unmodified lines
27172717 mlx5_core_modify_tir(mdev, priv->indir_tir[tt].tirn, in, inlen);
27182718 }
27192719
2720− if (!mlx5e_tunnel_inner_ft_supported(priv->mdev))
2720+ /* Verify inner tirs resources allocated */
2721+ if (!priv->inner_indir_tir[0].tirn)
27212722 return;
27222723
27232724 for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) {
@@ -3408,14 +3409,15 @@ out: · 684 unmodified lines
34083409 return err;
34093410 }
34103411
3411−void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc)
3412+void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv)
34123413 {
34133414 int i;
34143415
34153416 for (i = 0; i < MLX5E_NUM_INDIR_TIRS; i++)
34163417 mlx5e_destroy_tir(priv->mdev, &priv->indir_tir[i]);
34173418
3418− if (!inner_ttc || !mlx5e_tunnel_inner_ft_supported(priv->mdev))
3419+ /* Verify inner tirs resources allocated */
3420+ if (!priv->inner_indir_tir[0].tirn)
34193421 return;
34203422
34213423 for (i = 0; i < MLX5E_NUM_INDIR_TIRS; i++)
@@ -5123,7 +5125,7 @@ err_destroy_xsk_rqts: · 1701 unmodified lines
51235125 err_destroy_direct_tirs:
51245126 mlx5e_destroy_direct_tirs(priv, priv->direct_tir);
51255127 err_destroy_indirect_tirs:
5126− mlx5e_destroy_indirect_tirs(priv, true);
5128+ mlx5e_destroy_indirect_tirs(priv);
51275129 err_destroy_direct_rqts:
51285130 mlx5e_destroy_direct_rqts(priv, priv->direct_tir);
51295131 err_destroy_indirect_rqts:
@@ -5142,7 +5144,7 @@ static void mlx5e_cleanup_nic_rx(struct mlx5e_priv *priv) · 12 unmodified lines
51425144 mlx5e_destroy_direct_tirs(priv, priv->xsk_tir);
51435145 mlx5e_destroy_direct_rqts(priv, priv->xsk_tir);
51445146 mlx5e_destroy_direct_tirs(priv, priv->direct_tir);
5145− mlx5e_destroy_indirect_tirs(priv, true);
5147+ mlx5e_destroy_indirect_tirs(priv);
51465148 mlx5e_destroy_direct_rqts(priv, priv->direct_tir);
51475149 mlx5e_destroy_rqt(priv, &priv->indir_rqt);
51485150 mlx5e_close_drop_rq(&priv->drop_rq);
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c+4−8
@@ -1484,13 +1484,9 @@ bool mlx5e_eswitch_uplink_rep(struct net_device *netdev) · 1483 unmodified lines
14841484 return netdev->netdev_ops == &mlx5e_netdev_ops_uplink_rep;
14851485 }
14861486
1487−bool mlx5e_eswitch_rep(struct net_device *netdev)
1487+bool mlx5e_eswitch_vf_rep(struct net_device *netdev)
14881488 {
1489− if (netdev->netdev_ops == &mlx5e_netdev_ops_rep ||
1490− netdev->netdev_ops == &mlx5e_netdev_ops_uplink_rep)
1491− return true;
1492−
1493− return false;
1489+ return netdev->netdev_ops == &mlx5e_netdev_ops_rep;
14941490 }
14951491
14961492 static void mlx5e_build_rep_params(struct net_device *netdev)
@@ -1747,7 +1743,7 @@ err_destroy_ttc_table: · 250 unmodified lines
17471743 err_destroy_direct_tirs:
17481744 mlx5e_destroy_direct_tirs(priv, priv->direct_tir);
17491745 err_destroy_indirect_tirs:
1750− mlx5e_destroy_indirect_tirs(priv, false);
1746+ mlx5e_destroy_indirect_tirs(priv);
17511747 err_destroy_direct_rqts:
17521748 mlx5e_destroy_direct_rqts(priv, priv->direct_tir);
17531749 err_destroy_indirect_rqts:
@@ -1765,7 +1761,7 @@ static void mlx5e_cleanup_rep_rx(struct mlx5e_priv *priv) · 11 unmodified lines
17651761 mlx5e_destroy_rep_root_ft(priv);
17661762 mlx5e_destroy_ttc_table(priv, &priv->fs.ttc);
17671763 mlx5e_destroy_direct_tirs(priv, priv->direct_tir);
1768− mlx5e_destroy_indirect_tirs(priv, false);
1764+ mlx5e_destroy_indirect_tirs(priv);
17691765 mlx5e_destroy_direct_rqts(priv, priv->direct_tir);
17701766 mlx5e_destroy_rqt(priv, &priv->indir_rqt);
17711767 mlx5e_close_drop_rq(&priv->drop_rq);
drivers/net/ethernet/mellanox/mlx5/core/en_rep.h+6−1
@@ -210,8 +210,13 @@ void mlx5e_rep_encap_entry_detach(struct mlx5e_priv *priv, · 209 unmodified lines
210210
211211 void mlx5e_rep_queue_neigh_stats_work(struct mlx5e_priv *priv);
212212
213−bool mlx5e_eswitch_rep(struct net_device *netdev);
213+bool mlx5e_eswitch_vf_rep(struct net_device *netdev);
214214 bool mlx5e_eswitch_uplink_rep(struct net_device *netdev);
215+static inline bool mlx5e_eswitch_rep(struct net_device *netdev)
216+{
217+ return mlx5e_eswitch_vf_rep(netdev) ||
218+ mlx5e_eswitch_uplink_rep(netdev);
219+}
215220
216221 #else /* CONFIG_MLX5_ESWITCH */
217222 static inline bool mlx5e_is_uplink_rep(struct mlx5e_priv *priv) { return false; }
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+33−7
@@ -3073,6 +3073,11 @@ static bool actions_match_supported(struct mlx5e_priv *priv, · 3072 unmodified lines
30733073 return true;
30743074 }
30753075
3076+static bool same_port_devs(struct mlx5e_priv *priv, struct mlx5e_priv *peer_priv)
3077+{
3078+ return priv->mdev == peer_priv->mdev;
3079+}
3080+
30763081 static bool same_hw_devs(struct mlx5e_priv *priv, struct mlx5e_priv *peer_priv)
30773082 {
30783083 struct mlx5_core_dev *fmdev, *pmdev;
@@ -3291,7 +3296,7 @@ static inline int hash_encap_info(struct encap_key *key) · 212 unmodified lines
32913296 }
32923297
32933298
3294−static bool is_merged_eswitch_dev(struct mlx5e_priv *priv,
3299+static bool is_merged_eswitch_vfs(struct mlx5e_priv *priv,
32953300 struct net_device *peer_netdev)
32963301 {
32973302 struct mlx5e_priv *peer_priv;
@@ -3299,13 +3304,11 @@ static bool is_merged_eswitch_dev(struct mlx5e_priv *priv, · 1 unmodified line
32993304 peer_priv = netdev_priv(peer_netdev);
33003305
33013306 return (MLX5_CAP_ESW(priv->mdev, merged_eswitch) &&
3302− mlx5e_eswitch_rep(priv->netdev) &&
3303− mlx5e_eswitch_rep(peer_netdev) &&
3307+ mlx5e_eswitch_vf_rep(priv->netdev) &&
3308+ mlx5e_eswitch_vf_rep(peer_netdev) &&
33043309 same_hw_devs(priv, peer_priv));
33053310 }
33063311
3307−
3308−
33093312 bool mlx5e_encap_take(struct mlx5e_encap_entry *e)
33103313 {
33113314 return refcount_inc_not_zero(&e->refcnt);
@@ -3575,14 +3578,37 @@ static int add_vlan_pop_action(struct mlx5e_priv *priv, · 263 unmodified lines
35753578 return err;
35763579 }
35773580
3581+static bool same_hw_reps(struct mlx5e_priv *priv,
3582+ struct net_device *peer_netdev)
3583+{
3584+ struct mlx5e_priv *peer_priv;
3585+
3586+ peer_priv = netdev_priv(peer_netdev);
3587+
3588+ return mlx5e_eswitch_rep(priv->netdev) &&
3589+ mlx5e_eswitch_rep(peer_netdev) &&
3590+ same_hw_devs(priv, peer_priv);
3591+}
3592+
3593+static bool is_lag_dev(struct mlx5e_priv *priv,
3594+ struct net_device *peer_netdev)
3595+{
3596+ return ((mlx5_lag_is_sriov(priv->mdev) ||
3597+ mlx5_lag_is_multipath(priv->mdev)) &&
3598+ same_hw_reps(priv, peer_netdev));
3599+}
3600+
35783601 bool mlx5e_is_valid_eswitch_fwd_dev(struct mlx5e_priv *priv,
35793602 struct net_device *out_dev)
35803603 {
3581− if (is_merged_eswitch_dev(priv, out_dev))
3604+ if (is_merged_eswitch_vfs(priv, out_dev))
3605+ return true;
3606+
3607+ if (is_lag_dev(priv, out_dev))
35823608 return true;
35833609
35843610 return mlx5e_eswitch_rep(out_dev) &&
3585− same_hw_devs(priv, netdev_priv(out_dev));
3611+ same_port_devs(priv, netdev_priv(out_dev));
35863612 }
35873613
35883614 static bool is_duplicated_output_device(struct net_device *dev,
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c+6−3
@@ -537,10 +537,9 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget) · 536 unmodified lines
537537 void mlx5e_free_txqsq_descs(struct mlx5e_txqsq *sq)
538538 {
539539 struct mlx5e_tx_wqe_info *wi;
540+ u32 dma_fifo_cc, nbytes = 0;
541+ u16 ci, sqcc, npkts = 0;
540542 struct sk_buff *skb;
541− u32 dma_fifo_cc;
542− u16 sqcc;
543− u16 ci;
544543 int i;
545544
546545 sqcc = sq->cc;
@@ -565,11 +564,15 @@ void mlx5e_free_txqsq_descs(struct mlx5e_txqsq *sq) · 18 unmodified lines
565564 }
566565
567566 dev_kfree_skb_any(skb);
567+ npkts++;
568+ nbytes += wi->num_bytes;
568569 sqcc += wi->num_wqebbs;
569570 }
570571
571572 sq->dma_fifo_cc = dma_fifo_cc;
572573 sq->cc = sqcc;
574+
575+ netdev_tx_completed_queue(sq->txq, npkts, nbytes);
573576 }
574577
575578 #ifdef CONFIG_MLX5_CORE_IPOIB
drivers/net/ethernet/mellanox/mlx5/core/eq.c+3−0
@@ -611,11 +611,13 @@ static int create_async_eqs(struct mlx5_core_dev *dev) · 610 unmodified lines
611611 .nent = MLX5_NUM_CMD_EQE,
612612 .mask[0] = 1ull << MLX5_EVENT_TYPE_CMD,
613613 };
614+ mlx5_cmd_allowed_opcode(dev, MLX5_CMD_OP_CREATE_EQ);
614615 err = setup_async_eq(dev, &table->cmd_eq, &param, "cmd");
615616 if (err)
616617 goto err1;
617618
618619 mlx5_cmd_use_events(dev);
620+ mlx5_cmd_allowed_opcode(dev, CMD_ALLOWED_OPCODE_ALL);
619621
620622 param = (struct mlx5_eq_param) {
621623 .irq_index = 0,
@@ -645,6 +647,7 @@ err2: · 23 unmodified lines
645647 mlx5_cmd_use_polling(dev);
646648 cleanup_async_eq(dev, &table->cmd_eq, "cmd");
647649 err1:
650+ mlx5_cmd_allowed_opcode(dev, CMD_ALLOWED_OPCODE_ALL);
648651 mlx5_eq_notifier_unregister(dev, &table->cq_err_nb);
649652 return err;
650653 }
drivers/net/ethernet/mellanox/mlx5/core/events.c+3−1
@@ -346,8 +346,10 @@ int mlx5_events_init(struct mlx5_core_dev *dev) · 345 unmodified lines
346346 events->dev = dev;
347347 dev->priv.events = events;
348348 events->wq = create_singlethread_workqueue("mlx5_events");
349− if (!events->wq)
349+ if (!events->wq) {
350+ kfree(events);
350351 return -ENOMEM;
352+ }
351353 INIT_WORK(&events->pcie_core_work, mlx5_pcie_event);
352354
353355 return 0;
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c+19−11
@@ -344,17 +344,12 @@ static void tree_put_node(struct fs_node *node, bool locked) · 343 unmodified lines
344344 if (node->del_hw_func)
345345 node->del_hw_func(node);
346346 if (parent_node) {
347− /* Only root namespace doesn't have parent and we just
348− * need to free its node.
349− */
350347 down_write_ref_node(parent_node, locked);
351348 list_del_init(&node->list);
352− if (node->del_sw_func)
353− node->del_sw_func(node);
354− up_write_ref_node(parent_node, locked);
355− } else {
356− kfree(node);
357349 }
350+ node->del_sw_func(node);
351+ if (parent_node)
352+ up_write_ref_node(parent_node, locked);
358353 node = NULL;
359354 }
360355 if (!node && parent_node)
@@ -468,8 +463,10 @@ static void del_sw_flow_table(struct fs_node *node) · 107 unmodified lines
468463 fs_get_obj(ft, node);
469464
470465 rhltable_destroy(&ft->fgs_hash);
471− fs_get_obj(prio, ft->node.parent);
472− prio->num_ft--;
466+ if (ft->node.parent) {
467+ fs_get_obj(prio, ft->node.parent);
468+ prio->num_ft--;
469+ }
473470 kfree(ft);
474471 }
475472
@@ -2351,6 +2348,17 @@ static int init_root_tree(struct mlx5_flow_steering *steering, · 1875 unmodified lines
23512348 return 0;
23522349 }
23532350
2351+static void del_sw_root_ns(struct fs_node *node)
2352+{
2353+ struct mlx5_flow_root_namespace *root_ns;
2354+ struct mlx5_flow_namespace *ns;
2355+
2356+ fs_get_obj(ns, node);
2357+ root_ns = container_of(ns, struct mlx5_flow_root_namespace, ns);
2358+ mutex_destroy(&root_ns->chain_lock);
2359+ kfree(node);
2360+}
2361+
23542362 static struct mlx5_flow_root_namespace
23552363 *create_root_ns(struct mlx5_flow_steering *steering,
23562364 enum fs_flow_table_type table_type)
@@ -2377,7 +2385,7 @@ static struct mlx5_flow_root_namespace · 20 unmodified lines
23772385 ns = &root_ns->ns;
23782386 fs_init_namespace(ns);
23792387 mutex_init(&root_ns->chain_lock);
2380− tree_init_node(&ns->node, NULL, NULL);
2388+ tree_init_node(&ns->node, NULL, del_sw_root_ns);
23812389 tree_add_node(&ns->node, NULL);
23822390
23832391 return root_ns;
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c+2−2
@@ -396,7 +396,7 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv) · 395 unmodified lines
396396 err_destroy_direct_tirs:
397397 mlx5e_destroy_direct_tirs(priv, priv->direct_tir);
398398 err_destroy_indirect_tirs:
399− mlx5e_destroy_indirect_tirs(priv, true);
399+ mlx5e_destroy_indirect_tirs(priv);
400400 err_destroy_direct_rqts:
401401 mlx5e_destroy_direct_rqts(priv, priv->direct_tir);
402402 err_destroy_indirect_rqts:
@@ -412,7 +412,7 @@ static void mlx5i_cleanup_rx(struct mlx5e_priv *priv) · 9 unmodified lines
412412 {
413413 mlx5i_destroy_flow_steering(priv);
414414 mlx5e_destroy_direct_tirs(priv, priv->direct_tir);
415− mlx5e_destroy_indirect_tirs(priv, true);
415+ mlx5e_destroy_indirect_tirs(priv);
416416 mlx5e_destroy_direct_rqts(priv, priv->direct_tir);
417417 mlx5e_destroy_rqt(priv, &priv->indir_rqt);
418418 mlx5e_close_drop_rq(&priv->drop_rq);
drivers/net/ethernet/mellanox/mlx5/core/main.c+6−1
@@ -965,6 +965,8 @@ static int mlx5_function_setup(struct mlx5_core_dev *dev, bool boot) · 964 unmodified lines
965965 goto err_cmd_cleanup;
966966 }
967967
968+ mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_UP);
969+
968970 err = mlx5_core_enable_hca(dev, 0);
969971 if (err) {
970972 mlx5_core_err(dev, "enable hca failed\n");
@@ -1026,6 +1028,7 @@ reclaim_boot_pages: · 55 unmodified lines
10261028 err_disable_hca:
10271029 mlx5_core_disable_hca(dev, 0);
10281030 err_cmd_cleanup:
1031+ mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_DOWN);
10291032 mlx5_cmd_cleanup(dev);
10301033
10311034 return err;
@@ -1043,6 +1046,7 @@ static int mlx5_function_teardown(struct mlx5_core_dev *dev, bool boot) · 11 unmodified lines
10431046 }
10441047 mlx5_reclaim_startup_pages(dev);
10451048 mlx5_core_disable_hca(dev, 0);
1049+ mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_DOWN);
10461050 mlx5_cmd_cleanup(dev);
10471051
10481052 return 0;
@@ -1191,7 +1195,7 @@ int mlx5_load_one(struct mlx5_core_dev *dev, bool boot) · 142 unmodified lines
11911195
11921196 err = mlx5_function_setup(dev, boot);
11931197 if (err)
1194− goto out;
1198+ goto err_function;
11951199
11961200 if (boot) {
11971201 err = mlx5_init_once(dev);
@@ -1229,6 +1233,7 @@ err_load: · 31 unmodified lines
12291233 mlx5_cleanup_once(dev);
12301234 function_teardown:
12311235 mlx5_function_teardown(dev, boot);
1236+err_function:
12321237 dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR;
12331238 mutex_unlock(&dev->intf_state_mutex);
12341239
drivers/net/ethernet/mellanox/mlxsw/spectrum.c+12−2
@@ -3986,6 +3986,7 @@ static void mlxsw_sp_ports_remove(struct mlxsw_sp *mlxsw_sp) · 3985 unmodified lines
39863986 mlxsw_sp_port_remove(mlxsw_sp, i);
39873987 mlxsw_sp_cpu_port_remove(mlxsw_sp);
39883988 kfree(mlxsw_sp->ports);
3989+ mlxsw_sp->ports = NULL;
39893990 }
39903991
39913992 static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp)
@@ -4022,6 +4023,7 @@ err_port_create: · 30 unmodified lines
40224023 mlxsw_sp_cpu_port_remove(mlxsw_sp);
40234024 err_cpu_port_create:
40244025 kfree(mlxsw_sp->ports);
4026+ mlxsw_sp->ports = NULL;
40254027 return err;
40264028 }
40274029
@@ -4143,6 +4145,14 @@ static int mlxsw_sp_local_ports_offset(struct mlxsw_core *mlxsw_core, · 115 unmodified lines
41434145 return mlxsw_core_res_get(mlxsw_core, local_ports_in_x_res_id);
41444146 }
41454147
4148+static struct mlxsw_sp_port *
4149+mlxsw_sp_port_get_by_local_port(struct mlxsw_sp *mlxsw_sp, u8 local_port)
4150+{
4151+ if (mlxsw_sp->ports && mlxsw_sp->ports[local_port])
4152+ return mlxsw_sp->ports[local_port];
4153+ return NULL;
4154+}
4155+
41464156 static int mlxsw_sp_port_split(struct mlxsw_core *mlxsw_core, u8 local_port,
41474157 unsigned int count,
41484158 struct netlink_ext_ack *extack)
@@ -4156,7 +4166,7 @@ static int mlxsw_sp_port_split(struct mlxsw_core *mlxsw_core, u8 local_port, · 7 unmodified lines
41564166 int i;
41574167 int err;
41584168
4159− mlxsw_sp_port = mlxsw_sp->ports[local_port];
4169+ mlxsw_sp_port = mlxsw_sp_port_get_by_local_port(mlxsw_sp, local_port);
41604170 if (!mlxsw_sp_port) {
41614171 dev_err(mlxsw_sp->bus_info->dev, "Port number \"%d\" does not exist\n",
41624172 local_port);
@@ -4251,7 +4261,7 @@ static int mlxsw_sp_port_unsplit(struct mlxsw_core *mlxsw_core, u8 local_port, · 88 unmodified lines
42514261 int offset;
42524262 int i;
42534263
4254− mlxsw_sp_port = mlxsw_sp->ports[local_port];
4264+ mlxsw_sp_port = mlxsw_sp_port_get_by_local_port(mlxsw_sp, local_port);
42554265 if (!mlxsw_sp_port) {
42564266 dev_err(mlxsw_sp->bus_info->dev, "Port number \"%d\" does not exist\n",
42574267 local_port);
drivers/net/ethernet/mellanox/mlxsw/switchx2.c+8−0
@@ -1259,6 +1259,7 @@ static void mlxsw_sx_ports_remove(struct mlxsw_sx *mlxsw_sx) · 1258 unmodified lines
12591259 if (mlxsw_sx_port_created(mlxsw_sx, i))
12601260 mlxsw_sx_port_remove(mlxsw_sx, i);
12611261 kfree(mlxsw_sx->ports);
1262+ mlxsw_sx->ports = NULL;
12621263 }
12631264
12641265 static int mlxsw_sx_ports_create(struct mlxsw_sx *mlxsw_sx)
@@ -1293,6 +1294,7 @@ err_port_module_info_get: · 28 unmodified lines
12931294 if (mlxsw_sx_port_created(mlxsw_sx, i))
12941295 mlxsw_sx_port_remove(mlxsw_sx, i);
12951296 kfree(mlxsw_sx->ports);
1297+ mlxsw_sx->ports = NULL;
12961298 return err;
12971299 }
12981300
@@ -1376,6 +1378,12 @@ static int mlxsw_sx_port_type_set(struct mlxsw_core *mlxsw_core, u8 local_port, · 77 unmodified lines
13761378 u8 module, width;
13771379 int err;
13781380
1381+ if (!mlxsw_sx->ports || !mlxsw_sx->ports[local_port]) {
1382+ dev_err(mlxsw_sx->bus_info->dev, "Port number \"%d\" does not exist\n",
1383+ local_port);
1384+ return -EINVAL;
1385+ }
1386+
13791387 if (new_type == DEVLINK_PORT_TYPE_AUTO)
13801388 return -EOPNOTSUPP;
13811389
drivers/net/ethernet/microchip/encx24j600.c+4−1
@@ -1070,7 +1070,7 @@ static int encx24j600_spi_probe(struct spi_device *spi) · 1069 unmodified lines
10701070 if (unlikely(ret)) {
10711071 netif_err(priv, probe, ndev, "Error %d initializing card encx24j600 card\n",
10721072 ret);
1073− goto out_free;
1073+ goto out_stop;
10741074 }
10751075
10761076 eidled = encx24j600_read_reg(priv, EIDLED);
@@ -1088,6 +1088,8 @@ static int encx24j600_spi_probe(struct spi_device *spi) · 11 unmodified lines
10881088
10891089 out_unregister:
10901090 unregister_netdev(priv->ndev);
1091+out_stop:
1092+ kthread_stop(priv->kworker_task);
10911093 out_free:
10921094 free_netdev(ndev);
10931095
@@ -1100,6 +1102,7 @@ static int encx24j600_spi_remove(struct spi_device *spi) · 6 unmodified lines
11001102 struct encx24j600_priv *priv = dev_get_drvdata(&spi->dev);
11011103
11021104 unregister_netdev(priv->ndev);
1105+ kthread_stop(priv->kworker_task);
11031106
11041107 free_netdev(priv->ndev);
11051108
drivers/net/ethernet/mscc/ocelot.c+1−1
@@ -1467,7 +1467,7 @@ static void ocelot_port_attr_ageing_set(struct ocelot *ocelot, int port, · 1466 unmodified lines
14671467 unsigned long ageing_clock_t)
14681468 {
14691469 unsigned long ageing_jiffies = clock_t_to_jiffies(ageing_clock_t);
1470− u32 ageing_time = jiffies_to_msecs(ageing_jiffies) / 1000;
1470+ u32 ageing_time = jiffies_to_msecs(ageing_jiffies);
14711471
14721472 ocelot_set_ageing_time(ocelot, ageing_time);
14731473 }
drivers/net/ethernet/netronome/nfp/abm/main.c+3−1
@@ -333,8 +333,10 @@ nfp_abm_vnic_alloc(struct nfp_app *app, struct nfp_net *nn, unsigned int id) · 332 unmodified lines
333333 goto err_free_alink;
334334
335335 alink->prio_map = kzalloc(abm->prio_map_len, GFP_KERNEL);
336− if (!alink->prio_map)
336+ if (!alink->prio_map) {
337+ err = -ENOMEM;
337338 goto err_free_alink;
339+ }
338340
339341 /* This is a multi-host app, make sure MAC/PHY is up, but don't
340342 * make the MAC/PHY state follow the state of any of the ports.
drivers/net/ethernet/pensando/ionic/ionic_lif.c+12−7
@@ -2118,6 +2118,7 @@ static void ionic_lif_handle_fw_up(struct ionic_lif *lif) · 2117 unmodified lines
21182118 dev_info(ionic->dev, "FW Up: restarting LIFs\n");
21192119
21202120 ionic_init_devinfo(ionic);
2121+ ionic_port_init(ionic);
21212122 err = ionic_qcqs_alloc(lif);
21222123 if (err)
21232124 goto err_out;
@@ -2348,7 +2349,17 @@ static int ionic_station_set(struct ionic_lif *lif) · 224 unmodified lines
23482349 if (is_zero_ether_addr(ctx.comp.lif_getattr.mac))
23492350 return 0;
23502351
2351− if (!ether_addr_equal(ctx.comp.lif_getattr.mac, netdev->dev_addr)) {
2352+ if (!is_zero_ether_addr(netdev->dev_addr)) {
2353+ /* If the netdev mac is non-zero and doesn't match the default
2354+ * device address, it was set by something earlier and we're
2355+ * likely here again after a fw-upgrade reset. We need to be
2356+ * sure the netdev mac is in our filter list.
2357+ */
2358+ if (!ether_addr_equal(ctx.comp.lif_getattr.mac,
2359+ netdev->dev_addr))
2360+ ionic_lif_addr(lif, netdev->dev_addr, true);
2361+ } else {
2362+ /* Update the netdev mac with the device's mac */
23522363 memcpy(addr.sa_data, ctx.comp.lif_getattr.mac, netdev->addr_len);
23532364 addr.sa_family = AF_INET;
23542365 err = eth_prepare_mac_addr_change(netdev, &addr);
@@ -2358,12 +2369,6 @@ static int ionic_station_set(struct ionic_lif *lif) · 3 unmodified lines
23582369 return 0;
23592370 }
23602371
2361− if (!is_zero_ether_addr(netdev->dev_addr)) {
2362− netdev_dbg(lif->netdev, "deleting station MAC addr %pM\n",
2363− netdev->dev_addr);
2364− ionic_lif_addr(lif, netdev->dev_addr, false);
2365− }
2366−
23672372 eth_commit_mac_addr_change(netdev, &addr);
23682373 }
23692374
drivers/net/ethernet/pensando/ionic/ionic_main.c+9−9
@@ -509,16 +509,16 @@ int ionic_port_init(struct ionic *ionic) · 508 unmodified lines
509509 size_t sz;
510510 int err;
511511
512− if (idev->port_info)
513− return 0;
514−
515− idev->port_info_sz = ALIGN(sizeof(*idev->port_info), PAGE_SIZE);
516− idev->port_info = dma_alloc_coherent(ionic->dev, idev->port_info_sz,
517− &idev->port_info_pa,
518− GFP_KERNEL);
519512 if (!idev->port_info) {
520− dev_err(ionic->dev, "Failed to allocate port info, aborting\n");
521− return -ENOMEM;
513+ idev->port_info_sz = ALIGN(sizeof(*idev->port_info), PAGE_SIZE);
514+ idev->port_info = dma_alloc_coherent(ionic->dev,
515+ idev->port_info_sz,
516+ &idev->port_info_pa,
517+ GFP_KERNEL);
518+ if (!idev->port_info) {
519+ dev_err(ionic->dev, "Failed to allocate port info\n");
520+ return -ENOMEM;
521+ }
522522 }
523523
524524 sz = min(sizeof(ident->port.config), sizeof(idev->dev_cmd_regs->data));
drivers/net/ethernet/realtek/r8169_main.c+17−2
@@ -1050,6 +1050,13 @@ static u16 rtl_ephy_read(struct rtl8169_private *tp, int reg_addr) · 1049 unmodified lines
10501050 RTL_R32(tp, EPHYAR) & EPHYAR_DATA_MASK : ~0;
10511051 }
10521052
1053+static void r8168fp_adjust_ocp_cmd(struct rtl8169_private *tp, u32 *cmd, int type)
1054+{
1055+ /* based on RTL8168FP_OOBMAC_BASE in vendor driver */
1056+ if (tp->mac_version == RTL_GIGA_MAC_VER_52 && type == ERIAR_OOB)
1057+ *cmd |= 0x7f0 << 18;
1058+}
1059+
10531060 DECLARE_RTL_COND(rtl_eriar_cond)
10541061 {
10551062 return RTL_R32(tp, ERIAR) & ERIAR_FLAG;
@@ -1058,9 +1065,12 @@ DECLARE_RTL_COND(rtl_eriar_cond) · 2 unmodified lines
10581065 static void _rtl_eri_write(struct rtl8169_private *tp, int addr, u32 mask,
10591066 u32 val, int type)
10601067 {
1068+ u32 cmd = ERIAR_WRITE_CMD | type | mask | addr;
1069+
10611070 BUG_ON((addr & 3) || (mask == 0));
10621071 RTL_W32(tp, ERIDR, val);
1063− RTL_W32(tp, ERIAR, ERIAR_WRITE_CMD | type | mask | addr);
1072+ r8168fp_adjust_ocp_cmd(tp, &cmd, type);
1073+ RTL_W32(tp, ERIAR, cmd);
10641074
10651075 rtl_udelay_loop_wait_low(tp, &rtl_eriar_cond, 100, 100);
10661076 }
@@ -1073,7 +1083,10 @@ static void rtl_eri_write(struct rtl8169_private *tp, int addr, u32 mask, · 6 unmodified lines
10731083
10741084 static u32 _rtl_eri_read(struct rtl8169_private *tp, int addr, int type)
10751085 {
1076− RTL_W32(tp, ERIAR, ERIAR_READ_CMD | type | ERIAR_MASK_1111 | addr);
1086+ u32 cmd = ERIAR_READ_CMD | type | ERIAR_MASK_1111 | addr;
1087+
1088+ r8168fp_adjust_ocp_cmd(tp, &cmd, type);
1089+ RTL_W32(tp, ERIAR, cmd);
10771090
10781091 return rtl_udelay_loop_wait_high(tp, &rtl_eriar_cond, 100, 100) ?
10791092 RTL_R32(tp, ERIDR) : ~0;
@@ -2127,6 +2140,8 @@ static enum mac_version rtl8169_get_mac_version(u16 xid, bool gmii) · 1047 unmodified lines
21272140 { 0x7cf, 0x348, RTL_GIGA_MAC_VER_07 },
21282141 { 0x7cf, 0x248, RTL_GIGA_MAC_VER_07 },
21292142 { 0x7cf, 0x340, RTL_GIGA_MAC_VER_13 },
2143+ /* RTL8401, reportedly works if treated as RTL8101e */
2144+ { 0x7cf, 0x240, RTL_GIGA_MAC_VER_13 },
21302145 { 0x7cf, 0x343, RTL_GIGA_MAC_VER_10 },
21312146 { 0x7cf, 0x342, RTL_GIGA_MAC_VER_16 },
21322147 { 0x7c8, 0x348, RTL_GIGA_MAC_VER_09 },
drivers/net/ethernet/sgi/ioc3-eth.c+4−4
@@ -848,14 +848,14 @@ static int ioc3eth_probe(struct platform_device *pdev) · 847 unmodified lines
848848 ip = netdev_priv(dev);
849849 ip->dma_dev = pdev->dev.parent;
850850 ip->regs = devm_platform_ioremap_resource(pdev, 0);
851− if (!ip->regs) {
852− err = -ENOMEM;
851+ if (IS_ERR(ip->regs)) {
852+ err = PTR_ERR(ip->regs);
853853 goto out_free;
854854 }
855855
856856 ip->ssram = devm_platform_ioremap_resource(pdev, 1);
857− if (!ip->ssram) {
858− err = -ENOMEM;
857+ if (IS_ERR(ip->ssram)) {
858+ err = PTR_ERR(ip->ssram);
859859 goto out_free;
860860 }
861861
drivers/net/ethernet/smsc/smsc911x.c+5−4
@@ -2493,20 +2493,20 @@ static int smsc911x_drv_probe(struct platform_device *pdev) · 2492 unmodified lines
24932493
24942494 retval = smsc911x_init(dev);
24952495 if (retval < 0)
2496− goto out_disable_resources;
2496+ goto out_init_fail;
24972497
24982498 netif_carrier_off(dev);
24992499
25002500 retval = smsc911x_mii_init(pdev, dev);
25012501 if (retval) {
25022502 SMSC_WARN(pdata, probe, "Error %i initialising mii", retval);
2503− goto out_disable_resources;
2503+ goto out_init_fail;
25042504 }
25052505
25062506 retval = register_netdev(dev);
25072507 if (retval) {
25082508 SMSC_WARN(pdata, probe, "Error %i registering device", retval);
2509− goto out_disable_resources;
2509+ goto out_init_fail;
25102510 } else {
25112511 SMSC_TRACE(pdata, probe,
25122512 "Network interface: \"%s\"", dev->name);
@@ -2547,9 +2547,10 @@ static int smsc911x_drv_probe(struct platform_device *pdev) · 34 unmodified lines
25472547
25482548 return 0;
25492549
2550−out_disable_resources:
2550+out_init_fail:
25512551 pm_runtime_put(&pdev->dev);
25522552 pm_runtime_disable(&pdev->dev);
2553+out_disable_resources:
25532554 (void)smsc911x_disable_resources(pdev);
25542555 out_enable_resources_fail:
25552556 smsc911x_free_resources(pdev);
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c+13−0
@@ -319,6 +319,19 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) · 318 unmodified lines
319319 /* Enable PTP clock */
320320 regmap_read(gmac->nss_common, NSS_COMMON_CLK_GATE, &val);
321321 val |= NSS_COMMON_CLK_GATE_PTP_EN(gmac->id);
322+ switch (gmac->phy_mode) {
323+ case PHY_INTERFACE_MODE_RGMII:
324+ val |= NSS_COMMON_CLK_GATE_RGMII_RX_EN(gmac->id) |
325+ NSS_COMMON_CLK_GATE_RGMII_TX_EN(gmac->id);
326+ break;
327+ case PHY_INTERFACE_MODE_SGMII:
328+ val |= NSS_COMMON_CLK_GATE_GMII_RX_EN(gmac->id) |
329+ NSS_COMMON_CLK_GATE_GMII_TX_EN(gmac->id);
330+ break;
331+ default:
332+ /* We don't get here; the switch above will have errored out */
333+ unreachable();
334+ }
322335 regmap_write(gmac->nss_common, NSS_COMMON_CLK_GATE, val);
323336
324337 if (gmac->phy_mode == PHY_INTERFACE_MODE_SGMII) {
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c+15−2
@@ -75,6 +75,11 @@ struct ethqos_emac_por { · 74 unmodified lines
7575 unsigned int value;
7676 };
7777
78+struct ethqos_emac_driver_data {
79+ const struct ethqos_emac_por *por;
80+ unsigned int num_por;
81+};
82+
7883 struct qcom_ethqos {
7984 struct platform_device *pdev;
8085 void __iomem *rgmii_base;
@@ -171,6 +176,11 @@ static const struct ethqos_emac_por emac_v2_3_0_por[] = { · 90 unmodified lines
171176 { .offset = RGMII_IO_MACRO_CONFIG2, .value = 0x00002060 },
172177 };
173178
179+static const struct ethqos_emac_driver_data emac_v2_3_0_data = {
180+ .por = emac_v2_3_0_por,
181+ .num_por = ARRAY_SIZE(emac_v2_3_0_por),
182+};
183+
174184 static int ethqos_dll_configure(struct qcom_ethqos *ethqos)
175185 {
176186 unsigned int val;
@@ -442,6 +452,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) · 265 unmodified lines
442452 struct device_node *np = pdev->dev.of_node;
443453 struct plat_stmmacenet_data *plat_dat;
444454 struct stmmac_resources stmmac_res;
455+ const struct ethqos_emac_driver_data *data;
445456 struct qcom_ethqos *ethqos;
446457 struct resource *res;
447458 int ret;
@@ -471,7 +482,9 @@ static int qcom_ethqos_probe(struct platform_device *pdev) · 23 unmodified lines
471482 goto err_mem;
472483 }
473484
474− ethqos->por = of_device_get_match_data(&pdev->dev);
485+ data = of_device_get_match_data(&pdev->dev);
486+ ethqos->por = data->por;
487+ ethqos->num_por = data->num_por;
475488
476489 ethqos->rgmii_clk = devm_clk_get(&pdev->dev, "rgmii");
477490 if (IS_ERR(ethqos->rgmii_clk)) {
@@ -526,7 +539,7 @@ static int qcom_ethqos_remove(struct platform_device *pdev) · 48 unmodified lines
526539 }
527540
528541 static const struct of_device_id qcom_ethqos_match[] = {
529− { .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_por},
542+ { .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_data},
530543 { }
531544 };
532545 MODULE_DEVICE_TABLE(of, qcom_ethqos_match);
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+2−2
@@ -5190,8 +5190,6 @@ int stmmac_resume(struct device *dev) · 5189 unmodified lines
51905190 return ret;
51915191 }
51925192
5193− netif_device_attach(ndev);
5194−
51955193 mutex_lock(&priv->lock);
51965194
51975195 stmmac_reset_queues_param(priv);
@@ -5218,6 +5216,8 @@ int stmmac_resume(struct device *dev) · 20 unmodified lines
52185216
52195217 phylink_mac_change(priv->phylink, true);
52205218
5219+ netif_device_attach(ndev);
5220+
52215221 return 0;
52225222 }
52235223 EXPORT_SYMBOL_GPL(stmmac_resume);
drivers/net/ethernet/sun/cassini.c+1−2
@@ -4963,7 +4963,7 @@ static int cas_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 4962 unmodified lines
49634963 cas_cacheline_size)) {
49644964 dev_err(&pdev->dev, "Could not set PCI cache "
49654965 "line size\n");
4966− goto err_write_cacheline;
4966+ goto err_out_free_res;
49674967 }
49684968 }
49694969 #endif
@@ -5136,7 +5136,6 @@ err_out_iounmap: · 166 unmodified lines
51365136 err_out_free_res:
51375137 pci_release_regions(pdev);
51385138
5139−err_write_cacheline:
51405139 /* Try to restore it in case the error occurred after we
51415140 * set it.
51425141 */
drivers/net/ethernet/ti/Kconfig+6−10
@@ -49,6 +49,7 @@ config TI_CPSW_PHY_SEL · 48 unmodified lines
4949 config TI_CPSW
5050 tristate "TI CPSW Switch Support"
5151 depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || COMPILE_TEST
52+ depends on TI_CPTS || !TI_CPTS
5253 select TI_DAVINCI_MDIO
5354 select MFD_SYSCON
5455 select PAGE_POOL
@@ -64,6 +65,7 @@ config TI_CPSW_SWITCHDEV · 9 unmodified lines
6465 tristate "TI CPSW Switch Support with switchdev"
6566 depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || COMPILE_TEST
6667 depends on NET_SWITCHDEV
68+ depends on TI_CPTS || !TI_CPTS
6769 select PAGE_POOL
6870 select TI_DAVINCI_MDIO
6971 select MFD_SYSCON
@@ -77,23 +79,16 @@ config TI_CPSW_SWITCHDEV · 7 unmodified lines
7779 will be called cpsw_new.
7880
7981 config TI_CPTS
80− bool "TI Common Platform Time Sync (CPTS) Support"
81− depends on TI_CPSW || TI_KEYSTONE_NETCP || TI_CPSW_SWITCHDEV || COMPILE_TEST
82+ tristate "TI Common Platform Time Sync (CPTS) Support"
83+ depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || COMPILE_TEST
8284 depends on COMMON_CLK
83− depends on POSIX_TIMERS
85+ depends on PTP_1588_CLOCK
8486 ---help---
8587 This driver supports the Common Platform Time Sync unit of
8688 the CPSW Ethernet Switch and Keystone 2 1g/10g Switch Subsystem.
8789 The unit can time stamp PTP UDP/IPv4 and Layer 2 packets, and the
8890 driver offers a PTP Hardware Clock.
8991
90−config TI_CPTS_MOD
91− tristate
92− depends on TI_CPTS
93− depends on PTP_1588_CLOCK
94− default y if TI_CPSW=y || TI_KEYSTONE_NETCP=y || TI_CPSW_SWITCHDEV=y
95− default m
96−
9792 config TI_K3_AM65_CPSW_NUSS
9893 tristate "TI K3 AM654x/J721E CPSW Ethernet driver"
9994 depends on ARCH_K3 && OF && TI_K3_UDMA_GLUE_LAYER
@@ -114,6 +109,7 @@ config TI_KEYSTONE_NETCP · 14 unmodified lines
114109 select TI_DAVINCI_MDIO
115110 depends on OF
116111 depends on KEYSTONE_NAVIGATOR_DMA && KEYSTONE_NAVIGATOR_QMSS
112+ depends on TI_CPTS || !TI_CPTS
117113 ---help---
118114 This driver supports TI's Keystone NETCP Core.
119115
drivers/net/ethernet/ti/Makefile+1−1
@@ -13,7 +13,7 @@ obj-$(CONFIG_TI_DAVINCI_EMAC) += ti_davinci_emac.o · 12 unmodified lines
1313 ti_davinci_emac-y := davinci_emac.o davinci_cpdma.o
1414 obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o
1515 obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o
16−obj-$(CONFIG_TI_CPTS_MOD) += cpts.o
16+obj-$(CONFIG_TI_CPTS) += cpts.o
1717 obj-$(CONFIG_TI_CPSW) += ti_cpsw.o
1818 ti_cpsw-y := cpsw.o davinci_cpdma.o cpsw_ale.o cpsw_priv.o cpsw_sl.o cpsw_ethtool.o
1919 obj-$(CONFIG_TI_CPSW_SWITCHDEV) += ti_cpsw_new.o
drivers/net/ethernet/ti/am65-cpsw-nuss.c+2−1
@@ -1895,8 +1895,9 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev) · 1894 unmodified lines
18951895 ale_params.nu_switch_ale = true;
18961896
18971897 common->ale = cpsw_ale_create(&ale_params);
1898− if (!common->ale) {
1898+ if (IS_ERR(common->ale)) {
18991899 dev_err(dev, "error initializing ale engine\n");
1900+ ret = PTR_ERR(common->ale);
19001901 goto err_of_clear;
19011902 }
19021903
drivers/net/ethernet/ti/cpsw.c+4−0
@@ -1753,11 +1753,15 @@ static int cpsw_suspend(struct device *dev) · 1752 unmodified lines
17531753 struct cpsw_common *cpsw = dev_get_drvdata(dev);
17541754 int i;
17551755
1756+ rtnl_lock();
1757+
17561758 for (i = 0; i < cpsw->data.slaves; i++)
17571759 if (cpsw->slaves[i].ndev)
17581760 if (netif_running(cpsw->slaves[i].ndev))
17591761 cpsw_ndo_stop(cpsw->slaves[i].ndev);
17601762
1763+ rtnl_unlock();
1764+
17611765 /* Select sleep pin state */
17621766 pinctrl_pm_select_sleep_state(dev);
17631767
drivers/net/ethernet/ti/cpsw_ale.c+1−1
@@ -955,7 +955,7 @@ struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params) · 954 unmodified lines
955955
956956 ale = devm_kzalloc(params->dev, sizeof(*ale), GFP_KERNEL);
957957 if (!ale)
958− return NULL;
958+ return ERR_PTR(-ENOMEM);
959959
960960 ale->p0_untag_vid_mask =
961961 devm_kmalloc_array(params->dev, BITS_TO_LONGS(VLAN_N_VID),
drivers/net/ethernet/ti/cpsw_priv.c+2−2
@@ -490,9 +490,9 @@ int cpsw_init_common(struct cpsw_common *cpsw, void __iomem *ss_regs, · 489 unmodified lines
490490 ale_params.ale_ports = CPSW_ALE_PORTS_NUM;
491491
492492 cpsw->ale = cpsw_ale_create(&ale_params);
493− if (!cpsw->ale) {
493+ if (IS_ERR(cpsw->ale)) {
494494 dev_err(dev, "error initializing ale engine\n");
495− return -ENODEV;
495+ return PTR_ERR(cpsw->ale);
496496 }
497497
498498 dma_params.dev = dev;
drivers/net/ethernet/ti/netcp_ethss.c+2−2
@@ -3704,9 +3704,9 @@ static int gbe_probe(struct netcp_device *netcp_device, struct device *dev, · 3703 unmodified lines
37043704 ale_params.nu_switch_ale = true;
37053705 }
37063706 gbe_dev->ale = cpsw_ale_create(&ale_params);
3707− if (!gbe_dev->ale) {
3707+ if (IS_ERR(gbe_dev->ale)) {
37083708 dev_err(gbe_dev->dev, "error initializing ale engine\n");
3709− ret = -ENODEV;
3709+ ret = PTR_ERR(gbe_dev->ale);
37103710 goto free_sec_ports;
37113711 } else {
37123712 dev_dbg(gbe_dev->dev, "Created a gbe ale engine\n");
drivers/net/hamradio/bpqether.c+2−1
@@ -127,7 +127,8 @@ static inline struct net_device *bpq_get_ax25_dev(struct net_device *dev) · 126 unmodified lines
127127 {
128128 struct bpqdev *bpq;
129129
130− list_for_each_entry_rcu(bpq, &bpq_devices, bpq_list) {
130+ list_for_each_entry_rcu(bpq, &bpq_devices, bpq_list,
131+ lockdep_rtnl_is_held()) {
131132 if (bpq->ethdev == dev)
132133 return bpq->axdev;
133134 }
drivers/net/ipa/gsi.c+1−0
@@ -1392,6 +1392,7 @@ static int gsi_channel_poll(struct napi_struct *napi, int budget) · 1391 unmodified lines
13921392 while (count < budget) {
13931393 struct gsi_trans *trans;
13941394
1395+ count++;
13951396 trans = gsi_channel_poll_one(channel);
13961397 if (!trans)
13971398 break;
drivers/net/ipa/gsi_trans.c+3−2
@@ -399,13 +399,14 @@ void gsi_trans_cmd_add(struct gsi_trans *trans, void *buf, u32 size, · 398 unmodified lines
399399 /* assert(which < trans->tre_count); */
400400
401401 /* Set the page information for the buffer. We also need to fill in
402− * the DMA address for the buffer (something dma_map_sg() normally
403− * does).
402+ * the DMA address and length for the buffer (something dma_map_sg()
403+ * normally does).
404404 */
405405 sg = &trans->sgl[which];
406406
407407 sg_set_buf(sg, buf, size);
408408 sg_dma_address(sg) = addr;
409+ sg_dma_len(sg) = sg->length;
409410
410411 info = &trans->info[which];
411412 info->opcode = opcode;
drivers/net/ipa/ipa_cmd.c+3−11
@@ -628,23 +628,15 @@ static void ipa_cmd_transfer_add(struct gsi_trans *trans, u16 size) · 627 unmodified lines
628628
629629 void ipa_cmd_tag_process_add(struct gsi_trans *trans)
630630 {
631− ipa_cmd_register_write_add(trans, 0, 0, 0, true);
632−#if 1
633− /* Reference these functions to avoid a compile error */
634− (void)ipa_cmd_ip_packet_init_add;
635− (void)ipa_cmd_ip_tag_status_add;
636− (void) ipa_cmd_transfer_add;
637−#else
638631 struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi);
639− struct gsi_endpoint *endpoint;
632+ struct ipa_endpoint *endpoint;
640633
641634 endpoint = ipa->name_map[IPA_ENDPOINT_AP_LAN_RX];
642− ipa_cmd_ip_packet_init_add(trans, endpoint->endpoint_id);
643635
636+ ipa_cmd_register_write_add(trans, 0, 0, 0, true);
637+ ipa_cmd_ip_packet_init_add(trans, endpoint->endpoint_id);
644638 ipa_cmd_ip_tag_status_add(trans, 0xcba987654321);
645−
646639 ipa_cmd_transfer_add(trans, 4);
647−#endif
648640 }
649641
650642 /* Returns the number of commands required for the tag process */
drivers/net/ipa/ipa_smp2p.c+1−1
@@ -53,7 +53,7 @@ · 52 unmodified lines
5353 * @clock_on: Whether IPA clock is on
5454 * @notified: Whether modem has been notified of clock state
5555 * @disabled: Whether setup ready interrupt handling is disabled
56− * @mutex mutex: Motex protecting ready interrupt/shutdown interlock
56+ * @mutex: Mutex protecting ready-interrupt/shutdown interlock
5757 * @panic_notifier: Panic notifier structure
5858 */
5959 struct ipa_smp2p {
drivers/net/netdevsim/dev.c+1−2
@@ -858,8 +858,7 @@ nsim_dev_devlink_trap_policer_counter_get(struct devlink *devlink, · 857 unmodified lines
858858 return -EINVAL;
859859
860860 cnt = &nsim_dev->trap_data->trap_policers_cnt_arr[policer->id - 1];
861− *p_drops = *cnt;
862− *cnt += jiffies % 64;
861+ *p_drops = (*cnt)++;
863862
864863 return 0;
865864 }
drivers/net/phy/broadcom.c+6−2
@@ -225,8 +225,12 @@ static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev) · 224 unmodified lines
225225 else
226226 val |= BCM54XX_SHD_SCR3_DLLAPD_DIS;
227227
228− if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY)
229− val |= BCM54XX_SHD_SCR3_TRDDAPD;
228+ if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) {
229+ if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810)
230+ val |= BCM54810_SHD_SCR3_TRDDAPD;
231+ else
232+ val |= BCM54XX_SHD_SCR3_TRDDAPD;
233+ }
230234
231235 if (orig != val)
232236 bcm_phy_write_shadow(phydev, BCM54XX_SHD_SCR3, val);
drivers/net/phy/mscc/mscc.h+2−0
@@ -354,6 +354,8 @@ struct vsc8531_private { · 353 unmodified lines
354354 u64 *stats;
355355 int nstats;
356356 bool pkg_init;
357+ /* PHY address within the package. */
358+ u8 addr;
357359 /* For multiple port PHYs; the MDIO address of the base PHY in the
358360 * package.
359361 */
drivers/net/phy/mscc/mscc_mac.h+3−3
@@ -152,8 +152,8 @@ · 151 unmodified lines
152152 #define MSCC_MAC_PAUSE_CFG_STATE_PAUSE_STATE BIT(0)
153153 #define MSCC_MAC_PAUSE_CFG_STATE_MAC_TX_PAUSE_GEN BIT(4)
154154
155−#define MSCC_PROC_0_IP_1588_TOP_CFG_STAT_MODE_CTL 0x2
156−#define MSCC_PROC_0_IP_1588_TOP_CFG_STAT_MODE_CTL_PROTOCOL_MODE(x) (x)
157−#define MSCC_PROC_0_IP_1588_TOP_CFG_STAT_MODE_CTL_PROTOCOL_MODE_M GENMASK(2, 0)
155+#define MSCC_PROC_IP_1588_TOP_CFG_STAT_MODE_CTL 0x2
156+#define MSCC_PROC_IP_1588_TOP_CFG_STAT_MODE_CTL_PROTOCOL_MODE(x) (x)
157+#define MSCC_PROC_IP_1588_TOP_CFG_STAT_MODE_CTL_PROTOCOL_MODE_M GENMASK(2, 0)
158158
159159 #endif /* _MSCC_PHY_LINE_MAC_H_ */
drivers/net/phy/mscc/mscc_macsec.c+10−6
@@ -316,6 +316,8 @@ static void vsc8584_macsec_mac_init(struct phy_device *phydev, · 315 unmodified lines
316316 /* Must be called with mdio_lock taken */
317317 static int __vsc8584_macsec_init(struct phy_device *phydev)
318318 {
319+ struct vsc8531_private *priv = phydev->priv;
320+ enum macsec_bank proc_bank;
319321 u32 val;
320322
321323 vsc8584_macsec_block_init(phydev, MACSEC_INGR);
@@ -351,12 +353,14 @@ static int __vsc8584_macsec_init(struct phy_device *phydev) · 29 unmodified lines
351353 val |= MSCC_FCBUF_ENA_CFG_TX_ENA | MSCC_FCBUF_ENA_CFG_RX_ENA;
352354 vsc8584_macsec_phy_write(phydev, FC_BUFFER, MSCC_FCBUF_ENA_CFG, val);
353355
354− val = vsc8584_macsec_phy_read(phydev, IP_1588,
355− MSCC_PROC_0_IP_1588_TOP_CFG_STAT_MODE_CTL);
356− val &= ~MSCC_PROC_0_IP_1588_TOP_CFG_STAT_MODE_CTL_PROTOCOL_MODE_M;
357− val |= MSCC_PROC_0_IP_1588_TOP_CFG_STAT_MODE_CTL_PROTOCOL_MODE(4);
358− vsc8584_macsec_phy_write(phydev, IP_1588,
359− MSCC_PROC_0_IP_1588_TOP_CFG_STAT_MODE_CTL, val);
356+ proc_bank = (priv->addr < 2) ? PROC_0 : PROC_2;
357+
358+ val = vsc8584_macsec_phy_read(phydev, proc_bank,
359+ MSCC_PROC_IP_1588_TOP_CFG_STAT_MODE_CTL);
360+ val &= ~MSCC_PROC_IP_1588_TOP_CFG_STAT_MODE_CTL_PROTOCOL_MODE_M;
361+ val |= MSCC_PROC_IP_1588_TOP_CFG_STAT_MODE_CTL_PROTOCOL_MODE(4);
362+ vsc8584_macsec_phy_write(phydev, proc_bank,
363+ MSCC_PROC_IP_1588_TOP_CFG_STAT_MODE_CTL, val);
360364
361365 return 0;
362366 }
drivers/net/phy/mscc/mscc_macsec.h+2−1
@@ -64,7 +64,8 @@ enum macsec_bank { · 63 unmodified lines
6464 FC_BUFFER = 0x04,
6565 HOST_MAC = 0x05,
6666 LINE_MAC = 0x06,
67− IP_1588 = 0x0e,
67+ PROC_0 = 0x0e,
68+ PROC_2 = 0x0f,
6869 MACSEC_INGR = 0x38,
6970 MACSEC_EGR = 0x3c,
7071 };
drivers/net/phy/mscc/mscc_main.c+4−0
@@ -1347,6 +1347,8 @@ static int vsc8584_config_init(struct phy_device *phydev) · 1346 unmodified lines
13471347 else
13481348 vsc8531->base_addr = phydev->mdio.addr - addr;
13491349
1350+ vsc8531->addr = addr;
1351+
13501352 /* Some parts of the init sequence are identical for every PHY in the
13511353 * package. Some parts are modifying the GPIO register bank which is a
13521354 * set of registers that are affecting all PHYs, a few resetting the
@@ -1771,6 +1773,8 @@ static int vsc8514_config_init(struct phy_device *phydev) · 418 unmodified lines
17711773 else
17721774 vsc8531->base_addr = phydev->mdio.addr - addr;
17731775
1776+ vsc8531->addr = addr;
1777+
17741778 /* Some parts of the init sequence are identical for every PHY in the
17751779 * package. Some parts are modifying the GPIO register bank which is a
17761780 * set of registers that are affecting all PHYs, a few resetting the
drivers/net/phy/phy.c+5−3
@@ -1132,9 +1132,11 @@ int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data) · 1131 unmodified lines
11321132 /* Restart autonegotiation so the new modes get sent to the
11331133 * link partner.
11341134 */
1135− ret = phy_restart_aneg(phydev);
1136− if (ret < 0)
1137− return ret;
1135+ if (phydev->autoneg == AUTONEG_ENABLE) {
1136+ ret = phy_restart_aneg(phydev);
1137+ if (ret < 0)
1138+ return ret;
1139+ }
11381140 }
11391141
11401142 return 0;
drivers/net/phy/phy_device.c+2−2
@@ -1233,7 +1233,7 @@ int phy_sfp_probe(struct phy_device *phydev, · 1232 unmodified lines
12331233 const struct sfp_upstream_ops *ops)
12341234 {
12351235 struct sfp_bus *bus;
1236− int ret;
1236+ int ret = 0;
12371237
12381238 if (phydev->mdio.dev.fwnode) {
12391239 bus = sfp_bus_find_fwnode(phydev->mdio.dev.fwnode);
@@ -1245,7 +1245,7 @@ int phy_sfp_probe(struct phy_device *phydev, · 5 unmodified lines
12451245 ret = sfp_bus_add_upstream(bus, phydev, ops);
12461246 sfp_bus_put(bus);
12471247 }
1248− return 0;
1248+ return ret;
12491249 }
12501250 EXPORT_SYMBOL(phy_sfp_probe);
12511251
drivers/net/ppp/pppoe.c+3−0
@@ -490,6 +490,9 @@ static int pppoe_disc_rcv(struct sk_buff *skb, struct net_device *dev, · 489 unmodified lines
490490 if (!skb)
491491 goto out;
492492
493+ if (skb->pkt_type != PACKET_HOST)
494+ goto abort;
495+
493496 if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
494497 goto abort;
495498
drivers/net/usb/cdc_ether.c+9−2
@@ -815,14 +815,21 @@ static const struct usb_device_id products[] = { · 814 unmodified lines
815815 .driver_info = 0,
816816 },
817817
818−/* Microsoft Surface 3 dock (based on Realtek RTL8153) */
818+/* Microsoft Surface Ethernet Adapter (based on Realtek RTL8153) */
819819 {
820820 USB_DEVICE_AND_INTERFACE_INFO(MICROSOFT_VENDOR_ID, 0x07c6, USB_CLASS_COMM,
821821 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
822822 .driver_info = 0,
823823 },
824824
825− /* TP-LINK UE300 USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */
825+/* Microsoft Surface Ethernet Adapter (based on Realtek RTL8153B) */
826+{
827+ USB_DEVICE_AND_INTERFACE_INFO(MICROSOFT_VENDOR_ID, 0x0927, USB_CLASS_COMM,
828+ USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
829+ .driver_info = 0,
830+},
831+
832+/* TP-LINK UE300 USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */
826833 {
827834 USB_DEVICE_AND_INTERFACE_INFO(TPLINK_VENDOR_ID, 0x0601, USB_CLASS_COMM,
828835 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
drivers/net/usb/hso.c+1−1
@@ -2659,7 +2659,7 @@ static struct hso_device *hso_create_bulk_serial_device( · 2658 unmodified lines
26592659 if (!
26602660 (serial->out_endp =
26612661 hso_get_ep(interface, USB_ENDPOINT_XFER_BULK, USB_DIR_OUT))) {
2662− dev_err(&interface->dev, "Failed to find BULK IN ep\n");
2662+ dev_err(&interface->dev, "Failed to find BULK OUT ep\n");
26632663 goto exit2;
26642664 }
26652665
drivers/net/usb/r8152.c+1−0
@@ -6880,6 +6880,7 @@ static const struct usb_device_id rtl8152_table[] = { · 6879 unmodified lines
68806880 {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8153)},
68816881 {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07ab)},
68826882 {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07c6)},
6883+ {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927)},
68836884 {REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101)},
68846885 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f)},
68856886 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3062)},
drivers/net/virtio_net.c+4−2
@@ -1243,9 +1243,11 @@ static bool try_fill_recv(struct virtnet_info *vi, struct receive_queue *rq, · 1242 unmodified lines
12431243 break;
12441244 } while (rq->vq->num_free);
12451245 if (virtqueue_kick_prepare(rq->vq) && virtqueue_notify(rq->vq)) {
1246− u64_stats_update_begin(&rq->stats.syncp);
1246+ unsigned long flags;
1247+
1248+ flags = u64_stats_update_begin_irqsave(&rq->stats.syncp);
12471249 rq->stats.kicks++;
1248− u64_stats_update_end(&rq->stats.syncp);
1250+ u64_stats_update_end_irqrestore(&rq->stats.syncp, flags);
12491251 }
12501252
12511253 return !oom;
drivers/net/wireguard/messages.h+1−1
@@ -32,7 +32,7 @@ enum cookie_values { · 31 unmodified lines
3232 };
3333
3434 enum counter_values {
35− COUNTER_BITS_TOTAL = 2048,
35+ COUNTER_BITS_TOTAL = 8192,
3636 COUNTER_REDUNDANT_BITS = BITS_PER_LONG,
3737 COUNTER_WINDOW_SIZE = COUNTER_BITS_TOTAL - COUNTER_REDUNDANT_BITS
3838 };
drivers/net/wireguard/noise.c+9−13
@@ -104,6 +104,7 @@ static struct noise_keypair *keypair_create(struct wg_peer *peer) · 103 unmodified lines
104104
105105 if (unlikely(!keypair))
106106 return NULL;
107+ spin_lock_init(&keypair->receiving_counter.lock);
107108 keypair->internal_id = atomic64_inc_return(&keypair_counter);
108109 keypair->entry.type = INDEX_HASHTABLE_KEYPAIR;
109110 keypair->entry.peer = peer;
@@ -358,25 +359,16 @@ out: · 248 unmodified lines
358359 memzero_explicit(output, BLAKE2S_HASH_SIZE + 1);
359360 }
360361
361−static void symmetric_key_init(struct noise_symmetric_key *key)
362−{
363− spin_lock_init(&key->counter.receive.lock);
364− atomic64_set(&key->counter.counter, 0);
365− memset(key->counter.receive.backtrack, 0,
366− sizeof(key->counter.receive.backtrack));
367− key->birthdate = ktime_get_coarse_boottime_ns();
368− key->is_valid = true;
369−}
370−
371362 static void derive_keys(struct noise_symmetric_key *first_dst,
372363 struct noise_symmetric_key *second_dst,
373364 const u8 chaining_key[NOISE_HASH_LEN])
374365 {
366+ u64 birthdate = ktime_get_coarse_boottime_ns();
375367 kdf(first_dst->key, second_dst->key, NULL, NULL,
376368 NOISE_SYMMETRIC_KEY_LEN, NOISE_SYMMETRIC_KEY_LEN, 0, 0,
377369 chaining_key);
378− symmetric_key_init(first_dst);
379− symmetric_key_init(second_dst);
370+ first_dst->birthdate = second_dst->birthdate = birthdate;
371+ first_dst->is_valid = second_dst->is_valid = true;
380372 }
381373
382374 static bool __must_check mix_dh(u8 chaining_key[NOISE_HASH_LEN],
@@ -715,6 +707,7 @@ wg_noise_handshake_consume_response(struct message_handshake_response *src, · 332 unmodified lines
715707 u8 e[NOISE_PUBLIC_KEY_LEN];
716708 u8 ephemeral_private[NOISE_PUBLIC_KEY_LEN];
717709 u8 static_private[NOISE_PUBLIC_KEY_LEN];
710+ u8 preshared_key[NOISE_SYMMETRIC_KEY_LEN];
718711
719712 down_read(&wg->static_identity.lock);
720713
@@ -733,6 +726,8 @@ wg_noise_handshake_consume_response(struct message_handshake_response *src, · 12 unmodified lines
733726 memcpy(chaining_key, handshake->chaining_key, NOISE_HASH_LEN);
734727 memcpy(ephemeral_private, handshake->ephemeral_private,
735728 NOISE_PUBLIC_KEY_LEN);
729+ memcpy(preshared_key, handshake->preshared_key,
730+ NOISE_SYMMETRIC_KEY_LEN);
736731 up_read(&handshake->lock);
737732
738733 if (state != HANDSHAKE_CREATED_INITIATION)
@@ -750,7 +745,7 @@ wg_noise_handshake_consume_response(struct message_handshake_response *src, · 11 unmodified lines
750745 goto fail;
751746
752747 /* psk */
753− mix_psk(chaining_key, hash, key, handshake->preshared_key);
748+ mix_psk(chaining_key, hash, key, preshared_key);
754749
755750 /* {} */
756751 if (!message_decrypt(NULL, src->encrypted_nothing,
@@ -783,6 +778,7 @@ out: · 26 unmodified lines
783778 memzero_explicit(chaining_key, NOISE_HASH_LEN);
784779 memzero_explicit(ephemeral_private, NOISE_PUBLIC_KEY_LEN);
785780 memzero_explicit(static_private, NOISE_PUBLIC_KEY_LEN);
781+ memzero_explicit(preshared_key, NOISE_SYMMETRIC_KEY_LEN);
786782 up_read(&wg->static_identity.lock);
787783 return ret_peer;
788784 }
drivers/net/wireguard/noise.h+6−8
@@ -15,18 +15,14 @@ · 14 unmodified lines
1515 #include <linux/mutex.h>
1616 #include <linux/kref.h>
1717
18−union noise_counter {
19− struct {
20− u64 counter;
21− unsigned long backtrack[COUNTER_BITS_TOTAL / BITS_PER_LONG];
22− spinlock_t lock;
23− } receive;
24− atomic64_t counter;
18+struct noise_replay_counter {
19+ u64 counter;
20+ spinlock_t lock;
21+ unsigned long backtrack[COUNTER_BITS_TOTAL / BITS_PER_LONG];
2522 };
2623
2724 struct noise_symmetric_key {
2825 u8 key[NOISE_SYMMETRIC_KEY_LEN];
29− union noise_counter counter;
3026 u64 birthdate;
3127 bool is_valid;
3228 };
@@ -34,7 +30,9 @@ struct noise_symmetric_key { · 1 unmodified line
3430 struct noise_keypair {
3531 struct index_hashtable_entry entry;
3632 struct noise_symmetric_key sending;
33+ atomic64_t sending_counter;
3734 struct noise_symmetric_key receiving;
35+ struct noise_replay_counter receiving_counter;
3836 __le32 remote_index;
3937 bool i_am_the_initiator;
4038 struct kref refcount;
drivers/net/wireguard/queueing.h+9−1
@@ -87,12 +87,20 @@ static inline bool wg_check_packet_protocol(struct sk_buff *skb) · 86 unmodified lines
8787 return real_protocol && skb->protocol == real_protocol;
8888 }
8989
90−static inline void wg_reset_packet(struct sk_buff *skb)
90+static inline void wg_reset_packet(struct sk_buff *skb, bool encapsulating)
9191 {
92+ u8 l4_hash = skb->l4_hash;
93+ u8 sw_hash = skb->sw_hash;
94+ u32 hash = skb->hash;
9295 skb_scrub_packet(skb, true);
9396 memset(&skb->headers_start, 0,
9497 offsetof(struct sk_buff, headers_end) -
9598 offsetof(struct sk_buff, headers_start));
99+ if (encapsulating) {
100+ skb->l4_hash = l4_hash;
101+ skb->sw_hash = sw_hash;
102+ skb->hash = hash;
103+ }
96104 skb->queue_mapping = 0;
97105 skb->nohdr = 0;
98106 skb->peeked = 0;
drivers/net/wireguard/receive.c+22−22
@@ -245,20 +245,20 @@ static void keep_key_fresh(struct wg_peer *peer) · 244 unmodified lines
245245 }
246246 }
247247
248−static bool decrypt_packet(struct sk_buff *skb, struct noise_symmetric_key *key)
248+static bool decrypt_packet(struct sk_buff *skb, struct noise_keypair *keypair)
249249 {
250250 struct scatterlist sg[MAX_SKB_FRAGS + 8];
251251 struct sk_buff *trailer;
252252 unsigned int offset;
253253 int num_frags;
254254
255− if (unlikely(!key))
255+ if (unlikely(!keypair))
256256 return false;
257257
258− if (unlikely(!READ_ONCE(key->is_valid) ||
259− wg_birthdate_has_expired(key->birthdate, REJECT_AFTER_TIME) ||
260− key->counter.receive.counter >= REJECT_AFTER_MESSAGES)) {
261− WRITE_ONCE(key->is_valid, false);
258+ if (unlikely(!READ_ONCE(keypair->receiving.is_valid) ||
259+ wg_birthdate_has_expired(keypair->receiving.birthdate, REJECT_AFTER_TIME) ||
260+ keypair->receiving_counter.counter >= REJECT_AFTER_MESSAGES)) {
261+ WRITE_ONCE(keypair->receiving.is_valid, false);
262262 return false;
263263 }
264264
@@ -283,7 +283,7 @@ static bool decrypt_packet(struct sk_buff *skb, struct noise_symmetric_key *key) · 18 unmodified lines
283283
284284 if (!chacha20poly1305_decrypt_sg_inplace(sg, skb->len, NULL, 0,
285285 PACKET_CB(skb)->nonce,
286− key->key))
286+ keypair->receiving.key))
287287 return false;
288288
289289 /* Another ugly situation of pushing and pulling the header so as to
@@ -298,41 +298,41 @@ static bool decrypt_packet(struct sk_buff *skb, struct noise_symmetric_key *key) · 8 unmodified lines
298298 }
299299
300300 /* This is RFC6479, a replay detection bitmap algorithm that avoids bitshifts */
301−static bool counter_validate(union noise_counter *counter, u64 their_counter)
301+static bool counter_validate(struct noise_replay_counter *counter, u64 their_counter)
302302 {
303303 unsigned long index, index_current, top, i;
304304 bool ret = false;
305305
306− spin_lock_bh(&counter->receive.lock);
306+ spin_lock_bh(&counter->lock);
307307
308− if (unlikely(counter->receive.counter >= REJECT_AFTER_MESSAGES + 1 ||
308+ if (unlikely(counter->counter >= REJECT_AFTER_MESSAGES + 1 ||
309309 their_counter >= REJECT_AFTER_MESSAGES))
310310 goto out;
311311
312312 ++their_counter;
313313
314314 if (unlikely((COUNTER_WINDOW_SIZE + their_counter) <
315− counter->receive.counter))
315+ counter->counter))
316316 goto out;
317317
318318 index = their_counter >> ilog2(BITS_PER_LONG);
319319
320− if (likely(their_counter > counter->receive.counter)) {
321− index_current = counter->receive.counter >> ilog2(BITS_PER_LONG);
320+ if (likely(their_counter > counter->counter)) {
321+ index_current = counter->counter >> ilog2(BITS_PER_LONG);
322322 top = min_t(unsigned long, index - index_current,
323323 COUNTER_BITS_TOTAL / BITS_PER_LONG);
324324 for (i = 1; i <= top; ++i)
325− counter->receive.backtrack[(i + index_current) &
325+ counter->backtrack[(i + index_current) &
326326 ((COUNTER_BITS_TOTAL / BITS_PER_LONG) - 1)] = 0;
327− counter->receive.counter = their_counter;
327+ counter->counter = their_counter;
328328 }
329329
330330 index &= (COUNTER_BITS_TOTAL / BITS_PER_LONG) - 1;
331331 ret = !test_and_set_bit(their_counter & (BITS_PER_LONG - 1),
332− &counter->receive.backtrack[index]);
332+ &counter->backtrack[index]);
333333
334334 out:
335− spin_unlock_bh(&counter->receive.lock);
335+ spin_unlock_bh(&counter->lock);
336336 return ret;
337337 }
338338
@@ -472,19 +472,19 @@ int wg_packet_rx_poll(struct napi_struct *napi, int budget) · 133 unmodified lines
472472 if (unlikely(state != PACKET_STATE_CRYPTED))
473473 goto next;
474474
475− if (unlikely(!counter_validate(&keypair->receiving.counter,
475+ if (unlikely(!counter_validate(&keypair->receiving_counter,
476476 PACKET_CB(skb)->nonce))) {
477477 net_dbg_ratelimited("%s: Packet has invalid nonce %llu (max %llu)\n",
478478 peer->device->dev->name,
479479 PACKET_CB(skb)->nonce,
480− keypair->receiving.counter.receive.counter);
480+ keypair->receiving_counter.counter);
481481 goto next;
482482 }
483483
484484 if (unlikely(wg_socket_endpoint_from_skb(&endpoint, skb)))
485485 goto next;
486486
487− wg_reset_packet(skb);
487+ wg_reset_packet(skb, false);
488488 wg_packet_consume_data_done(peer, skb, &endpoint);
489489 free = false;
490490
@@ -511,8 +511,8 @@ void wg_packet_decrypt_worker(struct work_struct *work) · 20 unmodified lines
511511 struct sk_buff *skb;
512512
513513 while ((skb = ptr_ring_consume_bh(&queue->ring)) != NULL) {
514− enum packet_state state = likely(decrypt_packet(skb,
515− &PACKET_CB(skb)->keypair->receiving)) ?
514+ enum packet_state state =
515+ likely(decrypt_packet(skb, PACKET_CB(skb)->keypair)) ?
516516 PACKET_STATE_CRYPTED : PACKET_STATE_DEAD;
517517 wg_queue_enqueue_per_peer_napi(skb, state);
518518 if (need_resched())
drivers/net/wireguard/selftest/counter.c+12−5
@@ -6,18 +6,24 @@ · 5 unmodified lines
66 #ifdef DEBUG
77 bool __init wg_packet_counter_selftest(void)
88 {
9+ struct noise_replay_counter *counter;
910 unsigned int test_num = 0, i;
10− union noise_counter counter;
1111 bool success = true;
1212
13−#define T_INIT do { \
14− memset(&counter, 0, sizeof(union noise_counter)); \
15− spin_lock_init(&counter.receive.lock); \
13+ counter = kmalloc(sizeof(*counter), GFP_KERNEL);
14+ if (unlikely(!counter)) {
15+ pr_err("nonce counter self-test malloc: FAIL\n");
16+ return false;
17+ }
18+
19+#define T_INIT do { \
20+ memset(counter, 0, sizeof(*counter)); \
21+ spin_lock_init(&counter->lock); \
1622 } while (0)
1723 #define T_LIM (COUNTER_WINDOW_SIZE + 1)
1824 #define T(n, v) do { \
1925 ++test_num; \
20− if (counter_validate(&counter, n) != (v)) { \
26+ if (counter_validate(counter, n) != (v)) { \
2127 pr_err("nonce counter self-test %u: FAIL\n", \
2228 test_num); \
2329 success = false; \
@@ -99,6 +105,7 @@ bool __init wg_packet_counter_selftest(void) · 75 unmodified lines
99105
100106 if (success)
101107 pr_info("nonce counter self-tests: pass\n");
108+ kfree(counter);
102109 return success;
103110 }
104111 #endif
drivers/net/wireguard/send.c+11−8
@@ -129,7 +129,7 @@ static void keep_key_fresh(struct wg_peer *peer) · 128 unmodified lines
129129 rcu_read_lock_bh();
130130 keypair = rcu_dereference_bh(peer->keypairs.current_keypair);
131131 send = keypair && READ_ONCE(keypair->sending.is_valid) &&
132− (atomic64_read(&keypair->sending.counter.counter) > REKEY_AFTER_MESSAGES ||
132+ (atomic64_read(&keypair->sending_counter) > REKEY_AFTER_MESSAGES ||
133133 (keypair->i_am_the_initiator &&
134134 wg_birthdate_has_expired(keypair->sending.birthdate, REKEY_AFTER_TIME)));
135135 rcu_read_unlock_bh();
@@ -167,6 +167,11 @@ static bool encrypt_packet(struct sk_buff *skb, struct noise_keypair *keypair) · 31 unmodified lines
167167 struct sk_buff *trailer;
168168 int num_frags;
169169
170+ /* Force hash calculation before encryption so that flow analysis is
171+ * consistent over the inner packet.
172+ */
173+ skb_get_hash(skb);
174+
170175 /* Calculate lengths. */
171176 padding_len = calculate_skb_padding(skb);
172177 trailer_len = padding_len + noise_encrypted_len(0);
@@ -295,7 +300,7 @@ void wg_packet_encrypt_worker(struct work_struct *work) · 122 unmodified lines
295300 skb_list_walk_safe(first, skb, next) {
296301 if (likely(encrypt_packet(skb,
297302 PACKET_CB(first)->keypair))) {
298− wg_reset_packet(skb);
303+ wg_reset_packet(skb, true);
299304 } else {
300305 state = PACKET_STATE_DEAD;
301306 break;
@@ -344,7 +349,6 @@ void wg_packet_purge_staged_packets(struct wg_peer *peer) · 42 unmodified lines
344349
345350 void wg_packet_send_staged_packets(struct wg_peer *peer)
346351 {
347− struct noise_symmetric_key *key;
348352 struct noise_keypair *keypair;
349353 struct sk_buff_head packets;
350354 struct sk_buff *skb;
@@ -364,10 +368,9 @@ void wg_packet_send_staged_packets(struct wg_peer *peer) · 13 unmodified lines
364368 rcu_read_unlock_bh();
365369 if (unlikely(!keypair))
366370 goto out_nokey;
367− key = &keypair->sending;
368− if (unlikely(!READ_ONCE(key->is_valid)))
371+ if (unlikely(!READ_ONCE(keypair->sending.is_valid)))
369372 goto out_nokey;
370− if (unlikely(wg_birthdate_has_expired(key->birthdate,
373+ if (unlikely(wg_birthdate_has_expired(keypair->sending.birthdate,
371374 REJECT_AFTER_TIME)))
372375 goto out_invalid;
373376
@@ -382,7 +385,7 @@ void wg_packet_send_staged_packets(struct wg_peer *peer) · 8 unmodified lines
382385 */
383386 PACKET_CB(skb)->ds = ip_tunnel_ecn_encap(0, ip_hdr(skb), skb);
384387 PACKET_CB(skb)->nonce =
385− atomic64_inc_return(&key->counter.counter) - 1;
388+ atomic64_inc_return(&keypair->sending_counter) - 1;
386389 if (unlikely(PACKET_CB(skb)->nonce >= REJECT_AFTER_MESSAGES))
387390 goto out_invalid;
388391 }
@@ -394,7 +397,7 @@ void wg_packet_send_staged_packets(struct wg_peer *peer) · 5 unmodified lines
394397 return;
395398
396399 out_invalid:
397− WRITE_ONCE(key->is_valid, false);
400+ WRITE_ONCE(keypair->sending.is_valid, false);
398401 out_nokey:
399402 wg_noise_keypair_put(keypair, false);
400403
drivers/net/wireless/intel/iwlwifi/pcie/drv.c+4−0
@@ -1092,6 +1092,10 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 1091 unmodified lines
10921092 iwl_trans->cfg = &iwl_ax101_cfg_quz_hr;
10931093 else if (iwl_trans->cfg == &iwl_ax201_cfg_qu_hr)
10941094 iwl_trans->cfg = &iwl_ax201_cfg_quz_hr;
1095+ else if (iwl_trans->cfg == &killer1650s_2ax_cfg_qu_b0_hr_b0)
1096+ iwl_trans->cfg = &iwl_ax1650s_cfg_quz_hr;
1097+ else if (iwl_trans->cfg == &killer1650i_2ax_cfg_qu_b0_hr_b0)
1098+ iwl_trans->cfg = &iwl_ax1650i_cfg_quz_hr;
10951099 }
10961100
10971101 #endif
drivers/nvme/host/pci.c+5−0
@@ -989,6 +989,11 @@ static inline int nvme_process_cq(struct nvme_queue *nvmeq) · 988 unmodified lines
989989
990990 while (nvme_cqe_pending(nvmeq)) {
991991 found++;
992+ /*
993+ * load-load control dependency between phase and the rest of
994+ * the cqe requires a full read memory barrier
995+ */
996+ dma_rmb();
992997 nvme_handle_cqe(nvmeq, nvmeq->cq_head);
993998 nvme_update_cq_head(nvmeq);
994999 }
drivers/pinctrl/actions/pinctrl-s700.c+1−1
@@ -1435,7 +1435,7 @@ static const char * const sd2_groups[] = { · 1434 unmodified lines
14351435 static const char * const i2c0_groups[] = {
14361436 "uart0_rx_mfp",
14371437 "uart0_tx_mfp",
1438− "i2c0_mfp_mfp",
1438+ "i2c0_mfp",
14391439 };
14401440
14411441 static const char * const i2c1_groups[] = {
drivers/pinctrl/intel/pinctrl-baytrail.c+1−0
@@ -1286,6 +1286,7 @@ static const struct gpio_chip byt_gpio_chip = { · 1285 unmodified lines
12861286 .direction_output = byt_gpio_direction_output,
12871287 .get = byt_gpio_get,
12881288 .set = byt_gpio_set,
1289+ .set_config = gpiochip_generic_config,
12891290 .dbg_show = byt_gpio_dbg_show,
12901291 };
12911292
drivers/pinctrl/intel/pinctrl-cherryview.c+4−0
@@ -1479,11 +1479,15 @@ static void chv_gpio_irq_handler(struct irq_desc *desc) · 1478 unmodified lines
14791479 struct chv_pinctrl *pctrl = gpiochip_get_data(gc);
14801480 struct irq_chip *chip = irq_desc_get_chip(desc);
14811481 unsigned long pending;
1482+ unsigned long flags;
14821483 u32 intr_line;
14831484
14841485 chained_irq_enter(chip, desc);
14851486
1487+ raw_spin_lock_irqsave(&chv_lock, flags);
14861488 pending = readl(pctrl->regs + CHV_INTSTAT);
1489+ raw_spin_unlock_irqrestore(&chv_lock, flags);
1490+
14871491 for_each_set_bit(intr_line, &pending, pctrl->community->nirqs) {
14881492 unsigned int irq, offset;
14891493
drivers/pinctrl/intel/pinctrl-sunrisepoint.c+8−7
@@ -15,17 +15,18 @@ · 14 unmodified lines
1515
1616 #include "pinctrl-intel.h"
1717
18−#define SPT_PAD_OWN 0x020
19−#define SPT_PADCFGLOCK 0x0a0
20−#define SPT_HOSTSW_OWN 0x0d0
21−#define SPT_GPI_IS 0x100
22−#define SPT_GPI_IE 0x120
18+#define SPT_PAD_OWN 0x020
19+#define SPT_H_PADCFGLOCK 0x090
20+#define SPT_LP_PADCFGLOCK 0x0a0
21+#define SPT_HOSTSW_OWN 0x0d0
22+#define SPT_GPI_IS 0x100
23+#define SPT_GPI_IE 0x120
2324
2425 #define SPT_COMMUNITY(b, s, e) \
2526 { \
2627 .barno = (b), \
2728 .padown_offset = SPT_PAD_OWN, \
28− .padcfglock_offset = SPT_PADCFGLOCK, \
29+ .padcfglock_offset = SPT_LP_PADCFGLOCK, \
2930 .hostown_offset = SPT_HOSTSW_OWN, \
3031 .is_offset = SPT_GPI_IS, \
3132 .ie_offset = SPT_GPI_IE, \
@@ -47,7 +48,7 @@ · 15 unmodified lines
4748 { \
4849 .barno = (b), \
4950 .padown_offset = SPT_PAD_OWN, \
50− .padcfglock_offset = SPT_PADCFGLOCK, \
51+ .padcfglock_offset = SPT_H_PADCFGLOCK, \
5152 .hostown_offset = SPT_HOSTSW_OWN, \
5253 .is_offset = SPT_GPI_IS, \
5354 .ie_offset = SPT_GPI_IE, \
drivers/pinctrl/mediatek/pinctrl-paris.c+0−2
@@ -164,8 +164,6 @@ static int mtk_pinconf_get(struct pinctrl_dev *pctldev, · 163 unmodified lines
164164 case MTK_PIN_CONFIG_PU_ADV:
165165 case MTK_PIN_CONFIG_PD_ADV:
166166 if (hw->soc->adv_pull_get) {
167− bool pullup;
168−
169167 pullup = param == MTK_PIN_CONFIG_PU_ADV;
170168 err = hw->soc->adv_pull_get(hw, desc, pullup, &ret);
171169 } else
drivers/pinctrl/qcom/pinctrl-msm.c+26−1
@@ -697,7 +697,7 @@ static void msm_gpio_update_dual_edge_pos(struct msm_pinctrl *pctrl, · 696 unmodified lines
697697
698698 pol = msm_readl_intr_cfg(pctrl, g);
699699 pol ^= BIT(g->intr_polarity_bit);
700− msm_writel_intr_cfg(val, pctrl, g);
700+ msm_writel_intr_cfg(pol, pctrl, g);
701701
702702 val2 = msm_readl_io(pctrl, g) & BIT(g->in_bit);
703703 intstat = msm_readl_intr_status(pctrl, g);
@@ -1034,6 +1034,29 @@ static void msm_gpio_irq_relres(struct irq_data *d) · 330 unmodified lines
10341034 module_put(gc->owner);
10351035 }
10361036
1037+static int msm_gpio_irq_set_affinity(struct irq_data *d,
1038+ const struct cpumask *dest, bool force)
1039+{
1040+ struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1041+ struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
1042+
1043+ if (d->parent_data && test_bit(d->hwirq, pctrl->skip_wake_irqs))
1044+ return irq_chip_set_affinity_parent(d, dest, force);
1045+
1046+ return 0;
1047+}
1048+
1049+static int msm_gpio_irq_set_vcpu_affinity(struct irq_data *d, void *vcpu_info)
1050+{
1051+ struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1052+ struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
1053+
1054+ if (d->parent_data && test_bit(d->hwirq, pctrl->skip_wake_irqs))
1055+ return irq_chip_set_vcpu_affinity_parent(d, vcpu_info);
1056+
1057+ return 0;
1058+}
1059+
10371060 static void msm_gpio_irq_handler(struct irq_desc *desc)
10381061 {
10391062 struct gpio_chip *gc = irq_desc_get_handler_data(desc);
@@ -1132,6 +1155,8 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl) · 92 unmodified lines
11321155 pctrl->irq_chip.irq_set_wake = msm_gpio_irq_set_wake;
11331156 pctrl->irq_chip.irq_request_resources = msm_gpio_irq_reqres;
11341157 pctrl->irq_chip.irq_release_resources = msm_gpio_irq_relres;
1158+ pctrl->irq_chip.irq_set_affinity = msm_gpio_irq_set_affinity;
1159+ pctrl->irq_chip.irq_set_vcpu_affinity = msm_gpio_irq_set_vcpu_affinity;
11351160
11361161 np = of_parse_phandle(pctrl->dev->of_node, "wakeup-parent", 0);
11371162 if (np) {
drivers/rapidio/devices/rio_mport_cdev.c+5−0
@@ -877,6 +877,11 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode, · 876 unmodified lines
877877 rmcd_error("pinned %ld out of %ld pages",
878878 pinned, nr_pages);
879879 ret = -EFAULT;
880+ /*
881+ * Set nr_pages up to mean "how many pages to unpin, in
882+ * the error handler:
883+ */
884+ nr_pages = pinned;
880885 goto err_pg;
881886 }
882887
drivers/s390/net/ism_drv.c+3−1
@@ -521,8 +521,10 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 520 unmodified lines
521521
522522 ism->smcd = smcd_alloc_dev(&pdev->dev, dev_name(&pdev->dev), &ism_ops,
523523 ISM_NR_DMBS);
524− if (!ism->smcd)
524+ if (!ism->smcd) {
525+ ret = -ENOMEM;
525526 goto err_resource;
527+ }
526528
527529 ism->smcd->priv = ism;
528530 ret = ism_dev_init(ism);
drivers/scsi/qla2xxx/qla_attr.c+0−3
@@ -1850,9 +1850,6 @@ qla2x00_port_speed_show(struct device *dev, struct device_attribute *attr, · 1849 unmodified lines
18501850 return -EINVAL;
18511851 }
18521852
1853− ql_log(ql_log_info, vha, 0x70d6,
1854− "port speed:%d\n", ha->link_data_rate);
1855−
18561853 return scnprintf(buf, PAGE_SIZE, "%s\n", spd[ha->link_data_rate]);
18571854 }
18581855
drivers/scsi/scsi_pm.c+8−2
@@ -80,6 +80,10 @@ static int scsi_dev_type_resume(struct device *dev, · 79 unmodified lines
8080 dev_dbg(dev, "scsi resume: %d\n", err);
8181
8282 if (err == 0) {
83+ bool was_runtime_suspended;
84+
85+ was_runtime_suspended = pm_runtime_suspended(dev);
86+
8387 pm_runtime_disable(dev);
8488 err = pm_runtime_set_active(dev);
8589 pm_runtime_enable(dev);
@@ -93,8 +97,10 @@ static int scsi_dev_type_resume(struct device *dev, · 7 unmodified lines
9397 */
9498 if (!err && scsi_is_sdev_device(dev)) {
9599 struct scsi_device *sdev = to_scsi_device(dev);
96−
97− blk_set_runtime_active(sdev->request_queue);
100+ if (was_runtime_suspended)
101+ blk_post_runtime_resume(sdev->request_queue, 0);
102+ else
103+ blk_set_runtime_active(sdev->request_queue);
98104 }
99105 }
100106
drivers/staging/greybus/uart.c+2−2
@@ -526,9 +526,9 @@ static void gb_tty_set_termios(struct tty_struct *tty, · 525 unmodified lines
526526 }
527527
528528 if (C_CRTSCTS(tty) && C_BAUD(tty) != B0)
529− newline.flow_control |= GB_SERIAL_AUTO_RTSCTS_EN;
529+ newline.flow_control = GB_SERIAL_AUTO_RTSCTS_EN;
530530 else
531− newline.flow_control &= ~GB_SERIAL_AUTO_RTSCTS_EN;
531+ newline.flow_control = 0;
532532
533533 if (memcmp(&gb_tty->line_coding, &newline, sizeof(newline))) {
534534 memcpy(&gb_tty->line_coding, &newline, sizeof(newline));
drivers/staging/iio/resolver/ad2s1210.c+12−5
@@ -130,17 +130,24 @@ static int ad2s1210_config_write(struct ad2s1210_state *st, u8 data) · 129 unmodified lines
130130 static int ad2s1210_config_read(struct ad2s1210_state *st,
131131 unsigned char address)
132132 {
133− struct spi_transfer xfer = {
134− .len = 2,
135− .rx_buf = st->rx,
136− .tx_buf = st->tx,
133+ struct spi_transfer xfers[] = {
134+ {
135+ .len = 1,
136+ .rx_buf = &st->rx[0],
137+ .tx_buf = &st->tx[0],
138+ .cs_change = 1,
139+ }, {
140+ .len = 1,
141+ .rx_buf = &st->rx[1],
142+ .tx_buf = &st->tx[1],
143+ },
137144 };
138145 int ret = 0;
139146
140147 ad2s1210_set_mode(MOD_CONFIG, st);
141148 st->tx[0] = address | AD2S1210_MSB_IS_HIGH;
142149 st->tx[1] = AD2S1210_REG_FAULT;
143− ret = spi_sync_transfer(st->sdev, &xfer, 1);
150+ ret = spi_sync_transfer(st->sdev, xfers, 2);
144151 if (ret < 0)
145152 return ret;
146153
drivers/staging/kpc2000/kpc2000/core.c+4−5
@@ -298,7 +298,6 @@ static int kp2000_pcie_probe(struct pci_dev *pdev, · 297 unmodified lines
298298 {
299299 int err = 0;
300300 struct kp2000_device *pcard;
301− int rv;
302301 unsigned long reg_bar_phys_addr;
303302 unsigned long reg_bar_phys_len;
304303 unsigned long dma_bar_phys_addr;
@@ -445,11 +444,11 @@ static int kp2000_pcie_probe(struct pci_dev *pdev, · 140 unmodified lines
445444 if (err < 0)
446445 goto err_release_dma;
447446
448− rv = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
449− pcard->name, pcard);
450− if (rv) {
447+ err = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
448+ pcard->name, pcard);
449+ if (err) {
451450 dev_err(&pcard->pdev->dev,
452− "%s: failed to request_irq: %d\n", __func__, rv);
451+ "%s: failed to request_irq: %d\n", __func__, err);
453452 goto err_disable_msi;
454453 }
455454
drivers/staging/wfx/scan.c+3−1
@@ -57,8 +57,10 @@ static int send_scan_req(struct wfx_vif *wvif, · 56 unmodified lines
5757 wvif->scan_abort = false;
5858 reinit_completion(&wvif->scan_complete);
5959 timeout = hif_scan(wvif, req, start_idx, i - start_idx);
60− if (timeout < 0)
60+ if (timeout < 0) {
61+ wfx_tx_unlock(wvif->wdev);
6162 return timeout;
63+ }
6264 ret = wait_for_completion_timeout(&wvif->scan_complete, timeout);
6365 if (req->channels[start_idx]->max_power != wvif->vif->bss_conf.txpower)
6466 hif_set_output_power(wvif, wvif->vif->bss_conf.txpower);
drivers/target/target_core_transport.c+1−0
@@ -3350,6 +3350,7 @@ static void target_tmr_work(struct work_struct *work) · 3349 unmodified lines
33503350
33513351 cmd->se_tfo->queue_tm_rsp(cmd);
33523352
3353+ transport_lun_remove_cmd(cmd);
33533354 transport_cmd_check_stop_to_fabric(cmd);
33543355 return;
33553356
drivers/tty/serial/sifive.c+1−0
@@ -883,6 +883,7 @@ console_initcall(sifive_console_init); · 882 unmodified lines
883883
884884 static void __ssp_add_console_port(struct sifive_serial_port *ssp)
885885 {
886+ spin_lock_init(&ssp->port.lock);
886887 sifive_serial_console_ports[ssp->port.line] = ssp;
887888 }
888889
drivers/usb/cdns3/gadget.c+11−11
@@ -82,7 +82,7 @@ static int cdns3_ep_run_stream_transfer(struct cdns3_endpoint *priv_ep, · 81 unmodified lines
8282 * @ptr: address of device controller register to be read and changed
8383 * @mask: bits requested to clar
8484 */
85−void cdns3_clear_register_bit(void __iomem *ptr, u32 mask)
85+static void cdns3_clear_register_bit(void __iomem *ptr, u32 mask)
8686 {
8787 mask = readl(ptr) & ~mask;
8888 writel(mask, ptr);
@@ -137,7 +137,7 @@ struct usb_request *cdns3_next_request(struct list_head *list) · 48 unmodified lines
137137 *
138138 * Returns buffer or NULL if no buffers in list
139139 */
140−struct cdns3_aligned_buf *cdns3_next_align_buf(struct list_head *list)
140+static struct cdns3_aligned_buf *cdns3_next_align_buf(struct list_head *list)
141141 {
142142 return list_first_entry_or_null(list, struct cdns3_aligned_buf, list);
143143 }
@@ -148,7 +148,7 @@ struct cdns3_aligned_buf *cdns3_next_align_buf(struct list_head *list) · 4 unmodified lines
148148 *
149149 * Returns request or NULL if no requests in list
150150 */
151−struct cdns3_request *cdns3_next_priv_request(struct list_head *list)
151+static struct cdns3_request *cdns3_next_priv_request(struct list_head *list)
152152 {
153153 return list_first_entry_or_null(list, struct cdns3_request, list);
154154 }
@@ -190,7 +190,7 @@ dma_addr_t cdns3_trb_virt_to_dma(struct cdns3_endpoint *priv_ep, · 35 unmodified lines
190190 return priv_ep->trb_pool_dma + offset;
191191 }
192192
193−int cdns3_ring_size(struct cdns3_endpoint *priv_ep)
193+static int cdns3_ring_size(struct cdns3_endpoint *priv_ep)
194194 {
195195 switch (priv_ep->type) {
196196 case USB_ENDPOINT_XFER_ISOC:
@@ -345,7 +345,7 @@ static void cdns3_ep_inc_deq(struct cdns3_endpoint *priv_ep) · 148 unmodified lines
345345 cdns3_ep_inc_trb(&priv_ep->dequeue, &priv_ep->ccs, priv_ep->num_trbs);
346346 }
347347
348−void cdns3_move_deq_to_next_trb(struct cdns3_request *priv_req)
348+static void cdns3_move_deq_to_next_trb(struct cdns3_request *priv_req)
349349 {
350350 struct cdns3_endpoint *priv_ep = priv_req->priv_ep;
351351 int current_trb = priv_req->start_trb;
@@ -511,7 +511,7 @@ static void cdns3_wa2_descmiss_copy_data(struct cdns3_endpoint *priv_ep, · 159 unmodified lines
511511 }
512512 }
513513
514−struct usb_request *cdns3_wa2_gadget_giveback(struct cdns3_device *priv_dev,
514+static struct usb_request *cdns3_wa2_gadget_giveback(struct cdns3_device *priv_dev,
515515 struct cdns3_endpoint *priv_ep,
516516 struct cdns3_request *priv_req)
517517 {
@@ -551,7 +551,7 @@ struct usb_request *cdns3_wa2_gadget_giveback(struct cdns3_device *priv_dev, · 33 unmodified lines
551551 return &priv_req->request;
552552 }
553553
554−int cdns3_wa2_gadget_ep_queue(struct cdns3_device *priv_dev,
554+static int cdns3_wa2_gadget_ep_queue(struct cdns3_device *priv_dev,
555555 struct cdns3_endpoint *priv_ep,
556556 struct cdns3_request *priv_req)
557557 {
@@ -836,7 +836,7 @@ void cdns3_gadget_giveback(struct cdns3_endpoint *priv_ep, · 278 unmodified lines
836836 cdns3_gadget_ep_free_request(&priv_ep->endpoint, request);
837837 }
838838
839−void cdns3_wa1_restore_cycle_bit(struct cdns3_endpoint *priv_ep)
839+static void cdns3_wa1_restore_cycle_bit(struct cdns3_endpoint *priv_ep)
840840 {
841841 /* Work around for stale data address in TRB*/
842842 if (priv_ep->wa1_set) {
@@ -1904,7 +1904,7 @@ static int cdns3_ep_onchip_buffer_reserve(struct cdns3_device *priv_dev, · 1061 unmodified lines
19041904 return 0;
19051905 }
19061906
1907−void cdns3_stream_ep_reconfig(struct cdns3_device *priv_dev,
1907+static void cdns3_stream_ep_reconfig(struct cdns3_device *priv_dev,
19081908 struct cdns3_endpoint *priv_ep)
19091909 {
19101910 if (!priv_ep->use_streams || priv_dev->gadget.speed < USB_SPEED_SUPER)
@@ -1925,7 +1925,7 @@ void cdns3_stream_ep_reconfig(struct cdns3_device *priv_dev, · 14 unmodified lines
19251925 EP_CFG_TDL_CHK | EP_CFG_SID_CHK);
19261926 }
19271927
1928−void cdns3_configure_dmult(struct cdns3_device *priv_dev,
1928+static void cdns3_configure_dmult(struct cdns3_device *priv_dev,
19291929 struct cdns3_endpoint *priv_ep)
19301930 {
19311931 struct cdns3_usb_regs __iomem *regs = priv_dev->regs;
@@ -2548,7 +2548,7 @@ found: · 616 unmodified lines
25482548 link_trb = priv_req->trb;
25492549
25502550 /* Update ring only if removed request is on pending_req_list list */
2551− if (req_on_hw_ring) {
2551+ if (req_on_hw_ring && link_trb) {
25522552 link_trb->buffer = TRB_BUFFER(priv_ep->trb_pool_dma +
25532553 ((priv_req->end_trb + 1) * TRB_SIZE));
25542554 link_trb->control = (link_trb->control & TRB_CYCLE) |
drivers/usb/core/devio.c+13−3
@@ -251,9 +251,19 @@ static int usbdev_mmap(struct file *file, struct vm_area_struct *vma) · 250 unmodified lines
251251 usbm->vma_use_count = 1;
252252 INIT_LIST_HEAD(&usbm->memlist);
253253
254− if (dma_mmap_coherent(hcd->self.sysdev, vma, mem, dma_handle, size)) {
255− dec_usb_memory_use_count(usbm, &usbm->vma_use_count);
256− return -EAGAIN;
254+ if (hcd->localmem_pool || !hcd_uses_dma(hcd)) {
255+ if (remap_pfn_range(vma, vma->vm_start,
256+ virt_to_phys(usbm->mem) >> PAGE_SHIFT,
257+ size, vma->vm_page_prot) < 0) {
258+ dec_usb_memory_use_count(usbm, &usbm->vma_use_count);
259+ return -EAGAIN;
260+ }
261+ } else {
262+ if (dma_mmap_coherent(hcd->self.sysdev, vma, mem, dma_handle,
263+ size)) {
264+ dec_usb_memory_use_count(usbm, &usbm->vma_use_count);
265+ return -EAGAIN;
266+ }
257267 }
258268
259269 vma->vm_flags |= VM_IO;
drivers/usb/core/hub.c+5−1
@@ -39,6 +39,7 @@ · 38 unmodified lines
3939
4040 #define USB_VENDOR_GENESYS_LOGIC 0x05e3
4141 #define USB_VENDOR_SMSC 0x0424
42+#define USB_PRODUCT_USB5534B 0x5534
4243 #define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01
4344 #define HUB_QUIRK_DISABLE_AUTOSUSPEND 0x02
4445
@@ -5621,8 +5622,11 @@ out_hdev_lock: · 5576 unmodified lines
56215622 }
56225623
56235624 static const struct usb_device_id hub_id_table[] = {
5624− { .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_CLASS,
5625+ { .match_flags = USB_DEVICE_ID_MATCH_VENDOR
5626+ | USB_DEVICE_ID_MATCH_PRODUCT
5627+ | USB_DEVICE_ID_MATCH_INT_CLASS,
56255628 .idVendor = USB_VENDOR_SMSC,
5629+ .idProduct = USB_PRODUCT_USB5534B,
56265630 .bInterfaceClass = USB_CLASS_HUB,
56275631 .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND},
56285632 { .match_flags = USB_DEVICE_ID_MATCH_VENDOR
drivers/usb/dwc3/Kconfig+1−0
@@ -4,6 +4,7 @@ config USB_DWC3 · 3 unmodified lines
44 tristate "DesignWare USB3 DRD Core Support"
55 depends on (USB || USB_GADGET) && HAS_DMA
66 select USB_XHCI_PLATFORM if USB_XHCI_HCD
7+ select USB_ROLE_SWITCH if USB_DWC3_DUAL_ROLE
78 help
89 Say Y or M here if your system has a Dual Role SuperSpeed
910 USB controller based on the DesignWare USB3 IP Core.
drivers/usb/dwc3/dwc3-pci.c+1−0
@@ -114,6 +114,7 @@ static const struct property_entry dwc3_pci_intel_properties[] = { · 113 unmodified lines
114114
115115 static const struct property_entry dwc3_pci_mrfld_properties[] = {
116116 PROPERTY_ENTRY_STRING("dr_mode", "otg"),
117+ PROPERTY_ENTRY_STRING("linux,extcon-name", "mrfld_bcove_pwrsrc"),
117118 PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
118119 {}
119120 };
drivers/usb/dwc3/gadget.c+0−3
@@ -2483,9 +2483,6 @@ static int dwc3_gadget_ep_reclaim_trb_sg(struct dwc3_ep *dep, · 2482 unmodified lines
24832483 for_each_sg(sg, s, pending, i) {
24842484 trb = &dep->trb_pool[dep->trb_dequeue];
24852485
2486− if (trb->ctrl & DWC3_TRB_CTRL_HWO)
2487− break;
2488−
24892486 req->sg = sg_next(s);
24902487 req->num_pending_sgs--;
24912488
drivers/usb/gadget/configfs.c+3−0
@@ -260,6 +260,9 @@ static ssize_t gadget_dev_desc_UDC_store(struct config_item *item, · 259 unmodified lines
260260 char *name;
261261 int ret;
262262
263+ if (strlen(page) < len)
264+ return -EOVERFLOW;
265+
263266 name = kstrdup(page, GFP_KERNEL);
264267 if (!name)
265268 return -ENOMEM;
drivers/usb/gadget/legacy/audio.c+3−1
@@ -300,8 +300,10 @@ static int audio_bind(struct usb_composite_dev *cdev) · 299 unmodified lines
300300 struct usb_descriptor_header *usb_desc;
301301
302302 usb_desc = usb_otg_descriptor_alloc(cdev->gadget);
303− if (!usb_desc)
303+ if (!usb_desc) {
304+ status = -ENOMEM;
304305 goto fail;
306+ }
305307 usb_otg_descriptor_init(cdev->gadget, usb_desc);
306308 otg_desc[0] = usb_desc;
307309 otg_desc[1] = NULL;
drivers/usb/gadget/legacy/cdc2.c+3−1
@@ -179,8 +179,10 @@ static int cdc_bind(struct usb_composite_dev *cdev) · 178 unmodified lines
179179 struct usb_descriptor_header *usb_desc;
180180
181181 usb_desc = usb_otg_descriptor_alloc(gadget);
182− if (!usb_desc)
182+ if (!usb_desc) {
183+ status = -ENOMEM;
183184 goto fail1;
185+ }
184186 usb_otg_descriptor_init(gadget, usb_desc);
185187 otg_desc[0] = usb_desc;
186188 otg_desc[1] = NULL;
drivers/usb/gadget/legacy/inode.c+1−2
@@ -1361,7 +1361,6 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) · 1360 unmodified lines
13611361
13621362 req->buf = dev->rbuf;
13631363 req->context = NULL;
1364− value = -EOPNOTSUPP;
13651364 switch (ctrl->bRequest) {
13661365
13671366 case USB_REQ_GET_DESCRIPTOR:
@@ -1784,7 +1783,7 @@ static ssize_t · 416 unmodified lines
17841783 dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
17851784 {
17861785 struct dev_data *dev = fd->private_data;
1787− ssize_t value = len, length = len;
1786+ ssize_t value, length = len;
17881787 unsigned total;
17891788 u32 tag;
17901789 char *kbuf;
drivers/usb/gadget/legacy/ncm.c+3−1
@@ -156,8 +156,10 @@ static int gncm_bind(struct usb_composite_dev *cdev) · 155 unmodified lines
156156 struct usb_descriptor_header *usb_desc;
157157
158158 usb_desc = usb_otg_descriptor_alloc(gadget);
159− if (!usb_desc)
159+ if (!usb_desc) {
160+ status = -ENOMEM;
160161 goto fail;
162+ }
161163 usb_otg_descriptor_init(gadget, usb_desc);
162164 otg_desc[0] = usb_desc;
163165 otg_desc[1] = NULL;
drivers/usb/gadget/legacy/raw_gadget.c+252−63
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 */
88
99 #include <linux/compiler.h>
10+#include <linux/ctype.h>
1011 #include <linux/debugfs.h>
1112 #include <linux/delay.h>
1213 #include <linux/kref.h>
@@ -123,8 +124,6 @@ static void raw_event_queue_destroy(struct raw_event_queue *queue) · 110 unmodified lines
123124
124125 struct raw_dev;
125126
126−#define USB_RAW_MAX_ENDPOINTS 32
127−
128127 enum ep_state {
129128 STATE_EP_DISABLED,
130129 STATE_EP_ENABLED,
@@ -134,6 +133,7 @@ struct raw_ep { · 3 unmodified lines
134133 struct raw_dev *dev;
135134 enum ep_state state;
136135 struct usb_ep *ep;
136+ u8 addr;
137137 struct usb_request *req;
138138 bool urb_queued;
139139 bool disabling;
@@ -168,7 +168,8 @@ struct raw_dev { · 28 unmodified lines
168168 bool ep0_out_pending;
169169 bool ep0_urb_queued;
170170 ssize_t ep0_status;
171− struct raw_ep eps[USB_RAW_MAX_ENDPOINTS];
171+ struct raw_ep eps[USB_RAW_EPS_NUM_MAX];
172+ int eps_num;
172173
173174 struct completion ep0_done;
174175 struct raw_event_queue queue;
@@ -202,8 +203,8 @@ static void dev_free(struct kref *kref) · 27 unmodified lines
202203 usb_ep_free_request(dev->gadget->ep0, dev->req);
203204 }
204205 raw_event_queue_destroy(&dev->queue);
205− for (i = 0; i < USB_RAW_MAX_ENDPOINTS; i++) {
206− if (dev->eps[i].state != STATE_EP_ENABLED)
206+ for (i = 0; i < dev->eps_num; i++) {
207+ if (dev->eps[i].state == STATE_EP_DISABLED)
207208 continue;
208209 usb_ep_disable(dev->eps[i].ep);
209210 usb_ep_free_request(dev->eps[i].ep, dev->eps[i].req);
@@ -249,12 +250,26 @@ static void gadget_ep0_complete(struct usb_ep *ep, struct usb_request *req) · 39 unmodified lines
249250 complete(&dev->ep0_done);
250251 }
251252
253+static u8 get_ep_addr(const char *name)
254+{
255+ /* If the endpoint has fixed function (named as e.g. "ep12out-bulk"),
256+ * parse the endpoint address from its name. We deliberately use
257+ * deprecated simple_strtoul() function here, as the number isn't
258+ * followed by '\0' nor '\n'.
259+ */
260+ if (isdigit(name[2]))
261+ return simple_strtoul(&name[2], NULL, 10);
262+ /* Otherwise the endpoint is configurable (named as e.g. "ep-a"). */
263+ return USB_RAW_EP_ADDR_ANY;
264+}
265+
252266 static int gadget_bind(struct usb_gadget *gadget,
253267 struct usb_gadget_driver *driver)
254268 {
255− int ret = 0;
269+ int ret = 0, i = 0;
256270 struct raw_dev *dev = container_of(driver, struct raw_dev, driver);
257271 struct usb_request *req;
272+ struct usb_ep *ep;
258273 unsigned long flags;
259274
260275 if (strcmp(gadget->name, dev->udc_name) != 0)
@@ -273,6 +288,13 @@ static int gadget_bind(struct usb_gadget *gadget, · 12 unmodified lines
273288 dev->req->context = dev;
274289 dev->req->complete = gadget_ep0_complete;
275290 dev->gadget = gadget;
291+ gadget_for_each_ep(ep, dev->gadget) {
292+ dev->eps[i].ep = ep;
293+ dev->eps[i].addr = get_ep_addr(ep->name);
294+ dev->eps[i].state = STATE_EP_DISABLED;
295+ i++;
296+ }
297+ dev->eps_num = i;
276298 spin_unlock_irqrestore(&dev->lock, flags);
277299
278300 /* Matches kref_put() in gadget_unbind(). */
@@ -555,7 +577,7 @@ static void *raw_alloc_io_data(struct usb_raw_ep_io *io, void __user *ptr, · 276 unmodified lines
555577
556578 if (copy_from_user(io, ptr, sizeof(*io)))
557579 return ERR_PTR(-EFAULT);
558− if (io->ep >= USB_RAW_MAX_ENDPOINTS)
580+ if (io->ep >= USB_RAW_EPS_NUM_MAX)
559581 return ERR_PTR(-EINVAL);
560582 if (!usb_raw_io_flags_valid(io->flags))
561583 return ERR_PTR(-EINVAL);
@@ -669,43 +691,61 @@ static int raw_ioctl_ep0_read(struct raw_dev *dev, unsigned long value) · 107 unmodified lines
669691 if (IS_ERR(data))
670692 return PTR_ERR(data);
671693 ret = raw_process_ep0_io(dev, &io, data, false);
672− if (ret)
694+ if (ret < 0)
673695 goto free;
674696
675697 length = min(io.length, (unsigned int)ret);
676698 if (copy_to_user((void __user *)(value + sizeof(io)), data, length))
677699 ret = -EFAULT;
700+ else
701+ ret = length;
678702 free:
679703 kfree(data);
680704 return ret;
681705 }
682706
683−static bool check_ep_caps(struct usb_ep *ep,
684− struct usb_endpoint_descriptor *desc)
707+static int raw_ioctl_ep0_stall(struct raw_dev *dev, unsigned long value)
685708 {
686− switch (usb_endpoint_type(desc)) {
687− case USB_ENDPOINT_XFER_ISOC:
688− if (!ep->caps.type_iso)
689− return false;
690− break;
691− case USB_ENDPOINT_XFER_BULK:
692− if (!ep->caps.type_bulk)
693− return false;
694− break;
695− case USB_ENDPOINT_XFER_INT:
696− if (!ep->caps.type_int)
697− return false;
698− break;
699− default:
700− return false;
709+ int ret = 0;
710+ unsigned long flags;
711+
712+ if (value)
713+ return -EINVAL;
714+ spin_lock_irqsave(&dev->lock, flags);
715+ if (dev->state != STATE_DEV_RUNNING) {
716+ dev_dbg(dev->dev, "fail, device is not running\n");
717+ ret = -EINVAL;
718+ goto out_unlock;
719+ }
720+ if (!dev->gadget) {
721+ dev_dbg(dev->dev, "fail, gadget is not bound\n");
722+ ret = -EBUSY;
723+ goto out_unlock;
724+ }
725+ if (dev->ep0_urb_queued) {
726+ dev_dbg(&dev->gadget->dev, "fail, urb already queued\n");
727+ ret = -EBUSY;
728+ goto out_unlock;
729+ }
730+ if (!dev->ep0_in_pending && !dev->ep0_out_pending) {
731+ dev_dbg(&dev->gadget->dev, "fail, no request pending\n");
732+ ret = -EBUSY;
733+ goto out_unlock;
701734 }
702735
703− if (usb_endpoint_dir_in(desc) && !ep->caps.dir_in)
704− return false;
705− if (usb_endpoint_dir_out(desc) && !ep->caps.dir_out)
706− return false;
736+ ret = usb_ep_set_halt(dev->gadget->ep0);
737+ if (ret < 0)
738+ dev_err(&dev->gadget->dev,
739+ "fail, usb_ep_set_halt returned %d\n", ret);
740+
741+ if (dev->ep0_in_pending)
742+ dev->ep0_in_pending = false;
743+ else
744+ dev->ep0_out_pending = false;
707745
708− return true;
746+out_unlock:
747+ spin_unlock_irqrestore(&dev->lock, flags);
748+ return ret;
709749 }
710750
711751 static int raw_ioctl_ep_enable(struct raw_dev *dev, unsigned long value)
@@ -713,7 +753,7 @@ static int raw_ioctl_ep_enable(struct raw_dev *dev, unsigned long value) · 1 unmodified line
713753 int ret = 0, i;
714754 unsigned long flags;
715755 struct usb_endpoint_descriptor *desc;
716− struct usb_ep *ep = NULL;
756+ struct raw_ep *ep;
717757
718758 desc = memdup_user((void __user *)value, sizeof(*desc));
719759 if (IS_ERR(desc))
@@ -741,41 +781,32 @@ static int raw_ioctl_ep_enable(struct raw_dev *dev, unsigned long value) · 21 unmodified lines
741781 goto out_free;
742782 }
743783
744− for (i = 0; i < USB_RAW_MAX_ENDPOINTS; i++) {
745− if (dev->eps[i].state == STATE_EP_ENABLED)
784+ for (i = 0; i < dev->eps_num; i++) {
785+ ep = &dev->eps[i];
786+ if (ep->state != STATE_EP_DISABLED)
746787 continue;
747− break;
748− }
749− if (i == USB_RAW_MAX_ENDPOINTS) {
750− dev_dbg(&dev->gadget->dev,
751− "fail, no device endpoints available\n");
752− ret = -EBUSY;
753− goto out_free;
754− }
755−
756− gadget_for_each_ep(ep, dev->gadget) {
757− if (ep->enabled)
788+ if (ep->addr != usb_endpoint_num(desc) &&
789+ ep->addr != USB_RAW_EP_ADDR_ANY)
758790 continue;
759− if (!check_ep_caps(ep, desc))
791+ if (!usb_gadget_ep_match_desc(dev->gadget, ep->ep, desc, NULL))
760792 continue;
761− ep->desc = desc;
762− ret = usb_ep_enable(ep);
793+ ep->ep->desc = desc;
794+ ret = usb_ep_enable(ep->ep);
763795 if (ret < 0) {
764796 dev_err(&dev->gadget->dev,
765797 "fail, usb_ep_enable returned %d\n", ret);
766798 goto out_free;
767799 }
768− dev->eps[i].req = usb_ep_alloc_request(ep, GFP_ATOMIC);
769− if (!dev->eps[i].req) {
800+ ep->req = usb_ep_alloc_request(ep->ep, GFP_ATOMIC);
801+ if (!ep->req) {
770802 dev_err(&dev->gadget->dev,
771803 "fail, usb_ep_alloc_request failed\n");
772− usb_ep_disable(ep);
804+ usb_ep_disable(ep->ep);
773805 ret = -ENOMEM;
774806 goto out_free;
775807 }
776− dev->eps[i].ep = ep;
777− dev->eps[i].state = STATE_EP_ENABLED;
778− ep->driver_data = &dev->eps[i];
808+ ep->state = STATE_EP_ENABLED;
809+ ep->ep->driver_data = ep;
779810 ret = i;
780811 goto out_unlock;
781812 }
@@ -794,10 +825,6 @@ static int raw_ioctl_ep_disable(struct raw_dev *dev, unsigned long value) · 12 unmodified lines
794825 {
795826 int ret = 0, i = value;
796827 unsigned long flags;
797− const void *desc;
798−
799− if (i < 0 || i >= USB_RAW_MAX_ENDPOINTS)
800− return -EINVAL;
801828
802829 spin_lock_irqsave(&dev->lock, flags);
803830 if (dev->state != STATE_DEV_RUNNING) {
@@ -810,7 +837,12 @@ static int raw_ioctl_ep_disable(struct raw_dev *dev, unsigned long value) · 6 unmodified lines
810837 ret = -EBUSY;
811838 goto out_unlock;
812839 }
813− if (dev->eps[i].state != STATE_EP_ENABLED) {
840+ if (i < 0 || i >= dev->eps_num) {
841+ dev_dbg(dev->dev, "fail, invalid endpoint\n");
842+ ret = -EBUSY;
843+ goto out_unlock;
844+ }
845+ if (dev->eps[i].state == STATE_EP_DISABLED) {
814846 dev_dbg(&dev->gadget->dev, "fail, endpoint is not enabled\n");
815847 ret = -EINVAL;
816848 goto out_unlock;
@@ -834,10 +866,8 @@ static int raw_ioctl_ep_disable(struct raw_dev *dev, unsigned long value) · 17 unmodified lines
834866
835867 spin_lock_irqsave(&dev->lock, flags);
836868 usb_ep_free_request(dev->eps[i].ep, dev->eps[i].req);
837− desc = dev->eps[i].ep->desc;
838− dev->eps[i].ep = NULL;
869+ kfree(dev->eps[i].ep->desc);
839870 dev->eps[i].state = STATE_EP_DISABLED;
840− kfree(desc);
841871 dev->eps[i].disabling = false;
842872
843873 out_unlock:
@@ -845,6 +875,74 @@ out_unlock: · 1 unmodified line
845875 return ret;
846876 }
847877
878+static int raw_ioctl_ep_set_clear_halt_wedge(struct raw_dev *dev,
879+ unsigned long value, bool set, bool halt)
880+{
881+ int ret = 0, i = value;
882+ unsigned long flags;
883+
884+ spin_lock_irqsave(&dev->lock, flags);
885+ if (dev->state != STATE_DEV_RUNNING) {
886+ dev_dbg(dev->dev, "fail, device is not running\n");
887+ ret = -EINVAL;
888+ goto out_unlock;
889+ }
890+ if (!dev->gadget) {
891+ dev_dbg(dev->dev, "fail, gadget is not bound\n");
892+ ret = -EBUSY;
893+ goto out_unlock;
894+ }
895+ if (i < 0 || i >= dev->eps_num) {
896+ dev_dbg(dev->dev, "fail, invalid endpoint\n");
897+ ret = -EBUSY;
898+ goto out_unlock;
899+ }
900+ if (dev->eps[i].state == STATE_EP_DISABLED) {
901+ dev_dbg(&dev->gadget->dev, "fail, endpoint is not enabled\n");
902+ ret = -EINVAL;
903+ goto out_unlock;
904+ }
905+ if (dev->eps[i].disabling) {
906+ dev_dbg(&dev->gadget->dev,
907+ "fail, disable is in progress\n");
908+ ret = -EINVAL;
909+ goto out_unlock;
910+ }
911+ if (dev->eps[i].urb_queued) {
912+ dev_dbg(&dev->gadget->dev,
913+ "fail, waiting for urb completion\n");
914+ ret = -EINVAL;
915+ goto out_unlock;
916+ }
917+ if (usb_endpoint_xfer_isoc(dev->eps[i].ep->desc)) {
918+ dev_dbg(&dev->gadget->dev,
919+ "fail, can't halt/wedge ISO endpoint\n");
920+ ret = -EINVAL;
921+ goto out_unlock;
922+ }
923+
924+ if (set && halt) {
925+ ret = usb_ep_set_halt(dev->eps[i].ep);
926+ if (ret < 0)
927+ dev_err(&dev->gadget->dev,
928+ "fail, usb_ep_set_halt returned %d\n", ret);
929+ } else if (!set && halt) {
930+ ret = usb_ep_clear_halt(dev->eps[i].ep);
931+ if (ret < 0)
932+ dev_err(&dev->gadget->dev,
933+ "fail, usb_ep_clear_halt returned %d\n", ret);
934+ } else if (set && !halt) {
935+ ret = usb_ep_set_wedge(dev->eps[i].ep);
936+ if (ret < 0)
937+ dev_err(&dev->gadget->dev,
938+ "fail, usb_ep_set_wedge returned %d\n", ret);
939+ }
940+
941+out_unlock:
942+ spin_unlock_irqrestore(&dev->lock, flags);
943+ return ret;
944+}
945+
848946 static void gadget_ep_complete(struct usb_ep *ep, struct usb_request *req)
849947 {
850948 struct raw_ep *r_ep = (struct raw_ep *)ep->driver_data;
@@ -866,7 +964,7 @@ static int raw_process_ep_io(struct raw_dev *dev, struct usb_raw_ep_io *io, · 15 unmodified lines
866964 {
867965 int ret = 0;
868966 unsigned long flags;
869− struct raw_ep *ep = &dev->eps[io->ep];
967+ struct raw_ep *ep;
870968 DECLARE_COMPLETION_ONSTACK(done);
871969
872970 spin_lock_irqsave(&dev->lock, flags);
@@ -880,6 +978,12 @@ static int raw_process_ep_io(struct raw_dev *dev, struct usb_raw_ep_io *io, · 7 unmodified lines
880978 ret = -EBUSY;
881979 goto out_unlock;
882980 }
981+ if (io->ep >= dev->eps_num) {
982+ dev_dbg(&dev->gadget->dev, "fail, invalid endpoint\n");
983+ ret = -EINVAL;
984+ goto out_unlock;
985+ }
986+ ep = &dev->eps[io->ep];
883987 if (ep->state != STATE_EP_ENABLED) {
884988 dev_dbg(&dev->gadget->dev, "fail, endpoint is not enabled\n");
885989 ret = -EBUSY;
@@ -964,12 +1068,14 @@ static int raw_ioctl_ep_read(struct raw_dev *dev, unsigned long value) · 78 unmodified lines
9641068 if (IS_ERR(data))
9651069 return PTR_ERR(data);
9661070 ret = raw_process_ep_io(dev, &io, data, false);
967− if (ret)
1071+ if (ret < 0)
9681072 goto free;
9691073
9701074 length = min(io.length, (unsigned int)ret);
9711075 if (copy_to_user((void __user *)(value + sizeof(io)), data, length))
9721076 ret = -EFAULT;
1077+ else
1078+ ret = length;
9731079 free:
9741080 kfree(data);
9751081 return ret;
@@ -1023,6 +1129,71 @@ out_unlock: · 47 unmodified lines
10231129 return ret;
10241130 }
10251131
1132+static void fill_ep_caps(struct usb_ep_caps *caps,
1133+ struct usb_raw_ep_caps *raw_caps)
1134+{
1135+ raw_caps->type_control = caps->type_control;
1136+ raw_caps->type_iso = caps->type_iso;
1137+ raw_caps->type_bulk = caps->type_bulk;
1138+ raw_caps->type_int = caps->type_int;
1139+ raw_caps->dir_in = caps->dir_in;
1140+ raw_caps->dir_out = caps->dir_out;
1141+}
1142+
1143+static void fill_ep_limits(struct usb_ep *ep, struct usb_raw_ep_limits *limits)
1144+{
1145+ limits->maxpacket_limit = ep->maxpacket_limit;
1146+ limits->max_streams = ep->max_streams;
1147+}
1148+
1149+static int raw_ioctl_eps_info(struct raw_dev *dev, unsigned long value)
1150+{
1151+ int ret = 0, i;
1152+ unsigned long flags;
1153+ struct usb_raw_eps_info *info;
1154+ struct raw_ep *ep;
1155+
1156+ info = kmalloc(sizeof(*info), GFP_KERNEL);
1157+ if (!info) {
1158+ ret = -ENOMEM;
1159+ goto out;
1160+ }
1161+
1162+ spin_lock_irqsave(&dev->lock, flags);
1163+ if (dev->state != STATE_DEV_RUNNING) {
1164+ dev_dbg(dev->dev, "fail, device is not running\n");
1165+ ret = -EINVAL;
1166+ spin_unlock_irqrestore(&dev->lock, flags);
1167+ goto out_free;
1168+ }
1169+ if (!dev->gadget) {
1170+ dev_dbg(dev->dev, "fail, gadget is not bound\n");
1171+ ret = -EBUSY;
1172+ spin_unlock_irqrestore(&dev->lock, flags);
1173+ goto out_free;
1174+ }
1175+
1176+ memset(info, 0, sizeof(*info));
1177+ for (i = 0; i < dev->eps_num; i++) {
1178+ ep = &dev->eps[i];
1179+ strscpy(&info->eps[i].name[0], ep->ep->name,
1180+ USB_RAW_EP_NAME_MAX);
1181+ info->eps[i].addr = ep->addr;
1182+ fill_ep_caps(&ep->ep->caps, &info->eps[i].caps);
1183+ fill_ep_limits(ep->ep, &info->eps[i].limits);
1184+ }
1185+ ret = dev->eps_num;
1186+ spin_unlock_irqrestore(&dev->lock, flags);
1187+
1188+ if (copy_to_user((void __user *)value, info, sizeof(*info)))
1189+ ret = -EFAULT;
1190+
1191+out_free:
1192+ kfree(info);
1193+out:
1194+ return ret;
1195+}
1196+
10261197 static long raw_ioctl(struct file *fd, unsigned int cmd, unsigned long value)
10271198 {
10281199 struct raw_dev *dev = fd->private_data;
@@ -1065,6 +1236,24 @@ static long raw_ioctl(struct file *fd, unsigned int cmd, unsigned long value) · 36 unmodified lines
10651236 case USB_RAW_IOCTL_VBUS_DRAW:
10661237 ret = raw_ioctl_vbus_draw(dev, value);
10671238 break;
1239+ case USB_RAW_IOCTL_EPS_INFO:
1240+ ret = raw_ioctl_eps_info(dev, value);
1241+ break;
1242+ case USB_RAW_IOCTL_EP0_STALL:
1243+ ret = raw_ioctl_ep0_stall(dev, value);
1244+ break;
1245+ case USB_RAW_IOCTL_EP_SET_HALT:
1246+ ret = raw_ioctl_ep_set_clear_halt_wedge(
1247+ dev, value, true, true);
1248+ break;
1249+ case USB_RAW_IOCTL_EP_CLEAR_HALT:
1250+ ret = raw_ioctl_ep_set_clear_halt_wedge(
1251+ dev, value, false, true);
1252+ break;
1253+ case USB_RAW_IOCTL_EP_SET_WEDGE:
1254+ ret = raw_ioctl_ep_set_clear_halt_wedge(
1255+ dev, value, true, false);
1256+ break;
10681257 default:
10691258 ret = -EINVAL;
10701259 }
drivers/usb/gadget/udc/atmel_usba_udc.c+2−2
@@ -185,7 +185,7 @@ static int regs_dbg_release(struct inode *inode, struct file *file) · 184 unmodified lines
185185 return 0;
186186 }
187187
188−const struct file_operations queue_dbg_fops = {
188+static const struct file_operations queue_dbg_fops = {
189189 .owner = THIS_MODULE,
190190 .open = queue_dbg_open,
191191 .llseek = no_llseek,
@@ -193,7 +193,7 @@ const struct file_operations queue_dbg_fops = { · 1 unmodified line
193193 .release = queue_dbg_release,
194194 };
195195
196−const struct file_operations regs_dbg_fops = {
196+static const struct file_operations regs_dbg_fops = {
197197 .owner = THIS_MODULE,
198198 .open = regs_dbg_open,
199199 .llseek = generic_file_llseek,
drivers/usb/gadget/udc/net2272.c+2−0
@@ -2647,6 +2647,8 @@ net2272_plat_probe(struct platform_device *pdev) · 2646 unmodified lines
26472647 err_req:
26482648 release_mem_region(base, len);
26492649 err:
2650+ kfree(dev);
2651+
26502652 return ret;
26512653 }
26522654
drivers/usb/gadget/udc/tegra-xudc.c+4−4
@@ -3840,11 +3840,11 @@ static int __maybe_unused tegra_xudc_suspend(struct device *dev) · 3839 unmodified lines
38403840
38413841 flush_work(&xudc->usb_role_sw_work);
38423842
3843− /* Forcibly disconnect before powergating. */
3844− tegra_xudc_device_mode_off(xudc);
3845−
3846− if (!pm_runtime_status_suspended(dev))
3843+ if (!pm_runtime_status_suspended(dev)) {
3844+ /* Forcibly disconnect before powergating. */
3845+ tegra_xudc_device_mode_off(xudc);
38473846 tegra_xudc_powergate(xudc);
3847+ }
38483848
38493849 pm_runtime_disable(dev);
38503850
drivers/usb/host/xhci-plat.c+3−1
@@ -362,6 +362,7 @@ static int xhci_plat_remove(struct platform_device *dev) · 361 unmodified lines
362362 struct clk *reg_clk = xhci->reg_clk;
363363 struct usb_hcd *shared_hcd = xhci->shared_hcd;
364364
365+ pm_runtime_get_sync(&dev->dev);
365366 xhci->xhc_state |= XHCI_STATE_REMOVING;
366367
367368 usb_remove_hcd(shared_hcd);
@@ -375,8 +376,9 @@ static int xhci_plat_remove(struct platform_device *dev) · 7 unmodified lines
375376 clk_disable_unprepare(reg_clk);
376377 usb_put_hcd(hcd);
377378
378− pm_runtime_set_suspended(&dev->dev);
379379 pm_runtime_disable(&dev->dev);
380+ pm_runtime_put_noidle(&dev->dev);
381+ pm_runtime_set_suspended(&dev->dev);
380382
381383 return 0;
382384 }
drivers/usb/host/xhci-ring.c+2−2
@@ -3433,8 +3433,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, · 3432 unmodified lines
34333433 /* New sg entry */
34343434 --num_sgs;
34353435 sent_len -= block_len;
3436− if (num_sgs != 0) {
3437− sg = sg_next(sg);
3436+ sg = sg_next(sg);
3437+ if (num_sgs != 0 && sg) {
34383438 block_len = sg_dma_len(sg);
34393439 addr = (u64) sg_dma_address(sg);
34403440 addr += sent_len;
drivers/usb/mtu3/mtu3_debugfs.c+2−2
@@ -276,7 +276,7 @@ static const struct file_operations mtu3_ep_fops = { · 275 unmodified lines
276276 .release = single_release,
277277 };
278278
279−static struct debugfs_reg32 mtu3_prb_regs[] = {
279+static const struct debugfs_reg32 mtu3_prb_regs[] = {
280280 dump_prb_reg("enable", U3D_SSUSB_PRB_CTRL0),
281281 dump_prb_reg("byte-sell", U3D_SSUSB_PRB_CTRL1),
282282 dump_prb_reg("byte-selh", U3D_SSUSB_PRB_CTRL2),
@@ -349,7 +349,7 @@ static const struct file_operations mtu3_probe_fops = { · 66 unmodified lines
349349 static void mtu3_debugfs_create_prb_files(struct mtu3 *mtu)
350350 {
351351 struct ssusb_mtk *ssusb = mtu->ssusb;
352− struct debugfs_reg32 *regs;
352+ const struct debugfs_reg32 *regs;
353353 struct dentry *dir_prb;
354354 int i;
355355
drivers/usb/phy/phy-twl6030-usb.c+9−3
@@ -377,7 +377,7 @@ static int twl6030_usb_probe(struct platform_device *pdev) · 376 unmodified lines
377377 if (status < 0) {
378378 dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
379379 twl->irq1, status);
380− return status;
380+ goto err_put_regulator;
381381 }
382382
383383 status = request_threaded_irq(twl->irq2, NULL, twl6030_usb_irq,
@@ -386,8 +386,7 @@ static int twl6030_usb_probe(struct platform_device *pdev) · 2 unmodified lines
386386 if (status < 0) {
387387 dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
388388 twl->irq2, status);
389− free_irq(twl->irq1, twl);
390− return status;
389+ goto err_free_irq1;
391390 }
392391
393392 twl->asleep = 0;
@@ -396,6 +395,13 @@ static int twl6030_usb_probe(struct platform_device *pdev) · 2 unmodified lines
396395 dev_info(&pdev->dev, "Initialized TWL6030 USB module\n");
397396
398397 return 0;
398+
399+err_free_irq1:
400+ free_irq(twl->irq1, twl);
401+err_put_regulator:
402+ regulator_put(twl->usb3v3);
403+
404+ return status;
399405 }
400406
401407 static int twl6030_usb_remove(struct platform_device *pdev)
drivers/usb/typec/mux/intel_pmc_mux.c+3−3
@@ -63,6 +63,7 @@ enum { · 62 unmodified lines
6363 #define PMC_USB_ALTMODE_DP_MODE_SHIFT 8
6464
6565 /* TBT specific Mode Data bits */
66+#define PMC_USB_ALTMODE_HPD_HIGH BIT(14)
6667 #define PMC_USB_ALTMODE_TBT_TYPE BIT(17)
6768 #define PMC_USB_ALTMODE_CABLE_TYPE BIT(18)
6869 #define PMC_USB_ALTMODE_ACTIVE_LINK BIT(20)
@@ -74,8 +75,8 @@ enum { · 5 unmodified lines
7475 #define PMC_USB_ALTMODE_TBT_GEN(_g_) (((_g_) & GENMASK(1, 0)) << 28)
7576
7677 /* Display HPD Request bits */
78+#define PMC_USB_DP_HPD_LVL BIT(4)
7779 #define PMC_USB_DP_HPD_IRQ BIT(5)
78−#define PMC_USB_DP_HPD_LVL BIT(6)
7980
8081 struct pmc_usb;
8182
@@ -158,8 +159,7 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state) · 76 unmodified lines
158159 PMC_USB_ALTMODE_DP_MODE_SHIFT;
159160
160161 if (data->status & DP_STATUS_HPD_STATE)
161− req.mode_data |= PMC_USB_DP_HPD_LVL <<
162− PMC_USB_ALTMODE_DP_MODE_SHIFT;
162+ req.mode_data |= PMC_USB_ALTMODE_HPD_HIGH;
163163
164164 return pmc_usb_command(port, (void *)&req, sizeof(req));
165165 }
drivers/vdpa/vdpa_sim/vdpa_sim.c+7−8
@@ -89,15 +89,14 @@ static struct vdpasim *dev_to_sim(struct device *dev) · 88 unmodified lines
8989 static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx)
9090 {
9191 struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];
92− int ret;
9392
94− ret = vringh_init_iotlb(&vq->vring, vdpasim_features,
95− VDPASIM_QUEUE_MAX, false,
96− (struct vring_desc *)(uintptr_t)vq->desc_addr,
97− (struct vring_avail *)
98− (uintptr_t)vq->driver_addr,
99− (struct vring_used *)
100− (uintptr_t)vq->device_addr);
93+ vringh_init_iotlb(&vq->vring, vdpasim_features,
94+ VDPASIM_QUEUE_MAX, false,
95+ (struct vring_desc *)(uintptr_t)vq->desc_addr,
96+ (struct vring_avail *)
97+ (uintptr_t)vq->driver_addr,
98+ (struct vring_used *)
99+ (uintptr_t)vq->device_addr);
101100 }
102101
103102 static void vdpasim_vq_reset(struct vdpasim_virtqueue *vq)
drivers/vhost/vhost.c+2−2
@@ -730,7 +730,7 @@ static inline void __user *vhost_vq_meta_fetch(struct vhost_virtqueue *vq, · 729 unmodified lines
730730 if (!map)
731731 return NULL;
732732
733− return (void *)(uintptr_t)(map->addr + addr - map->start);
733+ return (void __user *)(uintptr_t)(map->addr + addr - map->start);
734734 }
735735
736736 /* Can we switch to this memory table? */
@@ -869,7 +869,7 @@ static void __user *__vhost_get_user_slow(struct vhost_virtqueue *vq, · 132 unmodified lines
869869 * not happen in this case.
870870 */
871871 static inline void __user *__vhost_get_user(struct vhost_virtqueue *vq,
872− void *addr, unsigned int size,
872+ void __user *addr, unsigned int size,
873873 int type)
874874 {
875875 void __user *uaddr = vhost_vq_meta_fetch(vq,
fs/afs/fs_probe.c+5−13
@@ -32,9 +32,8 @@ void afs_fileserver_probe_result(struct afs_call *call) · 31 unmodified lines
3232 struct afs_server *server = call->server;
3333 unsigned int server_index = call->server_index;
3434 unsigned int index = call->addr_ix;
35− unsigned int rtt = UINT_MAX;
35+ unsigned int rtt_us = 0;
3636 bool have_result = false;
37− u64 _rtt;
3837 int ret = call->error;
3938
4039 _enter("%pU,%u", &server->uuid, index);
@@ -93,15 +92,9 @@ responded: · 52 unmodified lines
9392 }
9493 }
9594
96− /* Get the RTT and scale it to fit into a 32-bit value that represents
97− * over a minute of time so that we can access it with one instruction
98− * on a 32-bit system.
99− */
100− _rtt = rxrpc_kernel_get_rtt(call->net->socket, call->rxcall);
101− _rtt /= 64;
102− rtt = (_rtt > UINT_MAX) ? UINT_MAX : _rtt;
103− if (rtt < server->probe.rtt) {
104− server->probe.rtt = rtt;
95+ rtt_us = rxrpc_kernel_get_srtt(call->net->socket, call->rxcall);
96+ if (rtt_us < server->probe.rtt) {
97+ server->probe.rtt = rtt_us;
10598 alist->preferred = index;
10699 have_result = true;
107100 }
@@ -113,8 +106,7 @@ out: · 5 unmodified lines
113106 spin_unlock(&server->probe_lock);
114107
115108 _debug("probe [%u][%u] %pISpc rtt=%u ret=%d",
116− server_index, index, &alist->addrs[index].transport,
117− (unsigned int)rtt, ret);
109+ server_index, index, &alist->addrs[index].transport, rtt_us, ret);
118110
119111 have_result |= afs_fs_probe_done(server);
120112 if (have_result)
fs/afs/fsclient.c+4−4
@@ -385,8 +385,6 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call) · 384 unmodified lines
385385 ASSERTCMP(req->offset, <=, PAGE_SIZE);
386386 if (req->offset == PAGE_SIZE) {
387387 req->offset = 0;
388− if (req->page_done)
389− req->page_done(req);
390388 req->index++;
391389 if (req->remain > 0)
392390 goto begin_page;
@@ -440,11 +438,13 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call) · 47 unmodified lines
440438 if (req->offset < PAGE_SIZE)
441439 zero_user_segment(req->pages[req->index],
442440 req->offset, PAGE_SIZE);
443− if (req->page_done)
444− req->page_done(req);
445441 req->offset = 0;
446442 }
447443
444+ if (req->page_done)
445+ for (req->index = 0; req->index < req->nr_pages; req->index++)
446+ req->page_done(req);
447+
448448 _leave(" = 0 [done]");
449449 return 0;
450450 }
fs/afs/vl_probe.c+5−13
@@ -31,10 +31,9 @@ void afs_vlserver_probe_result(struct afs_call *call) · 30 unmodified lines
3131 struct afs_addr_list *alist = call->alist;
3232 struct afs_vlserver *server = call->vlserver;
3333 unsigned int server_index = call->server_index;
34+ unsigned int rtt_us = 0;
3435 unsigned int index = call->addr_ix;
35− unsigned int rtt = UINT_MAX;
3636 bool have_result = false;
37− u64 _rtt;
3837 int ret = call->error;
3938
4039 _enter("%s,%u,%u,%d,%d", server->name, server_index, index, ret, call->abort_code);
@@ -93,15 +92,9 @@ responded: · 52 unmodified lines
9392 }
9493 }
9594
96− /* Get the RTT and scale it to fit into a 32-bit value that represents
97− * over a minute of time so that we can access it with one instruction
98− * on a 32-bit system.
99− */
100− _rtt = rxrpc_kernel_get_rtt(call->net->socket, call->rxcall);
101− _rtt /= 64;
102− rtt = (_rtt > UINT_MAX) ? UINT_MAX : _rtt;
103− if (rtt < server->probe.rtt) {
104− server->probe.rtt = rtt;
95+ rtt_us = rxrpc_kernel_get_srtt(call->net->socket, call->rxcall);
96+ if (rtt_us < server->probe.rtt) {
97+ server->probe.rtt = rtt_us;
10598 alist->preferred = index;
10699 have_result = true;
107100 }
@@ -113,8 +106,7 @@ out: · 5 unmodified lines
113106 spin_unlock(&server->probe_lock);
114107
115108 _debug("probe [%u][%u] %pISpc rtt=%u ret=%d",
116− server_index, index, &alist->addrs[index].transport,
117− (unsigned int)rtt, ret);
109+ server_index, index, &alist->addrs[index].transport, rtt_us, ret);
118110
119111 have_result |= afs_vl_probe_done(server);
120112 if (have_result) {
fs/afs/yfsclient.c+4−4
@@ -497,8 +497,6 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call) · 496 unmodified lines
497497 ASSERTCMP(req->offset, <=, PAGE_SIZE);
498498 if (req->offset == PAGE_SIZE) {
499499 req->offset = 0;
500− if (req->page_done)
501− req->page_done(req);
502500 req->index++;
503501 if (req->remain > 0)
504502 goto begin_page;
@@ -556,11 +554,13 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call) · 51 unmodified lines
556554 if (req->offset < PAGE_SIZE)
557555 zero_user_segment(req->pages[req->index],
558556 req->offset, PAGE_SIZE);
559− if (req->page_done)
560− req->page_done(req);
561557 req->offset = 0;
562558 }
563559
560+ if (req->page_done)
561+ for (req->index = 0; req->index < req->nr_pages; req->index++)
562+ req->page_done(req);
563+
564564 _leave(" = 0 [done]");
565565 return 0;
566566 }
fs/cachefiles/rdwr.c+6−6
@@ -60,9 +60,9 @@ static int cachefiles_read_waiter(wait_queue_entry_t *wait, unsigned mode, · 59 unmodified lines
6060 object = container_of(op->op.object, struct cachefiles_object, fscache);
6161 spin_lock(&object->work_lock);
6262 list_add_tail(&monitor->op_link, &op->to_do);
63+ fscache_enqueue_retrieval(op);
6364 spin_unlock(&object->work_lock);
6465
65− fscache_enqueue_retrieval(op);
6666 fscache_put_retrieval(op);
6767 return 0;
6868 }
@@ -398,7 +398,7 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op, · 329 unmodified lines
398398 struct inode *inode;
399399 sector_t block;
400400 unsigned shift;
401− int ret;
401+ int ret, ret2;
402402
403403 object = container_of(op->op.object,
404404 struct cachefiles_object, fscache);
@@ -430,8 +430,8 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op, · 25 unmodified lines
430430 block = page->index;
431431 block <<= shift;
432432
433− ret = bmap(inode, &block);
434− ASSERT(ret < 0);
433+ ret2 = bmap(inode, &block);
434+ ASSERT(ret2 == 0);
435435
436436 _debug("%llx -> %llx",
437437 (unsigned long long) (page->index << shift),
@@ -739,8 +739,8 @@ int cachefiles_read_or_alloc_pages(struct fscache_retrieval *op, · 301 unmodified lines
739739 block = page->index;
740740 block <<= shift;
741741
742− ret = bmap(inode, &block);
743− ASSERT(!ret);
742+ ret2 = bmap(inode, &block);
743+ ASSERT(ret2 == 0);
744744
745745 _debug("%llx -> %llx",
746746 (unsigned long long) (page->index << shift),
fs/cifs/cifssmb.c+1−1
@@ -2152,8 +2152,8 @@ cifs_writev_requeue(struct cifs_writedata *wdata) · 2151 unmodified lines
21522152 }
21532153 }
21542154
2155+ kref_put(&wdata2->refcount, cifs_writedata_release);
21552156 if (rc) {
2156− kref_put(&wdata2->refcount, cifs_writedata_release);
21572157 if (is_retryable_error(rc))
21582158 continue;
21592159 i += nr_pages;
fs/cifs/file.c+1−1
@@ -4060,7 +4060,7 @@ cifs_read(struct file *file, char *read_data, size_t read_size, loff_t *offset) · 4059 unmodified lines
40604060 * than it negotiated since it will refuse the read
40614061 * then.
40624062 */
4063− if ((tcon->ses) && !(tcon->ses->capabilities &
4063+ if (!(tcon->ses->capabilities &
40644064 tcon->ses->server->vals->cap_large_files)) {
40654065 current_read_size = min_t(uint,
40664066 current_read_size, CIFSMaxBufSize);
fs/cifs/inode.c+1−1
@@ -730,7 +730,7 @@ static __u64 simple_hashstr(const char *str) · 729 unmodified lines
730730 * cifs_backup_query_path_info - SMB1 fallback code to get ino
731731 *
732732 * Fallback code to get file metadata when we don't have access to
733− * @full_path (EACCESS) and have backup creds.
733+ * @full_path (EACCES) and have backup creds.
734734 *
735735 * @data will be set to search info result buffer
736736 * @resp_buf will be set to cifs resp buf and needs to be freed with
fs/eventpoll.c+28−20
@@ -1879,34 +1879,33 @@ fetch_events: · 1878 unmodified lines
18791879 * event delivery.
18801880 */
18811881 init_wait(&wait);
1882− write_lock_irq(&ep->lock);
1883− __add_wait_queue_exclusive(&ep->wq, &wait);
1884− write_unlock_irq(&ep->lock);
18851882
1883+ write_lock_irq(&ep->lock);
18861884 /*
1887− * We don't want to sleep if the ep_poll_callback() sends us
1888− * a wakeup in between. That's why we set the task state
1889− * to TASK_INTERRUPTIBLE before doing the checks.
1885+ * Barrierless variant, waitqueue_active() is called under
1886+ * the same lock on wakeup ep_poll_callback() side, so it
1887+ * is safe to avoid an explicit barrier.
18901888 */
1891− set_current_state(TASK_INTERRUPTIBLE);
1889+ __set_current_state(TASK_INTERRUPTIBLE);
1890+
18921891 /*
1893− * Always short-circuit for fatal signals to allow
1894− * threads to make a timely exit without the chance of
1895− * finding more events available and fetching
1896− * repeatedly.
1892+ * Do the final check under the lock. ep_scan_ready_list()
1893+ * plays with two lists (->rdllist and ->ovflist) and there
1894+ * is always a race when both lists are empty for short
1895+ * period of time although events are pending, so lock is
1896+ * important.
18971897 */
1898− if (fatal_signal_pending(current)) {
1899− res = -EINTR;
1900− break;
1898+ eavail = ep_events_available(ep);
1899+ if (!eavail) {
1900+ if (signal_pending(current))
1901+ res = -EINTR;
1902+ else
1903+ __add_wait_queue_exclusive(&ep->wq, &wait);
19011904 }
1905+ write_unlock_irq(&ep->lock);
19021906
1903− eavail = ep_events_available(ep);
1904− if (eavail)
1905− break;
1906− if (signal_pending(current)) {
1907− res = -EINTR;
1907+ if (eavail || res)
19081908 break;
1909− }
19101909
19111910 if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS)) {
19121911 timed_out = 1;
@@ -1927,6 +1926,15 @@ fetch_events: · 14 unmodified lines
19271926 }
19281927
19291928 send_events:
1929+ if (fatal_signal_pending(current)) {
1930+ /*
1931+ * Always short-circuit for fatal signals to allow
1932+ * threads to make a timely exit without the chance of
1933+ * finding more events available and fetching
1934+ * repeatedly.
1935+ */
1936+ res = -EINTR;
1937+ }
19301938 /*
19311939 * Try to transfer events to user space. In case we get 0 events and
19321940 * there's still timeout left over, we go trying again in search of
fs/exec.c+2−2
@@ -1317,6 +1317,8 @@ int flush_old_exec(struct linux_binprm * bprm) · 1316 unmodified lines
13171317 */
13181318 set_mm_exe_file(bprm->mm, bprm->file);
13191319
1320+ would_dump(bprm, bprm->file);
1321+
13201322 /*
13211323 * Release all of the old mmap stuff
13221324 */
@@ -1876,8 +1878,6 @@ static int __do_execve_file(int fd, struct filename *filename, · 553 unmodified lines
18761878 if (retval < 0)
18771879 goto out;
18781880
1879− would_dump(bprm, bprm->file);
1880−
18811881 retval = exec_binprm(bprm);
18821882 if (retval < 0)
18831883 goto out;
fs/exfat/file.c+7−6
@@ -348,12 +348,13 @@ out: · 347 unmodified lines
348348 }
349349
350350 const struct file_operations exfat_file_operations = {
351− .llseek = generic_file_llseek,
352− .read_iter = generic_file_read_iter,
353− .write_iter = generic_file_write_iter,
354− .mmap = generic_file_mmap,
355− .fsync = generic_file_fsync,
356− .splice_read = generic_file_splice_read,
351+ .llseek = generic_file_llseek,
352+ .read_iter = generic_file_read_iter,
353+ .write_iter = generic_file_write_iter,
354+ .mmap = generic_file_mmap,
355+ .fsync = generic_file_fsync,
356+ .splice_read = generic_file_splice_read,
357+ .splice_write = iter_file_splice_write,
357358 };
358359
359360 const struct inode_operations exfat_file_inode_operations = {
fs/exfat/namei.c+1−0
@@ -692,6 +692,7 @@ static int exfat_find(struct inode *dir, struct qstr *qname, · 691 unmodified lines
692692 exfat_fs_error(sb,
693693 "non-zero size file starts with zero cluster (size : %llu, p_dir : %u, entry : 0x%08x)",
694694 i_size_read(dir), ei->dir.dir, ei->entry);
695+ kfree(es);
695696 return -EIO;
696697 }
697698
fs/exfat/super.c+19−0
@@ -203,6 +203,12 @@ enum { · 202 unmodified lines
203203 Opt_errors,
204204 Opt_discard,
205205 Opt_time_offset,
206+
207+ /* Deprecated options */
208+ Opt_utf8,
209+ Opt_debug,
210+ Opt_namecase,
211+ Opt_codepage,
206212 };
207213
208214 static const struct constant_table exfat_param_enums[] = {
@@ -223,6 +229,14 @@ static const struct fs_parameter_spec exfat_parameters[] = { · 14 unmodified lines
223229 fsparam_enum("errors", Opt_errors, exfat_param_enums),
224230 fsparam_flag("discard", Opt_discard),
225231 fsparam_s32("time_offset", Opt_time_offset),
232+ __fsparam(NULL, "utf8", Opt_utf8, fs_param_deprecated,
233+ NULL),
234+ __fsparam(NULL, "debug", Opt_debug, fs_param_deprecated,
235+ NULL),
236+ __fsparam(fs_param_is_u32, "namecase", Opt_namecase,
237+ fs_param_deprecated, NULL),
238+ __fsparam(fs_param_is_u32, "codepage", Opt_codepage,
239+ fs_param_deprecated, NULL),
226240 {}
227241 };
228242
@@ -278,6 +292,11 @@ static int exfat_parse_param(struct fs_context *fc, struct fs_parameter *param) · 49 unmodified lines
278292 return -EINVAL;
279293 opts->time_offset = result.int_32;
280294 break;
295+ case Opt_utf8:
296+ case Opt_debug:
297+ case Opt_namecase:
298+ case Opt_codepage:
299+ break;
281300 default:
282301 return -EINVAL;
283302 }
fs/ext4/ext4.h+1−1
@@ -722,7 +722,7 @@ enum { · 721 unmodified lines
722722 #define EXT4_MAX_BLOCK_FILE_PHYS 0xFFFFFFFF
723723
724724 /* Max logical block we can support */
725−#define EXT4_MAX_LOGICAL_BLOCK 0xFFFFFFFF
725+#define EXT4_MAX_LOGICAL_BLOCK 0xFFFFFFFE
726726
727727 /*
728728 * Structure of an inode on the disk
fs/ext4/extents.c+31−0
@@ -4832,6 +4832,28 @@ static const struct iomap_ops ext4_iomap_xattr_ops = { · 4831 unmodified lines
48324832 .iomap_begin = ext4_iomap_xattr_begin,
48334833 };
48344834
4835+static int ext4_fiemap_check_ranges(struct inode *inode, u64 start, u64 *len)
4836+{
4837+ u64 maxbytes;
4838+
4839+ if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
4840+ maxbytes = inode->i_sb->s_maxbytes;
4841+ else
4842+ maxbytes = EXT4_SB(inode->i_sb)->s_bitmap_maxbytes;
4843+
4844+ if (*len == 0)
4845+ return -EINVAL;
4846+ if (start > maxbytes)
4847+ return -EFBIG;
4848+
4849+ /*
4850+ * Shrink request scope to what the fs can actually handle.
4851+ */
4852+ if (*len > maxbytes || (maxbytes - *len) < start)
4853+ *len = maxbytes - start;
4854+ return 0;
4855+}
4856+
48354857 static int _ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
48364858 __u64 start, __u64 len, bool from_es_cache)
48374859 {
@@ -4852,6 +4874,15 @@ static int _ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, · 14 unmodified lines
48524874 if (fiemap_check_flags(fieinfo, ext4_fiemap_flags))
48534875 return -EBADR;
48544876
4877+ /*
4878+ * For bitmap files the maximum size limit could be smaller than
4879+ * s_maxbytes, so check len here manually instead of just relying on the
4880+ * generic check.
4881+ */
4882+ error = ext4_fiemap_check_ranges(inode, start, &len);
4883+ if (error)
4884+ return error;
4885+
48554886 if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR) {
48564887 fieinfo->fi_flags &= ~FIEMAP_FLAG_XATTR;
48574888 error = iomap_fiemap(inode, fieinfo, start, len,
fs/ext4/ioctl.c+2−31
@@ -733,29 +733,6 @@ static void ext4_fill_fsxattr(struct inode *inode, struct fsxattr *fa) · 732 unmodified lines
733733 fa->fsx_projid = from_kprojid(&init_user_ns, ei->i_projid);
734734 }
735735
736−/* copied from fs/ioctl.c */
737−static int fiemap_check_ranges(struct super_block *sb,
738− u64 start, u64 len, u64 *new_len)
739−{
740− u64 maxbytes = (u64) sb->s_maxbytes;
741−
742− *new_len = len;
743−
744− if (len == 0)
745− return -EINVAL;
746−
747− if (start > maxbytes)
748− return -EFBIG;
749−
750− /*
751− * Shrink request scope to what the fs can actually handle.
752− */
753− if (len > maxbytes || (maxbytes - len) < start)
754− *new_len = maxbytes - start;
755−
756− return 0;
757−}
758−
759736 /* So that the fiemap access checks can't overflow on 32 bit machines. */
760737 #define FIEMAP_MAX_EXTENTS (UINT_MAX / sizeof(struct fiemap_extent))
761738
@@ -765,8 +742,6 @@ static int ext4_ioctl_get_es_cache(struct file *filp, unsigned long arg) · 3 unmodified lines
765742 struct fiemap __user *ufiemap = (struct fiemap __user *) arg;
766743 struct fiemap_extent_info fieinfo = { 0, };
767744 struct inode *inode = file_inode(filp);
768− struct super_block *sb = inode->i_sb;
769− u64 len;
770745 int error;
771746
772747 if (copy_from_user(&fiemap, ufiemap, sizeof(fiemap)))
@@ -775,11 +750,6 @@ static int ext4_ioctl_get_es_cache(struct file *filp, unsigned long arg) · 2 unmodified lines
775750 if (fiemap.fm_extent_count > FIEMAP_MAX_EXTENTS)
776751 return -EINVAL;
777752
778− error = fiemap_check_ranges(sb, fiemap.fm_start, fiemap.fm_length,
779− &len);
780− if (error)
781− return error;
782−
783753 fieinfo.fi_flags = fiemap.fm_flags;
784754 fieinfo.fi_extents_max = fiemap.fm_extent_count;
785755 fieinfo.fi_extents_start = ufiemap->fm_extents;
@@ -792,7 +762,8 @@ static int ext4_ioctl_get_es_cache(struct file *filp, unsigned long arg) · 6 unmodified lines
792762 if (fieinfo.fi_flags & FIEMAP_FLAG_SYNC)
793763 filemap_write_and_wait(inode->i_mapping);
794764
795− error = ext4_get_es_cache(inode, &fieinfo, fiemap.fm_start, len);
765+ error = ext4_get_es_cache(inode, &fieinfo, fiemap.fm_start,
766+ fiemap.fm_length);
796767 fiemap.fm_flags = fieinfo.fi_flags;
797768 fiemap.fm_mapped_extents = fieinfo.fi_extents_mapped;
798769 if (copy_to_user(ufiemap, &fiemap, sizeof(fiemap)))
fs/file.c+1−1
@@ -70,7 +70,7 @@ static void copy_fd_bitmaps(struct fdtable *nfdt, struct fdtable *ofdt, · 69 unmodified lines
7070 */
7171 static void copy_fdtable(struct fdtable *nfdt, struct fdtable *ofdt)
7272 {
73− unsigned int cpy, set;
73+ size_t cpy, set;
7474
7575 BUG_ON(nfdt->max_fds < ofdt->max_fds);
7676
fs/gfs2/bmap.c+9−7
@@ -528,10 +528,12 @@ lower_metapath: · 527 unmodified lines
528528
529529 /* Advance in metadata tree. */
530530 (mp->mp_list[hgt])++;
531− if (mp->mp_list[hgt] >= sdp->sd_inptrs) {
532− if (!hgt)
531+ if (hgt) {
532+ if (mp->mp_list[hgt] >= sdp->sd_inptrs)
533+ goto lower_metapath;
534+ } else {
535+ if (mp->mp_list[hgt] >= sdp->sd_diptrs)
533536 break;
534− goto lower_metapath;
535537 }
536538
537539 fill_up_metapath:
@@ -876,10 +878,9 @@ static int gfs2_iomap_get(struct inode *inode, loff_t pos, loff_t length, · 338 unmodified lines
876878 ret = -ENOENT;
877879 goto unlock;
878880 } else {
879− /* report a hole */
880881 iomap->offset = pos;
881882 iomap->length = length;
882− goto do_alloc;
883+ goto hole_found;
883884 }
884885 }
885886 iomap->length = size;
@@ -933,8 +934,6 @@ unlock: · 47 unmodified lines
933934 return ret;
934935
935936 do_alloc:
936− iomap->addr = IOMAP_NULL_ADDR;
937− iomap->type = IOMAP_HOLE;
938937 if (flags & IOMAP_REPORT) {
939938 if (pos >= size)
940939 ret = -ENOENT;
@@ -956,6 +955,9 @@ do_alloc: · 15 unmodified lines
956955 if (pos < size && height == ip->i_height)
957956 ret = gfs2_hole_size(inode, lblock, len, mp, iomap);
958957 }
958+hole_found:
959+ iomap->addr = IOMAP_NULL_ADDR;
960+ iomap->type = IOMAP_HOLE;
959961 goto out;
960962 }
961963
fs/gfs2/glock.c+2−4
@@ -613,7 +613,7 @@ __acquires(&gl->gl_lockref.lock) · 612 unmodified lines
613613 fs_err(sdp, "Error %d syncing glock \n", ret);
614614 gfs2_dump_glock(NULL, gl, true);
615615 }
616− return;
616+ goto skip_inval;
617617 }
618618 }
619619 if (test_bit(GLF_INVALIDATE_IN_PROGRESS, &gl->gl_flags)) {
@@ -633,6 +633,7 @@ __acquires(&gl->gl_lockref.lock) · 13 unmodified lines
633633 clear_bit(GLF_INVALIDATE_IN_PROGRESS, &gl->gl_flags);
634634 }
635635
636+skip_inval:
636637 gfs2_glock_hold(gl);
637638 /*
638639 * Check for an error encountered since we called go_sync and go_inval.
@@ -722,9 +723,6 @@ __acquires(&gl->gl_lockref.lock) · 83 unmodified lines
722723 goto out_unlock;
723724 if (nonblock)
724725 goto out_sched;
725− smp_mb();
726− if (atomic_read(&gl->gl_revokes) != 0)
727− goto out_sched;
728726 set_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags);
729727 GLOCK_BUG_ON(gl, gl->gl_demote_state == LM_ST_EXCLUSIVE);
730728 gl->gl_target = gl->gl_demote_state;
fs/gfs2/inode.c+4−3
@@ -622,7 +622,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, · 621 unmodified lines
622622 error = finish_no_open(file, NULL);
623623 }
624624 gfs2_glock_dq_uninit(ghs);
625− return error;
625+ goto fail;
626626 } else if (error != -ENOENT) {
627627 goto fail_gunlock;
628628 }
@@ -764,9 +764,11 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, · 135 unmodified lines
764764 error = finish_open(file, dentry, gfs2_open_common);
765765 }
766766 gfs2_glock_dq_uninit(ghs);
767+ gfs2_qa_put(ip);
767768 gfs2_glock_dq_uninit(ghs + 1);
768769 clear_bit(GLF_INODE_CREATING, &io_gl->gl_flags);
769770 gfs2_glock_put(io_gl);
771+ gfs2_qa_put(dip);
770772 return error;
771773
772774 fail_gunlock3:
@@ -776,7 +778,6 @@ fail_gunlock2: · 3 unmodified lines
776778 clear_bit(GLF_INODE_CREATING, &io_gl->gl_flags);
777779 gfs2_glock_put(io_gl);
778780 fail_free_inode:
779− gfs2_qa_put(ip);
780781 if (ip->i_gl) {
781782 glock_clear_object(ip->i_gl, ip);
782783 gfs2_glock_put(ip->i_gl);
@@ -1005,7 +1006,7 @@ out_gunlock: · 222 unmodified lines
10051006 out_child:
10061007 gfs2_glock_dq(ghs);
10071008 out_parent:
1008− gfs2_qa_put(ip);
1009+ gfs2_qa_put(dip);
10091010 gfs2_holder_uninit(ghs);
10101011 gfs2_holder_uninit(ghs + 1);
10111012 return error;
fs/gfs2/log.c+8−3
@@ -669,13 +669,13 @@ void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) · 668 unmodified lines
669669 struct buffer_head *bh = bd->bd_bh;
670670 struct gfs2_glock *gl = bd->bd_gl;
671671
672+ sdp->sd_log_num_revoke++;
673+ if (atomic_inc_return(&gl->gl_revokes) == 1)
674+ gfs2_glock_hold(gl);
672675 bh->b_private = NULL;
673676 bd->bd_blkno = bh->b_blocknr;
674677 gfs2_remove_from_ail(bd); /* drops ref on bh */
675678 bd->bd_bh = NULL;
676− sdp->sd_log_num_revoke++;
677− if (atomic_inc_return(&gl->gl_revokes) == 1)
678− gfs2_glock_hold(gl);
679679 set_bit(GLF_LFLUSH, &gl->gl_flags);
680680 list_add(&bd->bd_list, &sdp->sd_log_revokes);
681681 }
@@ -1131,6 +1131,10 @@ int gfs2_logd(void *data) · 449 unmodified lines
11311131
11321132 while (!kthread_should_stop()) {
11331133
1134+ if (gfs2_withdrawn(sdp)) {
1135+ msleep_interruptible(HZ);
1136+ continue;
1137+ }
11341138 /* Check for errors writing to the journal */
11351139 if (sdp->sd_log_error) {
11361140 gfs2_lm(sdp,
@@ -1139,6 +1143,7 @@ int gfs2_logd(void *data) · 2 unmodified lines
11391143 "prevent further damage.\n",
11401144 sdp->sd_fsname, sdp->sd_log_error);
11411145 gfs2_withdraw(sdp);
1146+ continue;
11421147 }
11431148
11441149 did_flush = false;
fs/gfs2/lops.c+12−7
@@ -263,7 +263,7 @@ static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno, · 262 unmodified lines
263263 struct super_block *sb = sdp->sd_vfs;
264264 struct bio *bio = bio_alloc(GFP_NOIO, BIO_MAX_PAGES);
265265
266− bio->bi_iter.bi_sector = blkno << (sb->s_blocksize_bits - 9);
266+ bio->bi_iter.bi_sector = blkno << sdp->sd_fsb2bb_shift;
267267 bio_set_dev(bio, sb->s_bdev);
268268 bio->bi_end_io = end_io;
269269 bio->bi_private = sdp;
@@ -509,7 +509,7 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head, · 239 unmodified lines
509509 unsigned int bsize = sdp->sd_sb.sb_bsize, off;
510510 unsigned int bsize_shift = sdp->sd_sb.sb_bsize_shift;
511511 unsigned int shift = PAGE_SHIFT - bsize_shift;
512− unsigned int readahead_blocks = BIO_MAX_PAGES << shift;
512+ unsigned int max_bio_size = 2 * 1024 * 1024;
513513 struct gfs2_journal_extent *je;
514514 int sz, ret = 0;
515515 struct bio *bio = NULL;
@@ -537,12 +537,17 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head, · 21 unmodified lines
537537 off = 0;
538538 }
539539
540− if (!bio || (bio_chained && !off)) {
540+ if (!bio || (bio_chained && !off) ||
541+ bio->bi_iter.bi_size >= max_bio_size) {
541542 /* start new bio */
542543 } else {
543− sz = bio_add_page(bio, page, bsize, off);
544− if (sz == bsize)
545− goto block_added;
544+ sector_t sector = dblock << sdp->sd_fsb2bb_shift;
545+
546+ if (bio_end_sector(bio) == sector) {
547+ sz = bio_add_page(bio, page, bsize, off);
548+ if (sz == bsize)
549+ goto block_added;
550+ }
546551 if (off) {
547552 unsigned int blocks =
548553 (PAGE_SIZE - off) >> bsize_shift;
@@ -568,7 +573,7 @@ block_added: · 19 unmodified lines
568573 off += bsize;
569574 if (off == PAGE_SIZE)
570575 page = NULL;
571− if (blocks_submitted < blocks_read + readahead_blocks) {
576+ if (blocks_submitted < 2 * max_bio_size >> bsize_shift) {
572577 /* Keep at least one bio in flight */
573578 continue;
574579 }
fs/gfs2/meta_io.c+1−1
@@ -252,7 +252,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, · 251 unmodified lines
252252 int num = 0;
253253
254254 if (unlikely(gfs2_withdrawn(sdp)) &&
255− (!sdp->sd_jdesc || (blkno != sdp->sd_jdesc->jd_no_addr))) {
255+ (!sdp->sd_jdesc || gl != sdp->sd_jinode_gl)) {
256256 *bhp = NULL;
257257 return -EIO;
258258 }
fs/gfs2/quota.c+5−8
@@ -1051,8 +1051,7 @@ int gfs2_quota_lock(struct gfs2_inode *ip, kuid_t uid, kgid_t gid) · 1050 unmodified lines
10511051 u32 x;
10521052 int error = 0;
10531053
1054− if (capable(CAP_SYS_RESOURCE) ||
1055− sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
1054+ if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
10561055 return 0;
10571056
10581057 error = gfs2_quota_hold(ip, uid, gid);
@@ -1125,7 +1124,7 @@ void gfs2_quota_unlock(struct gfs2_inode *ip) · 66 unmodified lines
11251124 int found;
11261125
11271126 if (!test_and_clear_bit(GIF_QD_LOCKED, &ip->i_flags))
1128− goto out;
1127+ return;
11291128
11301129 for (x = 0; x < ip->i_qadata->qa_qd_num; x++) {
11311130 struct gfs2_quota_data *qd;
@@ -1162,7 +1161,6 @@ void gfs2_quota_unlock(struct gfs2_inode *ip) · 30 unmodified lines
11621161 qd_unlock(qda[x]);
11631162 }
11641163
1165−out:
11661164 gfs2_quota_unhold(ip);
11671165 }
11681166
@@ -1210,9 +1208,6 @@ int gfs2_quota_check(struct gfs2_inode *ip, kuid_t uid, kgid_t gid, · 41 unmodified lines
12101208 if (!test_bit(GIF_QD_LOCKED, &ip->i_flags))
12111209 return 0;
12121210
1213− if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
1214− return 0;
1215−
12161211 for (x = 0; x < ip->i_qadata->qa_qd_num; x++) {
12171212 qd = ip->i_qadata->qa_qd[x];
12181213
@@ -1270,7 +1265,9 @@ void gfs2_quota_change(struct gfs2_inode *ip, s64 change, · 51 unmodified lines
12701265 if (ip->i_diskflags & GFS2_DIF_SYSTEM)
12711266 return;
12721267
1273− BUG_ON(ip->i_qadata->qa_ref <= 0);
1268+ if (gfs2_assert_withdraw(sdp, ip->i_qadata &&
1269+ ip->i_qadata->qa_ref > 0))
1270+ return;
12741271 for (x = 0; x < ip->i_qadata->qa_qd_num; x++) {
12751272 qd = ip->i_qadata->qa_qd[x];
12761273
fs/gfs2/quota.h+2−1
@@ -44,7 +44,8 @@ static inline int gfs2_quota_lock_check(struct gfs2_inode *ip, · 43 unmodified lines
4444 int ret;
4545
4646 ap->allowed = UINT_MAX; /* Assume we are permitted a whole lot */
47− if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
47+ if (capable(CAP_SYS_RESOURCE) ||
48+ sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
4849 return 0;
4950 ret = gfs2_quota_lock(ip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);
5051 if (ret)
fs/gfs2/super.c+0−1
@@ -1404,7 +1404,6 @@ out: · 1403 unmodified lines
14041404 if (ip->i_qadata)
14051405 gfs2_assert_warn(sdp, ip->i_qadata->qa_ref == 0);
14061406 gfs2_rs_delete(ip, NULL);
1407− gfs2_qa_put(ip);
14081407 gfs2_ordered_del_inode(ip);
14091408 clear_inode(inode);
14101409 gfs2_dir_hash_inval(ip);
fs/gfs2/util.c+6−4
@@ -119,6 +119,12 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp) · 118 unmodified lines
119119 if (!sb_rdonly(sdp->sd_vfs))
120120 ret = gfs2_make_fs_ro(sdp);
121121
122+ if (sdp->sd_lockstruct.ls_ops->lm_lock == NULL) { /* lock_nolock */
123+ if (!ret)
124+ ret = -EIO;
125+ clear_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags);
126+ goto skip_recovery;
127+ }
122128 /*
123129 * Drop the glock for our journal so another node can recover it.
124130 */
@@ -159,10 +165,6 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp) · 34 unmodified lines
159165 wait_on_bit(&gl->gl_flags, GLF_FREEING, TASK_UNINTERRUPTIBLE);
160166 }
161167
162− if (sdp->sd_lockstruct.ls_ops->lm_lock == NULL) { /* lock_nolock */
163− clear_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags);
164− goto skip_recovery;
165− }
166168 /*
167169 * Dequeue the "live" glock, but keep a reference so it's never freed.
168170 */
fs/io_uring.c+38−31
@@ -619,6 +619,8 @@ struct io_kiocb { · 618 unmodified lines
619619 bool needs_fixed_file;
620620 u8 opcode;
621621
622+ u16 buf_index;
623+
622624 struct io_ring_ctx *ctx;
623625 struct list_head list;
624626 unsigned int flags;
@@ -924,6 +926,7 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p) · 299 unmodified lines
924926 goto err;
925927
926928 ctx->flags = p->flags;
929+ init_waitqueue_head(&ctx->sqo_wait);
927930 init_waitqueue_head(&ctx->cq_wait);
928931 INIT_LIST_HEAD(&ctx->cq_overflow_list);
929932 init_completion(&ctx->completions[0]);
@@ -1394,10 +1397,6 @@ static void io_free_req_many(struct io_ring_ctx *ctx, struct req_batch *rb) · 464 unmodified lines
13941397 for (i = 0; i < rb->to_free; i++) {
13951398 struct io_kiocb *req = rb->reqs[i];
13961399
1397− if (req->flags & REQ_F_FIXED_FILE) {
1398− req->file = NULL;
1399− percpu_ref_put(req->fixed_file_refs);
1400− }
14011400 if (req->flags & REQ_F_INFLIGHT)
14021401 inflight++;
14031402 __io_req_aux_free(req);
@@ -1670,7 +1669,7 @@ static inline bool io_req_multi_free(struct req_batch *rb, struct io_kiocb *req) · 266 unmodified lines
16701669 if ((req->flags & REQ_F_LINK_HEAD) || io_is_fallback_req(req))
16711670 return false;
16721671
1673− if (!(req->flags & REQ_F_FIXED_FILE) || req->io)
1672+ if (req->file || req->io)
16741673 rb->need_iter++;
16751674
16761675 rb->reqs[rb->to_free++] = req;
@@ -2104,9 +2103,7 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe, · 427 unmodified lines
21042103
21052104 req->rw.addr = READ_ONCE(sqe->addr);
21062105 req->rw.len = READ_ONCE(sqe->len);
2107− /* we own ->private, reuse it for the buffer index / buffer ID */
2108− req->rw.kiocb.private = (void *) (unsigned long)
2109− READ_ONCE(sqe->buf_index);
2106+ req->buf_index = READ_ONCE(sqe->buf_index);
21102107 return 0;
21112108 }
21122109
@@ -2149,7 +2146,7 @@ static ssize_t io_import_fixed(struct io_kiocb *req, int rw, · 36 unmodified lines
21492146 struct io_ring_ctx *ctx = req->ctx;
21502147 size_t len = req->rw.len;
21512148 struct io_mapped_ubuf *imu;
2152− unsigned index, buf_index;
2149+ u16 index, buf_index;
21532150 size_t offset;
21542151 u64 buf_addr;
21552152
@@ -2157,7 +2154,7 @@ static ssize_t io_import_fixed(struct io_kiocb *req, int rw, · 1 unmodified line
21572154 if (unlikely(!ctx->user_bufs))
21582155 return -EFAULT;
21592156
2160− buf_index = (unsigned long) req->rw.kiocb.private;
2157+ buf_index = req->buf_index;
21612158 if (unlikely(buf_index >= ctx->nr_user_bufs))
21622159 return -EFAULT;
21632160
@@ -2273,10 +2270,10 @@ static void __user *io_rw_buffer_select(struct io_kiocb *req, size_t *len, · 109 unmodified lines
22732270 bool needs_lock)
22742271 {
22752272 struct io_buffer *kbuf;
2276− int bgid;
2273+ u16 bgid;
22772274
22782275 kbuf = (struct io_buffer *) (unsigned long) req->rw.addr;
2279− bgid = (int) (unsigned long) req->rw.kiocb.private;
2276+ bgid = req->buf_index;
22802277 kbuf = io_buffer_select(req, len, bgid, kbuf, needs_lock);
22812278 if (IS_ERR(kbuf))
22822279 return kbuf;
@@ -2367,7 +2364,7 @@ static ssize_t io_import_iovec(int rw, struct io_kiocb *req, · 84 unmodified lines
23672364 }
23682365
23692366 /* buffer index only valid with fixed read/write, or buffer select */
2370− if (req->rw.kiocb.private && !(req->flags & REQ_F_BUFFER_SELECT))
2367+ if (req->buf_index && !(req->flags & REQ_F_BUFFER_SELECT))
23712368 return -EINVAL;
23722369
23732370 if (opcode == IORING_OP_READ || opcode == IORING_OP_WRITE) {
@@ -2767,16 +2764,16 @@ static int io_splice(struct io_kiocb *req, bool force_nonblock) · 393 unmodified lines
27672764 struct file *out = sp->file_out;
27682765 unsigned int flags = sp->flags & ~SPLICE_F_FD_IN_FIXED;
27692766 loff_t *poff_in, *poff_out;
2770− long ret;
2767+ long ret = 0;
27712768
27722769 if (force_nonblock)
27732770 return -EAGAIN;
27742771
27752772 poff_in = (sp->off_in == -1) ? NULL : &sp->off_in;
27762773 poff_out = (sp->off_out == -1) ? NULL : &sp->off_out;
2777− ret = do_splice(in, poff_in, out, poff_out, sp->len, flags);
2778− if (force_nonblock && ret == -EAGAIN)
2779− return -EAGAIN;
2774+
2775+ if (sp->len)
2776+ ret = do_splice(in, poff_in, out, poff_out, sp->len, flags);
27802777
27812778 io_put_file(req, in, (sp->flags & SPLICE_F_FD_IN_FIXED));
27822779 req->flags &= ~REQ_F_NEED_CLEANUP;
@@ -4138,12 +4135,14 @@ static int __io_async_wake(struct io_kiocb *req, struct io_poll_iocb *poll, · 1355 unmodified lines
41384135 req->result = mask;
41394136 init_task_work(&req->task_work, func);
41404137 /*
4141− * If this fails, then the task is exiting. Punt to one of the io-wq
4142− * threads to ensure the work gets run, we can't always rely on exit
4143− * cancelation taking care of this.
4138+ * If this fails, then the task is exiting. When a task exits, the
4139+ * work gets canceled, so just cancel this request as well instead
4140+ * of executing it. We can't safely execute it anyway, as we may not
4141+ * have the needed state needed for it anyway.
41444142 */
41454143 ret = task_work_add(tsk, &req->task_work, true);
41464144 if (unlikely(ret)) {
4145+ WRITE_ONCE(poll->canceled, true);
41474146 tsk = io_wq_get_task(req->ctx->io_wq);
41484147 task_work_add(tsk, &req->task_work, true);
41494148 }
@@ -5014,12 +5013,13 @@ static int io_req_defer(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 864 unmodified lines
50145013 if (!req_need_defer(req) && list_empty_careful(&ctx->defer_list))
50155014 return 0;
50165015
5017− if (!req->io && io_alloc_async_ctx(req))
5018− return -EAGAIN;
5019−
5020− ret = io_req_defer_prep(req, sqe);
5021− if (ret < 0)
5022− return ret;
5016+ if (!req->io) {
5017+ if (io_alloc_async_ctx(req))
5018+ return -EAGAIN;
5019+ ret = io_req_defer_prep(req, sqe);
5020+ if (ret < 0)
5021+ return ret;
5022+ }
50235023
50245024 spin_lock_irq(&ctx->completion_lock);
50255025 if (!req_need_defer(req) && list_empty(&ctx->defer_list)) {
@@ -5306,7 +5306,8 @@ static int io_issue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe, · 280 unmodified lines
53065306 if (ret)
53075307 return ret;
53085308
5309− if (ctx->flags & IORING_SETUP_IOPOLL) {
5309+ /* If the op doesn't have a file, we're not polling for it */
5310+ if ((ctx->flags & IORING_SETUP_IOPOLL) && req->file) {
53105311 const bool in_async = io_wq_current_is_worker();
53115312
53125313 if (req->result == -EAGAIN)
@@ -5607,9 +5608,15 @@ fail_req: · 294 unmodified lines
56075608 io_double_put_req(req);
56085609 }
56095610 } else if (req->flags & REQ_F_FORCE_ASYNC) {
5610− ret = io_req_defer_prep(req, sqe);
5611− if (unlikely(ret < 0))
5612− goto fail_req;
5611+ if (!req->io) {
5612+ ret = -EAGAIN;
5613+ if (io_alloc_async_ctx(req))
5614+ goto fail_req;
5615+ ret = io_req_defer_prep(req, sqe);
5616+ if (unlikely(ret < 0))
5617+ goto fail_req;
5618+ }
5619+
56135620 /*
56145621 * Never try inline submit of IOSQE_ASYNC is set, go straight
56155622 * to async execution.
@@ -6025,6 +6032,7 @@ static int io_sq_thread(void *data) · 409 unmodified lines
60256032 finish_wait(&ctx->sqo_wait, &wait);
60266033
60276034 ctx->rings->sq_flags &= ~IORING_SQ_NEED_WAKEUP;
6035+ ret = 0;
60286036 continue;
60296037 }
60306038 finish_wait(&ctx->sqo_wait, &wait);
@@ -6838,7 +6846,6 @@ static int io_sq_offload_start(struct io_ring_ctx *ctx, · 807 unmodified lines
68386846 {
68396847 int ret;
68406848
6841− init_waitqueue_head(&ctx->sqo_wait);
68426849 mmgrab(current->mm);
68436850 ctx->sqo_mm = current->mm;
68446851
fs/nfs/fscache.c+18−21
@@ -118,8 +118,6 @@ void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq, int · 117 unmodified lines
118118
119119 nfss->fscache_key = NULL;
120120 nfss->fscache = NULL;
121− if (!(nfss->options & NFS_OPTION_FSCACHE))
122− return;
123121 if (!uniq) {
124122 uniq = "";
125123 ulen = 1;
@@ -188,7 +186,8 @@ void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq, int · 62 unmodified lines
188186 /* create a cache index for looking up filehandles */
189187 nfss->fscache = fscache_acquire_cookie(nfss->nfs_client->fscache,
190188 &nfs_fscache_super_index_def,
191− key, sizeof(*key) + ulen,
189+ &key->key,
190+ sizeof(key->key) + ulen,
192191 NULL, 0,
193192 nfss, 0, true);
194193 dfprintk(FSCACHE, "NFS: get superblock cookie (0x%p/0x%p)\n",
@@ -226,6 +225,19 @@ void nfs_fscache_release_super_cookie(struct super_block *sb) · 31 unmodified lines
226225 }
227226 }
228227
228+static void nfs_fscache_update_auxdata(struct nfs_fscache_inode_auxdata *auxdata,
229+ struct nfs_inode *nfsi)
230+{
231+ memset(auxdata, 0, sizeof(*auxdata));
232+ auxdata->mtime_sec = nfsi->vfs_inode.i_mtime.tv_sec;
233+ auxdata->mtime_nsec = nfsi->vfs_inode.i_mtime.tv_nsec;
234+ auxdata->ctime_sec = nfsi->vfs_inode.i_ctime.tv_sec;
235+ auxdata->ctime_nsec = nfsi->vfs_inode.i_ctime.tv_nsec;
236+
237+ if (NFS_SERVER(&nfsi->vfs_inode)->nfs_client->rpc_ops->version == 4)
238+ auxdata->change_attr = inode_peek_iversion_raw(&nfsi->vfs_inode);
239+}
240+
229241 /*
230242 * Initialise the per-inode cache cookie pointer for an NFS inode.
231243 */
@@ -239,14 +251,7 @@ void nfs_fscache_init_inode(struct inode *inode) · 7 unmodified lines
239251 if (!(nfss->fscache && S_ISREG(inode->i_mode)))
240252 return;
241253
242− memset(&auxdata, 0, sizeof(auxdata));
243− auxdata.mtime_sec = nfsi->vfs_inode.i_mtime.tv_sec;
244− auxdata.mtime_nsec = nfsi->vfs_inode.i_mtime.tv_nsec;
245− auxdata.ctime_sec = nfsi->vfs_inode.i_ctime.tv_sec;
246− auxdata.ctime_nsec = nfsi->vfs_inode.i_ctime.tv_nsec;
247−
248− if (NFS_SERVER(&nfsi->vfs_inode)->nfs_client->rpc_ops->version == 4)
249− auxdata.change_attr = inode_peek_iversion_raw(&nfsi->vfs_inode);
254+ nfs_fscache_update_auxdata(&auxdata, nfsi);
250255
251256 nfsi->fscache = fscache_acquire_cookie(NFS_SB(inode->i_sb)->fscache,
252257 &nfs_fscache_inode_object_def,
@@ -266,11 +271,7 @@ void nfs_fscache_clear_inode(struct inode *inode) · 13 unmodified lines
266271
267272 dfprintk(FSCACHE, "NFS: clear cookie (0x%p/0x%p)\n", nfsi, cookie);
268273
269− memset(&auxdata, 0, sizeof(auxdata));
270− auxdata.mtime_sec = nfsi->vfs_inode.i_mtime.tv_sec;
271− auxdata.mtime_nsec = nfsi->vfs_inode.i_mtime.tv_nsec;
272− auxdata.ctime_sec = nfsi->vfs_inode.i_ctime.tv_sec;
273− auxdata.ctime_nsec = nfsi->vfs_inode.i_ctime.tv_nsec;
274+ nfs_fscache_update_auxdata(&auxdata, nfsi);
274275 fscache_relinquish_cookie(cookie, &auxdata, false);
275276 nfsi->fscache = NULL;
276277 }
@@ -310,11 +311,7 @@ void nfs_fscache_open_file(struct inode *inode, struct file *filp) · 33 unmodified lines
310311 if (!fscache_cookie_valid(cookie))
311312 return;
312313
313− memset(&auxdata, 0, sizeof(auxdata));
314− auxdata.mtime_sec = nfsi->vfs_inode.i_mtime.tv_sec;
315− auxdata.mtime_nsec = nfsi->vfs_inode.i_mtime.tv_nsec;
316− auxdata.ctime_sec = nfsi->vfs_inode.i_ctime.tv_sec;
317− auxdata.ctime_nsec = nfsi->vfs_inode.i_ctime.tv_nsec;
314+ nfs_fscache_update_auxdata(&auxdata, nfsi);
318315
319316 if (inode_is_open_for_write(inode)) {
320317 dfprintk(FSCACHE, "NFS: nfsi 0x%p disabling cache\n", nfsi);
fs/nfs/mount_clnt.c+2−1
@@ -30,6 +30,7 @@ · 29 unmodified lines
3030 #define encode_dirpath_sz (1 + XDR_QUADLEN(MNTPATHLEN))
3131 #define MNT_status_sz (1)
3232 #define MNT_fhandle_sz XDR_QUADLEN(NFS2_FHSIZE)
33+#define MNT_fhandlev3_sz XDR_QUADLEN(NFS3_FHSIZE)
3334 #define MNT_authflav3_sz (1 + NFS_MAX_SECFLAVORS)
3435
3536 /*
@@ -37,7 +38,7 @@ · 1 unmodified line
3738 */
3839 #define MNT_enc_dirpath_sz encode_dirpath_sz
3940 #define MNT_dec_mountres_sz (MNT_status_sz + MNT_fhandle_sz)
40−#define MNT_dec_mountres3_sz (MNT_status_sz + MNT_fhandle_sz + \
41+#define MNT_dec_mountres3_sz (MNT_status_sz + MNT_fhandlev3_sz + \
4142 MNT_authflav3_sz)
4243
4344 /*
fs/nfs/nfs4proc.c+1−1
@@ -6347,7 +6347,7 @@ static int _nfs4_proc_delegreturn(struct inode *inode, const struct cred *cred, · 6346 unmodified lines
63476347 .rpc_client = server->client,
63486348 .rpc_message = &msg,
63496349 .callback_ops = &nfs4_delegreturn_ops,
6350− .flags = RPC_TASK_ASYNC | RPC_TASK_CRED_NOREF | RPC_TASK_TIMEOUT,
6350+ .flags = RPC_TASK_ASYNC | RPC_TASK_TIMEOUT,
63516351 };
63526352 int status = 0;
63536353
fs/nfs/nfs4state.c+1−1
@@ -734,9 +734,9 @@ nfs4_get_open_state(struct inode *inode, struct nfs4_state_owner *owner) · 733 unmodified lines
734734 state = new;
735735 state->owner = owner;
736736 atomic_inc(&owner->so_count);
737− list_add_rcu(&state->inode_states, &nfsi->open_states);
738737 ihold(inode);
739738 state->inode = inode;
739+ list_add_rcu(&state->inode_states, &nfsi->open_states);
740740 spin_unlock(&inode->i_lock);
741741 /* Note: The reclaim code dictates that we add stateless
742742 * and read-only stateids to the end of the list */
fs/nfs/pagelist.c+3−2
@@ -752,7 +752,7 @@ int nfs_initiate_pgio(struct rpc_clnt *clnt, struct nfs_pgio_header *hdr, · 751 unmodified lines
752752 .callback_ops = call_ops,
753753 .callback_data = hdr,
754754 .workqueue = nfsiod_workqueue,
755− .flags = RPC_TASK_ASYNC | RPC_TASK_CRED_NOREF | flags,
755+ .flags = RPC_TASK_ASYNC | flags,
756756 };
757757
758758 hdr->rw_ops->rw_initiate(hdr, &msg, rpc_ops, &task_setup_data, how);
@@ -950,7 +950,8 @@ static int nfs_generic_pg_pgios(struct nfs_pageio_descriptor *desc) · 191 unmodified lines
950950 hdr->cred,
951951 NFS_PROTO(hdr->inode),
952952 desc->pg_rpc_callops,
953− desc->pg_ioflags, 0);
953+ desc->pg_ioflags,
954+ RPC_TASK_CRED_NOREF);
954955 return ret;
955956 }
956957
fs/nfs/pnfs_nfs.c+2−1
@@ -536,7 +536,8 @@ pnfs_generic_commit_pagelist(struct inode *inode, struct list_head *mds_pages, · 535 unmodified lines
536536 nfs_init_commit(data, NULL, NULL, cinfo);
537537 nfs_initiate_commit(NFS_CLIENT(inode), data,
538538 NFS_PROTO(data->inode),
539− data->mds_ops, how, 0);
539+ data->mds_ops, how,
540+ RPC_TASK_CRED_NOREF);
540541 } else {
541542 nfs_init_commit(data, NULL, data->lseg, cinfo);
542543 initiate_commit(data, how);
fs/nfs/super.c+0−1
@@ -1189,7 +1189,6 @@ static void nfs_get_cache_cookie(struct super_block *sb, · 1188 unmodified lines
11891189 uniq = ctx->fscache_uniq;
11901190 ulen = strlen(ctx->fscache_uniq);
11911191 }
1192− return;
11931192 }
11941193
11951194 nfs_fscache_get_super_cookie(sb, uniq, ulen);
fs/nfs/write.c+2−2
@@ -1695,7 +1695,7 @@ int nfs_initiate_commit(struct rpc_clnt *clnt, struct nfs_commit_data *data, · 1694 unmodified lines
16951695 .callback_ops = call_ops,
16961696 .callback_data = data,
16971697 .workqueue = nfsiod_workqueue,
1698− .flags = RPC_TASK_ASYNC | RPC_TASK_CRED_NOREF | flags,
1698+ .flags = RPC_TASK_ASYNC | flags,
16991699 .priority = priority,
17001700 };
17011701 /* Set up the initial task struct. */
@@ -1813,7 +1813,7 @@ nfs_commit_list(struct inode *inode, struct list_head *head, int how, · 111 unmodified lines
18131813 nfs_init_commit(data, head, NULL, cinfo);
18141814 atomic_inc(&cinfo->mds->rpcs_out);
18151815 return nfs_initiate_commit(NFS_CLIENT(inode), data, NFS_PROTO(inode),
1816− data->mds_ops, how, 0);
1816+ data->mds_ops, how, RPC_TASK_CRED_NOREF);
18171817 }
18181818
18191819 /*
fs/overlayfs/export.c+3−0
@@ -783,6 +783,9 @@ static struct ovl_fh *ovl_fid_to_fh(struct fid *fid, int buflen, int fh_type) · 782 unmodified lines
783783 if (fh_type != OVL_FILEID_V0)
784784 return ERR_PTR(-EINVAL);
785785
786+ if (buflen <= OVL_FH_WIRE_OFFSET)
787+ return ERR_PTR(-EINVAL);
788+
786789 fh = kzalloc(buflen, GFP_KERNEL);
787790 if (!fh)
788791 return ERR_PTR(-ENOMEM);
fs/overlayfs/inode.c+18−0
@@ -58,6 +58,24 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr) · 57 unmodified lines
5858 if (attr->ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID))
5959 attr->ia_valid &= ~ATTR_MODE;
6060
61+ /*
62+ * We might have to translate ovl file into real file object
63+ * once use cases emerge. For now, simply don't let underlying
64+ * filesystem rely on attr->ia_file
65+ */
66+ attr->ia_valid &= ~ATTR_FILE;
67+
68+ /*
69+ * If open(O_TRUNC) is done, VFS calls ->setattr with ATTR_OPEN
70+ * set. Overlayfs does not pass O_TRUNC flag to underlying
71+ * filesystem during open -> do not pass ATTR_OPEN. This
72+ * disables optimization in fuse which assumes open(O_TRUNC)
73+ * already set file size to 0. But we never passed O_TRUNC to
74+ * fuse. So by clearing ATTR_OPEN, fuse will be forced to send
75+ * setattr request to server.
76+ */
77+ attr->ia_valid &= ~ATTR_OPEN;
78+
6179 inode_lock(upperdentry->d_inode);
6280 old_cred = ovl_override_creds(dentry->d_sb);
6381 err = notify_change(upperdentry, attr, NULL);
fs/splice.c+1−1
@@ -1494,7 +1494,7 @@ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags) · 1493 unmodified lines
14941494 * Check pipe occupancy without the inode lock first. This function
14951495 * is speculative anyways, so missing one is ok.
14961496 */
1497− if (pipe_full(pipe->head, pipe->tail, pipe->max_usage))
1497+ if (!pipe_full(pipe->head, pipe->tail, pipe->max_usage))
14981498 return 0;
14991499
15001500 ret = 0;
fs/ubifs/auth.c+4−13
@@ -79,13 +79,9 @@ int ubifs_prepare_auth_node(struct ubifs_info *c, void *node, · 78 unmodified lines
7979 struct shash_desc *inhash)
8080 {
8181 struct ubifs_auth_node *auth = node;
82− u8 *hash;
82+ u8 hash[UBIFS_HASH_ARR_SZ];
8383 int err;
8484
85− hash = kmalloc(crypto_shash_descsize(c->hash_tfm), GFP_NOFS);
86− if (!hash)
87− return -ENOMEM;
88−
8985 {
9086 SHASH_DESC_ON_STACK(hash_desc, c->hash_tfm);
9187
@@ -94,21 +90,16 @@ int ubifs_prepare_auth_node(struct ubifs_info *c, void *node, · 2 unmodified lines
9490
9591 err = crypto_shash_final(hash_desc, hash);
9692 if (err)
97− goto out;
93+ return err;
9894 }
9995
10096 err = ubifs_hash_calc_hmac(c, hash, auth->hmac);
10197 if (err)
102− goto out;
98+ return err;
10399
104100 auth->ch.node_type = UBIFS_AUTH_NODE;
105101 ubifs_prepare_node(c, auth, ubifs_auth_node_sz(c), 0);
106−
107− err = 0;
108−out:
109− kfree(hash);
110−
111− return err;
102+ return 0;
112103 }
113104
114105 static struct shash_desc *ubifs_get_desc(const struct ubifs_info *c,
fs/ubifs/file.c+1−5
@@ -1375,7 +1375,6 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time, · 1374 unmodified lines
13751375 struct ubifs_info *c = inode->i_sb->s_fs_info;
13761376 struct ubifs_budget_req req = { .dirtied_ino = 1,
13771377 .dirtied_ino_d = ALIGN(ui->data_len, 8) };
1378− int iflags = I_DIRTY_TIME;
13791378 int err, release;
13801379
13811380 if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
@@ -1393,11 +1392,8 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time, · 11 unmodified lines
13931392 if (flags & S_MTIME)
13941393 inode->i_mtime = *time;
13951394
1396− if (!(inode->i_sb->s_flags & SB_LAZYTIME))
1397− iflags |= I_DIRTY_SYNC;
1398−
13991395 release = ui->dirty;
1400− __mark_inode_dirty(inode, iflags);
1396+ __mark_inode_dirty(inode, I_DIRTY_SYNC);
14011397 mutex_unlock(&ui->ui_mutex);
14021398 if (release)
14031399 ubifs_release_budget(c, &req);
fs/ubifs/replay.c+2−11
@@ -601,18 +601,12 @@ static int authenticate_sleb(struct ubifs_info *c, struct ubifs_scan_leb *sleb, · 600 unmodified lines
601601 struct ubifs_scan_node *snod;
602602 int n_nodes = 0;
603603 int err;
604− u8 *hash, *hmac;
604+ u8 hash[UBIFS_HASH_ARR_SZ];
605+ u8 hmac[UBIFS_HMAC_ARR_SZ];
605606
606607 if (!ubifs_authenticated(c))
607608 return sleb->nodes_cnt;
608609
609− hash = kmalloc(crypto_shash_descsize(c->hash_tfm), GFP_NOFS);
610− hmac = kmalloc(c->hmac_desc_len, GFP_NOFS);
611− if (!hash || !hmac) {
612− err = -ENOMEM;
613− goto out;
614− }
615−
616610 list_for_each_entry(snod, &sleb->nodes, list) {
617611
618612 n_nodes++;
@@ -662,9 +656,6 @@ static int authenticate_sleb(struct ubifs_info *c, struct ubifs_scan_leb *sleb, · 43 unmodified lines
662656 err = 0;
663657 }
664658 out:
665− kfree(hash);
666− kfree(hmac);
667−
668659 return err ? err : n_nodes - n_not_auth;
669660 }
670661
include/drm/drm_modes.h+1−1
@@ -48,7 +48,7 @@ struct videomode; · 47 unmodified lines
4848 * @MODE_HSYNC: hsync out of range
4949 * @MODE_VSYNC: vsync out of range
5050 * @MODE_H_ILLEGAL: mode has illegal horizontal timings
51− * @MODE_V_ILLEGAL: mode has illegal horizontal timings
51+ * @MODE_V_ILLEGAL: mode has illegal vertical timings
5252 * @MODE_BAD_WIDTH: requires an unsupported linepitch
5353 * @MODE_NOMODE: no mode with a matching name
5454 * @MODE_NO_INTERLACE: interlaced mode not supported
include/linux/brcmphy.h+1−0
@@ -245,6 +245,7 @@ · 244 unmodified lines
245245 #define BCM54810_EXP_BROADREACH_LRE_MISC_CTL_EN (1 << 0)
246246 #define BCM54810_SHD_CLK_CTL 0x3
247247 #define BCM54810_SHD_CLK_CTL_GTXCLK_EN (1 << 9)
248+#define BCM54810_SHD_SCR3_TRDDAPD 0x0100
248249
249250 /* BCM54612E Registers */
250251 #define BCM54612E_EXP_SPARE0 (MII_BCM54XX_EXP_SEL_ETC + 0x34)
include/linux/compiler.h+6−0
@@ -356,4 +356,10 @@ static inline void *offset_to_ptr(const int *off) · 355 unmodified lines
356356 /* &a[0] degrades to a pointer: a different type from an array */
357357 #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
358358
359+/*
360+ * This is needed in functions which generate the stack canary, see
361+ * arch/x86/kernel/smpboot.c::start_secondary() for an example.
362+ */
363+#define prevent_tail_call_optimization() mb()
364+
359365 #endif /* __LINUX_COMPILER_H */
include/linux/cper.h+9−0
@@ -521,6 +521,15 @@ struct cper_sec_pcie { · 520 unmodified lines
521521 u8 aer_info[96];
522522 };
523523
524+/* Firmware Error Record Reference, UEFI v2.7 sec N.2.10 */
525+struct cper_sec_fw_err_rec_ref {
526+ u8 record_type;
527+ u8 revision;
528+ u8 reserved[6];
529+ u64 record_identifier;
530+ guid_t record_identifier_guid;
531+};
532+
524533 /* Reset to default packing */
525534 #pragma pack()
526535
include/linux/efi.h+2−0
@@ -1245,4 +1245,6 @@ struct linux_efi_memreserve { · 1244 unmodified lines
12451245
12461246 void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size);
12471247
1248+char *efi_systab_show_arch(char *str);
1249+
12481250 #endif /* _LINUX_EFI_H */
include/linux/ftrace.h+23−0
@@ -210,6 +210,29 @@ struct ftrace_ops { · 209 unmodified lines
210210 #endif
211211 };
212212
213+extern struct ftrace_ops __rcu *ftrace_ops_list;
214+extern struct ftrace_ops ftrace_list_end;
215+
216+/*
217+ * Traverse the ftrace_global_list, invoking all entries. The reason that we
218+ * can use rcu_dereference_raw_check() is that elements removed from this list
219+ * are simply leaked, so there is no need to interact with a grace-period
220+ * mechanism. The rcu_dereference_raw_check() calls are needed to handle
221+ * concurrent insertions into the ftrace_global_list.
222+ *
223+ * Silly Alpha and silly pointer-speculation compiler optimizations!
224+ */
225+#define do_for_each_ftrace_op(op, list) \
226+ op = rcu_dereference_raw_check(list); \
227+ do
228+
229+/*
230+ * Optimized for just a single item in the list (as that is the normal case).
231+ */
232+#define while_for_each_ftrace_op(op) \
233+ while (likely(op = rcu_dereference_raw_check((op)->next)) && \
234+ unlikely((op) != &ftrace_list_end))
235+
213236 /*
214237 * Type of the current tracing.
215238 */
include/linux/host1x.h+3−0
@@ -17,9 +17,12 @@ enum host1x_class { · 16 unmodified lines
1717 HOST1X_CLASS_GR3D = 0x60,
1818 };
1919
20+struct host1x;
2021 struct host1x_client;
2122 struct iommu_group;
2223
24+u64 host1x_get_dma_mask(struct host1x *host1x);
25+
2326 /**
2427 * struct host1x_client_ops - host1x client operations
2528 * @init: host1x client initialization code
include/linux/i2c-mux.h+1−1
@@ -29,7 +29,7 @@ struct i2c_mux_core { · 28 unmodified lines
2929
3030 int num_adapters;
3131 int max_adapters;
32− struct i2c_adapter *adapter[0];
32+ struct i2c_adapter *adapter[];
3333 };
3434
3535 struct i2c_mux_core *i2c_mux_alloc(struct i2c_adapter *parent,
include/linux/i2c.h+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 /*
33 * i2c.h - definitions for the Linux i2c bus interface
44 * Copyright (C) 1995-2000 Simon G. Vogl
5− * Copyright (C) 2013-2019 Wolfram Sang <wsa@the-dreams.de>
5+ * Copyright (C) 2013-2019 Wolfram Sang <wsa@kernel.org>
66 *
77 * With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
88 * Frodo Looijaard <frodol@dds.nl>
include/linux/kvm_host.h+3−0
@@ -813,8 +813,11 @@ void kvm_flush_remote_tlbs(struct kvm *kvm); · 812 unmodified lines
813813 void kvm_reload_remote_mmus(struct kvm *kvm);
814814
815815 bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req,
816+ struct kvm_vcpu *except,
816817 unsigned long *vcpu_bitmap, cpumask_var_t tmp);
817818 bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req);
819+bool kvm_make_all_cpus_request_except(struct kvm *kvm, unsigned int req,
820+ struct kvm_vcpu *except);
818821 bool kvm_make_cpus_request_mask(struct kvm *kvm, unsigned int req,
819822 unsigned long *vcpu_bitmap);
820823
include/linux/lsm_hook_defs.h+1−1
@@ -243,7 +243,7 @@ LSM_HOOK(int, -EINVAL, getprocattr, struct task_struct *p, char *name, · 242 unmodified lines
243243 char **value)
244244 LSM_HOOK(int, -EINVAL, setprocattr, const char *name, void *value, size_t size)
245245 LSM_HOOK(int, 0, ismaclabel, const char *name)
246−LSM_HOOK(int, 0, secid_to_secctx, u32 secid, char **secdata,
246+LSM_HOOK(int, -EOPNOTSUPP, secid_to_secctx, u32 secid, char **secdata,
247247 u32 *seclen)
248248 LSM_HOOK(int, 0, secctx_to_secid, const char *secdata, u32 seclen, u32 *secid)
249249 LSM_HOOK(void, LSM_RET_VOID, release_secctx, char *secdata, u32 seclen)
include/linux/memcontrol.h+2−0
@@ -783,6 +783,8 @@ static inline void memcg_memory_event(struct mem_cgroup *memcg, · 782 unmodified lines
783783 atomic_long_inc(&memcg->memory_events[event]);
784784 cgroup_file_notify(&memcg->events_file);
785785
786+ if (!cgroup_subsys_on_dfl(memory_cgrp_subsys))
787+ break;
786788 if (cgrp_dfl_root.flags & CGRP_ROOT_MEMORY_LOCAL_EVENTS)
787789 break;
788790 } while ((memcg = parent_mem_cgroup(memcg)) &&
include/linux/mlx5/driver.h+16−0
@@ -213,6 +213,12 @@ enum mlx5_port_status { · 212 unmodified lines
213213 MLX5_PORT_DOWN = 2,
214214 };
215215
216+enum mlx5_cmdif_state {
217+ MLX5_CMDIF_STATE_UNINITIALIZED,
218+ MLX5_CMDIF_STATE_UP,
219+ MLX5_CMDIF_STATE_DOWN,
220+};
221+
216222 struct mlx5_cmd_first {
217223 __be32 data[4];
218224 };
@@ -258,6 +264,7 @@ struct mlx5_cmd_stats { · 39 unmodified lines
258264 struct mlx5_cmd {
259265 struct mlx5_nb nb;
260266
267+ enum mlx5_cmdif_state state;
261268 void *cmd_alloc_buf;
262269 dma_addr_t alloc_dma;
263270 int alloc_size;
@@ -284,6 +291,7 @@ struct mlx5_cmd { · 20 unmodified lines
284291 struct semaphore sem;
285292 struct semaphore pages_sem;
286293 int mode;
294+ u16 allowed_opcode;
287295 struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS];
288296 struct dma_pool *pool;
289297 struct mlx5_cmd_debug dbg;
@@ -743,6 +751,7 @@ struct mlx5_cmd_work_ent { · 453 unmodified lines
743751 struct delayed_work cb_timeout_work;
744752 void *context;
745753 int idx;
754+ struct completion handling;
746755 struct completion done;
747756 struct mlx5_cmd *cmd;
748757 struct work_struct work;
@@ -874,10 +883,17 @@ mlx5_frag_buf_get_idx_last_contig_stride(struct mlx5_frag_buf_ctrl *fbc, u32 ix) · 125 unmodified lines
874883 return min_t(u32, last_frag_stride_idx - fbc->strides_offset, fbc->sz_m1);
875884 }
876885
886+enum {
887+ CMD_ALLOWED_OPCODE_ALL,
888+};
889+
877890 int mlx5_cmd_init(struct mlx5_core_dev *dev);
878891 void mlx5_cmd_cleanup(struct mlx5_core_dev *dev);
892+void mlx5_cmd_set_state(struct mlx5_core_dev *dev,
893+ enum mlx5_cmdif_state cmdif_state);
879894 void mlx5_cmd_use_events(struct mlx5_core_dev *dev);
880895 void mlx5_cmd_use_polling(struct mlx5_core_dev *dev);
896+void mlx5_cmd_allowed_opcode(struct mlx5_core_dev *dev, u16 opcode);
881897
882898 struct mlx5_async_ctx {
883899 struct mlx5_core_dev *dev;
include/linux/ptp_clock_kernel.h+4−4
@@ -105,10 +105,10 @@ struct ptp_system_timestamp { · 104 unmodified lines
105105 * parameter func: the desired function to use.
106106 * parameter chan: the function channel index to use.
107107 *
108− * @do_work: Request driver to perform auxiliary (periodic) operations
109− * Driver should return delay of the next auxiliary work scheduling
110− * time (>=0) or negative value in case further scheduling
111− * is not required.
108+ * @do_aux_work: Request driver to perform auxiliary (periodic) operations
109+ * Driver should return delay of the next auxiliary work
110+ * scheduling time (>=0) or negative value in case further
111+ * scheduling is not required.
112112 *
113113 * Drivers should embed their ptp_clock_info within a private
114114 * structure, obtaining a reference to it using container_of().
include/linux/skmsg.h+1−0
@@ -187,6 +187,7 @@ static inline void sk_msg_xfer(struct sk_msg *dst, struct sk_msg *src, · 186 unmodified lines
187187 dst->sg.data[which] = src->sg.data[which];
188188 dst->sg.data[which].length = size;
189189 dst->sg.size += size;
190+ src->sg.size -= size;
190191 src->sg.data[which].length -= size;
191192 src->sg.data[which].offset += size;
192193 }
include/linux/sunrpc/gss_api.h+3−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 struct gss_ctx {
2222 struct gss_api_mech *mech_type;
2323 void *internal_ctx_id;
24+ unsigned int slack, align;
2425 };
2526
2627 #define GSS_C_NO_BUFFER ((struct xdr_netobj) 0)
@@ -66,6 +67,7 @@ u32 gss_wrap( · 39 unmodified lines
6667 u32 gss_unwrap(
6768 struct gss_ctx *ctx_id,
6869 int offset,
70+ int len,
6971 struct xdr_buf *inbuf);
7072 u32 gss_delete_sec_context(
7173 struct gss_ctx **ctx_id);
@@ -126,6 +128,7 @@ struct gss_api_ops { · 54 unmodified lines
126128 u32 (*gss_unwrap)(
127129 struct gss_ctx *ctx_id,
128130 int offset,
131+ int len,
129132 struct xdr_buf *buf);
130133 void (*gss_delete_sec_context)(
131134 void *internal_ctx_id);
include/linux/sunrpc/gss_krb5.h+3−3
@@ -83,7 +83,7 @@ struct gss_krb5_enctype { · 82 unmodified lines
8383 u32 (*encrypt_v2) (struct krb5_ctx *kctx, u32 offset,
8484 struct xdr_buf *buf,
8585 struct page **pages); /* v2 encryption function */
86− u32 (*decrypt_v2) (struct krb5_ctx *kctx, u32 offset,
86+ u32 (*decrypt_v2) (struct krb5_ctx *kctx, u32 offset, u32 len,
8787 struct xdr_buf *buf, u32 *headskip,
8888 u32 *tailskip); /* v2 decryption function */
8989 };
@@ -255,7 +255,7 @@ gss_wrap_kerberos(struct gss_ctx *ctx_id, int offset, · 165 unmodified lines
255255 struct xdr_buf *outbuf, struct page **pages);
256256
257257 u32
258−gss_unwrap_kerberos(struct gss_ctx *ctx_id, int offset,
258+gss_unwrap_kerberos(struct gss_ctx *ctx_id, int offset, int len,
259259 struct xdr_buf *buf);
260260
261261
@@ -312,7 +312,7 @@ gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset, · 50 unmodified lines
312312 struct page **pages);
313313
314314 u32
315−gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset,
315+gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, u32 len,
316316 struct xdr_buf *buf, u32 *plainoffset,
317317 u32 *plainlen);
318318
include/linux/sunrpc/xdr.h+1−0
@@ -184,6 +184,7 @@ xdr_adjust_iovec(struct kvec *iov, __be32 *p) · 183 unmodified lines
184184 extern void xdr_shift_buf(struct xdr_buf *, size_t);
185185 extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *);
186186 extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, unsigned int, unsigned int);
187+extern void xdr_buf_trim(struct xdr_buf *, unsigned int);
187188 extern int read_bytes_from_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int);
188189 extern int write_bytes_to_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int);
189190
include/net/act_api.h+2−1
@@ -75,7 +75,8 @@ static inline void tcf_tm_dump(struct tcf_t *dtm, const struct tcf_t *stm) · 74 unmodified lines
7575 {
7676 dtm->install = jiffies_to_clock_t(jiffies - stm->install);
7777 dtm->lastuse = jiffies_to_clock_t(jiffies - stm->lastuse);
78− dtm->firstuse = jiffies_to_clock_t(jiffies - stm->firstuse);
78+ dtm->firstuse = stm->firstuse ?
79+ jiffies_to_clock_t(jiffies - stm->firstuse) : 0;
7980 dtm->expires = jiffies_to_clock_t(stm->expires);
8081 }
8182
include/net/af_rxrpc.h+1−1
@@ -59,7 +59,7 @@ bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *, · 58 unmodified lines
5959 void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *);
6060 void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *,
6161 struct sockaddr_rxrpc *);
62−u64 rxrpc_kernel_get_rtt(struct socket *, struct rxrpc_call *);
62+u32 rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *);
6363 int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
6464 rxrpc_user_attach_call_t, unsigned long, gfp_t,
6565 unsigned int);
include/net/ip_fib.h+0−1
@@ -257,7 +257,6 @@ struct fib_dump_filter { · 256 unmodified lines
257257 u32 table_id;
258258 /* filter_set is an optimization that an entry is set */
259259 bool filter_set;
260− bool dump_all_families;
261260 bool dump_routes;
262261 bool dump_exceptions;
263262 unsigned char protocol;
include/net/netfilter/nf_conntrack.h+1−1
@@ -87,7 +87,7 @@ struct nf_conn { · 86 unmodified lines
8787 struct hlist_node nat_bysource;
8888 #endif
8989 /* all members below initialized via memset */
90− u8 __nfct_init_offset[0];
90+ struct { } __nfct_init_offset;
9191
9292 /* If we were expected by an expectation, this will be it */
9393 struct nf_conn *master;
include/net/netfilter/nf_flow_table.h+1−0
@@ -127,6 +127,7 @@ enum nf_flow_flags { · 126 unmodified lines
127127 NF_FLOW_HW_DYING,
128128 NF_FLOW_HW_DEAD,
129129 NF_FLOW_HW_REFRESH,
130+ NF_FLOW_HW_PENDING,
130131 };
131132
132133 enum flow_offload_type {
include/net/tcp.h+13−1
@@ -1376,7 +1376,6 @@ static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) · 1375 unmodified lines
13761376 rx_opt->num_sacks = 0;
13771377 }
13781378
1379−u32 tcp_default_init_rwnd(u32 mss);
13801379 void tcp_cwnd_restart(struct sock *sk, s32 delta);
13811380
13821381 static inline void tcp_slow_start_after_idle_check(struct sock *sk)
@@ -1421,6 +1420,19 @@ static inline int tcp_full_space(const struct sock *sk) · 38 unmodified lines
14211420 return tcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf));
14221421 }
14231422
1423+/* We provision sk_rcvbuf around 200% of sk_rcvlowat.
1424+ * If 87.5 % (7/8) of the space has been consumed, we want to override
1425+ * SO_RCVLOWAT constraint, since we are receiving skbs with too small
1426+ * len/truesize ratio.
1427+ */
1428+static inline bool tcp_rmem_pressure(const struct sock *sk)
1429+{
1430+ int rcvbuf = READ_ONCE(sk->sk_rcvbuf);
1431+ int threshold = rcvbuf - (rcvbuf >> 3);
1432+
1433+ return atomic_read(&sk->sk_rmem_alloc) > threshold;
1434+}
1435+
14241436 extern void tcp_openreq_init_rwin(struct request_sock *req,
14251437 const struct sock *sk_listener,
14261438 const struct dst_entry *dst);
include/net/udp_tunnel.h+0−2
@@ -143,14 +143,12 @@ void udp_tunnel_xmit_skb(struct rtable *rt, struct sock *sk, struct sk_buff *skb · 142 unmodified lines
143143 __be16 df, __be16 src_port, __be16 dst_port,
144144 bool xnet, bool nocheck);
145145
146−#if IS_ENABLED(CONFIG_IPV6)
147146 int udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sock *sk,
148147 struct sk_buff *skb,
149148 struct net_device *dev, struct in6_addr *saddr,
150149 struct in6_addr *daddr,
151150 __u8 prio, __u8 ttl, __be32 label,
152151 __be16 src_port, __be16 dst_port, bool nocheck);
153−#endif
154152
155153 void udp_tunnel_sock_release(struct socket *sock);
156154
include/sound/rawmidi.h+1−0
@@ -61,6 +61,7 @@ struct snd_rawmidi_runtime { · 60 unmodified lines
6161 size_t avail_min; /* min avail for wakeup */
6262 size_t avail; /* max used buffer for wakeup */
6363 size_t xruns; /* over/underruns counter */
64+ int buffer_ref; /* buffer reference count */
6465 /* misc */
6566 spinlock_t lock;
6667 wait_queue_head_t sleep;
include/trace/events/rxrpc.h+42−10
@@ -1112,18 +1112,17 @@ TRACE_EVENT(rxrpc_rtt_tx, · 1111 unmodified lines
11121112 TRACE_EVENT(rxrpc_rtt_rx,
11131113 TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
11141114 rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
1115− s64 rtt, u8 nr, s64 avg),
1115+ u32 rtt, u32 rto),
11161116
1117− TP_ARGS(call, why, send_serial, resp_serial, rtt, nr, avg),
1117+ TP_ARGS(call, why, send_serial, resp_serial, rtt, rto),
11181118
11191119 TP_STRUCT__entry(
11201120 __field(unsigned int, call )
11211121 __field(enum rxrpc_rtt_rx_trace, why )
1122− __field(u8, nr )
11231122 __field(rxrpc_serial_t, send_serial )
11241123 __field(rxrpc_serial_t, resp_serial )
1125− __field(s64, rtt )
1126− __field(u64, avg )
1124+ __field(u32, rtt )
1125+ __field(u32, rto )
11271126 ),
11281127
11291128 TP_fast_assign(
@@ -1132,18 +1131,16 @@ TRACE_EVENT(rxrpc_rtt_rx, · 2 unmodified lines
11321131 __entry->send_serial = send_serial;
11331132 __entry->resp_serial = resp_serial;
11341133 __entry->rtt = rtt;
1135− __entry->nr = nr;
1136− __entry->avg = avg;
1134+ __entry->rto = rto;
11371135 ),
11381136
1139− TP_printk("c=%08x %s sr=%08x rr=%08x rtt=%lld nr=%u avg=%lld",
1137+ TP_printk("c=%08x %s sr=%08x rr=%08x rtt=%u rto=%u",
11401138 __entry->call,
11411139 __print_symbolic(__entry->why, rxrpc_rtt_rx_traces),
11421140 __entry->send_serial,
11431141 __entry->resp_serial,
11441142 __entry->rtt,
1145− __entry->nr,
1146− __entry->avg)
1143+ __entry->rto)
11471144 );
11481145
11491146 TRACE_EVENT(rxrpc_timer,
@@ -1544,6 +1541,41 @@ TRACE_EVENT(rxrpc_notify_socket, · 394 unmodified lines
15441541 __entry->serial)
15451542 );
15461543
1544+TRACE_EVENT(rxrpc_rx_discard_ack,
1545+ TP_PROTO(unsigned int debug_id, rxrpc_serial_t serial,
1546+ rxrpc_seq_t first_soft_ack, rxrpc_seq_t call_ackr_first,
1547+ rxrpc_seq_t prev_pkt, rxrpc_seq_t call_ackr_prev),
1548+
1549+ TP_ARGS(debug_id, serial, first_soft_ack, call_ackr_first,
1550+ prev_pkt, call_ackr_prev),
1551+
1552+ TP_STRUCT__entry(
1553+ __field(unsigned int, debug_id )
1554+ __field(rxrpc_serial_t, serial )
1555+ __field(rxrpc_seq_t, first_soft_ack)
1556+ __field(rxrpc_seq_t, call_ackr_first)
1557+ __field(rxrpc_seq_t, prev_pkt)
1558+ __field(rxrpc_seq_t, call_ackr_prev)
1559+ ),
1560+
1561+ TP_fast_assign(
1562+ __entry->debug_id = debug_id;
1563+ __entry->serial = serial;
1564+ __entry->first_soft_ack = first_soft_ack;
1565+ __entry->call_ackr_first = call_ackr_first;
1566+ __entry->prev_pkt = prev_pkt;
1567+ __entry->call_ackr_prev = call_ackr_prev;
1568+ ),
1569+
1570+ TP_printk("c=%08x r=%08x %08x<%08x %08x<%08x",
1571+ __entry->debug_id,
1572+ __entry->serial,
1573+ __entry->first_soft_ack,
1574+ __entry->call_ackr_first,
1575+ __entry->prev_pkt,
1576+ __entry->call_ackr_prev)
1577+ );
1578+
15471579 #endif /* _TRACE_RXRPC_H */
15481580
15491581 /* This part must be outside protection */
include/uapi/linux/usb/raw_gadget.h+95−13
@@ -93,6 +93,64 @@ struct usb_raw_ep_io { · 92 unmodified lines
9393 __u8 data[0];
9494 };
9595
96+/* Maximum number of non-control endpoints in struct usb_raw_eps_info. */
97+#define USB_RAW_EPS_NUM_MAX 30
98+
99+/* Maximum length of UDC endpoint name in struct usb_raw_ep_info. */
100+#define USB_RAW_EP_NAME_MAX 16
101+
102+/* Used as addr in struct usb_raw_ep_info if endpoint accepts any address. */
103+#define USB_RAW_EP_ADDR_ANY 0xff
104+
105+/*
106+ * struct usb_raw_ep_caps - exposes endpoint capabilities from struct usb_ep
107+ * (technically from its member struct usb_ep_caps).
108+ */
109+struct usb_raw_ep_caps {
110+ __u32 type_control : 1;
111+ __u32 type_iso : 1;
112+ __u32 type_bulk : 1;
113+ __u32 type_int : 1;
114+ __u32 dir_in : 1;
115+ __u32 dir_out : 1;
116+};
117+
118+/*
119+ * struct usb_raw_ep_limits - exposes endpoint limits from struct usb_ep.
120+ * @maxpacket_limit: Maximum packet size value supported by this endpoint.
121+ * @max_streams: maximum number of streams supported by this endpoint
122+ * (actual number is 2^n).
123+ * @reserved: Empty, reserved for potential future extensions.
124+ */
125+struct usb_raw_ep_limits {
126+ __u16 maxpacket_limit;
127+ __u16 max_streams;
128+ __u32 reserved;
129+};
130+
131+/*
132+ * struct usb_raw_ep_info - stores information about a gadget endpoint.
133+ * @name: Name of the endpoint as it is defined in the UDC driver.
134+ * @addr: Address of the endpoint that must be specified in the endpoint
135+ * descriptor passed to USB_RAW_IOCTL_EP_ENABLE ioctl.
136+ * @caps: Endpoint capabilities.
137+ * @limits: Endpoint limits.
138+ */
139+struct usb_raw_ep_info {
140+ __u8 name[USB_RAW_EP_NAME_MAX];
141+ __u32 addr;
142+ struct usb_raw_ep_caps caps;
143+ struct usb_raw_ep_limits limits;
144+};
145+
146+/*
147+ * struct usb_raw_eps_info - argument for USB_RAW_IOCTL_EPS_INFO ioctl.
148+ * eps: Structures that store information about non-control endpoints.
149+ */
150+struct usb_raw_eps_info {
151+ struct usb_raw_ep_info eps[USB_RAW_EPS_NUM_MAX];
152+};
153+
96154 /*
97155 * Initializes a Raw Gadget instance.
98156 * Accepts a pointer to the usb_raw_init struct as an argument.
@@ -115,37 +173,38 @@ struct usb_raw_ep_io { · 16 unmodified lines
115173 #define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
116174
117175 /*
118− * Queues an IN (OUT for READ) urb as a response to the last control request
119− * received on endpoint 0, provided that was an IN (OUT for READ) request and
120− * waits until the urb is completed. Copies received data to user for READ.
176+ * Queues an IN (OUT for READ) request as a response to the last setup request
177+ * received on endpoint 0 (provided that was an IN (OUT for READ) request), and
178+ * waits until the request is completed. Copies received data to user for READ.
121179 * Accepts a pointer to the usb_raw_ep_io struct as an argument.
122− * Returns length of trasferred data on success or negative error code on
180+ * Returns length of transferred data on success or negative error code on
123181 * failure.
124182 */
125183 #define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
126184 #define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
127185
128186 /*
129− * Finds an endpoint that supports the transfer type specified in the
130− * descriptor and enables it.
131− * Accepts a pointer to the usb_endpoint_descriptor struct as an argument.
187+ * Finds an endpoint that satisfies the parameters specified in the provided
188+ * descriptors (address, transfer type, etc.) and enables it.
189+ * Accepts a pointer to the usb_raw_ep_descs struct as an argument.
132190 * Returns enabled endpoint handle on success or negative error code on failure.
133191 */
134192 #define USB_RAW_IOCTL_EP_ENABLE _IOW('U', 5, struct usb_endpoint_descriptor)
135193
136−/* Disables specified endpoint.
194+/*
195+ * Disables specified endpoint.
137196 * Accepts endpoint handle as an argument.
138197 * Returns 0 on success or negative error code on failure.
139198 */
140199 #define USB_RAW_IOCTL_EP_DISABLE _IOW('U', 6, __u32)
141200
142201 /*
143− * Queues an IN (OUT for READ) urb as a response to the last control request
144− * received on endpoint usb_raw_ep_io.ep, provided that was an IN (OUT for READ)
145− * request and waits until the urb is completed. Copies received data to user
146− * for READ.
202+ * Queues an IN (OUT for READ) request as a response to the last setup request
203+ * received on endpoint usb_raw_ep_io.ep (provided that was an IN (OUT for READ)
204+ * request), and waits until the request is completed. Copies received data to
205+ * user for READ.
147206 * Accepts a pointer to the usb_raw_ep_io struct as an argument.
148− * Returns length of trasferred data on success or negative error code on
207+ * Returns length of transferred data on success or negative error code on
149208 * failure.
150209 */
151210 #define USB_RAW_IOCTL_EP_WRITE _IOW('U', 7, struct usb_raw_ep_io)
@@ -164,4 +223,27 @@ struct usb_raw_ep_io { · 12 unmodified lines
164223 */
165224 #define USB_RAW_IOCTL_VBUS_DRAW _IOW('U', 10, __u32)
166225
226+/*
227+ * Fills in the usb_raw_eps_info structure with information about non-control
228+ * endpoints available for the currently connected UDC.
229+ * Returns the number of available endpoints on success or negative error code
230+ * on failure.
231+ */
232+#define USB_RAW_IOCTL_EPS_INFO _IOR('U', 11, struct usb_raw_eps_info)
233+
234+/*
235+ * Stalls a pending control request on endpoint 0.
236+ * Returns 0 on success or negative error code on failure.
237+ */
238+#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
239+
240+/*
241+ * Sets or clears halt or wedge status of the endpoint.
242+ * Accepts endpoint handle as an argument.
243+ * Returns 0 on success or negative error code on failure.
244+ */
245+#define USB_RAW_IOCTL_EP_SET_HALT _IOW('U', 13, __u32)
246+#define USB_RAW_IOCTL_EP_CLEAR_HALT _IOW('U', 14, __u32)
247+#define USB_RAW_IOCTL_EP_SET_WEDGE _IOW('U', 15, __u32)
248+
167249 #endif /* _UAPI__LINUX_USB_RAW_GADGET_H */
init/Kconfig+3−0
@@ -2261,6 +2261,9 @@ config ASN1 · 2260 unmodified lines
22612261
22622262 source "kernel/Kconfig.locks"
22632263
2264+config ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
2265+ bool
2266+
22642267 config ARCH_HAS_SYNC_CORE_BEFORE_USERMODE
22652268 bool
22662269
init/main.c+8−4
@@ -400,9 +400,8 @@ static void __init setup_boot_config(const char *cmdline) · 399 unmodified lines
400400 char *data, *copy;
401401 int ret;
402402
403+ /* Cut out the bootconfig data even if we have no bootconfig option */
403404 data = get_boot_config_from_initrd(&size, &csum);
404− if (!data)
405− goto not_found;
406405
407406 strlcpy(tmp_cmdline, boot_command_line, COMMAND_LINE_SIZE);
408407 parse_args("bootconfig", tmp_cmdline, NULL, 0, 0, 0, NULL,
@@ -411,6 +410,11 @@ static void __init setup_boot_config(const char *cmdline) · 2 unmodified lines
411410 if (!bootconfig_found)
412411 return;
413412
413+ if (!data) {
414+ pr_err("'bootconfig' found on command line, but no bootconfig found\n");
415+ return;
416+ }
417+
414418 if (size >= XBC_DATA_MAX) {
415419 pr_err("bootconfig size %d greater than max size %d\n",
416420 size, XBC_DATA_MAX);
@@ -446,8 +450,6 @@ static void __init setup_boot_config(const char *cmdline) · 29 unmodified lines
446450 extra_init_args = xbc_make_cmdline("init");
447451 }
448452 return;
449−not_found:
450− pr_err("'bootconfig' found on command line, but no bootconfig found\n");
451453 }
452454
453455 #else
@@ -1036,6 +1038,8 @@ asmlinkage __visible void __init start_kernel(void) · 582 unmodified lines
10361038
10371039 /* Do the rest non-__init'ed, we're now alive */
10381040 arch_call_rest_init();
1041+
1042+ prevent_tail_call_optimization();
10391043 }
10401044
10411045 /* Call all constructor functions linked into the kernel. */
ipc/util.c+6−6
@@ -764,21 +764,21 @@ static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos, · 763 unmodified lines
764764 total++;
765765 }
766766
767− *new_pos = pos + 1;
767+ ipc = NULL;
768768 if (total >= ids->in_use)
769− return NULL;
769+ goto out;
770770
771771 for (; pos < ipc_mni; pos++) {
772772 ipc = idr_find(&ids->ipcs_idr, pos);
773773 if (ipc != NULL) {
774774 rcu_read_lock();
775775 ipc_lock_object(ipc);
776− return ipc;
776+ break;
777777 }
778778 }
779−
780− /* Out of range - return NULL to terminate iteration */
781− return NULL;
779+out:
780+ *new_pos = pos + 1;
781+ return ipc;
782782 }
783783
784784 static void *sysvipc_proc_next(struct seq_file *s, void *it, loff_t *pos)
kernel/bpf/arraymap.c+6−1
@@ -486,7 +486,12 @@ static int array_map_mmap(struct bpf_map *map, struct vm_area_struct *vma) · 485 unmodified lines
486486 if (!(map->map_flags & BPF_F_MMAPABLE))
487487 return -EINVAL;
488488
489− return remap_vmalloc_range(vma, array_map_vmalloc_addr(array), pgoff);
489+ if (vma->vm_pgoff * PAGE_SIZE + (vma->vm_end - vma->vm_start) >
490+ PAGE_ALIGN((u64)array->map.max_entries * array->elem_size))
491+ return -EINVAL;
492+
493+ return remap_vmalloc_range(vma, array_map_vmalloc_addr(array),
494+ vma->vm_pgoff + pgoff);
490495 }
491496
492497 const struct bpf_map_ops array_map_ops = {
kernel/bpf/syscall.c+17−4
@@ -623,9 +623,20 @@ static int bpf_map_mmap(struct file *filp, struct vm_area_struct *vma) · 622 unmodified lines
623623
624624 mutex_lock(&map->freeze_mutex);
625625
626− if ((vma->vm_flags & VM_WRITE) && map->frozen) {
627− err = -EPERM;
628− goto out;
626+ if (vma->vm_flags & VM_WRITE) {
627+ if (map->frozen) {
628+ err = -EPERM;
629+ goto out;
630+ }
631+ /* map is meant to be read-only, so do not allow mapping as
632+ * writable, because it's possible to leak a writable page
633+ * reference and allows user-space to still modify it after
634+ * freezing, while verifier will assume contents do not change
635+ */
636+ if (map->map_flags & BPF_F_RDONLY_PROG) {
637+ err = -EACCES;
638+ goto out;
639+ }
629640 }
630641
631642 /* set default open/close callbacks */
@@ -1485,8 +1496,10 @@ static int map_lookup_and_delete_elem(union bpf_attr *attr) · 853 unmodified lines
14851496 if (err)
14861497 goto free_value;
14871498
1488− if (copy_to_user(uvalue, value, value_size) != 0)
1499+ if (copy_to_user(uvalue, value, value_size) != 0) {
1500+ err = -EFAULT;
14891501 goto free_value;
1502+ }
14901503
14911504 err = 0;
14921505
kernel/bpf/verifier.c+20−1
@@ -4340,7 +4340,9 @@ static void do_refine_retval_range(struct bpf_reg_state *regs, int ret_type, · 4339 unmodified lines
43404340
43414341 if (ret_type != RET_INTEGER ||
43424342 (func_id != BPF_FUNC_get_stack &&
4343− func_id != BPF_FUNC_probe_read_str))
4343+ func_id != BPF_FUNC_probe_read_str &&
4344+ func_id != BPF_FUNC_probe_read_kernel_str &&
4345+ func_id != BPF_FUNC_probe_read_user_str))
43444346 return;
43454347
43464348 ret_reg->smax_value = meta->msize_max_value;
@@ -7059,6 +7061,23 @@ static int check_return_code(struct bpf_verifier_env *env) · 2712 unmodified lines
70597061 return 0;
70607062 range = tnum_const(0);
70617063 break;
7064+ case BPF_PROG_TYPE_TRACING:
7065+ switch (env->prog->expected_attach_type) {
7066+ case BPF_TRACE_FENTRY:
7067+ case BPF_TRACE_FEXIT:
7068+ range = tnum_const(0);
7069+ break;
7070+ case BPF_TRACE_RAW_TP:
7071+ case BPF_MODIFY_RETURN:
7072+ return 0;
7073+ default:
7074+ return -ENOTSUPP;
7075+ }
7076+ break;
7077+ case BPF_PROG_TYPE_EXT:
7078+ /* freplace program can return anything as its return value
7079+ * depends on the to-be-replaced kernel func or bpf program.
7080+ */
70627081 default:
70637082 return 0;
70647083 }
kernel/fork.c+7−6
@@ -2486,11 +2486,11 @@ long do_fork(unsigned long clone_flags, · 2485 unmodified lines
24862486 int __user *child_tidptr)
24872487 {
24882488 struct kernel_clone_args args = {
2489− .flags = (clone_flags & ~CSIGNAL),
2489+ .flags = (lower_32_bits(clone_flags) & ~CSIGNAL),
24902490 .pidfd = parent_tidptr,
24912491 .child_tid = child_tidptr,
24922492 .parent_tid = parent_tidptr,
2493− .exit_signal = (clone_flags & CSIGNAL),
2493+ .exit_signal = (lower_32_bits(clone_flags) & CSIGNAL),
24942494 .stack = stack_start,
24952495 .stack_size = stack_size,
24962496 };
@@ -2508,8 +2508,9 @@ long do_fork(unsigned long clone_flags, · 11 unmodified lines
25082508 pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
25092509 {
25102510 struct kernel_clone_args args = {
2511− .flags = ((flags | CLONE_VM | CLONE_UNTRACED) & ~CSIGNAL),
2512− .exit_signal = (flags & CSIGNAL),
2511+ .flags = ((lower_32_bits(flags) | CLONE_VM |
2512+ CLONE_UNTRACED) & ~CSIGNAL),
2513+ .exit_signal = (lower_32_bits(flags) & CSIGNAL),
25132514 .stack = (unsigned long)fn,
25142515 .stack_size = (unsigned long)arg,
25152516 };
@@ -2570,11 +2571,11 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, · 54 unmodified lines
25702571 #endif
25712572 {
25722573 struct kernel_clone_args args = {
2573− .flags = (clone_flags & ~CSIGNAL),
2574+ .flags = (lower_32_bits(clone_flags) & ~CSIGNAL),
25742575 .pidfd = parent_tidptr,
25752576 .child_tid = child_tidptr,
25762577 .parent_tid = parent_tidptr,
2577− .exit_signal = (clone_flags & CSIGNAL),
2578+ .exit_signal = (lower_32_bits(clone_flags) & CSIGNAL),
25782579 .stack = newsp,
25792580 .tls = tls,
25802581 };
kernel/sched/debug.c+2−2
@@ -948,8 +948,8 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns, · 947 unmodified lines
948948 P(se.avg.util_est.enqueued);
949949 #endif
950950 #ifdef CONFIG_UCLAMP_TASK
951− __PS("uclamp.min", p->uclamp[UCLAMP_MIN].value);
952− __PS("uclamp.max", p->uclamp[UCLAMP_MAX].value);
951+ __PS("uclamp.min", p->uclamp_req[UCLAMP_MIN].value);
952+ __PS("uclamp.max", p->uclamp_req[UCLAMP_MAX].value);
953953 __PS("effective uclamp.min", uclamp_eff_value(p, UCLAMP_MIN));
954954 __PS("effective uclamp.max", uclamp_eff_value(p, UCLAMP_MAX));
955955 #endif
kernel/sched/fair.c+37−12
@@ -4774,7 +4774,6 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) · 4773 unmodified lines
47744774 struct rq *rq = rq_of(cfs_rq);
47754775 struct cfs_bandwidth *cfs_b = tg_cfs_bandwidth(cfs_rq->tg);
47764776 struct sched_entity *se;
4777− int enqueue = 1;
47784777 long task_delta, idle_task_delta;
47794778
47804779 se = cfs_rq->tg->se[cpu_of(rq)];
@@ -4798,26 +4797,44 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) · 17 unmodified lines
47984797 idle_task_delta = cfs_rq->idle_h_nr_running;
47994798 for_each_sched_entity(se) {
48004799 if (se->on_rq)
4801− enqueue = 0;
4800+ break;
4801+ cfs_rq = cfs_rq_of(se);
4802+ enqueue_entity(cfs_rq, se, ENQUEUE_WAKEUP);
4803+
4804+ cfs_rq->h_nr_running += task_delta;
4805+ cfs_rq->idle_h_nr_running += idle_task_delta;
4806+
4807+ /* end evaluation on encountering a throttled cfs_rq */
4808+ if (cfs_rq_throttled(cfs_rq))
4809+ goto unthrottle_throttle;
4810+ }
48024811
4812+ for_each_sched_entity(se) {
48034813 cfs_rq = cfs_rq_of(se);
4804− if (enqueue) {
4805− enqueue_entity(cfs_rq, se, ENQUEUE_WAKEUP);
4806− } else {
4807− update_load_avg(cfs_rq, se, 0);
4808− se_update_runnable(se);
4809− }
4814+
4815+ update_load_avg(cfs_rq, se, UPDATE_TG);
4816+ se_update_runnable(se);
48104817
48114818 cfs_rq->h_nr_running += task_delta;
48124819 cfs_rq->idle_h_nr_running += idle_task_delta;
48134820
4821+
4822+ /* end evaluation on encountering a throttled cfs_rq */
48144823 if (cfs_rq_throttled(cfs_rq))
4815− break;
4824+ goto unthrottle_throttle;
4825+
4826+ /*
4827+ * One parent has been throttled and cfs_rq removed from the
4828+ * list. Add it back to not break the leaf list.
4829+ */
4830+ if (throttled_hierarchy(cfs_rq))
4831+ list_add_leaf_cfs_rq(cfs_rq);
48164832 }
48174833
4818− if (!se)
4819− add_nr_running(rq, task_delta);
4834+ /* At this point se is NULL and we are at root level*/
4835+ add_nr_running(rq, task_delta);
48204836
4837+unthrottle_throttle:
48214838 /*
48224839 * The cfs_rq_throttled() breaks in the above iteration can result in
48234840 * incomplete leaf list maintenance, resulting in triggering the
@@ -4826,7 +4843,8 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) · 2 unmodified lines
48264843 for_each_sched_entity(se) {
48274844 cfs_rq = cfs_rq_of(se);
48284845
4829− list_add_leaf_cfs_rq(cfs_rq);
4846+ if (list_add_leaf_cfs_rq(cfs_rq))
4847+ break;
48304848 }
48314849
48324850 assert_list_leaf_cfs_rq(rq);
@@ -5479,6 +5497,13 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) · 646 unmodified lines
54795497 /* end evaluation on encountering a throttled cfs_rq */
54805498 if (cfs_rq_throttled(cfs_rq))
54815499 goto enqueue_throttle;
5500+
5501+ /*
5502+ * One parent has been throttled and cfs_rq removed from the
5503+ * list. Add it back to not break the leaf list.
5504+ */
5505+ if (throttled_hierarchy(cfs_rq))
5506+ list_add_leaf_cfs_rq(cfs_rq);
54825507 }
54835508
54845509 enqueue_throttle:
kernel/trace/bpf_trace.c+66−34
@@ -323,17 +323,15 @@ static const struct bpf_func_proto *bpf_get_probe_write_proto(void) · 322 unmodified lines
323323
324324 /*
325325 * Only limited trace_printk() conversion specifiers allowed:
326− * %d %i %u %x %ld %li %lu %lx %lld %lli %llu %llx %p %s
326+ * %d %i %u %x %ld %li %lu %lx %lld %lli %llu %llx %p %pks %pus %s
327327 */
328328 BPF_CALL_5(bpf_trace_printk, char *, fmt, u32, fmt_size, u64, arg1,
329329 u64, arg2, u64, arg3)
330330 {
331+ int i, mod[3] = {}, fmt_cnt = 0;
332+ char buf[64], fmt_ptype;
333+ void *unsafe_ptr = NULL;
331334 bool str_seen = false;
332− int mod[3] = {};
333− int fmt_cnt = 0;
334− u64 unsafe_addr;
335− char buf[64];
336− int i;
337335
338336 /*
339337 * bpf_check()->check_func_arg()->check_stack_boundary()
@@ -359,40 +357,71 @@ BPF_CALL_5(bpf_trace_printk, char *, fmt, u32, fmt_size, u64, arg1, · 19 unmodified lines
359357 if (fmt[i] == 'l') {
360358 mod[fmt_cnt]++;
361359 i++;
362− } else if (fmt[i] == 'p' || fmt[i] == 's') {
360+ } else if (fmt[i] == 'p') {
363361 mod[fmt_cnt]++;
362+ if ((fmt[i + 1] == 'k' ||
363+ fmt[i + 1] == 'u') &&
364+ fmt[i + 2] == 's') {
365+ fmt_ptype = fmt[i + 1];
366+ i += 2;
367+ goto fmt_str;
368+ }
369+
364370 /* disallow any further format extensions */
365371 if (fmt[i + 1] != 0 &&
366372 !isspace(fmt[i + 1]) &&
367373 !ispunct(fmt[i + 1]))
368374 return -EINVAL;
369− fmt_cnt++;
370− if (fmt[i] == 's') {
371− if (str_seen)
372− /* allow only one '%s' per fmt string */
373− return -EINVAL;
374− str_seen = true;
375−
376− switch (fmt_cnt) {
377− case 1:
378− unsafe_addr = arg1;
379− arg1 = (long) buf;
380− break;
381− case 2:
382− unsafe_addr = arg2;
383− arg2 = (long) buf;
384− break;
385− case 3:
386− unsafe_addr = arg3;
387− arg3 = (long) buf;
388− break;
389− }
390− buf[0] = 0;
391− strncpy_from_unsafe(buf,
392− (void *) (long) unsafe_addr,
375+
376+ goto fmt_next;
377+ } else if (fmt[i] == 's') {
378+ mod[fmt_cnt]++;
379+ fmt_ptype = fmt[i];
380+fmt_str:
381+ if (str_seen)
382+ /* allow only one '%s' per fmt string */
383+ return -EINVAL;
384+ str_seen = true;
385+
386+ if (fmt[i + 1] != 0 &&
387+ !isspace(fmt[i + 1]) &&
388+ !ispunct(fmt[i + 1]))
389+ return -EINVAL;
390+
391+ switch (fmt_cnt) {
392+ case 0:
393+ unsafe_ptr = (void *)(long)arg1;
394+ arg1 = (long)buf;
395+ break;
396+ case 1:
397+ unsafe_ptr = (void *)(long)arg2;
398+ arg2 = (long)buf;
399+ break;
400+ case 2:
401+ unsafe_ptr = (void *)(long)arg3;
402+ arg3 = (long)buf;
403+ break;
404+ }
405+
406+ buf[0] = 0;
407+ switch (fmt_ptype) {
408+ case 's':
409+#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
410+ strncpy_from_unsafe(buf, unsafe_ptr,
393411 sizeof(buf));
412+ break;
413+#endif
414+ case 'k':
415+ strncpy_from_unsafe_strict(buf, unsafe_ptr,
416+ sizeof(buf));
417+ break;
418+ case 'u':
419+ strncpy_from_unsafe_user(buf,
420+ (__force void __user *)unsafe_ptr,
421+ sizeof(buf));
422+ break;
394423 }
395− continue;
424+ goto fmt_next;
396425 }
397426
398427 if (fmt[i] == 'l') {
@@ -403,6 +432,7 @@ BPF_CALL_5(bpf_trace_printk, char *, fmt, u32, fmt_size, u64, arg1, · 4 unmodified lines
403432 if (fmt[i] != 'i' && fmt[i] != 'd' &&
404433 fmt[i] != 'u' && fmt[i] != 'x')
405434 return -EINVAL;
435+fmt_next:
406436 fmt_cnt++;
407437 }
408438
@@ -825,14 +855,16 @@ bpf_tracing_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) · 416 unmodified lines
825855 return &bpf_probe_read_user_proto;
826856 case BPF_FUNC_probe_read_kernel:
827857 return &bpf_probe_read_kernel_proto;
828− case BPF_FUNC_probe_read:
829− return &bpf_probe_read_compat_proto;
830858 case BPF_FUNC_probe_read_user_str:
831859 return &bpf_probe_read_user_str_proto;
832860 case BPF_FUNC_probe_read_kernel_str:
833861 return &bpf_probe_read_kernel_str_proto;
862+#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
863+ case BPF_FUNC_probe_read:
864+ return &bpf_probe_read_compat_proto;
834865 case BPF_FUNC_probe_read_str:
835866 return &bpf_probe_read_compat_str_proto;
867+#endif
836868 #ifdef CONFIG_CGROUPS
837869 case BPF_FUNC_get_current_cgroup_id:
838870 return &bpf_get_current_cgroup_id_proto;
kernel/trace/ftrace_internal.h+0−22
@@ -4,28 +4,6 @@ · 3 unmodified lines
44
55 #ifdef CONFIG_FUNCTION_TRACER
66
7−/*
8− * Traverse the ftrace_global_list, invoking all entries. The reason that we
9− * can use rcu_dereference_raw_check() is that elements removed from this list
10− * are simply leaked, so there is no need to interact with a grace-period
11− * mechanism. The rcu_dereference_raw_check() calls are needed to handle
12− * concurrent insertions into the ftrace_global_list.
13− *
14− * Silly Alpha and silly pointer-speculation compiler optimizations!
15− */
16−#define do_for_each_ftrace_op(op, list) \
17− op = rcu_dereference_raw_check(list); \
18− do
19−
20−/*
21− * Optimized for just a single item in the list (as that is the normal case).
22− */
23−#define while_for_each_ftrace_op(op) \
24− while (likely(op = rcu_dereference_raw_check((op)->next)) && \
25− unlikely((op) != &ftrace_list_end))
26−
27−extern struct ftrace_ops __rcu *ftrace_ops_list;
28−extern struct ftrace_ops ftrace_list_end;
297 extern struct mutex ftrace_lock;
308 extern struct ftrace_ops global_ops;
319
kernel/trace/preemptirq_delay_test.c+10−2
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include <linux/printk.h>
1717 #include <linux/string.h>
1818 #include <linux/sysfs.h>
19+#include <linux/completion.h>
1920
2021 static ulong delay = 100;
2122 static char test_mode[12] = "irq";
@@ -28,6 +29,8 @@ MODULE_PARM_DESC(delay, "Period in microseconds (100 us default)"); · 6 unmodified lines
2829 MODULE_PARM_DESC(test_mode, "Mode of the test such as preempt, irq, or alternate (default irq)");
2930 MODULE_PARM_DESC(burst_size, "The size of a burst (default 1)");
3031
32+static struct completion done;
33+
3134 #define MIN(x, y) ((x) < (y) ? (x) : (y))
3235
3336 static void busy_wait(ulong time)
@@ -114,6 +117,8 @@ static int preemptirq_delay_run(void *data) · 80 unmodified lines
114117 for (i = 0; i < s; i++)
115118 (testfuncs[i])(i);
116119
120+ complete(&done);
121+
117122 set_current_state(TASK_INTERRUPTIBLE);
118123 while (!kthread_should_stop()) {
119124 schedule();
@@ -128,15 +133,18 @@ static int preemptirq_delay_run(void *data) · 8 unmodified lines
128133 static int preemptirq_run_test(void)
129134 {
130135 struct task_struct *task;
131−
132136 char task_name[50];
133137
138+ init_completion(&done);
139+
134140 snprintf(task_name, sizeof(task_name), "%s_test", test_mode);
135141 task = kthread_run(preemptirq_delay_run, NULL, task_name);
136142 if (IS_ERR(task))
137143 return PTR_ERR(task);
138− if (task)
144+ if (task) {
145+ wait_for_completion(&done);
139146 kthread_stop(task);
147+ }
140148 return 0;
141149 }
142150
kernel/trace/ring_buffer.c+13−21
@@ -193,7 +193,7 @@ rb_event_length(struct ring_buffer_event *event) · 192 unmodified lines
193193 case RINGBUF_TYPE_DATA:
194194 return rb_event_data_length(event);
195195 default:
196− BUG();
196+ WARN_ON_ONCE(1);
197197 }
198198 /* not hit */
199199 return 0;
@@ -249,7 +249,7 @@ rb_event_data(struct ring_buffer_event *event) · 49 unmodified lines
249249 {
250250 if (extended_time(event))
251251 event = skip_time_extend(event);
252− BUG_ON(event->type_len > RINGBUF_TYPE_DATA_TYPE_LEN_MAX);
252+ WARN_ON_ONCE(event->type_len > RINGBUF_TYPE_DATA_TYPE_LEN_MAX);
253253 /* If length is in len field, then array[0] has the data */
254254 if (event->type_len)
255255 return (void *)&event->array[0];
@@ -3727,7 +3727,7 @@ rb_update_read_stamp(struct ring_buffer_per_cpu *cpu_buffer, · 3471 unmodified lines
37273727 return;
37283728
37293729 default:
3730− BUG();
3730+ RB_WARN_ON(cpu_buffer, 1);
37313731 }
37323732 return;
37333733 }
@@ -3757,7 +3757,7 @@ rb_update_iter_read_stamp(struct ring_buffer_iter *iter, · 23 unmodified lines
37573757 return;
37583758
37593759 default:
3760− BUG();
3760+ RB_WARN_ON(iter->cpu_buffer, 1);
37613761 }
37623762 return;
37633763 }
@@ -4020,7 +4020,7 @@ rb_buffer_peek(struct ring_buffer_per_cpu *cpu_buffer, u64 *ts, · 256 unmodified lines
40204020 return event;
40214021
40224022 default:
4023− BUG();
4023+ RB_WARN_ON(cpu_buffer, 1);
40244024 }
40254025
40264026 return NULL;
@@ -4034,7 +4034,6 @@ rb_iter_peek(struct ring_buffer_iter *iter, u64 *ts) · 7 unmodified lines
40344034 struct ring_buffer_per_cpu *cpu_buffer;
40354035 struct ring_buffer_event *event;
40364036 int nr_loops = 0;
4037− bool failed = false;
40384037
40394038 if (ts)
40404039 *ts = 0;
@@ -4056,19 +4055,14 @@ rb_iter_peek(struct ring_buffer_iter *iter, u64 *ts) · 15 unmodified lines
40564055 return NULL;
40574056
40584057 /*
4059− * We repeat when a time extend is encountered or we hit
4060− * the end of the page. Since the time extend is always attached
4061− * to a data event, we should never loop more than three times.
4062− * Once for going to next page, once on time extend, and
4063− * finally once to get the event.
4064− * We should never hit the following condition more than thrice,
4065− * unless the buffer is very small, and there's a writer
4066− * that is causing the reader to fail getting an event.
4058+ * As the writer can mess with what the iterator is trying
4059+ * to read, just give up if we fail to get an event after
4060+ * three tries. The iterator is not as reliable when reading
4061+ * the ring buffer with an active write as the consumer is.
4062+ * Do not warn if the three failures is reached.
40674063 */
4068− if (++nr_loops > 3) {
4069− RB_WARN_ON(cpu_buffer, !failed);
4064+ if (++nr_loops > 3)
40704065 return NULL;
4071− }
40724066
40734067 if (rb_per_cpu_empty(cpu_buffer))
40744068 return NULL;
@@ -4079,10 +4073,8 @@ rb_iter_peek(struct ring_buffer_iter *iter, u64 *ts) · 4 unmodified lines
40794073 }
40804074
40814075 event = rb_iter_head_event(iter);
4082− if (!event) {
4083− failed = true;
4076+ if (!event)
40844077 goto again;
4085− }
40864078
40874079 switch (event->type_len) {
40884080 case RINGBUF_TYPE_PADDING:
@@ -4117,7 +4109,7 @@ rb_iter_peek(struct ring_buffer_iter *iter, u64 *ts) · 28 unmodified lines
41174109 return event;
41184110
41194111 default:
4120− BUG();
4112+ RB_WARN_ON(cpu_buffer, 1);
41214113 }
41224114
41234115 return NULL;
kernel/umh.c+6−0
@@ -475,6 +475,12 @@ static void umh_clean_and_save_pid(struct subprocess_info *info) · 474 unmodified lines
475475 {
476476 struct umh_info *umh_info = info->data;
477477
478+ /* cleanup if umh_pipe_setup() was successful but exec failed */
479+ if (info->pid && info->retval) {
480+ fput(umh_info->pipe_to_umh);
481+ fput(umh_info->pipe_from_umh);
482+ }
483+
478484 argv_free(info->argv);
479485 umh_info->pid = info->pid;
480486 }
lib/test_printf.c+18−1
@@ -214,6 +214,7 @@ test_string(void) · 213 unmodified lines
214214 #define PTR_STR "ffff0123456789ab"
215215 #define PTR_VAL_NO_CRNG "(____ptrval____)"
216216 #define ZEROS "00000000" /* hex 32 zero bits */
217+#define ONES "ffffffff" /* hex 32 one bits */
217218
218219 static int __init
219220 plain_format(void)
@@ -245,6 +246,7 @@ plain_format(void) · 25 unmodified lines
245246 #define PTR_STR "456789ab"
246247 #define PTR_VAL_NO_CRNG "(ptrval)"
247248 #define ZEROS ""
249+#define ONES ""
248250
249251 static int __init
250252 plain_format(void)
@@ -330,14 +332,28 @@ test_hashed(const char *fmt, const void *p) · 79 unmodified lines
330332 test(buf, fmt, p);
331333 }
332334
335+/*
336+ * NULL pointers aren't hashed.
337+ */
333338 static void __init
334339 null_pointer(void)
335340 {
336− test_hashed("%p", NULL);
341+ test(ZEROS "00000000", "%p", NULL);
337342 test(ZEROS "00000000", "%px", NULL);
338343 test("(null)", "%pE", NULL);
339344 }
340345
346+/*
347+ * Error pointers aren't hashed.
348+ */
349+static void __init
350+error_pointer(void)
351+{
352+ test(ONES "fffffff5", "%p", ERR_PTR(-11));
353+ test(ONES "fffffff5", "%px", ERR_PTR(-11));
354+ test("(efault)", "%pE", ERR_PTR(-11));
355+}
356+
341357 #define PTR_INVALID ((void *)0x000000ab)
342358
343359 static void __init
@@ -649,6 +665,7 @@ test_pointer(void) · 305 unmodified lines
649665 {
650666 plain();
651667 null_pointer();
668+ error_pointer();
652669 invalid_pointer();
653670 symbol_ptr();
654671 kernel_ptr();
lib/vsprintf.c+19−0
@@ -794,6 +794,13 @@ static char *ptr_to_id(char *buf, char *end, const void *ptr, · 793 unmodified lines
794794 unsigned long hashval;
795795 int ret;
796796
797+ /*
798+ * Print the real pointer value for NULL and error pointers,
799+ * as they are not actual addresses.
800+ */
801+ if (IS_ERR_OR_NULL(ptr))
802+ return pointer_string(buf, end, ptr, spec);
803+
797804 /* When debugging early boot use non-cryptographically secure hash. */
798805 if (unlikely(debug_boot_weak_hash)) {
799806 hashval = hash_long((unsigned long)ptr, 32);
@@ -2168,6 +2175,10 @@ char *fwnode_string(char *buf, char *end, struct fwnode_handle *fwnode, · 1368 unmodified lines
21682175 * f full name
21692176 * P node name, including a possible unit address
21702177 * - 'x' For printing the address. Equivalent to "%lx".
2178+ * - '[ku]s' For a BPF/tracing related format specifier, e.g. used out of
2179+ * bpf_trace_printk() where [ku] prefix specifies either kernel (k)
2180+ * or user (u) memory to probe, and:
2181+ * s a string, equivalent to "%s" on direct vsnprintf() use
21712182 *
21722183 * ** When making changes please also update:
21732184 * Documentation/core-api/printk-formats.rst
@@ -2251,6 +2262,14 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, · 77 unmodified lines
22512262 if (!IS_ERR(ptr))
22522263 break;
22532264 return err_ptr(buf, end, ptr, spec);
2265+ case 'u':
2266+ case 'k':
2267+ switch (fmt[1]) {
2268+ case 's':
2269+ return string(buf, end, ptr, spec);
2270+ default:
2271+ return error_string(buf, end, "(einval)", spec);
2272+ }
22542273 }
22552274
22562275 /* default is to _not_ leak addresses, hash before printing */
mm/gup.c+7−5
@@ -1218,6 +1218,10 @@ retry: · 1217 unmodified lines
12181218 if (!vma_permits_fault(vma, fault_flags))
12191219 return -EFAULT;
12201220
1221+ if ((fault_flags & FAULT_FLAG_KILLABLE) &&
1222+ fatal_signal_pending(current))
1223+ return -EINTR;
1224+
12211225 ret = handle_mm_fault(vma, address, fault_flags);
12221226 major |= ret & VM_FAULT_MAJOR;
12231227 if (ret & VM_FAULT_ERROR) {
@@ -1230,11 +1234,9 @@ retry: · 6 unmodified lines
12301234
12311235 if (ret & VM_FAULT_RETRY) {
12321236 down_read(&mm->mmap_sem);
1233− if (!(fault_flags & FAULT_FLAG_TRIED)) {
1234− *unlocked = true;
1235− fault_flags |= FAULT_FLAG_TRIED;
1236− goto retry;
1237− }
1237+ *unlocked = true;
1238+ fault_flags |= FAULT_FLAG_TRIED;
1239+ goto retry;
12381240 }
12391241
12401242 if (tsk) {
mm/kasan/Makefile+14−9
@@ -1,23 +1,28 @@
11 # SPDX-License-Identifier: GPL-2.0
22 KASAN_SANITIZE := n
3−UBSAN_SANITIZE_common.o := n
4−UBSAN_SANITIZE_generic.o := n
5−UBSAN_SANITIZE_generic_report.o := n
6−UBSAN_SANITIZE_tags.o := n
3+UBSAN_SANITIZE := n
74 KCOV_INSTRUMENT := n
85
6+# Disable ftrace to avoid recursion.
97 CFLAGS_REMOVE_common.o = $(CC_FLAGS_FTRACE)
108 CFLAGS_REMOVE_generic.o = $(CC_FLAGS_FTRACE)
119 CFLAGS_REMOVE_generic_report.o = $(CC_FLAGS_FTRACE)
10+CFLAGS_REMOVE_init.o = $(CC_FLAGS_FTRACE)
11+CFLAGS_REMOVE_quarantine.o = $(CC_FLAGS_FTRACE)
12+CFLAGS_REMOVE_report.o = $(CC_FLAGS_FTRACE)
1213 CFLAGS_REMOVE_tags.o = $(CC_FLAGS_FTRACE)
14+CFLAGS_REMOVE_tags_report.o = $(CC_FLAGS_FTRACE)
1315
1416 # Function splitter causes unnecessary splits in __asan_load1/__asan_store1
1517 # see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533
16−
17−CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
18−CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
19−CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
20−CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
18+CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
19+CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
20+CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
21+CFLAGS_init.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
22+CFLAGS_quarantine.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
23+CFLAGS_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
24+CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
25+CFLAGS_tags_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
2126
2227 obj-$(CONFIG_KASAN) := common.o init.o report.o
2328 obj-$(CONFIG_KASAN_GENERIC) += generic.o generic_report.o quarantine.o
mm/kasan/generic.c+0−1
@@ -15,7 +15,6 @@ · 14 unmodified lines
1515 */
1616
1717 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18−#define DISABLE_BRANCH_PROFILING
1918
2019 #include <linux/export.h>
2120 #include <linux/interrupt.h>
mm/kasan/kasan.h+32−2
@@ -212,8 +212,6 @@ static inline const void *arch_kasan_set_tag(const void *addr, u8 tag) · 211 unmodified lines
212212 asmlinkage void kasan_unpoison_task_stack_below(const void *watermark);
213213 void __asan_register_globals(struct kasan_global *globals, size_t size);
214214 void __asan_unregister_globals(struct kasan_global *globals, size_t size);
215−void __asan_loadN(unsigned long addr, size_t size);
216−void __asan_storeN(unsigned long addr, size_t size);
217215 void __asan_handle_no_return(void);
218216 void __asan_alloca_poison(unsigned long addr, size_t size);
219217 void __asan_allocas_unpoison(const void *stack_top, const void *stack_bottom);
@@ -228,6 +226,8 @@ void __asan_load8(unsigned long addr); · 8 unmodified lines
228226 void __asan_store8(unsigned long addr);
229227 void __asan_load16(unsigned long addr);
230228 void __asan_store16(unsigned long addr);
229+void __asan_loadN(unsigned long addr, size_t size);
230+void __asan_storeN(unsigned long addr, size_t size);
231231
232232 void __asan_load1_noabort(unsigned long addr);
233233 void __asan_store1_noabort(unsigned long addr);
@@ -239,6 +239,21 @@ void __asan_load8_noabort(unsigned long addr); · 5 unmodified lines
239239 void __asan_store8_noabort(unsigned long addr);
240240 void __asan_load16_noabort(unsigned long addr);
241241 void __asan_store16_noabort(unsigned long addr);
242+void __asan_loadN_noabort(unsigned long addr, size_t size);
243+void __asan_storeN_noabort(unsigned long addr, size_t size);
244+
245+void __asan_report_load1_noabort(unsigned long addr);
246+void __asan_report_store1_noabort(unsigned long addr);
247+void __asan_report_load2_noabort(unsigned long addr);
248+void __asan_report_store2_noabort(unsigned long addr);
249+void __asan_report_load4_noabort(unsigned long addr);
250+void __asan_report_store4_noabort(unsigned long addr);
251+void __asan_report_load8_noabort(unsigned long addr);
252+void __asan_report_store8_noabort(unsigned long addr);
253+void __asan_report_load16_noabort(unsigned long addr);
254+void __asan_report_store16_noabort(unsigned long addr);
255+void __asan_report_load_n_noabort(unsigned long addr, size_t size);
256+void __asan_report_store_n_noabort(unsigned long addr, size_t size);
242257
243258 void __asan_set_shadow_00(const void *addr, size_t size);
244259 void __asan_set_shadow_f1(const void *addr, size_t size);
@@ -247,4 +262,19 @@ void __asan_set_shadow_f3(const void *addr, size_t size); · 2 unmodified lines
247262 void __asan_set_shadow_f5(const void *addr, size_t size);
248263 void __asan_set_shadow_f8(const void *addr, size_t size);
249264
265+void __hwasan_load1_noabort(unsigned long addr);
266+void __hwasan_store1_noabort(unsigned long addr);
267+void __hwasan_load2_noabort(unsigned long addr);
268+void __hwasan_store2_noabort(unsigned long addr);
269+void __hwasan_load4_noabort(unsigned long addr);
270+void __hwasan_store4_noabort(unsigned long addr);
271+void __hwasan_load8_noabort(unsigned long addr);
272+void __hwasan_store8_noabort(unsigned long addr);
273+void __hwasan_load16_noabort(unsigned long addr);
274+void __hwasan_store16_noabort(unsigned long addr);
275+void __hwasan_loadN_noabort(unsigned long addr, size_t size);
276+void __hwasan_storeN_noabort(unsigned long addr, size_t size);
277+
278+void __hwasan_tag_memory(unsigned long addr, u8 tag, unsigned long size);
279+
250280 #endif
mm/kasan/tags.c+0−1
@@ -12,7 +12,6 @@ · 11 unmodified lines
1212 */
1313
1414 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15−#define DISABLE_BRANCH_PROFILING
1615
1716 #include <linux/export.h>
1817 #include <linux/interrupt.h>
mm/mremap.c+1−1
@@ -794,7 +794,7 @@ out: · 793 unmodified lines
794794 if (locked && new_len > old_len)
795795 mm_populate(new_addr + old_len, new_len - old_len);
796796 userfaultfd_unmap_complete(mm, &uf_unmap_early);
797− mremap_userfaultfd_complete(&uf, addr, new_addr, old_len);
797+ mremap_userfaultfd_complete(&uf, addr, ret, old_len);
798798 userfaultfd_unmap_complete(mm, &uf_unmap);
799799 return ret;
800800 }
mm/z3fold.c+6−5
@@ -318,16 +318,16 @@ static inline void free_handle(unsigned long handle) · 317 unmodified lines
318318 slots = handle_to_slots(handle);
319319 write_lock(&slots->lock);
320320 *(unsigned long *)handle = 0;
321− write_unlock(&slots->lock);
322− if (zhdr->slots == slots)
321+ if (zhdr->slots == slots) {
322+ write_unlock(&slots->lock);
323323 return; /* simple case, nothing else to do */
324+ }
324325
325326 /* we are freeing a foreign handle if we are here */
326327 zhdr->foreign_handles--;
327328 is_free = true;
328− read_lock(&slots->lock);
329329 if (!test_bit(HANDLES_ORPHANED, &slots->pool)) {
330− read_unlock(&slots->lock);
330+ write_unlock(&slots->lock);
331331 return;
332332 }
333333 for (i = 0; i <= BUDDY_MASK; i++) {
@@ -336,7 +336,7 @@ static inline void free_handle(unsigned long handle) · 2 unmodified lines
336336 break;
337337 }
338338 }
339− read_unlock(&slots->lock);
339+ write_unlock(&slots->lock);
340340
341341 if (is_free) {
342342 struct z3fold_pool *pool = slots_to_pool(slots);
@@ -422,6 +422,7 @@ static struct z3fold_header *init_z3fold_page(struct page *page, bool headless, · 79 unmodified lines
422422 zhdr->start_middle = 0;
423423 zhdr->cpu = -1;
424424 zhdr->foreign_handles = 0;
425+ zhdr->mapped_count = 0;
425426 zhdr->slots = slots;
426427 zhdr->pool = pool;
427428 INIT_LIST_HEAD(&zhdr->buddy);
net/ax25/af_ax25.c+4−2
@@ -635,8 +635,10 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname, · 634 unmodified lines
635635 break;
636636
637637 case SO_BINDTODEVICE:
638− if (optlen > IFNAMSIZ)
639− optlen = IFNAMSIZ;
638+ if (optlen > IFNAMSIZ - 1)
639+ optlen = IFNAMSIZ - 1;
640+
641+ memset(devname, 0, sizeof(devname));
640642
641643 if (copy_from_user(devname, optval, optlen)) {
642644 res = -EFAULT;
net/core/dev.c+18−6
@@ -4988,11 +4988,12 @@ static inline int nf_ingress(struct sk_buff *skb, struct packet_type **pt_prev, · 4987 unmodified lines
49884988 return 0;
49894989 }
49904990
4991−static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc,
4991+static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc,
49924992 struct packet_type **ppt_prev)
49934993 {
49944994 struct packet_type *ptype, *pt_prev;
49954995 rx_handler_func_t *rx_handler;
4996+ struct sk_buff *skb = *pskb;
49964997 struct net_device *orig_dev;
49974998 bool deliver_exact = false;
49984999 int ret = NET_RX_DROP;
@@ -5023,8 +5024,10 @@ another_round: · 24 unmodified lines
50235024 ret2 = do_xdp_generic(rcu_dereference(skb->dev->xdp_prog), skb);
50245025 preempt_enable();
50255026
5026− if (ret2 != XDP_PASS)
5027− return NET_RX_DROP;
5027+ if (ret2 != XDP_PASS) {
5028+ ret = NET_RX_DROP;
5029+ goto out;
5030+ }
50285031 skb_reset_mac_len(skb);
50295032 }
50305033
@@ -5174,6 +5177,13 @@ drop: · 143 unmodified lines
51745177 }
51755178
51765179 out:
5180+ /* The invariant here is that if *ppt_prev is not NULL
5181+ * then skb should also be non-NULL.
5182+ *
5183+ * Apparently *ppt_prev assignment above holds this invariant due to
5184+ * skb dereferencing near it.
5185+ */
5186+ *pskb = skb;
51775187 return ret;
51785188 }
51795189
@@ -5183,7 +5193,7 @@ static int __netif_receive_skb_one_core(struct sk_buff *skb, bool pfmemalloc) · 3 unmodified lines
51835193 struct packet_type *pt_prev = NULL;
51845194 int ret;
51855195
5186− ret = __netif_receive_skb_core(skb, pfmemalloc, &pt_prev);
5196+ ret = __netif_receive_skb_core(&skb, pfmemalloc, &pt_prev);
51875197 if (pt_prev)
51885198 ret = INDIRECT_CALL_INET(pt_prev->func, ipv6_rcv, ip_rcv, skb,
51895199 skb->dev, pt_prev, orig_dev);
@@ -5261,7 +5271,7 @@ static void __netif_receive_skb_list_core(struct list_head *head, bool pfmemallo · 71 unmodified lines
52615271 struct packet_type *pt_prev = NULL;
52625272
52635273 skb_list_del_init(skb);
5264− __netif_receive_skb_core(skb, pfmemalloc, &pt_prev);
5274+ __netif_receive_skb_core(&skb, pfmemalloc, &pt_prev);
52655275 if (!pt_prev)
52665276 continue;
52675277 if (pt_curr != pt_prev || od_curr != orig_dev) {
@@ -8907,11 +8917,13 @@ static void netdev_sync_lower_features(struct net_device *upper, · 3639 unmodified lines
89078917 netdev_dbg(upper, "Disabling feature %pNF on lower dev %s.\n",
89088918 &feature, lower->name);
89098919 lower->wanted_features &= ~feature;
8910− netdev_update_features(lower);
8920+ __netdev_update_features(lower);
89118921
89128922 if (unlikely(lower->features & feature))
89138923 netdev_WARN(upper, "failed to disable %pNF on %s!\n",
89148924 &feature, lower->name);
8925+ else
8926+ netdev_features_change(lower);
89158927 }
89168928 }
89178929 }
net/core/filter.c+1−1
@@ -2590,8 +2590,8 @@ BPF_CALL_4(bpf_msg_pop_data, struct sk_msg *, msg, u32, start, · 2589 unmodified lines
25902590 }
25912591 pop = 0;
25922592 } else if (pop >= sge->length - a) {
2593− sge->length = a;
25942593 pop -= (sge->length - a);
2594+ sge->length = a;
25952595 }
25962596 }
25972597
net/core/flow_dissector.c+21−5
@@ -160,12 +160,10 @@ out: · 159 unmodified lines
160160 return ret;
161161 }
162162
163−int skb_flow_dissector_bpf_prog_detach(const union bpf_attr *attr)
163+static int flow_dissector_bpf_prog_detach(struct net *net)
164164 {
165165 struct bpf_prog *attached;
166− struct net *net;
167166
168− net = current->nsproxy->net_ns;
169167 mutex_lock(&flow_dissector_mutex);
170168 attached = rcu_dereference_protected(net->flow_dissector_prog,
171169 lockdep_is_held(&flow_dissector_mutex));
@@ -179,6 +177,24 @@ int skb_flow_dissector_bpf_prog_detach(const union bpf_attr *attr) · 7 unmodified lines
179177 return 0;
180178 }
181179
180+int skb_flow_dissector_bpf_prog_detach(const union bpf_attr *attr)
181+{
182+ return flow_dissector_bpf_prog_detach(current->nsproxy->net_ns);
183+}
184+
185+static void __net_exit flow_dissector_pernet_pre_exit(struct net *net)
186+{
187+ /* We're not racing with attach/detach because there are no
188+ * references to netns left when pre_exit gets called.
189+ */
190+ if (rcu_access_pointer(net->flow_dissector_prog))
191+ flow_dissector_bpf_prog_detach(net);
192+}
193+
194+static struct pernet_operations flow_dissector_pernet_ops __net_initdata = {
195+ .pre_exit = flow_dissector_pernet_pre_exit,
196+};
197+
182198 /**
183199 * __skb_flow_get_ports - extract the upper layer ports and return them
184200 * @skb: sk_buff to extract the ports from
@@ -1836,7 +1852,7 @@ static int __init init_default_flow_dissectors(void) · 1651 unmodified lines
18361852 skb_flow_dissector_init(&flow_keys_basic_dissector,
18371853 flow_keys_basic_dissector_keys,
18381854 ARRAY_SIZE(flow_keys_basic_dissector_keys));
1839− return 0;
1840−}
18411855
1856+ return register_pernet_subsys(&flow_dissector_pernet_ops);
1857+}
18421858 core_initcall(init_default_flow_dissectors);
net/core/netprio_cgroup.c+2−0
@@ -236,6 +236,8 @@ static void net_prio_attach(struct cgroup_taskset *tset) · 235 unmodified lines
236236 struct task_struct *p;
237237 struct cgroup_subsys_state *css;
238238
239+ cgroup_sk_alloc_disable();
240+
239241 cgroup_taskset_for_each(p, css, tset) {
240242 void *v = (void *)(unsigned long)css->id;
241243
net/dsa/tag_mtk.c+15−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #define MTK_HDR_XMIT_TAGGED_TPID_8100 1
1616 #define MTK_HDR_RECV_SOURCE_PORT_MASK GENMASK(2, 0)
1717 #define MTK_HDR_XMIT_DP_BIT_MASK GENMASK(5, 0)
18+#define MTK_HDR_XMIT_SA_DIS BIT(6)
1819
1920 static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,
2021 struct net_device *dev)
@@ -22,6 +23,9 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb, · 1 unmodified line
2223 struct dsa_port *dp = dsa_slave_to_port(dev);
2324 u8 *mtk_tag;
2425 bool is_vlan_skb = true;
26+ unsigned char *dest = eth_hdr(skb)->h_dest;
27+ bool is_multicast_skb = is_multicast_ether_addr(dest) &&
28+ !is_broadcast_ether_addr(dest);
2529
2630 /* Build the special tag after the MAC Source Address. If VLAN header
2731 * is present, it's required that VLAN header and special tag is
@@ -47,6 +51,10 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb, · 19 unmodified lines
4751 MTK_HDR_XMIT_UNTAGGED;
4852 mtk_tag[1] = (1 << dp->index) & MTK_HDR_XMIT_DP_BIT_MASK;
4953
54+ /* Disable SA learning for multicast frames */
55+ if (unlikely(is_multicast_skb))
56+ mtk_tag[1] |= MTK_HDR_XMIT_SA_DIS;
57+
5058 /* Tag control information is kept for 802.1Q */
5159 if (!is_vlan_skb) {
5260 mtk_tag[2] = 0;
@@ -61,6 +69,9 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev, · 8 unmodified lines
6169 {
6270 int port;
6371 __be16 *phdr, hdr;
72+ unsigned char *dest = eth_hdr(skb)->h_dest;
73+ bool is_multicast_skb = is_multicast_ether_addr(dest) &&
74+ !is_broadcast_ether_addr(dest);
6475
6576 if (unlikely(!pskb_may_pull(skb, MTK_HDR_LEN)))
6677 return NULL;
@@ -86,6 +97,10 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev, · 19 unmodified lines
8697 if (!skb->dev)
8798 return NULL;
8899
100+ /* Only unicast or broadcast frames are offloaded */
101+ if (likely(!is_multicast_skb))
102+ skb->offload_fwd_mark = 1;
103+
89104 return skb;
90105 }
91106
net/ethtool/netlink.c+2−2
@@ -342,7 +342,7 @@ static int ethnl_default_doit(struct sk_buff *skb, struct genl_info *info) · 341 unmodified lines
342342 ret = ops->reply_size(req_info, reply_data);
343343 if (ret < 0)
344344 goto err_cleanup;
345− reply_len = ret;
345+ reply_len = ret + ethnl_reply_header_size();
346346 ret = -ENOMEM;
347347 rskb = ethnl_reply_init(reply_len, req_info->dev, ops->reply_cmd,
348348 ops->hdr_attr, info, &reply_payload);
@@ -588,7 +588,7 @@ static void ethnl_default_notify(struct net_device *dev, unsigned int cmd, · 239 unmodified lines
588588 ret = ops->reply_size(req_info, reply_data);
589589 if (ret < 0)
590590 goto err_cleanup;
591− reply_len = ret;
591+ reply_len = ret + ethnl_reply_header_size();
592592 ret = -ENOMEM;
593593 skb = genlmsg_new(reply_len, GFP_KERNEL);
594594 if (!skb)
net/ethtool/strset.c+0−1
@@ -324,7 +324,6 @@ static int strset_reply_size(const struct ethnl_req_info *req_base, · 323 unmodified lines
324324 int len = 0;
325325 int ret;
326326
327− len += ethnl_reply_header_size();
328327 for (i = 0; i < ETH_SS_COUNT; i++) {
329328 const struct strset_info *set_info = &data->sets[i];
330329
net/ipv4/cipso_ipv4.c+4−2
@@ -1258,7 +1258,8 @@ static int cipso_v4_parsetag_rbm(const struct cipso_v4_doi *doi_def, · 1257 unmodified lines
12581258 return ret_val;
12591259 }
12601260
1261− secattr->flags |= NETLBL_SECATTR_MLS_CAT;
1261+ if (secattr->attr.mls.cat)
1262+ secattr->flags |= NETLBL_SECATTR_MLS_CAT;
12621263 }
12631264
12641265 return 0;
@@ -1439,7 +1440,8 @@ static int cipso_v4_parsetag_rng(const struct cipso_v4_doi *doi_def, · 174 unmodified lines
14391440 return ret_val;
14401441 }
14411442
1442− secattr->flags |= NETLBL_SECATTR_MLS_CAT;
1443+ if (secattr->attr.mls.cat)
1444+ secattr->flags |= NETLBL_SECATTR_MLS_CAT;
14431445 }
14441446
14451447 return 0;
net/ipv4/fib_frontend.c+1−2
@@ -918,7 +918,6 @@ int ip_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh, · 917 unmodified lines
918918 else
919919 filter->dump_exceptions = false;
920920
921− filter->dump_all_families = (rtm->rtm_family == AF_UNSPEC);
922921 filter->flags = rtm->rtm_flags;
923922 filter->protocol = rtm->rtm_protocol;
924923 filter->rt_type = rtm->rtm_type;
@@ -990,7 +989,7 @@ static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) · 65 unmodified lines
990989 if (filter.table_id) {
991990 tb = fib_get_table(net, filter.table_id);
992991 if (!tb) {
993− if (filter.dump_all_families)
992+ if (rtnl_msg_family(cb->nlh) != PF_INET)
994993 return skb->len;
995994
996995 NL_SET_ERR_MSG(cb->extack, "ipv4: FIB table does not exist");
net/ipv4/inet_connection_sock.c+24−19
@@ -24,17 +24,19 @@ · 23 unmodified lines
2424 #include <net/addrconf.h>
2525
2626 #if IS_ENABLED(CONFIG_IPV6)
27−/* match_wildcard == true: IPV6_ADDR_ANY equals to any IPv6 addresses if IPv6
28− * only, and any IPv4 addresses if not IPv6 only
29− * match_wildcard == false: addresses must be exactly the same, i.e.
30− * IPV6_ADDR_ANY only equals to IPV6_ADDR_ANY,
31− * and 0.0.0.0 equals to 0.0.0.0 only
27+/* match_sk*_wildcard == true: IPV6_ADDR_ANY equals to any IPv6 addresses
28+ * if IPv6 only, and any IPv4 addresses
29+ * if not IPv6 only
30+ * match_sk*_wildcard == false: addresses must be exactly the same, i.e.
31+ * IPV6_ADDR_ANY only equals to IPV6_ADDR_ANY,
32+ * and 0.0.0.0 equals to 0.0.0.0 only
3233 */
3334 static bool ipv6_rcv_saddr_equal(const struct in6_addr *sk1_rcv_saddr6,
3435 const struct in6_addr *sk2_rcv_saddr6,
3536 __be32 sk1_rcv_saddr, __be32 sk2_rcv_saddr,
3637 bool sk1_ipv6only, bool sk2_ipv6only,
37− bool match_wildcard)
38+ bool match_sk1_wildcard,
39+ bool match_sk2_wildcard)
3840 {
3941 int addr_type = ipv6_addr_type(sk1_rcv_saddr6);
4042 int addr_type2 = sk2_rcv_saddr6 ? ipv6_addr_type(sk2_rcv_saddr6) : IPV6_ADDR_MAPPED;
@@ -44,8 +46,8 @@ static bool ipv6_rcv_saddr_equal(const struct in6_addr *sk1_rcv_saddr6, · 3 unmodified lines
4446 if (!sk2_ipv6only) {
4547 if (sk1_rcv_saddr == sk2_rcv_saddr)
4648 return true;
47− if (!sk1_rcv_saddr || !sk2_rcv_saddr)
48− return match_wildcard;
49+ return (match_sk1_wildcard && !sk1_rcv_saddr) ||
50+ (match_sk2_wildcard && !sk2_rcv_saddr);
4951 }
5052 return false;
5153 }
@@ -53,11 +55,11 @@ static bool ipv6_rcv_saddr_equal(const struct in6_addr *sk1_rcv_saddr6, · 1 unmodified line
5355 if (addr_type == IPV6_ADDR_ANY && addr_type2 == IPV6_ADDR_ANY)
5456 return true;
5557
56− if (addr_type2 == IPV6_ADDR_ANY && match_wildcard &&
58+ if (addr_type2 == IPV6_ADDR_ANY && match_sk2_wildcard &&
5759 !(sk2_ipv6only && addr_type == IPV6_ADDR_MAPPED))
5860 return true;
5961
60− if (addr_type == IPV6_ADDR_ANY && match_wildcard &&
62+ if (addr_type == IPV6_ADDR_ANY && match_sk1_wildcard &&
6163 !(sk1_ipv6only && addr_type2 == IPV6_ADDR_MAPPED))
6264 return true;
6365
@@ -69,18 +71,19 @@ static bool ipv6_rcv_saddr_equal(const struct in6_addr *sk1_rcv_saddr6, · 5 unmodified lines
6971 }
7072 #endif
7173
72−/* match_wildcard == true: 0.0.0.0 equals to any IPv4 addresses
73− * match_wildcard == false: addresses must be exactly the same, i.e.
74− * 0.0.0.0 only equals to 0.0.0.0
74+/* match_sk*_wildcard == true: 0.0.0.0 equals to any IPv4 addresses
75+ * match_sk*_wildcard == false: addresses must be exactly the same, i.e.
76+ * 0.0.0.0 only equals to 0.0.0.0
7577 */
7678 static bool ipv4_rcv_saddr_equal(__be32 sk1_rcv_saddr, __be32 sk2_rcv_saddr,
77− bool sk2_ipv6only, bool match_wildcard)
79+ bool sk2_ipv6only, bool match_sk1_wildcard,
80+ bool match_sk2_wildcard)
7881 {
7982 if (!sk2_ipv6only) {
8083 if (sk1_rcv_saddr == sk2_rcv_saddr)
8184 return true;
82− if (!sk1_rcv_saddr || !sk2_rcv_saddr)
83− return match_wildcard;
85+ return (match_sk1_wildcard && !sk1_rcv_saddr) ||
86+ (match_sk2_wildcard && !sk2_rcv_saddr);
8487 }
8588 return false;
8689 }
@@ -96,10 +99,12 @@ bool inet_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2, · 9 unmodified lines
9699 sk2->sk_rcv_saddr,
97100 ipv6_only_sock(sk),
98101 ipv6_only_sock(sk2),
102+ match_wildcard,
99103 match_wildcard);
100104 #endif
101105 return ipv4_rcv_saddr_equal(sk->sk_rcv_saddr, sk2->sk_rcv_saddr,
102− ipv6_only_sock(sk2), match_wildcard);
106+ ipv6_only_sock(sk2), match_wildcard,
107+ match_wildcard);
103108 }
104109 EXPORT_SYMBOL(inet_rcv_saddr_equal);
105110
@@ -285,10 +290,10 @@ static inline int sk_reuseport_match(struct inet_bind_bucket *tb, · 179 unmodified lines
285290 tb->fast_rcv_saddr,
286291 sk->sk_rcv_saddr,
287292 tb->fast_ipv6_only,
288− ipv6_only_sock(sk), true);
293+ ipv6_only_sock(sk), true, false);
289294 #endif
290295 return ipv4_rcv_saddr_equal(tb->fast_rcv_saddr, sk->sk_rcv_saddr,
291− ipv6_only_sock(sk), true);
296+ ipv6_only_sock(sk), true, false);
292297 }
293298
294299 /* Obtain a reference to a local port for the given sock,
net/ipv4/ipip.c+1−1
@@ -698,7 +698,7 @@ out: · 697 unmodified lines
698698
699699 rtnl_link_failed:
700700 #if IS_ENABLED(CONFIG_MPLS)
701− xfrm4_tunnel_deregister(&mplsip_handler, AF_INET);
701+ xfrm4_tunnel_deregister(&mplsip_handler, AF_MPLS);
702702 xfrm_tunnel_mplsip_failed:
703703
704704 #endif
net/ipv4/ipmr.c+5−3
@@ -109,8 +109,10 @@ static void mroute_clean_tables(struct mr_table *mrt, int flags); · 108 unmodified lines
109109 static void ipmr_expire_process(struct timer_list *t);
110110
111111 #ifdef CONFIG_IP_MROUTE_MULTIPLE_TABLES
112−#define ipmr_for_each_table(mrt, net) \
113− list_for_each_entry_rcu(mrt, &net->ipv4.mr_tables, list)
112+#define ipmr_for_each_table(mrt, net) \
113+ list_for_each_entry_rcu(mrt, &net->ipv4.mr_tables, list, \
114+ lockdep_rtnl_is_held() || \
115+ list_empty(&net->ipv4.mr_tables))
114116
115117 static struct mr_table *ipmr_mr_table_iter(struct net *net,
116118 struct mr_table *mrt)
@@ -2611,7 +2613,7 @@ static int ipmr_rtm_dumproute(struct sk_buff *skb, struct netlink_callback *cb) · 2494 unmodified lines
26112613
26122614 mrt = ipmr_get_table(sock_net(skb->sk), filter.table_id);
26132615 if (!mrt) {
2614− if (filter.dump_all_families)
2616+ if (rtnl_msg_family(cb->nlh) != RTNL_FAMILY_IPMR)
26152617 return skb->len;
26162618
26172619 NL_SET_ERR_MSG(cb->extack, "ipv4: MR table does not exist");
net/ipv4/nexthop.c+2−1
@@ -276,6 +276,7 @@ out: · 275 unmodified lines
276276 return 0;
277277
278278 nla_put_failure:
279+ nlmsg_cancel(skb, nlh);
279280 return -EMSGSIZE;
280281 }
281282
@@ -433,7 +434,7 @@ static int nh_check_attr_group(struct net *net, struct nlattr *tb[], · 151 unmodified lines
433434 if (!valid_group_nh(nh, len, extack))
434435 return -EINVAL;
435436 }
436− for (i = NHA_GROUP + 1; i < __NHA_MAX; ++i) {
437+ for (i = NHA_GROUP_TYPE + 1; i < __NHA_MAX; ++i) {
437438 if (!tb[i])
438439 continue;
439440
net/ipv4/route.c+7−9
@@ -491,18 +491,16 @@ u32 ip_idents_reserve(u32 hash, int segs) · 490 unmodified lines
491491 atomic_t *p_id = ip_idents + hash % IP_IDENTS_SZ;
492492 u32 old = READ_ONCE(*p_tstamp);
493493 u32 now = (u32)jiffies;
494− u32 new, delta = 0;
494+ u32 delta = 0;
495495
496496 if (old != now && cmpxchg(p_tstamp, old, now) == old)
497497 delta = prandom_u32_max(now - old);
498498
499− /* Do not use atomic_add_return() as it makes UBSAN unhappy */
500− do {
501− old = (u32)atomic_read(p_id);
502− new = old + delta + segs;
503− } while (atomic_cmpxchg(p_id, old, new) != old);
504−
505− return new - segs;
499+ /* If UBSAN reports an error there, please make sure your compiler
500+ * supports -fno-strict-overflow before reporting it that was a bug
501+ * in UBSAN, and it has been fixed in GCC-8.
502+ */
503+ return atomic_add_return(segs + delta, p_id) - segs;
506504 }
507505 EXPORT_SYMBOL(ip_idents_reserve);
508506
@@ -915,7 +913,7 @@ void ip_rt_send_redirect(struct sk_buff *skb) · 406 unmodified lines
915913 /* Check for load limit; set rate_last to the latest sent
916914 * redirect.
917915 */
918− if (peer->rate_tokens == 0 ||
916+ if (peer->n_redirects == 0 ||
919917 time_after(jiffies,
920918 (peer->rate_last +
921919 (ip_rt_redirect_load << peer->n_redirects)))) {
net/ipv4/tcp.c+19−8
@@ -476,9 +476,17 @@ static void tcp_tx_timestamp(struct sock *sk, u16 tsflags) · 475 unmodified lines
476476 static inline bool tcp_stream_is_readable(const struct tcp_sock *tp,
477477 int target, struct sock *sk)
478478 {
479− return (READ_ONCE(tp->rcv_nxt) - READ_ONCE(tp->copied_seq) >= target) ||
480− (sk->sk_prot->stream_memory_read ?
481− sk->sk_prot->stream_memory_read(sk) : false);
479+ int avail = READ_ONCE(tp->rcv_nxt) - READ_ONCE(tp->copied_seq);
480+
481+ if (avail > 0) {
482+ if (avail >= target)
483+ return true;
484+ if (tcp_rmem_pressure(sk))
485+ return true;
486+ }
487+ if (sk->sk_prot->stream_memory_read)
488+ return sk->sk_prot->stream_memory_read(sk);
489+ return false;
482490 }
483491
484492 /*
@@ -1756,10 +1764,11 @@ static int tcp_zerocopy_receive(struct sock *sk, · 1271 unmodified lines
17561764
17571765 down_read(&current->mm->mmap_sem);
17581766
1759− ret = -EINVAL;
17601767 vma = find_vma(current->mm, address);
1761− if (!vma || vma->vm_start > address || vma->vm_ops != &tcp_vm_ops)
1762− goto out;
1768+ if (!vma || vma->vm_start > address || vma->vm_ops != &tcp_vm_ops) {
1769+ up_read(&current->mm->mmap_sem);
1770+ return -EINVAL;
1771+ }
17631772 zc->length = min_t(unsigned long, zc->length, vma->vm_end - address);
17641773
17651774 tp = tcp_sk(sk);
@@ -2154,13 +2163,15 @@ skip_copy: · 388 unmodified lines
21542163 tp->urg_data = 0;
21552164 tcp_fast_path_check(sk);
21562165 }
2157− if (used + offset < skb->len)
2158− continue;
21592166
21602167 if (TCP_SKB_CB(skb)->has_rxtstamp) {
21612168 tcp_update_recv_tstamps(skb, &tss);
21622169 cmsg_flags |= 2;
21632170 }
2171+
2172+ if (used + offset < skb->len)
2173+ continue;
2174+
21642175 if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)
21652176 goto found_fin_ok;
21662177 if (!(flags & MSG_PEEK))
net/ipv4/tcp_bpf.c+6−4
@@ -125,7 +125,6 @@ static int bpf_tcp_ingress(struct sock *sk, struct sk_psock *psock, · 124 unmodified lines
125125
126126 if (!ret) {
127127 msg->sg.start = i;
128− msg->sg.size -= apply_bytes;
129128 sk_psock_queue_msg(psock, tmp);
130129 sk_psock_data_ready(sk, psock);
131130 } else {
@@ -262,14 +261,17 @@ static int tcp_bpf_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, · 130 unmodified lines
262261 struct sk_psock *psock;
263262 int copied, ret;
264263
264+ if (unlikely(flags & MSG_ERRQUEUE))
265+ return inet_recv_error(sk, msg, len, addr_len);
266+
265267 psock = sk_psock_get(sk);
266268 if (unlikely(!psock))
267269 return tcp_recvmsg(sk, msg, len, nonblock, flags, addr_len);
268− if (unlikely(flags & MSG_ERRQUEUE))
269− return inet_recv_error(sk, msg, len, addr_len);
270270 if (!skb_queue_empty(&sk->sk_receive_queue) &&
271− sk_psock_queue_empty(psock))
271+ sk_psock_queue_empty(psock)) {
272+ sk_psock_put(sk, psock);
272273 return tcp_recvmsg(sk, msg, len, nonblock, flags, addr_len);
274+ }
273275 lock_sock(sk);
274276 msg_bytes_ready:
275277 copied = __tcp_bpf_recvmsg(sk, psock, msg, len, flags);
net/ipv4/tcp_input.c+2−1
@@ -4757,7 +4757,8 @@ void tcp_data_ready(struct sock *sk) · 4756 unmodified lines
47574757 const struct tcp_sock *tp = tcp_sk(sk);
47584758 int avail = tp->rcv_nxt - tp->copied_seq;
47594759
4760− if (avail < sk->sk_rcvlowat && !sock_flag(sk, SOCK_DONE))
4760+ if (avail < sk->sk_rcvlowat && !tcp_rmem_pressure(sk) &&
4761+ !sock_flag(sk, SOCK_DONE))
47614762 return;
47624763
47634764 sk->sk_data_ready(sk);
net/ipv6/calipso.c+2−1
@@ -1047,7 +1047,8 @@ static int calipso_opt_getattr(const unsigned char *calipso, · 1046 unmodified lines
10471047 goto getattr_return;
10481048 }
10491049
1050− secattr->flags |= NETLBL_SECATTR_MLS_CAT;
1050+ if (secattr->attr.mls.cat)
1051+ secattr->flags |= NETLBL_SECATTR_MLS_CAT;
10511052 }
10521053
10531054 secattr->type = NETLBL_NLTYPE_CALIPSO;
net/ipv6/ip6_fib.c+1−1
@@ -664,7 +664,7 @@ static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) · 663 unmodified lines
664664 if (arg.filter.table_id) {
665665 tb = fib6_get_table(net, arg.filter.table_id);
666666 if (!tb) {
667− if (arg.filter.dump_all_families)
667+ if (rtnl_msg_family(cb->nlh) != PF_INET6)
668668 goto out;
669669
670670 NL_SET_ERR_MSG_MOD(cb->extack, "FIB table does not exist");
net/ipv6/ip6mr.c+3−2
@@ -98,7 +98,8 @@ static void ipmr_expire_process(struct timer_list *t); · 97 unmodified lines
9898 #ifdef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES
9999 #define ip6mr_for_each_table(mrt, net) \
100100 list_for_each_entry_rcu(mrt, &net->ipv6.mr6_tables, list, \
101− lockdep_rtnl_is_held())
101+ lockdep_rtnl_is_held() || \
102+ list_empty(&net->ipv6.mr6_tables))
102103
103104 static struct mr_table *ip6mr_mr_table_iter(struct net *net,
104105 struct mr_table *mrt)
@@ -2502,7 +2503,7 @@ static int ip6mr_rtm_dumproute(struct sk_buff *skb, struct netlink_callback *cb) · 2397 unmodified lines
25022503
25032504 mrt = ip6mr_get_table(sock_net(skb->sk), filter.table_id);
25042505 if (!mrt) {
2505− if (filter.dump_all_families)
2506+ if (rtnl_msg_family(cb->nlh) != RTNL_FAMILY_IP6MR)
25062507 return skb->len;
25072508
25082509 NL_SET_ERR_MSG_MOD(cb->extack, "MR table does not exist");
net/ipv6/route.c+4−2
@@ -2722,8 +2722,10 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk, · 2721 unmodified lines
27222722 const struct in6_addr *daddr, *saddr;
27232723 struct rt6_info *rt6 = (struct rt6_info *)dst;
27242724
2725− if (dst_metric_locked(dst, RTAX_MTU))
2726− return;
2725+ /* Note: do *NOT* check dst_metric_locked(dst, RTAX_MTU)
2726+ * IPv6 pmtu discovery isn't optional, so 'mtu lock' cannot disable it.
2727+ * [see also comment in rt6_mtu_change_route()]
2728+ */
27272729
27282730 if (iph) {
27292731 daddr = &iph->daddr;
net/mptcp/crypto.c+9−15
@@ -47,8 +47,6 @@ void mptcp_crypto_key_sha(u64 key, u32 *token, u64 *idsn) · 46 unmodified lines
4747 void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u8 *msg, int len, void *hmac)
4848 {
4949 u8 input[SHA256_BLOCK_SIZE + SHA256_DIGEST_SIZE];
50− __be32 mptcp_hashed_key[SHA256_DIGEST_WORDS];
51− __be32 *hash_out = (__force __be32 *)hmac;
5250 struct sha256_state state;
5351 u8 key1be[8];
5452 u8 key2be[8];
@@ -86,11 +84,7 @@ void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u8 *msg, int len, void *hmac) · 31 unmodified lines
8684
8785 sha256_init(&state);
8886 sha256_update(&state, input, SHA256_BLOCK_SIZE + SHA256_DIGEST_SIZE);
89− sha256_final(&state, (u8 *)mptcp_hashed_key);
90−
91− /* takes only first 160 bits */
92− for (i = 0; i < 5; i++)
93− hash_out[i] = mptcp_hashed_key[i];
87+ sha256_final(&state, (u8 *)hmac);
9488 }
9589
9690 #ifdef CONFIG_MPTCP_HMAC_TEST
@@ -101,29 +95,29 @@ struct test_cast { · 4 unmodified lines
10195 };
10296
10397 /* we can't reuse RFC 4231 test vectors, as we have constraint on the
104− * input and key size, and we truncate the output.
98+ * input and key size.
10599 */
106100 static struct test_cast tests[] = {
107101 {
108102 .key = "0b0b0b0b0b0b0b0b",
109103 .msg = "48692054",
110− .result = "8385e24fb4235ac37556b6b886db106284a1da67",
104+ .result = "8385e24fb4235ac37556b6b886db106284a1da671699f46db1f235ec622dcafa",
111105 },
112106 {
113107 .key = "aaaaaaaaaaaaaaaa",
114108 .msg = "dddddddd",
115− .result = "2c5e219164ff1dca1c4a92318d847bb6b9d44492",
109+ .result = "2c5e219164ff1dca1c4a92318d847bb6b9d44492984e1eb71aff9022f71046e9",
116110 },
117111 {
118112 .key = "0102030405060708",
119113 .msg = "cdcdcdcd",
120− .result = "e73b9ba9969969cefb04aa0d6df18ec2fcc075b6",
114+ .result = "e73b9ba9969969cefb04aa0d6df18ec2fcc075b6f23b4d8c4da736a5dbbc6e7d",
121115 },
122116 };
123117
124118 static int __init test_mptcp_crypto(void)
125119 {
126− char hmac[20], hmac_hex[41];
120+ char hmac[32], hmac_hex[65];
127121 u32 nonce1, nonce2;
128122 u64 key1, key2;
129123 u8 msg[8];
@@ -140,11 +134,11 @@ static int __init test_mptcp_crypto(void) · 10 unmodified lines
140134 put_unaligned_be32(nonce2, &msg[4]);
141135
142136 mptcp_crypto_hmac_sha(key1, key2, msg, 8, hmac);
143− for (j = 0; j < 20; ++j)
137+ for (j = 0; j < 32; ++j)
144138 sprintf(&hmac_hex[j << 1], "%02x", hmac[j] & 0xff);
145− hmac_hex[40] = 0;
139+ hmac_hex[64] = 0;
146140
147− if (memcmp(hmac_hex, tests[i].result, 40))
141+ if (memcmp(hmac_hex, tests[i].result, 64))
148142 pr_err("test %d failed, got %s expected %s", i,
149143 hmac_hex, tests[i].result);
150144 else
net/mptcp/options.c+5−4
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 #define pr_fmt(fmt) "MPTCP: " fmt
88
99 #include <linux/kernel.h>
10+#include <crypto/sha.h>
1011 #include <net/tcp.h>
1112 #include <net/mptcp.h>
1213 #include "protocol.h"
@@ -535,7 +536,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, · 522 unmodified lines
535536 static u64 add_addr_generate_hmac(u64 key1, u64 key2, u8 addr_id,
536537 struct in_addr *addr)
537538 {
538− u8 hmac[MPTCP_ADDR_HMAC_LEN];
539+ u8 hmac[SHA256_DIGEST_SIZE];
539540 u8 msg[7];
540541
541542 msg[0] = addr_id;
@@ -545,14 +546,14 @@ static u64 add_addr_generate_hmac(u64 key1, u64 key2, u8 addr_id, · 3 unmodified lines
545546
546547 mptcp_crypto_hmac_sha(key1, key2, msg, 7, hmac);
547548
548− return get_unaligned_be64(hmac);
549+ return get_unaligned_be64(&hmac[SHA256_DIGEST_SIZE - sizeof(u64)]);
549550 }
550551
551552 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
552553 static u64 add_addr6_generate_hmac(u64 key1, u64 key2, u8 addr_id,
553554 struct in6_addr *addr)
554555 {
555− u8 hmac[MPTCP_ADDR_HMAC_LEN];
556+ u8 hmac[SHA256_DIGEST_SIZE];
556557 u8 msg[19];
557558
558559 msg[0] = addr_id;
@@ -562,7 +563,7 @@ static u64 add_addr6_generate_hmac(u64 key1, u64 key2, u8 addr_id, · 3 unmodified lines
562563
563564 mptcp_crypto_hmac_sha(key1, key2, msg, 19, hmac);
564565
565− return get_unaligned_be64(hmac);
566+ return get_unaligned_be64(&hmac[SHA256_DIGEST_SIZE - sizeof(u64)]);
566567 }
567568 #endif
568569
net/mptcp/protocol.c+2−0
@@ -1629,6 +1629,8 @@ bool mptcp_finish_join(struct sock *sk) · 1628 unmodified lines
16291629
16301630 ret = mptcp_pm_allow_new_subflow(msk);
16311631 if (ret) {
1632+ subflow->map_seq = msk->ack_seq;
1633+
16321634 /* active connections are already on conn_list */
16331635 spin_lock_bh(&msk->join_list_lock);
16341636 if (!WARN_ON_ONCE(!list_empty(&subflow->node)))
net/mptcp/protocol.h+0−1
@@ -81,7 +81,6 @@ · 80 unmodified lines
8181
8282 /* MPTCP ADD_ADDR flags */
8383 #define MPTCP_ADDR_ECHO BIT(0)
84−#define MPTCP_ADDR_HMAC_LEN 20
8584 #define MPTCP_ADDR_IPVERSION_4 4
8685 #define MPTCP_ADDR_IPVERSION_6 6
8786
net/mptcp/subflow.c+20−5
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #include <linux/module.h>
1111 #include <linux/netdevice.h>
1212 #include <crypto/algapi.h>
13+#include <crypto/sha.h>
1314 #include <net/sock.h>
1415 #include <net/inet_common.h>
1516 #include <net/inet_hashtables.h>
@@ -89,7 +90,7 @@ static bool subflow_token_join_request(struct request_sock *req, · 73 unmodified lines
8990 const struct sk_buff *skb)
9091 {
9192 struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
92− u8 hmac[MPTCPOPT_HMAC_LEN];
93+ u8 hmac[SHA256_DIGEST_SIZE];
9394 struct mptcp_sock *msk;
9495 int local_id;
9596
@@ -201,7 +202,7 @@ static void subflow_v6_init_req(struct request_sock *req, · 105 unmodified lines
201202 /* validate received truncated hmac and create hmac for third ACK */
202203 static bool subflow_thmac_valid(struct mptcp_subflow_context *subflow)
203204 {
204− u8 hmac[MPTCPOPT_HMAC_LEN];
205+ u8 hmac[SHA256_DIGEST_SIZE];
205206 u64 thmac;
206207
207208 subflow_generate_hmac(subflow->remote_key, subflow->local_key,
@@ -267,6 +268,8 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) · 59 unmodified lines
267268 subflow->ssn_offset = TCP_SKB_CB(skb)->seq;
268269 }
269270 } else if (subflow->mp_join) {
271+ u8 hmac[SHA256_DIGEST_SIZE];
272+
270273 pr_debug("subflow=%p, thmac=%llu, remote_nonce=%u",
271274 subflow, subflow->thmac,
272275 subflow->remote_nonce);
@@ -279,7 +282,9 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) · 6 unmodified lines
279282 subflow_generate_hmac(subflow->local_key, subflow->remote_key,
280283 subflow->local_nonce,
281284 subflow->remote_nonce,
282− subflow->hmac);
285+ hmac);
286+
287+ memcpy(subflow->hmac, hmac, MPTCPOPT_HMAC_LEN);
283288
284289 if (skb)
285290 subflow->ssn_offset = TCP_SKB_CB(skb)->seq;
@@ -347,7 +352,7 @@ static bool subflow_hmac_valid(const struct request_sock *req, · 61 unmodified lines
347352 const struct mptcp_options_received *mp_opt)
348353 {
349354 const struct mptcp_subflow_request_sock *subflow_req;
350− u8 hmac[MPTCPOPT_HMAC_LEN];
355+ u8 hmac[SHA256_DIGEST_SIZE];
351356 struct mptcp_sock *msk;
352357 bool ret;
353358
@@ -361,7 +366,7 @@ static bool subflow_hmac_valid(const struct request_sock *req, · 7 unmodified lines
361366 subflow_req->local_nonce, hmac);
362367
363368 ret = true;
364− if (crypto_memneq(hmac, mp_opt->hmac, sizeof(hmac)))
369+ if (crypto_memneq(hmac, mp_opt->hmac, MPTCPOPT_HMAC_LEN))
365370 ret = false;
366371
367372 sock_put((struct sock *)msk);
@@ -1012,6 +1017,16 @@ int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock) · 644 unmodified lines
10121017 if (err)
10131018 return err;
10141019
1020+ /* the newly created socket really belongs to the owning MPTCP master
1021+ * socket, even if for additional subflows the allocation is performed
1022+ * by a kernel workqueue. Adjust inode references, so that the
1023+ * procfs/diag interaces really show this one belonging to the correct
1024+ * user.
1025+ */
1026+ SOCK_INODE(sf)->i_ino = SOCK_INODE(sk->sk_socket)->i_ino;
1027+ SOCK_INODE(sf)->i_uid = SOCK_INODE(sk->sk_socket)->i_uid;
1028+ SOCK_INODE(sf)->i_gid = SOCK_INODE(sk->sk_socket)->i_gid;
1029+
10151030 subflow = mptcp_subflow_ctx(sf->sk);
10161031 pr_debug("subflow=%p", subflow);
10171032
net/netfilter/nf_conntrack_core.c+14−3
@@ -1519,9 +1519,9 @@ __nf_conntrack_alloc(struct net *net, · 1518 unmodified lines
15191519 ct->status = 0;
15201520 ct->timeout = 0;
15211521 write_pnet(&ct->ct_net, net);
1522− memset(&ct->__nfct_init_offset[0], 0,
1522+ memset(&ct->__nfct_init_offset, 0,
15231523 offsetof(struct nf_conn, proto) -
1524− offsetof(struct nf_conn, __nfct_init_offset[0]));
1524+ offsetof(struct nf_conn, __nfct_init_offset));
15251525
15261526 nf_ct_zone_add(ct, zone);
15271527
@@ -2139,8 +2139,19 @@ get_next_corpse(int (*iter)(struct nf_conn *i, void *data), · 611 unmodified lines
21392139 nf_conntrack_lock(lockp);
21402140 if (*bucket < nf_conntrack_htable_size) {
21412141 hlist_nulls_for_each_entry(h, n, &nf_conntrack_hash[*bucket], hnnode) {
2142− if (NF_CT_DIRECTION(h) != IP_CT_DIR_ORIGINAL)
2142+ if (NF_CT_DIRECTION(h) != IP_CT_DIR_REPLY)
21432143 continue;
2144+ /* All nf_conn objects are added to hash table twice, one
2145+ * for original direction tuple, once for the reply tuple.
2146+ *
2147+ * Exception: In the IPS_NAT_CLASH case, only the reply
2148+ * tuple is added (the original tuple already existed for
2149+ * a different object).
2150+ *
2151+ * We only need to call the iterator once for each
2152+ * conntrack, so we just use the 'reply' direction
2153+ * tuple while iterating.
2154+ */
21442155 ct = nf_ct_tuplehash_to_ctrack(h);
21452156 if (iter(ct, data))
21462157 goto found;
net/netfilter/nf_flow_table_core.c+5−3
@@ -284,7 +284,7 @@ static void flow_offload_del(struct nf_flowtable *flow_table, · 283 unmodified lines
284284
285285 if (nf_flow_has_expired(flow))
286286 flow_offload_fixup_ct(flow->ct);
287− else if (test_bit(NF_FLOW_TEARDOWN, &flow->flags))
287+ else
288288 flow_offload_fixup_ct_timeout(flow->ct);
289289
290290 flow_offload_free(flow);
@@ -361,8 +361,10 @@ static void nf_flow_offload_gc_step(struct flow_offload *flow, void *data) · 70 unmodified lines
361361 {
362362 struct nf_flowtable *flow_table = data;
363363
364− if (nf_flow_has_expired(flow) || nf_ct_is_dying(flow->ct) ||
365− test_bit(NF_FLOW_TEARDOWN, &flow->flags)) {
364+ if (nf_flow_has_expired(flow) || nf_ct_is_dying(flow->ct))
365+ set_bit(NF_FLOW_TEARDOWN, &flow->flags);
366+
367+ if (test_bit(NF_FLOW_TEARDOWN, &flow->flags)) {
366368 if (test_bit(NF_FLOW_HW, &flow->flags)) {
367369 if (!test_bit(NF_FLOW_HW_DYING, &flow->flags))
368370 nf_flow_offload_del(flow_table, flow);
net/netfilter/nf_flow_table_offload.c+8−2
@@ -817,6 +817,7 @@ static void flow_offload_work_handler(struct work_struct *work) · 816 unmodified lines
817817 WARN_ON_ONCE(1);
818818 }
819819
820+ clear_bit(NF_FLOW_HW_PENDING, &offload->flow->flags);
820821 kfree(offload);
821822 }
822823
@@ -831,9 +832,14 @@ nf_flow_offload_work_alloc(struct nf_flowtable *flowtable, · 8 unmodified lines
831832 {
832833 struct flow_offload_work *offload;
833834
835+ if (test_and_set_bit(NF_FLOW_HW_PENDING, &flow->flags))
836+ return NULL;
837+
834838 offload = kmalloc(sizeof(struct flow_offload_work), GFP_ATOMIC);
835− if (!offload)
839+ if (!offload) {
840+ clear_bit(NF_FLOW_HW_PENDING, &flow->flags);
836841 return NULL;
842+ }
837843
838844 offload->cmd = cmd;
839845 offload->flow = flow;
@@ -1056,7 +1062,7 @@ static struct flow_indr_block_entry block_ing_entry = { · 216 unmodified lines
10561062 int nf_flow_table_offload_init(void)
10571063 {
10581064 nf_flow_offload_wq = alloc_workqueue("nf_flow_table_offload",
1059− WQ_UNBOUND | WQ_MEM_RECLAIM, 0);
1065+ WQ_UNBOUND, 0);
10601066 if (!nf_flow_offload_wq)
10611067 return -ENOMEM;
10621068
net/netfilter/nft_set_rbtree.c+11−0
@@ -79,6 +79,10 @@ static bool __nft_rbtree_lookup(const struct net *net, const struct nft_set *set · 78 unmodified lines
7979 parent = rcu_dereference_raw(parent->rb_left);
8080 continue;
8181 }
82+
83+ if (nft_set_elem_expired(&rbe->ext))
84+ return false;
85+
8286 if (nft_rbtree_interval_end(rbe)) {
8387 if (nft_set_is_anonymous(set))
8488 return false;
@@ -94,6 +98,7 @@ static bool __nft_rbtree_lookup(const struct net *net, const struct nft_set *set · 9 unmodified lines
9498
9599 if (set->flags & NFT_SET_INTERVAL && interval != NULL &&
96100 nft_set_elem_active(&interval->ext, genmask) &&
101+ !nft_set_elem_expired(&interval->ext) &&
97102 nft_rbtree_interval_start(interval)) {
98103 *ext = &interval->ext;
99104 return true;
@@ -154,6 +159,9 @@ static bool __nft_rbtree_get(const struct net *net, const struct nft_set *set, · 54 unmodified lines
154159 continue;
155160 }
156161
162+ if (nft_set_elem_expired(&rbe->ext))
163+ return false;
164+
157165 if (!nft_set_ext_exists(&rbe->ext, NFT_SET_EXT_FLAGS) ||
158166 (*nft_set_ext_flags(&rbe->ext) & NFT_SET_ELEM_INTERVAL_END) ==
159167 (flags & NFT_SET_ELEM_INTERVAL_END)) {
@@ -170,6 +178,7 @@ static bool __nft_rbtree_get(const struct net *net, const struct nft_set *set, · 10 unmodified lines
170178
171179 if (set->flags & NFT_SET_INTERVAL && interval != NULL &&
172180 nft_set_elem_active(&interval->ext, genmask) &&
181+ !nft_set_elem_expired(&interval->ext) &&
173182 ((!nft_rbtree_interval_end(interval) &&
174183 !(flags & NFT_SET_ELEM_INTERVAL_END)) ||
175184 (nft_rbtree_interval_end(interval) &&
@@ -418,6 +427,8 @@ static void nft_rbtree_walk(const struct nft_ctx *ctx, · 242 unmodified lines
418427
419428 if (iter->count < iter->skip)
420429 goto cont;
430+ if (nft_set_elem_expired(&rbe->ext))
431+ goto cont;
421432 if (!nft_set_elem_active(&rbe->ext, iter->genmask))
422433 goto cont;
423434
net/netlabel/netlabel_kapi.c+6−0
@@ -734,6 +734,12 @@ int netlbl_catmap_getlong(struct netlbl_lsm_catmap *catmap, · 733 unmodified lines
734734 if ((off & (BITS_PER_LONG - 1)) != 0)
735735 return -EINVAL;
736736
737+ /* a null catmap is equivalent to an empty one */
738+ if (!catmap) {
739+ *offset = (u32)-1;
740+ return 0;
741+ }
742+
737743 if (off < catmap->startbit) {
738744 off = catmap->startbit;
739745 *offset = off;
net/qrtr/qrtr.c+1−1
@@ -854,7 +854,7 @@ static int qrtr_bcast_enqueue(struct qrtr_node *node, struct sk_buff *skb, · 853 unmodified lines
854854 }
855855 mutex_unlock(&qrtr_node_lock);
856856
857− qrtr_local_enqueue(node, skb, type, from, to);
857+ qrtr_local_enqueue(NULL, skb, type, from, to);
858858
859859 return 0;
860860 }
net/rxrpc/Makefile+1−0
@@ -25,6 +25,7 @@ rxrpc-y := \ · 24 unmodified lines
2525 peer_event.o \
2626 peer_object.o \
2727 recvmsg.o \
28+ rtt.o \
2829 security.o \
2930 sendmsg.o \
3031 skbuff.o \
net/rxrpc/ar-internal.h+17−8
@@ -7,6 +7,7 @@ · 6 unmodified lines
77
88 #include <linux/atomic.h>
99 #include <linux/seqlock.h>
10+#include <linux/win_minmax.h>
1011 #include <net/net_namespace.h>
1112 #include <net/netns/generic.h>
1213 #include <net/sock.h>
@@ -311,11 +312,14 @@ struct rxrpc_peer { · 298 unmodified lines
311312 #define RXRPC_RTT_CACHE_SIZE 32
312313 spinlock_t rtt_input_lock; /* RTT lock for input routine */
313314 ktime_t rtt_last_req; /* Time of last RTT request */
314− u64 rtt; /* Current RTT estimate (in nS) */
315− u64 rtt_sum; /* Sum of cache contents */
316− u64 rtt_cache[RXRPC_RTT_CACHE_SIZE]; /* Determined RTT cache */
317− u8 rtt_cursor; /* next entry at which to insert */
318− u8 rtt_usage; /* amount of cache actually used */
315+ unsigned int rtt_count; /* Number of samples we've got */
316+
317+ u32 srtt_us; /* smoothed round trip time << 3 in usecs */
318+ u32 mdev_us; /* medium deviation */
319+ u32 mdev_max_us; /* maximal mdev for the last rtt period */
320+ u32 rttvar_us; /* smoothed mdev_max */
321+ u32 rto_j; /* Retransmission timeout in jiffies */
322+ u8 backoff; /* Backoff timeout */
319323
320324 u8 cong_cwnd; /* Congestion window size */
321325 };
@@ -1041,7 +1045,6 @@ extern unsigned long rxrpc_idle_ack_delay; · 719 unmodified lines
10411045 extern unsigned int rxrpc_rx_window_size;
10421046 extern unsigned int rxrpc_rx_mtu;
10431047 extern unsigned int rxrpc_rx_jumbo_max;
1044−extern unsigned long rxrpc_resend_timeout;
10451048
10461049 extern const s8 rxrpc_ack_priority[];
10471050
@@ -1069,8 +1072,6 @@ void rxrpc_send_keepalive(struct rxrpc_peer *); · 21 unmodified lines
10691072 * peer_event.c
10701073 */
10711074 void rxrpc_error_report(struct sock *);
1072−void rxrpc_peer_add_rtt(struct rxrpc_call *, enum rxrpc_rtt_rx_trace,
1073− rxrpc_serial_t, rxrpc_serial_t, ktime_t, ktime_t);
10741075 void rxrpc_peer_keepalive_worker(struct work_struct *);
10751076
10761077 /*
@@ -1102,6 +1103,14 @@ extern const struct seq_operations rxrpc_peer_seq_ops; · 25 unmodified lines
11021103 void rxrpc_notify_socket(struct rxrpc_call *);
11031104 int rxrpc_recvmsg(struct socket *, struct msghdr *, size_t, int);
11041105
1106+/*
1107+ * rtt.c
1108+ */
1109+void rxrpc_peer_add_rtt(struct rxrpc_call *, enum rxrpc_rtt_rx_trace,
1110+ rxrpc_serial_t, rxrpc_serial_t, ktime_t, ktime_t);
1111+unsigned long rxrpc_get_rto_backoff(struct rxrpc_peer *, bool);
1112+void rxrpc_peer_init_rtt(struct rxrpc_peer *);
1113+
11051114 /*
11061115 * rxkad.c
11071116 */
net/rxrpc/call_accept.c+1−1
@@ -248,7 +248,7 @@ static void rxrpc_send_ping(struct rxrpc_call *call, struct sk_buff *skb) · 247 unmodified lines
248248 struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
249249 ktime_t now = skb->tstamp;
250250
251− if (call->peer->rtt_usage < 3 ||
251+ if (call->peer->rtt_count < 3 ||
252252 ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000), now))
253253 rxrpc_propose_ACK(call, RXRPC_ACK_PING, sp->hdr.serial,
254254 true, true,
net/rxrpc/call_event.c+8−14
@@ -111,8 +111,8 @@ static void __rxrpc_propose_ACK(struct rxrpc_call *call, u8 ack_reason, · 110 unmodified lines
111111 } else {
112112 unsigned long now = jiffies, ack_at;
113113
114− if (call->peer->rtt_usage > 0)
115− ack_at = nsecs_to_jiffies(call->peer->rtt);
114+ if (call->peer->srtt_us != 0)
115+ ack_at = usecs_to_jiffies(call->peer->srtt_us >> 3);
116116 else
117117 ack_at = expiry;
118118
@@ -157,24 +157,18 @@ static void rxrpc_congestion_timeout(struct rxrpc_call *call) · 38 unmodified lines
157157 static void rxrpc_resend(struct rxrpc_call *call, unsigned long now_j)
158158 {
159159 struct sk_buff *skb;
160− unsigned long resend_at;
160+ unsigned long resend_at, rto_j;
161161 rxrpc_seq_t cursor, seq, top;
162− ktime_t now, max_age, oldest, ack_ts, timeout, min_timeo;
162+ ktime_t now, max_age, oldest, ack_ts;
163163 int ix;
164164 u8 annotation, anno_type, retrans = 0, unacked = 0;
165165
166166 _enter("{%d,%d}", call->tx_hard_ack, call->tx_top);
167167
168− if (call->peer->rtt_usage > 1)
169− timeout = ns_to_ktime(call->peer->rtt * 3 / 2);
170− else
171− timeout = ms_to_ktime(rxrpc_resend_timeout);
172− min_timeo = ns_to_ktime((1000000000 / HZ) * 4);
173− if (ktime_before(timeout, min_timeo))
174− timeout = min_timeo;
168+ rto_j = call->peer->rto_j;
175169
176170 now = ktime_get_real();
177− max_age = ktime_sub(now, timeout);
171+ max_age = ktime_sub(now, jiffies_to_usecs(rto_j));
178172
179173 spin_lock_bh(&call->lock);
180174
@@ -219,7 +213,7 @@ static void rxrpc_resend(struct rxrpc_call *call, unsigned long now_j) · 38 unmodified lines
219213 }
220214
221215 resend_at = nsecs_to_jiffies(ktime_to_ns(ktime_sub(now, oldest)));
222− resend_at += jiffies + rxrpc_resend_timeout;
216+ resend_at += jiffies + rto_j;
223217 WRITE_ONCE(call->resend_at, resend_at);
224218
225219 if (unacked)
@@ -234,7 +228,7 @@ static void rxrpc_resend(struct rxrpc_call *call, unsigned long now_j) · 8 unmodified lines
234228 rxrpc_timer_set_for_resend);
235229 spin_unlock_bh(&call->lock);
236230 ack_ts = ktime_sub(now, call->acks_latest_ts);
237− if (ktime_to_ns(ack_ts) < call->peer->rtt)
231+ if (ktime_to_us(ack_ts) < (call->peer->srtt_us >> 3))
238232 goto out;
239233 rxrpc_propose_ACK(call, RXRPC_ACK_PING, 0, true, false,
240234 rxrpc_propose_ack_ping_for_lost_ack);
net/rxrpc/input.c+37−7
@@ -91,11 +91,11 @@ static void rxrpc_congestion_management(struct rxrpc_call *call, · 90 unmodified lines
9191 /* We analyse the number of packets that get ACK'd per RTT
9292 * period and increase the window if we managed to fill it.
9393 */
94− if (call->peer->rtt_usage == 0)
94+ if (call->peer->rtt_count == 0)
9595 goto out;
9696 if (ktime_before(skb->tstamp,
97− ktime_add_ns(call->cong_tstamp,
98− call->peer->rtt)))
97+ ktime_add_us(call->cong_tstamp,
98+ call->peer->srtt_us >> 3)))
9999 goto out_no_clear_ca;
100100 change = rxrpc_cong_rtt_window_end;
101101 call->cong_tstamp = skb->tstamp;
@@ -802,6 +802,30 @@ static void rxrpc_input_soft_acks(struct rxrpc_call *call, u8 *acks, · 700 unmodified lines
802802 }
803803 }
804804
805+/*
806+ * Return true if the ACK is valid - ie. it doesn't appear to have regressed
807+ * with respect to the ack state conveyed by preceding ACKs.
808+ */
809+static bool rxrpc_is_ack_valid(struct rxrpc_call *call,
810+ rxrpc_seq_t first_pkt, rxrpc_seq_t prev_pkt)
811+{
812+ rxrpc_seq_t base = READ_ONCE(call->ackr_first_seq);
813+
814+ if (after(first_pkt, base))
815+ return true; /* The window advanced */
816+
817+ if (before(first_pkt, base))
818+ return false; /* firstPacket regressed */
819+
820+ if (after_eq(prev_pkt, call->ackr_prev_seq))
821+ return true; /* previousPacket hasn't regressed. */
822+
823+ /* Some rx implementations put a serial number in previousPacket. */
824+ if (after_eq(prev_pkt, base + call->tx_winsize))
825+ return false;
826+ return true;
827+}
828+
805829 /*
806830 * Process an ACK packet.
807831 *
@@ -865,9 +889,12 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 57 unmodified lines
865889 }
866890
867891 /* Discard any out-of-order or duplicate ACKs (outside lock). */
868− if (before(first_soft_ack, call->ackr_first_seq) ||
869− before(prev_pkt, call->ackr_prev_seq))
892+ if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) {
893+ trace_rxrpc_rx_discard_ack(call->debug_id, sp->hdr.serial,
894+ first_soft_ack, call->ackr_first_seq,
895+ prev_pkt, call->ackr_prev_seq);
870896 return;
897+ }
871898
872899 buf.info.rxMTU = 0;
873900 ioffset = offset + nr_acks + 3;
@@ -878,9 +905,12 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 4 unmodified lines
878905 spin_lock(&call->input_lock);
879906
880907 /* Discard any out-of-order or duplicate ACKs (inside lock). */
881− if (before(first_soft_ack, call->ackr_first_seq) ||
882− before(prev_pkt, call->ackr_prev_seq))
908+ if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) {
909+ trace_rxrpc_rx_discard_ack(call->debug_id, sp->hdr.serial,
910+ first_soft_ack, call->ackr_first_seq,
911+ prev_pkt, call->ackr_prev_seq);
883912 goto out;
913+ }
884914 call->acks_latest_ts = skb->tstamp;
885915
886916 call->ackr_first_seq = first_soft_ack;
net/rxrpc/misc.c+0−5
@@ -63,11 +63,6 @@ unsigned int rxrpc_rx_mtu = 5692; · 62 unmodified lines
6363 */
6464 unsigned int rxrpc_rx_jumbo_max = 4;
6565
66−/*
67− * Time till packet resend (in milliseconds).
68− */
69−unsigned long rxrpc_resend_timeout = 4 * HZ;
70−
7166 const s8 rxrpc_ack_priority[] = {
7267 [0] = 0,
7368 [RXRPC_ACK_DELAY] = 1,
net/rxrpc/output.c+3−6
@@ -369,7 +369,7 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb, · 368 unmodified lines
369369 (test_and_clear_bit(RXRPC_CALL_EV_ACK_LOST, &call->events) ||
370370 retrans ||
371371 call->cong_mode == RXRPC_CALL_SLOW_START ||
372− (call->peer->rtt_usage < 3 && sp->hdr.seq & 1) ||
372+ (call->peer->rtt_count < 3 && sp->hdr.seq & 1) ||
373373 ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000),
374374 ktime_get_real())))
375375 whdr.flags |= RXRPC_REQUEST_ACK;
@@ -423,13 +423,10 @@ done: · 47 unmodified lines
423423 if (whdr.flags & RXRPC_REQUEST_ACK) {
424424 call->peer->rtt_last_req = skb->tstamp;
425425 trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_data, serial);
426− if (call->peer->rtt_usage > 1) {
426+ if (call->peer->rtt_count > 1) {
427427 unsigned long nowj = jiffies, ack_lost_at;
428428
429− ack_lost_at = nsecs_to_jiffies(2 * call->peer->rtt);
430− if (ack_lost_at < 1)
431− ack_lost_at = 1;
432−
429+ ack_lost_at = rxrpc_get_rto_backoff(call->peer, retrans);
433430 ack_lost_at += nowj;
434431 WRITE_ONCE(call->ack_lost_at, ack_lost_at);
435432 rxrpc_reduce_call_timer(call, ack_lost_at, nowj,
net/rxrpc/peer_event.c+0−46
@@ -295,52 +295,6 @@ static void rxrpc_distribute_error(struct rxrpc_peer *peer, int error, · 294 unmodified lines
295295 }
296296 }
297297
298−/*
299− * Add RTT information to cache. This is called in softirq mode and has
300− * exclusive access to the peer RTT data.
301− */
302−void rxrpc_peer_add_rtt(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
303− rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
304− ktime_t send_time, ktime_t resp_time)
305−{
306− struct rxrpc_peer *peer = call->peer;
307− s64 rtt;
308− u64 sum = peer->rtt_sum, avg;
309− u8 cursor = peer->rtt_cursor, usage = peer->rtt_usage;
310−
311− rtt = ktime_to_ns(ktime_sub(resp_time, send_time));
312− if (rtt < 0)
313− return;
314−
315− spin_lock(&peer->rtt_input_lock);
316−
317− /* Replace the oldest datum in the RTT buffer */
318− sum -= peer->rtt_cache[cursor];
319− sum += rtt;
320− peer->rtt_cache[cursor] = rtt;
321− peer->rtt_cursor = (cursor + 1) & (RXRPC_RTT_CACHE_SIZE - 1);
322− peer->rtt_sum = sum;
323− if (usage < RXRPC_RTT_CACHE_SIZE) {
324− usage++;
325− peer->rtt_usage = usage;
326− }
327−
328− spin_unlock(&peer->rtt_input_lock);
329−
330− /* Now recalculate the average */
331− if (usage == RXRPC_RTT_CACHE_SIZE) {
332− avg = sum / RXRPC_RTT_CACHE_SIZE;
333− } else {
334− avg = sum;
335− do_div(avg, usage);
336− }
337−
338− /* Don't need to update this under lock */
339− peer->rtt = avg;
340− trace_rxrpc_rtt_rx(call, why, send_serial, resp_serial, rtt,
341− usage, avg);
342−}
343−
344298 /*
345299 * Perform keep-alive pings.
346300 */
net/rxrpc/peer_object.c+7−5
@@ -225,6 +225,8 @@ struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *local, gfp_t gfp) · 224 unmodified lines
225225 spin_lock_init(&peer->rtt_input_lock);
226226 peer->debug_id = atomic_inc_return(&rxrpc_debug_id);
227227
228+ rxrpc_peer_init_rtt(peer);
229+
228230 if (RXRPC_TX_SMSS > 2190)
229231 peer->cong_cwnd = 2;
230232 else if (RXRPC_TX_SMSS > 1095)
@@ -497,14 +499,14 @@ void rxrpc_kernel_get_peer(struct socket *sock, struct rxrpc_call *call, · 266 unmodified lines
497499 EXPORT_SYMBOL(rxrpc_kernel_get_peer);
498500
499501 /**
500− * rxrpc_kernel_get_rtt - Get a call's peer RTT
502+ * rxrpc_kernel_get_srtt - Get a call's peer smoothed RTT
501503 * @sock: The socket on which the call is in progress.
502504 * @call: The call to query
503505 *
504− * Get the call's peer RTT.
506+ * Get the call's peer smoothed RTT.
505507 */
506−u64 rxrpc_kernel_get_rtt(struct socket *sock, struct rxrpc_call *call)
508+u32 rxrpc_kernel_get_srtt(struct socket *sock, struct rxrpc_call *call)
507509 {
508− return call->peer->rtt;
510+ return call->peer->srtt_us >> 3;
509511 }
510−EXPORT_SYMBOL(rxrpc_kernel_get_rtt);
512+EXPORT_SYMBOL(rxrpc_kernel_get_srtt);
net/rxrpc/proc.c+4−4
@@ -222,7 +222,7 @@ static int rxrpc_peer_seq_show(struct seq_file *seq, void *v) · 221 unmodified lines
222222 seq_puts(seq,
223223 "Proto Local "
224224 " Remote "
225− " Use CW MTU LastUse RTT Rc\n"
225+ " Use CW MTU LastUse RTT RTO\n"
226226 );
227227 return 0;
228228 }
@@ -236,15 +236,15 @@ static int rxrpc_peer_seq_show(struct seq_file *seq, void *v) · 7 unmodified lines
236236 now = ktime_get_seconds();
237237 seq_printf(seq,
238238 "UDP %-47.47s %-47.47s %3u"
239− " %3u %5u %6llus %12llu %2u\n",
239+ " %3u %5u %6llus %8u %8u\n",
240240 lbuff,
241241 rbuff,
242242 atomic_read(&peer->usage),
243243 peer->cong_cwnd,
244244 peer->mtu,
245245 now - peer->last_tx_at,
246− peer->rtt,
247− peer->rtt_cursor);
246+ peer->srtt_us >> 3,
247+ jiffies_to_usecs(peer->rto_j));
248248
249249 return 0;
250250 }
net/rxrpc/rtt.c+195−0
@@ -0,0 +1,195 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/* RTT/RTO calculation.
3+ *
4+ * Adapted from TCP for AF_RXRPC by David Howells (dhowells@redhat.com)
5+ *
6+ * https://tools.ietf.org/html/rfc6298
7+ * https://tools.ietf.org/html/rfc1122#section-4.2.3.1
8+ * http://ccr.sigcomm.org/archive/1995/jan95/ccr-9501-partridge87.pdf
9+ */
10+
11+#include <linux/net.h>
12+#include "ar-internal.h"
13+
14+#define RXRPC_RTO_MAX ((unsigned)(120 * HZ))
15+#define RXRPC_TIMEOUT_INIT ((unsigned)(1*HZ)) /* RFC6298 2.1 initial RTO value */
16+#define rxrpc_jiffies32 ((u32)jiffies) /* As rxrpc_jiffies32 */
17+#define rxrpc_min_rtt_wlen 300 /* As sysctl_tcp_min_rtt_wlen */
18+
19+static u32 rxrpc_rto_min_us(struct rxrpc_peer *peer)
20+{
21+ return 200;
22+}
23+
24+static u32 __rxrpc_set_rto(const struct rxrpc_peer *peer)
25+{
26+ return _usecs_to_jiffies((peer->srtt_us >> 3) + peer->rttvar_us);
27+}
28+
29+static u32 rxrpc_bound_rto(u32 rto)
30+{
31+ return min(rto, RXRPC_RTO_MAX);
32+}
33+
34+/*
35+ * Called to compute a smoothed rtt estimate. The data fed to this
36+ * routine either comes from timestamps, or from segments that were
37+ * known _not_ to have been retransmitted [see Karn/Partridge
38+ * Proceedings SIGCOMM 87]. The algorithm is from the SIGCOMM 88
39+ * piece by Van Jacobson.
40+ * NOTE: the next three routines used to be one big routine.
41+ * To save cycles in the RFC 1323 implementation it was better to break
42+ * it up into three procedures. -- erics
43+ */
44+static void rxrpc_rtt_estimator(struct rxrpc_peer *peer, long sample_rtt_us)
45+{
46+ long m = sample_rtt_us; /* RTT */
47+ u32 srtt = peer->srtt_us;
48+
49+ /* The following amusing code comes from Jacobson's
50+ * article in SIGCOMM '88. Note that rtt and mdev
51+ * are scaled versions of rtt and mean deviation.
52+ * This is designed to be as fast as possible
53+ * m stands for "measurement".
54+ *
55+ * On a 1990 paper the rto value is changed to:
56+ * RTO = rtt + 4 * mdev
57+ *
58+ * Funny. This algorithm seems to be very broken.
59+ * These formulae increase RTO, when it should be decreased, increase
60+ * too slowly, when it should be increased quickly, decrease too quickly
61+ * etc. I guess in BSD RTO takes ONE value, so that it is absolutely
62+ * does not matter how to _calculate_ it. Seems, it was trap
63+ * that VJ failed to avoid. 8)
64+ */
65+ if (srtt != 0) {
66+ m -= (srtt >> 3); /* m is now error in rtt est */
67+ srtt += m; /* rtt = 7/8 rtt + 1/8 new */
68+ if (m < 0) {
69+ m = -m; /* m is now abs(error) */
70+ m -= (peer->mdev_us >> 2); /* similar update on mdev */
71+ /* This is similar to one of Eifel findings.
72+ * Eifel blocks mdev updates when rtt decreases.
73+ * This solution is a bit different: we use finer gain
74+ * for mdev in this case (alpha*beta).
75+ * Like Eifel it also prevents growth of rto,
76+ * but also it limits too fast rto decreases,
77+ * happening in pure Eifel.
78+ */
79+ if (m > 0)
80+ m >>= 3;
81+ } else {
82+ m -= (peer->mdev_us >> 2); /* similar update on mdev */
83+ }
84+
85+ peer->mdev_us += m; /* mdev = 3/4 mdev + 1/4 new */
86+ if (peer->mdev_us > peer->mdev_max_us) {
87+ peer->mdev_max_us = peer->mdev_us;
88+ if (peer->mdev_max_us > peer->rttvar_us)
89+ peer->rttvar_us = peer->mdev_max_us;
90+ }
91+ } else {
92+ /* no previous measure. */
93+ srtt = m << 3; /* take the measured time to be rtt */
94+ peer->mdev_us = m << 1; /* make sure rto = 3*rtt */
95+ peer->rttvar_us = max(peer->mdev_us, rxrpc_rto_min_us(peer));
96+ peer->mdev_max_us = peer->rttvar_us;
97+ }
98+
99+ peer->srtt_us = max(1U, srtt);
100+}
101+
102+/*
103+ * Calculate rto without backoff. This is the second half of Van Jacobson's
104+ * routine referred to above.
105+ */
106+static void rxrpc_set_rto(struct rxrpc_peer *peer)
107+{
108+ u32 rto;
109+
110+ /* 1. If rtt variance happened to be less 50msec, it is hallucination.
111+ * It cannot be less due to utterly erratic ACK generation made
112+ * at least by solaris and freebsd. "Erratic ACKs" has _nothing_
113+ * to do with delayed acks, because at cwnd>2 true delack timeout
114+ * is invisible. Actually, Linux-2.4 also generates erratic
115+ * ACKs in some circumstances.
116+ */
117+ rto = __rxrpc_set_rto(peer);
118+
119+ /* 2. Fixups made earlier cannot be right.
120+ * If we do not estimate RTO correctly without them,
121+ * all the algo is pure shit and should be replaced
122+ * with correct one. It is exactly, which we pretend to do.
123+ */
124+
125+ /* NOTE: clamping at RXRPC_RTO_MIN is not required, current algo
126+ * guarantees that rto is higher.
127+ */
128+ peer->rto_j = rxrpc_bound_rto(rto);
129+}
130+
131+static void rxrpc_ack_update_rtt(struct rxrpc_peer *peer, long rtt_us)
132+{
133+ if (rtt_us < 0)
134+ return;
135+
136+ //rxrpc_update_rtt_min(peer, rtt_us);
137+ rxrpc_rtt_estimator(peer, rtt_us);
138+ rxrpc_set_rto(peer);
139+
140+ /* RFC6298: only reset backoff on valid RTT measurement. */
141+ peer->backoff = 0;
142+}
143+
144+/*
145+ * Add RTT information to cache. This is called in softirq mode and has
146+ * exclusive access to the peer RTT data.
147+ */
148+void rxrpc_peer_add_rtt(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
149+ rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
150+ ktime_t send_time, ktime_t resp_time)
151+{
152+ struct rxrpc_peer *peer = call->peer;
153+ s64 rtt_us;
154+
155+ rtt_us = ktime_to_us(ktime_sub(resp_time, send_time));
156+ if (rtt_us < 0)
157+ return;
158+
159+ spin_lock(&peer->rtt_input_lock);
160+ rxrpc_ack_update_rtt(peer, rtt_us);
161+ if (peer->rtt_count < 3)
162+ peer->rtt_count++;
163+ spin_unlock(&peer->rtt_input_lock);
164+
165+ trace_rxrpc_rtt_rx(call, why, send_serial, resp_serial,
166+ peer->srtt_us >> 3, peer->rto_j);
167+}
168+
169+/*
170+ * Get the retransmission timeout to set in jiffies, backing it off each time
171+ * we retransmit.
172+ */
173+unsigned long rxrpc_get_rto_backoff(struct rxrpc_peer *peer, bool retrans)
174+{
175+ u64 timo_j;
176+ u8 backoff = READ_ONCE(peer->backoff);
177+
178+ timo_j = peer->rto_j;
179+ timo_j <<= backoff;
180+ if (retrans && timo_j * 2 <= RXRPC_RTO_MAX)
181+ WRITE_ONCE(peer->backoff, backoff + 1);
182+
183+ if (timo_j < 1)
184+ timo_j = 1;
185+
186+ return timo_j;
187+}
188+
189+void rxrpc_peer_init_rtt(struct rxrpc_peer *peer)
190+{
191+ peer->rto_j = RXRPC_TIMEOUT_INIT;
192+ peer->mdev_us = jiffies_to_usecs(RXRPC_TIMEOUT_INIT);
193+ peer->backoff = 0;
194+ //minmax_reset(&peer->rtt_min, rxrpc_jiffies32, ~0U);
195+}
net/rxrpc/rxkad.c+1−2
@@ -1148,7 +1148,7 @@ static int rxkad_verify_response(struct rxrpc_connection *conn, · 1147 unmodified lines
11481148 ret = rxkad_decrypt_ticket(conn, skb, ticket, ticket_len, &session_key,
11491149 &expiry, _abort_code);
11501150 if (ret < 0)
1151− goto temporary_error_free_resp;
1151+ goto temporary_error_free_ticket;
11521152
11531153 /* use the session key from inside the ticket to decrypt the
11541154 * response */
@@ -1230,7 +1230,6 @@ protocol_error: · 75 unmodified lines
12301230
12311231 temporary_error_free_ticket:
12321232 kfree(ticket);
1233−temporary_error_free_resp:
12341233 kfree(response);
12351234 temporary_error:
12361235 /* Ignore the response packet if we got a temporary error such as
net/rxrpc/sendmsg.c+9−17
@@ -66,15 +66,14 @@ static int rxrpc_wait_for_tx_window_waitall(struct rxrpc_sock *rx, · 65 unmodified lines
6666 struct rxrpc_call *call)
6767 {
6868 rxrpc_seq_t tx_start, tx_win;
69− signed long rtt2, timeout;
70− u64 rtt;
69+ signed long rtt, timeout;
7170
72− rtt = READ_ONCE(call->peer->rtt);
73− rtt2 = nsecs_to_jiffies64(rtt) * 2;
74− if (rtt2 < 2)
75− rtt2 = 2;
71+ rtt = READ_ONCE(call->peer->srtt_us) >> 3;
72+ rtt = usecs_to_jiffies(rtt) * 2;
73+ if (rtt < 2)
74+ rtt = 2;
7675
77− timeout = rtt2;
76+ timeout = rtt;
7877 tx_start = READ_ONCE(call->tx_hard_ack);
7978
8079 for (;;) {
@@ -92,7 +91,7 @@ static int rxrpc_wait_for_tx_window_waitall(struct rxrpc_sock *rx, · 11 unmodified lines
9291 return -EINTR;
9392
9493 if (tx_win != tx_start) {
95− timeout = rtt2;
94+ timeout = rtt;
9695 tx_start = tx_win;
9796 }
9897
@@ -271,16 +270,9 @@ static int rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call, · 172 unmodified lines
271270 _debug("need instant resend %d", ret);
272271 rxrpc_instant_resend(call, ix);
273272 } else {
274− unsigned long now = jiffies, resend_at;
273+ unsigned long now = jiffies;
274+ unsigned long resend_at = now + call->peer->rto_j;
275275
276− if (call->peer->rtt_usage > 1)
277− resend_at = nsecs_to_jiffies(call->peer->rtt * 3 / 2);
278− else
279− resend_at = rxrpc_resend_timeout;
280− if (resend_at < 1)
281− resend_at = 1;
282−
283− resend_at += now;
284276 WRITE_ONCE(call->resend_at, resend_at);
285277 rxrpc_reduce_call_timer(call, resend_at, now,
286278 rxrpc_timer_set_for_send);
net/rxrpc/sysctl.c+0−9
@@ -71,15 +71,6 @@ static struct ctl_table rxrpc_sysctl_table[] = { · 70 unmodified lines
7171 .extra1 = (void *)&one_jiffy,
7272 .extra2 = (void *)&max_jiffies,
7373 },
74− {
75− .procname = "resend_timeout",
76− .data = &rxrpc_resend_timeout,
77− .maxlen = sizeof(unsigned long),
78− .mode = 0644,
79− .proc_handler = proc_doulongvec_ms_jiffies_minmax,
80− .extra1 = (void *)&one_jiffy,
81− .extra2 = (void *)&max_jiffies,
82− },
8374
8475 /* Non-time values */
8576 {
net/sctp/sm_sideeffect.c+11−3
@@ -1523,9 +1523,17 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type, · 1522 unmodified lines
15231523 timeout = asoc->timeouts[cmd->obj.to];
15241524 BUG_ON(!timeout);
15251525
1526− timer->expires = jiffies + timeout;
1527− sctp_association_hold(asoc);
1528− add_timer(timer);
1526+ /*
1527+ * SCTP has a hard time with timer starts. Because we process
1528+ * timer starts as side effects, it can be hard to tell if we
1529+ * have already started a timer or not, which leads to BUG
1530+ * halts when we call add_timer. So here, instead of just starting
1531+ * a timer, if the timer is already started, and just mod
1532+ * the timer with the shorter of the two expiration times
1533+ */
1534+ if (!timer_pending(timer))
1535+ sctp_association_hold(asoc);
1536+ timer_reduce(timer, jiffies + timeout);
15291537 break;
15301538
15311539 case SCTP_CMD_TIMER_RESTART:
net/sctp/sm_statefuns.c+5−4
@@ -1856,12 +1856,13 @@ static enum sctp_disposition sctp_sf_do_dupcook_a( · 1855 unmodified lines
18561856 /* Update the content of current association. */
18571857 sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc));
18581858 sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev));
1859− if (sctp_state(asoc, SHUTDOWN_PENDING) &&
1859+ if ((sctp_state(asoc, SHUTDOWN_PENDING) ||
1860+ sctp_state(asoc, SHUTDOWN_SENT)) &&
18601861 (sctp_sstate(asoc->base.sk, CLOSING) ||
18611862 sock_flag(asoc->base.sk, SOCK_DEAD))) {
1862− /* if were currently in SHUTDOWN_PENDING, but the socket
1863− * has been closed by user, don't transition to ESTABLISHED.
1864− * Instead trigger SHUTDOWN bundled with COOKIE_ACK.
1863+ /* If the socket has been closed by user, don't
1864+ * transition to ESTABLISHED. Instead trigger SHUTDOWN
1865+ * bundled with COOKIE_ACK.
18651866 */
18661867 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));
18671868 return sctp_sf_do_9_2_start_shutdown(net, ep, asoc,
net/sunrpc/auth_gss/auth_gss.c+5−7
@@ -2032,7 +2032,6 @@ gss_unwrap_resp_priv(struct rpc_task *task, struct rpc_cred *cred, · 2031 unmodified lines
20322032 struct xdr_buf *rcv_buf = &rqstp->rq_rcv_buf;
20332033 struct kvec *head = rqstp->rq_rcv_buf.head;
20342034 struct rpc_auth *auth = cred->cr_auth;
2035− unsigned int savedlen = rcv_buf->len;
20362035 u32 offset, opaque_len, maj_stat;
20372036 __be32 *p;
20382037
@@ -2043,9 +2042,9 @@ gss_unwrap_resp_priv(struct rpc_task *task, struct rpc_cred *cred, · 4 unmodified lines
20432042 offset = (u8 *)(p) - (u8 *)head->iov_base;
20442043 if (offset + opaque_len > rcv_buf->len)
20452044 goto unwrap_failed;
2046− rcv_buf->len = offset + opaque_len;
20472045
2048− maj_stat = gss_unwrap(ctx->gc_gss_ctx, offset, rcv_buf);
2046+ maj_stat = gss_unwrap(ctx->gc_gss_ctx, offset,
2047+ offset + opaque_len, rcv_buf);
20492048 if (maj_stat == GSS_S_CONTEXT_EXPIRED)
20502049 clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
20512050 if (maj_stat != GSS_S_COMPLETE)
@@ -2059,10 +2058,9 @@ gss_unwrap_resp_priv(struct rpc_task *task, struct rpc_cred *cred, · 7 unmodified lines
20592058 */
20602059 xdr_init_decode(xdr, rcv_buf, p, rqstp);
20612060
2062− auth->au_rslack = auth->au_verfsize + 2 +
2063− XDR_QUADLEN(savedlen - rcv_buf->len);
2064− auth->au_ralign = auth->au_verfsize + 2 +
2065− XDR_QUADLEN(savedlen - rcv_buf->len);
2061+ auth->au_rslack = auth->au_verfsize + 2 + ctx->gc_gss_ctx->slack;
2062+ auth->au_ralign = auth->au_verfsize + 2 + ctx->gc_gss_ctx->align;
2063+
20662064 return 0;
20672065 unwrap_failed:
20682066 trace_rpcgss_unwrap_failed(task);
net/sunrpc/auth_gss/gss_krb5_crypto.c+4−4
@@ -851,8 +851,8 @@ out_err: · 850 unmodified lines
851851 }
852852
853853 u32
854−gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, struct xdr_buf *buf,
855− u32 *headskip, u32 *tailskip)
854+gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, u32 len,
855+ struct xdr_buf *buf, u32 *headskip, u32 *tailskip)
856856 {
857857 struct xdr_buf subbuf;
858858 u32 ret = 0;
@@ -881,7 +881,7 @@ gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, struct xdr_buf *buf, · 22 unmodified lines
881881
882882 /* create a segment skipping the header and leaving out the checksum */
883883 xdr_buf_subsegment(buf, &subbuf, offset + GSS_KRB5_TOK_HDR_LEN,
884− (buf->len - offset - GSS_KRB5_TOK_HDR_LEN -
884+ (len - offset - GSS_KRB5_TOK_HDR_LEN -
885885 kctx->gk5e->cksumlength));
886886
887887 nblocks = (subbuf.len + blocksize - 1) / blocksize;
@@ -926,7 +926,7 @@ gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, struct xdr_buf *buf, · 38 unmodified lines
926926 goto out_err;
927927
928928 /* Get the packet's hmac value */
929− ret = read_bytes_from_xdr_buf(buf, buf->len - kctx->gk5e->cksumlength,
929+ ret = read_bytes_from_xdr_buf(buf, len - kctx->gk5e->cksumlength,
930930 pkt_hmac, kctx->gk5e->cksumlength);
931931 if (ret)
932932 goto out_err;
net/sunrpc/auth_gss/gss_krb5_wrap.c+29−15
@@ -261,7 +261,9 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset, · 260 unmodified lines
261261 }
262262
263263 static u32
264−gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf)
264+gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, int len,
265+ struct xdr_buf *buf, unsigned int *slack,
266+ unsigned int *align)
265267 {
266268 int signalg;
267269 int sealalg;
@@ -279,12 +281,13 @@ gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf) · 11 unmodified lines
279281 u32 conflen = kctx->gk5e->conflen;
280282 int crypt_offset;
281283 u8 *cksumkey;
284+ unsigned int saved_len = buf->len;
282285
283286 dprintk("RPC: gss_unwrap_kerberos\n");
284287
285288 ptr = (u8 *)buf->head[0].iov_base + offset;
286289 if (g_verify_token_header(&kctx->mech_used, &bodysize, &ptr,
287− buf->len - offset))
290+ len - offset))
288291 return GSS_S_DEFECTIVE_TOKEN;
289292
290293 if ((ptr[0] != ((KG_TOK_WRAP_MSG >> 8) & 0xff)) ||
@@ -324,6 +327,7 @@ gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf) · 33 unmodified lines
324327 (!kctx->initiate && direction != 0))
325328 return GSS_S_BAD_SIG;
326329
330+ buf->len = len;
327331 if (kctx->enctype == ENCTYPE_ARCFOUR_HMAC) {
328332 struct crypto_sync_skcipher *cipher;
329333 int err;
@@ -376,11 +380,15 @@ gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf) · 46 unmodified lines
376380 data_len = (buf->head[0].iov_base + buf->head[0].iov_len) - data_start;
377381 memmove(orig_start, data_start, data_len);
378382 buf->head[0].iov_len -= (data_start - orig_start);
379− buf->len -= (data_start - orig_start);
383+ buf->len = len - (data_start - orig_start);
380384
381385 if (gss_krb5_remove_padding(buf, blocksize))
382386 return GSS_S_DEFECTIVE_TOKEN;
383387
388+ /* slack must include room for krb5 padding */
389+ *slack = XDR_QUADLEN(saved_len - buf->len);
390+ /* The GSS blob always precedes the RPC message payload */
391+ *align = *slack;
384392 return GSS_S_COMPLETE;
385393 }
386394
@@ -486,7 +494,9 @@ gss_wrap_kerberos_v2(struct krb5_ctx *kctx, u32 offset, · 99 unmodified lines
486494 }
487495
488496 static u32
489−gss_unwrap_kerberos_v2(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf)
497+gss_unwrap_kerberos_v2(struct krb5_ctx *kctx, int offset, int len,
498+ struct xdr_buf *buf, unsigned int *slack,
499+ unsigned int *align)
490500 {
491501 time64_t now;
492502 u8 *ptr;
@@ -532,7 +542,7 @@ gss_unwrap_kerberos_v2(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf) · 39 unmodified lines
532542 if (rrc != 0)
533543 rotate_left(offset + 16, buf, rrc);
534544
535− err = (*kctx->gk5e->decrypt_v2)(kctx, offset, buf,
545+ err = (*kctx->gk5e->decrypt_v2)(kctx, offset, len, buf,
536546 &headskip, &tailskip);
537547 if (err)
538548 return GSS_S_FAILURE;
@@ -542,7 +552,7 @@ gss_unwrap_kerberos_v2(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf) · 3 unmodified lines
542552 * it against the original
543553 */
544554 err = read_bytes_from_xdr_buf(buf,
545− buf->len - GSS_KRB5_TOK_HDR_LEN - tailskip,
555+ len - GSS_KRB5_TOK_HDR_LEN - tailskip,
546556 decrypted_hdr, GSS_KRB5_TOK_HDR_LEN);
547557 if (err) {
548558 dprintk("%s: error %u getting decrypted_hdr\n", __func__, err);
@@ -568,18 +578,19 @@ gss_unwrap_kerberos_v2(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf) · 19 unmodified lines
568578 * Note that buf->head[0].iov_len may indicate the available
569579 * head buffer space rather than that actually occupied.
570580 */
571− movelen = min_t(unsigned int, buf->head[0].iov_len, buf->len);
581+ movelen = min_t(unsigned int, buf->head[0].iov_len, len);
572582 movelen -= offset + GSS_KRB5_TOK_HDR_LEN + headskip;
573− if (offset + GSS_KRB5_TOK_HDR_LEN + headskip + movelen >
574− buf->head[0].iov_len)
575− return GSS_S_FAILURE;
583+ BUG_ON(offset + GSS_KRB5_TOK_HDR_LEN + headskip + movelen >
584+ buf->head[0].iov_len);
576585 memmove(ptr, ptr + GSS_KRB5_TOK_HDR_LEN + headskip, movelen);
577586 buf->head[0].iov_len -= GSS_KRB5_TOK_HDR_LEN + headskip;
578− buf->len -= GSS_KRB5_TOK_HDR_LEN + headskip;
587+ buf->len = len - GSS_KRB5_TOK_HDR_LEN + headskip;
579588
580589 /* Trim off the trailing "extra count" and checksum blob */
581− buf->len -= ec + GSS_KRB5_TOK_HDR_LEN + tailskip;
590+ xdr_buf_trim(buf, ec + GSS_KRB5_TOK_HDR_LEN + tailskip);
582591
592+ *align = XDR_QUADLEN(GSS_KRB5_TOK_HDR_LEN + headskip);
593+ *slack = *align + XDR_QUADLEN(ec + GSS_KRB5_TOK_HDR_LEN + tailskip);
583594 return GSS_S_COMPLETE;
584595 }
585596
@@ -603,7 +614,8 @@ gss_wrap_kerberos(struct gss_ctx *gctx, int offset, · 17 unmodified lines
603614 }
604615
605616 u32
606−gss_unwrap_kerberos(struct gss_ctx *gctx, int offset, struct xdr_buf *buf)
617+gss_unwrap_kerberos(struct gss_ctx *gctx, int offset,
618+ int len, struct xdr_buf *buf)
607619 {
608620 struct krb5_ctx *kctx = gctx->internal_ctx_id;
609621
@@ -613,9 +625,11 @@ gss_unwrap_kerberos(struct gss_ctx *gctx, int offset, struct xdr_buf *buf) · 3 unmodified lines
613625 case ENCTYPE_DES_CBC_RAW:
614626 case ENCTYPE_DES3_CBC_RAW:
615627 case ENCTYPE_ARCFOUR_HMAC:
616− return gss_unwrap_kerberos_v1(kctx, offset, buf);
628+ return gss_unwrap_kerberos_v1(kctx, offset, len, buf,
629+ &gctx->slack, &gctx->align);
617630 case ENCTYPE_AES128_CTS_HMAC_SHA1_96:
618631 case ENCTYPE_AES256_CTS_HMAC_SHA1_96:
619− return gss_unwrap_kerberos_v2(kctx, offset, buf);
632+ return gss_unwrap_kerberos_v2(kctx, offset, len, buf,
633+ &gctx->slack, &gctx->align);
620634 }
621635 }
net/sunrpc/auth_gss/gss_mech_switch.c+2−1
@@ -411,10 +411,11 @@ gss_wrap(struct gss_ctx *ctx_id, · 410 unmodified lines
411411 u32
412412 gss_unwrap(struct gss_ctx *ctx_id,
413413 int offset,
414+ int len,
414415 struct xdr_buf *buf)
415416 {
416417 return ctx_id->mech_type->gm_ops
417− ->gss_unwrap(ctx_id, offset, buf);
418+ ->gss_unwrap(ctx_id, offset, len, buf);
418419 }
419420
420421
net/sunrpc/auth_gss/svcauth_gss.c+3−7
@@ -906,7 +906,7 @@ unwrap_integ_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct g · 905 unmodified lines
906906 if (svc_getnl(&buf->head[0]) != seq)
907907 goto out;
908908 /* trim off the mic and padding at the end before returning */
909− buf->len -= 4 + round_up_to_quad(mic.len);
909+ xdr_buf_trim(buf, round_up_to_quad(mic.len) + 4);
910910 stat = 0;
911911 out:
912912 kfree(mic.data);
@@ -934,7 +934,7 @@ static int · 21 unmodified lines
934934 unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gss_ctx *ctx)
935935 {
936936 u32 priv_len, maj_stat;
937− int pad, saved_len, remaining_len, offset;
937+ int pad, remaining_len, offset;
938938
939939 clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
940940
@@ -954,12 +954,8 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs · 13 unmodified lines
954954 buf->len -= pad;
955955 fix_priv_head(buf, pad);
956956
957− /* Maybe it would be better to give gss_unwrap a length parameter: */
958− saved_len = buf->len;
959− buf->len = priv_len;
960− maj_stat = gss_unwrap(ctx, 0, buf);
957+ maj_stat = gss_unwrap(ctx, 0, priv_len, buf);
961958 pad = priv_len - buf->len;
962− buf->len = saved_len;
963959 buf->len -= pad;
964960 /* The upper layers assume the buffer is aligned on 4-byte boundaries.
965961 * In the krb5p case, at least, the data ends up offset, so we need to
net/sunrpc/clnt.c+7−2
@@ -889,7 +889,9 @@ static void rpc_free_client_work(struct work_struct *work) · 888 unmodified lines
889889 * here.
890890 */
891891 rpc_clnt_debugfs_unregister(clnt);
892+ rpc_free_clid(clnt);
892893 rpc_clnt_remove_pipedir(clnt);
894+ xprt_put(rcu_dereference_raw(clnt->cl_xprt));
893895
894896 kfree(clnt);
895897 rpciod_down();
@@ -907,10 +909,8 @@ rpc_free_client(struct rpc_clnt *clnt) · 11 unmodified lines
907909 rpc_unregister_client(clnt);
908910 rpc_free_iostats(clnt->cl_metrics);
909911 clnt->cl_metrics = NULL;
910− xprt_put(rcu_dereference_raw(clnt->cl_xprt));
911912 xprt_iter_destroy(&clnt->cl_xpi);
912913 put_cred(clnt->cl_cred);
913− rpc_free_clid(clnt);
914914
915915 INIT_WORK(&clnt->cl_work, rpc_free_client_work);
916916 schedule_work(&clnt->cl_work);
@@ -2433,6 +2433,11 @@ rpc_check_timeout(struct rpc_task *task) · 1516 unmodified lines
24332433 {
24342434 struct rpc_clnt *clnt = task->tk_client;
24352435
2436+ if (RPC_SIGNALLED(task)) {
2437+ rpc_call_rpcerror(task, -ERESTARTSYS);
2438+ return;
2439+ }
2440+
24362441 if (xprt_adjust_timeout(task->tk_rqstp) == 0)
24372442 return;
24382443
net/sunrpc/xdr.c+41−0
@@ -1150,6 +1150,47 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf, · 1149 unmodified lines
11501150 }
11511151 EXPORT_SYMBOL_GPL(xdr_buf_subsegment);
11521152
1153+/**
1154+ * xdr_buf_trim - lop at most "len" bytes off the end of "buf"
1155+ * @buf: buf to be trimmed
1156+ * @len: number of bytes to reduce "buf" by
1157+ *
1158+ * Trim an xdr_buf by the given number of bytes by fixing up the lengths. Note
1159+ * that it's possible that we'll trim less than that amount if the xdr_buf is
1160+ * too small, or if (for instance) it's all in the head and the parser has
1161+ * already read too far into it.
1162+ */
1163+void xdr_buf_trim(struct xdr_buf *buf, unsigned int len)
1164+{
1165+ size_t cur;
1166+ unsigned int trim = len;
1167+
1168+ if (buf->tail[0].iov_len) {
1169+ cur = min_t(size_t, buf->tail[0].iov_len, trim);
1170+ buf->tail[0].iov_len -= cur;
1171+ trim -= cur;
1172+ if (!trim)
1173+ goto fix_len;
1174+ }
1175+
1176+ if (buf->page_len) {
1177+ cur = min_t(unsigned int, buf->page_len, trim);
1178+ buf->page_len -= cur;
1179+ trim -= cur;
1180+ if (!trim)
1181+ goto fix_len;
1182+ }
1183+
1184+ if (buf->head[0].iov_len) {
1185+ cur = min_t(size_t, buf->head[0].iov_len, trim);
1186+ buf->head[0].iov_len -= cur;
1187+ trim -= cur;
1188+ }
1189+fix_len:
1190+ buf->len -= (len - trim);
1191+}
1192+EXPORT_SYMBOL_GPL(xdr_buf_trim);
1193+
11531194 static void __read_bytes_from_xdr_buf(struct xdr_buf *subbuf, void *obj, unsigned int len)
11541195 {
11551196 unsigned int this_len;
net/tipc/socket.c+31−11
@@ -1739,22 +1739,21 @@ static int tipc_sk_anc_data_recv(struct msghdr *m, struct sk_buff *skb, · 1738 unmodified lines
17391739 return 0;
17401740 }
17411741
1742−static void tipc_sk_send_ack(struct tipc_sock *tsk)
1742+static struct sk_buff *tipc_sk_build_ack(struct tipc_sock *tsk)
17431743 {
17441744 struct sock *sk = &tsk->sk;
1745− struct net *net = sock_net(sk);
17461745 struct sk_buff *skb = NULL;
17471746 struct tipc_msg *msg;
17481747 u32 peer_port = tsk_peer_port(tsk);
17491748 u32 dnode = tsk_peer_node(tsk);
17501749
17511750 if (!tipc_sk_connected(sk))
1752− return;
1751+ return NULL;
17531752 skb = tipc_msg_create(CONN_MANAGER, CONN_ACK, INT_H_SIZE, 0,
17541753 dnode, tsk_own_node(tsk), peer_port,
17551754 tsk->portid, TIPC_OK);
17561755 if (!skb)
1757− return;
1756+ return NULL;
17581757 msg = buf_msg(skb);
17591758 msg_set_conn_ack(msg, tsk->rcv_unacked);
17601759 tsk->rcv_unacked = 0;
@@ -1764,7 +1763,19 @@ static void tipc_sk_send_ack(struct tipc_sock *tsk) · 3 unmodified lines
17641763 tsk->rcv_win = tsk_adv_blocks(tsk->sk.sk_rcvbuf);
17651764 msg_set_adv_win(msg, tsk->rcv_win);
17661765 }
1767− tipc_node_xmit_skb(net, skb, dnode, msg_link_selector(msg));
1766+ return skb;
1767+}
1768+
1769+static void tipc_sk_send_ack(struct tipc_sock *tsk)
1770+{
1771+ struct sk_buff *skb;
1772+
1773+ skb = tipc_sk_build_ack(tsk);
1774+ if (!skb)
1775+ return;
1776+
1777+ tipc_node_xmit_skb(sock_net(&tsk->sk), skb, tsk_peer_node(tsk),
1778+ msg_link_selector(buf_msg(skb)));
17681779 }
17691780
17701781 static int tipc_wait_for_rcvmsg(struct socket *sock, long *timeop)
@@ -1938,7 +1949,6 @@ static int tipc_recvstream(struct socket *sock, struct msghdr *m, · 167 unmodified lines
19381949 bool peek = flags & MSG_PEEK;
19391950 int offset, required, copy, copied = 0;
19401951 int hlen, dlen, err, rc;
1941− bool ack = false;
19421952 long timeout;
19431953
19441954 /* Catch invalid receive attempts */
@@ -1983,7 +1993,6 @@ static int tipc_recvstream(struct socket *sock, struct msghdr *m, · 38 unmodified lines
19831993
19841994 /* Copy data if msg ok, otherwise return error/partial data */
19851995 if (likely(!err)) {
1986− ack = msg_ack_required(hdr);
19871996 offset = skb_cb->bytes_read;
19881997 copy = min_t(int, dlen - offset, buflen - copied);
19891998 rc = skb_copy_datagram_msg(skb, hlen + offset, m, copy);
@@ -2011,7 +2020,7 @@ static int tipc_recvstream(struct socket *sock, struct msghdr *m, · 21 unmodified lines
20112020
20122021 /* Send connection flow control advertisement when applicable */
20132022 tsk->rcv_unacked += tsk_inc(tsk, hlen + dlen);
2014− if (ack || tsk->rcv_unacked >= tsk->rcv_win / TIPC_ACK_RATE)
2023+ if (tsk->rcv_unacked >= tsk->rcv_win / TIPC_ACK_RATE)
20152024 tipc_sk_send_ack(tsk);
20162025
20172026 /* Exit if all requested data or FIN/error received */
@@ -2105,9 +2114,11 @@ static void tipc_sk_proto_rcv(struct sock *sk, · 87 unmodified lines
21052114 * tipc_sk_filter_connect - check incoming message for a connection-based socket
21062115 * @tsk: TIPC socket
21072116 * @skb: pointer to message buffer.
2117+ * @xmitq: for Nagle ACK if any
21082118 * Returns true if message should be added to receive queue, false otherwise
21092119 */
2110−static bool tipc_sk_filter_connect(struct tipc_sock *tsk, struct sk_buff *skb)
2120+static bool tipc_sk_filter_connect(struct tipc_sock *tsk, struct sk_buff *skb,
2121+ struct sk_buff_head *xmitq)
21112122 {
21122123 struct sock *sk = &tsk->sk;
21132124 struct net *net = sock_net(sk);
@@ -2171,8 +2182,17 @@ static bool tipc_sk_filter_connect(struct tipc_sock *tsk, struct sk_buff *skb) · 57 unmodified lines
21712182 if (!skb_queue_empty(&sk->sk_write_queue))
21722183 tipc_sk_push_backlog(tsk);
21732184 /* Accept only connection-based messages sent by peer */
2174− if (likely(con_msg && !err && pport == oport && pnode == onode))
2185+ if (likely(con_msg && !err && pport == oport &&
2186+ pnode == onode)) {
2187+ if (msg_ack_required(hdr)) {
2188+ struct sk_buff *skb;
2189+
2190+ skb = tipc_sk_build_ack(tsk);
2191+ if (skb)
2192+ __skb_queue_tail(xmitq, skb);
2193+ }
21752194 return true;
2195+ }
21762196 if (!tsk_peer_msg(tsk, hdr))
21772197 return false;
21782198 if (!err)
@@ -2267,7 +2287,7 @@ static void tipc_sk_filter_rcv(struct sock *sk, struct sk_buff *skb, · 88 unmodified lines
22672287 while ((skb = __skb_dequeue(&inputq))) {
22682288 hdr = buf_msg(skb);
22692289 limit = rcvbuf_limit(sk, skb);
2270− if ((sk_conn && !tipc_sk_filter_connect(tsk, skb)) ||
2290+ if ((sk_conn && !tipc_sk_filter_connect(tsk, skb, xmitq)) ||
22712291 (!sk_conn && msg_connected(hdr)) ||
22722292 (!grp && msg_in_group(hdr)))
22732293 err = TIPC_ERR_NO_PORT;
net/tipc/subscr.h+10−0
@@ -96,6 +96,16 @@ void tipc_sub_get(struct tipc_subscription *subscription); · 95 unmodified lines
9696 (swap_ ? swab32(val__) : val__); \
9797 })
9898
99+/* tipc_sub_write - write val_ to field_ of struct sub_ in user endian format
100+ */
101+#define tipc_sub_write(sub_, field_, val_) \
102+ ({ \
103+ struct tipc_subscr *sub__ = sub_; \
104+ u32 val__ = val_; \
105+ int swap_ = !((sub__)->filter & TIPC_FILTER_MASK); \
106+ (sub__)->field_ = swap_ ? swab32(val__) : val__; \
107+ })
108+
99109 /* tipc_evt_write - write val_ to field_ of struct evt_ in user endian format
100110 */
101111 #define tipc_evt_write(evt_, field_, val_) \
net/tipc/topsrv.c+8−5
@@ -237,8 +237,8 @@ static void tipc_conn_delete_sub(struct tipc_conn *con, struct tipc_subscr *s) · 236 unmodified lines
237237 if (!s || !memcmp(s, &sub->evt.s, sizeof(*s))) {
238238 tipc_sub_unsubscribe(sub);
239239 atomic_dec(&tn->subscription_count);
240− } else if (s) {
241− break;
240+ if (s)
241+ break;
242242 }
243243 }
244244 spin_unlock_bh(&con->sub_lock);
@@ -362,9 +362,10 @@ static int tipc_conn_rcv_sub(struct tipc_topsrv *srv, · 117 unmodified lines
362362 {
363363 struct tipc_net *tn = tipc_net(srv->net);
364364 struct tipc_subscription *sub;
365+ u32 s_filter = tipc_sub_read(s, filter);
365366
366− if (tipc_sub_read(s, filter) & TIPC_SUB_CANCEL) {
367− s->filter &= __constant_ntohl(~TIPC_SUB_CANCEL);
367+ if (s_filter & TIPC_SUB_CANCEL) {
368+ tipc_sub_write(s, filter, s_filter & ~TIPC_SUB_CANCEL);
368369 tipc_conn_delete_sub(con, s);
369370 return 0;
370371 }
@@ -400,7 +401,9 @@ static int tipc_conn_rcv_from_sock(struct tipc_conn *con) · 29 unmodified lines
400401 return -EWOULDBLOCK;
401402 if (ret == sizeof(s)) {
402403 read_lock_bh(&sk->sk_callback_lock);
403− ret = tipc_conn_rcv_sub(srv, con, &s);
404+ /* RACE: the connection can be closed in the meantime */
405+ if (likely(connected(con)))
406+ ret = tipc_conn_rcv_sub(srv, con, &s);
404407 read_unlock_bh(&sk->sk_callback_lock);
405408 if (!ret)
406409 return 0;
net/tipc/udp_media.c+5−1
@@ -161,9 +161,11 @@ static int tipc_udp_xmit(struct net *net, struct sk_buff *skb, · 160 unmodified lines
161161 struct udp_bearer *ub, struct udp_media_addr *src,
162162 struct udp_media_addr *dst, struct dst_cache *cache)
163163 {
164− struct dst_entry *ndst = dst_cache_get(cache);
164+ struct dst_entry *ndst;
165165 int ttl, err = 0;
166166
167+ local_bh_disable();
168+ ndst = dst_cache_get(cache);
167169 if (dst->proto == htons(ETH_P_IP)) {
168170 struct rtable *rt = (struct rtable *)ndst;
169171
@@ -210,9 +212,11 @@ static int tipc_udp_xmit(struct net *net, struct sk_buff *skb, · 40 unmodified lines
210212 src->port, dst->port, false);
211213 #endif
212214 }
215+ local_bh_enable();
213216 return err;
214217
215218 tx_error:
219+ local_bh_enable();
216220 kfree_skb(skb);
217221 return err;
218222 }
net/tls/tls_sw.c+10−7
@@ -780,7 +780,7 @@ static int tls_push_record(struct sock *sk, int flags, · 779 unmodified lines
780780
781781 static int bpf_exec_tx_verdict(struct sk_msg *msg, struct sock *sk,
782782 bool full_record, u8 record_type,
783− size_t *copied, int flags)
783+ ssize_t *copied, int flags)
784784 {
785785 struct tls_context *tls_ctx = tls_get_ctx(sk);
786786 struct tls_sw_context_tx *ctx = tls_sw_ctx_tx(tls_ctx);
@@ -796,9 +796,10 @@ static int bpf_exec_tx_verdict(struct sk_msg *msg, struct sock *sk, · 9 unmodified lines
796796 psock = sk_psock_get(sk);
797797 if (!psock || !policy) {
798798 err = tls_push_record(sk, flags, record_type);
799− if (err && err != -EINPROGRESS) {
799+ if (err && sk->sk_err == EBADMSG) {
800800 *copied -= sk_msg_free(sk, msg);
801801 tls_free_open_rec(sk);
802+ err = -sk->sk_err;
802803 }
803804 if (psock)
804805 sk_psock_put(sk, psock);
@@ -824,9 +825,10 @@ more_data: · 19 unmodified lines
824825 switch (psock->eval) {
825826 case __SK_PASS:
826827 err = tls_push_record(sk, flags, record_type);
827− if (err && err != -EINPROGRESS) {
828+ if (err && sk->sk_err == EBADMSG) {
828829 *copied -= sk_msg_free(sk, msg);
829830 tls_free_open_rec(sk);
831+ err = -sk->sk_err;
830832 goto out_err;
831833 }
832834 break;
@@ -916,7 +918,8 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) · 83 unmodified lines
916918 unsigned char record_type = TLS_RECORD_TYPE_DATA;
917919 bool is_kvec = iov_iter_is_kvec(&msg->msg_iter);
918920 bool eor = !(msg->msg_flags & MSG_MORE);
919− size_t try_to_copy, copied = 0;
921+ size_t try_to_copy;
922+ ssize_t copied = 0;
920923 struct sk_msg *msg_pl, *msg_en;
921924 struct tls_rec *rec;
922925 int required_size;
@@ -1118,7 +1121,7 @@ send_end: · 195 unmodified lines
11181121
11191122 release_sock(sk);
11201123 mutex_unlock(&tls_ctx->tx_lock);
1121− return copied ? copied : ret;
1124+ return copied > 0 ? copied : ret;
11221125 }
11231126
11241127 static int tls_sw_do_sendpage(struct sock *sk, struct page *page,
@@ -1132,7 +1135,7 @@ static int tls_sw_do_sendpage(struct sock *sk, struct page *page, · 7 unmodified lines
11321135 struct sk_msg *msg_pl;
11331136 struct tls_rec *rec;
11341137 int num_async = 0;
1135− size_t copied = 0;
1138+ ssize_t copied = 0;
11361139 bool full_record;
11371140 int record_room;
11381141 int ret = 0;
@@ -1234,7 +1237,7 @@ wait_for_memory: · 95 unmodified lines
12341237 }
12351238 sendpage_end:
12361239 ret = sk_stream_error(sk, flags, ret);
1237− return copied ? copied : ret;
1240+ return copied > 0 ? copied : ret;
12381241 }
12391242
12401243 int tls_sw_sendpage_locked(struct sock *sk, struct page *page,
samples/bpf/lwt_len_hist_user.c+0−2
@@ -15,8 +15,6 @@ · 14 unmodified lines
1515 #define MAX_INDEX 64
1616 #define MAX_STARS 38
1717
18−char bpf_log_buf[BPF_LOG_BUF_SIZE];
19−
2018 static void stars(char *str, long val, long max, int width)
2119 {
2220 int i;
security/apparmor/apparmorfs.c+2−1
@@ -454,7 +454,7 @@ static ssize_t policy_update(u32 mask, const char __user *buf, size_t size, · 453 unmodified lines
454454 */
455455 error = aa_may_manage_policy(label, ns, mask);
456456 if (error)
457− return error;
457+ goto end_section;
458458
459459 data = aa_simple_write_to_buffer(buf, size, size, pos);
460460 error = PTR_ERR(data);
@@ -462,6 +462,7 @@ static ssize_t policy_update(u32 mask, const char __user *buf, size_t size, · 1 unmodified line
462462 error = aa_replace_profiles(ns, label, mask, data);
463463 aa_put_loaddata(data);
464464 }
465+end_section:
465466 end_current_label_crit_section(label);
466467
467468 return error;
security/apparmor/audit.c+2−1
@@ -197,8 +197,9 @@ int aa_audit_rule_init(u32 field, u32 op, char *rulestr, void **vrule) · 196 unmodified lines
197197 rule->label = aa_label_parse(&root_ns->unconfined->label, rulestr,
198198 GFP_KERNEL, true, false);
199199 if (IS_ERR(rule->label)) {
200+ int err = PTR_ERR(rule->label);
200201 aa_audit_rule_free(rule);
201− return PTR_ERR(rule->label);
202+ return err;
202203 }
203204
204205 *vrule = rule;
security/apparmor/domain.c+1−2
@@ -1328,6 +1328,7 @@ int aa_change_profile(const char *fqname, int flags) · 1327 unmodified lines
13281328 ctx->nnp = aa_get_label(label);
13291329
13301330 if (!fqname || !*fqname) {
1331+ aa_put_label(label);
13311332 AA_DEBUG("no profile name");
13321333 return -EINVAL;
13331334 }
@@ -1346,8 +1347,6 @@ int aa_change_profile(const char *fqname, int flags) · 12 unmodified lines
13461347 op = OP_CHANGE_PROFILE;
13471348 }
13481349
1349− label = aa_get_current_label();
1350−
13511350 if (*fqname == '&') {
13521351 stack = true;
13531352 /* don't have label_parse() do stacking */
security/integrity/evm/evm_crypto.c+23−23
@@ -73,7 +73,7 @@ static struct shash_desc *init_desc(char type, uint8_t hash_algo) · 72 unmodified lines
7373 {
7474 long rc;
7575 const char *algo;
76− struct crypto_shash **tfm;
76+ struct crypto_shash **tfm, *tmp_tfm;
7777 struct shash_desc *desc;
7878
7979 if (type == EVM_XATTR_HMAC) {
@@ -91,31 +91,31 @@ static struct shash_desc *init_desc(char type, uint8_t hash_algo) · 11 unmodified lines
9191 algo = hash_algo_name[hash_algo];
9292 }
9393
94− if (*tfm == NULL) {
95− mutex_lock(&mutex);
96− if (*tfm)
97− goto out;
98− *tfm = crypto_alloc_shash(algo, 0, CRYPTO_NOLOAD);
99− if (IS_ERR(*tfm)) {
100− rc = PTR_ERR(*tfm);
101− pr_err("Can not allocate %s (reason: %ld)\n", algo, rc);
102− *tfm = NULL;
94+ if (*tfm)
95+ goto alloc;
96+ mutex_lock(&mutex);
97+ if (*tfm)
98+ goto unlock;
99+
100+ tmp_tfm = crypto_alloc_shash(algo, 0, CRYPTO_NOLOAD);
101+ if (IS_ERR(tmp_tfm)) {
102+ pr_err("Can not allocate %s (reason: %ld)\n", algo,
103+ PTR_ERR(tmp_tfm));
104+ mutex_unlock(&mutex);
105+ return ERR_CAST(tmp_tfm);
106+ }
107+ if (type == EVM_XATTR_HMAC) {
108+ rc = crypto_shash_setkey(tmp_tfm, evmkey, evmkey_len);
109+ if (rc) {
110+ crypto_free_shash(tmp_tfm);
103111 mutex_unlock(&mutex);
104112 return ERR_PTR(rc);
105113 }
106− if (type == EVM_XATTR_HMAC) {
107− rc = crypto_shash_setkey(*tfm, evmkey, evmkey_len);
108− if (rc) {
109− crypto_free_shash(*tfm);
110− *tfm = NULL;
111− mutex_unlock(&mutex);
112− return ERR_PTR(rc);
113− }
114− }
115−out:
116− mutex_unlock(&mutex);
117114 }
118−
115+ *tfm = tmp_tfm;
116+unlock:
117+ mutex_unlock(&mutex);
118+alloc:
119119 desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(*tfm),
120120 GFP_KERNEL);
121121 if (!desc)
@@ -207,7 +207,7 @@ static int evm_calc_hmac_or_hash(struct dentry *dentry, · 85 unmodified lines
207207 data->hdr.length = crypto_shash_digestsize(desc->tfm);
208208
209209 error = -ENODATA;
210− list_for_each_entry_rcu(xattr, &evm_config_xattrnames, list) {
210+ list_for_each_entry_lockless(xattr, &evm_config_xattrnames, list) {
211211 bool is_ima = false;
212212
213213 if (strcmp(xattr->name, XATTR_NAME_IMA) == 0)
security/integrity/evm/evm_main.c+2−2
@@ -97,7 +97,7 @@ static int evm_find_protected_xattrs(struct dentry *dentry) · 96 unmodified lines
9797 if (!(inode->i_opflags & IOP_XATTR))
9898 return -EOPNOTSUPP;
9999
100− list_for_each_entry_rcu(xattr, &evm_config_xattrnames, list) {
100+ list_for_each_entry_lockless(xattr, &evm_config_xattrnames, list) {
101101 error = __vfs_getxattr(dentry, inode, xattr->name, NULL, 0);
102102 if (error < 0) {
103103 if (error == -ENODATA)
@@ -228,7 +228,7 @@ static int evm_protected_xattr(const char *req_xattr_name) · 124 unmodified lines
228228 struct xattr_list *xattr;
229229
230230 namelen = strlen(req_xattr_name);
231− list_for_each_entry_rcu(xattr, &evm_config_xattrnames, list) {
231+ list_for_each_entry_lockless(xattr, &evm_config_xattrnames, list) {
232232 if ((strlen(xattr->name) == namelen)
233233 && (strncmp(req_xattr_name, xattr->name, namelen) == 0)) {
234234 found = 1;
security/integrity/evm/evm_secfs.c+8−1
@@ -232,7 +232,14 @@ static ssize_t evm_write_xattrs(struct file *file, const char __user *buf, · 231 unmodified lines
232232 goto out;
233233 }
234234
235− /* Guard against races in evm_read_xattrs */
235+ /*
236+ * xattr_list_mutex guards against races in evm_read_xattrs().
237+ * Entries are only added to the evm_config_xattrnames list
238+ * and never deleted. Therefore, the list is traversed
239+ * using list_for_each_entry_lockless() without holding
240+ * the mutex in evm_calc_hmac_or_hash(), evm_find_protected_xattrs()
241+ * and evm_protected_xattr().
242+ */
236243 mutex_lock(&xattr_list_mutex);
237244 list_for_each_entry(tmp, &evm_config_xattrnames, list) {
238245 if (strcmp(xattr->name, tmp->name) == 0) {
security/integrity/ima/ima_crypto.c+6−6
@@ -411,7 +411,7 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) · 410 unmodified lines
411411 loff_t i_size;
412412 int rc;
413413 struct file *f = file;
414− bool new_file_instance = false, modified_flags = false;
414+ bool new_file_instance = false, modified_mode = false;
415415
416416 /*
417417 * For consistency, fail file's opened with the O_DIRECT flag on
@@ -431,13 +431,13 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) · 13 unmodified lines
431431 f = dentry_open(&file->f_path, flags, file->f_cred);
432432 if (IS_ERR(f)) {
433433 /*
434− * Cannot open the file again, lets modify f_flags
434+ * Cannot open the file again, lets modify f_mode
435435 * of original and continue
436436 */
437437 pr_info_ratelimited("Unable to reopen file for reading.\n");
438438 f = file;
439− f->f_flags |= FMODE_READ;
440− modified_flags = true;
439+ f->f_mode |= FMODE_READ;
440+ modified_mode = true;
441441 } else {
442442 new_file_instance = true;
443443 }
@@ -455,8 +455,8 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) · 11 unmodified lines
455455 out:
456456 if (new_file_instance)
457457 fput(f);
458− else if (modified_flags)
459− f->f_flags &= ~FMODE_READ;
458+ else if (modified_mode)
459+ f->f_mode &= ~FMODE_READ;
460460 return rc;
461461 }
462462
security/integrity/ima/ima_fs.c+1−2
@@ -338,8 +338,7 @@ static ssize_t ima_write_policy(struct file *file, const char __user *buf, · 337 unmodified lines
338338 integrity_audit_msg(AUDIT_INTEGRITY_STATUS, NULL, NULL,
339339 "policy_update", "signed policy required",
340340 1, 0);
341− if (ima_appraise & IMA_APPRAISE_ENFORCE)
342− result = -EACCES;
341+ result = -EACCES;
343342 } else {
344343 result = ima_parse_add_rule(data);
345344 }
security/security.c+14−2
@@ -1965,8 +1965,20 @@ EXPORT_SYMBOL(security_ismaclabel); · 1964 unmodified lines
19651965
19661966 int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
19671967 {
1968− return call_int_hook(secid_to_secctx, -EOPNOTSUPP, secid, secdata,
1969− seclen);
1968+ struct security_hook_list *hp;
1969+ int rc;
1970+
1971+ /*
1972+ * Currently, only one LSM can implement secid_to_secctx (i.e this
1973+ * LSM hook is not "stackable").
1974+ */
1975+ hlist_for_each_entry(hp, &security_hook_heads.secid_to_secctx, list) {
1976+ rc = hp->hook.secid_to_secctx(secid, secdata, seclen);
1977+ if (rc != LSM_RET_DEFAULT(secid_to_secctx))
1978+ return rc;
1979+ }
1980+
1981+ return LSM_RET_DEFAULT(secid_to_secctx);
19701982 }
19711983 EXPORT_SYMBOL(security_secid_to_secctx);
19721984
sound/core/pcm_lib.c+1−0
@@ -433,6 +433,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, · 432 unmodified lines
433433
434434 no_delta_check:
435435 if (runtime->status->hw_ptr == new_hw_ptr) {
436+ runtime->hw_ptr_jiffies = curr_jiffies;
436437 update_audio_tstamp(substream, &curr_tstamp, &audio_tstamp);
437438 return 0;
438439 }
sound/core/rawmidi.c+27−4
@@ -120,6 +120,17 @@ static void snd_rawmidi_input_event_work(struct work_struct *work) · 119 unmodified lines
120120 runtime->event(runtime->substream);
121121 }
122122
123+/* buffer refcount management: call with runtime->lock held */
124+static inline void snd_rawmidi_buffer_ref(struct snd_rawmidi_runtime *runtime)
125+{
126+ runtime->buffer_ref++;
127+}
128+
129+static inline void snd_rawmidi_buffer_unref(struct snd_rawmidi_runtime *runtime)
130+{
131+ runtime->buffer_ref--;
132+}
133+
123134 static int snd_rawmidi_runtime_create(struct snd_rawmidi_substream *substream)
124135 {
125136 struct snd_rawmidi_runtime *runtime;
@@ -669,6 +680,11 @@ static int resize_runtime_buffer(struct snd_rawmidi_runtime *runtime, · 543 unmodified lines
669680 if (!newbuf)
670681 return -ENOMEM;
671682 spin_lock_irq(&runtime->lock);
683+ if (runtime->buffer_ref) {
684+ spin_unlock_irq(&runtime->lock);
685+ kvfree(newbuf);
686+ return -EBUSY;
687+ }
672688 oldbuf = runtime->buffer;
673689 runtime->buffer = newbuf;
674690 runtime->buffer_size = params->buffer_size;
@@ -1019,8 +1035,10 @@ static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream, · 344 unmodified lines
10191035 long result = 0, count1;
10201036 struct snd_rawmidi_runtime *runtime = substream->runtime;
10211037 unsigned long appl_ptr;
1038+ int err = 0;
10221039
10231040 spin_lock_irqsave(&runtime->lock, flags);
1041+ snd_rawmidi_buffer_ref(runtime);
10241042 while (count > 0 && runtime->avail) {
10251043 count1 = runtime->buffer_size - runtime->appl_ptr;
10261044 if (count1 > count)
@@ -1039,16 +1057,19 @@ static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream, · 12 unmodified lines
10391057 if (userbuf) {
10401058 spin_unlock_irqrestore(&runtime->lock, flags);
10411059 if (copy_to_user(userbuf + result,
1042− runtime->buffer + appl_ptr, count1)) {
1043− return result > 0 ? result : -EFAULT;
1044− }
1060+ runtime->buffer + appl_ptr, count1))
1061+ err = -EFAULT;
10451062 spin_lock_irqsave(&runtime->lock, flags);
1063+ if (err)
1064+ goto out;
10461065 }
10471066 result += count1;
10481067 count -= count1;
10491068 }
1069+ out:
1070+ snd_rawmidi_buffer_unref(runtime);
10501071 spin_unlock_irqrestore(&runtime->lock, flags);
1051− return result;
1072+ return result > 0 ? result : err;
10521073 }
10531074
10541075 long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream,
@@ -1342,6 +1363,7 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream, · 287 unmodified lines
13421363 return -EAGAIN;
13431364 }
13441365 }
1366+ snd_rawmidi_buffer_ref(runtime);
13451367 while (count > 0 && runtime->avail > 0) {
13461368 count1 = runtime->buffer_size - runtime->appl_ptr;
13471369 if (count1 > count)
@@ -1373,6 +1395,7 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream, · 25 unmodified lines
13731395 }
13741396 __end:
13751397 count1 = runtime->avail < runtime->buffer_size;
1398+ snd_rawmidi_buffer_unref(runtime);
13761399 spin_unlock_irqrestore(&runtime->lock, flags);
13771400 if (count1)
13781401 snd_rawmidi_output_trigger(substream, 1);
sound/firewire/amdtp-stream-trace.h+1−2
@@ -66,8 +66,7 @@ TRACE_EVENT(amdtp_packet, · 65 unmodified lines
6666 __entry->irq,
6767 __entry->index,
6868 __print_array(__get_dynamic_array(cip_header),
69− __get_dynamic_array_len(cip_header),
70− sizeof(u8)))
69+ __get_dynamic_array_len(cip_header), 1))
7170 );
7271
7372 #endif
sound/pci/hda/patch_realtek.c+75−3
@@ -2457,6 +2457,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { · 2456 unmodified lines
24572457 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
24582458 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
24592459 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
2460+ SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
24602461 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
24612462 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
24622463 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
@@ -2472,6 +2473,9 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { · 9 unmodified lines
24722473 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
24732474 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
24742475 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2476+ SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2477+ SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2478+ SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
24752479 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
24762480 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
24772481 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
@@ -5856,6 +5860,15 @@ static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec, · 3378 unmodified lines
58565860 }
58575861 }
58585862
5863+static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
5864+ const struct hda_fixup *fix, int action)
5865+{
5866+ if (action != HDA_FIXUP_ACT_PRE_PROBE)
5867+ return;
5868+
5869+ codec->power_save_node = 1;
5870+}
5871+
58595872 /* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
58605873 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
58615874 const struct hda_fixup *fix, int action)
@@ -5960,6 +5973,7 @@ enum { · 98 unmodified lines
59605973 ALC269_FIXUP_HP_LINE1_MIC1_LED,
59615974 ALC269_FIXUP_INV_DMIC,
59625975 ALC269_FIXUP_LENOVO_DOCK,
5976+ ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
59635977 ALC269_FIXUP_NO_SHUTUP,
59645978 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
59655979 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
@@ -6045,6 +6059,7 @@ enum { · 79 unmodified lines
60456059 ALC233_FIXUP_ACER_HEADSET_MIC,
60466060 ALC294_FIXUP_LENOVO_MIC_LOCATION,
60476061 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
6062+ ALC225_FIXUP_S3_POP_NOISE,
60486063 ALC700_FIXUP_INTEL_REFERENCE,
60496064 ALC274_FIXUP_DELL_BIND_DACS,
60506065 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
@@ -6080,9 +6095,12 @@ enum { · 29 unmodified lines
60806095 ALC294_FIXUP_ASUS_DUAL_SPK,
60816096 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
60826097 ALC294_FIXUP_ASUS_HPE,
6098+ ALC294_FIXUP_ASUS_COEF_1B,
60836099 ALC285_FIXUP_HP_GPIO_LED,
60846100 ALC285_FIXUP_HP_MUTE_LED,
60856101 ALC236_FIXUP_HP_MUTE_LED,
6102+ ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
6103+ ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
60866104 };
60876105
60886106 static const struct hda_fixup alc269_fixups[] = {
@@ -6280,6 +6298,12 @@ static const struct hda_fixup alc269_fixups[] = { · 191 unmodified lines
62806298 .chained = true,
62816299 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
62826300 },
6301+ [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
6302+ .type = HDA_FIXUP_FUNC,
6303+ .v.func = alc269_fixup_limit_int_mic_boost,
6304+ .chained = true,
6305+ .chain_id = ALC269_FIXUP_LENOVO_DOCK,
6306+ },
62836307 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
62846308 .type = HDA_FIXUP_FUNC,
62856309 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
@@ -6932,6 +6956,12 @@ static const struct hda_fixup alc269_fixups[] = { · 646 unmodified lines
69326956 { }
69336957 },
69346958 .chained = true,
6959+ .chain_id = ALC225_FIXUP_S3_POP_NOISE
6960+ },
6961+ [ALC225_FIXUP_S3_POP_NOISE] = {
6962+ .type = HDA_FIXUP_FUNC,
6963+ .v.func = alc225_fixup_s3_pop_noise,
6964+ .chained = true,
69356965 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
69366966 },
69376967 [ALC700_FIXUP_INTEL_REFERENCE] = {
@@ -7204,6 +7234,17 @@ static const struct hda_fixup alc269_fixups[] = { · 266 unmodified lines
72047234 .chained = true,
72057235 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
72067236 },
7237+ [ALC294_FIXUP_ASUS_COEF_1B] = {
7238+ .type = HDA_FIXUP_VERBS,
7239+ .v.verbs = (const struct hda_verb[]) {
7240+ /* Set bit 10 to correct noisy output after reboot from
7241+ * Windows 10 (due to pop noise reduction?)
7242+ */
7243+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
7244+ { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
7245+ { }
7246+ },
7247+ },
72077248 [ALC285_FIXUP_HP_GPIO_LED] = {
72087249 .type = HDA_FIXUP_FUNC,
72097250 .v.func = alc285_fixup_hp_gpio_led,
@@ -7216,6 +7257,22 @@ static const struct hda_fixup alc269_fixups[] = { · 6 unmodified lines
72167257 .type = HDA_FIXUP_FUNC,
72177258 .v.func = alc236_fixup_hp_mute_led,
72187259 },
7260+ [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
7261+ .type = HDA_FIXUP_VERBS,
7262+ .v.verbs = (const struct hda_verb[]) {
7263+ { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
7264+ { }
7265+ },
7266+ },
7267+ [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7268+ .type = HDA_FIXUP_PINS,
7269+ .v.pins = (const struct hda_pintbl[]) {
7270+ { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7271+ { }
7272+ },
7273+ .chained = true,
7274+ .chain_id = ALC269_FIXUP_HEADSET_MODE
7275+ },
72197276 };
72207277
72217278 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7383,8 +7440,10 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 161 unmodified lines
73837440 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
73847441 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
73857442 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
7443+ SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
73867444 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
73877445 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
7446+ SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
73887447 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
73897448 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
73907449 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
@@ -7410,6 +7469,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 19 unmodified lines
74107469 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
74117470 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
74127471 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
7472+ SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7473+ SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
74137474 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
74147475 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
74157476 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
@@ -7426,7 +7487,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 10 unmodified lines
74267487 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
74277488 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
74287489 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
7429− SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
7490+ SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
74307491 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
74317492 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
74327493 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
@@ -7565,6 +7626,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { · 132 unmodified lines
75657626 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
75667627 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
75677628 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
7629+ {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
75687630 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
75697631 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
75707632 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
@@ -7993,6 +8055,18 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { · 422 unmodified lines
79938055 {0x12, 0x90a60130},
79948056 {0x17, 0x90170110},
79958057 {0x21, 0x03211020}),
8058+ SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8059+ {0x12, 0x90a60120},
8060+ {0x17, 0x90170110},
8061+ {0x21, 0x04211030}),
8062+ SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8063+ {0x12, 0x90a60130},
8064+ {0x17, 0x90170110},
8065+ {0x21, 0x03211020}),
8066+ SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8067+ {0x12, 0x90a60130},
8068+ {0x17, 0x90170110},
8069+ {0x21, 0x03211020}),
79968070 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
79978071 {0x14, 0x90170110},
79988072 {0x21, 0x04211020}),
@@ -8209,8 +8283,6 @@ static int patch_alc269(struct hda_codec *codec) · 210 unmodified lines
82098283 spec->gen.mixer_nid = 0;
82108284 break;
82118285 case 0x10ec0225:
8212− codec->power_save_node = 1;
8213− /* fall through */
82148286 case 0x10ec0295:
82158287 case 0x10ec0299:
82168288 spec->codec_variant = ALC269_TYPE_ALC225;
sound/pci/ice1712/ice1712.c+2−1
@@ -2332,7 +2332,8 @@ static int snd_ice1712_chip_init(struct snd_ice1712 *ice) · 2331 unmodified lines
23322332 pci_write_config_byte(ice->pci, 0x61, ice->eeprom.data[ICE_EEP1_ACLINK]);
23332333 pci_write_config_byte(ice->pci, 0x62, ice->eeprom.data[ICE_EEP1_I2SID]);
23342334 pci_write_config_byte(ice->pci, 0x63, ice->eeprom.data[ICE_EEP1_SPDIF]);
2335− if (ice->eeprom.subvendor != ICE1712_SUBDEVICE_STDSP24) {
2335+ if (ice->eeprom.subvendor != ICE1712_SUBDEVICE_STDSP24 &&
2336+ ice->eeprom.subvendor != ICE1712_SUBDEVICE_STAUDIO_ADCIII) {
23362337 ice->gpio.write_mask = ice->eeprom.gpiomask;
23372338 ice->gpio.direction = ice->eeprom.gpiodir;
23382339 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK,
sound/usb/mixer_maps.c+5−0
@@ -549,6 +549,11 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = { · 548 unmodified lines
549549 .map = trx40_mobo_map,
550550 .connector_map = trx40_mobo_connector_map,
551551 },
552+ { /* Asrock TRX40 Creator */
553+ .id = USB_ID(0x26ce, 0x0a01),
554+ .map = trx40_mobo_map,
555+ .connector_map = trx40_mobo_connector_map,
556+ },
552557 { 0 } /* terminator */
553558 };
554559
sound/usb/quirks-table.h+1−0
@@ -3563,6 +3563,7 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), · 3562 unmodified lines
35633563 ALC1220_VB_DESKTOP(0x0414, 0xa002), /* Gigabyte TRX40 Aorus Pro WiFi */
35643564 ALC1220_VB_DESKTOP(0x0db0, 0x0d64), /* MSI TRX40 Creator */
35653565 ALC1220_VB_DESKTOP(0x0db0, 0x543d), /* MSI TRX40 */
3566+ALC1220_VB_DESKTOP(0x26ce, 0x0a01), /* Asrock TRX40 Creator */
35663567 #undef ALC1220_VB_DESKTOP
35673568
35683569 #undef USB_DEVICE_VENDOR_SPEC
sound/usb/quirks.c+5−4
@@ -1636,13 +1636,14 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, · 1635 unmodified lines
16361636 && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
16371637 msleep(20);
16381638
1639− /* Zoom R16/24, Logitech H650e, Jabra 550a needs a tiny delay here,
1640− * otherwise requests like get/set frequency return as failed despite
1641− * actually succeeding.
1639+ /* Zoom R16/24, Logitech H650e, Jabra 550a, Kingston HyperX needs a tiny
1640+ * delay here, otherwise requests like get/set frequency return as
1641+ * failed despite actually succeeding.
16421642 */
16431643 if ((chip->usb_id == USB_ID(0x1686, 0x00dd) ||
16441644 chip->usb_id == USB_ID(0x046d, 0x0a46) ||
1645− chip->usb_id == USB_ID(0x0b0e, 0x0349)) &&
1645+ chip->usb_id == USB_ID(0x0b0e, 0x0349) ||
1646+ chip->usb_id == USB_ID(0x0951, 0x16ad)) &&
16461647 (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
16471648 usleep_range(1000, 2000);
16481649 }
tools/bootconfig/main.c+1−0
@@ -337,6 +337,7 @@ int apply_xbc(const char *path, const char *xbc_path) · 336 unmodified lines
337337 pr_err("Failed to apply a boot config magic: %d\n", ret);
338338 goto out;
339339 }
340+ ret = 0;
340341 out:
341342 close(fd);
342343 free(data);
tools/lib/bpf/bpf_tracing.h+2−2
@@ -148,11 +148,11 @@ struct pt_regs; · 147 unmodified lines
148148 #define PT_REGS_PARM3_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), gprs[4])
149149 #define PT_REGS_PARM4_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), gprs[5])
150150 #define PT_REGS_PARM5_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), gprs[6])
151−#define PT_REGS_RET_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), grps[14])
151+#define PT_REGS_RET_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), gprs[14])
152152 #define PT_REGS_FP_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), gprs[11])
153153 #define PT_REGS_RC_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), gprs[2])
154154 #define PT_REGS_SP_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), gprs[15])
155−#define PT_REGS_IP_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), pdw.addr)
155+#define PT_REGS_IP_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), psw.addr)
156156
157157 #elif defined(bpf_target_arm)
158158
tools/testing/selftests/bpf/prog_tests/mmap.c+20−1
@@ -19,7 +19,7 @@ void test_mmap(void) · 18 unmodified lines
1919 const size_t map_sz = roundup_page(sizeof(struct map_data));
2020 const int zero = 0, one = 1, two = 2, far = 1500;
2121 const long page_size = sysconf(_SC_PAGE_SIZE);
22− int err, duration = 0, i, data_map_fd, data_map_id, tmp_fd;
22+ int err, duration = 0, i, data_map_fd, data_map_id, tmp_fd, rdmap_fd;
2323 struct bpf_map *data_map, *bss_map;
2424 void *bss_mmaped = NULL, *map_mmaped = NULL, *tmp1, *tmp2;
2525 struct test_mmap__bss *bss_data;
@@ -37,6 +37,17 @@ void test_mmap(void) · 11 unmodified lines
3737 data_map = skel->maps.data_map;
3838 data_map_fd = bpf_map__fd(data_map);
3939
40+ rdmap_fd = bpf_map__fd(skel->maps.rdonly_map);
41+ tmp1 = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, rdmap_fd, 0);
42+ if (CHECK(tmp1 != MAP_FAILED, "rdonly_write_mmap", "unexpected success\n")) {
43+ munmap(tmp1, 4096);
44+ goto cleanup;
45+ }
46+ /* now double-check if it's mmap()'able at all */
47+ tmp1 = mmap(NULL, 4096, PROT_READ, MAP_SHARED, rdmap_fd, 0);
48+ if (CHECK(tmp1 == MAP_FAILED, "rdonly_read_mmap", "failed: %d\n", errno))
49+ goto cleanup;
50+
4051 /* get map's ID */
4152 memset(&map_info, 0, map_info_sz);
4253 err = bpf_obj_get_info_by_fd(data_map_fd, &map_info, &map_info_sz);
@@ -217,6 +228,14 @@ void test_mmap(void) · 174 unmodified lines
217228
218229 munmap(tmp2, 4 * page_size);
219230
231+ /* map all 4 pages, but with pg_off=1 page, should fail */
232+ tmp1 = mmap(NULL, 4 * page_size, PROT_READ, MAP_SHARED | MAP_FIXED,
233+ data_map_fd, page_size /* initial page shift */);
234+ if (CHECK(tmp1 != MAP_FAILED, "adv_mmap7", "unexpected success")) {
235+ munmap(tmp1, 4 * page_size);
236+ goto cleanup;
237+ }
238+
220239 tmp1 = mmap(NULL, map_sz, PROT_READ, MAP_SHARED, data_map_fd, 0);
221240 if (CHECK(tmp1 == MAP_FAILED, "last_mmap", "failed %d\n", errno))
222241 goto cleanup;
tools/testing/selftests/bpf/progs/test_mmap.c+8−0
@@ -7,6 +7,14 @@ · 6 unmodified lines
77
88 char _license[] SEC("license") = "GPL";
99
10+struct {
11+ __uint(type, BPF_MAP_TYPE_ARRAY);
12+ __uint(max_entries, 4096);
13+ __uint(map_flags, BPF_F_MMAPABLE | BPF_F_RDONLY_PROG);
14+ __type(key, __u32);
15+ __type(value, char);
16+} rdonly_map SEC(".maps");
17+
1018 struct {
1119 __uint(type, BPF_MAP_TYPE_ARRAY);
1220 __uint(max_entries, 512 * 4); /* at least 4 pages of data */
tools/testing/selftests/bpf/progs/test_overhead.c+2−2
@@ -30,13 +30,13 @@ int prog3(struct bpf_raw_tracepoint_args *ctx) · 29 unmodified lines
3030 SEC("fentry/__set_task_comm")
3131 int BPF_PROG(prog4, struct task_struct *tsk, const char *buf, bool exec)
3232 {
33− return !tsk;
33+ return 0;
3434 }
3535
3636 SEC("fexit/__set_task_comm")
3737 int BPF_PROG(prog5, struct task_struct *tsk, const char *buf, bool exec)
3838 {
39− return !tsk;
39+ return 0;
4040 }
4141
4242 char _license[] SEC("license") = "GPL";
tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c+1−0
@@ -351,6 +351,7 @@ static int test_alloc_errors(char *heap_name) · 350 unmodified lines
351351 }
352352
353353 printf("Expected error checking passed\n");
354+ ret = 0;
354355 out:
355356 if (dmabuf_fd >= 0)
356357 close(dmabuf_fd);
tools/testing/selftests/drivers/net/mlxsw/qos_mc_aware.sh+1−1
@@ -300,7 +300,7 @@ test_uc_aware() · 299 unmodified lines
300300 local i
301301
302302 for ((i = 0; i < attempts; ++i)); do
303− if $ARPING -c 1 -I $h1 -b 192.0.2.66 -q -w 0.1; then
303+ if $ARPING -c 1 -I $h1 -b 192.0.2.66 -q -w 1; then
304304 ((passes++))
305305 fi
306306
tools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh+4−0
@@ -264,6 +264,8 @@ trap_policer_test() · 263 unmodified lines
264264 local packets_t0
265265 local packets_t1
266266
267+ RET=0
268+
267269 if [ $(devlink_trap_policers_num_get) -eq 0 ]; then
268270 check_err 1 "Failed to dump policers"
269271 fi
@@ -328,6 +330,8 @@ trap_group_check_policer() · 58 unmodified lines
328330
329331 trap_policer_bind_test()
330332 {
333+ RET=0
334+
331335 devlink trap group set $DEVLINK_DEV group l2_drops policer 1
332336 check_err $? "Failed to bind a valid policer"
333337 if [ $(devlink_trap_group_policer_get "l2_drops") -ne 1 ]; then
tools/testing/selftests/ftrace/test.d/preemptirq/irqsoff_tracer.tc+8−1
@@ -17,7 +17,14 @@ unsup() { #msg · 16 unmodified lines
1717 exit_unsupported
1818 }
1919
20−modprobe $MOD || unsup "$MOD module not available"
20+unres() { #msg
21+ reset_tracer
22+ rmmod $MOD || true
23+ echo $1
24+ exit_unresolved
25+}
26+
27+modprobe $MOD || unres "$MOD module not available"
2128 rmmod $MOD
2229
2330 grep -q "preemptoff" available_tracers || unsup "preemptoff tracer not enabled"
tools/testing/selftests/kvm/Makefile+1−0
@@ -54,6 +54,7 @@ TEST_GEN_PROGS_x86_64 += x86_64/vmx_dirty_log_test · 53 unmodified lines
5454 TEST_GEN_PROGS_x86_64 += x86_64/vmx_set_nested_state_test
5555 TEST_GEN_PROGS_x86_64 += x86_64/vmx_tsc_adjust_test
5656 TEST_GEN_PROGS_x86_64 += x86_64/xss_msr_test
57+TEST_GEN_PROGS_x86_64 += x86_64/debug_regs
5758 TEST_GEN_PROGS_x86_64 += clear_dirty_log_test
5859 TEST_GEN_PROGS_x86_64 += demand_paging_test
5960 TEST_GEN_PROGS_x86_64 += dirty_log_test
tools/testing/selftests/kvm/include/kvm_util.h+2−0
@@ -143,6 +143,8 @@ struct kvm_run *vcpu_state(struct kvm_vm *vm, uint32_t vcpuid); · 142 unmodified lines
143143 void vcpu_run(struct kvm_vm *vm, uint32_t vcpuid);
144144 int _vcpu_run(struct kvm_vm *vm, uint32_t vcpuid);
145145 void vcpu_run_complete_io(struct kvm_vm *vm, uint32_t vcpuid);
146+void vcpu_set_guest_debug(struct kvm_vm *vm, uint32_t vcpuid,
147+ struct kvm_guest_debug *debug);
146148 void vcpu_set_mp_state(struct kvm_vm *vm, uint32_t vcpuid,
147149 struct kvm_mp_state *mp_state);
148150 void vcpu_regs_get(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_regs *regs);
tools/testing/selftests/kvm/lib/kvm_util.c+9−0
@@ -1201,6 +1201,15 @@ void vcpu_run_complete_io(struct kvm_vm *vm, uint32_t vcpuid) · 1200 unmodified lines
12011201 ret, errno);
12021202 }
12031203
1204+void vcpu_set_guest_debug(struct kvm_vm *vm, uint32_t vcpuid,
1205+ struct kvm_guest_debug *debug)
1206+{
1207+ struct vcpu *vcpu = vcpu_find(vm, vcpuid);
1208+ int ret = ioctl(vcpu->fd, KVM_SET_GUEST_DEBUG, debug);
1209+
1210+ TEST_ASSERT(ret == 0, "KVM_SET_GUEST_DEBUG failed: %d", ret);
1211+}
1212+
12041213 /*
12051214 * VM VCPU Set MP State
12061215 *
tools/testing/selftests/kvm/x86_64/debug_regs.c+202−0
@@ -0,0 +1,202 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/*
3+ * KVM guest debug register tests
4+ *
5+ * Copyright (C) 2020, Red Hat, Inc.
6+ */
7+#include <stdio.h>
8+#include <string.h>
9+#include "kvm_util.h"
10+#include "processor.h"
11+
12+#define VCPU_ID 0
13+
14+#define DR6_BD (1 << 13)
15+#define DR7_GD (1 << 13)
16+
17+/* For testing data access debug BP */
18+uint32_t guest_value;
19+
20+extern unsigned char sw_bp, hw_bp, write_data, ss_start, bd_start;
21+
22+static void guest_code(void)
23+{
24+ /*
25+ * Software BP tests.
26+ *
27+ * NOTE: sw_bp need to be before the cmd here, because int3 is an
28+ * exception rather than a normal trap for KVM_SET_GUEST_DEBUG (we
29+ * capture it using the vcpu exception bitmap).
30+ */
31+ asm volatile("sw_bp: int3");
32+
33+ /* Hardware instruction BP test */
34+ asm volatile("hw_bp: nop");
35+
36+ /* Hardware data BP test */
37+ asm volatile("mov $1234,%%rax;\n\t"
38+ "mov %%rax,%0;\n\t write_data:"
39+ : "=m" (guest_value) : : "rax");
40+
41+ /* Single step test, covers 2 basic instructions and 2 emulated */
42+ asm volatile("ss_start: "
43+ "xor %%rax,%%rax\n\t"
44+ "cpuid\n\t"
45+ "movl $0x1a0,%%ecx\n\t"
46+ "rdmsr\n\t"
47+ : : : "rax", "ecx");
48+
49+ /* DR6.BD test */
50+ asm volatile("bd_start: mov %%dr0, %%rax" : : : "rax");
51+ GUEST_DONE();
52+}
53+
54+#define CLEAR_DEBUG() memset(&debug, 0, sizeof(debug))
55+#define APPLY_DEBUG() vcpu_set_guest_debug(vm, VCPU_ID, &debug)
56+#define CAST_TO_RIP(v) ((unsigned long long)&(v))
57+#define SET_RIP(v) do { \
58+ vcpu_regs_get(vm, VCPU_ID, &regs); \
59+ regs.rip = (v); \
60+ vcpu_regs_set(vm, VCPU_ID, &regs); \
61+ } while (0)
62+#define MOVE_RIP(v) SET_RIP(regs.rip + (v));
63+
64+int main(void)
65+{
66+ struct kvm_guest_debug debug;
67+ unsigned long long target_dr6, target_rip;
68+ struct kvm_regs regs;
69+ struct kvm_run *run;
70+ struct kvm_vm *vm;
71+ struct ucall uc;
72+ uint64_t cmd;
73+ int i;
74+ /* Instruction lengths starting at ss_start */
75+ int ss_size[4] = {
76+ 3, /* xor */
77+ 2, /* cpuid */
78+ 5, /* mov */
79+ 2, /* rdmsr */
80+ };
81+
82+ if (!kvm_check_cap(KVM_CAP_SET_GUEST_DEBUG)) {
83+ print_skip("KVM_CAP_SET_GUEST_DEBUG not supported");
84+ return 0;
85+ }
86+
87+ vm = vm_create_default(VCPU_ID, 0, guest_code);
88+ vcpu_set_cpuid(vm, VCPU_ID, kvm_get_supported_cpuid());
89+ run = vcpu_state(vm, VCPU_ID);
90+
91+ /* Test software BPs - int3 */
92+ CLEAR_DEBUG();
93+ debug.control = KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP;
94+ APPLY_DEBUG();
95+ vcpu_run(vm, VCPU_ID);
96+ TEST_ASSERT(run->exit_reason == KVM_EXIT_DEBUG &&
97+ run->debug.arch.exception == BP_VECTOR &&
98+ run->debug.arch.pc == CAST_TO_RIP(sw_bp),
99+ "INT3: exit %d exception %d rip 0x%llx (should be 0x%llx)",
100+ run->exit_reason, run->debug.arch.exception,
101+ run->debug.arch.pc, CAST_TO_RIP(sw_bp));
102+ MOVE_RIP(1);
103+
104+ /* Test instruction HW BP over DR[0-3] */
105+ for (i = 0; i < 4; i++) {
106+ CLEAR_DEBUG();
107+ debug.control = KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_HW_BP;
108+ debug.arch.debugreg[i] = CAST_TO_RIP(hw_bp);
109+ debug.arch.debugreg[7] = 0x400 | (1UL << (2*i+1));
110+ APPLY_DEBUG();
111+ vcpu_run(vm, VCPU_ID);
112+ target_dr6 = 0xffff0ff0 | (1UL << i);
113+ TEST_ASSERT(run->exit_reason == KVM_EXIT_DEBUG &&
114+ run->debug.arch.exception == DB_VECTOR &&
115+ run->debug.arch.pc == CAST_TO_RIP(hw_bp) &&
116+ run->debug.arch.dr6 == target_dr6,
117+ "INS_HW_BP (DR%d): exit %d exception %d rip 0x%llx "
118+ "(should be 0x%llx) dr6 0x%llx (should be 0x%llx)",
119+ i, run->exit_reason, run->debug.arch.exception,
120+ run->debug.arch.pc, CAST_TO_RIP(hw_bp),
121+ run->debug.arch.dr6, target_dr6);
122+ }
123+ /* Skip "nop" */
124+ MOVE_RIP(1);
125+
126+ /* Test data access HW BP over DR[0-3] */
127+ for (i = 0; i < 4; i++) {
128+ CLEAR_DEBUG();
129+ debug.control = KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_HW_BP;
130+ debug.arch.debugreg[i] = CAST_TO_RIP(guest_value);
131+ debug.arch.debugreg[7] = 0x00000400 | (1UL << (2*i+1)) |
132+ (0x000d0000UL << (4*i));
133+ APPLY_DEBUG();
134+ vcpu_run(vm, VCPU_ID);
135+ target_dr6 = 0xffff0ff0 | (1UL << i);
136+ TEST_ASSERT(run->exit_reason == KVM_EXIT_DEBUG &&
137+ run->debug.arch.exception == DB_VECTOR &&
138+ run->debug.arch.pc == CAST_TO_RIP(write_data) &&
139+ run->debug.arch.dr6 == target_dr6,
140+ "DATA_HW_BP (DR%d): exit %d exception %d rip 0x%llx "
141+ "(should be 0x%llx) dr6 0x%llx (should be 0x%llx)",
142+ i, run->exit_reason, run->debug.arch.exception,
143+ run->debug.arch.pc, CAST_TO_RIP(write_data),
144+ run->debug.arch.dr6, target_dr6);
145+ /* Rollback the 4-bytes "mov" */
146+ MOVE_RIP(-7);
147+ }
148+ /* Skip the 4-bytes "mov" */
149+ MOVE_RIP(7);
150+
151+ /* Test single step */
152+ target_rip = CAST_TO_RIP(ss_start);
153+ target_dr6 = 0xffff4ff0ULL;
154+ vcpu_regs_get(vm, VCPU_ID, &regs);
155+ for (i = 0; i < (sizeof(ss_size) / sizeof(ss_size[0])); i++) {
156+ target_rip += ss_size[i];
157+ CLEAR_DEBUG();
158+ debug.control = KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP;
159+ debug.arch.debugreg[7] = 0x00000400;
160+ APPLY_DEBUG();
161+ vcpu_run(vm, VCPU_ID);
162+ TEST_ASSERT(run->exit_reason == KVM_EXIT_DEBUG &&
163+ run->debug.arch.exception == DB_VECTOR &&
164+ run->debug.arch.pc == target_rip &&
165+ run->debug.arch.dr6 == target_dr6,
166+ "SINGLE_STEP[%d]: exit %d exception %d rip 0x%llx "
167+ "(should be 0x%llx) dr6 0x%llx (should be 0x%llx)",
168+ i, run->exit_reason, run->debug.arch.exception,
169+ run->debug.arch.pc, target_rip, run->debug.arch.dr6,
170+ target_dr6);
171+ }
172+
173+ /* Finally test global disable */
174+ CLEAR_DEBUG();
175+ debug.control = KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_HW_BP;
176+ debug.arch.debugreg[7] = 0x400 | DR7_GD;
177+ APPLY_DEBUG();
178+ vcpu_run(vm, VCPU_ID);
179+ target_dr6 = 0xffff0ff0 | DR6_BD;
180+ TEST_ASSERT(run->exit_reason == KVM_EXIT_DEBUG &&
181+ run->debug.arch.exception == DB_VECTOR &&
182+ run->debug.arch.pc == CAST_TO_RIP(bd_start) &&
183+ run->debug.arch.dr6 == target_dr6,
184+ "DR7.GD: exit %d exception %d rip 0x%llx "
185+ "(should be 0x%llx) dr6 0x%llx (should be 0x%llx)",
186+ run->exit_reason, run->debug.arch.exception,
187+ run->debug.arch.pc, target_rip, run->debug.arch.dr6,
188+ target_dr6);
189+
190+ /* Disable all debug controls, run to the end */
191+ CLEAR_DEBUG();
192+ APPLY_DEBUG();
193+
194+ vcpu_run(vm, VCPU_ID);
195+ TEST_ASSERT(run->exit_reason == KVM_EXIT_IO, "KVM_EXIT_IO");
196+ cmd = get_ucall(vm, VCPU_ID, &uc);
197+ TEST_ASSERT(cmd == UCALL_DONE, "UCALL_DONE");
198+
199+ kvm_vm_free(vm);
200+
201+ return 0;
202+}
tools/testing/selftests/lkdtm/run.sh+12−10
@@ -25,13 +25,13 @@ fi · 24 unmodified lines
2525 # Figure out which test to run from our script name.
2626 test=$(basename $0 .sh)
2727 # Look up details about the test from master list of LKDTM tests.
28−line=$(egrep '^#?'"$test"'\b' tests.txt)
28+line=$(grep -E '^#?'"$test"'\b' tests.txt)
2929 if [ -z "$line" ]; then
3030 echo "Skipped: missing test '$test' in tests.txt"
3131 exit $KSELFTEST_SKIP_TEST
3232 fi
3333 # Check that the test is known to LKDTM.
34−if ! egrep -q '^'"$test"'$' "$TRIGGER" ; then
34+if ! grep -E -q '^'"$test"'$' "$TRIGGER" ; then
3535 echo "Skipped: test '$test' missing in $TRIGGER!"
3636 exit $KSELFTEST_SKIP_TEST
3737 fi
@@ -59,30 +59,32 @@ if [ -z "$expect" ]; then · 21 unmodified lines
5959 expect="call trace:"
6060 fi
6161
62−# Clear out dmesg for output reporting
63−dmesg -c >/dev/null
64−
6562 # Prepare log for report checking
66−LOG=$(mktemp --tmpdir -t lkdtm-XXXXXX)
63+LOG=$(mktemp --tmpdir -t lkdtm-log-XXXXXX)
64+DMESG=$(mktemp --tmpdir -t lkdtm-dmesg-XXXXXX)
6765 cleanup() {
68− rm -f "$LOG"
66+ rm -f "$LOG" "$DMESG"
6967 }
7068 trap cleanup EXIT
7169
70+# Save existing dmesg so we can detect new content below
71+dmesg > "$DMESG"
72+
7273 # Most shells yell about signals and we're expecting the "cat" process
7374 # to usually be killed by the kernel. So we have to run it in a sub-shell
7475 # and silence errors.
7576 ($SHELL -c 'cat <(echo '"$test"') >'"$TRIGGER" 2>/dev/null) || true
7677
7778 # Record and dump the results
78−dmesg -c >"$LOG"
79+dmesg | diff --changed-group-format='%>' --unchanged-group-format='' "$DMESG" - > "$LOG" || true
80+
7981 cat "$LOG"
8082 # Check for expected output
81−if egrep -qi "$expect" "$LOG" ; then
83+if grep -E -qi "$expect" "$LOG" ; then
8284 echo "$test: saw '$expect': ok"
8385 exit 0
8486 else
85− if egrep -qi XFAIL: "$LOG" ; then
87+ if grep -E -qi XFAIL: "$LOG" ; then
8688 echo "$test: saw 'XFAIL': [SKIP]"
8789 exit $KSELFTEST_SKIP_TEST
8890 else
tools/testing/selftests/net/mptcp/pm_netlink.sh+1−1
@@ -30,7 +30,7 @@ ret=0 · 29 unmodified lines
3030
3131 cleanup()
3232 {
33− rm -f $out
33+ rm -f $err
3434 ip netns del $ns1
3535 }
3636
tools/testing/selftests/nsfs/pidns.c+1−1
@@ -27,7 +27,7 @@ · 26 unmodified lines
2727 #define __stack_aligned__ __attribute__((aligned(16)))
2828 struct cr_clone_arg {
2929 char stack[128] __stack_aligned__;
30− char stack_ptr[0];
30+ char stack_ptr[];
3131 };
3232
3333 static int child(void *args)
tools/testing/selftests/vm/.gitignore+1−0
@@ -6,6 +6,7 @@ map_populate · 5 unmodified lines
66 thuge-gen
77 compaction_test
88 mlock2-tests
9+mremap_dontunmap
910 on-fault-limit
1011 transhuge-stress
1112 userfaultfd
tools/testing/selftests/vm/write_to_hugetlbfs.c+0−2
@@ -74,8 +74,6 @@ int main(int argc, char **argv) · 73 unmodified lines
7474 int write = 0;
7575 int reserve = 1;
7676
77− unsigned long i;
78−
7977 if (signal(SIGINT, sig_handler) == SIG_ERR)
8078 err(1, "\ncan't catch SIGINT\n");
8179
tools/testing/selftests/wireguard/qemu/Makefile+1−1
@@ -44,7 +44,7 @@ endef · 43 unmodified lines
4444 $(eval $(call tar_download,MUSL,musl,1.2.0,.tar.gz,https://musl.libc.org/releases/,c6de7b191139142d3f9a7b5b702c9cae1b5ee6e7f57e582da9328629408fd4e8))
4545 $(eval $(call tar_download,IPERF,iperf,3.7,.tar.gz,https://downloads.es.net/pub/iperf/,d846040224317caf2f75c843d309a950a7db23f9b44b94688ccbe557d6d1710c))
4646 $(eval $(call tar_download,BASH,bash,5.0,.tar.gz,https://ftp.gnu.org/gnu/bash/,b4a80f2ac66170b2913efbfb9f2594f1f76c7b1afd11f799e22035d63077fb4d))
47−$(eval $(call tar_download,IPROUTE2,iproute2,5.4.0,.tar.xz,https://www.kernel.org/pub/linux/utils/net/iproute2/,fe97aa60a0d4c5ac830be18937e18dc3400ca713a33a89ad896ff1e3d46086ae))
47+$(eval $(call tar_download,IPROUTE2,iproute2,5.6.0,.tar.xz,https://www.kernel.org/pub/linux/utils/net/iproute2/,1b5b0e25ce6e23da7526ea1da044e814ad85ba761b10dd29c2b027c056b04692))
4848 $(eval $(call tar_download,IPTABLES,iptables,1.8.4,.tar.bz2,https://www.netfilter.org/projects/iptables/files/,993a3a5490a544c2cbf2ef15cf7e7ed21af1845baf228318d5c36ef8827e157c))
4949 $(eval $(call tar_download,NMAP,nmap,7.80,.tar.bz2,https://nmap.org/dist/,fcfa5a0e42099e12e4bf7a68ebe6fde05553383a682e816a7ec9256ab4773faa))
5050 $(eval $(call tar_download,IPUTILS,iputils,s20190709,.tar.gz,https://github.com/iputils/iputils/archive/s20190709.tar.gz/#,a15720dd741d7538dd2645f9f516d193636ae4300ff7dbc8bfca757bf166490a))
virt/kvm/kvm_main.c+11−3
@@ -259,6 +259,7 @@ static inline bool kvm_kick_many_cpus(const struct cpumask *cpus, bool wait) · 258 unmodified lines
259259 }
260260
261261 bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req,
262+ struct kvm_vcpu *except,
262263 unsigned long *vcpu_bitmap, cpumask_var_t tmp)
263264 {
264265 int i, cpu, me;
@@ -268,7 +269,8 @@ bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req, · 3 unmodified lines
268269 me = get_cpu();
269270
270271 kvm_for_each_vcpu(i, vcpu, kvm) {
271− if (vcpu_bitmap && !test_bit(i, vcpu_bitmap))
272+ if ((vcpu_bitmap && !test_bit(i, vcpu_bitmap)) ||
273+ vcpu == except)
272274 continue;
273275
274276 kvm_make_request(req, vcpu);
@@ -288,19 +290,25 @@ bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req, · 13 unmodified lines
288290 return called;
289291 }
290292
291−bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req)
293+bool kvm_make_all_cpus_request_except(struct kvm *kvm, unsigned int req,
294+ struct kvm_vcpu *except)
292295 {
293296 cpumask_var_t cpus;
294297 bool called;
295298
296299 zalloc_cpumask_var(&cpus, GFP_ATOMIC);
297300
298− called = kvm_make_vcpus_request_mask(kvm, req, NULL, cpus);
301+ called = kvm_make_vcpus_request_mask(kvm, req, except, NULL, cpus);
299302
300303 free_cpumask_var(cpus);
301304 return called;
302305 }
303306
307+bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req)
308+{
309+ return kvm_make_all_cpus_request_except(kvm, req, NULL);
310+}
311+
304312 #ifndef CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL
305313 void kvm_flush_remote_tlbs(struct kvm *kvm)
306314 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t