History

Merge v5.7-rc5 into driver-core-next

We want the driver core fixes in here and this resolves a merge issue with drivers/base/dd.c

Greg Kroah-Hartman committed 6 years ago

Commit c8be6af2 parents c78c31b 2ef96a5461 files · +4386 −2037Browse files

Unified · Split

461 files
  1. Documentation/admin-guide/device-mapper/dm-integrity.rst +9 −6
  2. Documentation/devicetree/bindings/dma/socionext,uniphier-xdmac.yaml +3 −4
  3. Documentation/networking/devlink/ice.rst +2 −2
  4. Documentation/virt/kvm/index.rst +2 −0
  5. Documentation/virt/kvm/running-nested-guests.rst +276 −0
  6. MAINTAINERS +4 −14
  7. Makefile +12 −5
  8. arch/arm/crypto/chacha-glue.c +11 −3
  9. arch/arm/crypto/nhpoly1305-neon-glue.c +1 −1
  10. arch/arm/crypto/poly1305-glue.c +11 −4
  11. arch/arm/include/asm/futex.h +7 −2
  12. arch/arm64/crypto/chacha-neon-glue.c +11 −3
  13. arch/arm64/crypto/nhpoly1305-neon-glue.c +1 −1
  14. arch/arm64/crypto/poly1305-glue.c +11 −4
  15. arch/arm64/kernel/vdso/Makefile +1 −1
  16. arch/arm64/kvm/guest.c +7 −0
  17. arch/arm64/kvm/hyp/entry.S +23 −0
  18. arch/arm64/kvm/hyp/hyp-entry.S +0 −1
  19. arch/arm64/kvm/hyp/sysreg-sr.c +3 −14
  20. arch/arm64/mm/hugetlbpage.c +2 −0
  21. arch/powerpc/kvm/powerpc.c +1 −0
  22. arch/riscv/Kconfig +1 −1
  23. arch/riscv/include/asm/csr.h +0 −3
  24. arch/riscv/include/asm/hwcap.h +22 −0
  25. arch/riscv/include/asm/set_memory.h +0 −8
  26. arch/riscv/kernel/cpu_ops.c +2 −2
  27. arch/riscv/kernel/cpufeature.c +80 −3
  28. arch/riscv/kernel/sbi.c +10 −7
  29. arch/riscv/kernel/smp.c +2 −0
  30. arch/riscv/kernel/stacktrace.c +2 −2
  31. arch/riscv/kernel/vdso/Makefile +4 −4
  32. arch/riscv/kernel/vdso/note.S +12 −0
  33. arch/riscv/mm/init.c +2 −17
  34. arch/s390/kvm/kvm-s390.c +1 −0
  35. arch/s390/kvm/priv.c +3 −1
  36. arch/s390/lib/uaccess.c +4 −0
  37. arch/s390/mm/pgalloc.c +14 −2
  38. arch/x86/crypto/blake2s-glue.c +4 −6
  39. arch/x86/crypto/chacha_glue.c +11 −3
  40. arch/x86/crypto/nhpoly1305-avx2-glue.c +1 −1
  41. arch/x86/crypto/nhpoly1305-sse2-glue.c +1 −1
  42. arch/x86/crypto/poly1305_glue.c +6 −7
  43. arch/x86/entry/calling.h +21 −19
  44. arch/x86/entry/entry_64.S +7 −7
  45. arch/x86/hyperv/hv_init.c +10 −2
  46. arch/x86/include/asm/ftrace.h +3 −2
  47. arch/x86/include/asm/kvm_host.h +2 −2
  48. arch/x86/include/asm/mshyperv.h +2 −0
  49. arch/x86/include/asm/unwind.h +1 −1
  50. arch/x86/kernel/apic/apic.c +14 −13
  51. arch/x86/kernel/dumpstack_64.c +2 −1
  52. arch/x86/kernel/unwind_frame.c +3 −0
  53. arch/x86/kernel/unwind_orc.c +74 −39
  54. arch/x86/kvm/ioapic.c +5 −5
  55. arch/x86/kvm/svm/sev.c +1 −1
  56. arch/x86/kvm/svm/svm.c +2 −0
  57. arch/x86/kvm/vmx/nested.c +1 −1
  58. arch/x86/kvm/vmx/vmenter.S +3 −0
  59. arch/x86/kvm/x86.c +6 −15
  60. arch/x86/mm/pat/set_memory.c +8 −4
  61. block/bfq-iosched.c +4 −2
  62. block/blk-cgroup.c +1 −1
  63. block/blk-iocost.c +71 −46
  64. block/partitions/core.c +1 −1
  65. crypto/lrw.c +3 −3
  66. crypto/xts.c +3 −3
  67. drivers/acpi/device_pm.c +2 −2
  68. drivers/amba/bus.c +1 −0
  69. drivers/base/component.c +5 −3
  70. drivers/base/core.c +6 −1
  71. drivers/base/dd.c +8 −12
  72. drivers/base/platform.c +2 −0
  73. drivers/block/virtio_blk.c +78 −8
  74. drivers/bus/mhi/core/init.c +3 −4
  75. drivers/bus/mhi/core/internal.h +0 −3
  76. drivers/bus/mhi/core/main.c +5 −13
  77. drivers/bus/mhi/core/pm.c +5 −1
  78. drivers/cpufreq/intel_pstate.c +1 −1
  79. drivers/crypto/caam/caamalg.c +7 −3
  80. drivers/crypto/caam/caamhash.c +6 −2
  81. drivers/crypto/caam/caampkc.c +6 −2
  82. drivers/crypto/chelsio/chcr_ktls.c +46 −37
  83. drivers/dma-buf/dma-buf.c +4 −3
  84. drivers/dma/Kconfig +2 −1
  85. drivers/dma/dmaengine.c +26 −34
  86. drivers/dma/dmatest.c +3 −3
  87. drivers/dma/mmp_tdma.c +4 −1
  88. drivers/dma/pch_dma.c +1 −1
  89. drivers/dma/tegra20-apb-dma.c +9 −0
  90. drivers/dma/ti/k3-psil.c +1 −0
  91. drivers/dma/xilinx/xilinx_dma.c +10 −10
  92. drivers/firmware/efi/tpm.c +1 −1
  93. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 −5
  94. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 −1
  95. drivers/gpu/drm/amd/amdgpu/navi10_sdma_pkt_open.h +16 −0
  96. drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +13 −1
  97. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +40 −15
  98. drivers/gpu/drm/amd/display/dc/core/dc.c +2 −3
  99. drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +27 −0
  100. drivers/gpu/drm/amd/display/dc/core/dc_stream.c +4 −36
  101. drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +1 −0
  102. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +10 −0
  103. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h +1 −0
  104. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_init.c +1 −0
  105. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c +15 −0
  106. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h +14 −6
  107. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +12 −2
  108. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +2 −1
  109. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_init.c +1 −0
  110. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c +1 −0
  111. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.h +2 −1
  112. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +27 −8
  113. drivers/gpu/drm/amd/display/dc/dcn21/dcn21_init.c +1 −0
  114. drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +33 −44
  115. drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c +4 −4
  116. drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h +16 −0
  117. drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +1 −0
  118. drivers/gpu/drm/amd/display/dc/os_types.h +1 −1
  119. drivers/gpu/drm/amd/powerplay/amd_powerplay.c +5 −4
  120. drivers/gpu/drm/drm_dp_mst_topology.c +6 −2
  121. drivers/gpu/drm/drm_edid.c +1 −1
  122. drivers/gpu/drm/drm_hdcp.c +7 −1
  123. drivers/gpu/drm/i915/gem/i915_gem_tiling.c +18 −2
  124. drivers/gpu/drm/i915/gem/selftests/huge_pages.c +8 −4
  125. drivers/gpu/drm/i915/gt/intel_timeline.c +2 −0
  126. drivers/gpu/drm/i915/i915_irq.c +2 −4
  127. drivers/gpu/drm/i915/i915_vma.c +6 −4
  128. drivers/gpu/drm/ingenic/ingenic-drm.c +1 −0
  129. drivers/gpu/drm/qxl/qxl_cmd.c +5 −5
  130. drivers/gpu/drm/qxl/qxl_display.c +3 −3
  131. drivers/gpu/drm/qxl/qxl_draw.c +4 −3
  132. drivers/gpu/drm/qxl/qxl_image.c +2 −1
  133. drivers/gpu/drm/qxl/qxl_ioctl.c +1 −4
  134. drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +1 −1
  135. drivers/gpu/drm/virtio/virtgpu_drv.h +1 −0
  136. drivers/gpu/drm/virtio/virtgpu_gem.c +3 −0
  137. drivers/gpu/drm/virtio/virtgpu_ioctl.c +1 −2
  138. drivers/gpu/drm/virtio/virtgpu_kms.c +6 −11
  139. drivers/hid/Kconfig +1 −0
  140. drivers/hid/hid-alps.c +1 −0
  141. drivers/hid/hid-ids.h +7 −1
  142. drivers/hid/hid-lg-g15.c +4 −0
  143. drivers/hid/hid-multitouch.c +3 −0
  144. drivers/hid/hid-quirks.c +1 −0
  145. drivers/hid/i2c-hid/i2c-hid-core.c +2 −0
  146. drivers/hid/usbhid/hid-core.c +29 −8
  147. drivers/hid/usbhid/usbhid.h +1 −0
  148. drivers/hid/wacom_sys.c +3 −1
  149. drivers/hid/wacom_wac.c +22 −66
  150. drivers/hv/hv.c +1 −5
  151. drivers/hv/hv_trace.h +2 −2
  152. drivers/hv/vmbus_drv.c +34 −9
  153. drivers/i2c/busses/i2c-amd-mp2-pci.c +1 −1
  154. drivers/i2c/busses/i2c-aspeed.c +4 −1
  155. drivers/i2c/busses/i2c-bcm-iproc.c +3 −0
  156. drivers/i2c/busses/i2c-tegra.c +12 −24
  157. drivers/infiniband/core/cm.c +14 −12
  158. drivers/infiniband/core/rdma_core.c +4 −5
  159. drivers/infiniband/core/uverbs_main.c +4 −0
  160. drivers/infiniband/hw/i40iw/i40iw_ctrl.c +1 −1
  161. drivers/infiniband/hw/mlx4/main.c +2 −1
  162. drivers/infiniband/hw/mlx5/qp.c +3 −1
  163. drivers/infiniband/sw/rdmavt/cq.c +2 −2
  164. drivers/infiniband/sw/rdmavt/mmap.c +2 −2
  165. drivers/infiniband/sw/rdmavt/qp.c +2 −2
  166. drivers/infiniband/sw/rdmavt/srq.c +2 −2
  167. drivers/infiniband/sw/siw/siw_qp_tx.c +11 −4
  168. drivers/interconnect/qcom/osm-l3.c +2 −2
  169. drivers/interconnect/qcom/sdm845.c +8 −8
  170. drivers/iommu/Kconfig +2 −2
  171. drivers/iommu/amd_iommu.c +154 −44
  172. drivers/iommu/amd_iommu_init.c +1 −1
  173. drivers/iommu/amd_iommu_types.h +7 −2
  174. drivers/iommu/intel-iommu.c +2 −2
  175. drivers/iommu/iommu.c +2 −1
  176. drivers/iommu/qcom_iommu.c +4 −1
  177. drivers/iommu/virtio-iommu.c +1 −1
  178. drivers/md/dm-mpath.c +4 −2
  179. drivers/md/dm-verity-fec.c +1 −1
  180. drivers/md/dm-writecache.c +37 −15
  181. drivers/misc/mei/hw-me.c +8 −0
  182. drivers/misc/mei/hw-me.h +4 −0
  183. drivers/misc/mei/pci-me.c +1 −1
  184. drivers/mmc/core/mmc_ops.c +1 −1
  185. drivers/mmc/host/cqhci.c +10 −11
  186. drivers/mmc/host/meson-mx-sdio.c +1 −10
  187. drivers/mmc/host/sdhci-msm.c +2 −0
  188. drivers/mmc/host/sdhci-pci-core.c +3 −0
  189. drivers/mmc/host/sdhci-xenon.c +10 −0
  190. drivers/most/core.c +1 −1
  191. drivers/net/dsa/mv88e6xxx/Kconfig +1 −1
  192. drivers/net/dsa/mv88e6xxx/chip.c +0 −4
  193. drivers/net/dsa/ocelot/felix.c +1 −0
  194. drivers/net/dsa/ocelot/felix.h +1 −0
  195. drivers/net/dsa/ocelot/felix_vsc9959.c +1 −0
  196. drivers/net/dsa/sja1105/Kconfig +1 −0
  197. drivers/net/dsa/sja1105/sja1105_ptp.c +18 −8
  198. drivers/net/ethernet/amazon/ena/ena_netdev.h +1 −1
  199. drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +1 −1
  200. drivers/net/ethernet/broadcom/bgmac-platform.c +15 −9
  201. drivers/net/ethernet/broadcom/bnxt/bnxt.c +13 −7
  202. drivers/net/ethernet/broadcom/bnxt/bnxt.h +0 −1
  203. drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h +1 −1
  204. drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +2 −8
  205. drivers/net/ethernet/cadence/Kconfig +1 −1
  206. drivers/net/ethernet/cadence/macb_main.c +12 −12
  207. drivers/net/ethernet/cavium/Kconfig +1 −1
  208. drivers/net/ethernet/chelsio/cxgb4/sge.c +37 −3
  209. drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c +1 −1
  210. drivers/net/ethernet/ibm/ibmvnic.c +2 −1
  211. drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c +3 −0
  212. drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +2 −0
  213. drivers/net/ethernet/mellanox/mlx4/main.c +3 −1
  214. drivers/net/ethernet/mellanox/mlx5/core/cmd.c +5 −1
  215. drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +2 −7
  216. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +9 −9
  217. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c +13 −1
  218. drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c +10 −2
  219. drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c +2 −1
  220. drivers/net/ethernet/moxa/moxart_ether.c +1 −1
  221. drivers/net/ethernet/mscc/ocelot.c +11 −6
  222. drivers/net/ethernet/mscc/ocelot_regs.c +1 −0
  223. drivers/net/ethernet/natsemi/jazzsonic.c +4 −2
  224. drivers/net/ethernet/netronome/nfp/abm/main.c +1 −0
  225. drivers/net/ethernet/pensando/ionic/ionic_debugfs.c +1 −2
  226. drivers/net/ethernet/pensando/ionic/ionic_lif.c +2 −2
  227. drivers/net/ethernet/stmicro/stmmac/dwmac5.c +1 −1
  228. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4 −7
  229. drivers/net/ethernet/ti/Kconfig +1 −2
  230. drivers/net/ethernet/ti/am65-cpsw-nuss.c +3 −2
  231. drivers/net/ethernet/toshiba/tc35815.c +1 −1
  232. drivers/net/gtp.c +5 −4
  233. drivers/net/hyperv/netvsc_drv.c +2 −1
  234. drivers/net/ipa/gsi.c +9 −2
  235. drivers/net/ipa/gsi_reg.h +2 −0
  236. drivers/net/ipa/ipa_endpoint.c +2 −5
  237. drivers/net/macsec.c +4 −2
  238. drivers/net/phy/dp83640.c +1 −1
  239. drivers/net/phy/dp83822.c +14 −16
  240. drivers/net/phy/dp83tc811.c +12 −9
  241. drivers/net/phy/marvell10g.c +26 −1
  242. drivers/net/usb/qmi_wwan.c +1 −0
  243. drivers/net/wireguard/queueing.c +3 −1
  244. drivers/net/wireguard/receive.c +10 −11
  245. drivers/net/wireguard/selftest/ratelimiter.c +2 −2
  246. drivers/net/wireguard/send.c +10 −10
  247. drivers/net/wireguard/socket.c +0 −12
  248. drivers/nvme/host/core.c +3 −1
  249. drivers/nvme/host/pci.c +5 −1
  250. drivers/phy/qualcomm/phy-qcom-qusb2.c +7 −0
  251. drivers/phy/qualcomm/phy-qcom-usb-hs-28nm.c +21 −11
  252. drivers/platform/chrome/cros_ec_sensorhub.c +46 −34
  253. drivers/platform/chrome/cros_ec_sensorhub_ring.c +46 −27
  254. drivers/platform/x86/asus-nb-wmi.c +24 −0
  255. drivers/platform/x86/intel-uncore-frequency.c +1 −1
  256. drivers/platform/x86/intel_pmc_core.c +5 −19
  257. drivers/platform/x86/intel_pmc_core.h +0 −2
  258. drivers/platform/x86/surface3_power.c +2 −2
  259. drivers/platform/x86/thinkpad_acpi.c +1 −1
  260. drivers/platform/x86/xiaomi-wmi.c +2 −2
  261. drivers/regulator/core.c +11 −14
  262. drivers/s390/net/qeth_core_main.c +5 −5
  263. drivers/scsi/ibmvscsi/ibmvfc.c +5 −0
  264. drivers/scsi/ibmvscsi/ibmvscsi.c +0 −4
  265. drivers/scsi/qla2xxx/qla_attr.c +1 −1
  266. drivers/scsi/qla2xxx/qla_mbx.c +1 −1
  267. drivers/scsi/qla2xxx/qla_os.c +17 −18
  268. drivers/scsi/scsi_lib.c +1 −0
  269. drivers/staging/gasket/gasket_core.c +4 −0
  270. drivers/staging/ks7010/TODO +0 −1
  271. drivers/target/target_core_iblock.c +1 −1
  272. drivers/thunderbolt/usb4.c +3 −0
  273. drivers/tty/hvc/Kconfig +1 −1
  274. drivers/tty/serial/Kconfig +1 −1
  275. drivers/tty/serial/bcm63xx_uart.c +1 −3
  276. drivers/tty/serial/xilinx_uartps.c +1 −0
  277. drivers/tty/vt/vt.c +7 −2
  278. drivers/usb/chipidea/ci_hdrc_msm.c +1 −1
  279. drivers/usb/core/devio.c +2 −3
  280. drivers/usb/core/message.c +2 −2
  281. drivers/usb/serial/garmin_gps.c +2 −2
  282. drivers/usb/serial/qcserial.c +1 −0
  283. drivers/usb/storage/unusual_uas.h +7 −0
  284. drivers/usb/typec/mux/intel_pmc_mux.c +6 −2
  285. drivers/vfio/vfio_iommu_type1.c +5 −5
  286. drivers/vhost/vsock.c +16 −5
  287. fs/btrfs/backref.c +1 −1
  288. fs/btrfs/block-group.c +14 −6
  289. fs/btrfs/discard.h +1 −1
  290. fs/btrfs/disk-io.c +32 −4
  291. fs/btrfs/relocation.c +1 −0
  292. fs/btrfs/transaction.c +11 −2
  293. fs/btrfs/tree-log.c +40 −3
  294. fs/ceph/caps.c +2 −1
  295. fs/ceph/debugfs.c +1 −1
  296. fs/ceph/mds_client.c +3 −5
  297. fs/ceph/quota.c +2 −2
  298. fs/configfs/dir.c +1 −0
  299. fs/coredump.c +8 −0
  300. fs/eventpoll.c +33 −28
  301. fs/io_uring.c +53 −70
  302. fs/ioctl.c +8 −0
  303. fs/iomap/fiemap.c +1 −4
  304. fs/nfs/nfs3acl.c +15 −7
  305. fs/nfs/nfs4proc.c +9 −2
  306. fs/nfs/pnfs.c +5 −6
  307. fs/nfs/super.c +1 −1
  308. fs/ocfs2/dlmfs/dlmfs.c +12 −15
  309. fs/pnode.c +4 −5
  310. fs/splice.c +18 −27
  311. fs/super.c +1 −1
  312. fs/vboxsf/super.c +1 −1
  313. include/linux/amba/bus.h +1 −0
  314. include/linux/backing-dev-defs.h +1 −0
  315. include/linux/backing-dev.h +1 −8
  316. include/linux/dma-buf.h +1 −2
  317. include/linux/dmaengine.h +6 −6
  318. include/linux/fs.h +1 −1
  319. include/linux/lsm_hook_defs.h +1 −1
  320. include/linux/mhi.h +10 −6
  321. include/linux/nfs_xdr.h +2 −0
  322. include/linux/platform_data/cros_ec_sensorhub.h +1 −0
  323. include/linux/platform_device.h +1 −0
  324. include/linux/sunrpc/clnt.h +12 −1
  325. include/linux/tcp.h +0 −51
  326. include/linux/tty.h +1 −1
  327. include/linux/virtio_net.h +24 −2
  328. include/linux/virtio_vsock.h +1 −0
  329. include/net/flow_offload.h +8 −1
  330. include/net/inet_ecn.h +55 −2
  331. include/net/ip6_fib.h +4 −0
  332. include/net/mptcp.h +0 −3
  333. include/net/net_namespace.h +7 −0
  334. include/net/sch_generic.h +1 −0
  335. include/soc/mscc/ocelot.h +1 −0
  336. include/trace/events/gpu_mem.h +1 −1
  337. include/trace/events/rpcrdma.h +4 −8
  338. include/trace/events/wbt.h +4 −4
  339. include/uapi/drm/amdgpu_drm.h +4 −0
  340. include/uapi/linux/bpf.h +1 −1
  341. include/uapi/linux/dlm_device.h +2 −2
  342. include/uapi/linux/dma-buf.h +6 −0
  343. include/uapi/linux/fiemap.h +1 −1
  344. include/uapi/linux/hyperv.h +2 −2
  345. include/uapi/linux/if_arcnet.h +3 −3
  346. include/uapi/linux/mmc/ioctl.h +1 −1
  347. include/uapi/linux/net_dropmon.h +2 −2
  348. include/uapi/linux/netfilter_bridge/ebt_among.h +1 −1
  349. include/uapi/scsi/scsi_bsg_fc.h +1 −1
  350. init/Kconfig +0 −18
  351. init/initramfs.c +1 −1
  352. init/main.c +52 −17
  353. ipc/mqueue.c +26 −8
  354. kernel/kcov.c +2 −2
  355. kernel/power/hibernate.c +7 −0
  356. kernel/trace/Kconfig +0 −1
  357. kernel/trace/preemptirq_delay_test.c +24 −6
  358. kernel/trace/trace.c +15 −1
  359. kernel/trace/trace_boot.c +8 −12
  360. kernel/trace/trace_kprobe.c +7 −1
  361. kernel/umh.c +5 −0
  362. lib/Kconfig.ubsan +6 −9
  363. lib/kunit/test.c +1 −1
  364. mm/backing-dev.c +11 −2
  365. mm/memcontrol.c +9 −6
  366. mm/page_alloc.c +9 −0
  367. mm/percpu.c +10 −4
  368. mm/slub.c +30 −15
  369. mm/vmscan.c +0 −1
  370. net/atm/common.c +11 −11
  371. net/atm/lec.c +6 −0
  372. net/batman-adv/bat_v_ogm.c +1 −1
  373. net/batman-adv/network-coding.c +1 −8
  374. net/batman-adv/sysfs.c +2 −1
  375. net/bridge/br_netlink.c +1 −0
  376. net/core/devlink.c +10 −2
  377. net/core/drop_monitor.c +7 −4
  378. net/core/neighbour.c +3 −3
  379. net/core/sock.c +0 −1
  380. net/dsa/dsa2.c +1 −1
  381. net/dsa/master.c +2 −1
  382. net/dsa/slave.c +3 −5
  383. net/hsr/hsr_slave.c +1 −1
  384. net/ipv4/tcp_input.c +0 −7
  385. net/ipv6/route.c +25 −0
  386. net/ipv6/seg6.c +8 −2
  387. net/mptcp/options.c +41 −54
  388. net/mptcp/protocol.c +9 −8
  389. net/mptcp/protocol.h +41 −2
  390. net/mptcp/subflow.c +55 −31
  391. net/netfilter/nf_nat_proto.c +1 −3
  392. net/netfilter/nfnetlink_osf.c +7 −5
  393. net/sched/cls_api.c +16 −6
  394. net/sched/sch_choke.c +2 −1
  395. net/sched/sch_fq_codel.c +1 −1
  396. net/sched/sch_sfq.c +9 −0
  397. net/sched/sch_skbprio.c +3 −0
  398. net/sunrpc/clnt.c +18 −6
  399. net/sunrpc/xprtrdma/rpc_rdma.c +11 −4
  400. net/sunrpc/xprtrdma/verbs.c +2 −1
  401. net/tipc/topsrv.c +3 −2
  402. net/tls/tls_sw.c +5 −2
  403. net/vmw_vsock/virtio_transport_common.c +4 −0
  404. net/x25/x25_subr.c +6 −0
  405. samples/trace_events/trace-events-sample.h +1 −1
  406. scripts/decodecode +1 −1
  407. scripts/gcc-plugins/Makefile +1 −0
  408. scripts/gcc-plugins/gcc-common.h +4 −0
  409. scripts/gcc-plugins/stackleak_plugin.c +2 −3
  410. scripts/gdb/linux/rbtree.py +2 −2
  411. scripts/kallsyms.c +1 −1
  412. security/selinux/hooks.c +45 −25
  413. security/selinux/ss/conditional.c +1 −1
  414. sound/core/oss/pcm_plugin.c +6 −4
  415. sound/isa/opti9xx/miro.c +6 −3
  416. sound/isa/opti9xx/opti92x-ad1848.c +6 −3
  417. sound/pci/hda/hda_intel.c +5 −4
  418. sound/pci/hda/patch_hdmi.c +5 −1
  419. sound/pci/hda/patch_realtek.c +1 −0
  420. sound/usb/line6/podhd.c +5 −17
  421. sound/usb/quirks.c +1 −1
  422. tools/bootconfig/main.c +6 −3
  423. tools/cgroup/iocost_monitor.py +6 −1
  424. tools/objtool/check.c +14 −3
  425. tools/objtool/elf.h +4 −3
  426. tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c +146 −0
  427. tools/testing/selftests/ftrace/ftracetest +30 −2
  428. tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc +1 −4
  429. tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter.tc +2 −0
  430. tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc +2 −0
  431. tools/testing/selftests/ftrace/test.d/ftrace/func-filter-notrace-pid.tc +1 −4
  432. tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc +1 −4
  433. tools/testing/selftests/ftrace/test.d/ftrace/func-filter-stacktrace.tc +1 −1
  434. tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc +1 −4
  435. tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc +1 −1
  436. tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc +1 −4
  437. tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc +1 −4
  438. tools/testing/selftests/ftrace/test.d/ftrace/func_stack_tracer.tc +2 −0
  439. tools/testing/selftests/ftrace/test.d/ftrace/func_traceonoff_triggers.tc +1 −4
  440. tools/testing/selftests/ftrace/test.d/functions +6 −0
  441. tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +1 −1
  442. tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc +2 −0
  443. tools/testing/selftests/gpio/Makefile +6 −6
  444. tools/testing/selftests/intel_pstate/Makefile +1 −1
  445. tools/testing/selftests/kselftest_deps.sh +272 −0
  446. tools/testing/selftests/kvm/Makefile +28 −1
  447. tools/testing/selftests/kvm/include/evmcs.h +2 −2
  448. tools/testing/selftests/kvm/lib/x86_64/vmx.c +3 −0
  449. tools/testing/selftests/memfd/Makefile +12 −2
  450. tools/testing/selftests/net/tcp_mmap.c +5 −2
  451. tools/testing/selftests/wireguard/netns.sh +51 −3
  452. tools/testing/selftests/wireguard/qemu/arch/powerpc64le.config +1 −0
  453. tools/testing/selftests/wireguard/qemu/debug.config +0 −1
  454. virt/kvm/arm/hyp/aarch32.c +6 −2
  455. virt/kvm/arm/psci.c +40 −0
  456. virt/kvm/arm/vgic/vgic-init.c +16 −3
  457. virt/kvm/arm/vgic/vgic-its.c +9 −2
  458. virt/kvm/arm/vgic/vgic-mmio-v2.c +10 −6
  459. virt/kvm/arm/vgic/vgic-mmio-v3.c +18 −13
  460. virt/kvm/arm/vgic/vgic-mmio.c +170 −58
  461. virt/kvm/arm/vgic/vgic-mmio.h +19 −0
Documentation/admin-guide/device-mapper/dm-integrity.rst+9−6
@@ -182,12 +182,15 @@ fix_padding · 181 unmodified lines
182182 space-efficient. If this option is not present, large padding is
183183 used - that is for compatibility with older kernels.
184184
185−
186−The journal mode (D/J), buffer_sectors, journal_watermark, commit_time can
187−be changed when reloading the target (load an inactive table and swap the
188−tables with suspend and resume). The other arguments should not be changed
189−when reloading the target because the layout of disk data depend on them
190−and the reloaded target would be non-functional.
185+allow_discards
186+ Allow block discard requests (a.k.a. TRIM) for the integrity device.
187+ Discards are only allowed to devices using internal hash.
188+
189+The journal mode (D/J), buffer_sectors, journal_watermark, commit_time and
190+allow_discards can be changed when reloading the target (load an inactive
191+table and swap the tables with suspend and resume). The other arguments
192+should not be changed when reloading the target because the layout of disk
193+data depend on them and the reloaded target would be non-functional.
191194
192195
193196 The layout of the formatted block device:
Documentation/devicetree/bindings/dma/socionext,uniphier-xdmac.yaml+3−4
@@ -22,9 +22,7 @@ properties: · 21 unmodified lines
2222 const: socionext,uniphier-xdmac
2323
2424 reg:
25− items:
26− - description: XDMAC base register region (offset and length)
27− - description: XDMAC extension register region (offset and length)
25+ maxItems: 1
2826
2927 interrupts:
3028 maxItems: 1
@@ -49,12 +47,13 @@ required: · 18 unmodified lines
4947 - reg
5048 - interrupts
5149 - "#dma-cells"
50+ - dma-channels
5251
5352 examples:
5453 - |
5554 xdmac: dma-controller@5fc10000 {
5655 compatible = "socionext,uniphier-xdmac";
57− reg = <0x5fc10000 0x1000>, <0x5fc20000 0x800>;
56+ reg = <0x5fc10000 0x5300>;
5857 interrupts = <0 188 4>;
5958 #dma-cells = <2>;
6059 dma-channels = <16>;
Documentation/networking/devlink/ice.rst+2−2
@@ -61,8 +61,8 @@ The ``ice`` driver reports the following versions · 60 unmodified lines
6161 - running
6262 - ICE OS Default Package
6363 - The name of the DDP package that is active in the device. The DDP
64− package is loaded by the driver during initialization. Each varation
65− of DDP package shall have a unique name.
64+ package is loaded by the driver during initialization. Each
65+ variation of the DDP package has a unique name.
6666 * - ``fw.app``
6767 - running
6868 - 1.3.1.0
Documentation/virt/kvm/index.rst+2−0
@@ -28,3 +28,5 @@ KVM · 27 unmodified lines
2828 arm/index
2929
3030 devices/index
31+
32+ running-nested-guests
Documentation/virt/kvm/running-nested-guests.rst+276−0
@@ -0,0 +1,276 @@
1+==============================
2+Running nested guests with KVM
3+==============================
4+
5+A nested guest is the ability to run a guest inside another guest (it
6+can be KVM-based or a different hypervisor). The straightforward
7+example is a KVM guest that in turn runs on a KVM guest (the rest of
8+this document is built on this example)::
9+
10+ .----------------. .----------------.
11+ | | | |
12+ | L2 | | L2 |
13+ | (Nested Guest) | | (Nested Guest) |
14+ | | | |
15+ |----------------'--'----------------|
16+ | |
17+ | L1 (Guest Hypervisor) |
18+ | KVM (/dev/kvm) |
19+ | |
20+ .------------------------------------------------------.
21+ | L0 (Host Hypervisor) |
22+ | KVM (/dev/kvm) |
23+ |------------------------------------------------------|
24+ | Hardware (with virtualization extensions) |
25+ '------------------------------------------------------'
26+
27+Terminology:
28+
29+- L0 – level-0; the bare metal host, running KVM
30+
31+- L1 – level-1 guest; a VM running on L0; also called the "guest
32+ hypervisor", as it itself is capable of running KVM.
33+
34+- L2 – level-2 guest; a VM running on L1, this is the "nested guest"
35+
36+.. note:: The above diagram is modelled after the x86 architecture;
37+ s390x, ppc64 and other architectures are likely to have
38+ a different design for nesting.
39+
40+ For example, s390x always has an LPAR (LogicalPARtition)
41+ hypervisor running on bare metal, adding another layer and
42+ resulting in at least four levels in a nested setup — L0 (bare
43+ metal, running the LPAR hypervisor), L1 (host hypervisor), L2
44+ (guest hypervisor), L3 (nested guest).
45+
46+ This document will stick with the three-level terminology (L0,
47+ L1, and L2) for all architectures; and will largely focus on
48+ x86.
49+
50+
51+Use Cases
52+---------
53+
54+There are several scenarios where nested KVM can be useful, to name a
55+few:
56+
57+- As a developer, you want to test your software on different operating
58+ systems (OSes). Instead of renting multiple VMs from a Cloud
59+ Provider, using nested KVM lets you rent a large enough "guest
60+ hypervisor" (level-1 guest). This in turn allows you to create
61+ multiple nested guests (level-2 guests), running different OSes, on
62+ which you can develop and test your software.
63+
64+- Live migration of "guest hypervisors" and their nested guests, for
65+ load balancing, disaster recovery, etc.
66+
67+- VM image creation tools (e.g. ``virt-install``, etc) often run
68+ their own VM, and users expect these to work inside a VM.
69+
70+- Some OSes use virtualization internally for security (e.g. to let
71+ applications run safely in isolation).
72+
73+
74+Enabling "nested" (x86)
75+-----------------------
76+
77+From Linux kernel v4.19 onwards, the ``nested`` KVM parameter is enabled
78+by default for Intel and AMD. (Though your Linux distribution might
79+override this default.)
80+
81+In case you are running a Linux kernel older than v4.19, to enable
82+nesting, set the ``nested`` KVM module parameter to ``Y`` or ``1``. To
83+persist this setting across reboots, you can add it in a config file, as
84+shown below:
85+
86+1. On the bare metal host (L0), list the kernel modules and ensure that
87+ the KVM modules::
88+
89+ $ lsmod | grep -i kvm
90+ kvm_intel 133627 0
91+ kvm 435079 1 kvm_intel
92+
93+2. Show information for ``kvm_intel`` module::
94+
95+ $ modinfo kvm_intel | grep -i nested
96+ parm: nested:bool
97+
98+3. For the nested KVM configuration to persist across reboots, place the
99+ below in ``/etc/modprobed/kvm_intel.conf`` (create the file if it
100+ doesn't exist)::
101+
102+ $ cat /etc/modprobe.d/kvm_intel.conf
103+ options kvm-intel nested=y
104+
105+4. Unload and re-load the KVM Intel module::
106+
107+ $ sudo rmmod kvm-intel
108+ $ sudo modprobe kvm-intel
109+
110+5. Verify if the ``nested`` parameter for KVM is enabled::
111+
112+ $ cat /sys/module/kvm_intel/parameters/nested
113+ Y
114+
115+For AMD hosts, the process is the same as above, except that the module
116+name is ``kvm-amd``.
117+
118+
119+Additional nested-related kernel parameters (x86)
120+-------------------------------------------------
121+
122+If your hardware is sufficiently advanced (Intel Haswell processor or
123+higher, which has newer hardware virt extensions), the following
124+additional features will also be enabled by default: "Shadow VMCS
125+(Virtual Machine Control Structure)", APIC Virtualization on your bare
126+metal host (L0). Parameters for Intel hosts::
127+
128+ $ cat /sys/module/kvm_intel/parameters/enable_shadow_vmcs
129+ Y
130+
131+ $ cat /sys/module/kvm_intel/parameters/enable_apicv
132+ Y
133+
134+ $ cat /sys/module/kvm_intel/parameters/ept
135+ Y
136+
137+.. note:: If you suspect your L2 (i.e. nested guest) is running slower,
138+ ensure the above are enabled (particularly
139+ ``enable_shadow_vmcs`` and ``ept``).
140+
141+
142+Starting a nested guest (x86)
143+-----------------------------
144+
145+Once your bare metal host (L0) is configured for nesting, you should be
146+able to start an L1 guest with::
147+
148+ $ qemu-kvm -cpu host [...]
149+
150+The above will pass through the host CPU's capabilities as-is to the
151+gues); or for better live migration compatibility, use a named CPU
152+model supported by QEMU. e.g.::
153+
154+ $ qemu-kvm -cpu Haswell-noTSX-IBRS,vmx=on
155+
156+then the guest hypervisor will subsequently be capable of running a
157+nested guest with accelerated KVM.
158+
159+
160+Enabling "nested" (s390x)
161+-------------------------
162+
163+1. On the host hypervisor (L0), enable the ``nested`` parameter on
164+ s390x::
165+
166+ $ rmmod kvm
167+ $ modprobe kvm nested=1
168+
169+.. note:: On s390x, the kernel parameter ``hpage`` is mutually exclusive
170+ with the ``nested`` paramter — i.e. to be able to enable
171+ ``nested``, the ``hpage`` parameter *must* be disabled.
172+
173+2. The guest hypervisor (L1) must be provided with the ``sie`` CPU
174+ feature — with QEMU, this can be done by using "host passthrough"
175+ (via the command-line ``-cpu host``).
176+
177+3. Now the KVM module can be loaded in the L1 (guest hypervisor)::
178+
179+ $ modprobe kvm
180+
181+
182+Live migration with nested KVM
183+------------------------------
184+
185+Migrating an L1 guest, with a *live* nested guest in it, to another
186+bare metal host, works as of Linux kernel 5.3 and QEMU 4.2.0 for
187+Intel x86 systems, and even on older versions for s390x.
188+
189+On AMD systems, once an L1 guest has started an L2 guest, the L1 guest
190+should no longer be migrated or saved (refer to QEMU documentation on
191+"savevm"/"loadvm") until the L2 guest shuts down. Attempting to migrate
192+or save-and-load an L1 guest while an L2 guest is running will result in
193+undefined behavior. You might see a ``kernel BUG!`` entry in ``dmesg``, a
194+kernel 'oops', or an outright kernel panic. Such a migrated or loaded L1
195+guest can no longer be considered stable or secure, and must be restarted.
196+Migrating an L1 guest merely configured to support nesting, while not
197+actually running L2 guests, is expected to function normally even on AMD
198+systems but may fail once guests are started.
199+
200+Migrating an L2 guest is always expected to succeed, so all the following
201+scenarios should work even on AMD systems:
202+
203+- Migrating a nested guest (L2) to another L1 guest on the *same* bare
204+ metal host.
205+
206+- Migrating a nested guest (L2) to another L1 guest on a *different*
207+ bare metal host.
208+
209+- Migrating a nested guest (L2) to a bare metal host.
210+
211+Reporting bugs from nested setups
212+-----------------------------------
213+
214+Debugging "nested" problems can involve sifting through log files across
215+L0, L1 and L2; this can result in tedious back-n-forth between the bug
216+reporter and the bug fixer.
217+
218+- Mention that you are in a "nested" setup. If you are running any kind
219+ of "nesting" at all, say so. Unfortunately, this needs to be called
220+ out because when reporting bugs, people tend to forget to even
221+ *mention* that they're using nested virtualization.
222+
223+- Ensure you are actually running KVM on KVM. Sometimes people do not
224+ have KVM enabled for their guest hypervisor (L1), which results in
225+ them running with pure emulation or what QEMU calls it as "TCG", but
226+ they think they're running nested KVM. Thus confusing "nested Virt"
227+ (which could also mean, QEMU on KVM) with "nested KVM" (KVM on KVM).
228+
229+Information to collect (generic)
230+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
231+
232+The following is not an exhaustive list, but a very good starting point:
233+
234+ - Kernel, libvirt, and QEMU version from L0
235+
236+ - Kernel, libvirt and QEMU version from L1
237+
238+ - QEMU command-line of L1 -- when using libvirt, you'll find it here:
239+ ``/var/log/libvirt/qemu/instance.log``
240+
241+ - QEMU command-line of L2 -- as above, when using libvirt, get the
242+ complete libvirt-generated QEMU command-line
243+
244+ - ``cat /sys/cpuinfo`` from L0
245+
246+ - ``cat /sys/cpuinfo`` from L1
247+
248+ - ``lscpu`` from L0
249+
250+ - ``lscpu`` from L1
251+
252+ - Full ``dmesg`` output from L0
253+
254+ - Full ``dmesg`` output from L1
255+
256+x86-specific info to collect
257+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
258+
259+Both the below commands, ``x86info`` and ``dmidecode``, should be
260+available on most Linux distributions with the same name:
261+
262+ - Output of: ``x86info -a`` from L0
263+
264+ - Output of: ``x86info -a`` from L1
265+
266+ - Output of: ``dmidecode`` from L0
267+
268+ - Output of: ``dmidecode`` from L1
269+
270+s390x-specific info to collect
271+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
272+
273+Along with the earlier mentioned generic details, the below is
274+also recommended:
275+
276+ - ``/proc/sysinfo`` from L1; this will also include the info from L0
MAINTAINERS+4−14
@@ -3657,7 +3657,7 @@ L: linux-btrfs@vger.kernel.org · 3656 unmodified lines
36573657 S: Maintained
36583658 W: http://btrfs.wiki.kernel.org/
36593659 Q: http://patchwork.kernel.org/project/linux-btrfs/list/
3660−T: git git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git
3660+T: git git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git
36613661 F: Documentation/filesystems/btrfs.rst
36623662 F: fs/btrfs/
36633663 F: include/linux/btrfs*
@@ -3936,11 +3936,9 @@ F: arch/powerpc/platforms/cell/ · 272 unmodified lines
39363936 CEPH COMMON CODE (LIBCEPH)
39373937 M: Ilya Dryomov <idryomov@gmail.com>
39383938 M: Jeff Layton <jlayton@kernel.org>
3939−M: Sage Weil <sage@redhat.com>
39403939 L: ceph-devel@vger.kernel.org
39413940 S: Supported
39423941 W: http://ceph.com/
3943−T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git
39443942 T: git git://github.com/ceph/ceph-client.git
39453943 F: include/linux/ceph/
39463944 F: include/linux/crush/
@@ -3948,12 +3946,10 @@ F: net/ceph/ · 1 unmodified line
39483946
39493947 CEPH DISTRIBUTED FILE SYSTEM CLIENT (CEPH)
39503948 M: Jeff Layton <jlayton@kernel.org>
3951−M: Sage Weil <sage@redhat.com>
39523949 M: Ilya Dryomov <idryomov@gmail.com>
39533950 L: ceph-devel@vger.kernel.org
39543951 S: Supported
39553952 W: http://ceph.com/
3956−T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git
39573953 T: git git://github.com/ceph/ceph-client.git
39583954 F: Documentation/filesystems/ceph.rst
39593955 F: fs/ceph/
@@ -5935,9 +5931,9 @@ F: lib/dynamic_debug.c · 1975 unmodified lines
59355931 DYNAMIC INTERRUPT MODERATION
59365932 M: Tal Gilboa <talgi@mellanox.com>
59375933 S: Maintained
5934+F: Documentation/networking/net_dim.rst
59385935 F: include/linux/dim.h
59395936 F: lib/dim/
5940−F: Documentation/networking/net_dim.rst
59415937
59425938 DZ DECSTATION DZ11 SERIAL DRIVER
59435939 M: "Maciej W. Rozycki" <macro@linux-mips.org>
@@ -7119,9 +7115,10 @@ F: include/uapi/asm-generic/ · 1175 unmodified lines
71197115
71207116 GENERIC PHY FRAMEWORK
71217117 M: Kishon Vijay Abraham I <kishon@ti.com>
7118+M: Vinod Koul <vkoul@kernel.org>
71227119 L: linux-kernel@vger.kernel.org
71237120 S: Supported
7124−T: git git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git
7121+T: git git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy.git
71257122 F: Documentation/devicetree/bindings/phy/
71267123 F: drivers/phy/
71277124 F: include/linux/phy/
@@ -7746,11 +7743,6 @@ L: platform-driver-x86@vger.kernel.org · 618 unmodified lines
77467743 S: Orphan
77477744 F: drivers/platform/x86/tc1100-wmi.c
77487745
7749−HP100: Driver for HP 10/100 Mbit/s Voice Grade Network Adapter Series
7750−M: Jaroslav Kysela <perex@perex.cz>
7751−S: Obsolete
7752−F: drivers/staging/hp/hp100.*
7753−
77547746 HPET: High Precision Event Timers driver
77557747 M: Clemens Ladisch <clemens@ladisch.de>
77567748 S: Maintained
@@ -14102,12 +14094,10 @@ F: drivers/media/radio/radio-tea5777.c · 6345 unmodified lines
1410214094
1410314095 RADOS BLOCK DEVICE (RBD)
1410414096 M: Ilya Dryomov <idryomov@gmail.com>
14105−M: Sage Weil <sage@redhat.com>
1410614097 R: Dongsheng Yang <dongsheng.yang@easystack.cn>
1410714098 L: ceph-devel@vger.kernel.org
1410814099 S: Supported
1410914100 W: http://ceph.com/
14110−T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git
1411114101 T: git git://github.com/ceph/ceph-client.git
1411214102 F: Documentation/ABI/testing/sysfs-bus-rbd
1411314103 F: drivers/block/rbd.c
Makefile+12−5
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 7
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc3
5+EXTRAVERSION = -rc5
66 NAME = Kleptomaniac Octopus
77
88 # *DOCUMENTATION*
@@ -729,10 +729,6 @@ else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE · 720 unmodified lines
729729 KBUILD_CFLAGS += -Os
730730 endif
731731
732−ifdef CONFIG_CC_DISABLE_WARN_MAYBE_UNINITIALIZED
733−KBUILD_CFLAGS += -Wno-maybe-uninitialized
734−endif
735−
736732 # Tell gcc to never replace conditional load with a non-conditional one
737733 KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
738734 KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)
@@ -881,6 +877,17 @@ KBUILD_CFLAGS += -Wno-pointer-sign · 142 unmodified lines
881877 # disable stringop warnings in gcc 8+
882878 KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
883879
880+# We'll want to enable this eventually, but it's not going away for 5.7 at least
881+KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds)
882+KBUILD_CFLAGS += $(call cc-disable-warning, array-bounds)
883+KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow)
884+
885+# Another good warning that we'll want to enable eventually
886+KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
887+
888+# Enabled with W=2, disabled by default as noisy
889+KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
890+
884891 # disable invalid "can't wrap" optimizations for signed / pointers
885892 KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
886893
arch/arm/crypto/chacha-glue.c+11−3
@@ -91,9 +91,17 @@ void chacha_crypt_arch(u32 *state, u8 *dst, const u8 *src, unsigned int bytes, · 90 unmodified lines
9191 return;
9292 }
9393
94− kernel_neon_begin();
95− chacha_doneon(state, dst, src, bytes, nrounds);
96− kernel_neon_end();
94+ do {
95+ unsigned int todo = min_t(unsigned int, bytes, SZ_4K);
96+
97+ kernel_neon_begin();
98+ chacha_doneon(state, dst, src, todo, nrounds);
99+ kernel_neon_end();
100+
101+ bytes -= todo;
102+ src += todo;
103+ dst += todo;
104+ } while (bytes);
97105 }
98106 EXPORT_SYMBOL(chacha_crypt_arch);
99107
arch/arm/crypto/nhpoly1305-neon-glue.c+1−1
@@ -30,7 +30,7 @@ static int nhpoly1305_neon_update(struct shash_desc *desc, · 29 unmodified lines
3030 return crypto_nhpoly1305_update(desc, src, srclen);
3131
3232 do {
33− unsigned int n = min_t(unsigned int, srclen, PAGE_SIZE);
33+ unsigned int n = min_t(unsigned int, srclen, SZ_4K);
3434
3535 kernel_neon_begin();
3636 crypto_nhpoly1305_update_helper(desc, src, n, _nh_neon);
arch/arm/crypto/poly1305-glue.c+11−4
@@ -160,13 +160,20 @@ void poly1305_update_arch(struct poly1305_desc_ctx *dctx, const u8 *src, · 159 unmodified lines
160160 unsigned int len = round_down(nbytes, POLY1305_BLOCK_SIZE);
161161
162162 if (static_branch_likely(&have_neon) && do_neon) {
163− kernel_neon_begin();
164− poly1305_blocks_neon(&dctx->h, src, len, 1);
165− kernel_neon_end();
163+ do {
164+ unsigned int todo = min_t(unsigned int, len, SZ_4K);
165+
166+ kernel_neon_begin();
167+ poly1305_blocks_neon(&dctx->h, src, todo, 1);
168+ kernel_neon_end();
169+
170+ len -= todo;
171+ src += todo;
172+ } while (len);
166173 } else {
167174 poly1305_blocks_arm(&dctx->h, src, len, 1);
175+ src += len;
168176 }
169− src += len;
170177 nbytes %= POLY1305_BLOCK_SIZE;
171178 }
172179
arch/arm/include/asm/futex.h+7−2
@@ -165,8 +165,13 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr) · 164 unmodified lines
165165 preempt_enable();
166166 #endif
167167
168− if (!ret)
169− *oval = oldval;
168+ /*
169+ * Store unconditionally. If ret != 0 the extra store is the least
170+ * of the worries but GCC cannot figure out that __futex_atomic_op()
171+ * is either setting ret to -EFAULT or storing the old value in
172+ * oldval which results in a uninitialized warning at the call site.
173+ */
174+ *oval = oldval;
170175
171176 return ret;
172177 }
arch/arm64/crypto/chacha-neon-glue.c+11−3
@@ -87,9 +87,17 @@ void chacha_crypt_arch(u32 *state, u8 *dst, const u8 *src, unsigned int bytes, · 86 unmodified lines
8787 !crypto_simd_usable())
8888 return chacha_crypt_generic(state, dst, src, bytes, nrounds);
8989
90− kernel_neon_begin();
91− chacha_doneon(state, dst, src, bytes, nrounds);
92− kernel_neon_end();
90+ do {
91+ unsigned int todo = min_t(unsigned int, bytes, SZ_4K);
92+
93+ kernel_neon_begin();
94+ chacha_doneon(state, dst, src, todo, nrounds);
95+ kernel_neon_end();
96+
97+ bytes -= todo;
98+ src += todo;
99+ dst += todo;
100+ } while (bytes);
93101 }
94102 EXPORT_SYMBOL(chacha_crypt_arch);
95103
arch/arm64/crypto/nhpoly1305-neon-glue.c+1−1
@@ -30,7 +30,7 @@ static int nhpoly1305_neon_update(struct shash_desc *desc, · 29 unmodified lines
3030 return crypto_nhpoly1305_update(desc, src, srclen);
3131
3232 do {
33− unsigned int n = min_t(unsigned int, srclen, PAGE_SIZE);
33+ unsigned int n = min_t(unsigned int, srclen, SZ_4K);
3434
3535 kernel_neon_begin();
3636 crypto_nhpoly1305_update_helper(desc, src, n, _nh_neon);
arch/arm64/crypto/poly1305-glue.c+11−4
@@ -143,13 +143,20 @@ void poly1305_update_arch(struct poly1305_desc_ctx *dctx, const u8 *src, · 142 unmodified lines
143143 unsigned int len = round_down(nbytes, POLY1305_BLOCK_SIZE);
144144
145145 if (static_branch_likely(&have_neon) && crypto_simd_usable()) {
146− kernel_neon_begin();
147− poly1305_blocks_neon(&dctx->h, src, len, 1);
148− kernel_neon_end();
146+ do {
147+ unsigned int todo = min_t(unsigned int, len, SZ_4K);
148+
149+ kernel_neon_begin();
150+ poly1305_blocks_neon(&dctx->h, src, todo, 1);
151+ kernel_neon_end();
152+
153+ len -= todo;
154+ src += todo;
155+ } while (len);
149156 } else {
150157 poly1305_blocks(&dctx->h, src, len, 1);
158+ src += len;
151159 }
152− src += len;
153160 nbytes %= POLY1305_BLOCK_SIZE;
154161 }
155162
arch/arm64/kernel/vdso/Makefile+1−1
@@ -32,7 +32,7 @@ UBSAN_SANITIZE := n · 31 unmodified lines
3232 OBJECT_FILES_NON_STANDARD := y
3333 KCOV_INSTRUMENT := n
3434
35−CFLAGS_vgettimeofday.o = -O2 -mcmodel=tiny
35+CFLAGS_vgettimeofday.o = -O2 -mcmodel=tiny -fasynchronous-unwind-tables
3636
3737 ifneq ($(c-gettimeofday-y),)
3838 CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
arch/arm64/kvm/guest.c+7−0
@@ -200,6 +200,13 @@ static int set_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) · 199 unmodified lines
200200 }
201201
202202 memcpy((u32 *)regs + off, valp, KVM_REG_SIZE(reg->id));
203+
204+ if (*vcpu_cpsr(vcpu) & PSR_MODE32_BIT) {
205+ int i;
206+
207+ for (i = 0; i < 16; i++)
208+ *vcpu_reg32(vcpu, i) = (u32)*vcpu_reg32(vcpu, i);
209+ }
203210 out:
204211 return err;
205212 }
arch/arm64/kvm/hyp/entry.S+23−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818
1919 #define CPU_GP_REG_OFFSET(x) (CPU_GP_REGS + x)
2020 #define CPU_XREG_OFFSET(x) CPU_GP_REG_OFFSET(CPU_USER_PT_REGS + 8*x)
21+#define CPU_SP_EL0_OFFSET (CPU_XREG_OFFSET(30) + 8)
2122
2223 .text
2324 .pushsection .hyp.text, "ax"
@@ -47,6 +48,16 @@ · 23 unmodified lines
4748 ldp x29, lr, [\ctxt, #CPU_XREG_OFFSET(29)]
4849 .endm
4950
51+.macro save_sp_el0 ctxt, tmp
52+ mrs \tmp, sp_el0
53+ str \tmp, [\ctxt, #CPU_SP_EL0_OFFSET]
54+.endm
55+
56+.macro restore_sp_el0 ctxt, tmp
57+ ldr \tmp, [\ctxt, #CPU_SP_EL0_OFFSET]
58+ msr sp_el0, \tmp
59+.endm
60+
5061 /*
5162 * u64 __guest_enter(struct kvm_vcpu *vcpu,
5263 * struct kvm_cpu_context *host_ctxt);
@@ -60,6 +71,9 @@ SYM_FUNC_START(__guest_enter) · 7 unmodified lines
6071 // Store the host regs
6172 save_callee_saved_regs x1
6273
74+ // Save the host's sp_el0
75+ save_sp_el0 x1, x2
76+
6377 // Now the host state is stored if we have a pending RAS SError it must
6478 // affect the host. If any asynchronous exception is pending we defer
6579 // the guest entry. The DSB isn't necessary before v8.2 as any SError
@@ -83,6 +97,9 @@ alternative_else_nop_endif · 17 unmodified lines
8397 // when this feature is enabled for kernel code.
8498 ptrauth_switch_to_guest x29, x0, x1, x2
8599
100+ // Restore the guest's sp_el0
101+ restore_sp_el0 x29, x0
102+
86103 // Restore guest regs x0-x17
87104 ldp x0, x1, [x29, #CPU_XREG_OFFSET(0)]
88105 ldp x2, x3, [x29, #CPU_XREG_OFFSET(2)]
@@ -130,6 +147,9 @@ SYM_INNER_LABEL(__guest_exit, SYM_L_GLOBAL) · 41 unmodified lines
130147 // Store the guest regs x18-x29, lr
131148 save_callee_saved_regs x1
132149
150+ // Store the guest's sp_el0
151+ save_sp_el0 x1, x2
152+
133153 get_host_ctxt x2, x3
134154
135155 // Macro ptrauth_switch_to_guest format:
@@ -139,6 +159,9 @@ SYM_INNER_LABEL(__guest_exit, SYM_L_GLOBAL) · 3 unmodified lines
139159 // when this feature is enabled for kernel code.
140160 ptrauth_switch_to_host x1, x2, x3, x4, x5
141161
162+ // Restore the hosts's sp_el0
163+ restore_sp_el0 x2, x3
164+
142165 // Now restore the host regs
143166 restore_callee_saved_regs x2
144167
arch/arm64/kvm/hyp/hyp-entry.S+0−1
@@ -198,7 +198,6 @@ SYM_CODE_END(__hyp_panic) · 197 unmodified lines
198198 .macro invalid_vector label, target = __hyp_panic
199199 .align 2
200200 SYM_CODE_START(\label)
201−\label:
202201 b \target
203202 SYM_CODE_END(\label)
204203 .endm
arch/arm64/kvm/hyp/sysreg-sr.c+3−14
@@ -15,8 +15,9 @@ · 14 unmodified lines
1515 /*
1616 * Non-VHE: Both host and guest must save everything.
1717 *
18− * VHE: Host and guest must save mdscr_el1 and sp_el0 (and the PC and pstate,
19− * which are handled as part of the el2 return state) on every switch.
18+ * VHE: Host and guest must save mdscr_el1 and sp_el0 (and the PC and
19+ * pstate, which are handled as part of the el2 return state) on every
20+ * switch (sp_el0 is being dealt with in the assembly code).
2021 * tpidr_el0 and tpidrro_el0 only need to be switched when going
2122 * to host userspace or a different VCPU. EL1 registers only need to be
2223 * switched when potentially going to run a different VCPU. The latter two
@@ -26,12 +27,6 @@ · 3 unmodified lines
2627 static void __hyp_text __sysreg_save_common_state(struct kvm_cpu_context *ctxt)
2728 {
2829 ctxt->sys_regs[MDSCR_EL1] = read_sysreg(mdscr_el1);
29−
30− /*
31− * The host arm64 Linux uses sp_el0 to point to 'current' and it must
32− * therefore be saved/restored on every entry/exit to/from the guest.
33− */
34− ctxt->gp_regs.regs.sp = read_sysreg(sp_el0);
3530 }
3631
3732 static void __hyp_text __sysreg_save_user_state(struct kvm_cpu_context *ctxt)
@@ -99,12 +94,6 @@ NOKPROBE_SYMBOL(sysreg_save_guest_state_vhe); · 61 unmodified lines
9994 static void __hyp_text __sysreg_restore_common_state(struct kvm_cpu_context *ctxt)
10095 {
10196 write_sysreg(ctxt->sys_regs[MDSCR_EL1], mdscr_el1);
102−
103− /*
104− * The host arm64 Linux uses sp_el0 to point to 'current' and it must
105− * therefore be saved/restored on every entry/exit to/from the guest.
106− */
107− write_sysreg(ctxt->gp_regs.regs.sp, sp_el0);
10897 }
10998
11099 static void __hyp_text __sysreg_restore_user_state(struct kvm_cpu_context *ctxt)
arch/arm64/mm/hugetlbpage.c+2−0
@@ -230,6 +230,8 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, · 229 unmodified lines
230230 ptep = (pte_t *)pudp;
231231 } else if (sz == (CONT_PTE_SIZE)) {
232232 pmdp = pmd_alloc(mm, pudp, addr);
233+ if (!pmdp)
234+ return NULL;
233235
234236 WARN_ON(addr & (sz - 1));
235237 /*
arch/powerpc/kvm/powerpc.c+1−0
@@ -521,6 +521,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 520 unmodified lines
521521 case KVM_CAP_IOEVENTFD:
522522 case KVM_CAP_DEVICE_CTRL:
523523 case KVM_CAP_IMMEDIATE_EXIT:
524+ case KVM_CAP_SET_GUEST_DEBUG:
524525 r = 1;
525526 break;
526527 case KVM_CAP_PPC_GUEST_DEBUG_SSTEP:
arch/riscv/Kconfig+1−1
@@ -60,7 +60,7 @@ config RISCV · 59 unmodified lines
6060 select ARCH_HAS_GIGANTIC_PAGE
6161 select ARCH_HAS_SET_DIRECT_MAP
6262 select ARCH_HAS_SET_MEMORY
63− select ARCH_HAS_STRICT_KERNEL_RWX
63+ select ARCH_HAS_STRICT_KERNEL_RWX if MMU
6464 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
6565 select SPARSEMEM_STATIC if 32BIT
6666 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
arch/riscv/include/asm/csr.h+0−3
@@ -51,13 +51,10 @@ · 50 unmodified lines
5151 #define CAUSE_IRQ_FLAG (_AC(1, UL) << (__riscv_xlen - 1))
5252
5353 /* Interrupt causes (minus the high bit) */
54−#define IRQ_U_SOFT 0
5554 #define IRQ_S_SOFT 1
5655 #define IRQ_M_SOFT 3
57−#define IRQ_U_TIMER 4
5856 #define IRQ_S_TIMER 5
5957 #define IRQ_M_TIMER 7
60−#define IRQ_U_EXT 8
6158 #define IRQ_S_EXT 9
6259 #define IRQ_M_EXT 11
6360
arch/riscv/include/asm/hwcap.h+22−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #ifndef _ASM_RISCV_HWCAP_H
99 #define _ASM_RISCV_HWCAP_H
1010
11+#include <linux/bits.h>
1112 #include <uapi/asm/hwcap.h>
1213
1314 #ifndef __ASSEMBLY__
@@ -22,6 +23,27 @@ enum { · 8 unmodified lines
2223 };
2324
2425 extern unsigned long elf_hwcap;
26+
27+#define RISCV_ISA_EXT_a ('a' - 'a')
28+#define RISCV_ISA_EXT_c ('c' - 'a')
29+#define RISCV_ISA_EXT_d ('d' - 'a')
30+#define RISCV_ISA_EXT_f ('f' - 'a')
31+#define RISCV_ISA_EXT_h ('h' - 'a')
32+#define RISCV_ISA_EXT_i ('i' - 'a')
33+#define RISCV_ISA_EXT_m ('m' - 'a')
34+#define RISCV_ISA_EXT_s ('s' - 'a')
35+#define RISCV_ISA_EXT_u ('u' - 'a')
36+
37+#define RISCV_ISA_EXT_MAX 64
38+
39+unsigned long riscv_isa_extension_base(const unsigned long *isa_bitmap);
40+
41+#define riscv_isa_extension_mask(ext) BIT_MASK(RISCV_ISA_EXT_##ext)
42+
43+bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, int bit);
44+#define riscv_isa_extension_available(isa_bitmap, ext) \
45+ __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_##ext)
46+
2547 #endif
2648
2749 #endif /* _ASM_RISCV_HWCAP_H */
arch/riscv/include/asm/set_memory.h+0−8
@@ -22,14 +22,6 @@ static inline int set_memory_x(unsigned long addr, int numpages) { return 0; } · 21 unmodified lines
2222 static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; }
2323 #endif
2424
25−#ifdef CONFIG_STRICT_KERNEL_RWX
26−void set_kernel_text_ro(void);
27−void set_kernel_text_rw(void);
28−#else
29−static inline void set_kernel_text_ro(void) { }
30−static inline void set_kernel_text_rw(void) { }
31−#endif
32−
3325 int set_direct_map_invalid_noflush(struct page *page);
3426 int set_direct_map_default_noflush(struct page *page);
3527
arch/riscv/kernel/cpu_ops.c+2−2
@@ -15,8 +15,8 @@ · 14 unmodified lines
1515
1616 const struct cpu_operations *cpu_ops[NR_CPUS] __ro_after_init;
1717
18−void *__cpu_up_stack_pointer[NR_CPUS];
19−void *__cpu_up_task_pointer[NR_CPUS];
18+void *__cpu_up_stack_pointer[NR_CPUS] __section(.data);
19+void *__cpu_up_task_pointer[NR_CPUS] __section(.data);
2020
2121 extern const struct cpu_operations cpu_ops_sbi;
2222 extern const struct cpu_operations cpu_ops_spinwait;
arch/riscv/kernel/cpufeature.c+80−3
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 * Copyright (C) 2017 SiFive
77 */
88
9+#include <linux/bitmap.h>
910 #include <linux/of.h>
1011 #include <asm/processor.h>
1112 #include <asm/hwcap.h>
@@ -13,15 +14,57 @@ · 1 unmodified line
1314 #include <asm/switch_to.h>
1415
1516 unsigned long elf_hwcap __read_mostly;
17+
18+/* Host ISA bitmap */
19+static DECLARE_BITMAP(riscv_isa, RISCV_ISA_EXT_MAX) __read_mostly;
20+
1621 #ifdef CONFIG_FPU
1722 bool has_fpu __read_mostly;
1823 #endif
1924
25+/**
26+ * riscv_isa_extension_base() - Get base extension word
27+ *
28+ * @isa_bitmap: ISA bitmap to use
29+ * Return: base extension word as unsigned long value
30+ *
31+ * NOTE: If isa_bitmap is NULL then Host ISA bitmap will be used.
32+ */
33+unsigned long riscv_isa_extension_base(const unsigned long *isa_bitmap)
34+{
35+ if (!isa_bitmap)
36+ return riscv_isa[0];
37+ return isa_bitmap[0];
38+}
39+EXPORT_SYMBOL_GPL(riscv_isa_extension_base);
40+
41+/**
42+ * __riscv_isa_extension_available() - Check whether given extension
43+ * is available or not
44+ *
45+ * @isa_bitmap: ISA bitmap to use
46+ * @bit: bit position of the desired extension
47+ * Return: true or false
48+ *
49+ * NOTE: If isa_bitmap is NULL then Host ISA bitmap will be used.
50+ */
51+bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, int bit)
52+{
53+ const unsigned long *bmap = (isa_bitmap) ? isa_bitmap : riscv_isa;
54+
55+ if (bit >= RISCV_ISA_EXT_MAX)
56+ return false;
57+
58+ return test_bit(bit, bmap) ? true : false;
59+}
60+EXPORT_SYMBOL_GPL(__riscv_isa_extension_available);
61+
2062 void riscv_fill_hwcap(void)
2163 {
2264 struct device_node *node;
2365 const char *isa;
24− size_t i;
66+ char print_str[BITS_PER_LONG + 1];
67+ size_t i, j, isa_len;
2568 static unsigned long isa2hwcap[256] = {0};
2669
2770 isa2hwcap['i'] = isa2hwcap['I'] = COMPAT_HWCAP_ISA_I;
@@ -33,8 +76,11 @@ void riscv_fill_hwcap(void) · 5 unmodified lines
3376
3477 elf_hwcap = 0;
3578
79+ bitmap_zero(riscv_isa, RISCV_ISA_EXT_MAX);
80+
3681 for_each_of_cpu_node(node) {
3782 unsigned long this_hwcap = 0;
83+ unsigned long this_isa = 0;
3884
3985 if (riscv_of_processor_hartid(node) < 0)
4086 continue;
@@ -44,8 +90,24 @@ void riscv_fill_hwcap(void) · 3 unmodified lines
4490 continue;
4591 }
4692
47− for (i = 0; i < strlen(isa); ++i)
93+ i = 0;
94+ isa_len = strlen(isa);
95+#if IS_ENABLED(CONFIG_32BIT)
96+ if (!strncmp(isa, "rv32", 4))
97+ i += 4;
98+#elif IS_ENABLED(CONFIG_64BIT)
99+ if (!strncmp(isa, "rv64", 4))
100+ i += 4;
101+#endif
102+ for (; i < isa_len; ++i) {
48103 this_hwcap |= isa2hwcap[(unsigned char)(isa[i])];
104+ /*
105+ * TODO: X, Y and Z extension parsing for Host ISA
106+ * bitmap will be added in-future.
107+ */
108+ if ('a' <= isa[i] && isa[i] < 'x')
109+ this_isa |= (1UL << (isa[i] - 'a'));
110+ }
49111
50112 /*
51113 * All "okay" hart should have same isa. Set HWCAP based on
@@ -56,6 +118,11 @@ void riscv_fill_hwcap(void) · 4 unmodified lines
56118 elf_hwcap &= this_hwcap;
57119 else
58120 elf_hwcap = this_hwcap;
121+
122+ if (riscv_isa[0])
123+ riscv_isa[0] &= this_isa;
124+ else
125+ riscv_isa[0] = this_isa;
59126 }
60127
61128 /* We don't support systems with F but without D, so mask those out
@@ -65,7 +132,17 @@ void riscv_fill_hwcap(void) · 3 unmodified lines
65132 elf_hwcap &= ~COMPAT_HWCAP_ISA_F;
66133 }
67134
68− pr_info("elf_hwcap is 0x%lx\n", elf_hwcap);
135+ memset(print_str, 0, sizeof(print_str));
136+ for (i = 0, j = 0; i < BITS_PER_LONG; i++)
137+ if (riscv_isa[0] & BIT_MASK(i))
138+ print_str[j++] = (char)('a' + i);
139+ pr_info("riscv: ISA extensions %s\n", print_str);
140+
141+ memset(print_str, 0, sizeof(print_str));
142+ for (i = 0, j = 0; i < BITS_PER_LONG; i++)
143+ if (elf_hwcap & BIT_MASK(i))
144+ print_str[j++] = (char)('a' + i);
145+ pr_info("riscv: ELF capabilities %s\n", print_str);
69146
70147 #ifdef CONFIG_FPU
71148 if (elf_hwcap & (COMPAT_HWCAP_ISA_F | COMPAT_HWCAP_ISA_D))
arch/riscv/kernel/sbi.c+10−7
@@ -102,7 +102,7 @@ void sbi_shutdown(void) · 101 unmodified lines
102102 {
103103 sbi_ecall(SBI_EXT_0_1_SHUTDOWN, 0, 0, 0, 0, 0, 0, 0);
104104 }
105−EXPORT_SYMBOL(sbi_set_timer);
105+EXPORT_SYMBOL(sbi_shutdown);
106106
107107 /**
108108 * sbi_clear_ipi() - Clear any pending IPIs for the calling hart.
@@ -113,7 +113,7 @@ void sbi_clear_ipi(void) · 4 unmodified lines
113113 {
114114 sbi_ecall(SBI_EXT_0_1_CLEAR_IPI, 0, 0, 0, 0, 0, 0, 0);
115115 }
116−EXPORT_SYMBOL(sbi_shutdown);
116+EXPORT_SYMBOL(sbi_clear_ipi);
117117
118118 /**
119119 * sbi_set_timer_v01() - Program the timer for next timer event.
@@ -167,6 +167,11 @@ static int __sbi_rfence_v01(int fid, const unsigned long *hart_mask, · 47 unmodified lines
167167
168168 return result;
169169 }
170+
171+static void sbi_set_power_off(void)
172+{
173+ pm_power_off = sbi_shutdown;
174+}
170175 #else
171176 static void __sbi_set_timer_v01(uint64_t stime_value)
172177 {
@@ -191,6 +196,8 @@ static int __sbi_rfence_v01(int fid, const unsigned long *hart_mask, · 18 unmodified lines
191196
192197 return 0;
193198 }
199+
200+static void sbi_set_power_off(void) {}
194201 #endif /* CONFIG_RISCV_SBI_V01 */
195202
196203 static void __sbi_set_timer_v02(uint64_t stime_value)
@@ -540,16 +547,12 @@ static inline long sbi_get_firmware_version(void) · 343 unmodified lines
540547 return __sbi_base_ecall(SBI_EXT_BASE_GET_IMP_VERSION);
541548 }
542549
543−static void sbi_power_off(void)
544−{
545− sbi_shutdown();
546−}
547550
548551 int __init sbi_init(void)
549552 {
550553 int ret;
551554
552− pm_power_off = sbi_power_off;
555+ sbi_set_power_off();
553556 ret = sbi_get_spec_version();
554557 if (ret > 0)
555558 sbi_spec_version = ret;
arch/riscv/kernel/smp.c+2−0
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010
1111 #include <linux/cpu.h>
1212 #include <linux/interrupt.h>
13+#include <linux/module.h>
1314 #include <linux/profile.h>
1415 #include <linux/smp.h>
1516 #include <linux/sched.h>
@@ -63,6 +64,7 @@ void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out) · 47 unmodified lines
6364 for_each_cpu(cpu, in)
6465 cpumask_set_cpu(cpuid_to_hartid_map(cpu), out);
6566 }
67+EXPORT_SYMBOL_GPL(riscv_cpuid_to_hartid_mask);
6668
6769 bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
6870 {
arch/riscv/kernel/stacktrace.c+2−2
@@ -12,6 +12,8 @@ · 11 unmodified lines
1212 #include <linux/stacktrace.h>
1313 #include <linux/ftrace.h>
1414
15+register unsigned long sp_in_global __asm__("sp");
16+
1517 #ifdef CONFIG_FRAME_POINTER
1618
1719 struct stackframe {
@@ -19,8 +21,6 @@ struct stackframe { · 1 unmodified line
1921 unsigned long ra;
2022 };
2123
22−register unsigned long sp_in_global __asm__("sp");
23−
2424 void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
2525 bool (*fn)(unsigned long, void *), void *arg)
2626 {
arch/riscv/kernel/vdso/Makefile+4−4
@@ -12,7 +12,7 @@ vdso-syms += getcpu · 11 unmodified lines
1212 vdso-syms += flush_icache
1313
1414 # Files to link into the vdso
15−obj-vdso = $(patsubst %, %.o, $(vdso-syms))
15+obj-vdso = $(patsubst %, %.o, $(vdso-syms)) note.o
1616
1717 # Build rules
1818 targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.lds vdso-dummy.o
@@ -33,15 +33,15 @@ $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE · 14 unmodified lines
3333 $(call if_changed,vdsold)
3434
3535 # We also create a special relocatable object that should mirror the symbol
36−# table and layout of the linked DSO. With ld -R we can then refer to
37−# these symbols in the kernel code rather than hand-coded addresses.
36+# table and layout of the linked DSO. With ld --just-symbols we can then
37+# refer to these symbols in the kernel code rather than hand-coded addresses.
3838
3939 SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
4040 -Wl,--build-id -Wl,--hash-style=both
4141 $(obj)/vdso-dummy.o: $(src)/vdso.lds $(obj)/rt_sigreturn.o FORCE
4242 $(call if_changed,vdsold)
4343
44−LDFLAGS_vdso-syms.o := -r -R
44+LDFLAGS_vdso-syms.o := -r --just-symbols
4545 $(obj)/vdso-syms.o: $(obj)/vdso-dummy.o FORCE
4646 $(call if_changed,ld)
4747
arch/riscv/kernel/vdso/note.S+12−0
@@ -0,0 +1,12 @@
1+/* SPDX-License-Identifier: GPL-2.0-or-later */
2+/*
3+ * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text.
4+ * Here we can supply some information useful to userland.
5+ */
6+
7+#include <linux/elfnote.h>
8+#include <linux/version.h>
9+
10+ELFNOTE_START(Linux, 0, "a")
11+ .long LINUX_VERSION_CODE
12+ELFNOTE_END
arch/riscv/mm/init.c+2−17
@@ -150,7 +150,8 @@ void __init setup_bootmem(void) · 149 unmodified lines
150150 memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);
151151
152152 set_max_mapnr(PFN_DOWN(mem_size));
153− max_low_pfn = PFN_DOWN(memblock_end_of_DRAM());
153+ max_pfn = PFN_DOWN(memblock_end_of_DRAM());
154+ max_low_pfn = max_pfn;
154155
155156 #ifdef CONFIG_BLK_DEV_INITRD
156157 setup_initrd();
@@ -501,22 +502,6 @@ static inline void setup_vm_final(void) · 344 unmodified lines
501502 #endif /* CONFIG_MMU */
502503
503504 #ifdef CONFIG_STRICT_KERNEL_RWX
504−void set_kernel_text_rw(void)
505−{
506− unsigned long text_start = (unsigned long)_text;
507− unsigned long text_end = (unsigned long)_etext;
508−
509− set_memory_rw(text_start, (text_end - text_start) >> PAGE_SHIFT);
510−}
511−
512−void set_kernel_text_ro(void)
513−{
514− unsigned long text_start = (unsigned long)_text;
515− unsigned long text_end = (unsigned long)_etext;
516−
517− set_memory_ro(text_start, (text_end - text_start) >> PAGE_SHIFT);
518−}
519−
520505 void mark_rodata_ro(void)
521506 {
522507 unsigned long text_start = (unsigned long)_text;
arch/s390/kvm/kvm-s390.c+1−0
@@ -545,6 +545,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 544 unmodified lines
545545 case KVM_CAP_S390_AIS:
546546 case KVM_CAP_S390_AIS_MIGRATION:
547547 case KVM_CAP_S390_VCPU_RESETS:
548+ case KVM_CAP_SET_GUEST_DEBUG:
548549 r = 1;
549550 break;
550551 case KVM_CAP_S390_HPAGE_1M:
arch/s390/kvm/priv.c+3−1
@@ -626,10 +626,12 @@ static int handle_pqap(struct kvm_vcpu *vcpu) · 625 unmodified lines
626626 * available for the guest are AQIC and TAPQ with the t bit set
627627 * since we do not set IC.3 (FIII) we currently will only intercept
628628 * the AQIC function code.
629+ * Note: running nested under z/VM can result in intercepts for other
630+ * function codes, e.g. PQAP(QCI). We do not support this and bail out.
629631 */
630632 reg0 = vcpu->run->s.regs.gprs[0];
631633 fc = (reg0 >> 24) & 0xff;
632− if (WARN_ON_ONCE(fc != 0x03))
634+ if (fc != 0x03)
633635 return -EOPNOTSUPP;
634636
635637 /* PQAP instruction is allowed for guest kernel only */
arch/s390/lib/uaccess.c+4−0
@@ -64,10 +64,13 @@ mm_segment_t enable_sacf_uaccess(void) · 63 unmodified lines
6464 {
6565 mm_segment_t old_fs;
6666 unsigned long asce, cr;
67+ unsigned long flags;
6768
6869 old_fs = current->thread.mm_segment;
6970 if (old_fs & 1)
7071 return old_fs;
72+ /* protect against a concurrent page table upgrade */
73+ local_irq_save(flags);
7174 current->thread.mm_segment |= 1;
7275 asce = S390_lowcore.kernel_asce;
7376 if (likely(old_fs == USER_DS)) {
@@ -83,6 +86,7 @@ mm_segment_t enable_sacf_uaccess(void) · 9 unmodified lines
8386 __ctl_load(asce, 7, 7);
8487 set_cpu_flag(CIF_ASCE_SECONDARY);
8588 }
89+ local_irq_restore(flags);
8690 return old_fs;
8791 }
8892 EXPORT_SYMBOL(enable_sacf_uaccess);
arch/s390/mm/pgalloc.c+14−2
@@ -70,8 +70,20 @@ static void __crst_table_upgrade(void *arg) · 69 unmodified lines
7070 {
7171 struct mm_struct *mm = arg;
7272
73− if (current->active_mm == mm)
74− set_user_asce(mm);
73+ /* we must change all active ASCEs to avoid the creation of new TLBs */
74+ if (current->active_mm == mm) {
75+ S390_lowcore.user_asce = mm->context.asce;
76+ if (current->thread.mm_segment == USER_DS) {
77+ __ctl_load(S390_lowcore.user_asce, 1, 1);
78+ /* Mark user-ASCE present in CR1 */
79+ clear_cpu_flag(CIF_ASCE_PRIMARY);
80+ }
81+ if (current->thread.mm_segment == USER_DS_SACF) {
82+ __ctl_load(S390_lowcore.user_asce, 7, 7);
83+ /* enable_sacf_uaccess does all or nothing */
84+ WARN_ON(!test_cpu_flag(CIF_ASCE_SECONDARY));
85+ }
86+ }
7587 __tlb_flush_local();
7688 }
7789
arch/x86/crypto/blake2s-glue.c+4−6
@@ -32,16 +32,16 @@ void blake2s_compress_arch(struct blake2s_state *state, · 31 unmodified lines
3232 const u32 inc)
3333 {
3434 /* SIMD disables preemption, so relax after processing each page. */
35− BUILD_BUG_ON(PAGE_SIZE / BLAKE2S_BLOCK_SIZE < 8);
35+ BUILD_BUG_ON(SZ_4K / BLAKE2S_BLOCK_SIZE < 8);
3636
3737 if (!static_branch_likely(&blake2s_use_ssse3) || !crypto_simd_usable()) {
3838 blake2s_compress_generic(state, block, nblocks, inc);
3939 return;
4040 }
4141
42− for (;;) {
42+ do {
4343 const size_t blocks = min_t(size_t, nblocks,
44− PAGE_SIZE / BLAKE2S_BLOCK_SIZE);
44+ SZ_4K / BLAKE2S_BLOCK_SIZE);
4545
4646 kernel_fpu_begin();
4747 if (IS_ENABLED(CONFIG_AS_AVX512) &&
@@ -52,10 +52,8 @@ void blake2s_compress_arch(struct blake2s_state *state, · 4 unmodified lines
5252 kernel_fpu_end();
5353
5454 nblocks -= blocks;
55− if (!nblocks)
56− break;
5755 block += blocks * BLAKE2S_BLOCK_SIZE;
58− }
56+ } while (nblocks);
5957 }
6058 EXPORT_SYMBOL(blake2s_compress_arch);
6159
arch/x86/crypto/chacha_glue.c+11−3
@@ -153,9 +153,17 @@ void chacha_crypt_arch(u32 *state, u8 *dst, const u8 *src, unsigned int bytes, · 152 unmodified lines
153153 bytes <= CHACHA_BLOCK_SIZE)
154154 return chacha_crypt_generic(state, dst, src, bytes, nrounds);
155155
156− kernel_fpu_begin();
157− chacha_dosimd(state, dst, src, bytes, nrounds);
158− kernel_fpu_end();
156+ do {
157+ unsigned int todo = min_t(unsigned int, bytes, SZ_4K);
158+
159+ kernel_fpu_begin();
160+ chacha_dosimd(state, dst, src, todo, nrounds);
161+ kernel_fpu_end();
162+
163+ bytes -= todo;
164+ src += todo;
165+ dst += todo;
166+ } while (bytes);
159167 }
160168 EXPORT_SYMBOL(chacha_crypt_arch);
161169
arch/x86/crypto/nhpoly1305-avx2-glue.c+1−1
@@ -29,7 +29,7 @@ static int nhpoly1305_avx2_update(struct shash_desc *desc, · 28 unmodified lines
2929 return crypto_nhpoly1305_update(desc, src, srclen);
3030
3131 do {
32− unsigned int n = min_t(unsigned int, srclen, PAGE_SIZE);
32+ unsigned int n = min_t(unsigned int, srclen, SZ_4K);
3333
3434 kernel_fpu_begin();
3535 crypto_nhpoly1305_update_helper(desc, src, n, _nh_avx2);
arch/x86/crypto/nhpoly1305-sse2-glue.c+1−1
@@ -29,7 +29,7 @@ static int nhpoly1305_sse2_update(struct shash_desc *desc, · 28 unmodified lines
2929 return crypto_nhpoly1305_update(desc, src, srclen);
3030
3131 do {
32− unsigned int n = min_t(unsigned int, srclen, PAGE_SIZE);
32+ unsigned int n = min_t(unsigned int, srclen, SZ_4K);
3333
3434 kernel_fpu_begin();
3535 crypto_nhpoly1305_update_helper(desc, src, n, _nh_sse2);
arch/x86/crypto/poly1305_glue.c+6−7
@@ -91,8 +91,8 @@ static void poly1305_simd_blocks(void *ctx, const u8 *inp, size_t len, · 90 unmodified lines
9191 struct poly1305_arch_internal *state = ctx;
9292
9393 /* SIMD disables preemption, so relax after processing each page. */
94− BUILD_BUG_ON(PAGE_SIZE < POLY1305_BLOCK_SIZE ||
95− PAGE_SIZE % POLY1305_BLOCK_SIZE);
94+ BUILD_BUG_ON(SZ_4K < POLY1305_BLOCK_SIZE ||
95+ SZ_4K % POLY1305_BLOCK_SIZE);
9696
9797 if (!static_branch_likely(&poly1305_use_avx) ||
9898 (len < (POLY1305_BLOCK_SIZE * 18) && !state->is_base2_26) ||
@@ -102,8 +102,8 @@ static void poly1305_simd_blocks(void *ctx, const u8 *inp, size_t len, · 3 unmodified lines
102102 return;
103103 }
104104
105− for (;;) {
106− const size_t bytes = min_t(size_t, len, PAGE_SIZE);
105+ do {
106+ const size_t bytes = min_t(size_t, len, SZ_4K);
107107
108108 kernel_fpu_begin();
109109 if (IS_ENABLED(CONFIG_AS_AVX512) && static_branch_likely(&poly1305_use_avx512))
@@ -113,11 +113,10 @@ static void poly1305_simd_blocks(void *ctx, const u8 *inp, size_t len, · 3 unmodified lines
113113 else
114114 poly1305_blocks_avx(ctx, inp, bytes, padbit);
115115 kernel_fpu_end();
116+
116117 len -= bytes;
117− if (!len)
118− break;
119118 inp += bytes;
120− }
119+ } while (len);
121120 }
122121
123122 static void poly1305_simd_emit(void *ctx, u8 mac[POLY1305_DIGEST_SIZE],
arch/x86/entry/calling.h+21−19
@@ -98,13 +98,6 @@ For 32-bit we have the following conventions - kernel is built with · 97 unmodified lines
9898 #define SIZEOF_PTREGS 21*8
9999
100100 .macro PUSH_AND_CLEAR_REGS rdx=%rdx rax=%rax save_ret=0
101− /*
102− * Push registers and sanitize registers of values that a
103− * speculation attack might otherwise want to exploit. The
104− * lower registers are likely clobbered well before they
105− * could be put to use in a speculative execution gadget.
106− * Interleave XOR with PUSH for better uop scheduling:
107− */
108101 .if \save_ret
109102 pushq %rsi /* pt_regs->si */
110103 movq 8(%rsp), %rsi /* temporarily store the return address in %rsi */
@@ -114,34 +107,43 @@ For 32-bit we have the following conventions - kernel is built with · 3 unmodified lines
114107 pushq %rsi /* pt_regs->si */
115108 .endif
116109 pushq \rdx /* pt_regs->dx */
117− xorl %edx, %edx /* nospec dx */
118110 pushq %rcx /* pt_regs->cx */
119− xorl %ecx, %ecx /* nospec cx */
120111 pushq \rax /* pt_regs->ax */
121112 pushq %r8 /* pt_regs->r8 */
122− xorl %r8d, %r8d /* nospec r8 */
123113 pushq %r9 /* pt_regs->r9 */
124− xorl %r9d, %r9d /* nospec r9 */
125114 pushq %r10 /* pt_regs->r10 */
126− xorl %r10d, %r10d /* nospec r10 */
127115 pushq %r11 /* pt_regs->r11 */
128− xorl %r11d, %r11d /* nospec r11*/
129116 pushq %rbx /* pt_regs->rbx */
130− xorl %ebx, %ebx /* nospec rbx*/
131117 pushq %rbp /* pt_regs->rbp */
132− xorl %ebp, %ebp /* nospec rbp*/
133118 pushq %r12 /* pt_regs->r12 */
134− xorl %r12d, %r12d /* nospec r12*/
135119 pushq %r13 /* pt_regs->r13 */
136− xorl %r13d, %r13d /* nospec r13*/
137120 pushq %r14 /* pt_regs->r14 */
138− xorl %r14d, %r14d /* nospec r14*/
139121 pushq %r15 /* pt_regs->r15 */
140− xorl %r15d, %r15d /* nospec r15*/
141122 UNWIND_HINT_REGS
123+
142124 .if \save_ret
143125 pushq %rsi /* return address on top of stack */
144126 .endif
127+
128+ /*
129+ * Sanitize registers of values that a speculation attack might
130+ * otherwise want to exploit. The lower registers are likely clobbered
131+ * well before they could be put to use in a speculative execution
132+ * gadget.
133+ */
134+ xorl %edx, %edx /* nospec dx */
135+ xorl %ecx, %ecx /* nospec cx */
136+ xorl %r8d, %r8d /* nospec r8 */
137+ xorl %r9d, %r9d /* nospec r9 */
138+ xorl %r10d, %r10d /* nospec r10 */
139+ xorl %r11d, %r11d /* nospec r11 */
140+ xorl %ebx, %ebx /* nospec rbx */
141+ xorl %ebp, %ebp /* nospec rbp */
142+ xorl %r12d, %r12d /* nospec r12 */
143+ xorl %r13d, %r13d /* nospec r13 */
144+ xorl %r14d, %r14d /* nospec r14 */
145+ xorl %r15d, %r15d /* nospec r15 */
146+
145147 .endm
146148
147149 .macro POP_REGS pop_rdi=1 skip_r11rcx=0
arch/x86/entry/entry_64.S+7−7
@@ -249,7 +249,6 @@ SYM_INNER_LABEL(entry_SYSCALL_64_after_hwframe, SYM_L_GLOBAL) · 248 unmodified lines
249249 */
250250 syscall_return_via_sysret:
251251 /* rcx and r11 are already restored (see code above) */
252− UNWIND_HINT_EMPTY
253252 POP_REGS pop_rdi=0 skip_r11rcx=1
254253
255254 /*
@@ -258,6 +257,7 @@ syscall_return_via_sysret: · 2 unmodified lines
258257 */
259258 movq %rsp, %rdi
260259 movq PER_CPU_VAR(cpu_tss_rw + TSS_sp0), %rsp
260+ UNWIND_HINT_EMPTY
261261
262262 pushq RSP-RDI(%rdi) /* RSP */
263263 pushq (%rdi) /* RDI */
@@ -279,8 +279,7 @@ SYM_CODE_END(entry_SYSCALL_64) · 15 unmodified lines
279279 * %rdi: prev task
280280 * %rsi: next task
281281 */
282−SYM_CODE_START(__switch_to_asm)
283− UNWIND_HINT_FUNC
282+SYM_FUNC_START(__switch_to_asm)
284283 /*
285284 * Save callee-saved registers
286285 * This must match the order in inactive_task_frame
@@ -321,7 +320,7 @@ SYM_CODE_START(__switch_to_asm) · 34 unmodified lines
321320 popq %rbp
322321
323322 jmp __switch_to
324−SYM_CODE_END(__switch_to_asm)
323+SYM_FUNC_END(__switch_to_asm)
325324
326325 /*
327326 * A newly forked process directly context switches into this address.
@@ -512,7 +511,7 @@ SYM_CODE_END(spurious_entries_start) · 184 unmodified lines
512511 * +----------------------------------------------------+
513512 */
514513 SYM_CODE_START(interrupt_entry)
515− UNWIND_HINT_FUNC
514+ UNWIND_HINT_IRET_REGS offset=16
516515 ASM_CLAC
517516 cld
518517
@@ -544,9 +543,9 @@ SYM_CODE_START(interrupt_entry) · 25 unmodified lines
544543 pushq 5*8(%rdi) /* regs->eflags */
545544 pushq 4*8(%rdi) /* regs->cs */
546545 pushq 3*8(%rdi) /* regs->ip */
546+ UNWIND_HINT_IRET_REGS
547547 pushq 2*8(%rdi) /* regs->orig_ax */
548548 pushq 8(%rdi) /* return address */
549− UNWIND_HINT_FUNC
550549
551550 movq (%rdi), %rdi
552551 jmp 2f
@@ -637,6 +636,7 @@ SYM_INNER_LABEL(swapgs_restore_regs_and_return_to_usermode, SYM_L_GLOBAL) · 84 unmodified lines
637636 */
638637 movq %rsp, %rdi
639638 movq PER_CPU_VAR(cpu_tss_rw + TSS_sp0), %rsp
639+ UNWIND_HINT_EMPTY
640640
641641 /* Copy the IRET frame to the trampoline stack. */
642642 pushq 6*8(%rdi) /* SS */
@@ -1739,7 +1739,7 @@ SYM_CODE_START(rewind_stack_do_exit) · 1096 unmodified lines
17391739
17401740 movq PER_CPU_VAR(cpu_current_top_of_stack), %rax
17411741 leaq -PTREGS_SIZE(%rax), %rsp
1742− UNWIND_HINT_FUNC sp_offset=PTREGS_SIZE
1742+ UNWIND_HINT_REGS
17431743
17441744 call do_exit
17451745 SYM_CODE_END(rewind_stack_do_exit)
arch/x86/hyperv/hv_init.c+10−2
@@ -73,7 +73,8 @@ static int hv_cpu_init(unsigned int cpu) · 72 unmodified lines
7373 struct page *pg;
7474
7575 input_arg = (void **)this_cpu_ptr(hyperv_pcpu_input_arg);
76− pg = alloc_page(GFP_KERNEL);
76+ /* hv_cpu_init() can be called with IRQs disabled from hv_resume() */
77+ pg = alloc_page(irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
7778 if (unlikely(!pg))
7879 return -ENOMEM;
7980 *input_arg = page_address(pg);
@@ -254,6 +255,7 @@ static int __init hv_pci_init(void) · 174 unmodified lines
254255 static int hv_suspend(void)
255256 {
256257 union hv_x64_msr_hypercall_contents hypercall_msr;
258+ int ret;
257259
258260 /*
259261 * Reset the hypercall page as it is going to be invalidated
@@ -270,12 +272,17 @@ static int hv_suspend(void) · 10 unmodified lines
270272 hypercall_msr.enable = 0;
271273 wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
272274
273− return 0;
275+ ret = hv_cpu_die(0);
276+ return ret;
274277 }
275278
276279 static void hv_resume(void)
277280 {
278281 union hv_x64_msr_hypercall_contents hypercall_msr;
282+ int ret;
283+
284+ ret = hv_cpu_init(0);
285+ WARN_ON(ret);
279286
280287 /* Re-enable the hypercall page */
281288 rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
@@ -288,6 +295,7 @@ static void hv_resume(void) · 6 unmodified lines
288295 hv_hypercall_pg_saved = NULL;
289296 }
290297
298+/* Note: when the ops are called, only CPU0 is online and IRQs are disabled. */
291299 static struct syscore_ops hv_syscore_ops = {
292300 .suspend = hv_suspend,
293301 .resume = hv_resume,
arch/x86/include/asm/ftrace.h+3−2
@@ -61,11 +61,12 @@ static inline bool arch_syscall_match_sym_name(const char *sym, const char *name · 60 unmodified lines
6161 {
6262 /*
6363 * Compare the symbol name with the system call name. Skip the
64− * "__x64_sys", "__ia32_sys" or simple "sys" prefix.
64+ * "__x64_sys", "__ia32_sys", "__do_sys" or simple "sys" prefix.
6565 */
6666 return !strcmp(sym + 3, name + 3) ||
6767 (!strncmp(sym, "__x64_", 6) && !strcmp(sym + 9, name + 3)) ||
68− (!strncmp(sym, "__ia32_", 7) && !strcmp(sym + 10, name + 3));
68+ (!strncmp(sym, "__ia32_", 7) && !strcmp(sym + 10, name + 3)) ||
69+ (!strncmp(sym, "__do_sys", 8) && !strcmp(sym + 8, name + 3));
6970 }
7071
7172 #ifndef COMPILE_OFFSETS
arch/x86/include/asm/kvm_host.h+2−2
@@ -1663,8 +1663,8 @@ void kvm_set_msi_irq(struct kvm *kvm, struct kvm_kernel_irq_routing_entry *e, · 1662 unmodified lines
16631663 static inline bool kvm_irq_is_postable(struct kvm_lapic_irq *irq)
16641664 {
16651665 /* We can only post Fixed and LowPrio IRQs */
1666− return (irq->delivery_mode == dest_Fixed ||
1667− irq->delivery_mode == dest_LowestPrio);
1666+ return (irq->delivery_mode == APIC_DM_FIXED ||
1667+ irq->delivery_mode == APIC_DM_LOWEST);
16681668 }
16691669
16701670 static inline void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu)
arch/x86/include/asm/mshyperv.h+2−0
@@ -35,6 +35,8 @@ typedef int (*hyperv_fill_flush_list_func)( · 34 unmodified lines
3535 rdmsrl(HV_X64_MSR_SINT0 + int_num, val)
3636 #define hv_set_synint_state(int_num, val) \
3737 wrmsrl(HV_X64_MSR_SINT0 + int_num, val)
38+#define hv_recommend_using_aeoi() \
39+ (!(ms_hyperv.hints & HV_DEPRECATING_AEOI_RECOMMENDED))
3840
3941 #define hv_get_crash_ctl(val) \
4042 rdmsrl(HV_X64_MSR_CRASH_CTL, val)
arch/x86/include/asm/unwind.h+1−1
@@ -19,7 +19,7 @@ struct unwind_state { · 18 unmodified lines
1919 #if defined(CONFIG_UNWINDER_ORC)
2020 bool signal, full_regs;
2121 unsigned long sp, bp, ip;
22− struct pt_regs *regs;
22+ struct pt_regs *regs, *prev_regs;
2323 #elif defined(CONFIG_UNWINDER_FRAME_POINTER)
2424 bool got_irq;
2525 unsigned long *bp, *orig_sp, ip;
arch/x86/kernel/apic/apic.c+14−13
@@ -352,8 +352,6 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen) · 351 unmodified lines
352352 * According to Intel, MFENCE can do the serialization here.
353353 */
354354 asm volatile("mfence" : : : "memory");
355−
356− printk_once(KERN_DEBUG "TSC deadline timer enabled\n");
357355 return;
358356 }
359357
@@ -546,7 +544,7 @@ static struct clock_event_device lapic_clockevent = { · 186 unmodified lines
546544 };
547545 static DEFINE_PER_CPU(struct clock_event_device, lapic_events);
548546
549−static u32 hsx_deadline_rev(void)
547+static __init u32 hsx_deadline_rev(void)
550548 {
551549 switch (boot_cpu_data.x86_stepping) {
552550 case 0x02: return 0x3a; /* EP */
@@ -556,7 +554,7 @@ static u32 hsx_deadline_rev(void) · 3 unmodified lines
556554 return ~0U;
557555 }
558556
559−static u32 bdx_deadline_rev(void)
557+static __init u32 bdx_deadline_rev(void)
560558 {
561559 switch (boot_cpu_data.x86_stepping) {
562560 case 0x02: return 0x00000011;
@@ -568,7 +566,7 @@ static u32 bdx_deadline_rev(void) · 5 unmodified lines
568566 return ~0U;
569567 }
570568
571−static u32 skx_deadline_rev(void)
569+static __init u32 skx_deadline_rev(void)
572570 {
573571 switch (boot_cpu_data.x86_stepping) {
574572 case 0x03: return 0x01000136;
@@ -581,7 +579,7 @@ static u32 skx_deadline_rev(void) · 6 unmodified lines
581579 return ~0U;
582580 }
583581
584−static const struct x86_cpu_id deadline_match[] = {
582+static const struct x86_cpu_id deadline_match[] __initconst = {
585583 X86_MATCH_INTEL_FAM6_MODEL( HASWELL_X, &hsx_deadline_rev),
586584 X86_MATCH_INTEL_FAM6_MODEL( BROADWELL_X, 0x0b000020),
587585 X86_MATCH_INTEL_FAM6_MODEL( BROADWELL_D, &bdx_deadline_rev),
@@ -603,18 +601,19 @@ static const struct x86_cpu_id deadline_match[] = { · 15 unmodified lines
603601 {},
604602 };
605603
606−static void apic_check_deadline_errata(void)
604+static __init bool apic_validate_deadline_timer(void)
607605 {
608606 const struct x86_cpu_id *m;
609607 u32 rev;
610608
611− if (!boot_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER) ||
612− boot_cpu_has(X86_FEATURE_HYPERVISOR))
613− return;
609+ if (!boot_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER))
610+ return false;
611+ if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
612+ return true;
614613
615614 m = x86_match_cpu(deadline_match);
616615 if (!m)
617− return;
616+ return true;
618617
619618 /*
620619 * Function pointers will have the MSB set due to address layout,
@@ -626,11 +625,12 @@ static void apic_check_deadline_errata(void) · 5 unmodified lines
626625 rev = (u32)m->driver_data;
627626
628627 if (boot_cpu_data.microcode >= rev)
629− return;
628+ return true;
630629
631630 setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER);
632631 pr_err(FW_BUG "TSC_DEADLINE disabled due to Errata; "
633632 "please update microcode to version: 0x%x (or later)\n", rev);
633+ return false;
634634 }
635635
636636 /*
@@ -2092,7 +2092,8 @@ void __init init_apic_mappings(void) · 1455 unmodified lines
20922092 {
20932093 unsigned int new_apicid;
20942094
2095− apic_check_deadline_errata();
2095+ if (apic_validate_deadline_timer())
2096+ pr_debug("TSC deadline timer available\n");
20962097
20972098 if (x2apic_mode) {
20982099 boot_cpu_physical_apicid = read_apic_id();
arch/x86/kernel/dumpstack_64.c+2−1
@@ -183,7 +183,8 @@ recursion_check: · 182 unmodified lines
183183 */
184184 if (visit_mask) {
185185 if (*visit_mask & (1UL << info->type)) {
186− printk_deferred_once(KERN_WARNING "WARNING: stack recursion on stack type %d\n", info->type);
186+ if (task == current)
187+ printk_deferred_once(KERN_WARNING "WARNING: stack recursion on stack type %d\n", info->type);
187188 goto unknown;
188189 }
189190 *visit_mask |= 1UL << info->type;
arch/x86/kernel/unwind_frame.c+3−0
@@ -344,6 +344,9 @@ bad_address: · 343 unmodified lines
344344 if (IS_ENABLED(CONFIG_X86_32))
345345 goto the_end;
346346
347+ if (state->task != current)
348+ goto the_end;
349+
347350 if (state->regs) {
348351 printk_deferred_once(KERN_WARNING
349352 "WARNING: kernel stack regs at %p in %s:%d has bad 'bp' value %p\n",
arch/x86/kernel/unwind_orc.c+74−39
@@ -8,19 +8,21 @@ · 7 unmodified lines
88 #include <asm/orc_lookup.h>
99
1010 #define orc_warn(fmt, ...) \
11− printk_deferred_once(KERN_WARNING pr_fmt("WARNING: " fmt), ##__VA_ARGS__)
11+ printk_deferred_once(KERN_WARNING "WARNING: " fmt, ##__VA_ARGS__)
12+
13+#define orc_warn_current(args...) \
14+({ \
15+ if (state->task == current) \
16+ orc_warn(args); \
17+})
1218
1319 extern int __start_orc_unwind_ip[];
1420 extern int __stop_orc_unwind_ip[];
1521 extern struct orc_entry __start_orc_unwind[];
1622 extern struct orc_entry __stop_orc_unwind[];
1723
18−static DEFINE_MUTEX(sort_mutex);
19−int *cur_orc_ip_table = __start_orc_unwind_ip;
20−struct orc_entry *cur_orc_table = __start_orc_unwind;
21−
22−unsigned int lookup_num_blocks;
23−bool orc_init;
24+static bool orc_init __ro_after_init;
25+static unsigned int lookup_num_blocks __ro_after_init;
2426
2527 static inline unsigned long orc_ip(const int *ip)
2628 {
@@ -142,9 +144,6 @@ static struct orc_entry *orc_find(unsigned long ip) · 115 unmodified lines
142144 {
143145 static struct orc_entry *orc;
144146
145− if (!orc_init)
146− return NULL;
147−
148147 if (ip == 0)
149148 return &null_orc_entry;
150149
@@ -189,6 +188,10 @@ static struct orc_entry *orc_find(unsigned long ip) · 38 unmodified lines
189188
190189 #ifdef CONFIG_MODULES
191190
191+static DEFINE_MUTEX(sort_mutex);
192+static int *cur_orc_ip_table = __start_orc_unwind_ip;
193+static struct orc_entry *cur_orc_table = __start_orc_unwind;
194+
192195 static void orc_sort_swap(void *_a, void *_b, int size)
193196 {
194197 struct orc_entry *orc_a, *orc_b;
@@ -381,9 +384,38 @@ static bool deref_stack_iret_regs(struct unwind_state *state, unsigned long addr · 186 unmodified lines
381384 return true;
382385 }
383386
387+/*
388+ * If state->regs is non-NULL, and points to a full pt_regs, just get the reg
389+ * value from state->regs.
390+ *
391+ * Otherwise, if state->regs just points to IRET regs, and the previous frame
392+ * had full regs, it's safe to get the value from the previous regs. This can
393+ * happen when early/late IRQ entry code gets interrupted by an NMI.
394+ */
395+static bool get_reg(struct unwind_state *state, unsigned int reg_off,
396+ unsigned long *val)
397+{
398+ unsigned int reg = reg_off/8;
399+
400+ if (!state->regs)
401+ return false;
402+
403+ if (state->full_regs) {
404+ *val = ((unsigned long *)state->regs)[reg];
405+ return true;
406+ }
407+
408+ if (state->prev_regs) {
409+ *val = ((unsigned long *)state->prev_regs)[reg];
410+ return true;
411+ }
412+
413+ return false;
414+}
415+
384416 bool unwind_next_frame(struct unwind_state *state)
385417 {
386− unsigned long ip_p, sp, orig_ip = state->ip, prev_sp = state->sp;
418+ unsigned long ip_p, sp, tmp, orig_ip = state->ip, prev_sp = state->sp;
387419 enum stack_type prev_type = state->stack_info.type;
388420 struct orc_entry *orc;
389421 bool indirect = false;
@@ -445,43 +477,39 @@ bool unwind_next_frame(struct unwind_state *state) · 55 unmodified lines
445477 break;
446478
447479 case ORC_REG_R10:
448− if (!state->regs || !state->full_regs) {
449− orc_warn("missing regs for base reg R10 at ip %pB\n",
450− (void *)state->ip);
480+ if (!get_reg(state, offsetof(struct pt_regs, r10), &sp)) {
481+ orc_warn_current("missing R10 value at %pB\n",
482+ (void *)state->ip);
451483 goto err;
452484 }
453− sp = state->regs->r10;
454485 break;
455486
456487 case ORC_REG_R13:
457− if (!state->regs || !state->full_regs) {
458− orc_warn("missing regs for base reg R13 at ip %pB\n",
459− (void *)state->ip);
488+ if (!get_reg(state, offsetof(struct pt_regs, r13), &sp)) {
489+ orc_warn_current("missing R13 value at %pB\n",
490+ (void *)state->ip);
460491 goto err;
461492 }
462− sp = state->regs->r13;
463493 break;
464494
465495 case ORC_REG_DI:
466− if (!state->regs || !state->full_regs) {
467− orc_warn("missing regs for base reg DI at ip %pB\n",
468− (void *)state->ip);
496+ if (!get_reg(state, offsetof(struct pt_regs, di), &sp)) {
497+ orc_warn_current("missing RDI value at %pB\n",
498+ (void *)state->ip);
469499 goto err;
470500 }
471− sp = state->regs->di;
472501 break;
473502
474503 case ORC_REG_DX:
475− if (!state->regs || !state->full_regs) {
476− orc_warn("missing regs for base reg DX at ip %pB\n",
477− (void *)state->ip);
504+ if (!get_reg(state, offsetof(struct pt_regs, dx), &sp)) {
505+ orc_warn_current("missing DX value at %pB\n",
506+ (void *)state->ip);
478507 goto err;
479508 }
480− sp = state->regs->dx;
481509 break;
482510
483511 default:
484− orc_warn("unknown SP base reg %d for ip %pB\n",
512+ orc_warn("unknown SP base reg %d at %pB\n",
485513 orc->sp_reg, (void *)state->ip);
486514 goto err;
487515 }
@@ -504,44 +532,48 @@ bool unwind_next_frame(struct unwind_state *state) · 16 unmodified lines
504532
505533 state->sp = sp;
506534 state->regs = NULL;
535+ state->prev_regs = NULL;
507536 state->signal = false;
508537 break;
509538
510539 case ORC_TYPE_REGS:
511540 if (!deref_stack_regs(state, sp, &state->ip, &state->sp)) {
512− orc_warn("can't dereference registers at %p for ip %pB\n",
513− (void *)sp, (void *)orig_ip);
541+ orc_warn_current("can't access registers at %pB\n",
542+ (void *)orig_ip);
514543 goto err;
515544 }
516545
517546 state->regs = (struct pt_regs *)sp;
547+ state->prev_regs = NULL;
518548 state->full_regs = true;
519549 state->signal = true;
520550 break;
521551
522552 case ORC_TYPE_REGS_IRET:
523553 if (!deref_stack_iret_regs(state, sp, &state->ip, &state->sp)) {
524− orc_warn("can't dereference iret registers at %p for ip %pB\n",
525− (void *)sp, (void *)orig_ip);
554+ orc_warn_current("can't access iret registers at %pB\n",
555+ (void *)orig_ip);
526556 goto err;
527557 }
528558
559+ if (state->full_regs)
560+ state->prev_regs = state->regs;
529561 state->regs = (void *)sp - IRET_FRAME_OFFSET;
530562 state->full_regs = false;
531563 state->signal = true;
532564 break;
533565
534566 default:
535− orc_warn("unknown .orc_unwind entry type %d for ip %pB\n",
567+ orc_warn("unknown .orc_unwind entry type %d at %pB\n",
536568 orc->type, (void *)orig_ip);
537− break;
569+ goto err;
538570 }
539571
540572 /* Find BP: */
541573 switch (orc->bp_reg) {
542574 case ORC_REG_UNDEFINED:
543− if (state->regs && state->full_regs)
544− state->bp = state->regs->bp;
575+ if (get_reg(state, offsetof(struct pt_regs, bp), &tmp))
576+ state->bp = tmp;
545577 break;
546578
547579 case ORC_REG_PREV_SP:
@@ -564,8 +596,8 @@ bool unwind_next_frame(struct unwind_state *state) · 16 unmodified lines
564596 if (state->stack_info.type == prev_type &&
565597 on_stack(&state->stack_info, (void *)state->sp, sizeof(long)) &&
566598 state->sp <= prev_sp) {
567− orc_warn("stack going in the wrong direction? ip=%pB\n",
568− (void *)orig_ip);
599+ orc_warn_current("stack going in the wrong direction? at %pB\n",
600+ (void *)orig_ip);
569601 goto err;
570602 }
571603
@@ -585,6 +617,9 @@ EXPORT_SYMBOL_GPL(unwind_next_frame); · 13 unmodified lines
585617 void __unwind_start(struct unwind_state *state, struct task_struct *task,
586618 struct pt_regs *regs, unsigned long *first_frame)
587619 {
620+ if (!orc_init)
621+ goto done;
622+
588623 memset(state, 0, sizeof(*state));
589624 state->task = task;
590625
@@ -651,7 +686,7 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task, · 60 unmodified lines
651686 /* Otherwise, skip ahead to the user-specified starting frame: */
652687 while (!unwind_done(state) &&
653688 (!on_stack(&state->stack_info, first_frame, sizeof(long)) ||
654− state->sp <= (unsigned long)first_frame))
689+ state->sp < (unsigned long)first_frame))
655690 unwind_next_frame(state);
656691
657692 return;
arch/x86/kvm/ioapic.c+5−5
@@ -225,12 +225,12 @@ static int ioapic_set_irq(struct kvm_ioapic *ioapic, unsigned int irq, · 224 unmodified lines
225225 }
226226
227227 /*
228− * AMD SVM AVIC accelerate EOI write and do not trap,
229− * in-kernel IOAPIC will not be able to receive the EOI.
230− * In this case, we do lazy update of the pending EOI when
231− * trying to set IOAPIC irq.
228+ * AMD SVM AVIC accelerate EOI write iff the interrupt is edge
229+ * triggered, in which case the in-kernel IOAPIC will not be able
230+ * to receive the EOI. In this case, we do a lazy update of the
231+ * pending EOI when trying to set IOAPIC irq.
232232 */
233− if (kvm_apicv_activated(ioapic->kvm))
233+ if (edge && kvm_apicv_activated(ioapic->kvm))
234234 ioapic_lazy_update_eoi(ioapic, irq);
235235
236236 /*
arch/x86/kvm/svm/sev.c+1−1
@@ -345,7 +345,7 @@ static struct page **sev_pin_memory(struct kvm *kvm, unsigned long uaddr, · 344 unmodified lines
345345 return NULL;
346346
347347 /* Pin the user virtual address. */
348− npinned = get_user_pages_fast(uaddr, npages, FOLL_WRITE, pages);
348+ npinned = get_user_pages_fast(uaddr, npages, write ? FOLL_WRITE : 0, pages);
349349 if (npinned != npages) {
350350 pr_err("SEV: Failure locking %lu pages.\n", npages);
351351 goto err;
arch/x86/kvm/svm/svm.c+2−0
@@ -1752,6 +1752,8 @@ static int db_interception(struct vcpu_svm *svm) · 1751 unmodified lines
17521752 if (svm->vcpu.guest_debug &
17531753 (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP)) {
17541754 kvm_run->exit_reason = KVM_EXIT_DEBUG;
1755+ kvm_run->debug.arch.dr6 = svm->vmcb->save.dr6;
1756+ kvm_run->debug.arch.dr7 = svm->vmcb->save.dr7;
17551757 kvm_run->debug.arch.pc =
17561758 svm->vmcb->save.cs.base + svm->vmcb->save.rip;
17571759 kvm_run->debug.arch.exception = DB_VECTOR;
arch/x86/kvm/vmx/nested.c+1−1
@@ -5165,7 +5165,7 @@ static int handle_invept(struct kvm_vcpu *vcpu) · 5164 unmodified lines
51655165 */
51665166 break;
51675167 default:
5168− BUG_ON(1);
5168+ BUG();
51695169 break;
51705170 }
51715171
arch/x86/kvm/vmx/vmenter.S+3−0
@@ -82,6 +82,9 @@ SYM_FUNC_START(vmx_vmexit) · 81 unmodified lines
8282 /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */
8383 FILL_RETURN_BUFFER %_ASM_AX, RSB_CLEAR_LOOPS, X86_FEATURE_RETPOLINE
8484
85+ /* Clear RFLAGS.CF and RFLAGS.ZF to preserve VM-Exit, i.e. !VM-Fail. */
86+ or $1, %_ASM_AX
87+
8588 pop %_ASM_AX
8689 .Lvmexit_skip_rsb:
8790 #endif
arch/x86/kvm/x86.c+6−15
@@ -926,19 +926,6 @@ EXPORT_SYMBOL_GPL(kvm_set_xcr); · 925 unmodified lines
926926 __reserved_bits; \
927927 })
928928
929−static u64 kvm_host_cr4_reserved_bits(struct cpuinfo_x86 *c)
930−{
931− u64 reserved_bits = __cr4_reserved_bits(cpu_has, c);
932−
933− if (kvm_cpu_cap_has(X86_FEATURE_LA57))
934− reserved_bits &= ~X86_CR4_LA57;
935−
936− if (kvm_cpu_cap_has(X86_FEATURE_UMIP))
937− reserved_bits &= ~X86_CR4_UMIP;
938−
939− return reserved_bits;
940−}
941−
942929 static int kvm_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
943930 {
944931 if (cr4 & cr4_reserved_bits)
@@ -3385,6 +3372,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 2440 unmodified lines
33853372 case KVM_CAP_GET_MSR_FEATURES:
33863373 case KVM_CAP_MSR_PLATFORM_INFO:
33873374 case KVM_CAP_EXCEPTION_PAYLOAD:
3375+ case KVM_CAP_SET_GUEST_DEBUG:
33883376 r = 1;
33893377 break;
33903378 case KVM_CAP_SYNC_REGS:
@@ -9675,7 +9663,9 @@ int kvm_arch_hardware_setup(void *opaque) · 6284 unmodified lines
96759663 if (!kvm_cpu_cap_has(X86_FEATURE_XSAVES))
96769664 supported_xss = 0;
96779665
9678− cr4_reserved_bits = kvm_host_cr4_reserved_bits(&boot_cpu_data);
9666+#define __kvm_cpu_cap_has(UNUSED_, f) kvm_cpu_cap_has(f)
9667+ cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_);
9668+#undef __kvm_cpu_cap_has
96799669
96809670 if (kvm_has_tsc_control) {
96819671 /*
@@ -9707,7 +9697,8 @@ int kvm_arch_check_processor_compat(void *opaque) · 25 unmodified lines
97079697
97089698 WARN_ON(!irqs_disabled());
97099699
9710− if (kvm_host_cr4_reserved_bits(c) != cr4_reserved_bits)
9700+ if (__cr4_reserved_bits(cpu_has, c) !=
9701+ __cr4_reserved_bits(cpu_has, &boot_cpu_data))
97119702 return -EIO;
97129703
97139704 return ops->check_processor_compatibility();
arch/x86/mm/pat/set_memory.c+8−4
@@ -43,7 +43,8 @@ struct cpa_data { · 42 unmodified lines
4343 unsigned long pfn;
4444 unsigned int flags;
4545 unsigned int force_split : 1,
46− force_static_prot : 1;
46+ force_static_prot : 1,
47+ force_flush_all : 1;
4748 struct page **pages;
4849 };
4950
@@ -355,10 +356,10 @@ static void cpa_flush(struct cpa_data *data, int cache) · 305 unmodified lines
355356 return;
356357 }
357358
358− if (cpa->numpages <= tlb_single_page_flush_ceiling)
359− on_each_cpu(__cpa_flush_tlb, cpa, 1);
360− else
359+ if (cpa->force_flush_all || cpa->numpages > tlb_single_page_flush_ceiling)
361360 flush_tlb_all();
361+ else
362+ on_each_cpu(__cpa_flush_tlb, cpa, 1);
362363
363364 if (!cache)
364365 return;
@@ -1598,6 +1599,8 @@ static int cpa_process_alias(struct cpa_data *cpa) · 1233 unmodified lines
15981599 alias_cpa.flags &= ~(CPA_PAGES_ARRAY | CPA_ARRAY);
15991600 alias_cpa.curpage = 0;
16001601
1602+ cpa->force_flush_all = 1;
1603+
16011604 ret = __change_page_attr_set_clr(&alias_cpa, 0);
16021605 if (ret)
16031606 return ret;
@@ -1618,6 +1621,7 @@ static int cpa_process_alias(struct cpa_data *cpa) · 14 unmodified lines
16181621 alias_cpa.flags &= ~(CPA_PAGES_ARRAY | CPA_ARRAY);
16191622 alias_cpa.curpage = 0;
16201623
1624+ cpa->force_flush_all = 1;
16211625 /*
16221626 * The high mapping range is imprecise, so ignore the
16231627 * return value.
block/bfq-iosched.c+4−2
@@ -123,6 +123,7 @@ · 122 unmodified lines
123123 #include <linux/ioprio.h>
124124 #include <linux/sbitmap.h>
125125 #include <linux/delay.h>
126+#include <linux/backing-dev.h>
126127
127128 #include "blk.h"
128129 #include "blk-mq.h"
@@ -4976,8 +4977,9 @@ bfq_set_next_ioprio_data(struct bfq_queue *bfqq, struct bfq_io_cq *bic) · 4847 unmodified lines
49764977 ioprio_class = IOPRIO_PRIO_CLASS(bic->ioprio);
49774978 switch (ioprio_class) {
49784979 default:
4979− dev_err(bfqq->bfqd->queue->backing_dev_info->dev,
4980− "bfq: bad prio class %d\n", ioprio_class);
4980+ pr_err("bdi %s: bfq: bad prio class %d\n",
4981+ bdi_dev_name(bfqq->bfqd->queue->backing_dev_info),
4982+ ioprio_class);
49814983 /* fall through */
49824984 case IOPRIO_CLASS_NONE:
49834985 /*
block/blk-cgroup.c+1−1
@@ -496,7 +496,7 @@ const char *blkg_dev_name(struct blkcg_gq *blkg) · 495 unmodified lines
496496 {
497497 /* some drivers (floppy) instantiate a queue w/o disk registered */
498498 if (blkg->q->backing_dev_info->dev)
499− return dev_name(blkg->q->backing_dev_info->dev);
499+ return bdi_dev_name(blkg->q->backing_dev_info);
500500 return NULL;
501501 }
502502
block/blk-iocost.c+71−46
@@ -466,7 +466,7 @@ struct ioc_gq { · 465 unmodified lines
466466 */
467467 atomic64_t vtime;
468468 atomic64_t done_vtime;
469− atomic64_t abs_vdebt;
469+ u64 abs_vdebt;
470470 u64 last_vtime;
471471
472472 /*
@@ -1142,7 +1142,7 @@ static void iocg_kick_waitq(struct ioc_gq *iocg, struct ioc_now *now) · 669 unmodified lines
11421142 struct iocg_wake_ctx ctx = { .iocg = iocg };
11431143 u64 margin_ns = (u64)(ioc->period_us *
11441144 WAITQ_TIMER_MARGIN_PCT / 100) * NSEC_PER_USEC;
1145− u64 abs_vdebt, vdebt, vshortage, expires, oexpires;
1145+ u64 vdebt, vshortage, expires, oexpires;
11461146 s64 vbudget;
11471147 u32 hw_inuse;
11481148
@@ -1152,18 +1152,15 @@ static void iocg_kick_waitq(struct ioc_gq *iocg, struct ioc_now *now) · 3 unmodified lines
11521152 vbudget = now->vnow - atomic64_read(&iocg->vtime);
11531153
11541154 /* pay off debt */
1155− abs_vdebt = atomic64_read(&iocg->abs_vdebt);
1156− vdebt = abs_cost_to_cost(abs_vdebt, hw_inuse);
1155+ vdebt = abs_cost_to_cost(iocg->abs_vdebt, hw_inuse);
11571156 if (vdebt && vbudget > 0) {
11581157 u64 delta = min_t(u64, vbudget, vdebt);
11591158 u64 abs_delta = min(cost_to_abs_cost(delta, hw_inuse),
1160− abs_vdebt);
1159+ iocg->abs_vdebt);
11611160
11621161 atomic64_add(delta, &iocg->vtime);
11631162 atomic64_add(delta, &iocg->done_vtime);
1164− atomic64_sub(abs_delta, &iocg->abs_vdebt);
1165− if (WARN_ON_ONCE(atomic64_read(&iocg->abs_vdebt) < 0))
1166− atomic64_set(&iocg->abs_vdebt, 0);
1163+ iocg->abs_vdebt -= abs_delta;
11671164 }
11681165
11691166 /*
@@ -1219,12 +1216,18 @@ static bool iocg_kick_delay(struct ioc_gq *iocg, struct ioc_now *now, u64 cost) · 49 unmodified lines
12191216 u64 expires, oexpires;
12201217 u32 hw_inuse;
12211218
1219+ lockdep_assert_held(&iocg->waitq.lock);
1220+
12221221 /* debt-adjust vtime */
12231222 current_hweight(iocg, NULL, &hw_inuse);
1224− vtime += abs_cost_to_cost(atomic64_read(&iocg->abs_vdebt), hw_inuse);
1223+ vtime += abs_cost_to_cost(iocg->abs_vdebt, hw_inuse);
12251224
1226− /* clear or maintain depending on the overage */
1227− if (time_before_eq64(vtime, now->vnow)) {
1225+ /*
1226+ * Clear or maintain depending on the overage. Non-zero vdebt is what
1227+ * guarantees that @iocg is online and future iocg_kick_delay() will
1228+ * clear use_delay. Don't leave it on when there's no vdebt.
1229+ */
1230+ if (!iocg->abs_vdebt || time_before_eq64(vtime, now->vnow)) {
12281231 blkcg_clear_delay(blkg);
12291232 return false;
12301233 }
@@ -1258,9 +1261,12 @@ static enum hrtimer_restart iocg_delay_timer_fn(struct hrtimer *timer) · 27 unmodified lines
12581261 {
12591262 struct ioc_gq *iocg = container_of(timer, struct ioc_gq, delay_timer);
12601263 struct ioc_now now;
1264+ unsigned long flags;
12611265
1266+ spin_lock_irqsave(&iocg->waitq.lock, flags);
12621267 ioc_now(iocg->ioc, &now);
12631268 iocg_kick_delay(iocg, &now, 0);
1269+ spin_unlock_irqrestore(&iocg->waitq.lock, flags);
12641270
12651271 return HRTIMER_NORESTART;
12661272 }
@@ -1368,14 +1374,13 @@ static void ioc_timer_fn(struct timer_list *timer) · 101 unmodified lines
13681374 * should have woken up in the last period and expire idle iocgs.
13691375 */
13701376 list_for_each_entry_safe(iocg, tiocg, &ioc->active_iocgs, active_list) {
1371− if (!waitqueue_active(&iocg->waitq) &&
1372− !atomic64_read(&iocg->abs_vdebt) && !iocg_is_idle(iocg))
1377+ if (!waitqueue_active(&iocg->waitq) && iocg->abs_vdebt &&
1378+ !iocg_is_idle(iocg))
13731379 continue;
13741380
13751381 spin_lock(&iocg->waitq.lock);
13761382
1377− if (waitqueue_active(&iocg->waitq) ||
1378− atomic64_read(&iocg->abs_vdebt)) {
1383+ if (waitqueue_active(&iocg->waitq) || iocg->abs_vdebt) {
13791384 /* might be oversleeping vtime / hweight changes, kick */
13801385 iocg_kick_waitq(iocg, &now);
13811386 iocg_kick_delay(iocg, &now, 0);
@@ -1718,28 +1723,49 @@ static void ioc_rqos_throttle(struct rq_qos *rqos, struct bio *bio) · 336 unmodified lines
17181723 * tests are racy but the races aren't systemic - we only miss once
17191724 * in a while which is fine.
17201725 */
1721− if (!waitqueue_active(&iocg->waitq) &&
1722− !atomic64_read(&iocg->abs_vdebt) &&
1726+ if (!waitqueue_active(&iocg->waitq) && !iocg->abs_vdebt &&
17231727 time_before_eq64(vtime + cost, now.vnow)) {
17241728 iocg_commit_bio(iocg, bio, cost);
17251729 return;
17261730 }
17271731
17281732 /*
1729− * We're over budget. If @bio has to be issued regardless,
1730− * remember the abs_cost instead of advancing vtime.
1731− * iocg_kick_waitq() will pay off the debt before waking more IOs.
1733+ * We activated above but w/o any synchronization. Deactivation is
1734+ * synchronized with waitq.lock and we won't get deactivated as long
1735+ * as we're waiting or has debt, so we're good if we're activated
1736+ * here. In the unlikely case that we aren't, just issue the IO.
1737+ */
1738+ spin_lock_irq(&iocg->waitq.lock);
1739+
1740+ if (unlikely(list_empty(&iocg->active_list))) {
1741+ spin_unlock_irq(&iocg->waitq.lock);
1742+ iocg_commit_bio(iocg, bio, cost);
1743+ return;
1744+ }
1745+
1746+ /*
1747+ * We're over budget. If @bio has to be issued regardless, remember
1748+ * the abs_cost instead of advancing vtime. iocg_kick_waitq() will pay
1749+ * off the debt before waking more IOs.
1750+ *
17321751 * This way, the debt is continuously paid off each period with the
1733− * actual budget available to the cgroup. If we just wound vtime,
1734− * we would incorrectly use the current hw_inuse for the entire
1735− * amount which, for example, can lead to the cgroup staying
1736− * blocked for a long time even with substantially raised hw_inuse.
1752+ * actual budget available to the cgroup. If we just wound vtime, we
1753+ * would incorrectly use the current hw_inuse for the entire amount
1754+ * which, for example, can lead to the cgroup staying blocked for a
1755+ * long time even with substantially raised hw_inuse.
1756+ *
1757+ * An iocg with vdebt should stay online so that the timer can keep
1758+ * deducting its vdebt and [de]activate use_delay mechanism
1759+ * accordingly. We don't want to race against the timer trying to
1760+ * clear them and leave @iocg inactive w/ dangling use_delay heavily
1761+ * penalizing the cgroup and its descendants.
17371762 */
17381763 if (bio_issue_as_root_blkg(bio) || fatal_signal_pending(current)) {
1739− atomic64_add(abs_cost, &iocg->abs_vdebt);
1764+ iocg->abs_vdebt += abs_cost;
17401765 if (iocg_kick_delay(iocg, &now, cost))
17411766 blkcg_schedule_throttle(rqos->q,
17421767 (bio->bi_opf & REQ_SWAP) == REQ_SWAP);
1768+ spin_unlock_irq(&iocg->waitq.lock);
17431769 return;
17441770 }
17451771
@@ -1756,20 +1782,6 @@ static void ioc_rqos_throttle(struct rq_qos *rqos, struct bio *bio) · 10 unmodified lines
17561782 * All waiters are on iocg->waitq and the wait states are
17571783 * synchronized using waitq.lock.
17581784 */
1759− spin_lock_irq(&iocg->waitq.lock);
1760−
1761− /*
1762− * We activated above but w/o any synchronization. Deactivation is
1763− * synchronized with waitq.lock and we won't get deactivated as
1764− * long as we're waiting, so we're good if we're activated here.
1765− * In the unlikely case that we are deactivated, just issue the IO.
1766− */
1767− if (unlikely(list_empty(&iocg->active_list))) {
1768− spin_unlock_irq(&iocg->waitq.lock);
1769− iocg_commit_bio(iocg, bio, cost);
1770− return;
1771− }
1772−
17731785 init_waitqueue_func_entry(&wait.wait, iocg_wake_fn);
17741786 wait.wait.private = current;
17751787 wait.bio = bio;
@@ -1801,6 +1813,7 @@ static void ioc_rqos_merge(struct rq_qos *rqos, struct request *rq, · 25 unmodified lines
18011813 struct ioc_now now;
18021814 u32 hw_inuse;
18031815 u64 abs_cost, cost;
1816+ unsigned long flags;
18041817
18051818 /* bypass if disabled or for root cgroup */
18061819 if (!ioc->enabled || !iocg->level)
@@ -1820,15 +1833,28 @@ static void ioc_rqos_merge(struct rq_qos *rqos, struct request *rq, · 13 unmodified lines
18201833 iocg->cursor = bio_end;
18211834
18221835 /*
1823− * Charge if there's enough vtime budget and the existing request
1824− * has cost assigned. Otherwise, account it as debt. See debt
1825− * handling in ioc_rqos_throttle() for details.
1836+ * Charge if there's enough vtime budget and the existing request has
1837+ * cost assigned.
18261838 */
18271839 if (rq->bio && rq->bio->bi_iocost_cost &&
1828− time_before_eq64(atomic64_read(&iocg->vtime) + cost, now.vnow))
1840+ time_before_eq64(atomic64_read(&iocg->vtime) + cost, now.vnow)) {
18291841 iocg_commit_bio(iocg, bio, cost);
1830− else
1831− atomic64_add(abs_cost, &iocg->abs_vdebt);
1842+ return;
1843+ }
1844+
1845+ /*
1846+ * Otherwise, account it as debt if @iocg is online, which it should
1847+ * be for the vast majority of cases. See debt handling in
1848+ * ioc_rqos_throttle() for details.
1849+ */
1850+ spin_lock_irqsave(&iocg->waitq.lock, flags);
1851+ if (likely(!list_empty(&iocg->active_list))) {
1852+ iocg->abs_vdebt += abs_cost;
1853+ iocg_kick_delay(iocg, &now, cost);
1854+ } else {
1855+ iocg_commit_bio(iocg, bio, cost);
1856+ }
1857+ spin_unlock_irqrestore(&iocg->waitq.lock, flags);
18321858 }
18331859
18341860 static void ioc_rqos_done_bio(struct rq_qos *rqos, struct bio *bio)
@@ -1998,7 +2024,6 @@ static void ioc_pd_init(struct blkg_policy_data *pd) · 163 unmodified lines
19982024 iocg->ioc = ioc;
19992025 atomic64_set(&iocg->vtime, now.vnow);
20002026 atomic64_set(&iocg->done_vtime, now.vnow);
2001− atomic64_set(&iocg->abs_vdebt, 0);
20022027 atomic64_set(&iocg->active_period, atomic64_read(&ioc->cur_period));
20032028 INIT_LIST_HEAD(&iocg->active_list);
20042029 iocg->hweight_active = HWEIGHT_WHOLE;
block/partitions/core.c+1−1
@@ -496,7 +496,7 @@ int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev) · 495 unmodified lines
496496
497497 if (!disk_part_scan_enabled(disk))
498498 return 0;
499− if (bdev->bd_part_count || bdev->bd_openers > 1)
499+ if (bdev->bd_part_count)
500500 return -EBUSY;
501501 res = invalidate_partition(disk, 0);
502502 if (res)
crypto/lrw.c+3−3
@@ -287,7 +287,7 @@ static void exit_tfm(struct crypto_skcipher *tfm) · 286 unmodified lines
287287 crypto_free_skcipher(ctx->child);
288288 }
289289
290−static void free(struct skcipher_instance *inst)
290+static void free_inst(struct skcipher_instance *inst)
291291 {
292292 crypto_drop_skcipher(skcipher_instance_ctx(inst));
293293 kfree(inst);
@@ -400,12 +400,12 @@ static int create(struct crypto_template *tmpl, struct rtattr **tb) · 106 unmodified lines
400400 inst->alg.encrypt = encrypt;
401401 inst->alg.decrypt = decrypt;
402402
403− inst->free = free;
403+ inst->free = free_inst;
404404
405405 err = skcipher_register_instance(tmpl, inst);
406406 if (err) {
407407 err_free_inst:
408− free(inst);
408+ free_inst(inst);
409409 }
410410 return err;
411411 }
crypto/xts.c+3−3
@@ -322,7 +322,7 @@ static void exit_tfm(struct crypto_skcipher *tfm) · 321 unmodified lines
322322 crypto_free_cipher(ctx->tweak);
323323 }
324324
325−static void free(struct skcipher_instance *inst)
325+static void free_inst(struct skcipher_instance *inst)
326326 {
327327 crypto_drop_skcipher(skcipher_instance_ctx(inst));
328328 kfree(inst);
@@ -434,12 +434,12 @@ static int create(struct crypto_template *tmpl, struct rtattr **tb) · 105 unmodified lines
434434 inst->alg.encrypt = encrypt;
435435 inst->alg.decrypt = decrypt;
436436
437− inst->free = free;
437+ inst->free = free_inst;
438438
439439 err = skcipher_register_instance(tmpl, inst);
440440 if (err) {
441441 err_free_inst:
442− free(inst);
442+ free_inst(inst);
443443 }
444444 return err;
445445 }
drivers/acpi/device_pm.c+2−2
@@ -273,13 +273,13 @@ int acpi_device_set_power(struct acpi_device *device, int state) · 272 unmodified lines
273273 end:
274274 if (result) {
275275 dev_warn(&device->dev, "Failed to change power state to %s\n",
276− acpi_power_state_string(state));
276+ acpi_power_state_string(target_state));
277277 } else {
278278 device->power.state = target_state;
279279 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
280280 "Device [%s] transitioned to %s\n",
281281 device->pnp.bus_id,
282− acpi_power_state_string(state)));
282+ acpi_power_state_string(target_state)));
283283 }
284284
285285 return result;
drivers/amba/bus.c+1−0
@@ -645,6 +645,7 @@ static void amba_device_initialize(struct amba_device *dev, const char *name) · 644 unmodified lines
645645 dev->dev.release = amba_device_release;
646646 dev->dev.bus = &amba_bustype;
647647 dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
648+ dev->dev.dma_parms = &dev->dma_parms;
648649 dev->res.name = dev_name(&dev->dev);
649650 }
650651
drivers/base/component.c+5−3
@@ -256,7 +256,8 @@ static int try_to_bring_up_master(struct master *master, · 255 unmodified lines
256256 ret = master->ops->bind(master->dev);
257257 if (ret < 0) {
258258 devres_release_group(master->dev, NULL);
259− dev_info(master->dev, "master bind failed: %d\n", ret);
259+ if (ret != -EPROBE_DEFER)
260+ dev_info(master->dev, "master bind failed: %d\n", ret);
260261 return ret;
261262 }
262263
@@ -611,8 +612,9 @@ static int component_bind(struct component *component, struct master *master, · 348 unmodified lines
611612 devres_release_group(component->dev, NULL);
612613 devres_release_group(master->dev, NULL);
613614
614− dev_err(master->dev, "failed to bind %s (ops %ps): %d\n",
615− dev_name(component->dev), component->ops, ret);
615+ if (ret != -EPROBE_DEFER)
616+ dev_err(master->dev, "failed to bind %s (ops %ps): %d\n",
617+ dev_name(component->dev), component->ops, ret);
616618 }
617619
618620 return ret;
drivers/base/core.c+6−1
@@ -2370,6 +2370,11 @@ u32 fw_devlink_get_flags(void) · 2369 unmodified lines
23702370 return fw_devlink_flags;
23712371 }
23722372
2373+static bool fw_devlink_is_permissive(void)
2374+{
2375+ return fw_devlink_flags == DL_FLAG_SYNC_STATE_ONLY;
2376+}
2377+
23732378 /**
23742379 * device_add - add device to device hierarchy.
23752380 * @dev: device.
@@ -2524,7 +2529,7 @@ int device_add(struct device *dev) · 148 unmodified lines
25242529 if (fw_devlink_flags && is_fwnode_dev &&
25252530 fwnode_has_op(dev->fwnode, add_links)) {
25262531 fw_ret = fwnode_call_int_op(dev->fwnode, add_links, dev);
2527− if (fw_ret == -ENODEV)
2532+ if (fw_ret == -ENODEV && !fw_devlink_is_permissive())
25282533 device_link_wait_for_mandatory_supplier(dev);
25292534 else if (fw_ret)
25302535 device_link_wait_for_optional_supplier(dev);
drivers/base/dd.c+8−12
@@ -224,17 +224,9 @@ static int deferred_devs_show(struct seq_file *s, void *data) · 223 unmodified lines
224224 }
225225 DEFINE_SHOW_ATTRIBUTE(deferred_devs);
226226
227−#ifdef CONFIG_MODULES
228−/*
229− * In the case of modules, set the default probe timeout to
230− * 30 seconds to give userland some time to load needed modules
231− */
232−int driver_deferred_probe_timeout = 30;
233−#else
234−/* In the case of !modules, no probe timeout needed */
235−int driver_deferred_probe_timeout = -1;
236−#endif
227+int driver_deferred_probe_timeout;
237228 EXPORT_SYMBOL_GPL(driver_deferred_probe_timeout);
229+static DECLARE_WAIT_QUEUE_HEAD(probe_timeout_waitqueue);
238230
239231 static int __init deferred_probe_timeout_setup(char *str)
240232 {
@@ -266,8 +258,8 @@ int driver_deferred_probe_check_state(struct device *dev) · 25 unmodified lines
266258 return -ENODEV;
267259 }
268260
269− if (!driver_deferred_probe_timeout) {
270− dev_WARN(dev, "deferred probe timeout, ignoring dependency\n");
261+ if (!driver_deferred_probe_timeout && initcalls_done) {
262+ dev_warn(dev, "deferred probe timeout, ignoring dependency\n");
271263 return -ETIMEDOUT;
272264 }
273265
@@ -284,6 +276,7 @@ static void deferred_probe_timeout_work_func(struct work_struct *work) · 10 unmodified lines
284276
285277 list_for_each_entry_safe(private, p, &deferred_probe_pending_list, deferred_probe)
286278 dev_info(private->device, "deferred probe pending\n");
279+ wake_up(&probe_timeout_waitqueue);
287280 }
288281 static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func);
289282
@@ -657,6 +650,9 @@ int driver_probe_done(void) · 367 unmodified lines
657650 */
658651 void wait_for_device_probe(void)
659652 {
653+ /* wait for probe timeout */
654+ wait_event(probe_timeout_waitqueue, !driver_deferred_probe_timeout);
655+
660656 /* wait for the deferred probe workqueue to finish */
661657 flush_work(&deferred_probe_work);
662658
drivers/base/platform.c+2−0
@@ -380,6 +380,8 @@ struct platform_object { · 379 unmodified lines
380380 */
381381 static void setup_pdev_dma_masks(struct platform_device *pdev)
382382 {
383+ pdev->dev.dma_parms = &pdev->dma_parms;
384+
383385 if (!pdev->dev.coherent_dma_mask)
384386 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
385387 if (!pdev->dev.dma_mask) {
drivers/block/virtio_blk.c+78−8
@@ -33,6 +33,15 @@ struct virtio_blk_vq { · 32 unmodified lines
3333 } ____cacheline_aligned_in_smp;
3434
3535 struct virtio_blk {
36+ /*
37+ * This mutex must be held by anything that may run after
38+ * virtblk_remove() sets vblk->vdev to NULL.
39+ *
40+ * blk-mq, virtqueue processing, and sysfs attribute code paths are
41+ * shut down before vblk->vdev is set to NULL and therefore do not need
42+ * to hold this mutex.
43+ */
44+ struct mutex vdev_mutex;
3645 struct virtio_device *vdev;
3746
3847 /* The disk structure for the kernel. */
@@ -44,6 +53,13 @@ struct virtio_blk { · 5 unmodified lines
4453 /* Process context for config space updates */
4554 struct work_struct config_work;
4655
56+ /*
57+ * Tracks references from block_device_operations open/release and
58+ * virtio_driver probe/remove so this object can be freed once no
59+ * longer in use.
60+ */
61+ refcount_t refs;
62+
4763 /* What host tells us, plus 2 for header & tailer. */
4864 unsigned int sg_elems;
4965
@@ -295,10 +311,55 @@ out: · 245 unmodified lines
295311 return err;
296312 }
297313
314+static void virtblk_get(struct virtio_blk *vblk)
315+{
316+ refcount_inc(&vblk->refs);
317+}
318+
319+static void virtblk_put(struct virtio_blk *vblk)
320+{
321+ if (refcount_dec_and_test(&vblk->refs)) {
322+ ida_simple_remove(&vd_index_ida, vblk->index);
323+ mutex_destroy(&vblk->vdev_mutex);
324+ kfree(vblk);
325+ }
326+}
327+
328+static int virtblk_open(struct block_device *bd, fmode_t mode)
329+{
330+ struct virtio_blk *vblk = bd->bd_disk->private_data;
331+ int ret = 0;
332+
333+ mutex_lock(&vblk->vdev_mutex);
334+
335+ if (vblk->vdev)
336+ virtblk_get(vblk);
337+ else
338+ ret = -ENXIO;
339+
340+ mutex_unlock(&vblk->vdev_mutex);
341+ return ret;
342+}
343+
344+static void virtblk_release(struct gendisk *disk, fmode_t mode)
345+{
346+ struct virtio_blk *vblk = disk->private_data;
347+
348+ virtblk_put(vblk);
349+}
350+
298351 /* We provide getgeo only to please some old bootloader/partitioning tools */
299352 static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo)
300353 {
301354 struct virtio_blk *vblk = bd->bd_disk->private_data;
355+ int ret = 0;
356+
357+ mutex_lock(&vblk->vdev_mutex);
358+
359+ if (!vblk->vdev) {
360+ ret = -ENXIO;
361+ goto out;
362+ }
302363
303364 /* see if the host passed in geometry config */
304365 if (virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_GEOMETRY)) {
@@ -314,11 +375,15 @@ static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo) · 9 unmodified lines
314375 geo->sectors = 1 << 5;
315376 geo->cylinders = get_capacity(bd->bd_disk) >> 11;
316377 }
317− return 0;
378+out:
379+ mutex_unlock(&vblk->vdev_mutex);
380+ return ret;
318381 }
319382
320383 static const struct block_device_operations virtblk_fops = {
321384 .owner = THIS_MODULE,
385+ .open = virtblk_open,
386+ .release = virtblk_release,
322387 .getgeo = virtblk_getgeo,
323388 };
324389
@@ -655,6 +720,10 @@ static int virtblk_probe(struct virtio_device *vdev) · 330 unmodified lines
655720 goto out_free_index;
656721 }
657722
723+ /* This reference is dropped in virtblk_remove(). */
724+ refcount_set(&vblk->refs, 1);
725+ mutex_init(&vblk->vdev_mutex);
726+
658727 vblk->vdev = vdev;
659728 vblk->sg_elems = sg_elems;
660729
@@ -820,8 +889,6 @@ out: · 159 unmodified lines
820889 static void virtblk_remove(struct virtio_device *vdev)
821890 {
822891 struct virtio_blk *vblk = vdev->priv;
823− int index = vblk->index;
824− int refc;
825892
826893 /* Make sure no work handler is accessing the device. */
827894 flush_work(&vblk->config_work);
@@ -831,18 +898,21 @@ static void virtblk_remove(struct virtio_device *vdev) · 3 unmodified lines
831898
832899 blk_mq_free_tag_set(&vblk->tag_set);
833900
901+ mutex_lock(&vblk->vdev_mutex);
902+
834903 /* Stop all the virtqueues. */
835904 vdev->config->reset(vdev);
836905
837− refc = kref_read(&disk_to_dev(vblk->disk)->kobj.kref);
906+ /* Virtqueues are stopped, nothing can use vblk->vdev anymore. */
907+ vblk->vdev = NULL;
908+
838909 put_disk(vblk->disk);
839910 vdev->config->del_vqs(vdev);
840911 kfree(vblk->vqs);
841− kfree(vblk);
842912
843− /* Only free device id if we don't have any users */
844− if (refc == 1)
845− ida_simple_remove(&vd_index_ida, index);
913+ mutex_unlock(&vblk->vdev_mutex);
914+
915+ virtblk_put(vblk);
846916 }
847917
848918 #ifdef CONFIG_PM_SLEEP
drivers/bus/mhi/core/init.c+3−4
@@ -812,10 +812,9 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, · 811 unmodified lines
812812 if (!mhi_cntrl)
813813 return -EINVAL;
814814
815− if (!mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put)
816− return -EINVAL;
817−
818− if (!mhi_cntrl->status_cb || !mhi_cntrl->link_status)
815+ if (!mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put ||
816+ !mhi_cntrl->status_cb || !mhi_cntrl->read_reg ||
817+ !mhi_cntrl->write_reg)
819818 return -EINVAL;
820819
821820 ret = parse_config(mhi_cntrl, config);
drivers/bus/mhi/core/internal.h+0−3
@@ -11,9 +11,6 @@ · 10 unmodified lines
1111
1212 extern struct bus_type mhi_bus_type;
1313
14−/* MHI MMIO register mapping */
15−#define PCI_INVALID_READ(val) (val == U32_MAX)
16−
1714 #define MHIREGLEN (0x0)
1815 #define MHIREGLEN_MHIREGLEN_MASK (0xFFFFFFFF)
1916 #define MHIREGLEN_MHIREGLEN_SHIFT (0)
drivers/bus/mhi/core/main.c+5−13
@@ -18,16 +18,7 @@ · 17 unmodified lines
1818 int __must_check mhi_read_reg(struct mhi_controller *mhi_cntrl,
1919 void __iomem *base, u32 offset, u32 *out)
2020 {
21− u32 tmp = readl(base + offset);
22−
23− /* If there is any unexpected value, query the link status */
24− if (PCI_INVALID_READ(tmp) &&
25− mhi_cntrl->link_status(mhi_cntrl))
26− return -EIO;
27−
28− *out = tmp;
29−
30− return 0;
21+ return mhi_cntrl->read_reg(mhi_cntrl, base + offset, out);
3122 }
3223
3324 int __must_check mhi_read_reg_field(struct mhi_controller *mhi_cntrl,
@@ -49,7 +40,7 @@ int __must_check mhi_read_reg_field(struct mhi_controller *mhi_cntrl, · 15 unmodified lines
4940 void mhi_write_reg(struct mhi_controller *mhi_cntrl, void __iomem *base,
5041 u32 offset, u32 val)
5142 {
52− writel(val, base + offset);
43+ mhi_cntrl->write_reg(mhi_cntrl, base + offset, val);
5344 }
5445
5546 void mhi_write_reg_field(struct mhi_controller *mhi_cntrl, void __iomem *base,
@@ -294,7 +285,7 @@ void mhi_create_devices(struct mhi_controller *mhi_cntrl) · 238 unmodified lines
294285 !(mhi_chan->ee_mask & BIT(mhi_cntrl->ee)))
295286 continue;
296287 mhi_dev = mhi_alloc_device(mhi_cntrl);
297− if (!mhi_dev)
288+ if (IS_ERR(mhi_dev))
298289 return;
299290
300291 mhi_dev->dev_type = MHI_DEVICE_XFER;
@@ -336,7 +327,8 @@ void mhi_create_devices(struct mhi_controller *mhi_cntrl) · 35 unmodified lines
336327
337328 /* Channel name is same for both UL and DL */
338329 mhi_dev->chan_name = mhi_chan->name;
339− dev_set_name(&mhi_dev->dev, "%04x_%s", mhi_chan->chan,
330+ dev_set_name(&mhi_dev->dev, "%s_%s",
331+ dev_name(mhi_cntrl->cntrl_dev),
340332 mhi_dev->chan_name);
341333
342334 /* Init wakeup source if available */
drivers/bus/mhi/core/pm.c+5−1
@@ -902,7 +902,11 @@ int mhi_sync_power_up(struct mhi_controller *mhi_cntrl) · 901 unmodified lines
902902 MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state),
903903 msecs_to_jiffies(mhi_cntrl->timeout_ms));
904904
905− return (MHI_IN_MISSION_MODE(mhi_cntrl->ee)) ? 0 : -EIO;
905+ ret = (MHI_IN_MISSION_MODE(mhi_cntrl->ee)) ? 0 : -ETIMEDOUT;
906+ if (ret)
907+ mhi_power_down(mhi_cntrl, false);
908+
909+ return ret;
906910 }
907911 EXPORT_SYMBOL(mhi_sync_power_up);
908912
drivers/cpufreq/intel_pstate.c+1−1
@@ -1059,7 +1059,7 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b, · 1058 unmodified lines
10591059
10601060 update_turbo_state();
10611061 if (global.turbo_disabled) {
1062− pr_warn("Turbo disabled by BIOS or unavailable on processor\n");
1062+ pr_notice_once("Turbo disabled by BIOS or unavailable on processor\n");
10631063 mutex_unlock(&intel_pstate_limits_lock);
10641064 mutex_unlock(&intel_pstate_driver_lock);
10651065 return -EPERM;
drivers/crypto/caam/caamalg.c+7−3
@@ -963,10 +963,12 @@ static void aead_crypt_done(struct device *jrdev, u32 *desc, u32 err, · 962 unmodified lines
963963 struct caam_drv_private_jr *jrp = dev_get_drvdata(jrdev);
964964 struct aead_edesc *edesc;
965965 int ecode = 0;
966+ bool has_bklog;
966967
967968 dev_dbg(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
968969
969970 edesc = rctx->edesc;
971+ has_bklog = edesc->bklog;
970972
971973 if (err)
972974 ecode = caam_jr_strstatus(jrdev, err);
@@ -979,7 +981,7 @@ static void aead_crypt_done(struct device *jrdev, u32 *desc, u32 err, · 6 unmodified lines
979981 * If no backlog flag, the completion of the request is done
980982 * by CAAM, not crypto engine.
981983 */
982− if (!edesc->bklog)
984+ if (!has_bklog)
983985 aead_request_complete(req, ecode);
984986 else
985987 crypto_finalize_aead_request(jrp->engine, req, ecode);
@@ -995,10 +997,12 @@ static void skcipher_crypt_done(struct device *jrdev, u32 *desc, u32 err, · 9 unmodified lines
995997 struct caam_drv_private_jr *jrp = dev_get_drvdata(jrdev);
996998 int ivsize = crypto_skcipher_ivsize(skcipher);
997999 int ecode = 0;
1000+ bool has_bklog;
9981001
9991002 dev_dbg(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
10001003
10011004 edesc = rctx->edesc;
1005+ has_bklog = edesc->bklog;
10021006 if (err)
10031007 ecode = caam_jr_strstatus(jrdev, err);
10041008
@@ -1028,7 +1032,7 @@ static void skcipher_crypt_done(struct device *jrdev, u32 *desc, u32 err, · 23 unmodified lines
10281032 * If no backlog flag, the completion of the request is done
10291033 * by CAAM, not crypto engine.
10301034 */
1031− if (!edesc->bklog)
1035+ if (!has_bklog)
10321036 skcipher_request_complete(req, ecode);
10331037 else
10341038 crypto_finalize_skcipher_request(jrp->engine, req, ecode);
@@ -1711,7 +1715,7 @@ static struct skcipher_edesc *skcipher_edesc_alloc(struct skcipher_request *req, · 676 unmodified lines
17111715
17121716 if (ivsize || mapped_dst_nents > 1)
17131717 sg_to_sec4_set_last(edesc->sec4_sg + dst_sg_idx +
1714− mapped_dst_nents);
1718+ mapped_dst_nents - 1 + !!ivsize);
17151719
17161720 if (sec4_sg_bytes) {
17171721 edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg,
drivers/crypto/caam/caamhash.c+6−2
@@ -583,10 +583,12 @@ static inline void ahash_done_cpy(struct device *jrdev, u32 *desc, u32 err, · 582 unmodified lines
583583 struct caam_hash_state *state = ahash_request_ctx(req);
584584 struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
585585 int ecode = 0;
586+ bool has_bklog;
586587
587588 dev_dbg(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
588589
589590 edesc = state->edesc;
591+ has_bklog = edesc->bklog;
590592
591593 if (err)
592594 ecode = caam_jr_strstatus(jrdev, err);
@@ -603,7 +605,7 @@ static inline void ahash_done_cpy(struct device *jrdev, u32 *desc, u32 err, · 10 unmodified lines
603605 * If no backlog flag, the completion of the request is done
604606 * by CAAM, not crypto engine.
605607 */
606− if (!edesc->bklog)
608+ if (!has_bklog)
607609 req->base.complete(&req->base, ecode);
608610 else
609611 crypto_finalize_hash_request(jrp->engine, req, ecode);
@@ -632,10 +634,12 @@ static inline void ahash_done_switch(struct device *jrdev, u32 *desc, u32 err, · 22 unmodified lines
632634 struct caam_hash_state *state = ahash_request_ctx(req);
633635 int digestsize = crypto_ahash_digestsize(ahash);
634636 int ecode = 0;
637+ bool has_bklog;
635638
636639 dev_dbg(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
637640
638641 edesc = state->edesc;
642+ has_bklog = edesc->bklog;
639643 if (err)
640644 ecode = caam_jr_strstatus(jrdev, err);
641645
@@ -663,7 +667,7 @@ static inline void ahash_done_switch(struct device *jrdev, u32 *desc, u32 err, · 21 unmodified lines
663667 * If no backlog flag, the completion of the request is done
664668 * by CAAM, not crypto engine.
665669 */
666− if (!edesc->bklog)
670+ if (!has_bklog)
667671 req->base.complete(&req->base, ecode);
668672 else
669673 crypto_finalize_hash_request(jrp->engine, req, ecode);
drivers/crypto/caam/caampkc.c+6−2
@@ -121,11 +121,13 @@ static void rsa_pub_done(struct device *dev, u32 *desc, u32 err, void *context) · 120 unmodified lines
121121 struct caam_drv_private_jr *jrp = dev_get_drvdata(dev);
122122 struct rsa_edesc *edesc;
123123 int ecode = 0;
124+ bool has_bklog;
124125
125126 if (err)
126127 ecode = caam_jr_strstatus(dev, err);
127128
128129 edesc = req_ctx->edesc;
130+ has_bklog = edesc->bklog;
129131
130132 rsa_pub_unmap(dev, edesc, req);
131133 rsa_io_unmap(dev, edesc, req);
@@ -135,7 +137,7 @@ static void rsa_pub_done(struct device *dev, u32 *desc, u32 err, void *context) · 3 unmodified lines
135137 * If no backlog flag, the completion of the request is done
136138 * by CAAM, not crypto engine.
137139 */
138− if (!edesc->bklog)
140+ if (!has_bklog)
139141 akcipher_request_complete(req, ecode);
140142 else
141143 crypto_finalize_akcipher_request(jrp->engine, req, ecode);
@@ -152,11 +154,13 @@ static void rsa_priv_f_done(struct device *dev, u32 *desc, u32 err, · 10 unmodified lines
152154 struct caam_rsa_req_ctx *req_ctx = akcipher_request_ctx(req);
153155 struct rsa_edesc *edesc;
154156 int ecode = 0;
157+ bool has_bklog;
155158
156159 if (err)
157160 ecode = caam_jr_strstatus(dev, err);
158161
159162 edesc = req_ctx->edesc;
163+ has_bklog = edesc->bklog;
160164
161165 switch (key->priv_form) {
162166 case FORM1:
@@ -176,7 +180,7 @@ static void rsa_priv_f_done(struct device *dev, u32 *desc, u32 err, · 13 unmodified lines
176180 * If no backlog flag, the completion of the request is done
177181 * by CAAM, not crypto engine.
178182 */
179− if (!edesc->bklog)
183+ if (!has_bklog)
180184 akcipher_request_complete(req, ecode);
181185 else
182186 crypto_finalize_akcipher_request(jrp->engine, req, ecode);
drivers/crypto/chelsio/chcr_ktls.c+46−37
@@ -673,41 +673,14 @@ int chcr_ktls_cpl_set_tcb_rpl(struct adapter *adap, unsigned char *input) · 672 unmodified lines
673673 return 0;
674674 }
675675
676−/*
677− * chcr_write_cpl_set_tcb_ulp: update tcb values.
678− * TCB is responsible to create tcp headers, so all the related values
679− * should be correctly updated.
680− * @tx_info - driver specific tls info.
681− * @q - tx queue on which packet is going out.
682− * @tid - TCB identifier.
683− * @pos - current index where should we start writing.
684− * @word - TCB word.
685− * @mask - TCB word related mask.
686− * @val - TCB word related value.
687− * @reply - set 1 if looking for TP response.
688− * return - next position to write.
689− */
690−static void *chcr_write_cpl_set_tcb_ulp(struct chcr_ktls_info *tx_info,
691− struct sge_eth_txq *q, u32 tid,
692− void *pos, u16 word, u64 mask,
676+static void *__chcr_write_cpl_set_tcb_ulp(struct chcr_ktls_info *tx_info,
677+ u32 tid, void *pos, u16 word, u64 mask,
693678 u64 val, u32 reply)
694679 {
695680 struct cpl_set_tcb_field_core *cpl;
696681 struct ulptx_idata *idata;
697682 struct ulp_txpkt *txpkt;
698− void *save_pos = NULL;
699− u8 buf[48] = {0};
700− int left;
701683
702− left = (void *)q->q.stat - pos;
703− if (unlikely(left < CHCR_SET_TCB_FIELD_LEN)) {
704− if (!left) {
705− pos = q->q.desc;
706− } else {
707− save_pos = pos;
708− pos = buf;
709− }
710− }
711684 /* ULP_TXPKT */
712685 txpkt = pos;
713686 txpkt->cmd_dest = htonl(ULPTX_CMD_V(ULP_TX_PKT) | ULP_TXPKT_DEST_V(0));
@@ -732,18 +705,54 @@ static void *chcr_write_cpl_set_tcb_ulp(struct chcr_ktls_info *tx_info, · 18 unmodified lines
732705 idata = (struct ulptx_idata *)(cpl + 1);
733706 idata->cmd_more = htonl(ULPTX_CMD_V(ULP_TX_SC_NOOP));
734707 idata->len = htonl(0);
708+ pos = idata + 1;
735709
736− if (save_pos) {
737− pos = chcr_copy_to_txd(buf, &q->q, save_pos,
738− CHCR_SET_TCB_FIELD_LEN);
739− } else {
740− /* check again if we are at the end of the queue */
741− if (left == CHCR_SET_TCB_FIELD_LEN)
710+ return pos;
711+}
712+
713+
714+/*
715+ * chcr_write_cpl_set_tcb_ulp: update tcb values.
716+ * TCB is responsible to create tcp headers, so all the related values
717+ * should be correctly updated.
718+ * @tx_info - driver specific tls info.
719+ * @q - tx queue on which packet is going out.
720+ * @tid - TCB identifier.
721+ * @pos - current index where should we start writing.
722+ * @word - TCB word.
723+ * @mask - TCB word related mask.
724+ * @val - TCB word related value.
725+ * @reply - set 1 if looking for TP response.
726+ * return - next position to write.
727+ */
728+static void *chcr_write_cpl_set_tcb_ulp(struct chcr_ktls_info *tx_info,
729+ struct sge_eth_txq *q, u32 tid,
730+ void *pos, u16 word, u64 mask,
731+ u64 val, u32 reply)
732+{
733+ int left = (void *)q->q.stat - pos;
734+
735+ if (unlikely(left < CHCR_SET_TCB_FIELD_LEN)) {
736+ if (!left) {
742737 pos = q->q.desc;
743− else
744− pos = idata + 1;
738+ } else {
739+ u8 buf[48] = {0};
740+
741+ __chcr_write_cpl_set_tcb_ulp(tx_info, tid, buf, word,
742+ mask, val, reply);
743+
744+ return chcr_copy_to_txd(buf, &q->q, pos,
745+ CHCR_SET_TCB_FIELD_LEN);
746+ }
745747 }
746748
749+ pos = __chcr_write_cpl_set_tcb_ulp(tx_info, tid, pos, word,
750+ mask, val, reply);
751+
752+ /* check again if we are at the end of the queue */
753+ if (left == CHCR_SET_TCB_FIELD_LEN)
754+ pos = q->q.desc;
755+
747756 return pos;
748757 }
749758
drivers/dma-buf/dma-buf.c+4−3
@@ -388,7 +388,8 @@ static long dma_buf_ioctl(struct file *file, · 387 unmodified lines
388388
389389 return ret;
390390
391− case DMA_BUF_SET_NAME:
391+ case DMA_BUF_SET_NAME_A:
392+ case DMA_BUF_SET_NAME_B:
392393 return dma_buf_set_name(dmabuf, (const char __user *)arg);
393394
394395 default:
@@ -655,8 +656,8 @@ EXPORT_SYMBOL_GPL(dma_buf_put); · 260 unmodified lines
655656 * calls attach() of dma_buf_ops to allow device-specific attach functionality
656657 * @dmabuf: [in] buffer to attach device to.
657658 * @dev: [in] device to be attached.
658− * @importer_ops [in] importer operations for the attachment
659− * @importer_priv [in] importer private pointer for the attachment
659+ * @importer_ops: [in] importer operations for the attachment
660+ * @importer_priv: [in] importer private pointer for the attachment
660661 *
661662 * Returns struct dma_buf_attachment pointer for this attachment. Attachments
662663 * must be cleaned up by calling dma_buf_detach().
drivers/dma/Kconfig+2−1
@@ -241,7 +241,8 @@ config FSL_RAID · 240 unmodified lines
241241
242242 config HISI_DMA
243243 tristate "HiSilicon DMA Engine support"
244− depends on ARM64 || (COMPILE_TEST && PCI_MSI)
244+ depends on ARM64 || COMPILE_TEST
245+ depends on PCI_MSI
245246 select DMA_ENGINE
246247 select DMA_VIRTUAL_CHANNELS
247248 help
drivers/dma/dmaengine.c+26−34
@@ -232,10 +232,6 @@ static void chan_dev_release(struct device *dev) · 231 unmodified lines
232232 struct dma_chan_dev *chan_dev;
233233
234234 chan_dev = container_of(dev, typeof(*chan_dev), device);
235− if (atomic_dec_and_test(chan_dev->idr_ref)) {
236− ida_free(&dma_ida, chan_dev->dev_id);
237− kfree(chan_dev->idr_ref);
238− }
239235 kfree(chan_dev);
240236 }
241237
@@ -1043,27 +1039,9 @@ static int get_dma_id(struct dma_device *device) · 801 unmodified lines
10431039 }
10441040
10451041 static int __dma_async_device_channel_register(struct dma_device *device,
1046− struct dma_chan *chan,
1047− int chan_id)
1042+ struct dma_chan *chan)
10481043 {
10491044 int rc = 0;
1050− int chancnt = device->chancnt;
1051− atomic_t *idr_ref;
1052− struct dma_chan *tchan;
1053−
1054− tchan = list_first_entry_or_null(&device->channels,
1055− struct dma_chan, device_node);
1056− if (!tchan)
1057− return -ENODEV;
1058−
1059− if (tchan->dev) {
1060− idr_ref = tchan->dev->idr_ref;
1061− } else {
1062− idr_ref = kmalloc(sizeof(*idr_ref), GFP_KERNEL);
1063− if (!idr_ref)
1064− return -ENOMEM;
1065− atomic_set(idr_ref, 0);
1066− }
10671045
10681046 chan->local = alloc_percpu(typeof(*chan->local));
10691047 if (!chan->local)
@@ -1079,29 +1057,36 @@ static int __dma_async_device_channel_register(struct dma_device *device, · 9 unmodified lines
10791057 * When the chan_id is a negative value, we are dynamically adding
10801058 * the channel. Otherwise we are static enumerating.
10811059 */
1082− chan->chan_id = chan_id < 0 ? chancnt : chan_id;
1060+ mutex_lock(&device->chan_mutex);
1061+ chan->chan_id = ida_alloc(&device->chan_ida, GFP_KERNEL);
1062+ mutex_unlock(&device->chan_mutex);
1063+ if (chan->chan_id < 0) {
1064+ pr_err("%s: unable to alloc ida for chan: %d\n",
1065+ __func__, chan->chan_id);
1066+ goto err_out;
1067+ }
1068+
10831069 chan->dev->device.class = &dma_devclass;
10841070 chan->dev->device.parent = device->dev;
10851071 chan->dev->chan = chan;
1086− chan->dev->idr_ref = idr_ref;
10871072 chan->dev->dev_id = device->dev_id;
1088− atomic_inc(idr_ref);
10891073 dev_set_name(&chan->dev->device, "dma%dchan%d",
10901074 device->dev_id, chan->chan_id);
1091−
10921075 rc = device_register(&chan->dev->device);
10931076 if (rc)
1094− goto err_out;
1077+ goto err_out_ida;
10951078 chan->client_count = 0;
1096− device->chancnt = chan->chan_id + 1;
1079+ device->chancnt++;
10971080
10981081 return 0;
10991082
1083+ err_out_ida:
1084+ mutex_lock(&device->chan_mutex);
1085+ ida_free(&device->chan_ida, chan->chan_id);
1086+ mutex_unlock(&device->chan_mutex);
11001087 err_out:
11011088 free_percpu(chan->local);
11021089 kfree(chan->dev);
1103− if (atomic_dec_return(idr_ref) == 0)
1104− kfree(idr_ref);
11051090 return rc;
11061091 }
11071092
@@ -1110,7 +1095,7 @@ int dma_async_device_channel_register(struct dma_device *device, · 2 unmodified lines
11101095 {
11111096 int rc;
11121097
1113− rc = __dma_async_device_channel_register(device, chan, -1);
1098+ rc = __dma_async_device_channel_register(device, chan);
11141099 if (rc < 0)
11151100 return rc;
11161101
@@ -1130,6 +1115,9 @@ static void __dma_async_device_channel_unregister(struct dma_device *device, · 13 unmodified lines
11301115 device->chancnt--;
11311116 chan->dev->chan = NULL;
11321117 mutex_unlock(&dma_list_mutex);
1118+ mutex_lock(&device->chan_mutex);
1119+ ida_free(&device->chan_ida, chan->chan_id);
1120+ mutex_unlock(&device->chan_mutex);
11331121 device_unregister(&chan->dev->device);
11341122 free_percpu(chan->local);
11351123 }
@@ -1152,7 +1140,7 @@ EXPORT_SYMBOL_GPL(dma_async_device_channel_unregister); · 16 unmodified lines
11521140 */
11531141 int dma_async_device_register(struct dma_device *device)
11541142 {
1155− int rc, i = 0;
1143+ int rc;
11561144 struct dma_chan* chan;
11571145
11581146 if (!device)
@@ -1257,9 +1245,12 @@ int dma_async_device_register(struct dma_device *device) · 98 unmodified lines
12571245 if (rc != 0)
12581246 return rc;
12591247
1248+ mutex_init(&device->chan_mutex);
1249+ ida_init(&device->chan_ida);
1250+
12601251 /* represent channels in sysfs. Probably want devs too */
12611252 list_for_each_entry(chan, &device->channels, device_node) {
1262− rc = __dma_async_device_channel_register(device, chan, i++);
1253+ rc = __dma_async_device_channel_register(device, chan);
12631254 if (rc < 0)
12641255 goto err_out;
12651256 }
@@ -1334,6 +1325,7 @@ void dma_async_device_unregister(struct dma_device *device) · 68 unmodified lines
13341325 */
13351326 dma_cap_set(DMA_PRIVATE, device->cap_mask);
13361327 dma_channel_rebalance();
1328+ ida_free(&dma_ida, device->dev_id);
13371329 dma_device_put(device);
13381330 mutex_unlock(&dma_list_mutex);
13391331 }
drivers/dma/dmatest.c+3−3
@@ -240,7 +240,7 @@ static bool is_threaded_test_run(struct dmatest_info *info) · 239 unmodified lines
240240 struct dmatest_thread *thread;
241241
242242 list_for_each_entry(thread, &dtc->threads, node) {
243− if (!thread->done)
243+ if (!thread->done && !thread->pending)
244244 return true;
245245 }
246246 }
@@ -662,8 +662,8 @@ static int dmatest_func(void *data) · 415 unmodified lines
662662 flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
663663
664664 ktime = ktime_get();
665− while (!kthread_should_stop()
666− && !(params->iterations && total_tests >= params->iterations)) {
665+ while (!(kthread_should_stop() ||
666+ (params->iterations && total_tests >= params->iterations))) {
667667 struct dma_async_tx_descriptor *tx = NULL;
668668 struct dmaengine_unmap_data *um;
669669 dma_addr_t *dsts;
drivers/dma/mmp_tdma.c+4−1
@@ -363,6 +363,8 @@ static void mmp_tdma_free_descriptor(struct mmp_tdma_chan *tdmac) · 362 unmodified lines
363363 gen_pool_free(gpool, (unsigned long)tdmac->desc_arr,
364364 size);
365365 tdmac->desc_arr = NULL;
366+ if (tdmac->status == DMA_ERROR)
367+ tdmac->status = DMA_COMPLETE;
366368
367369 return;
368370 }
@@ -443,7 +445,8 @@ static struct dma_async_tx_descriptor *mmp_tdma_prep_dma_cyclic( · 74 unmodified lines
443445 if (!desc)
444446 goto err_out;
445447
446− mmp_tdma_config_write(chan, direction, &tdmac->slave_config);
448+ if (mmp_tdma_config_write(chan, direction, &tdmac->slave_config))
449+ goto err_out;
447450
448451 while (buf < buf_len) {
449452 desc = &tdmac->desc_arr[i];
drivers/dma/pch_dma.c+1−1
@@ -865,6 +865,7 @@ static int pch_dma_probe(struct pci_dev *pdev, · 864 unmodified lines
865865 }
866866
867867 pci_set_master(pdev);
868+ pd->dma.dev = &pdev->dev;
868869
869870 err = request_irq(pdev->irq, pd_irq, IRQF_SHARED, DRV_NAME, pd);
870871 if (err) {
@@ -880,7 +881,6 @@ static int pch_dma_probe(struct pci_dev *pdev, · 9 unmodified lines
880881 goto err_free_irq;
881882 }
882883
883− pd->dma.dev = &pdev->dev;
884884
885885 INIT_LIST_HEAD(&pd->dma.channels);
886886
drivers/dma/tegra20-apb-dma.c+9−0
@@ -816,6 +816,13 @@ static bool tegra_dma_eoc_interrupt_deasserted(struct tegra_dma_channel *tdc) · 815 unmodified lines
816816 static void tegra_dma_synchronize(struct dma_chan *dc)
817817 {
818818 struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc);
819+ int err;
820+
821+ err = pm_runtime_get_sync(tdc->tdma->dev);
822+ if (err < 0) {
823+ dev_err(tdc2dev(tdc), "Failed to synchronize DMA: %d\n", err);
824+ return;
825+ }
819826
820827 /*
821828 * CPU, which handles interrupt, could be busy in
@@ -825,6 +832,8 @@ static void tegra_dma_synchronize(struct dma_chan *dc) · 3 unmodified lines
825832 wait_event(tdc->wq, tegra_dma_eoc_interrupt_deasserted(tdc));
826833
827834 tasklet_kill(&tdc->tasklet);
835+
836+ pm_runtime_put(tdc->tdma->dev);
828837 }
829838
830839 static unsigned int tegra_dma_sg_bytes_xferred(struct tegra_dma_channel *tdc,
drivers/dma/ti/k3-psil.c+1−0
@@ -27,6 +27,7 @@ struct psil_endpoint_config *psil_get_ep_config(u32 thread_id) · 26 unmodified lines
2727 soc_ep_map = &j721e_ep_map;
2828 } else {
2929 pr_err("PSIL: No compatible machine found for map\n");
30+ mutex_unlock(&ep_map_mutex);
3031 return ERR_PTR(-ENOTSUPP);
3132 }
3233 pr_debug("%s: Using map for %s\n", __func__, soc_ep_map->name);
drivers/dma/xilinx/xilinx_dma.c+10−10
@@ -1230,16 +1230,16 @@ static enum dma_status xilinx_dma_tx_status(struct dma_chan *dchan, · 1229 unmodified lines
12301230 return ret;
12311231
12321232 spin_lock_irqsave(&chan->lock, flags);
1233−
1234− desc = list_last_entry(&chan->active_list,
1235− struct xilinx_dma_tx_descriptor, node);
1236− /*
1237− * VDMA and simple mode do not support residue reporting, so the
1238− * residue field will always be 0.
1239− */
1240− if (chan->has_sg && chan->xdev->dma_config->dmatype != XDMA_TYPE_VDMA)
1241− residue = xilinx_dma_get_residue(chan, desc);
1242−
1233+ if (!list_empty(&chan->active_list)) {
1234+ desc = list_last_entry(&chan->active_list,
1235+ struct xilinx_dma_tx_descriptor, node);
1236+ /*
1237+ * VDMA and simple mode do not support residue reporting, so the
1238+ * residue field will always be 0.
1239+ */
1240+ if (chan->has_sg && chan->xdev->dma_config->dmatype != XDMA_TYPE_VDMA)
1241+ residue = xilinx_dma_get_residue(chan, desc);
1242+ }
12431243 spin_unlock_irqrestore(&chan->lock, flags);
12441244
12451245 dma_set_residue(txstate, residue);
drivers/firmware/efi/tpm.c+1−1
@@ -16,7 +16,7 @@ · 15 unmodified lines
1616 int efi_tpm_final_log_size;
1717 EXPORT_SYMBOL(efi_tpm_final_log_size);
1818
19−static int tpm2_calc_event_log_size(void *data, int count, void *size_info)
19+static int __init tpm2_calc_event_log_size(void *data, int count, void *size_info)
2020 {
2121 struct tcg_pcr_event2_head *header;
2222 int event_size, size = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+2−5
@@ -3372,15 +3372,12 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon) · 3371 unmodified lines
33723372 }
33733373 }
33743374
3375− amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
3376− amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
3377−
3378− amdgpu_amdkfd_suspend(adev, !fbcon);
3379−
33803375 amdgpu_ras_suspend(adev);
33813376
33823377 r = amdgpu_device_ip_suspend_phase1(adev);
33833378
3379+ amdgpu_amdkfd_suspend(adev, !fbcon);
3380+
33843381 /* evict vram memory */
33853382 amdgpu_bo_evict_vram(adev);
33863383
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+2−1
@@ -85,9 +85,10 @@ · 84 unmodified lines
8585 * - 3.34.0 - Non-DC can flip correctly between buffers with different pitches
8686 * - 3.35.0 - Add drm_amdgpu_info_device::tcc_disabled_mask
8787 * - 3.36.0 - Allow reading more status registers on si/cik
88+ * - 3.37.0 - L2 is invalidated before SDMA IBs, needed for correctness
8889 */
8990 #define KMS_DRIVER_MAJOR 3
90−#define KMS_DRIVER_MINOR 36
91+#define KMS_DRIVER_MINOR 37
9192 #define KMS_DRIVER_PATCHLEVEL 0
9293
9394 int amdgpu_vram_limit = 0;
drivers/gpu/drm/amd/amdgpu/navi10_sdma_pkt_open.h+16−0
@@ -73,6 +73,22 @@ · 72 unmodified lines
7373 #define SDMA_OP_AQL_COPY 0
7474 #define SDMA_OP_AQL_BARRIER_OR 0
7575
76+#define SDMA_GCR_RANGE_IS_PA (1 << 18)
77+#define SDMA_GCR_SEQ(x) (((x) & 0x3) << 16)
78+#define SDMA_GCR_GL2_WB (1 << 15)
79+#define SDMA_GCR_GL2_INV (1 << 14)
80+#define SDMA_GCR_GL2_DISCARD (1 << 13)
81+#define SDMA_GCR_GL2_RANGE(x) (((x) & 0x3) << 11)
82+#define SDMA_GCR_GL2_US (1 << 10)
83+#define SDMA_GCR_GL1_INV (1 << 9)
84+#define SDMA_GCR_GLV_INV (1 << 8)
85+#define SDMA_GCR_GLK_INV (1 << 7)
86+#define SDMA_GCR_GLK_WB (1 << 6)
87+#define SDMA_GCR_GLM_INV (1 << 5)
88+#define SDMA_GCR_GLM_WB (1 << 4)
89+#define SDMA_GCR_GL1_RANGE(x) (((x) & 0x3) << 2)
90+#define SDMA_GCR_GLI_INV(x) (((x) & 0x3) << 0)
91+
7692 /*define for op field*/
7793 #define SDMA_PKT_HEADER_op_offset 0
7894 #define SDMA_PKT_HEADER_op_mask 0x000000FF
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c+13−1
@@ -382,6 +382,18 @@ static void sdma_v5_0_ring_emit_ib(struct amdgpu_ring *ring, · 381 unmodified lines
382382 unsigned vmid = AMDGPU_JOB_GET_VMID(job);
383383 uint64_t csa_mc_addr = amdgpu_sdma_get_csa_mc_addr(ring, vmid);
384384
385+ /* Invalidate L2, because if we don't do it, we might get stale cache
386+ * lines from previous IBs.
387+ */
388+ amdgpu_ring_write(ring, SDMA_PKT_HEADER_OP(SDMA_OP_GCR_REQ));
389+ amdgpu_ring_write(ring, 0);
390+ amdgpu_ring_write(ring, (SDMA_GCR_GL2_INV |
391+ SDMA_GCR_GL2_WB |
392+ SDMA_GCR_GLM_INV |
393+ SDMA_GCR_GLM_WB) << 16);
394+ amdgpu_ring_write(ring, 0xffffff80);
395+ amdgpu_ring_write(ring, 0xffff);
396+
385397 /* An IB packet must end on a 8 DW boundary--the next dword
386398 * must be on a 8-dword boundary. Our IB packet below is 6
387399 * dwords long, thus add x number of NOPs, such that, in
@@ -1595,7 +1607,7 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = { · 1207 unmodified lines
15951607 SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
15961608 SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 * 2 +
15971609 10 + 10 + 10, /* sdma_v5_0_ring_emit_fence x3 for user fence, vm fence */
1598− .emit_ib_size = 7 + 6, /* sdma_v5_0_ring_emit_ib */
1610+ .emit_ib_size = 5 + 7 + 6, /* sdma_v5_0_ring_emit_ib */
15991611 .emit_ib = sdma_v5_0_ring_emit_ib,
16001612 .emit_fence = sdma_v5_0_ring_emit_fence,
16011613 .emit_pipeline_sync = sdma_v5_0_ring_emit_pipeline_sync,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+40−15
@@ -2008,17 +2008,22 @@ void amdgpu_dm_update_connector_after_detect( · 2007 unmodified lines
20082008 dc_sink_retain(aconnector->dc_sink);
20092009 if (sink->dc_edid.length == 0) {
20102010 aconnector->edid = NULL;
2011− drm_dp_cec_unset_edid(&aconnector->dm_dp_aux.aux);
2011+ if (aconnector->dc_link->aux_mode) {
2012+ drm_dp_cec_unset_edid(
2013+ &aconnector->dm_dp_aux.aux);
2014+ }
20122015 } else {
20132016 aconnector->edid =
2014− (struct edid *) sink->dc_edid.raw_edid;
2015−
2017+ (struct edid *)sink->dc_edid.raw_edid;
20162018
20172019 drm_connector_update_edid_property(connector,
2018− aconnector->edid);
2019− drm_dp_cec_set_edid(&aconnector->dm_dp_aux.aux,
2020− aconnector->edid);
2020+ aconnector->edid);
2021+
2022+ if (aconnector->dc_link->aux_mode)
2023+ drm_dp_cec_set_edid(&aconnector->dm_dp_aux.aux,
2024+ aconnector->edid);
20212025 }
2026+
20222027 amdgpu_dm_update_freesync_caps(connector, aconnector->edid);
20232028 update_connector_ext_caps(aconnector);
20242029 } else {
@@ -3340,7 +3345,8 @@ fill_plane_dcc_attributes(struct amdgpu_device *adev, · 1315 unmodified lines
33403345 const union dc_tiling_info *tiling_info,
33413346 const uint64_t info,
33423347 struct dc_plane_dcc_param *dcc,
3343− struct dc_plane_address *address)
3348+ struct dc_plane_address *address,
3349+ bool force_disable_dcc)
33443350 {
33453351 struct dc *dc = adev->dm.dc;
33463352 struct dc_dcc_surface_param input;
@@ -3352,6 +3358,9 @@ fill_plane_dcc_attributes(struct amdgpu_device *adev, · 5 unmodified lines
33523358 memset(&input, 0, sizeof(input));
33533359 memset(&output, 0, sizeof(output));
33543360
3361+ if (force_disable_dcc)
3362+ return 0;
3363+
33553364 if (!offset)
33563365 return 0;
33573366
@@ -3401,7 +3410,8 @@ fill_plane_buffer_attributes(struct amdgpu_device *adev, · 43 unmodified lines
34013410 union dc_tiling_info *tiling_info,
34023411 struct plane_size *plane_size,
34033412 struct dc_plane_dcc_param *dcc,
3404− struct dc_plane_address *address)
3413+ struct dc_plane_address *address,
3414+ bool force_disable_dcc)
34053415 {
34063416 const struct drm_framebuffer *fb = &afb->base;
34073417 int ret;
@@ -3507,7 +3517,8 @@ fill_plane_buffer_attributes(struct amdgpu_device *adev, · 99 unmodified lines
35073517
35083518 ret = fill_plane_dcc_attributes(adev, afb, format, rotation,
35093519 plane_size, tiling_info,
3510− tiling_flags, dcc, address);
3520+ tiling_flags, dcc, address,
3521+ force_disable_dcc);
35113522 if (ret)
35123523 return ret;
35133524 }
@@ -3599,7 +3610,8 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev, · 85 unmodified lines
35993610 const struct drm_plane_state *plane_state,
36003611 const uint64_t tiling_flags,
36013612 struct dc_plane_info *plane_info,
3602− struct dc_plane_address *address)
3613+ struct dc_plane_address *address,
3614+ bool force_disable_dcc)
36033615 {
36043616 const struct drm_framebuffer *fb = plane_state->fb;
36053617 const struct amdgpu_framebuffer *afb =
@@ -3681,7 +3693,8 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev, · 75 unmodified lines
36813693 plane_info->rotation, tiling_flags,
36823694 &plane_info->tiling_info,
36833695 &plane_info->plane_size,
3684− &plane_info->dcc, address);
3696+ &plane_info->dcc, address,
3697+ force_disable_dcc);
36853698 if (ret)
36863699 return ret;
36873700
@@ -3704,6 +3717,7 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev, · 16 unmodified lines
37043717 struct dc_plane_info plane_info;
37053718 uint64_t tiling_flags;
37063719 int ret;
3720+ bool force_disable_dcc = false;
37073721
37083722 ret = fill_dc_scaling_info(plane_state, &scaling_info);
37093723 if (ret)
@@ -3718,9 +3732,11 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev, · 8 unmodified lines
37183732 if (ret)
37193733 return ret;
37203734
3735+ force_disable_dcc = adev->asic_type == CHIP_RAVEN && adev->in_suspend;
37213736 ret = fill_dc_plane_info_and_addr(adev, plane_state, tiling_flags,
37223737 &plane_info,
3723− &dc_plane_state->address);
3738+ &dc_plane_state->address,
3739+ force_disable_dcc);
37243740 if (ret)
37253741 return ret;
37263742
@@ -5342,6 +5358,7 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane, · 1615 unmodified lines
53425358 uint64_t tiling_flags;
53435359 uint32_t domain;
53445360 int r;
5361+ bool force_disable_dcc = false;
53455362
53465363 dm_plane_state_old = to_dm_plane_state(plane->state);
53475364 dm_plane_state_new = to_dm_plane_state(new_state);
@@ -5400,11 +5417,13 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane, · 52 unmodified lines
54005417 dm_plane_state_old->dc_state != dm_plane_state_new->dc_state) {
54015418 struct dc_plane_state *plane_state = dm_plane_state_new->dc_state;
54025419
5420+ force_disable_dcc = adev->asic_type == CHIP_RAVEN && adev->in_suspend;
54035421 fill_plane_buffer_attributes(
54045422 adev, afb, plane_state->format, plane_state->rotation,
54055423 tiling_flags, &plane_state->tiling_info,
54065424 &plane_state->plane_size, &plane_state->dcc,
5407− &plane_state->address);
5425+ &plane_state->address,
5426+ force_disable_dcc);
54085427 }
54095428
54105429 return 0;
@@ -6676,7 +6695,12 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · 1265 unmodified lines
66766695 fill_dc_plane_info_and_addr(
66776696 dm->adev, new_plane_state, tiling_flags,
66786697 &bundle->plane_infos[planes_count],
6679− &bundle->flip_addrs[planes_count].address);
6698+ &bundle->flip_addrs[planes_count].address,
6699+ false);
6700+
6701+ DRM_DEBUG_DRIVER("plane: id=%d dcc_en=%d\n",
6702+ new_plane_state->plane->index,
6703+ bundle->plane_infos[planes_count].dcc.enable);
66806704
66816705 bundle->surface_updates[planes_count].plane_info =
66826706 &bundle->plane_infos[planes_count];
@@ -8096,7 +8120,8 @@ dm_determine_update_type_for_commit(struct amdgpu_display_manager *dm, · 1413 unmodified lines
80968120 ret = fill_dc_plane_info_and_addr(
80978121 dm->adev, new_plane_state, tiling_flags,
80988122 plane_info,
8099− &flip_addr->address);
8123+ &flip_addr->address,
8124+ false);
81008125 if (ret)
81018126 goto cleanup;
81028127
drivers/gpu/drm/amd/display/dc/core/dc.c+2−3
@@ -834,11 +834,10 @@ static void disable_dangling_plane(struct dc *dc, struct dc_state *context) · 833 unmodified lines
834834 static void wait_for_no_pipes_pending(struct dc *dc, struct dc_state *context)
835835 {
836836 int i;
837− int count = 0;
838− struct pipe_ctx *pipe;
839837 PERF_TRACE();
840838 for (i = 0; i < MAX_PIPES; i++) {
841− pipe = &context->res_ctx.pipe_ctx[i];
839+ int count = 0;
840+ struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
842841
843842 if (!pipe->plane_state)
844843 continue;
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c+27−0
@@ -2908,6 +2908,12 @@ bool dc_link_handle_hpd_rx_irq(struct dc_link *link, union hpd_irq_data *out_hpd · 2907 unmodified lines
29082908 sizeof(hpd_irq_dpcd_data),
29092909 "Status: ");
29102910
2911+ for (i = 0; i < MAX_PIPES; i++) {
2912+ pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i];
2913+ if (pipe_ctx && pipe_ctx->stream && pipe_ctx->stream->link == link)
2914+ link->dc->hwss.blank_stream(pipe_ctx);
2915+ }
2916+
29112917 for (i = 0; i < MAX_PIPES; i++) {
29122918 pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i];
29132919 if (pipe_ctx && pipe_ctx->stream && pipe_ctx->stream->link == link)
@@ -2927,6 +2933,12 @@ bool dc_link_handle_hpd_rx_irq(struct dc_link *link, union hpd_irq_data *out_hpd · 13 unmodified lines
29272933 if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
29282934 dc_link_reallocate_mst_payload(link);
29292935
2936+ for (i = 0; i < MAX_PIPES; i++) {
2937+ pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i];
2938+ if (pipe_ctx && pipe_ctx->stream && pipe_ctx->stream->link == link)
2939+ link->dc->hwss.unblank_stream(pipe_ctx, &previous_link_settings);
2940+ }
2941+
29302942 status = false;
29312943 if (out_link_loss)
29322944 *out_link_loss = true;
@@ -4227,6 +4239,21 @@ void dp_set_fec_enable(struct dc_link *link, bool enable) · 1294 unmodified lines
42274239 void dpcd_set_source_specific_data(struct dc_link *link)
42284240 {
42294241 const uint32_t post_oui_delay = 30; // 30ms
4242+ uint8_t dspc = 0;
4243+ enum dc_status ret = DC_ERROR_UNEXPECTED;
4244+
4245+ ret = core_link_read_dpcd(link, DP_DOWN_STREAM_PORT_COUNT, &dspc,
4246+ sizeof(dspc));
4247+
4248+ if (ret != DC_OK) {
4249+ DC_LOG_ERROR("Error in DP aux read transaction,"
4250+ " not writing source specific data\n");
4251+ return;
4252+ }
4253+
4254+ /* Return if OUI unsupported */
4255+ if (!(dspc & DP_OUI_SUPPORT))
4256+ return;
42304257
42314258 if (!link->dc->vendor_signature.is_valid) {
42324259 struct dpcd_amd_signature amd_signature;
drivers/gpu/drm/amd/display/dc/core/dc_stream.c+4−36
@@ -231,34 +231,6 @@ struct dc_stream_status *dc_stream_get_status( · 230 unmodified lines
231231 return dc_stream_get_status_from_state(dc->current_state, stream);
232232 }
233233
234−static void delay_cursor_until_vupdate(struct pipe_ctx *pipe_ctx, struct dc *dc)
235−{
236−#if defined(CONFIG_DRM_AMD_DC_DCN)
237− unsigned int vupdate_line;
238− unsigned int lines_to_vupdate, us_to_vupdate, vpos, nvpos;
239− struct dc_stream_state *stream = pipe_ctx->stream;
240− unsigned int us_per_line;
241−
242− if (stream->ctx->asic_id.chip_family == FAMILY_RV &&
243− ASICREV_IS_RAVEN(stream->ctx->asic_id.hw_internal_rev)) {
244−
245− vupdate_line = dc->hwss.get_vupdate_offset_from_vsync(pipe_ctx);
246− if (!dc_stream_get_crtc_position(dc, &stream, 1, &vpos, &nvpos))
247− return;
248−
249− if (vpos >= vupdate_line)
250− return;
251−
252− us_per_line = stream->timing.h_total * 10000 / stream->timing.pix_clk_100hz;
253− lines_to_vupdate = vupdate_line - vpos;
254− us_to_vupdate = lines_to_vupdate * us_per_line;
255−
256− /* 70 us is a conservative estimate of cursor update time*/
257− if (us_to_vupdate < 70)
258− udelay(us_to_vupdate);
259− }
260−#endif
261−}
262234
263235 /**
264236 * dc_stream_set_cursor_attributes() - Update cursor attributes and set cursor surface address
@@ -298,9 +270,7 @@ bool dc_stream_set_cursor_attributes( · 33 unmodified lines
298270
299271 if (!pipe_to_program) {
300272 pipe_to_program = pipe_ctx;
301−
302− delay_cursor_until_vupdate(pipe_ctx, dc);
303− dc->hwss.pipe_control_lock(dc, pipe_to_program, true);
273+ dc->hwss.cursor_lock(dc, pipe_to_program, true);
304274 }
305275
306276 dc->hwss.set_cursor_attribute(pipe_ctx);
@@ -309,7 +279,7 @@ bool dc_stream_set_cursor_attributes( · 2 unmodified lines
309279 }
310280
311281 if (pipe_to_program)
312− dc->hwss.pipe_control_lock(dc, pipe_to_program, false);
282+ dc->hwss.cursor_lock(dc, pipe_to_program, false);
313283
314284 return true;
315285 }
@@ -349,16 +319,14 @@ bool dc_stream_set_cursor_position( · 33 unmodified lines
349319
350320 if (!pipe_to_program) {
351321 pipe_to_program = pipe_ctx;
352−
353− delay_cursor_until_vupdate(pipe_ctx, dc);
354− dc->hwss.pipe_control_lock(dc, pipe_to_program, true);
322+ dc->hwss.cursor_lock(dc, pipe_to_program, true);
355323 }
356324
357325 dc->hwss.set_cursor_position(pipe_ctx);
358326 }
359327
360328 if (pipe_to_program)
361− dc->hwss.pipe_control_lock(dc, pipe_to_program, false);
329+ dc->hwss.cursor_lock(dc, pipe_to_program, false);
362330
363331 return true;
364332 }
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c+1−0
@@ -2757,6 +2757,7 @@ static const struct hw_sequencer_funcs dce110_funcs = { · 2756 unmodified lines
27572757 .disable_plane = dce110_power_down_fe,
27582758 .pipe_control_lock = dce_pipe_control_lock,
27592759 .interdependent_update_lock = NULL,
2760+ .cursor_lock = dce_pipe_control_lock,
27602761 .prepare_bandwidth = dce110_prepare_bandwidth,
27612762 .optimize_bandwidth = dce110_optimize_bandwidth,
27622763 .set_drr = set_drr,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c+10−0
@@ -1625,6 +1625,16 @@ void dcn10_pipe_control_lock( · 1624 unmodified lines
16251625 hws->funcs.verify_allow_pstate_change_high(dc);
16261626 }
16271627
1628+void dcn10_cursor_lock(struct dc *dc, struct pipe_ctx *pipe, bool lock)
1629+{
1630+ /* cursor lock is per MPCC tree, so only need to lock one pipe per stream */
1631+ if (!pipe || pipe->top_pipe)
1632+ return;
1633+
1634+ dc->res_pool->mpc->funcs->cursor_lock(dc->res_pool->mpc,
1635+ pipe->stream_res.opp->inst, lock);
1636+}
1637+
16281638 static bool wait_for_reset_trigger_to_occur(
16291639 struct dc_context *dc_ctx,
16301640 struct timing_generator *tg)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h+1−0
@@ -49,6 +49,7 @@ void dcn10_pipe_control_lock( · 48 unmodified lines
4949 struct dc *dc,
5050 struct pipe_ctx *pipe,
5151 bool lock);
52+void dcn10_cursor_lock(struct dc *dc, struct pipe_ctx *pipe, bool lock);
5253 void dcn10_blank_pixel_data(
5354 struct dc *dc,
5455 struct pipe_ctx *pipe_ctx,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_init.c+1−0
@@ -50,6 +50,7 @@ static const struct hw_sequencer_funcs dcn10_funcs = { · 49 unmodified lines
5050 .disable_audio_stream = dce110_disable_audio_stream,
5151 .disable_plane = dcn10_disable_plane,
5252 .pipe_control_lock = dcn10_pipe_control_lock,
53+ .cursor_lock = dcn10_cursor_lock,
5354 .interdependent_update_lock = dcn10_lock_all_pipes,
5455 .prepare_bandwidth = dcn10_prepare_bandwidth,
5556 .optimize_bandwidth = dcn10_optimize_bandwidth,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c+15−0
@@ -223,6 +223,9 @@ struct mpcc *mpc1_insert_plane( · 222 unmodified lines
223223 REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, dpp_id);
224224 REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, tree->opp_id);
225225
226+ /* Configure VUPDATE lock set for this MPCC to map to the OPP */
227+ REG_SET(MPCC_UPDATE_LOCK_SEL[mpcc_id], 0, MPCC_UPDATE_LOCK_SEL, tree->opp_id);
228+
226229 /* update mpc tree mux setting */
227230 if (tree->opp_list == insert_above_mpcc) {
228231 /* insert the toppest mpcc */
@@ -318,6 +321,7 @@ void mpc1_remove_mpcc( · 89 unmodified lines
318321 REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, 0xf);
319322 REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, 0xf);
320323 REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, 0xf);
324+ REG_SET(MPCC_UPDATE_LOCK_SEL[mpcc_id], 0, MPCC_UPDATE_LOCK_SEL, 0xf);
321325
322326 /* mark this mpcc as not in use */
323327 mpc10->mpcc_in_use_mask &= ~(1 << mpcc_id);
@@ -328,6 +332,7 @@ void mpc1_remove_mpcc( · 4 unmodified lines
328332 REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, 0xf);
329333 REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, 0xf);
330334 REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, 0xf);
335+ REG_SET(MPCC_UPDATE_LOCK_SEL[mpcc_id], 0, MPCC_UPDATE_LOCK_SEL, 0xf);
331336 }
332337 }
333338
@@ -361,6 +366,7 @@ void mpc1_mpc_init(struct mpc *mpc) · 27 unmodified lines
361366 REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, 0xf);
362367 REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, 0xf);
363368 REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, 0xf);
369+ REG_SET(MPCC_UPDATE_LOCK_SEL[mpcc_id], 0, MPCC_UPDATE_LOCK_SEL, 0xf);
364370
365371 mpc1_init_mpcc(&(mpc->mpcc_array[mpcc_id]), mpcc_id);
366372 }
@@ -381,6 +387,7 @@ void mpc1_mpc_init_single_inst(struct mpc *mpc, unsigned int mpcc_id) · 14 unmodified lines
381387 REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, 0xf);
382388 REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, 0xf);
383389 REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, 0xf);
390+ REG_SET(MPCC_UPDATE_LOCK_SEL[mpcc_id], 0, MPCC_UPDATE_LOCK_SEL, 0xf);
384391
385392 mpc1_init_mpcc(&(mpc->mpcc_array[mpcc_id]), mpcc_id);
386393
@@ -453,6 +460,13 @@ void mpc1_read_mpcc_state( · 66 unmodified lines
453460 MPCC_BUSY, &s->busy);
454461 }
455462
463+void mpc1_cursor_lock(struct mpc *mpc, int opp_id, bool lock)
464+{
465+ struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
466+
467+ REG_SET(CUR[opp_id], 0, CUR_VUPDATE_LOCK_SET, lock ? 1 : 0);
468+}
469+
456470 static const struct mpc_funcs dcn10_mpc_funcs = {
457471 .read_mpcc_state = mpc1_read_mpcc_state,
458472 .insert_plane = mpc1_insert_plane,
@@ -464,6 +478,7 @@ static const struct mpc_funcs dcn10_mpc_funcs = { · 5 unmodified lines
464478 .assert_mpcc_idle_before_connect = mpc1_assert_mpcc_idle_before_connect,
465479 .init_mpcc_list_from_hw = mpc1_init_mpcc_list_from_hw,
466480 .update_blending = mpc1_update_blending,
481+ .cursor_lock = mpc1_cursor_lock,
467482 .set_denorm = NULL,
468483 .set_denorm_clamp = NULL,
469484 .set_output_csc = NULL,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h+14−6
@@ -39,11 +39,12 @@ · 38 unmodified lines
3939 SRII(MPCC_BG_G_Y, MPCC, inst),\
4040 SRII(MPCC_BG_R_CR, MPCC, inst),\
4141 SRII(MPCC_BG_B_CB, MPCC, inst),\
42− SRII(MPCC_BG_B_CB, MPCC, inst),\
43− SRII(MPCC_SM_CONTROL, MPCC, inst)
42+ SRII(MPCC_SM_CONTROL, MPCC, inst),\
43+ SRII(MPCC_UPDATE_LOCK_SEL, MPCC, inst)
4444
4545 #define MPC_OUT_MUX_COMMON_REG_LIST_DCN1_0(inst) \
46− SRII(MUX, MPC_OUT, inst)
46+ SRII(MUX, MPC_OUT, inst),\
47+ VUPDATE_SRII(CUR, VUPDATE_LOCK_SET, inst)
4748
4849 #define MPC_COMMON_REG_VARIABLE_LIST \
4950 uint32_t MPCC_TOP_SEL[MAX_MPCC]; \
@@ -55,7 +56,9 @@ · 5 unmodified lines
5556 uint32_t MPCC_BG_R_CR[MAX_MPCC]; \
5657 uint32_t MPCC_BG_B_CB[MAX_MPCC]; \
5758 uint32_t MPCC_SM_CONTROL[MAX_MPCC]; \
58− uint32_t MUX[MAX_OPP];
59+ uint32_t MUX[MAX_OPP]; \
60+ uint32_t MPCC_UPDATE_LOCK_SEL[MAX_MPCC]; \
61+ uint32_t CUR[MAX_OPP];
5962
6063 #define MPC_COMMON_MASK_SH_LIST_DCN1_0(mask_sh)\
6164 SF(MPCC0_MPCC_TOP_SEL, MPCC_TOP_SEL, mask_sh),\
@@ -78,7 +81,8 @@ · 16 unmodified lines
7881 SF(MPCC0_MPCC_SM_CONTROL, MPCC_SM_FIELD_ALT, mask_sh),\
7982 SF(MPCC0_MPCC_SM_CONTROL, MPCC_SM_FORCE_NEXT_FRAME_POL, mask_sh),\
8083 SF(MPCC0_MPCC_SM_CONTROL, MPCC_SM_FORCE_NEXT_TOP_POL, mask_sh),\
81− SF(MPC_OUT0_MUX, MPC_OUT_MUX, mask_sh)
84+ SF(MPC_OUT0_MUX, MPC_OUT_MUX, mask_sh),\
85+ SF(MPCC0_MPCC_UPDATE_LOCK_SEL, MPCC_UPDATE_LOCK_SEL, mask_sh)
8286
8387 #define MPC_REG_FIELD_LIST(type) \
8488 type MPCC_TOP_SEL;\
@@ -101,7 +105,9 @@ · 16 unmodified lines
101105 type MPCC_SM_FIELD_ALT;\
102106 type MPCC_SM_FORCE_NEXT_FRAME_POL;\
103107 type MPCC_SM_FORCE_NEXT_TOP_POL;\
104− type MPC_OUT_MUX;
108+ type MPC_OUT_MUX;\
109+ type MPCC_UPDATE_LOCK_SEL;\
110+ type CUR_VUPDATE_LOCK_SET;
105111
106112 struct dcn_mpc_registers {
107113 MPC_COMMON_REG_VARIABLE_LIST
@@ -192,4 +198,6 @@ void mpc1_read_mpcc_state( · 84 unmodified lines
192198 int mpcc_inst,
193199 struct mpcc_state *s);
194200
201+void mpc1_cursor_lock(struct mpc *mpc, int opp_id, bool lock);
202+
195203 #endif
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c+12−2
@@ -181,6 +181,14 @@ enum dcn10_clk_src_array_id { · 180 unmodified lines
181181 .reg_name[id] = BASE(mm ## block ## id ## _ ## reg_name ## _BASE_IDX) + \
182182 mm ## block ## id ## _ ## reg_name
183183
184+#define VUPDATE_SRII(reg_name, block, id)\
185+ .reg_name[id] = BASE(mm ## reg_name ## 0 ## _ ## block ## id ## _BASE_IDX) + \
186+ mm ## reg_name ## 0 ## _ ## block ## id
187+
188+/* set field/register/bitfield name */
189+#define SFRB(field_name, reg_name, bitfield, post_fix)\
190+ .field_name = reg_name ## __ ## bitfield ## post_fix
191+
184192 /* NBIO */
185193 #define NBIO_BASE_INNER(seg) \
186194 NBIF_BASE__INST0_SEG ## seg
@@ -419,11 +427,13 @@ static const struct dcn_mpc_registers mpc_regs = { · 232 unmodified lines
419427 };
420428
421429 static const struct dcn_mpc_shift mpc_shift = {
422− MPC_COMMON_MASK_SH_LIST_DCN1_0(__SHIFT)
430+ MPC_COMMON_MASK_SH_LIST_DCN1_0(__SHIFT),\
431+ SFRB(CUR_VUPDATE_LOCK_SET, CUR0_VUPDATE_LOCK_SET0, CUR0_VUPDATE_LOCK_SET, __SHIFT)
423432 };
424433
425434 static const struct dcn_mpc_mask mpc_mask = {
426− MPC_COMMON_MASK_SH_LIST_DCN1_0(_MASK),
435+ MPC_COMMON_MASK_SH_LIST_DCN1_0(_MASK),\
436+ SFRB(CUR_VUPDATE_LOCK_SET, CUR0_VUPDATE_LOCK_SET0, CUR0_VUPDATE_LOCK_SET, _MASK)
427437 };
428438
429439 #define tg_regs(id)\
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c+2−1
@@ -2294,7 +2294,8 @@ void dcn20_fpga_init_hw(struct dc *dc) · 2293 unmodified lines
22942294
22952295 REG_UPDATE(DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_REFDIV, 2);
22962296 REG_UPDATE(DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_ENABLE, 1);
2297− REG_WRITE(REFCLK_CNTL, 0);
2297+ if (REG(REFCLK_CNTL))
2298+ REG_WRITE(REFCLK_CNTL, 0);
22982299 //
22992300
23002301
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_init.c+1−0
@@ -52,6 +52,7 @@ static const struct hw_sequencer_funcs dcn20_funcs = { · 51 unmodified lines
5252 .disable_plane = dcn20_disable_plane,
5353 .pipe_control_lock = dcn20_pipe_control_lock,
5454 .interdependent_update_lock = dcn10_lock_all_pipes,
55+ .cursor_lock = dcn10_cursor_lock,
5556 .prepare_bandwidth = dcn20_prepare_bandwidth,
5657 .optimize_bandwidth = dcn20_optimize_bandwidth,
5758 .update_bandwidth = dcn20_update_bandwidth,
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c+1−0
@@ -545,6 +545,7 @@ const struct mpc_funcs dcn20_mpc_funcs = { · 544 unmodified lines
545545 .mpc_init = mpc1_mpc_init,
546546 .mpc_init_single_inst = mpc1_mpc_init_single_inst,
547547 .update_blending = mpc2_update_blending,
548+ .cursor_lock = mpc1_cursor_lock,
548549 .get_mpcc_for_dpp = mpc2_get_mpcc_for_dpp,
549550 .wait_for_idle = mpc2_assert_idle_mpcc,
550551 .assert_mpcc_idle_before_connect = mpc2_assert_mpcc_idle_before_connect,
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.h+2−1
@@ -179,7 +179,8 @@ · 178 unmodified lines
179179 SF(MPC_OUT0_DENORM_CLAMP_G_Y, MPC_OUT_DENORM_CLAMP_MAX_G_Y, mask_sh),\
180180 SF(MPC_OUT0_DENORM_CLAMP_G_Y, MPC_OUT_DENORM_CLAMP_MIN_G_Y, mask_sh),\
181181 SF(MPC_OUT0_DENORM_CLAMP_B_CB, MPC_OUT_DENORM_CLAMP_MAX_B_CB, mask_sh),\
182− SF(MPC_OUT0_DENORM_CLAMP_B_CB, MPC_OUT_DENORM_CLAMP_MIN_B_CB, mask_sh)
182+ SF(MPC_OUT0_DENORM_CLAMP_B_CB, MPC_OUT_DENORM_CLAMP_MIN_B_CB, mask_sh),\
183+ SF(CUR_VUPDATE_LOCK_SET0, CUR_VUPDATE_LOCK_SET, mask_sh)
183184
184185 /*
185186 * DCN2 MPC_OCSC debug status register:
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c+27−8
@@ -508,6 +508,10 @@ enum dcn20_clk_src_array_id { · 507 unmodified lines
508508 .block ## _ ## reg_name[id] = BASE(mm ## block ## id ## _ ## reg_name ## _BASE_IDX) + \
509509 mm ## block ## id ## _ ## reg_name
510510
511+#define VUPDATE_SRII(reg_name, block, id)\
512+ .reg_name[id] = BASE(mm ## reg_name ## _ ## block ## id ## _BASE_IDX) + \
513+ mm ## reg_name ## _ ## block ## id
514+
511515 /* NBIO */
512516 #define NBIO_BASE_INNER(seg) \
513517 NBIO_BASE__INST0_SEG ## seg
@@ -3064,25 +3068,32 @@ validate_out: · 2550 unmodified lines
30643068 return out;
30653069 }
30663070
3067−
3068−bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context,
3069− bool fast_validate)
3071+/*
3072+ * This must be noinline to ensure anything that deals with FP registers
3073+ * is contained within this call; previously our compiling with hard-float
3074+ * would result in fp instructions being emitted outside of the boundaries
3075+ * of the DC_FP_START/END macros, which makes sense as the compiler has no
3076+ * idea about what is wrapped and what is not
3077+ *
3078+ * This is largely just a workaround to avoid breakage introduced with 5.6,
3079+ * ideally all fp-using code should be moved into its own file, only that
3080+ * should be compiled with hard-float, and all code exported from there
3081+ * should be strictly wrapped with DC_FP_START/END
3082+ */
3083+static noinline bool dcn20_validate_bandwidth_fp(struct dc *dc,
3084+ struct dc_state *context, bool fast_validate)
30703085 {
30713086 bool voltage_supported = false;
30723087 bool full_pstate_supported = false;
30733088 bool dummy_pstate_supported = false;
30743089 double p_state_latency_us;
30753090
3076− DC_FP_START();
30773091 p_state_latency_us = context->bw_ctx.dml.soc.dram_clock_change_latency_us;
30783092 context->bw_ctx.dml.soc.disable_dram_clock_change_vactive_support =
30793093 dc->debug.disable_dram_clock_change_vactive_support;
30803094
30813095 if (fast_validate) {
3082− voltage_supported = dcn20_validate_bandwidth_internal(dc, context, true);
3083−
3084− DC_FP_END();
3085− return voltage_supported;
3096+ return dcn20_validate_bandwidth_internal(dc, context, true);
30863097 }
30873098
30883099 // Best case, we support full UCLK switch latency
@@ -3111,7 +3122,15 @@ bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context, · 22 unmodified lines
31113122
31123123 restore_dml_state:
31133124 context->bw_ctx.dml.soc.dram_clock_change_latency_us = p_state_latency_us;
3125+ return voltage_supported;
3126+}
31143127
3128+bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context,
3129+ bool fast_validate)
3130+{
3131+ bool voltage_supported = false;
3132+ DC_FP_START();
3133+ voltage_supported = dcn20_validate_bandwidth_fp(dc, context, fast_validate);
31153134 DC_FP_END();
31163135 return voltage_supported;
31173136 }
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_init.c+1−0
@@ -53,6 +53,7 @@ static const struct hw_sequencer_funcs dcn21_funcs = { · 52 unmodified lines
5353 .disable_plane = dcn20_disable_plane,
5454 .pipe_control_lock = dcn20_pipe_control_lock,
5555 .interdependent_update_lock = dcn10_lock_all_pipes,
56+ .cursor_lock = dcn10_cursor_lock,
5657 .prepare_bandwidth = dcn20_prepare_bandwidth,
5758 .optimize_bandwidth = dcn20_optimize_bandwidth,
5859 .update_bandwidth = dcn20_update_bandwidth,
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c+33−44
@@ -284,7 +284,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = { · 283 unmodified lines
284284 .dram_channel_width_bytes = 4,
285285 .fabric_datapath_to_dcn_data_return_bytes = 32,
286286 .dcn_downspread_percent = 0.5,
287− .downspread_percent = 0.5,
287+ .downspread_percent = 0.38,
288288 .dram_page_open_time_ns = 50.0,
289289 .dram_rw_turnaround_time_ns = 17.5,
290290 .dram_return_buffer_per_channel_bytes = 8192,
@@ -340,6 +340,10 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = { · 49 unmodified lines
340340 .block ## _ ## reg_name[id] = BASE(mm ## block ## id ## _ ## reg_name ## _BASE_IDX) + \
341341 mm ## block ## id ## _ ## reg_name
342342
343+#define VUPDATE_SRII(reg_name, block, id)\
344+ .reg_name[id] = BASE(mm ## reg_name ## _ ## block ## id ## _BASE_IDX) + \
345+ mm ## reg_name ## _ ## block ## id
346+
343347 /* NBIO */
344348 #define NBIO_BASE_INNER(seg) \
345349 NBIF0_BASE__INST0_SEG ## seg
@@ -1374,64 +1378,49 @@ static void update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_param · 1028 unmodified lines
13741378 {
13751379 struct dcn21_resource_pool *pool = TO_DCN21_RES_POOL(dc->res_pool);
13761380 struct clk_limit_table *clk_table = &bw_params->clk_table;
1377− unsigned int i, j, k;
1378− int closest_clk_lvl;
1381+ struct _vcs_dpi_voltage_scaling_st clock_limits[DC__VOLTAGE_STATES];
1382+ unsigned int i, j, closest_clk_lvl;
13791383
13801384 // Default clock levels are used for diags, which may lead to overclocking.
1381− if (!IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment) && !IS_DIAG_DC(dc->ctx->dce_environment)) {
1385+ if (!IS_DIAG_DC(dc->ctx->dce_environment)) {
13821386 dcn2_1_ip.max_num_otg = pool->base.res_cap->num_timing_generator;
13831387 dcn2_1_ip.max_num_dpp = pool->base.pipe_count;
13841388 dcn2_1_soc.num_chans = bw_params->num_channels;
13851389
1386− /* Vmin: leave lowest DCN clocks, override with dcfclk, fclk, memclk from fuse */
1387− dcn2_1_soc.clock_limits[0].state = 0;
1388− dcn2_1_soc.clock_limits[0].dcfclk_mhz = clk_table->entries[0].dcfclk_mhz;
1389− dcn2_1_soc.clock_limits[0].fabricclk_mhz = clk_table->entries[0].fclk_mhz;
1390− dcn2_1_soc.clock_limits[0].socclk_mhz = clk_table->entries[0].socclk_mhz;
1391− dcn2_1_soc.clock_limits[0].dram_speed_mts = clk_table->entries[0].memclk_mhz * 2;
1392−
1393− /*
1394− * Other levels: find closest DCN clocks that fit the given clock limit using dcfclk
1395− * as indicator
1396− */
1397−
1398− closest_clk_lvl = -1;
1399− /* index currently being filled */
1400− k = 1;
1401− for (i = 1; i < clk_table->num_entries; i++) {
1402− /* loop backwards, skip duplicate state*/
1403− for (j = dcn2_1_soc.num_states - 1; j >= k; j--) {
1390+ ASSERT(clk_table->num_entries);
1391+ for (i = 0; i < clk_table->num_entries; i++) {
1392+ /* loop backwards*/
1393+ for (closest_clk_lvl = 0, j = dcn2_1_soc.num_states - 1; j >= 0; j--) {
14041394 if ((unsigned int) dcn2_1_soc.clock_limits[j].dcfclk_mhz <= clk_table->entries[i].dcfclk_mhz) {
14051395 closest_clk_lvl = j;
14061396 break;
14071397 }
14081398 }
14091399
1410− /* if found a lvl that fits, use the DCN clks from it, if not, go to next clk limit*/
1411− if (closest_clk_lvl != -1) {
1412− dcn2_1_soc.clock_limits[k].state = i;
1413− dcn2_1_soc.clock_limits[k].dcfclk_mhz = clk_table->entries[i].dcfclk_mhz;
1414− dcn2_1_soc.clock_limits[k].fabricclk_mhz = clk_table->entries[i].fclk_mhz;
1415− dcn2_1_soc.clock_limits[k].socclk_mhz = clk_table->entries[i].socclk_mhz;
1416− dcn2_1_soc.clock_limits[k].dram_speed_mts = clk_table->entries[i].memclk_mhz * 2;
1417−
1418− dcn2_1_soc.clock_limits[k].dispclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dispclk_mhz;
1419− dcn2_1_soc.clock_limits[k].dppclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dppclk_mhz;
1420− dcn2_1_soc.clock_limits[k].dram_bw_per_chan_gbps = dcn2_1_soc.clock_limits[closest_clk_lvl].dram_bw_per_chan_gbps;
1421− dcn2_1_soc.clock_limits[k].dscclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dscclk_mhz;
1422− dcn2_1_soc.clock_limits[k].dtbclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dtbclk_mhz;
1423− dcn2_1_soc.clock_limits[k].phyclk_d18_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].phyclk_d18_mhz;
1424− dcn2_1_soc.clock_limits[k].phyclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].phyclk_mhz;
1425− k++;
1426− }
1400+ clock_limits[i].state = i;
1401+ clock_limits[i].dcfclk_mhz = clk_table->entries[i].dcfclk_mhz;
1402+ clock_limits[i].fabricclk_mhz = clk_table->entries[i].fclk_mhz;
1403+ clock_limits[i].socclk_mhz = clk_table->entries[i].socclk_mhz;
1404+ clock_limits[i].dram_speed_mts = clk_table->entries[i].memclk_mhz * 2;
1405+
1406+ clock_limits[i].dispclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dispclk_mhz;
1407+ clock_limits[i].dppclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dppclk_mhz;
1408+ clock_limits[i].dram_bw_per_chan_gbps = dcn2_1_soc.clock_limits[closest_clk_lvl].dram_bw_per_chan_gbps;
1409+ clock_limits[i].dscclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dscclk_mhz;
1410+ clock_limits[i].dtbclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dtbclk_mhz;
1411+ clock_limits[i].phyclk_d18_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].phyclk_d18_mhz;
1412+ clock_limits[i].phyclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].phyclk_mhz;
1413+ }
1414+ for (i = 0; i < clk_table->num_entries; i++)
1415+ dcn2_1_soc.clock_limits[i] = clock_limits[i];
1416+ if (clk_table->num_entries) {
1417+ dcn2_1_soc.num_states = clk_table->num_entries;
1418+ /* duplicate last level */
1419+ dcn2_1_soc.clock_limits[dcn2_1_soc.num_states] = dcn2_1_soc.clock_limits[dcn2_1_soc.num_states - 1];
1420+ dcn2_1_soc.clock_limits[dcn2_1_soc.num_states].state = dcn2_1_soc.num_states;
14271421 }
1428− dcn2_1_soc.num_states = k;
14291422 }
14301423
1431− /* duplicate last level */
1432− dcn2_1_soc.clock_limits[dcn2_1_soc.num_states] = dcn2_1_soc.clock_limits[dcn2_1_soc.num_states - 1];
1433− dcn2_1_soc.clock_limits[dcn2_1_soc.num_states].state = dcn2_1_soc.num_states;
1434−
14351424 dml_init_instance(&dc->dml, &dcn2_1_soc, &dcn2_1_ip, DML_PROJECT_DCN21);
14361425 }
14371426
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c+4−4
@@ -1200,7 +1200,7 @@ static void dml_rq_dlg_get_dlg_params( · 1199 unmodified lines
12001200 min_hratio_fact_l = 1.0;
12011201 min_hratio_fact_c = 1.0;
12021202
1203− if (htaps_l <= 1)
1203+ if (hratio_l <= 1)
12041204 min_hratio_fact_l = 2.0;
12051205 else if (htaps_l <= 6) {
12061206 if ((hratio_l * 2.0) > 4.0)
@@ -1216,7 +1216,7 @@ static void dml_rq_dlg_get_dlg_params( · 9 unmodified lines
12161216
12171217 hscale_pixel_rate_l = min_hratio_fact_l * dppclk_freq_in_mhz;
12181218
1219− if (htaps_c <= 1)
1219+ if (hratio_c <= 1)
12201220 min_hratio_fact_c = 2.0;
12211221 else if (htaps_c <= 6) {
12221222 if ((hratio_c * 2.0) > 4.0)
@@ -1522,8 +1522,8 @@ static void dml_rq_dlg_get_dlg_params( · 299 unmodified lines
15221522
15231523 disp_dlg_regs->refcyc_per_vm_group_vblank = get_refcyc_per_vm_group_vblank(mode_lib, e2e_pipe_param, num_pipes, pipe_idx) * refclk_freq_in_mhz;
15241524 disp_dlg_regs->refcyc_per_vm_group_flip = get_refcyc_per_vm_group_flip(mode_lib, e2e_pipe_param, num_pipes, pipe_idx) * refclk_freq_in_mhz;
1525− disp_dlg_regs->refcyc_per_vm_req_vblank = get_refcyc_per_vm_req_vblank(mode_lib, e2e_pipe_param, num_pipes, pipe_idx) * refclk_freq_in_mhz;
1526− disp_dlg_regs->refcyc_per_vm_req_flip = get_refcyc_per_vm_req_flip(mode_lib, e2e_pipe_param, num_pipes, pipe_idx) * refclk_freq_in_mhz;
1525+ disp_dlg_regs->refcyc_per_vm_req_vblank = get_refcyc_per_vm_req_vblank(mode_lib, e2e_pipe_param, num_pipes, pipe_idx) * refclk_freq_in_mhz * dml_pow(2, 10);
1526+ disp_dlg_regs->refcyc_per_vm_req_flip = get_refcyc_per_vm_req_flip(mode_lib, e2e_pipe_param, num_pipes, pipe_idx) * refclk_freq_in_mhz * dml_pow(2, 10);
15271527
15281528 // Clamp to max for now
15291529 if (disp_dlg_regs->refcyc_per_vm_group_vblank >= (unsigned int)dml_pow(2, 23))
drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h+16−0
@@ -210,6 +210,22 @@ struct mpc_funcs { · 209 unmodified lines
210210 struct mpcc_blnd_cfg *blnd_cfg,
211211 int mpcc_id);
212212
213+ /*
214+ * Lock cursor updates for the specified OPP.
215+ * OPP defines the set of MPCC that are locked together for cursor.
216+ *
217+ * Parameters:
218+ * [in] mpc - MPC context.
219+ * [in] opp_id - The OPP to lock cursor updates on
220+ * [in] lock - lock/unlock the OPP
221+ *
222+ * Return: void
223+ */
224+ void (*cursor_lock)(
225+ struct mpc *mpc,
226+ int opp_id,
227+ bool lock);
228+
213229 struct mpcc* (*get_mpcc_for_dpp)(
214230 struct mpc_tree *tree,
215231 int dpp_id);
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h+1−0
@@ -86,6 +86,7 @@ struct hw_sequencer_funcs { · 85 unmodified lines
8686 struct dc_state *context, bool lock);
8787 void (*set_flip_control_gsl)(struct pipe_ctx *pipe_ctx,
8888 bool flip_immediate);
89+ void (*cursor_lock)(struct dc *dc, struct pipe_ctx *pipe, bool lock);
8990
9091 /* Timing Related */
9192 void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes,
drivers/gpu/drm/amd/display/dc/os_types.h+1−1
@@ -108,7 +108,7 @@ · 107 unmodified lines
108108 #define ASSERT(expr) ASSERT_CRITICAL(expr)
109109
110110 #else
111−#define ASSERT(expr) WARN_ON(!(expr))
111+#define ASSERT(expr) WARN_ON_ONCE(!(expr))
112112 #endif
113113
114114 #define BREAK_TO_DEBUGGER() ASSERT(0)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c+5−4
@@ -1435,7 +1435,8 @@ static int pp_get_asic_baco_capability(void *handle, bool *cap) · 1434 unmodified lines
14351435 if (!hwmgr)
14361436 return -EINVAL;
14371437
1438− if (!hwmgr->pm_en || !hwmgr->hwmgr_func->get_asic_baco_capability)
1438+ if (!(hwmgr->not_vf && amdgpu_dpm) ||
1439+ !hwmgr->hwmgr_func->get_asic_baco_capability)
14391440 return 0;
14401441
14411442 mutex_lock(&hwmgr->smu_lock);
@@ -1452,8 +1453,7 @@ static int pp_get_asic_baco_state(void *handle, int *state) · 10 unmodified lines
14521453 if (!hwmgr)
14531454 return -EINVAL;
14541455
1455− if (!(hwmgr->not_vf && amdgpu_dpm) ||
1456− !hwmgr->hwmgr_func->get_asic_baco_state)
1456+ if (!hwmgr->pm_en || !hwmgr->hwmgr_func->get_asic_baco_state)
14571457 return 0;
14581458
14591459 mutex_lock(&hwmgr->smu_lock);
@@ -1470,7 +1470,8 @@ static int pp_set_asic_baco_state(void *handle, int state) · 10 unmodified lines
14701470 if (!hwmgr)
14711471 return -EINVAL;
14721472
1473− if (!hwmgr->pm_en || !hwmgr->hwmgr_func->set_asic_baco_state)
1473+ if (!(hwmgr->not_vf && amdgpu_dpm) ||
1474+ !hwmgr->hwmgr_func->set_asic_baco_state)
14741475 return 0;
14751476
14761477 mutex_lock(&hwmgr->smu_lock);
drivers/gpu/drm/drm_dp_mst_topology.c+6−2
@@ -3442,8 +3442,12 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr, · 3441 unmodified lines
34423442 drm_dp_queue_down_tx(mgr, txmsg);
34433443
34443444 ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
3445− if (ret > 0 && txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
3446− ret = -EIO;
3445+ if (ret > 0) {
3446+ if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
3447+ ret = -EIO;
3448+ else
3449+ ret = size;
3450+ }
34473451
34483452 kfree(txmsg);
34493453 fail_put:
drivers/gpu/drm/drm_edid.c+1−1
@@ -5111,7 +5111,7 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d · 5110 unmodified lines
51115111 struct drm_display_mode *mode;
51125112 unsigned pixel_clock = (timings->pixel_clock[0] |
51135113 (timings->pixel_clock[1] << 8) |
5114− (timings->pixel_clock[2] << 16));
5114+ (timings->pixel_clock[2] << 16)) + 1;
51155115 unsigned hactive = (timings->hactive[0] | timings->hactive[1] << 8) + 1;
51165116 unsigned hblank = (timings->hblank[0] | timings->hblank[1] << 8) + 1;
51175117 unsigned hsync = (timings->hsync[0] | (timings->hsync[1] & 0x7f) << 8) + 1;
drivers/gpu/drm/drm_hdcp.c+7−1
@@ -241,8 +241,12 @@ static int drm_hdcp_request_srm(struct drm_device *drm_dev, · 240 unmodified lines
241241
242242 ret = request_firmware_direct(&fw, (const char *)fw_name,
243243 drm_dev->dev);
244− if (ret < 0)
244+ if (ret < 0) {
245+ *revoked_ksv_cnt = 0;
246+ *revoked_ksv_list = NULL;
247+ ret = 0;
245248 goto exit;
249+ }
246250
247251 if (fw->size && fw->data)
248252 ret = drm_hdcp_srm_update(fw->data, fw->size, revoked_ksv_list,
@@ -287,6 +291,8 @@ int drm_hdcp_check_ksvs_revoked(struct drm_device *drm_dev, u8 *ksvs, · 38 unmodified lines
287291
288292 ret = drm_hdcp_request_srm(drm_dev, &revoked_ksv_list,
289293 &revoked_ksv_cnt);
294+ if (ret)
295+ return ret;
290296
291297 /* revoked_ksv_cnt will be zero when above function failed */
292298 for (i = 0; i < revoked_ksv_cnt; i++)
drivers/gpu/drm/i915/gem/i915_gem_tiling.c+18−2
@@ -182,21 +182,35 @@ i915_gem_object_fence_prepare(struct drm_i915_gem_object *obj, · 181 unmodified lines
182182 int tiling_mode, unsigned int stride)
183183 {
184184 struct i915_ggtt *ggtt = &to_i915(obj->base.dev)->ggtt;
185− struct i915_vma *vma;
185+ struct i915_vma *vma, *vn;
186+ LIST_HEAD(unbind);
186187 int ret = 0;
187188
188189 if (tiling_mode == I915_TILING_NONE)
189190 return 0;
190191
191192 mutex_lock(&ggtt->vm.mutex);
193+
194+ spin_lock(&obj->vma.lock);
192195 for_each_ggtt_vma(vma, obj) {
196+ GEM_BUG_ON(vma->vm != &ggtt->vm);
197+
193198 if (i915_vma_fence_prepare(vma, tiling_mode, stride))
194199 continue;
195200
201+ list_move(&vma->vm_link, &unbind);
202+ }
203+ spin_unlock(&obj->vma.lock);
204+
205+ list_for_each_entry_safe(vma, vn, &unbind, vm_link) {
196206 ret = __i915_vma_unbind(vma);
197− if (ret)
207+ if (ret) {
208+ /* Restore the remaining vma on an error */
209+ list_splice(&unbind, &ggtt->vm.bound_list);
198210 break;
211+ }
199212 }
213+
200214 mutex_unlock(&ggtt->vm.mutex);
201215
202216 return ret;
@@ -268,6 +282,7 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj, · 65 unmodified lines
268282 }
269283 mutex_unlock(&obj->mm.lock);
270284
285+ spin_lock(&obj->vma.lock);
271286 for_each_ggtt_vma(vma, obj) {
272287 vma->fence_size =
273288 i915_gem_fence_size(i915, vma->size, tiling, stride);
@@ -278,6 +293,7 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj, · 4 unmodified lines
278293 if (vma->fence)
279294 vma->fence->dirty = true;
280295 }
296+ spin_unlock(&obj->vma.lock);
281297
282298 obj->tiling_and_stride = tiling | stride;
283299 i915_gem_object_unlock(obj);
drivers/gpu/drm/i915/gem/selftests/huge_pages.c+8−4
@@ -1477,8 +1477,10 @@ static int igt_ppgtt_pin_update(void *arg) · 1476 unmodified lines
14771477 unsigned int page_size = BIT(first);
14781478
14791479 obj = i915_gem_object_create_internal(dev_priv, page_size);
1480− if (IS_ERR(obj))
1481− return PTR_ERR(obj);
1480+ if (IS_ERR(obj)) {
1481+ err = PTR_ERR(obj);
1482+ goto out_vm;
1483+ }
14821484
14831485 vma = i915_vma_instance(obj, vm, NULL);
14841486 if (IS_ERR(vma)) {
@@ -1531,8 +1533,10 @@ static int igt_ppgtt_pin_update(void *arg) · 46 unmodified lines
15311533 }
15321534
15331535 obj = i915_gem_object_create_internal(dev_priv, PAGE_SIZE);
1534− if (IS_ERR(obj))
1535− return PTR_ERR(obj);
1536+ if (IS_ERR(obj)) {
1537+ err = PTR_ERR(obj);
1538+ goto out_vm;
1539+ }
15361540
15371541 vma = i915_vma_instance(obj, vm, NULL);
15381542 if (IS_ERR(vma)) {
drivers/gpu/drm/i915/gt/intel_timeline.c+2−0
@@ -521,6 +521,8 @@ int intel_timeline_read_hwsp(struct i915_request *from, · 520 unmodified lines
521521
522522 rcu_read_lock();
523523 cl = rcu_dereference(from->hwsp_cacheline);
524+ if (i915_request_completed(from)) /* confirm cacheline is valid */
525+ goto unlock;
524526 if (unlikely(!i915_active_acquire_if_busy(&cl->active)))
525527 goto unlock; /* seqno wrapped and completed! */
526528 if (unlikely(i915_request_completed(from)))
drivers/gpu/drm/i915/i915_irq.c+2−4
@@ -3358,7 +3358,8 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv) · 3357 unmodified lines
33583358 {
33593359 struct intel_uncore *uncore = &dev_priv->uncore;
33603360
3361− u32 de_pipe_masked = GEN8_PIPE_CDCLK_CRC_DONE;
3361+ u32 de_pipe_masked = gen8_de_pipe_fault_mask(dev_priv) |
3362+ GEN8_PIPE_CDCLK_CRC_DONE;
33623363 u32 de_pipe_enables;
33633364 u32 de_port_masked = GEN8_AUX_CHANNEL_A;
33643365 u32 de_port_enables;
@@ -3369,13 +3370,10 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv) · 4 unmodified lines
33693370 de_misc_masked |= GEN8_DE_MISC_GSE;
33703371
33713372 if (INTEL_GEN(dev_priv) >= 9) {
3372− de_pipe_masked |= GEN9_DE_PIPE_IRQ_FAULT_ERRORS;
33733373 de_port_masked |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
33743374 GEN9_AUX_CHANNEL_D;
33753375 if (IS_GEN9_LP(dev_priv))
33763376 de_port_masked |= BXT_DE_PORT_GMBUS;
3377− } else {
3378− de_pipe_masked |= GEN8_DE_PIPE_IRQ_FAULT_ERRORS;
33793377 }
33803378
33813379 if (INTEL_GEN(dev_priv) >= 11)
drivers/gpu/drm/i915/i915_vma.c+6−4
@@ -158,16 +158,18 @@ vma_create(struct drm_i915_gem_object *obj, · 157 unmodified lines
158158
159159 GEM_BUG_ON(!IS_ALIGNED(vma->size, I915_GTT_PAGE_SIZE));
160160
161+ spin_lock(&obj->vma.lock);
162+
161163 if (i915_is_ggtt(vm)) {
162164 if (unlikely(overflows_type(vma->size, u32)))
163− goto err_vma;
165+ goto err_unlock;
164166
165167 vma->fence_size = i915_gem_fence_size(vm->i915, vma->size,
166168 i915_gem_object_get_tiling(obj),
167169 i915_gem_object_get_stride(obj));
168170 if (unlikely(vma->fence_size < vma->size || /* overflow */
169171 vma->fence_size > vm->total))
170− goto err_vma;
172+ goto err_unlock;
171173
172174 GEM_BUG_ON(!IS_ALIGNED(vma->fence_size, I915_GTT_MIN_ALIGNMENT));
173175
@@ -179,8 +181,6 @@ vma_create(struct drm_i915_gem_object *obj, · 5 unmodified lines
179181 __set_bit(I915_VMA_GGTT_BIT, __i915_vma_flags(vma));
180182 }
181183
182− spin_lock(&obj->vma.lock);
183−
184184 rb = NULL;
185185 p = &obj->vma.tree.rb_node;
186186 while (*p) {
@@ -225,6 +225,8 @@ vma_create(struct drm_i915_gem_object *obj, · 38 unmodified lines
225225
226226 return vma;
227227
228+err_unlock:
229+ spin_unlock(&obj->vma.lock);
228230 err_vma:
229231 i915_vma_free(vma);
230232 return ERR_PTR(-E2BIG);
drivers/gpu/drm/ingenic/ingenic-drm.c+1−0
@@ -843,6 +843,7 @@ static const struct of_device_id ingenic_drm_of_match[] = { · 842 unmodified lines
843843 { .compatible = "ingenic,jz4770-lcd", .data = &jz4770_soc_info },
844844 { /* sentinel */ },
845845 };
846+MODULE_DEVICE_TABLE(of, ingenic_drm_of_match);
846847
847848 static struct platform_driver ingenic_drm_driver = {
848849 .driver = {
drivers/gpu/drm/qxl/qxl_cmd.c+5−5
@@ -480,9 +480,10 @@ int qxl_hw_surface_alloc(struct qxl_device *qdev, · 479 unmodified lines
480480 return ret;
481481
482482 ret = qxl_release_reserve_list(release, true);
483− if (ret)
483+ if (ret) {
484+ qxl_release_free(qdev, release);
484485 return ret;
485−
486+ }
486487 cmd = (struct qxl_surface_cmd *)qxl_release_map(qdev, release);
487488 cmd->type = QXL_SURFACE_CMD_CREATE;
488489 cmd->flags = QXL_SURF_FLAG_KEEP_DATA;
@@ -499,8 +500,8 @@ int qxl_hw_surface_alloc(struct qxl_device *qdev, · 10 unmodified lines
499500 /* no need to add a release to the fence for this surface bo,
500501 since it is only released when we ask to destroy the surface
501502 and it would never signal otherwise */
502− qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false);
503503 qxl_release_fence_buffer_objects(release);
504+ qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false);
504505
505506 surf->hw_surf_alloc = true;
506507 spin_lock(&qdev->surf_id_idr_lock);
@@ -542,9 +543,8 @@ int qxl_hw_surface_dealloc(struct qxl_device *qdev, · 35 unmodified lines
542543 cmd->surface_id = id;
543544 qxl_release_unmap(qdev, release, &cmd->release_info);
544545
545− qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false);
546−
547546 qxl_release_fence_buffer_objects(release);
547+ qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false);
548548
549549 return 0;
550550 }
drivers/gpu/drm/qxl/qxl_display.c+3−3
@@ -510,8 +510,8 @@ static int qxl_primary_apply_cursor(struct drm_plane *plane) · 509 unmodified lines
510510 cmd->u.set.visible = 1;
511511 qxl_release_unmap(qdev, release, &cmd->release_info);
512512
513− qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
514513 qxl_release_fence_buffer_objects(release);
514+ qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
515515
516516 return ret;
517517
@@ -652,8 +652,8 @@ static void qxl_cursor_atomic_update(struct drm_plane *plane, · 134 unmodified lines
652652 cmd->u.position.y = plane->state->crtc_y + fb->hot_y;
653653
654654 qxl_release_unmap(qdev, release, &cmd->release_info);
655− qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
656655 qxl_release_fence_buffer_objects(release);
656+ qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
657657
658658 if (old_cursor_bo != NULL)
659659 qxl_bo_unpin(old_cursor_bo);
@@ -700,8 +700,8 @@ static void qxl_cursor_atomic_disable(struct drm_plane *plane, · 40 unmodified lines
700700 cmd->type = QXL_CURSOR_HIDE;
701701 qxl_release_unmap(qdev, release, &cmd->release_info);
702702
703− qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
704703 qxl_release_fence_buffer_objects(release);
704+ qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
705705 }
706706
707707 static void qxl_update_dumb_head(struct qxl_device *qdev,
drivers/gpu/drm/qxl/qxl_draw.c+4−3
@@ -209,9 +209,10 @@ void qxl_draw_dirty_fb(struct qxl_device *qdev, · 208 unmodified lines
209209 goto out_release_backoff;
210210
211211 rects = drawable_set_clipping(qdev, num_clips, clips_bo);
212− if (!rects)
212+ if (!rects) {
213+ ret = -EINVAL;
213214 goto out_release_backoff;
214−
215+ }
215216 drawable = (struct qxl_drawable *)qxl_release_map(qdev, release);
216217
217218 drawable->clip.type = SPICE_CLIP_TYPE_RECTS;
@@ -242,8 +243,8 @@ void qxl_draw_dirty_fb(struct qxl_device *qdev, · 24 unmodified lines
242243 }
243244 qxl_bo_kunmap(clips_bo);
244245
245− qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false);
246246 qxl_release_fence_buffer_objects(release);
247+ qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false);
247248
248249 out_release_backoff:
249250 if (ret)
drivers/gpu/drm/qxl/qxl_image.c+2−1
@@ -212,7 +212,8 @@ qxl_image_init_helper(struct qxl_device *qdev, · 211 unmodified lines
212212 break;
213213 default:
214214 DRM_ERROR("unsupported image bit depth\n");
215− return -EINVAL; /* TODO: cleanup */
215+ qxl_bo_kunmap_atomic_page(qdev, image_bo, ptr);
216+ return -EINVAL;
216217 }
217218 image->u.bitmap.flags = QXL_BITMAP_TOP_DOWN;
218219 image->u.bitmap.x = width;
drivers/gpu/drm/qxl/qxl_ioctl.c+1−4
@@ -261,11 +261,8 @@ static int qxl_process_single_command(struct qxl_device *qdev, · 260 unmodified lines
261261 apply_surf_reloc(qdev, &reloc_info[i]);
262262 }
263263
264+ qxl_release_fence_buffer_objects(release);
264265 ret = qxl_push_command_ring_release(qdev, release, cmd->type, true);
265− if (ret)
266− qxl_release_backoff_reserve_list(release);
267− else
268− qxl_release_fence_buffer_objects(release);
269266
270267 out_free_bos:
271268 out_free_release:
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c+1−1
@@ -717,7 +717,7 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) · 716 unmodified lines
717717 struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
718718 struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder);
719719 struct mipi_dsi_device *device = dsi->device;
720− union phy_configure_opts opts = { 0 };
720+ union phy_configure_opts opts = { };
721721 struct phy_configure_opts_mipi_dphy *cfg = &opts.mipi_dphy;
722722 u16 delay;
723723 int err;
drivers/gpu/drm/virtio/virtgpu_drv.h+1−0
@@ -221,6 +221,7 @@ struct virtio_gpu_fpriv { · 220 unmodified lines
221221 /* virtio_ioctl.c */
222222 #define DRM_VIRTIO_NUM_IOCTLS 10
223223 extern struct drm_ioctl_desc virtio_gpu_ioctls[DRM_VIRTIO_NUM_IOCTLS];
224+void virtio_gpu_create_context(struct drm_device *dev, struct drm_file *file);
224225
225226 /* virtio_kms.c */
226227 int virtio_gpu_init(struct drm_device *dev);
drivers/gpu/drm/virtio/virtgpu_gem.c+3−0
@@ -39,6 +39,9 @@ int virtio_gpu_gem_create(struct drm_file *file, · 38 unmodified lines
3939 int ret;
4040 u32 handle;
4141
42+ if (vgdev->has_virgl_3d)
43+ virtio_gpu_create_context(dev, file);
44+
4245 ret = virtio_gpu_object_create(vgdev, params, &obj, NULL);
4346 if (ret < 0)
4447 return ret;
drivers/gpu/drm/virtio/virtgpu_ioctl.c+1−2
@@ -34,8 +34,7 @@ · 33 unmodified lines
3434
3535 #include "virtgpu_drv.h"
3636
37−static void virtio_gpu_create_context(struct drm_device *dev,
38− struct drm_file *file)
37+void virtio_gpu_create_context(struct drm_device *dev, struct drm_file *file)
3938 {
4039 struct virtio_gpu_device *vgdev = dev->dev_private;
4140 struct virtio_gpu_fpriv *vfpriv = file->driver_priv;
drivers/gpu/drm/virtio/virtgpu_kms.c+6−11
@@ -53,14 +53,6 @@ static void virtio_gpu_config_changed_work_func(struct work_struct *work) · 52 unmodified lines
5353 events_clear, &events_clear);
5454 }
5555
56−static void virtio_gpu_context_destroy(struct virtio_gpu_device *vgdev,
57− uint32_t ctx_id)
58−{
59− virtio_gpu_cmd_context_destroy(vgdev, ctx_id);
60− virtio_gpu_notify(vgdev);
61− ida_free(&vgdev->ctx_id_ida, ctx_id - 1);
62−}
63−
6456 static void virtio_gpu_init_vq(struct virtio_gpu_queue *vgvq,
6557 void (*work_func)(struct work_struct *work))
6658 {
@@ -275,14 +267,17 @@ int virtio_gpu_driver_open(struct drm_device *dev, struct drm_file *file) · 208 unmodified lines
275267 void virtio_gpu_driver_postclose(struct drm_device *dev, struct drm_file *file)
276268 {
277269 struct virtio_gpu_device *vgdev = dev->dev_private;
278− struct virtio_gpu_fpriv *vfpriv;
270+ struct virtio_gpu_fpriv *vfpriv = file->driver_priv;
279271
280272 if (!vgdev->has_virgl_3d)
281273 return;
282274
283− vfpriv = file->driver_priv;
275+ if (vfpriv->context_created) {
276+ virtio_gpu_cmd_context_destroy(vgdev, vfpriv->ctx_id);
277+ virtio_gpu_notify(vgdev);
278+ }
284279
285− virtio_gpu_context_destroy(vgdev, vfpriv->ctx_id);
280+ ida_free(&vgdev->ctx_id_ida, vfpriv->ctx_id - 1);
286281 mutex_destroy(&vfpriv->context_lock);
287282 kfree(vfpriv);
288283 file->driver_priv = NULL;
drivers/hid/Kconfig+1−0
@@ -1155,6 +1155,7 @@ config HID_ALPS · 1154 unmodified lines
11551155 config HID_MCP2221
11561156 tristate "Microchip MCP2221 HID USB-to-I2C/SMbus host support"
11571157 depends on USB_HID && I2C
1158+ depends on GPIOLIB
11581159 ---help---
11591160 Provides I2C and SMBUS host adapter functionality over USB-HID
11601161 through MCP2221 device.
drivers/hid/hid-alps.c+1−0
@@ -802,6 +802,7 @@ static int alps_probe(struct hid_device *hdev, const struct hid_device_id *id) · 801 unmodified lines
802802 break;
803803 case HID_DEVICE_ID_ALPS_U1_DUAL:
804804 case HID_DEVICE_ID_ALPS_U1:
805+ case HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY:
805806 data->dev_type = U1;
806807 break;
807808 default:
drivers/hid/hid-ids.h+7−1
@@ -79,10 +79,10 @@ · 78 unmodified lines
7979 #define HID_DEVICE_ID_ALPS_U1_DUAL_PTP 0x121F
8080 #define HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP 0x1220
8181 #define HID_DEVICE_ID_ALPS_U1 0x1215
82+#define HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY 0x121E
8283 #define HID_DEVICE_ID_ALPS_T4_BTNLESS 0x120C
8384 #define HID_DEVICE_ID_ALPS_1222 0x1222
8485
85−
8686 #define USB_VENDOR_ID_AMI 0x046b
8787 #define USB_DEVICE_ID_AMI_VIRT_KEYBOARD_AND_MOUSE 0xff10
8888
@@ -385,6 +385,7 @@ · 296 unmodified lines
385385 #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349 0x7349
386386 #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7 0x73f7
387387 #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001
388+#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_C002 0xc002
388389
389390 #define USB_VENDOR_ID_ELAN 0x04f3
390391 #define USB_DEVICE_ID_TOSHIBA_CLICK_L9W 0x0401
@@ -759,6 +760,7 @@ · 368 unmodified lines
759760 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2 0xc218
760761 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2 0xc219
761762 #define USB_DEVICE_ID_LOGITECH_G15_LCD 0xc222
763+#define USB_DEVICE_ID_LOGITECH_G11 0xc225
762764 #define USB_DEVICE_ID_LOGITECH_G15_V2_LCD 0xc227
763765 #define USB_DEVICE_ID_LOGITECH_G510 0xc22d
764766 #define USB_DEVICE_ID_LOGITECH_G510_USB_AUDIO 0xc22e
@@ -1097,6 +1099,9 @@ · 332 unmodified lines
10971099 #define USB_DEVICE_ID_SYMBOL_SCANNER_2 0x1300
10981100 #define USB_DEVICE_ID_SYMBOL_SCANNER_3 0x1200
10991101
1102+#define I2C_VENDOR_ID_SYNAPTICS 0x06cb
1103+#define I2C_PRODUCT_ID_SYNAPTICS_SYNA2393 0x7a13
1104+
11001105 #define USB_VENDOR_ID_SYNAPTICS 0x06cb
11011106 #define USB_DEVICE_ID_SYNAPTICS_TP 0x0001
11021107 #define USB_DEVICE_ID_SYNAPTICS_INT_TP 0x0002
@@ -1111,6 +1116,7 @@ · 8 unmodified lines
11111116 #define USB_DEVICE_ID_SYNAPTICS_LTS2 0x1d10
11121117 #define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3
11131118 #define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3
1119+#define USB_DEVICE_ID_SYNAPTICS_DELL_K12A 0x2819
11141120 #define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 0x2968
11151121 #define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710
11161122 #define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5 0x81a7
drivers/hid/hid-lg-g15.c+4−0
@@ -872,6 +872,10 @@ error_hw_stop: · 871 unmodified lines
872872 }
873873
874874 static const struct hid_device_id lg_g15_devices[] = {
875+ /* The G11 is a G15 without the LCD, treat it as a G15 */
876+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
877+ USB_DEVICE_ID_LOGITECH_G11),
878+ .driver_data = LG_G15 },
875879 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
876880 USB_DEVICE_ID_LOGITECH_G15_LCD),
877881 .driver_data = LG_G15 },
drivers/hid/hid-multitouch.c+3−0
@@ -1922,6 +1922,9 @@ static const struct hid_device_id mt_devices[] = { · 1921 unmodified lines
19221922 { .driver_data = MT_CLS_EGALAX_SERIAL,
19231923 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
19241924 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },
1925+ { .driver_data = MT_CLS_EGALAX,
1926+ MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
1927+ USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_C002) },
19251928
19261929 /* Elitegroup panel */
19271930 { .driver_data = MT_CLS_SERIAL,
drivers/hid/hid-quirks.c+1−0
@@ -163,6 +163,7 @@ static const struct hid_device_id hid_quirks[] = { · 162 unmodified lines
163163 { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS2), HID_QUIRK_NO_INIT_REPORTS },
164164 { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_QUAD_HD), HID_QUIRK_NO_INIT_REPORTS },
165165 { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP_V103), HID_QUIRK_NO_INIT_REPORTS },
166+ { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DELL_K12A), HID_QUIRK_NO_INIT_REPORTS },
166167 { HID_USB_DEVICE(USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD), HID_QUIRK_BADPAD },
167168 { HID_USB_DEVICE(USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS), HID_QUIRK_MULTI_INPUT },
168169 { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882), HID_QUIRK_NOGET },
drivers/hid/i2c-hid/i2c-hid-core.c+2−0
@@ -177,6 +177,8 @@ static const struct i2c_hid_quirks { · 176 unmodified lines
177177 I2C_HID_QUIRK_BOGUS_IRQ },
178178 { USB_VENDOR_ID_ALPS_JP, HID_ANY_ID,
179179 I2C_HID_QUIRK_RESET_ON_RESUME },
180+ { I2C_VENDOR_ID_SYNAPTICS, I2C_PRODUCT_ID_SYNAPTICS_SYNA2393,
181+ I2C_HID_QUIRK_RESET_ON_RESUME },
180182 { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720,
181183 I2C_HID_QUIRK_BAD_INPUT_SIZE },
182184 { 0, 0 }
drivers/hid/usbhid/hid-core.c+29−8
@@ -682,16 +682,21 @@ static int usbhid_open(struct hid_device *hid) · 681 unmodified lines
682682 struct usbhid_device *usbhid = hid->driver_data;
683683 int res;
684684
685+ mutex_lock(&usbhid->mutex);
686+
685687 set_bit(HID_OPENED, &usbhid->iofl);
686688
687− if (hid->quirks & HID_QUIRK_ALWAYS_POLL)
688− return 0;
689+ if (hid->quirks & HID_QUIRK_ALWAYS_POLL) {
690+ res = 0;
691+ goto Done;
692+ }
689693
690694 res = usb_autopm_get_interface(usbhid->intf);
691695 /* the device must be awake to reliably request remote wakeup */
692696 if (res < 0) {
693697 clear_bit(HID_OPENED, &usbhid->iofl);
694− return -EIO;
698+ res = -EIO;
699+ goto Done;
695700 }
696701
697702 usbhid->intf->needs_remote_wakeup = 1;
@@ -725,6 +730,9 @@ static int usbhid_open(struct hid_device *hid) · 27 unmodified lines
725730 msleep(50);
726731
727732 clear_bit(HID_RESUME_RUNNING, &usbhid->iofl);
733+
734+ Done:
735+ mutex_unlock(&usbhid->mutex);
728736 return res;
729737 }
730738
@@ -732,6 +740,8 @@ static void usbhid_close(struct hid_device *hid) · 1 unmodified line
732740 {
733741 struct usbhid_device *usbhid = hid->driver_data;
734742
743+ mutex_lock(&usbhid->mutex);
744+
735745 /*
736746 * Make sure we don't restart data acquisition due to
737747 * a resumption we no longer care about by avoiding racing
@@ -743,12 +753,13 @@ static void usbhid_close(struct hid_device *hid) · 5 unmodified lines
743753 clear_bit(HID_IN_POLLING, &usbhid->iofl);
744754 spin_unlock_irq(&usbhid->lock);
745755
746− if (hid->quirks & HID_QUIRK_ALWAYS_POLL)
747− return;
756+ if (!(hid->quirks & HID_QUIRK_ALWAYS_POLL)) {
757+ hid_cancel_delayed_stuff(usbhid);
758+ usb_kill_urb(usbhid->urbin);
759+ usbhid->intf->needs_remote_wakeup = 0;
760+ }
748761
749− hid_cancel_delayed_stuff(usbhid);
750− usb_kill_urb(usbhid->urbin);
751− usbhid->intf->needs_remote_wakeup = 0;
762+ mutex_unlock(&usbhid->mutex);
752763 }
753764
754765 /*
@@ -1057,6 +1068,8 @@ static int usbhid_start(struct hid_device *hid) · 302 unmodified lines
10571068 unsigned int n, insize = 0;
10581069 int ret;
10591070
1071+ mutex_lock(&usbhid->mutex);
1072+
10601073 clear_bit(HID_DISCONNECTED, &usbhid->iofl);
10611074
10621075 usbhid->bufsize = HID_MIN_BUFFER_SIZE;
@@ -1177,6 +1190,8 @@ static int usbhid_start(struct hid_device *hid) · 114 unmodified lines
11771190 usbhid_set_leds(hid);
11781191 device_set_wakeup_enable(&dev->dev, 1);
11791192 }
1193+
1194+ mutex_unlock(&usbhid->mutex);
11801195 return 0;
11811196
11821197 fail:
@@ -1187,6 +1202,7 @@ fail: · 4 unmodified lines
11871202 usbhid->urbout = NULL;
11881203 usbhid->urbctrl = NULL;
11891204 hid_free_buffers(dev, hid);
1205+ mutex_unlock(&usbhid->mutex);
11901206 return ret;
11911207 }
11921208
@@ -1202,6 +1218,8 @@ static void usbhid_stop(struct hid_device *hid) · 9 unmodified lines
12021218 usbhid->intf->needs_remote_wakeup = 0;
12031219 }
12041220
1221+ mutex_lock(&usbhid->mutex);
1222+
12051223 clear_bit(HID_STARTED, &usbhid->iofl);
12061224 spin_lock_irq(&usbhid->lock); /* Sync with error and led handlers */
12071225 set_bit(HID_DISCONNECTED, &usbhid->iofl);
@@ -1222,6 +1240,8 @@ static void usbhid_stop(struct hid_device *hid) · 14 unmodified lines
12221240 usbhid->urbout = NULL;
12231241
12241242 hid_free_buffers(hid_to_usb_dev(hid), hid);
1243+
1244+ mutex_unlock(&usbhid->mutex);
12251245 }
12261246
12271247 static int usbhid_power(struct hid_device *hid, int lvl)
@@ -1382,6 +1402,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id * · 154 unmodified lines
13821402 INIT_WORK(&usbhid->reset_work, hid_reset);
13831403 timer_setup(&usbhid->io_retry, hid_retry_timeout, 0);
13841404 spin_lock_init(&usbhid->lock);
1405+ mutex_init(&usbhid->mutex);
13851406
13861407 ret = hid_add_device(hid);
13871408 if (ret) {
drivers/hid/usbhid/usbhid.h+1−0
@@ -80,6 +80,7 @@ struct usbhid_device { · 79 unmodified lines
8080 dma_addr_t outbuf_dma; /* Output buffer dma */
8181 unsigned long last_out; /* record of last output for timeouts */
8282
83+ struct mutex mutex; /* start/stop/open/close */
8384 spinlock_t lock; /* fifo spinlock */
8485 unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */
8586 struct timer_list io_retry; /* Retry timer */
drivers/hid/wacom_sys.c+3−1
@@ -319,9 +319,11 @@ static void wacom_feature_mapping(struct hid_device *hdev, · 318 unmodified lines
319319 data[0] = field->report->id;
320320 ret = wacom_get_report(hdev, HID_FEATURE_REPORT,
321321 data, n, WAC_CMD_RETRIES);
322− if (ret == n) {
322+ if (ret == n && features->type == HID_GENERIC) {
323323 ret = hid_report_raw_event(hdev,
324324 HID_FEATURE_REPORT, data, n, 0);
325+ } else if (ret == 2 && features->type != HID_GENERIC) {
326+ features->touch_max = data[1];
325327 } else {
326328 features->touch_max = 16;
327329 hid_warn(hdev, "wacom_feature_mapping: "
drivers/hid/wacom_wac.c+22−66
@@ -1427,11 +1427,13 @@ static void wacom_intuos_pro2_bt_pad(struct wacom_wac *wacom) · 1426 unmodified lines
14271427 {
14281428 struct input_dev *pad_input = wacom->pad_input;
14291429 unsigned char *data = wacom->data;
1430+ int nbuttons = wacom->features.numbered_buttons;
14301431
1431− int buttons = data[282] | ((data[281] & 0x40) << 2);
1432+ int expresskeys = data[282];
1433+ int center = (data[281] & 0x40) >> 6;
14321434 int ring = data[285] & 0x7F;
14331435 bool ringstatus = data[285] & 0x80;
1434− bool prox = buttons || ringstatus;
1436+ bool prox = expresskeys || center || ringstatus;
14351437
14361438 /* Fix touchring data: userspace expects 0 at left and increasing clockwise */
14371439 ring = 71 - ring;
@@ -1439,7 +1441,8 @@ static void wacom_intuos_pro2_bt_pad(struct wacom_wac *wacom) · 1 unmodified line
14391441 if (ring > 71)
14401442 ring -= 72;
14411443
1442− wacom_report_numbered_buttons(pad_input, 9, buttons);
1444+ wacom_report_numbered_buttons(pad_input, nbuttons,
1445+ expresskeys | (center << (nbuttons - 1)));
14431446
14441447 input_report_abs(pad_input, ABS_WHEEL, ringstatus ? ring : 0);
14451448
@@ -2637,9 +2640,25 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev, · 1191 unmodified lines
26372640 case HID_DG_TIPSWITCH:
26382641 hid_data->last_slot_field = equivalent_usage;
26392642 break;
2643+ case HID_DG_CONTACTCOUNT:
2644+ hid_data->cc_report = report->id;
2645+ hid_data->cc_index = i;
2646+ hid_data->cc_value_index = j;
2647+ break;
26402648 }
26412649 }
26422650 }
2651+
2652+ if (hid_data->cc_report != 0 &&
2653+ hid_data->cc_index >= 0) {
2654+ struct hid_field *field = report->field[hid_data->cc_index];
2655+ int value = field->value[hid_data->cc_value_index];
2656+ if (value)
2657+ hid_data->num_expected = value;
2658+ }
2659+ else {
2660+ hid_data->num_expected = wacom_wac->features.touch_max;
2661+ }
26432662 }
26442663
26452664 static void wacom_wac_finger_report(struct hid_device *hdev,
@@ -2649,7 +2668,6 @@ static void wacom_wac_finger_report(struct hid_device *hdev, · 3 unmodified lines
26492668 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
26502669 struct input_dev *input = wacom_wac->touch_input;
26512670 unsigned touch_max = wacom_wac->features.touch_max;
2652− struct hid_data *hid_data = &wacom_wac->hid_data;
26532671
26542672 /* If more packets of data are expected, give us a chance to
26552673 * process them rather than immediately syncing a partial
@@ -2663,7 +2681,6 @@ static void wacom_wac_finger_report(struct hid_device *hdev, · 7 unmodified lines
26632681
26642682 input_sync(input);
26652683 wacom_wac->hid_data.num_received = 0;
2666− hid_data->num_expected = 0;
26672684
26682685 /* keep touch state for pen event */
26692686 wacom_wac->shared->touch_down = wacom_wac_finger_count_touches(wacom_wac);
@@ -2738,73 +2755,12 @@ static void wacom_report_events(struct hid_device *hdev, · 68 unmodified lines
27382755 }
27392756 }
27402757
2741−static void wacom_set_num_expected(struct hid_device *hdev,
2742− struct hid_report *report,
2743− int collection_index,
2744− struct hid_field *field,
2745− int field_index)
2746−{
2747− struct wacom *wacom = hid_get_drvdata(hdev);
2748− struct wacom_wac *wacom_wac = &wacom->wacom_wac;
2749− struct hid_data *hid_data = &wacom_wac->hid_data;
2750− unsigned int original_collection_level =
2751− hdev->collection[collection_index].level;
2752− bool end_collection = false;
2753− int i;
2754−
2755− if (hid_data->num_expected)
2756− return;
2757−
2758− // find the contact count value for this segment
2759− for (i = field_index; i < report->maxfield && !end_collection; i++) {
2760− struct hid_field *field = report->field[i];
2761− unsigned int field_level =
2762− hdev->collection[field->usage[0].collection_index].level;
2763− unsigned int j;
2764−
2765− if (field_level != original_collection_level)
2766− continue;
2767−
2768− for (j = 0; j < field->maxusage; j++) {
2769− struct hid_usage *usage = &field->usage[j];
2770−
2771− if (usage->collection_index != collection_index) {
2772− end_collection = true;
2773− break;
2774− }
2775− if (wacom_equivalent_usage(usage->hid) == HID_DG_CONTACTCOUNT) {
2776− hid_data->cc_report = report->id;
2777− hid_data->cc_index = i;
2778− hid_data->cc_value_index = j;
2779−
2780− if (hid_data->cc_report != 0 &&
2781− hid_data->cc_index >= 0) {
2782−
2783− struct hid_field *field =
2784− report->field[hid_data->cc_index];
2785− int value =
2786− field->value[hid_data->cc_value_index];
2787−
2788− if (value)
2789− hid_data->num_expected = value;
2790− }
2791− }
2792− }
2793− }
2794−
2795− if (hid_data->cc_report == 0 || hid_data->cc_index < 0)
2796− hid_data->num_expected = wacom_wac->features.touch_max;
2797−}
2798−
27992758 static int wacom_wac_collection(struct hid_device *hdev, struct hid_report *report,
28002759 int collection_index, struct hid_field *field,
28012760 int field_index)
28022761 {
28032762 struct wacom *wacom = hid_get_drvdata(hdev);
28042763
2805− if (WACOM_FINGER_FIELD(field))
2806− wacom_set_num_expected(hdev, report, collection_index, field,
2807− field_index);
28082764 wacom_report_events(hdev, report, collection_index, field_index);
28092765
28102766 /*
drivers/hv/hv.c+1−5
@@ -184,11 +184,7 @@ void hv_synic_enable_regs(unsigned int cpu) · 183 unmodified lines
184184
185185 shared_sint.vector = HYPERVISOR_CALLBACK_VECTOR;
186186 shared_sint.masked = false;
187− if (ms_hyperv.hints & HV_DEPRECATING_AEOI_RECOMMENDED)
188− shared_sint.auto_eoi = false;
189− else
190− shared_sint.auto_eoi = true;
191−
187+ shared_sint.auto_eoi = hv_recommend_using_aeoi();
192188 hv_set_synint_state(VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
193189
194190 /* Enable the global synic bit */
drivers/hv/hv_trace.h+2−2
@@ -286,8 +286,8 @@ TRACE_EVENT(vmbus_send_tl_connect_request, · 285 unmodified lines
286286 __field(int, ret)
287287 ),
288288 TP_fast_assign(
289− memcpy(__entry->guest_id, &msg->guest_endpoint_id.b, 16);
290− memcpy(__entry->host_id, &msg->host_service_id.b, 16);
289+ export_guid(__entry->guest_id, &msg->guest_endpoint_id);
290+ export_guid(__entry->host_id, &msg->host_service_id);
291291 __entry->ret = ret;
292292 ),
293293 TP_printk("sending guest_endpoint_id %pUl, host_service_id %pUl, "
drivers/hv/vmbus_drv.c+34−9
@@ -978,6 +978,9 @@ static int vmbus_resume(struct device *child_device) · 977 unmodified lines
978978
979979 return drv->resume(dev);
980980 }
981+#else
982+#define vmbus_suspend NULL
983+#define vmbus_resume NULL
981984 #endif /* CONFIG_PM_SLEEP */
982985
983986 /*
@@ -997,11 +1000,22 @@ static void vmbus_device_release(struct device *device) · 13 unmodified lines
9971000 }
9981001
9991002 /*
1000− * Note: we must use SET_NOIRQ_SYSTEM_SLEEP_PM_OPS rather than
1001− * SET_SYSTEM_SLEEP_PM_OPS: see the comment before vmbus_bus_pm.
1003+ * Note: we must use the "noirq" ops: see the comment before vmbus_bus_pm.
1004+ *
1005+ * suspend_noirq/resume_noirq are set to NULL to support Suspend-to-Idle: we
1006+ * shouldn't suspend the vmbus devices upon Suspend-to-Idle, otherwise there
1007+ * is no way to wake up a Generation-2 VM.
1008+ *
1009+ * The other 4 ops are for hibernation.
10021010 */
1011+
10031012 static const struct dev_pm_ops vmbus_pm = {
1004− SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(vmbus_suspend, vmbus_resume)
1013+ .suspend_noirq = NULL,
1014+ .resume_noirq = NULL,
1015+ .freeze_noirq = vmbus_suspend,
1016+ .thaw_noirq = vmbus_resume,
1017+ .poweroff_noirq = vmbus_suspend,
1018+ .restore_noirq = vmbus_resume,
10051019 };
10061020
10071021 /* The one and only one */
@@ -2281,6 +2295,9 @@ static int vmbus_bus_resume(struct device *dev) · 1273 unmodified lines
22812295
22822296 return 0;
22832297 }
2298+#else
2299+#define vmbus_bus_suspend NULL
2300+#define vmbus_bus_resume NULL
22842301 #endif /* CONFIG_PM_SLEEP */
22852302
22862303 static const struct acpi_device_id vmbus_acpi_device_ids[] = {
@@ -2291,16 +2308,24 @@ static const struct acpi_device_id vmbus_acpi_device_ids[] = { · 4 unmodified lines
22912308 MODULE_DEVICE_TABLE(acpi, vmbus_acpi_device_ids);
22922309
22932310 /*
2294− * Note: we must use SET_NOIRQ_SYSTEM_SLEEP_PM_OPS rather than
2295− * SET_SYSTEM_SLEEP_PM_OPS, otherwise NIC SR-IOV can not work, because the
2296− * "pci_dev_pm_ops" uses the "noirq" callbacks: in the resume path, the
2297− * pci "noirq" restore callback runs before "non-noirq" callbacks (see
2311+ * Note: we must use the "no_irq" ops, otherwise hibernation can not work with
2312+ * PCI device assignment, because "pci_dev_pm_ops" uses the "noirq" ops: in
2313+ * the resume path, the pci "noirq" restore op runs before "non-noirq" op (see
22982314 * resume_target_kernel() -> dpm_resume_start(), and hibernation_restore() ->
22992315 * dpm_resume_end()). This means vmbus_bus_resume() and the pci-hyperv's
2300− * resume callback must also run via the "noirq" callbacks.
2316+ * resume callback must also run via the "noirq" ops.
2317+ *
2318+ * Set suspend_noirq/resume_noirq to NULL for Suspend-to-Idle: see the comment
2319+ * earlier in this file before vmbus_pm.
23012320 */
2321+
23022322 static const struct dev_pm_ops vmbus_bus_pm = {
2303− SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(vmbus_bus_suspend, vmbus_bus_resume)
2323+ .suspend_noirq = NULL,
2324+ .resume_noirq = NULL,
2325+ .freeze_noirq = vmbus_bus_suspend,
2326+ .thaw_noirq = vmbus_bus_resume,
2327+ .poweroff_noirq = vmbus_bus_suspend,
2328+ .restore_noirq = vmbus_bus_resume
23042329 };
23052330
23062331 static struct acpi_driver vmbus_acpi_driver = {
drivers/i2c/busses/i2c-amd-mp2-pci.c+1−1
@@ -349,12 +349,12 @@ static int amd_mp2_pci_probe(struct pci_dev *pci_dev, · 348 unmodified lines
349349 if (!privdata)
350350 return -ENOMEM;
351351
352+ privdata->pci_dev = pci_dev;
352353 rc = amd_mp2_pci_init(privdata, pci_dev);
353354 if (rc)
354355 return rc;
355356
356357 mutex_init(&privdata->c2p_lock);
357− privdata->pci_dev = pci_dev;
358358
359359 pm_runtime_set_autosuspend_delay(&pci_dev->dev, 1000);
360360 pm_runtime_use_autosuspend(&pci_dev->dev);
drivers/i2c/busses/i2c-aspeed.c+4−1
@@ -603,6 +603,7 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) · 602 unmodified lines
603603 /* Ack all interrupts except for Rx done */
604604 writel(irq_received & ~ASPEED_I2CD_INTR_RX_DONE,
605605 bus->base + ASPEED_I2C_INTR_STS_REG);
606+ readl(bus->base + ASPEED_I2C_INTR_STS_REG);
606607 irq_remaining = irq_received;
607608
608609 #if IS_ENABLED(CONFIG_I2C_SLAVE)
@@ -645,9 +646,11 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) · 36 unmodified lines
645646 irq_received, irq_handled);
646647
647648 /* Ack Rx done */
648− if (irq_received & ASPEED_I2CD_INTR_RX_DONE)
649+ if (irq_received & ASPEED_I2CD_INTR_RX_DONE) {
649650 writel(ASPEED_I2CD_INTR_RX_DONE,
650651 bus->base + ASPEED_I2C_INTR_STS_REG);
652+ readl(bus->base + ASPEED_I2C_INTR_STS_REG);
653+ }
651654 spin_unlock(&bus->lock);
652655 return irq_remaining ? IRQ_NONE : IRQ_HANDLED;
653656 }
drivers/i2c/busses/i2c-bcm-iproc.c+3−0
@@ -360,6 +360,9 @@ static bool bcm_iproc_i2c_slave_isr(struct bcm_iproc_i2c_dev *iproc_i2c, · 359 unmodified lines
360360 value = (u8)((val >> S_RX_DATA_SHIFT) & S_RX_DATA_MASK);
361361 i2c_slave_event(iproc_i2c->slave,
362362 I2C_SLAVE_WRITE_RECEIVED, &value);
363+ if (rx_status == I2C_SLAVE_RX_END)
364+ i2c_slave_event(iproc_i2c->slave,
365+ I2C_SLAVE_STOP, &value);
363366 }
364367 } else if (status & BIT(IS_S_TX_UNDERRUN_SHIFT)) {
365368 /* Master read other than start */
drivers/i2c/busses/i2c-tegra.c+12−24
@@ -996,13 +996,14 @@ tegra_i2c_poll_completion_timeout(struct tegra_i2c_dev *i2c_dev, · 995 unmodified lines
996996 do {
997997 u32 status = i2c_readl(i2c_dev, I2C_INT_STATUS);
998998
999− if (status)
999+ if (status) {
10001000 tegra_i2c_isr(i2c_dev->irq, i2c_dev);
10011001
1002− if (completion_done(complete)) {
1003− s64 delta = ktime_ms_delta(ktimeout, ktime);
1002+ if (completion_done(complete)) {
1003+ s64 delta = ktime_ms_delta(ktimeout, ktime);
10041004
1005− return msecs_to_jiffies(delta) ?: 1;
1005+ return msecs_to_jiffies(delta) ?: 1;
1006+ }
10061007 }
10071008
10081009 ktime = ktime_get();
@@ -1029,18 +1030,14 @@ tegra_i2c_wait_completion_timeout(struct tegra_i2c_dev *i2c_dev, · 20 unmodified lines
10291030 disable_irq(i2c_dev->irq);
10301031
10311032 /*
1032− * Under some rare circumstances (like running KASAN +
1033− * NFS root) CPU, which handles interrupt, may stuck in
1034− * uninterruptible state for a significant time. In this
1035− * case we will get timeout if I2C transfer is running on
1036− * a sibling CPU, despite of IRQ being raised.
1037− *
1038− * In order to handle this rare condition, the IRQ status
1039− * needs to be checked after timeout.
1033+ * There is a chance that completion may happen after IRQ
1034+ * synchronization, which is done by disable_irq().
10401035 */
1041− if (ret == 0)
1042− ret = tegra_i2c_poll_completion_timeout(i2c_dev,
1043− complete, 0);
1036+ if (ret == 0 && completion_done(complete)) {
1037+ dev_warn(i2c_dev->dev,
1038+ "completion done after timeout\n");
1039+ ret = 1;
1040+ }
10441041 }
10451042
10461043 return ret;
@@ -1219,15 +1216,6 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, · 172 unmodified lines
12191216 time_left = tegra_i2c_wait_completion_timeout(
12201217 i2c_dev, &i2c_dev->dma_complete, xfer_time);
12211218
1222− /*
1223− * Synchronize DMA first, since dmaengine_terminate_sync()
1224− * performs synchronization after the transfer's termination
1225− * and we want to get a completion if transfer succeeded.
1226− */
1227− dmaengine_synchronize(i2c_dev->msg_read ?
1228− i2c_dev->rx_dma_chan :
1229− i2c_dev->tx_dma_chan);
1230−
12311219 dmaengine_terminate_sync(i2c_dev->msg_read ?
12321220 i2c_dev->rx_dma_chan :
12331221 i2c_dev->tx_dma_chan);
drivers/infiniband/core/cm.c+14−12
@@ -862,7 +862,7 @@ static struct cm_id_private *cm_alloc_id_priv(struct ib_device *device, · 861 unmodified lines
862862
863863 ret = xa_alloc_cyclic_irq(&cm.local_id_table, &id, NULL, xa_limit_32b,
864864 &cm.local_id_next, GFP_KERNEL);
865− if (ret)
865+ if (ret < 0)
866866 goto error;
867867 cm_id_priv->id.local_id = (__force __be32)id ^ cm.random_id_operand;
868868
@@ -1828,11 +1828,9 @@ static void cm_format_mra(struct cm_mra_msg *mra_msg, · 959 unmodified lines
18281828
18291829 static void cm_format_rej(struct cm_rej_msg *rej_msg,
18301830 struct cm_id_private *cm_id_priv,
1831− enum ib_cm_rej_reason reason,
1832− void *ari,
1833− u8 ari_length,
1834− const void *private_data,
1835− u8 private_data_len)
1831+ enum ib_cm_rej_reason reason, void *ari,
1832+ u8 ari_length, const void *private_data,
1833+ u8 private_data_len, enum ib_cm_state state)
18361834 {
18371835 lockdep_assert_held(&cm_id_priv->lock);
18381836
@@ -1840,7 +1838,7 @@ static void cm_format_rej(struct cm_rej_msg *rej_msg, · 1 unmodified line
18401838 IBA_SET(CM_REJ_REMOTE_COMM_ID, rej_msg,
18411839 be32_to_cpu(cm_id_priv->id.remote_id));
18421840
1843− switch(cm_id_priv->id.state) {
1841+ switch (state) {
18441842 case IB_CM_REQ_RCVD:
18451843 IBA_SET(CM_REJ_LOCAL_COMM_ID, rej_msg, be32_to_cpu(0));
18461844 IBA_SET(CM_REJ_MESSAGE_REJECTED, rej_msg, CM_MSG_RESPONSE_REQ);
@@ -1905,8 +1903,9 @@ static void cm_dup_req_handler(struct cm_work *work, · 58 unmodified lines
19051903 cm_id_priv->private_data_len);
19061904 break;
19071905 case IB_CM_TIMEWAIT:
1908− cm_format_rej((struct cm_rej_msg *) msg->mad, cm_id_priv,
1909− IB_CM_REJ_STALE_CONN, NULL, 0, NULL, 0);
1906+ cm_format_rej((struct cm_rej_msg *)msg->mad, cm_id_priv,
1907+ IB_CM_REJ_STALE_CONN, NULL, 0, NULL, 0,
1908+ IB_CM_TIMEWAIT);
19101909 break;
19111910 default:
19121911 goto unlock;
@@ -2904,6 +2903,7 @@ static int cm_send_rej_locked(struct cm_id_private *cm_id_priv, · 991 unmodified lines
29042903 u8 ari_length, const void *private_data,
29052904 u8 private_data_len)
29062905 {
2906+ enum ib_cm_state state = cm_id_priv->id.state;
29072907 struct ib_mad_send_buf *msg;
29082908 int ret;
29092909
@@ -2913,7 +2913,7 @@ static int cm_send_rej_locked(struct cm_id_private *cm_id_priv, · 3 unmodified lines
29132913 (ari && ari_length > IB_CM_REJ_ARI_LENGTH))
29142914 return -EINVAL;
29152915
2916− switch (cm_id_priv->id.state) {
2916+ switch (state) {
29172917 case IB_CM_REQ_SENT:
29182918 case IB_CM_MRA_REQ_RCVD:
29192919 case IB_CM_REQ_RCVD:
@@ -2925,7 +2925,8 @@ static int cm_send_rej_locked(struct cm_id_private *cm_id_priv, · 5 unmodified lines
29252925 if (ret)
29262926 return ret;
29272927 cm_format_rej((struct cm_rej_msg *)msg->mad, cm_id_priv, reason,
2928− ari, ari_length, private_data, private_data_len);
2928+ ari, ari_length, private_data, private_data_len,
2929+ state);
29292930 break;
29302931 case IB_CM_REP_SENT:
29312932 case IB_CM_MRA_REP_RCVD:
@@ -2934,7 +2935,8 @@ static int cm_send_rej_locked(struct cm_id_private *cm_id_priv, · 2 unmodified lines
29342935 if (ret)
29352936 return ret;
29362937 cm_format_rej((struct cm_rej_msg *)msg->mad, cm_id_priv, reason,
2937− ari, ari_length, private_data, private_data_len);
2938+ ari, ari_length, private_data, private_data_len,
2939+ state);
29382940 break;
29392941 default:
29402942 pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__,
drivers/infiniband/core/rdma_core.c+4−5
@@ -360,7 +360,7 @@ lookup_get_fd_uobject(const struct uverbs_api_object *obj, · 359 unmodified lines
360360 * uverbs_uobject_fd_release(), and the caller is expected to ensure
361361 * that release is never done while a call to lookup is possible.
362362 */
363− if (f->f_op != fd_type->fops) {
363+ if (f->f_op != fd_type->fops || uobject->ufile != ufile) {
364364 fput(f);
365365 return ERR_PTR(-EBADF);
366366 }
@@ -474,16 +474,15 @@ alloc_begin_fd_uobject(const struct uverbs_api_object *obj, · 107 unmodified lines
474474 filp = anon_inode_getfile(fd_type->name, fd_type->fops, NULL,
475475 fd_type->flags);
476476 if (IS_ERR(filp)) {
477+ uverbs_uobject_put(uobj);
477478 uobj = ERR_CAST(filp);
478− goto err_uobj;
479+ goto err_fd;
479480 }
480481 uobj->object = filp;
481482
482483 uobj->id = new_fd;
483484 return uobj;
484485
485−err_uobj:
486− uverbs_uobject_put(uobj);
487486 err_fd:
488487 put_unused_fd(new_fd);
489488 return uobj;
@@ -679,7 +678,6 @@ void rdma_lookup_put_uobject(struct ib_uobject *uobj, · 189 unmodified lines
679678 enum rdma_lookup_mode mode)
680679 {
681680 assert_uverbs_usecnt(uobj, mode);
682− uobj->uapi_object->type_class->lookup_put(uobj, mode);
683681 /*
684682 * In order to unlock an object, either decrease its usecnt for
685683 * read access or zero it in case of exclusive access. See
@@ -696,6 +694,7 @@ void rdma_lookup_put_uobject(struct ib_uobject *uobj, · 10 unmodified lines
696694 break;
697695 }
698696
697+ uobj->uapi_object->type_class->lookup_put(uobj, mode);
699698 /* Pairs with the kref obtained by type->lookup_get */
700699 uverbs_uobject_put(uobj);
701700 }
drivers/infiniband/core/uverbs_main.c+4−0
@@ -820,6 +820,10 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) · 819 unmodified lines
820820 ret = mmget_not_zero(mm);
821821 if (!ret) {
822822 list_del_init(&priv->list);
823+ if (priv->entry) {
824+ rdma_user_mmap_entry_put(priv->entry);
825+ priv->entry = NULL;
826+ }
823827 mm = NULL;
824828 continue;
825829 }
drivers/infiniband/hw/i40iw/i40iw_ctrl.c+1−1
@@ -1046,7 +1046,7 @@ i40iw_sc_query_rdma_features(struct i40iw_sc_cqp *cqp, · 1045 unmodified lines
10461046 u64 header;
10471047
10481048 wqe = i40iw_sc_cqp_get_next_send_wqe(cqp, scratch);
1049− if (wqe)
1049+ if (!wqe)
10501050 return I40IW_ERR_RING_FULL;
10511051
10521052 set_64bit_val(wqe, 32, feat_mem->pa);
drivers/infiniband/hw/mlx4/main.c+2−1
@@ -1499,8 +1499,9 @@ static int __mlx4_ib_create_default_rules( · 1498 unmodified lines
14991499 int i;
15001500
15011501 for (i = 0; i < ARRAY_SIZE(pdefault_rules->rules_create_list); i++) {
1502+ union ib_flow_spec ib_spec = {};
15021503 int ret;
1503− union ib_flow_spec ib_spec;
1504+
15041505 switch (pdefault_rules->rules_create_list[i]) {
15051506 case 0:
15061507 /* no rule */
drivers/infiniband/hw/mlx5/qp.c+3−1
@@ -5558,7 +5558,9 @@ static void to_rdma_ah_attr(struct mlx5_ib_dev *ibdev, · 5557 unmodified lines
55585558 rdma_ah_set_path_bits(ah_attr, path->grh_mlid & 0x7f);
55595559 rdma_ah_set_static_rate(ah_attr,
55605560 path->static_rate ? path->static_rate - 5 : 0);
5561− if (path->grh_mlid & (1 << 7)) {
5561+
5562+ if (path->grh_mlid & (1 << 7) ||
5563+ ah_attr->type == RDMA_AH_ATTR_TYPE_ROCE) {
55625564 u32 tc_fl = be32_to_cpu(path->tclass_flowlabel);
55635565
55645566 rdma_ah_set_grh(ah_attr, NULL,
drivers/infiniband/sw/rdmavt/cq.c+2−2
@@ -248,8 +248,8 @@ int rvt_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, · 247 unmodified lines
248248 */
249249 if (udata && udata->outlen >= sizeof(__u64)) {
250250 cq->ip = rvt_create_mmap_info(rdi, sz, udata, u_wc);
251− if (!cq->ip) {
252− err = -ENOMEM;
251+ if (IS_ERR(cq->ip)) {
252+ err = PTR_ERR(cq->ip);
253253 goto bail_wc;
254254 }
255255
drivers/infiniband/sw/rdmavt/mmap.c+2−2
@@ -154,7 +154,7 @@ done: · 153 unmodified lines
154154 * @udata: user data (must be valid!)
155155 * @obj: opaque pointer to a cq, wq etc
156156 *
157− * Return: rvt_mmap struct on success
157+ * Return: rvt_mmap struct on success, ERR_PTR on failure
158158 */
159159 struct rvt_mmap_info *rvt_create_mmap_info(struct rvt_dev_info *rdi, u32 size,
160160 struct ib_udata *udata, void *obj)
@@ -166,7 +166,7 @@ struct rvt_mmap_info *rvt_create_mmap_info(struct rvt_dev_info *rdi, u32 size, · 5 unmodified lines
166166
167167 ip = kmalloc_node(sizeof(*ip), GFP_KERNEL, rdi->dparms.node);
168168 if (!ip)
169− return ip;
169+ return ERR_PTR(-ENOMEM);
170170
171171 size = PAGE_ALIGN(size);
172172
drivers/infiniband/sw/rdmavt/qp.c+2−2
@@ -1244,8 +1244,8 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd, · 1243 unmodified lines
12441244
12451245 qp->ip = rvt_create_mmap_info(rdi, s, udata,
12461246 qp->r_rq.wq);
1247− if (!qp->ip) {
1248− ret = ERR_PTR(-ENOMEM);
1247+ if (IS_ERR(qp->ip)) {
1248+ ret = ERR_CAST(qp->ip);
12491249 goto bail_qpn;
12501250 }
12511251
drivers/infiniband/sw/rdmavt/srq.c+2−2
@@ -111,8 +111,8 @@ int rvt_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *srq_init_attr, · 110 unmodified lines
111111 u32 s = sizeof(struct rvt_rwq) + srq->rq.size * sz;
112112
113113 srq->ip = rvt_create_mmap_info(dev, s, udata, srq->rq.wq);
114− if (!srq->ip) {
115− ret = -ENOMEM;
114+ if (IS_ERR(srq->ip)) {
115+ ret = PTR_ERR(srq->ip);
116116 goto bail_wq;
117117 }
118118
drivers/infiniband/sw/siw/siw_qp_tx.c+11−4
@@ -920,20 +920,27 @@ static int siw_fastreg_mr(struct ib_pd *pd, struct siw_sqe *sqe) · 919 unmodified lines
920920 {
921921 struct ib_mr *base_mr = (struct ib_mr *)(uintptr_t)sqe->base_mr;
922922 struct siw_device *sdev = to_siw_dev(pd->device);
923− struct siw_mem *mem = siw_mem_id2obj(sdev, sqe->rkey >> 8);
923+ struct siw_mem *mem;
924924 int rv = 0;
925925
926926 siw_dbg_pd(pd, "STag 0x%08x\n", sqe->rkey);
927927
928− if (unlikely(!mem || !base_mr)) {
928+ if (unlikely(!base_mr)) {
929929 pr_warn("siw: fastreg: STag 0x%08x unknown\n", sqe->rkey);
930930 return -EINVAL;
931931 }
932+
932933 if (unlikely(base_mr->rkey >> 8 != sqe->rkey >> 8)) {
933934 pr_warn("siw: fastreg: STag 0x%08x: bad MR\n", sqe->rkey);
934− rv = -EINVAL;
935− goto out;
935+ return -EINVAL;
936936 }
937+
938+ mem = siw_mem_id2obj(sdev, sqe->rkey >> 8);
939+ if (unlikely(!mem)) {
940+ pr_warn("siw: fastreg: STag 0x%08x unknown\n", sqe->rkey);
941+ return -EINVAL;
942+ }
943+
937944 if (unlikely(mem->pd != pd)) {
938945 pr_warn("siw: fastreg: PD mismatch\n");
939946 rv = -EINVAL;
drivers/interconnect/qcom/osm-l3.c+2−2
@@ -78,7 +78,7 @@ static struct qcom_icc_node *sdm845_osm_l3_nodes[] = { · 77 unmodified lines
7878 [SLAVE_OSM_L3] = &sdm845_osm_l3,
7979 };
8080
81−const static struct qcom_icc_desc sdm845_icc_osm_l3 = {
81+static const struct qcom_icc_desc sdm845_icc_osm_l3 = {
8282 .nodes = sdm845_osm_l3_nodes,
8383 .num_nodes = ARRAY_SIZE(sdm845_osm_l3_nodes),
8484 };
@@ -91,7 +91,7 @@ static struct qcom_icc_node *sc7180_osm_l3_nodes[] = { · 6 unmodified lines
9191 [SLAVE_OSM_L3] = &sc7180_osm_l3,
9292 };
9393
94−const static struct qcom_icc_desc sc7180_icc_osm_l3 = {
94+static const struct qcom_icc_desc sc7180_icc_osm_l3 = {
9595 .nodes = sc7180_osm_l3_nodes,
9696 .num_nodes = ARRAY_SIZE(sc7180_osm_l3_nodes),
9797 };
drivers/interconnect/qcom/sdm845.c+8−8
@@ -192,7 +192,7 @@ static struct qcom_icc_node *aggre1_noc_nodes[] = { · 191 unmodified lines
192192 [SLAVE_ANOC_PCIE_A1NOC_SNOC] = &qns_pcie_a1noc_snoc,
193193 };
194194
195−const static struct qcom_icc_desc sdm845_aggre1_noc = {
195+static const struct qcom_icc_desc sdm845_aggre1_noc = {
196196 .nodes = aggre1_noc_nodes,
197197 .num_nodes = ARRAY_SIZE(aggre1_noc_nodes),
198198 .bcms = aggre1_noc_bcms,
@@ -220,7 +220,7 @@ static struct qcom_icc_node *aggre2_noc_nodes[] = { · 21 unmodified lines
220220 [SLAVE_SERVICE_A2NOC] = &srvc_aggre2_noc,
221221 };
222222
223−const static struct qcom_icc_desc sdm845_aggre2_noc = {
223+static const struct qcom_icc_desc sdm845_aggre2_noc = {
224224 .nodes = aggre2_noc_nodes,
225225 .num_nodes = ARRAY_SIZE(aggre2_noc_nodes),
226226 .bcms = aggre2_noc_bcms,
@@ -281,7 +281,7 @@ static struct qcom_icc_node *config_noc_nodes[] = { · 54 unmodified lines
281281 [SLAVE_SERVICE_CNOC] = &srvc_cnoc,
282282 };
283283
284−const static struct qcom_icc_desc sdm845_config_noc = {
284+static const struct qcom_icc_desc sdm845_config_noc = {
285285 .nodes = config_noc_nodes,
286286 .num_nodes = ARRAY_SIZE(config_noc_nodes),
287287 .bcms = config_noc_bcms,
@@ -297,7 +297,7 @@ static struct qcom_icc_node *dc_noc_nodes[] = { · 9 unmodified lines
297297 [SLAVE_MEM_NOC_CFG] = &qhs_memnoc,
298298 };
299299
300−const static struct qcom_icc_desc sdm845_dc_noc = {
300+static const struct qcom_icc_desc sdm845_dc_noc = {
301301 .nodes = dc_noc_nodes,
302302 .num_nodes = ARRAY_SIZE(dc_noc_nodes),
303303 .bcms = dc_noc_bcms,
@@ -315,7 +315,7 @@ static struct qcom_icc_node *gladiator_noc_nodes[] = { · 11 unmodified lines
315315 [SLAVE_SERVICE_GNOC] = &srvc_gnoc,
316316 };
317317
318−const static struct qcom_icc_desc sdm845_gladiator_noc = {
318+static const struct qcom_icc_desc sdm845_gladiator_noc = {
319319 .nodes = gladiator_noc_nodes,
320320 .num_nodes = ARRAY_SIZE(gladiator_noc_nodes),
321321 .bcms = gladiator_noc_bcms,
@@ -350,7 +350,7 @@ static struct qcom_icc_node *mem_noc_nodes[] = { · 28 unmodified lines
350350 [SLAVE_EBI1] = &ebi,
351351 };
352352
353−const static struct qcom_icc_desc sdm845_mem_noc = {
353+static const struct qcom_icc_desc sdm845_mem_noc = {
354354 .nodes = mem_noc_nodes,
355355 .num_nodes = ARRAY_SIZE(mem_noc_nodes),
356356 .bcms = mem_noc_bcms,
@@ -384,7 +384,7 @@ static struct qcom_icc_node *mmss_noc_nodes[] = { · 27 unmodified lines
384384 [SLAVE_CAMNOC_UNCOMP] = &qns_camnoc_uncomp,
385385 };
386386
387−const static struct qcom_icc_desc sdm845_mmss_noc = {
387+static const struct qcom_icc_desc sdm845_mmss_noc = {
388388 .nodes = mmss_noc_nodes,
389389 .num_nodes = ARRAY_SIZE(mmss_noc_nodes),
390390 .bcms = mmss_noc_bcms,
@@ -430,7 +430,7 @@ static struct qcom_icc_node *system_noc_nodes[] = { · 39 unmodified lines
430430 [SLAVE_TCU] = &xs_sys_tcu_cfg,
431431 };
432432
433−const static struct qcom_icc_desc sdm845_system_noc = {
433+static const struct qcom_icc_desc sdm845_system_noc = {
434434 .nodes = system_noc_nodes,
435435 .num_nodes = ARRAY_SIZE(system_noc_nodes),
436436 .bcms = system_noc_bcms,
drivers/iommu/Kconfig+2−2
@@ -362,7 +362,7 @@ config IPMMU_VMSA · 361 unmodified lines
362362
363363 config SPAPR_TCE_IOMMU
364364 bool "sPAPR TCE IOMMU Support"
365− depends on PPC_POWERNV || PPC_PSERIES || (PPC && COMPILE_TEST)
365+ depends on PPC_POWERNV || PPC_PSERIES
366366 select IOMMU_API
367367 help
368368 Enables bits of IOMMU API required by VFIO. The iommu_ops
@@ -457,7 +457,7 @@ config S390_AP_IOMMU · 88 unmodified lines
457457
458458 config MTK_IOMMU
459459 bool "MTK IOMMU Support"
460− depends on ARM || ARM64 || COMPILE_TEST
460+ depends on HAS_DMA
461461 depends on ARCH_MEDIATEK || COMPILE_TEST
462462 select ARM_DMA_USE_IOMMU
463463 select IOMMU_API
drivers/iommu/amd_iommu.c+154−44
@@ -101,6 +101,8 @@ struct kmem_cache *amd_iommu_irq_cache; · 100 unmodified lines
101101 static void update_domain(struct protection_domain *domain);
102102 static int protection_domain_init(struct protection_domain *domain);
103103 static void detach_device(struct device *dev);
104+static void update_and_flush_device_table(struct protection_domain *domain,
105+ struct domain_pgtable *pgtable);
104106
105107 /****************************************************************************
106108 *
@@ -151,6 +153,26 @@ static struct protection_domain *to_pdomain(struct iommu_domain *dom) · 44 unmodified lines
151153 return container_of(dom, struct protection_domain, domain);
152154 }
153155
156+static void amd_iommu_domain_get_pgtable(struct protection_domain *domain,
157+ struct domain_pgtable *pgtable)
158+{
159+ u64 pt_root = atomic64_read(&domain->pt_root);
160+
161+ pgtable->root = (u64 *)(pt_root & PAGE_MASK);
162+ pgtable->mode = pt_root & 7; /* lowest 3 bits encode pgtable mode */
163+}
164+
165+static u64 amd_iommu_domain_encode_pgtable(u64 *root, int mode)
166+{
167+ u64 pt_root;
168+
169+ /* lowest 3 bits encode pgtable mode */
170+ pt_root = mode & 7;
171+ pt_root |= (u64)root;
172+
173+ return pt_root;
174+}
175+
154176 static struct iommu_dev_data *alloc_dev_data(u16 devid)
155177 {
156178 struct iommu_dev_data *dev_data;
@@ -1397,13 +1419,18 @@ static struct page *free_sub_pt(unsigned long root, int mode, · 1240 unmodified lines
13971419
13981420 static void free_pagetable(struct protection_domain *domain)
13991421 {
1400− unsigned long root = (unsigned long)domain->pt_root;
1422+ struct domain_pgtable pgtable;
14011423 struct page *freelist = NULL;
1424+ unsigned long root;
14021425
1403− BUG_ON(domain->mode < PAGE_MODE_NONE ||
1404− domain->mode > PAGE_MODE_6_LEVEL);
1426+ amd_iommu_domain_get_pgtable(domain, &pgtable);
1427+ atomic64_set(&domain->pt_root, 0);
14051428
1406− freelist = free_sub_pt(root, domain->mode, freelist);
1429+ BUG_ON(pgtable.mode < PAGE_MODE_NONE ||
1430+ pgtable.mode > PAGE_MODE_6_LEVEL);
1431+
1432+ root = (unsigned long)pgtable.root;
1433+ freelist = free_sub_pt(root, pgtable.mode, freelist);
14071434
14081435 free_page_list(freelist);
14091436 }
@@ -1417,24 +1444,39 @@ static bool increase_address_space(struct protection_domain *domain, · 7 unmodified lines
14171444 unsigned long address,
14181445 gfp_t gfp)
14191446 {
1447+ struct domain_pgtable pgtable;
14201448 unsigned long flags;
1421− bool ret = false;
1422− u64 *pte;
1449+ bool ret = true;
1450+ u64 *pte, root;
14231451
14241452 spin_lock_irqsave(&domain->lock, flags);
14251453
1426− if (address <= PM_LEVEL_SIZE(domain->mode) ||
1427− WARN_ON_ONCE(domain->mode == PAGE_MODE_6_LEVEL))
1454+ amd_iommu_domain_get_pgtable(domain, &pgtable);
1455+
1456+ if (address <= PM_LEVEL_SIZE(pgtable.mode))
1457+ goto out;
1458+
1459+ ret = false;
1460+ if (WARN_ON_ONCE(pgtable.mode == PAGE_MODE_6_LEVEL))
14281461 goto out;
14291462
14301463 pte = (void *)get_zeroed_page(gfp);
14311464 if (!pte)
14321465 goto out;
14331466
1434− *pte = PM_LEVEL_PDE(domain->mode,
1435− iommu_virt_to_phys(domain->pt_root));
1436− domain->pt_root = pte;
1437− domain->mode += 1;
1467+ *pte = PM_LEVEL_PDE(pgtable.mode, iommu_virt_to_phys(pgtable.root));
1468+
1469+ pgtable.root = pte;
1470+ pgtable.mode += 1;
1471+ update_and_flush_device_table(domain, &pgtable);
1472+ domain_flush_complete(domain);
1473+
1474+ /*
1475+ * Device Table needs to be updated and flushed before the new root can
1476+ * be published.
1477+ */
1478+ root = amd_iommu_domain_encode_pgtable(pte, pgtable.mode);
1479+ atomic64_set(&domain->pt_root, root);
14381480
14391481 ret = true;
14401482
@@ -1451,16 +1493,29 @@ static u64 *alloc_pte(struct protection_domain *domain, · 10 unmodified lines
14511493 gfp_t gfp,
14521494 bool *updated)
14531495 {
1496+ struct domain_pgtable pgtable;
14541497 int level, end_lvl;
14551498 u64 *pte, *page;
14561499
14571500 BUG_ON(!is_power_of_2(page_size));
14581501
1459− while (address > PM_LEVEL_SIZE(domain->mode))
1460− *updated = increase_address_space(domain, address, gfp) || *updated;
1502+ amd_iommu_domain_get_pgtable(domain, &pgtable);
1503+
1504+ while (address > PM_LEVEL_SIZE(pgtable.mode)) {
1505+ /*
1506+ * Return an error if there is no memory to update the
1507+ * page-table.
1508+ */
1509+ if (!increase_address_space(domain, address, gfp))
1510+ return NULL;
1511+
1512+ /* Read new values to check if update was successful */
1513+ amd_iommu_domain_get_pgtable(domain, &pgtable);
1514+ }
1515+
14611516
1462− level = domain->mode - 1;
1463− pte = &domain->pt_root[PM_LEVEL_INDEX(level, address)];
1517+ level = pgtable.mode - 1;
1518+ pte = &pgtable.root[PM_LEVEL_INDEX(level, address)];
14641519 address = PAGE_SIZE_ALIGN(address, page_size);
14651520 end_lvl = PAGE_SIZE_LEVEL(page_size);
14661521
@@ -1536,16 +1591,19 @@ static u64 *fetch_pte(struct protection_domain *domain, · 69 unmodified lines
15361591 unsigned long address,
15371592 unsigned long *page_size)
15381593 {
1594+ struct domain_pgtable pgtable;
15391595 int level;
15401596 u64 *pte;
15411597
15421598 *page_size = 0;
15431599
1544− if (address > PM_LEVEL_SIZE(domain->mode))
1600+ amd_iommu_domain_get_pgtable(domain, &pgtable);
1601+
1602+ if (address > PM_LEVEL_SIZE(pgtable.mode))
15451603 return NULL;
15461604
1547− level = domain->mode - 1;
1548− pte = &domain->pt_root[PM_LEVEL_INDEX(level, address)];
1605+ level = pgtable.mode - 1;
1606+ pte = &pgtable.root[PM_LEVEL_INDEX(level, address)];
15491607 *page_size = PTE_LEVEL_PAGE_SIZE(level);
15501608
15511609 while (level > 0) {
@@ -1660,7 +1718,13 @@ out: · 108 unmodified lines
16601718 unsigned long flags;
16611719
16621720 spin_lock_irqsave(&dom->lock, flags);
1663− update_domain(dom);
1721+ /*
1722+ * Flush domain TLB(s) and wait for completion. Any Device-Table
1723+ * Updates and flushing already happened in
1724+ * increase_address_space().
1725+ */
1726+ domain_flush_tlb_pde(dom);
1727+ domain_flush_complete(dom);
16641728 spin_unlock_irqrestore(&dom->lock, flags);
16651729 }
16661730
@@ -1806,6 +1870,7 @@ static void dma_ops_domain_free(struct protection_domain *domain) · 139 unmodified lines
18061870 static struct protection_domain *dma_ops_domain_alloc(void)
18071871 {
18081872 struct protection_domain *domain;
1873+ u64 *pt_root, root;
18091874
18101875 domain = kzalloc(sizeof(struct protection_domain), GFP_KERNEL);
18111876 if (!domain)
@@ -1814,12 +1879,14 @@ static struct protection_domain *dma_ops_domain_alloc(void) · 2 unmodified lines
18141879 if (protection_domain_init(domain))
18151880 goto free_domain;
18161881
1817− domain->mode = PAGE_MODE_3_LEVEL;
1818− domain->pt_root = (void *)get_zeroed_page(GFP_KERNEL);
1819− domain->flags = PD_DMA_OPS_MASK;
1820− if (!domain->pt_root)
1882+ pt_root = (void *)get_zeroed_page(GFP_KERNEL);
1883+ if (!pt_root)
18211884 goto free_domain;
18221885
1886+ root = amd_iommu_domain_encode_pgtable(pt_root, PAGE_MODE_3_LEVEL);
1887+ atomic64_set(&domain->pt_root, root);
1888+ domain->flags = PD_DMA_OPS_MASK;
1889+
18231890 if (iommu_get_dma_cookie(&domain->domain) == -ENOMEM)
18241891 goto free_domain;
18251892
@@ -1841,16 +1908,17 @@ static bool dma_ops_domain(struct protection_domain *domain) · 15 unmodified lines
18411908 }
18421909
18431910 static void set_dte_entry(u16 devid, struct protection_domain *domain,
1911+ struct domain_pgtable *pgtable,
18441912 bool ats, bool ppr)
18451913 {
18461914 u64 pte_root = 0;
18471915 u64 flags = 0;
18481916 u32 old_domid;
18491917
1850− if (domain->mode != PAGE_MODE_NONE)
1851− pte_root = iommu_virt_to_phys(domain->pt_root);
1918+ if (pgtable->mode != PAGE_MODE_NONE)
1919+ pte_root = iommu_virt_to_phys(pgtable->root);
18521920
1853− pte_root |= (domain->mode & DEV_ENTRY_MODE_MASK)
1921+ pte_root |= (pgtable->mode & DEV_ENTRY_MODE_MASK)
18541922 << DEV_ENTRY_MODE_SHIFT;
18551923 pte_root |= DTE_FLAG_IR | DTE_FLAG_IW | DTE_FLAG_V | DTE_FLAG_TV;
18561924
@@ -1923,6 +1991,7 @@ static void clear_dte_entry(u16 devid) · 66 unmodified lines
19231991 static void do_attach(struct iommu_dev_data *dev_data,
19241992 struct protection_domain *domain)
19251993 {
1994+ struct domain_pgtable pgtable;
19261995 struct amd_iommu *iommu;
19271996 bool ats;
19281997
@@ -1938,7 +2007,9 @@ static void do_attach(struct iommu_dev_data *dev_data, · 9 unmodified lines
19382007 domain->dev_cnt += 1;
19392008
19402009 /* Update device table */
1941− set_dte_entry(dev_data->devid, domain, ats, dev_data->iommu_v2);
2010+ amd_iommu_domain_get_pgtable(domain, &pgtable);
2011+ set_dte_entry(dev_data->devid, domain, &pgtable,
2012+ ats, dev_data->iommu_v2);
19422013 clone_aliases(dev_data->pdev);
19432014
19442015 device_flush_dte(dev_data);
@@ -2249,23 +2320,36 @@ static int amd_iommu_domain_get_attr(struct iommu_domain *domain, · 304 unmodified lines
22492320 *
22502321 *****************************************************************************/
22512322
2252−static void update_device_table(struct protection_domain *domain)
2323+static void update_device_table(struct protection_domain *domain,
2324+ struct domain_pgtable *pgtable)
22532325 {
22542326 struct iommu_dev_data *dev_data;
22552327
22562328 list_for_each_entry(dev_data, &domain->dev_list, list) {
2257− set_dte_entry(dev_data->devid, domain, dev_data->ats.enabled,
2258− dev_data->iommu_v2);
2329+ set_dte_entry(dev_data->devid, domain, pgtable,
2330+ dev_data->ats.enabled, dev_data->iommu_v2);
22592331 clone_aliases(dev_data->pdev);
22602332 }
22612333 }
22622334
2335+static void update_and_flush_device_table(struct protection_domain *domain,
2336+ struct domain_pgtable *pgtable)
2337+{
2338+ update_device_table(domain, pgtable);
2339+ domain_flush_devices(domain);
2340+}
2341+
22632342 static void update_domain(struct protection_domain *domain)
22642343 {
2265− update_device_table(domain);
2344+ struct domain_pgtable pgtable;
22662345
2267− domain_flush_devices(domain);
2346+ /* Update device table */
2347+ amd_iommu_domain_get_pgtable(domain, &pgtable);
2348+ update_and_flush_device_table(domain, &pgtable);
2349+
2350+ /* Flush domain TLB(s) and wait for completion */
22682351 domain_flush_tlb_pde(domain);
2352+ domain_flush_complete(domain);
22692353 }
22702354
22712355 int __init amd_iommu_init_api(void)
@@ -2375,6 +2459,7 @@ out_err: · 103 unmodified lines
23752459 static struct iommu_domain *amd_iommu_domain_alloc(unsigned type)
23762460 {
23772461 struct protection_domain *pdomain;
2462+ u64 *pt_root, root;
23782463
23792464 switch (type) {
23802465 case IOMMU_DOMAIN_UNMANAGED:
@@ -2382,13 +2467,15 @@ static struct iommu_domain *amd_iommu_domain_alloc(unsigned type) · 1 unmodified line
23822467 if (!pdomain)
23832468 return NULL;
23842469
2385− pdomain->mode = PAGE_MODE_3_LEVEL;
2386− pdomain->pt_root = (void *)get_zeroed_page(GFP_KERNEL);
2387− if (!pdomain->pt_root) {
2470+ pt_root = (void *)get_zeroed_page(GFP_KERNEL);
2471+ if (!pt_root) {
23882472 protection_domain_free(pdomain);
23892473 return NULL;
23902474 }
23912475
2476+ root = amd_iommu_domain_encode_pgtable(pt_root, PAGE_MODE_3_LEVEL);
2477+ atomic64_set(&pdomain->pt_root, root);
2478+
23922479 pdomain->domain.geometry.aperture_start = 0;
23932480 pdomain->domain.geometry.aperture_end = ~0ULL;
23942481 pdomain->domain.geometry.force_aperture = true;
@@ -2406,7 +2493,7 @@ static struct iommu_domain *amd_iommu_domain_alloc(unsigned type) · 11 unmodified lines
24062493 if (!pdomain)
24072494 return NULL;
24082495
2409− pdomain->mode = PAGE_MODE_NONE;
2496+ atomic64_set(&pdomain->pt_root, PAGE_MODE_NONE);
24102497 break;
24112498 default:
24122499 return NULL;
@@ -2418,6 +2505,7 @@ static struct iommu_domain *amd_iommu_domain_alloc(unsigned type) · 5 unmodified lines
24182505 static void amd_iommu_domain_free(struct iommu_domain *dom)
24192506 {
24202507 struct protection_domain *domain;
2508+ struct domain_pgtable pgtable;
24212509
24222510 domain = to_pdomain(dom);
24232511
@@ -2435,7 +2523,9 @@ static void amd_iommu_domain_free(struct iommu_domain *dom) · 11 unmodified lines
24352523 dma_ops_domain_free(domain);
24362524 break;
24372525 default:
2438− if (domain->mode != PAGE_MODE_NONE)
2526+ amd_iommu_domain_get_pgtable(domain, &pgtable);
2527+
2528+ if (pgtable.mode != PAGE_MODE_NONE)
24392529 free_pagetable(domain);
24402530
24412531 if (domain->flags & PD_IOMMUV2_MASK)
@@ -2518,10 +2608,12 @@ static int amd_iommu_map(struct iommu_domain *dom, unsigned long iova, · 76 unmodified lines
25182608 gfp_t gfp)
25192609 {
25202610 struct protection_domain *domain = to_pdomain(dom);
2611+ struct domain_pgtable pgtable;
25212612 int prot = 0;
25222613 int ret;
25232614
2524− if (domain->mode == PAGE_MODE_NONE)
2615+ amd_iommu_domain_get_pgtable(domain, &pgtable);
2616+ if (pgtable.mode == PAGE_MODE_NONE)
25252617 return -EINVAL;
25262618
25272619 if (iommu_prot & IOMMU_READ)
@@ -2541,8 +2633,10 @@ static size_t amd_iommu_unmap(struct iommu_domain *dom, unsigned long iova, · 13 unmodified lines
25412633 struct iommu_iotlb_gather *gather)
25422634 {
25432635 struct protection_domain *domain = to_pdomain(dom);
2636+ struct domain_pgtable pgtable;
25442637
2545− if (domain->mode == PAGE_MODE_NONE)
2638+ amd_iommu_domain_get_pgtable(domain, &pgtable);
2639+ if (pgtable.mode == PAGE_MODE_NONE)
25462640 return 0;
25472641
25482642 return iommu_unmap_page(domain, iova, page_size);
@@ -2553,9 +2647,11 @@ static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom, · 4 unmodified lines
25532647 {
25542648 struct protection_domain *domain = to_pdomain(dom);
25552649 unsigned long offset_mask, pte_pgsize;
2650+ struct domain_pgtable pgtable;
25562651 u64 *pte, __pte;
25572652
2558− if (domain->mode == PAGE_MODE_NONE)
2653+ amd_iommu_domain_get_pgtable(domain, &pgtable);
2654+ if (pgtable.mode == PAGE_MODE_NONE)
25592655 return iova;
25602656
25612657 pte = fetch_pte(domain, iova, &pte_pgsize);
@@ -2708,16 +2804,26 @@ EXPORT_SYMBOL(amd_iommu_unregister_ppr_notifier); · 146 unmodified lines
27082804 void amd_iommu_domain_direct_map(struct iommu_domain *dom)
27092805 {
27102806 struct protection_domain *domain = to_pdomain(dom);
2807+ struct domain_pgtable pgtable;
27112808 unsigned long flags;
2809+ u64 pt_root;
27122810
27132811 spin_lock_irqsave(&domain->lock, flags);
27142812
2813+ /* First save pgtable configuration*/
2814+ amd_iommu_domain_get_pgtable(domain, &pgtable);
2815+
27152816 /* Update data structure */
2716− domain->mode = PAGE_MODE_NONE;
2817+ pt_root = amd_iommu_domain_encode_pgtable(NULL, PAGE_MODE_NONE);
2818+ atomic64_set(&domain->pt_root, pt_root);
27172819
27182820 /* Make changes visible to IOMMUs */
27192821 update_domain(domain);
27202822
2823+ /* Restore old pgtable in domain->ptroot to free page-table */
2824+ pt_root = amd_iommu_domain_encode_pgtable(pgtable.root, pgtable.mode);
2825+ atomic64_set(&domain->pt_root, pt_root);
2826+
27212827 /* Page-table is not visible to IOMMU anymore, so free it */
27222828 free_pagetable(domain);
27232829
@@ -2908,9 +3014,11 @@ static u64 *__get_gcr3_pte(u64 *root, int level, int pasid, bool alloc) · 184 unmodified lines
29083014 static int __set_gcr3(struct protection_domain *domain, int pasid,
29093015 unsigned long cr3)
29103016 {
3017+ struct domain_pgtable pgtable;
29113018 u64 *pte;
29123019
2913− if (domain->mode != PAGE_MODE_NONE)
3020+ amd_iommu_domain_get_pgtable(domain, &pgtable);
3021+ if (pgtable.mode != PAGE_MODE_NONE)
29143022 return -EINVAL;
29153023
29163024 pte = __get_gcr3_pte(domain->gcr3_tbl, domain->glx, pasid, true);
@@ -2924,9 +3032,11 @@ static int __set_gcr3(struct protection_domain *domain, int pasid, · 7 unmodified lines
29243032
29253033 static int __clear_gcr3(struct protection_domain *domain, int pasid)
29263034 {
3035+ struct domain_pgtable pgtable;
29273036 u64 *pte;
29283037
2929− if (domain->mode != PAGE_MODE_NONE)
3038+ amd_iommu_domain_get_pgtable(domain, &pgtable);
3039+ if (pgtable.mode != PAGE_MODE_NONE)
29303040 return -EINVAL;
29313041
29323042 pte = __get_gcr3_pte(domain->gcr3_tbl, domain->glx, pasid, false);
drivers/iommu/amd_iommu_init.c+1−1
@@ -2936,7 +2936,7 @@ static int __init parse_amd_iommu_intr(char *str) · 2935 unmodified lines
29362936 {
29372937 for (; *str; ++str) {
29382938 if (strncmp(str, "legacy", 6) == 0) {
2939− amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY;
2939+ amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY_GA;
29402940 break;
29412941 }
29422942 if (strncmp(str, "vapic", 5) == 0) {
drivers/iommu/amd_iommu_types.h+7−2
@@ -468,8 +468,7 @@ struct protection_domain { · 467 unmodified lines
468468 iommu core code */
469469 spinlock_t lock; /* mostly used to lock the page table*/
470470 u16 id; /* the domain id written to the device table */
471− int mode; /* paging mode (0-6 levels) */
472− u64 *pt_root; /* page table root pointer */
471+ atomic64_t pt_root; /* pgtable root and pgtable mode */
473472 int glx; /* Number of levels for GCR3 table */
474473 u64 *gcr3_tbl; /* Guest CR3 table */
475474 unsigned long flags; /* flags to find out type of domain */
@@ -477,6 +476,12 @@ struct protection_domain { · 1 unmodified line
477476 unsigned dev_iommu[MAX_IOMMUS]; /* per-IOMMU reference count */
478477 };
479478
479+/* For decocded pt_root */
480+struct domain_pgtable {
481+ int mode;
482+ u64 *root;
483+};
484+
480485 /*
481486 * Structure where we save information about one hardware AMD IOMMU in the
482487 * system.
drivers/iommu/intel-iommu.c+2−2
@@ -371,11 +371,11 @@ int dmar_disabled = 0; · 370 unmodified lines
371371 int dmar_disabled = 1;
372372 #endif /* CONFIG_INTEL_IOMMU_DEFAULT_ON */
373373
374−#ifdef INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON
374+#ifdef CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON
375375 int intel_iommu_sm = 1;
376376 #else
377377 int intel_iommu_sm;
378−#endif /* INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON */
378+#endif /* CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON */
379379
380380 int intel_iommu_enabled = 0;
381381 EXPORT_SYMBOL_GPL(intel_iommu_enabled);
drivers/iommu/iommu.c+2−1
@@ -170,6 +170,7 @@ static struct dev_iommu *dev_iommu_get(struct device *dev) · 169 unmodified lines
170170
171171 static void dev_iommu_free(struct device *dev)
172172 {
173+ iommu_fwspec_free(dev);
173174 kfree(dev->iommu);
174175 dev->iommu = NULL;
175176 }
@@ -1428,7 +1429,7 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev) · 1252 unmodified lines
14281429
14291430 return group;
14301431 }
1431−EXPORT_SYMBOL(iommu_group_get_for_dev);
1432+EXPORT_SYMBOL_GPL(iommu_group_get_for_dev);
14321433
14331434 struct iommu_domain *iommu_group_default_domain(struct iommu_group *group)
14341435 {
drivers/iommu/qcom_iommu.c+4−1
@@ -824,8 +824,11 @@ static int qcom_iommu_device_probe(struct platform_device *pdev) · 823 unmodified lines
824824 qcom_iommu->dev = dev;
825825
826826 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
827− if (res)
827+ if (res) {
828828 qcom_iommu->local_base = devm_ioremap_resource(dev, res);
829+ if (IS_ERR(qcom_iommu->local_base))
830+ return PTR_ERR(qcom_iommu->local_base);
831+ }
829832
830833 qcom_iommu->iface_clk = devm_clk_get(dev, "iface");
831834 if (IS_ERR(qcom_iommu->iface_clk)) {
drivers/iommu/virtio-iommu.c+1−1
@@ -453,7 +453,7 @@ static int viommu_add_resv_mem(struct viommu_endpoint *vdev, · 452 unmodified lines
453453 if (!region)
454454 return -ENOMEM;
455455
456− list_add(&vdev->resv_regions, &region->list);
456+ list_add(&region->list, &vdev->resv_regions);
457457 return 0;
458458 }
459459
drivers/md/dm-mpath.c+4−2
@@ -585,10 +585,12 @@ static struct pgpath *__map_bio(struct multipath *m, struct bio *bio) · 584 unmodified lines
585585
586586 /* Do we need to select a new pgpath? */
587587 pgpath = READ_ONCE(m->current_pgpath);
588− queue_io = test_bit(MPATHF_QUEUE_IO, &m->flags);
589− if (!pgpath || !queue_io)
588+ if (!pgpath || !test_bit(MPATHF_QUEUE_IO, &m->flags))
590589 pgpath = choose_pgpath(m, bio->bi_iter.bi_size);
591590
591+ /* MPATHF_QUEUE_IO might have been cleared by choose_pgpath. */
592+ queue_io = test_bit(MPATHF_QUEUE_IO, &m->flags);
593+
592594 if ((pgpath && queue_io) ||
593595 (!pgpath && test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))) {
594596 /* Queue for the daemon to resubmit */
drivers/md/dm-verity-fec.c+1−1
@@ -435,7 +435,7 @@ int verity_fec_decode(struct dm_verity *v, struct dm_verity_io *io, · 434 unmodified lines
435435 fio->level++;
436436
437437 if (type == DM_VERITY_BLOCK_TYPE_METADATA)
438− block += v->data_blocks;
438+ block = block - v->hash_start + v->data_blocks;
439439
440440 /*
441441 * For RS(M, N), the continuous FEC data is divided into blocks of N
drivers/md/dm-writecache.c+37−15
@@ -931,6 +931,24 @@ static int writecache_alloc_entries(struct dm_writecache *wc) · 930 unmodified lines
931931 return 0;
932932 }
933933
934+static int writecache_read_metadata(struct dm_writecache *wc, sector_t n_sectors)
935+{
936+ struct dm_io_region region;
937+ struct dm_io_request req;
938+
939+ region.bdev = wc->ssd_dev->bdev;
940+ region.sector = wc->start_sector;
941+ region.count = n_sectors;
942+ req.bi_op = REQ_OP_READ;
943+ req.bi_op_flags = REQ_SYNC;
944+ req.mem.type = DM_IO_VMA;
945+ req.mem.ptr.vma = (char *)wc->memory_map;
946+ req.client = wc->dm_io;
947+ req.notify.fn = NULL;
948+
949+ return dm_io(&req, 1, &region, NULL);
950+}
951+
934952 static void writecache_resume(struct dm_target *ti)
935953 {
936954 struct dm_writecache *wc = ti->private;
@@ -941,8 +959,18 @@ static void writecache_resume(struct dm_target *ti) · 4 unmodified lines
941959
942960 wc_lock(wc);
943961
944− if (WC_MODE_PMEM(wc))
962+ if (WC_MODE_PMEM(wc)) {
945963 persistent_memory_invalidate_cache(wc->memory_map, wc->memory_map_size);
964+ } else {
965+ r = writecache_read_metadata(wc, wc->metadata_sectors);
966+ if (r) {
967+ size_t sb_entries_offset;
968+ writecache_error(wc, r, "unable to read metadata: %d", r);
969+ sb_entries_offset = offsetof(struct wc_memory_superblock, entries);
970+ memset((char *)wc->memory_map + sb_entries_offset, -1,
971+ (wc->metadata_sectors << SECTOR_SHIFT) - sb_entries_offset);
972+ }
973+ }
946974
947975 wc->tree = RB_ROOT;
948976 INIT_LIST_HEAD(&wc->lru);
@@ -2102,6 +2130,12 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv) · 1153 unmodified lines
21022130 ti->error = "Invalid block size";
21032131 goto bad;
21042132 }
2133+ if (wc->block_size < bdev_logical_block_size(wc->dev->bdev) ||
2134+ wc->block_size < bdev_logical_block_size(wc->ssd_dev->bdev)) {
2135+ r = -EINVAL;
2136+ ti->error = "Block size is smaller than device logical block size";
2137+ goto bad;
2138+ }
21052139 wc->block_size_bits = __ffs(wc->block_size);
21062140
21072141 wc->max_writeback_jobs = MAX_WRITEBACK_JOBS;
@@ -2200,8 +2234,6 @@ invalid_optional: · 92 unmodified lines
22002234 goto bad;
22012235 }
22022236 } else {
2203− struct dm_io_region region;
2204− struct dm_io_request req;
22052237 size_t n_blocks, n_metadata_blocks;
22062238 uint64_t n_bitmap_bits;
22072239
@@ -2258,19 +2290,9 @@ invalid_optional: · 50 unmodified lines
22582290 goto bad;
22592291 }
22602292
2261− region.bdev = wc->ssd_dev->bdev;
2262− region.sector = wc->start_sector;
2263− region.count = wc->metadata_sectors;
2264− req.bi_op = REQ_OP_READ;
2265− req.bi_op_flags = REQ_SYNC;
2266− req.mem.type = DM_IO_VMA;
2267− req.mem.ptr.vma = (char *)wc->memory_map;
2268− req.client = wc->dm_io;
2269− req.notify.fn = NULL;
2270−
2271− r = dm_io(&req, 1, &region, NULL);
2293+ r = writecache_read_metadata(wc, wc->block_size >> SECTOR_SHIFT);
22722294 if (r) {
2273− ti->error = "Unable to read metadata";
2295+ ti->error = "Unable to read first block of metadata";
22742296 goto bad;
22752297 }
22762298 }
drivers/misc/mei/hw-me.c+8−0
@@ -1465,6 +1465,13 @@ static const struct mei_cfg mei_me_pch12_cfg = { · 1464 unmodified lines
14651465 MEI_CFG_DMA_128,
14661466 };
14671467
1468+/* LBG with quirk for SPS Firmware exclusion */
1469+static const struct mei_cfg mei_me_pch12_sps_cfg = {
1470+ MEI_CFG_PCH8_HFS,
1471+ MEI_CFG_FW_VER_SUPP,
1472+ MEI_CFG_FW_SPS,
1473+};
1474+
14681475 /* Tiger Lake and newer devices */
14691476 static const struct mei_cfg mei_me_pch15_cfg = {
14701477 MEI_CFG_PCH8_HFS,
@@ -1487,6 +1494,7 @@ static const struct mei_cfg *const mei_cfg_list[] = { · 16 unmodified lines
14871494 [MEI_ME_PCH8_CFG] = &mei_me_pch8_cfg,
14881495 [MEI_ME_PCH8_SPS_CFG] = &mei_me_pch8_sps_cfg,
14891496 [MEI_ME_PCH12_CFG] = &mei_me_pch12_cfg,
1497+ [MEI_ME_PCH12_SPS_CFG] = &mei_me_pch12_sps_cfg,
14901498 [MEI_ME_PCH15_CFG] = &mei_me_pch15_cfg,
14911499 };
14921500
drivers/misc/mei/hw-me.h+4−0
@@ -80,6 +80,9 @@ struct mei_me_hw { · 79 unmodified lines
8080 * servers platforms with quirk for
8181 * SPS firmware exclusion.
8282 * @MEI_ME_PCH12_CFG: Platform Controller Hub Gen12 and newer
83+ * @MEI_ME_PCH12_SPS_CFG: Platform Controller Hub Gen12 and newer
84+ * servers platforms with quirk for
85+ * SPS firmware exclusion.
8386 * @MEI_ME_PCH15_CFG: Platform Controller Hub Gen15 and newer
8487 * @MEI_ME_NUM_CFG: Upper Sentinel.
8588 */
@@ -93,6 +96,7 @@ enum mei_cfg_idx { · 7 unmodified lines
9396 MEI_ME_PCH8_CFG,
9497 MEI_ME_PCH8_SPS_CFG,
9598 MEI_ME_PCH12_CFG,
99+ MEI_ME_PCH12_SPS_CFG,
96100 MEI_ME_PCH15_CFG,
97101 MEI_ME_NUM_CFG,
98102 };
drivers/misc/mei/pci-me.c+1−1
@@ -70,7 +70,7 @@ static const struct pci_device_id mei_me_pci_tbl[] = { · 69 unmodified lines
7070 {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_2, MEI_ME_PCH8_CFG)},
7171 {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H, MEI_ME_PCH8_SPS_CFG)},
7272 {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H_2, MEI_ME_PCH8_SPS_CFG)},
73− {MEI_PCI_DEVICE(MEI_DEV_ID_LBG, MEI_ME_PCH12_CFG)},
73+ {MEI_PCI_DEVICE(MEI_DEV_ID_LBG, MEI_ME_PCH12_SPS_CFG)},
7474
7575 {MEI_PCI_DEVICE(MEI_DEV_ID_BXT_M, MEI_ME_PCH8_CFG)},
7676 {MEI_PCI_DEVICE(MEI_DEV_ID_APL_I, MEI_ME_PCH8_CFG)},
drivers/mmc/core/mmc_ops.c+1−1
@@ -878,7 +878,7 @@ static int mmc_send_hpi_cmd(struct mmc_card *card) · 877 unmodified lines
878878 * Issued High Priority Interrupt, and check for card status
879879 * until out-of prg-state.
880880 */
881−int mmc_interrupt_hpi(struct mmc_card *card)
881+static int mmc_interrupt_hpi(struct mmc_card *card)
882882 {
883883 int err;
884884 u32 status;
drivers/mmc/host/cqhci.c+10−11
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 #include <linux/delay.h>
66 #include <linux/highmem.h>
77 #include <linux/io.h>
8+#include <linux/iopoll.h>
89 #include <linux/module.h>
910 #include <linux/dma-mapping.h>
1011 #include <linux/slab.h>
@@ -349,12 +350,16 @@ static int cqhci_enable(struct mmc_host *mmc, struct mmc_card *card) · 338 unmodified lines
349350 /* CQHCI is idle and should halt immediately, so set a small timeout */
350351 #define CQHCI_OFF_TIMEOUT 100
351352
353+static u32 cqhci_read_ctl(struct cqhci_host *cq_host)
354+{
355+ return cqhci_readl(cq_host, CQHCI_CTL);
356+}
357+
352358 static void cqhci_off(struct mmc_host *mmc)
353359 {
354360 struct cqhci_host *cq_host = mmc->cqe_private;
355− ktime_t timeout;
356− bool timed_out;
357361 u32 reg;
362+ int err;
358363
359364 if (!cq_host->enabled || !mmc->cqe_on || cq_host->recovery_halt)
360365 return;
@@ -364,15 +369,9 @@ static void cqhci_off(struct mmc_host *mmc) · 3 unmodified lines
364369
365370 cqhci_writel(cq_host, CQHCI_HALT, CQHCI_CTL);
366371
367− timeout = ktime_add_us(ktime_get(), CQHCI_OFF_TIMEOUT);
368− while (1) {
369− timed_out = ktime_compare(ktime_get(), timeout) > 0;
370− reg = cqhci_readl(cq_host, CQHCI_CTL);
371− if ((reg & CQHCI_HALT) || timed_out)
372− break;
373− }
374−
375− if (timed_out)
372+ err = readx_poll_timeout(cqhci_read_ctl, cq_host, reg,
373+ reg & CQHCI_HALT, 0, CQHCI_OFF_TIMEOUT);
374+ if (err < 0)
376375 pr_err("%s: cqhci: CQE stuck on\n", mmc_hostname(mmc));
377376 else
378377 pr_debug("%s: cqhci: CQE off\n", mmc_hostname(mmc));
drivers/mmc/host/meson-mx-sdio.c+1−10
@@ -357,14 +357,6 @@ static void meson_mx_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) · 356 unmodified lines
357357 meson_mx_mmc_start_cmd(mmc, mrq->cmd);
358358 }
359359
360−static int meson_mx_mmc_card_busy(struct mmc_host *mmc)
361−{
362− struct meson_mx_mmc_host *host = mmc_priv(mmc);
363− u32 irqc = readl(host->base + MESON_MX_SDIO_IRQC);
364−
365− return !!(irqc & MESON_MX_SDIO_IRQC_FORCE_DATA_DAT_MASK);
366−}
367−
368360 static void meson_mx_mmc_read_response(struct mmc_host *mmc,
369361 struct mmc_command *cmd)
370362 {
@@ -506,7 +498,6 @@ static void meson_mx_mmc_timeout(struct timer_list *t) · 135 unmodified lines
506498 static struct mmc_host_ops meson_mx_mmc_ops = {
507499 .request = meson_mx_mmc_request,
508500 .set_ios = meson_mx_mmc_set_ios,
509− .card_busy = meson_mx_mmc_card_busy,
510501 .get_cd = mmc_gpio_get_cd,
511502 .get_ro = mmc_gpio_get_ro,
512503 };
@@ -570,7 +561,7 @@ static int meson_mx_mmc_add_host(struct meson_mx_mmc_host *host) · 57 unmodified lines
570561 mmc->f_max = clk_round_rate(host->cfg_div_clk,
571562 clk_get_rate(host->parent_clk));
572563
573− mmc->caps |= MMC_CAP_ERASE | MMC_CAP_CMD23;
564+ mmc->caps |= MMC_CAP_ERASE | MMC_CAP_CMD23 | MMC_CAP_WAIT_WHILE_BUSY;
574565 mmc->ops = &meson_mx_mmc_ops;
575566
576567 ret = mmc_of_parse(mmc);
drivers/mmc/host/sdhci-msm.c+2−0
@@ -2087,6 +2087,8 @@ static int sdhci_msm_probe(struct platform_device *pdev) · 2086 unmodified lines
20872087 goto clk_disable;
20882088 }
20892089
2090+ msm_host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_NEED_RSP_BUSY;
2091+
20902092 pm_runtime_get_noresume(&pdev->dev);
20912093 pm_runtime_set_active(&pdev->dev);
20922094 pm_runtime_enable(&pdev->dev);
drivers/mmc/host/sdhci-pci-core.c+3−0
@@ -601,6 +601,9 @@ static int intel_select_drive_strength(struct mmc_card *card, · 600 unmodified lines
601601 struct sdhci_pci_slot *slot = sdhci_priv(host);
602602 struct intel_host *intel_host = sdhci_pci_priv(slot);
603603
604+ if (!(mmc_driver_type_mask(intel_host->drv_strength) & card_drv))
605+ return 0;
606+
604607 return intel_host->drv_strength;
605608 }
606609
drivers/mmc/host/sdhci-xenon.c+10−0
@@ -235,6 +235,16 @@ static void xenon_voltage_switch(struct sdhci_host *host) · 234 unmodified lines
235235 {
236236 /* Wait for 5ms after set 1.8V signal enable bit */
237237 usleep_range(5000, 5500);
238+
239+ /*
240+ * For some reason the controller's Host Control2 register reports
241+ * the bit representing 1.8V signaling as 0 when read after it was
242+ * written as 1. Subsequent read reports 1.
243+ *
244+ * Since this may cause some issues, do an empty read of the Host
245+ * Control2 register here to circumvent this.
246+ */
247+ sdhci_readw(host, SDHCI_HOST_CONTROL2);
238248 }
239249
240250 static const struct sdhci_ops sdhci_xenon_ops = {
drivers/most/core.c+1−1
@@ -1483,7 +1483,7 @@ static void __exit most_exit(void) · 1482 unmodified lines
14831483 ida_destroy(&mdev_id);
14841484 }
14851485
1486−module_init(most_init);
1486+subsys_initcall(most_init);
14871487 module_exit(most_exit);
14881488 MODULE_LICENSE("GPL");
14891489 MODULE_AUTHOR("Christian Gromm <christian.gromm@microchip.com>");
drivers/net/dsa/mv88e6xxx/Kconfig+1−1
@@ -24,8 +24,8 @@ config NET_DSA_MV88E6XXX_PTP · 23 unmodified lines
2424 bool "PTP support for Marvell 88E6xxx"
2525 default n
2626 depends on NET_DSA_MV88E6XXX_GLOBAL2
27+ depends on PTP_1588_CLOCK
2728 imply NETWORK_PHY_TIMESTAMPING
28− imply PTP_1588_CLOCK
2929 help
3030 Say Y to enable PTP hardware timestamping on Marvell 88E6xxx switch
3131 chips that support it.
drivers/net/dsa/mv88e6xxx/chip.c+0−4
@@ -3962,7 +3962,6 @@ static const struct mv88e6xxx_ops mv88e6190_ops = { · 3961 unmodified lines
39623962 .serdes_get_stats = mv88e6390_serdes_get_stats,
39633963 .serdes_get_regs_len = mv88e6390_serdes_get_regs_len,
39643964 .serdes_get_regs = mv88e6390_serdes_get_regs,
3965− .phylink_validate = mv88e6390_phylink_validate,
39663965 .gpio_ops = &mv88e6352_gpio_ops,
39673966 .phylink_validate = mv88e6390_phylink_validate,
39683967 };
@@ -4021,7 +4020,6 @@ static const struct mv88e6xxx_ops mv88e6190x_ops = { · 52 unmodified lines
40214020 .serdes_get_stats = mv88e6390_serdes_get_stats,
40224021 .serdes_get_regs_len = mv88e6390_serdes_get_regs_len,
40234022 .serdes_get_regs = mv88e6390_serdes_get_regs,
4024− .phylink_validate = mv88e6390_phylink_validate,
40254023 .gpio_ops = &mv88e6352_gpio_ops,
40264024 .phylink_validate = mv88e6390x_phylink_validate,
40274025 };
@@ -4079,7 +4077,6 @@ static const struct mv88e6xxx_ops mv88e6191_ops = { · 51 unmodified lines
40794077 .serdes_get_stats = mv88e6390_serdes_get_stats,
40804078 .serdes_get_regs_len = mv88e6390_serdes_get_regs_len,
40814079 .serdes_get_regs = mv88e6390_serdes_get_regs,
4082− .phylink_validate = mv88e6390_phylink_validate,
40834080 .avb_ops = &mv88e6390_avb_ops,
40844081 .ptp_ops = &mv88e6352_ptp_ops,
40854082 .phylink_validate = mv88e6390_phylink_validate,
@@ -4235,7 +4232,6 @@ static const struct mv88e6xxx_ops mv88e6290_ops = { · 149 unmodified lines
42354232 .serdes_get_stats = mv88e6390_serdes_get_stats,
42364233 .serdes_get_regs_len = mv88e6390_serdes_get_regs_len,
42374234 .serdes_get_regs = mv88e6390_serdes_get_regs,
4238− .phylink_validate = mv88e6390_phylink_validate,
42394235 .gpio_ops = &mv88e6352_gpio_ops,
42404236 .avb_ops = &mv88e6390_avb_ops,
42414237 .ptp_ops = &mv88e6352_ptp_ops,
drivers/net/dsa/ocelot/felix.c+1−0
@@ -400,6 +400,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) · 399 unmodified lines
400400 ocelot->stats_layout = felix->info->stats_layout;
401401 ocelot->num_stats = felix->info->num_stats;
402402 ocelot->shared_queue_sz = felix->info->shared_queue_sz;
403+ ocelot->num_mact_rows = felix->info->num_mact_rows;
403404 ocelot->vcap_is2_keys = felix->info->vcap_is2_keys;
404405 ocelot->vcap_is2_actions= felix->info->vcap_is2_actions;
405406 ocelot->vcap = felix->info->vcap;
drivers/net/dsa/ocelot/felix.h+1−0
@@ -15,6 +15,7 @@ struct felix_info { · 14 unmodified lines
1515 const u32 *const *map;
1616 const struct ocelot_ops *ops;
1717 int shared_queue_sz;
18+ int num_mact_rows;
1819 const struct ocelot_stat_layout *stats_layout;
1920 unsigned int num_stats;
2021 int num_ports;
drivers/net/dsa/ocelot/felix_vsc9959.c+1−0
@@ -1220,6 +1220,7 @@ struct felix_info felix_info_vsc9959 = { · 1219 unmodified lines
12201220 .vcap_is2_actions = vsc9959_vcap_is2_actions,
12211221 .vcap = vsc9959_vcap_props,
12221222 .shared_queue_sz = 128 * 1024,
1223+ .num_mact_rows = 2048,
12231224 .num_ports = 6,
12241225 .switch_pci_bar = 4,
12251226 .imdio_pci_bar = 0,
drivers/net/dsa/sja1105/Kconfig+1−0
@@ -20,6 +20,7 @@ tristate "NXP SJA1105 Ethernet switch family support" · 19 unmodified lines
2020 config NET_DSA_SJA1105_PTP
2121 bool "Support for the PTP clock on the NXP SJA1105 Ethernet switch"
2222 depends on NET_DSA_SJA1105
23+ depends on PTP_1588_CLOCK
2324 help
2425 This enables support for timestamping and PTP clock manipulations in
2526 the SJA1105 DSA driver.
drivers/net/dsa/sja1105/sja1105_ptp.c+18−8
@@ -16,14 +16,15 @@ · 15 unmodified lines
1616
1717 /* PTPSYNCTS has no interrupt or update mechanism, because the intended
1818 * hardware use case is for the timestamp to be collected synchronously,
19− * immediately after the CAS_MASTER SJA1105 switch has triggered a CASSYNC
20− * pulse on the PTP_CLK pin. When used as a generic extts source, it needs
21− * polling and a comparison with the old value. The polling interval is just
22− * the Nyquist rate of a canonical PPS input (e.g. from a GPS module).
23− * Anything of higher frequency than 1 Hz will be lost, since there is no
24− * timestamp FIFO.
19+ * immediately after the CAS_MASTER SJA1105 switch has performed a CASSYNC
20+ * one-shot toggle (no return to level) on the PTP_CLK pin. When used as a
21+ * generic extts source, the PTPSYNCTS register needs polling and a comparison
22+ * with the old value. The polling interval is configured as the Nyquist rate
23+ * of a signal with 50% duty cycle and 1Hz frequency, which is sadly all that
24+ * this hardware can do (but may be enough for some setups). Anything of higher
25+ * frequency than 1 Hz will be lost, since there is no timestamp FIFO.
2526 */
26−#define SJA1105_EXTTS_INTERVAL (HZ / 2)
27+#define SJA1105_EXTTS_INTERVAL (HZ / 4)
2728
2829 /* This range is actually +/- SJA1105_MAX_ADJ_PPB
2930 * divided by 1000 (ppb -> ppm) and with a 16-bit
@@ -754,7 +755,16 @@ static int sja1105_extts_enable(struct sja1105_private *priv, · 724 unmodified lines
754755 return -EOPNOTSUPP;
755756
756757 /* Reject requests with unsupported flags */
757− if (extts->flags)
758+ if (extts->flags & ~(PTP_ENABLE_FEATURE |
759+ PTP_RISING_EDGE |
760+ PTP_FALLING_EDGE |
761+ PTP_STRICT_FLAGS))
762+ return -EOPNOTSUPP;
763+
764+ /* We can only enable time stamping on both edges, sadly. */
765+ if ((extts->flags & PTP_STRICT_FLAGS) &&
766+ (extts->flags & PTP_ENABLE_FEATURE) &&
767+ (extts->flags & PTP_EXTTS_EDGES) != PTP_EXTTS_EDGES)
758768 return -EOPNOTSUPP;
759769
760770 rc = sja1105_change_ptp_clk_pin_func(priv, PTP_PF_EXTTS);
drivers/net/ethernet/amazon/ena/ena_netdev.h+1−1
@@ -69,7 +69,7 @@ · 68 unmodified lines
6969 * 16kB.
7070 */
7171 #if PAGE_SIZE > SZ_16K
72−#define ENA_PAGE_SIZE SZ_16K
72+#define ENA_PAGE_SIZE (_AC(SZ_16K, UL))
7373 #else
7474 #define ENA_PAGE_SIZE PAGE_SIZE
7575 #endif
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c+1−1
@@ -57,7 +57,7 @@ static const struct aq_board_revision_s hw_atl_boards[] = { · 56 unmodified lines
5757 { AQ_DEVICE_ID_D108, AQ_HWREV_2, &hw_atl_ops_b0, &hw_atl_b0_caps_aqc108, },
5858 { AQ_DEVICE_ID_D109, AQ_HWREV_2, &hw_atl_ops_b0, &hw_atl_b0_caps_aqc109, },
5959
60− { AQ_DEVICE_ID_AQC100, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc107, },
60+ { AQ_DEVICE_ID_AQC100, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc100, },
6161 { AQ_DEVICE_ID_AQC107, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc107, },
6262 { AQ_DEVICE_ID_AQC108, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc108, },
6363 { AQ_DEVICE_ID_AQC109, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc109, },
drivers/net/ethernet/broadcom/bgmac-platform.c+15−9
@@ -172,6 +172,7 @@ static int bgmac_probe(struct platform_device *pdev) · 171 unmodified lines
172172 {
173173 struct device_node *np = pdev->dev.of_node;
174174 struct bgmac *bgmac;
175+ struct resource *regs;
175176 const u8 *mac_addr;
176177
177178 bgmac = bgmac_alloc(&pdev->dev);
@@ -206,16 +207,21 @@ static int bgmac_probe(struct platform_device *pdev) · 28 unmodified lines
206207 if (IS_ERR(bgmac->plat.base))
207208 return PTR_ERR(bgmac->plat.base);
208209
209− bgmac->plat.idm_base =
210− devm_platform_ioremap_resource_byname(pdev, "idm_base");
211− if (IS_ERR(bgmac->plat.idm_base))
212− return PTR_ERR(bgmac->plat.idm_base);
213− bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK;
210+ regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base");
211+ if (regs) {
212+ bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs);
213+ if (IS_ERR(bgmac->plat.idm_base))
214+ return PTR_ERR(bgmac->plat.idm_base);
215+ bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK;
216+ }
214217
215− bgmac->plat.nicpm_base =
216− devm_platform_ioremap_resource_byname(pdev, "nicpm_base");
217− if (IS_ERR(bgmac->plat.nicpm_base))
218− return PTR_ERR(bgmac->plat.nicpm_base);
218+ regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nicpm_base");
219+ if (regs) {
220+ bgmac->plat.nicpm_base = devm_ioremap_resource(&pdev->dev,
221+ regs);
222+ if (IS_ERR(bgmac->plat.nicpm_base))
223+ return PTR_ERR(bgmac->plat.nicpm_base);
224+ }
219225
220226 bgmac->read = platform_bgmac_read;
221227 bgmac->write = platform_bgmac_write;
drivers/net/ethernet/broadcom/bnxt/bnxt.c+13−7
@@ -6642,7 +6642,7 @@ static int bnxt_alloc_ctx_pg_tbls(struct bnxt *bp, · 6641 unmodified lines
66426642 int rc;
66436643
66446644 if (!mem_size)
6645− return 0;
6645+ return -EINVAL;
66466646
66476647 ctx_pg->nr_pages = DIV_ROUND_UP(mem_size, BNXT_PAGE_SIZE);
66486648 if (ctx_pg->nr_pages > MAX_CTX_TOTAL_PAGES) {
@@ -9780,6 +9780,7 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev, · 3131 unmodified lines
97809780 netdev_features_t features)
97819781 {
97829782 struct bnxt *bp = netdev_priv(dev);
9783+ netdev_features_t vlan_features;
97839784
97849785 if ((features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp))
97859786 features &= ~NETIF_F_NTUPLE;
@@ -9796,12 +9797,14 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev, · 10 unmodified lines
97969797 /* Both CTAG and STAG VLAN accelaration on the RX side have to be
97979798 * turned on or off together.
97989799 */
9799− if ((features & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX)) !=
9800− (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX)) {
9800+ vlan_features = features & (NETIF_F_HW_VLAN_CTAG_RX |
9801+ NETIF_F_HW_VLAN_STAG_RX);
9802+ if (vlan_features != (NETIF_F_HW_VLAN_CTAG_RX |
9803+ NETIF_F_HW_VLAN_STAG_RX)) {
98019804 if (dev->features & NETIF_F_HW_VLAN_CTAG_RX)
98029805 features &= ~(NETIF_F_HW_VLAN_CTAG_RX |
98039806 NETIF_F_HW_VLAN_STAG_RX);
9804− else
9807+ else if (vlan_features)
98059808 features |= NETIF_F_HW_VLAN_CTAG_RX |
98069809 NETIF_F_HW_VLAN_STAG_RX;
98079810 }
@@ -12212,12 +12215,15 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) · 2404 unmodified lines
1221212215 bnxt_ulp_start(bp, err);
1221312216 }
1221412217
12215− if (result != PCI_ERS_RESULT_RECOVERED && netif_running(netdev))
12216− dev_close(netdev);
12218+ if (result != PCI_ERS_RESULT_RECOVERED) {
12219+ if (netif_running(netdev))
12220+ dev_close(netdev);
12221+ pci_disable_device(pdev);
12222+ }
1221712223
1221812224 rtnl_unlock();
1221912225
12220− return PCI_ERS_RESULT_RECOVERED;
12226+ return result;
1222112227 }
1222212228
1222312229 /**
drivers/net/ethernet/broadcom/bnxt/bnxt.h+0−1
@@ -1066,7 +1066,6 @@ struct bnxt_vf_info { · 1065 unmodified lines
10661066 #define BNXT_VF_LINK_FORCED 0x4
10671067 #define BNXT_VF_LINK_UP 0x8
10681068 #define BNXT_VF_TRUST 0x10
1069− u32 func_flags; /* func cfg flags */
10701069 u32 min_tx_rate;
10711070 u32 max_tx_rate;
10721071 void *hwrm_cmd_req_addr;
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h+1−1
@@ -43,7 +43,7 @@ static inline void bnxt_link_bp_to_dl(struct bnxt *bp, struct devlink *dl) · 42 unmodified lines
4343 #define BNXT_NVM_CFG_VER_BITS 24
4444 #define BNXT_NVM_CFG_VER_BYTES 4
4545
46−#define BNXT_MSIX_VEC_MAX 1280
46+#define BNXT_MSIX_VEC_MAX 512
4747 #define BNXT_MSIX_VEC_MIN_MAX 128
4848
4949 enum bnxt_nvm_dir_type {
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c+2−8
@@ -85,11 +85,10 @@ int bnxt_set_vf_spoofchk(struct net_device *dev, int vf_id, bool setting) · 84 unmodified lines
8585 if (old_setting == setting)
8686 return 0;
8787
88− func_flags = vf->func_flags;
8988 if (setting)
90− func_flags |= FUNC_CFG_REQ_FLAGS_SRC_MAC_ADDR_CHECK_ENABLE;
89+ func_flags = FUNC_CFG_REQ_FLAGS_SRC_MAC_ADDR_CHECK_ENABLE;
9190 else
92− func_flags |= FUNC_CFG_REQ_FLAGS_SRC_MAC_ADDR_CHECK_DISABLE;
91+ func_flags = FUNC_CFG_REQ_FLAGS_SRC_MAC_ADDR_CHECK_DISABLE;
9392 /*TODO: if the driver supports VLAN filter on guest VLAN,
9493 * the spoof check should also include vlan anti-spoofing
9594 */
@@ -98,7 +97,6 @@ int bnxt_set_vf_spoofchk(struct net_device *dev, int vf_id, bool setting) · 2 unmodified lines
9897 req.flags = cpu_to_le32(func_flags);
9998 rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
10099 if (!rc) {
101− vf->func_flags = func_flags;
102100 if (setting)
103101 vf->flags |= BNXT_VF_SPOOFCHK;
104102 else
@@ -228,7 +226,6 @@ int bnxt_set_vf_mac(struct net_device *dev, int vf_id, u8 *mac) · 123 unmodified lines
228226 memcpy(vf->mac_addr, mac, ETH_ALEN);
229227 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
230228 req.fid = cpu_to_le16(vf->fw_fid);
231− req.flags = cpu_to_le32(vf->func_flags);
232229 req.enables = cpu_to_le32(FUNC_CFG_REQ_ENABLES_DFLT_MAC_ADDR);
233230 memcpy(req.dflt_mac_addr, mac, ETH_ALEN);
234231 return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
@@ -266,7 +263,6 @@ int bnxt_set_vf_vlan(struct net_device *dev, int vf_id, u16 vlan_id, u8 qos, · 31 unmodified lines
266263
267264 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
268265 req.fid = cpu_to_le16(vf->fw_fid);
269− req.flags = cpu_to_le32(vf->func_flags);
270266 req.dflt_vlan = cpu_to_le16(vlan_tag);
271267 req.enables = cpu_to_le32(FUNC_CFG_REQ_ENABLES_DFLT_VLAN);
272268 rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
@@ -305,7 +301,6 @@ int bnxt_set_vf_bw(struct net_device *dev, int vf_id, int min_tx_rate, · 32 unmodified lines
305301 return 0;
306302 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
307303 req.fid = cpu_to_le16(vf->fw_fid);
308− req.flags = cpu_to_le32(vf->func_flags);
309304 req.enables = cpu_to_le32(FUNC_CFG_REQ_ENABLES_MAX_BW);
310305 req.max_bw = cpu_to_le32(max_tx_rate);
311306 req.enables |= cpu_to_le32(FUNC_CFG_REQ_ENABLES_MIN_BW);
@@ -477,7 +472,6 @@ static void __bnxt_set_vf_params(struct bnxt *bp, int vf_id) · 165 unmodified lines
477472 vf = &bp->pf.vf[vf_id];
478473 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
479474 req.fid = cpu_to_le16(vf->fw_fid);
480− req.flags = cpu_to_le32(vf->func_flags);
481475
482476 if (is_valid_ether_addr(vf->mac_addr)) {
483477 req.enables |= cpu_to_le32(FUNC_CFG_REQ_ENABLES_DFLT_MAC_ADDR);
drivers/net/ethernet/cadence/Kconfig+1−1
@@ -35,8 +35,8 @@ config MACB · 34 unmodified lines
3535 config MACB_USE_HWSTAMP
3636 bool "Use IEEE 1588 hwstamp"
3737 depends on MACB
38+ depends on PTP_1588_CLOCK
3839 default y
39− imply PTP_1588_CLOCK
4040 ---help---
4141 Enable IEEE 1588 Precision Time Protocol (PTP) support for MACB.
4242
drivers/net/ethernet/cadence/macb_main.c+12−12
@@ -334,8 +334,10 @@ static int macb_mdio_read(struct mii_bus *bus, int mii_id, int regnum) · 333 unmodified lines
334334 int status;
335335
336336 status = pm_runtime_get_sync(&bp->pdev->dev);
337− if (status < 0)
337+ if (status < 0) {
338+ pm_runtime_put_noidle(&bp->pdev->dev);
338339 goto mdio_pm_exit;
340+ }
339341
340342 status = macb_mdio_wait_for_idle(bp);
341343 if (status < 0)
@@ -386,8 +388,10 @@ static int macb_mdio_write(struct mii_bus *bus, int mii_id, int regnum, · 44 unmodified lines
386388 int status;
387389
388390 status = pm_runtime_get_sync(&bp->pdev->dev);
389− if (status < 0)
391+ if (status < 0) {
392+ pm_runtime_put_noidle(&bp->pdev->dev);
390393 goto mdio_pm_exit;
394+ }
391395
392396 status = macb_mdio_wait_for_idle(bp);
393397 if (status < 0)
@@ -3816,8 +3820,10 @@ static int at91ether_open(struct net_device *dev) · 3422 unmodified lines
38163820 int ret;
38173821
38183822 ret = pm_runtime_get_sync(&lp->pdev->dev);
3819− if (ret < 0)
3823+ if (ret < 0) {
3824+ pm_runtime_put_noidle(&lp->pdev->dev);
38203825 return ret;
3826+ }
38213827
38223828 /* Clear internal statistics */
38233829 ctl = macb_readl(lp, NCR);
@@ -4172,15 +4178,9 @@ static int fu540_c000_clk_init(struct platform_device *pdev, struct clk **pclk, · 348 unmodified lines
41724178
41734179 static int fu540_c000_init(struct platform_device *pdev)
41744180 {
4175− struct resource *res;
4176−
4177− res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
4178− if (!res)
4179− return -ENODEV;
4180−
4181− mgmt->reg = ioremap(res->start, resource_size(res));
4182− if (!mgmt->reg)
4183− return -ENOMEM;
4181+ mgmt->reg = devm_platform_ioremap_resource(pdev, 1);
4182+ if (IS_ERR(mgmt->reg))
4183+ return PTR_ERR(mgmt->reg);
41844184
41854185 return macb_init(pdev);
41864186 }
drivers/net/ethernet/cavium/Kconfig+1−1
@@ -54,7 +54,7 @@ config THUNDER_NIC_RGX · 53 unmodified lines
5454 config CAVIUM_PTP
5555 tristate "Cavium PTP coprocessor as PTP clock"
5656 depends on 64BIT && PCI
57− imply PTP_1588_CLOCK
57+ depends on PTP_1588_CLOCK
5858 ---help---
5959 This driver adds support for the Precision Time Protocol Clocks and
6060 Timestamping coprocessor (PTP) found on Cavium processors.
drivers/net/ethernet/chelsio/cxgb4/sge.c+37−3
@@ -2207,6 +2207,9 @@ static void ethofld_hard_xmit(struct net_device *dev, · 2206 unmodified lines
22072207 if (unlikely(skip_eotx_wr)) {
22082208 start = (u64 *)wr;
22092209 eosw_txq->state = next_state;
2210+ eosw_txq->cred -= wrlen16;
2211+ eosw_txq->ncompl++;
2212+ eosw_txq->last_compl = 0;
22102213 goto write_wr_headers;
22112214 }
22122215
@@ -2365,6 +2368,34 @@ netdev_tx_t t4_start_xmit(struct sk_buff *skb, struct net_device *dev) · 152 unmodified lines
23652368 return cxgb4_eth_xmit(skb, dev);
23662369 }
23672370
2371+static void eosw_txq_flush_pending_skbs(struct sge_eosw_txq *eosw_txq)
2372+{
2373+ int pktcount = eosw_txq->pidx - eosw_txq->last_pidx;
2374+ int pidx = eosw_txq->pidx;
2375+ struct sk_buff *skb;
2376+
2377+ if (!pktcount)
2378+ return;
2379+
2380+ if (pktcount < 0)
2381+ pktcount += eosw_txq->ndesc;
2382+
2383+ while (pktcount--) {
2384+ pidx--;
2385+ if (pidx < 0)
2386+ pidx += eosw_txq->ndesc;
2387+
2388+ skb = eosw_txq->desc[pidx].skb;
2389+ if (skb) {
2390+ dev_consume_skb_any(skb);
2391+ eosw_txq->desc[pidx].skb = NULL;
2392+ eosw_txq->inuse--;
2393+ }
2394+ }
2395+
2396+ eosw_txq->pidx = eosw_txq->last_pidx + 1;
2397+}
2398+
23682399 /**
23692400 * cxgb4_ethofld_send_flowc - Send ETHOFLD flowc request to bind eotid to tc.
23702401 * @dev - netdevice
@@ -2440,9 +2471,11 @@ int cxgb4_ethofld_send_flowc(struct net_device *dev, u32 eotid, u32 tc) · 69 unmodified lines
24402471 FW_FLOWC_MNEM_EOSTATE_CLOSING :
24412472 FW_FLOWC_MNEM_EOSTATE_ESTABLISHED);
24422473
2443− eosw_txq->cred -= len16;
2444− eosw_txq->ncompl++;
2445− eosw_txq->last_compl = 0;
2474+ /* Free up any pending skbs to ensure there's room for
2475+ * termination FLOWC.
2476+ */
2477+ if (tc == FW_SCHED_CLS_NONE)
2478+ eosw_txq_flush_pending_skbs(eosw_txq);
24462479
24472480 ret = eosw_txq_enqueue(eosw_txq, skb);
24482481 if (ret) {
@@ -2695,6 +2728,7 @@ static void ofldtxq_stop(struct sge_uld_txq *q, struct fw_wr_hdr *wr) · 246 unmodified lines
26952728 * is ever running at a time ...
26962729 */
26972730 static void service_ofldq(struct sge_uld_txq *q)
2731+ __must_hold(&q->sendq.lock)
26982732 {
26992733 u64 *pos, *before, *end;
27002734 int credits;
drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c+1−1
@@ -74,8 +74,8 @@ err_pci_mem_reg: · 73 unmodified lines
7474 pci_disable_device(pdev);
7575 err_pci_enable:
7676 err_mdiobus_alloc:
77− iounmap(port_regs);
7877 err_hw_alloc:
78+ iounmap(port_regs);
7979 err_ioremap:
8080 return err;
8181 }
drivers/net/ethernet/ibm/ibmvnic.c+2−1
@@ -2189,7 +2189,8 @@ static void __ibmvnic_reset(struct work_struct *work) · 2188 unmodified lines
21892189 rc = do_hard_reset(adapter, rwi, reset_state);
21902190 rtnl_unlock();
21912191 }
2192− } else {
2192+ } else if (!(rwi->reset_reason == VNIC_RESET_FATAL &&
2193+ adapter->from_passive_init)) {
21932194 rc = do_reset(adapter, rwi, reset_state);
21942195 }
21952196 kfree(rwi);
drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c+3−0
@@ -1428,6 +1428,9 @@ int mvpp2_ethtool_cls_rule_del(struct mvpp2_port *port, · 1427 unmodified lines
14281428 struct mvpp2_ethtool_fs *efs;
14291429 int ret;
14301430
1431+ if (info->fs.location >= MVPP2_N_RFS_ENTRIES_PER_FLOW)
1432+ return -EINVAL;
1433+
14311434 efs = port->rfs_rules[info->fs.location];
14321435 if (!efs)
14331436 return -EINVAL;
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c+2−0
@@ -4329,6 +4329,8 @@ static int mvpp2_ethtool_get_rxfh_context(struct net_device *dev, u32 *indir, · 4328 unmodified lines
43294329
43304330 if (!mvpp22_rss_is_supported())
43314331 return -EOPNOTSUPP;
4332+ if (rss_context >= MVPP22_N_RSS_TABLES)
4333+ return -EINVAL;
43324334
43334335 if (hfunc)
43344336 *hfunc = ETH_RSS_HASH_CRC32;
drivers/net/ethernet/mellanox/mlx4/main.c+3−1
@@ -2550,6 +2550,7 @@ static int mlx4_allocate_default_counters(struct mlx4_dev *dev) · 2549 unmodified lines
25502550
25512551 if (!err || err == -ENOSPC) {
25522552 priv->def_counter[port] = idx;
2553+ err = 0;
25532554 } else if (err == -ENOENT) {
25542555 err = 0;
25552556 continue;
@@ -2600,7 +2601,8 @@ int mlx4_counter_alloc(struct mlx4_dev *dev, u32 *idx, u8 usage) · 44 unmodified lines
26002601 MLX4_CMD_TIME_CLASS_A, MLX4_CMD_WRAPPED);
26012602 if (!err)
26022603 *idx = get_param_l(&out_param);
2603−
2604+ if (WARN_ON(err == -ENOSPC))
2605+ err = -EINVAL;
26042606 return err;
26052607 }
26062608 return __mlx4_counter_alloc(dev, idx);
drivers/net/ethernet/mellanox/mlx5/core/cmd.c+5−1
@@ -888,7 +888,6 @@ static void cmd_work_handler(struct work_struct *work) · 887 unmodified lines
888888 }
889889
890890 cmd->ent_arr[ent->idx] = ent;
891− set_bit(MLX5_CMD_ENT_STATE_PENDING_COMP, &ent->state);
892891 lay = get_inst(cmd, ent->idx);
893892 ent->lay = lay;
894893 memset(lay, 0, sizeof(*lay));
@@ -910,6 +909,7 @@ static void cmd_work_handler(struct work_struct *work) · 15 unmodified lines
910909
911910 if (ent->callback)
912911 schedule_delayed_work(&ent->cb_timeout_work, cb_timeout);
912+ set_bit(MLX5_CMD_ENT_STATE_PENDING_COMP, &ent->state);
913913
914914 /* Skip sending command to fw if internal error */
915915 if (pci_channel_offline(dev->pdev) ||
@@ -922,6 +922,10 @@ static void cmd_work_handler(struct work_struct *work) · 6 unmodified lines
922922 MLX5_SET(mbox_out, ent->out, syndrome, drv_synd);
923923
924924 mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true);
925+ /* no doorbell, no need to keep the entry */
926+ free_ent(cmd, ent->idx);
927+ if (ent->callback)
928+ free_cmd(ent);
925929 return;
926930 }
927931
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c+2−7
@@ -1773,19 +1773,14 @@ static void mlx5e_cleanup_rep_rx(struct mlx5e_priv *priv) · 1772 unmodified lines
17731773
17741774 static int mlx5e_init_ul_rep_rx(struct mlx5e_priv *priv)
17751775 {
1776− int err = mlx5e_init_rep_rx(priv);
1777−
1778− if (err)
1779− return err;
1780−
17811776 mlx5e_create_q_counters(priv);
1782− return 0;
1777+ return mlx5e_init_rep_rx(priv);
17831778 }
17841779
17851780 static void mlx5e_cleanup_ul_rep_rx(struct mlx5e_priv *priv)
17861781 {
1787− mlx5e_destroy_q_counters(priv);
17881782 mlx5e_cleanup_rep_rx(priv);
1783+ mlx5e_destroy_q_counters(priv);
17891784 }
17901785
17911786 static int mlx5e_init_uplink_rep_tx(struct mlx5e_rep_priv *rpriv)
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c+9−9
@@ -1550,9 +1550,9 @@ static int esw_create_restore_table(struct mlx5_eswitch *esw) · 1549 unmodified lines
15501550 MLX5_FLOW_NAMESPACE_KERNEL, 1,
15511551 modact);
15521552 if (IS_ERR(mod_hdr)) {
1553+ err = PTR_ERR(mod_hdr);
15531554 esw_warn(dev, "Failed to create restore mod header, err: %d\n",
15541555 err);
1555− err = PTR_ERR(mod_hdr);
15561556 goto err_mod_hdr;
15571557 }
15581558
@@ -2219,10 +2219,12 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw) · 660 unmodified lines
22192219 total_vports = num_vfs + MLX5_SPECIAL_VPORTS(esw->dev);
22202220
22212221 memset(&esw->fdb_table.offloads, 0, sizeof(struct offloads_fdb));
2222+ mutex_init(&esw->fdb_table.offloads.vports.lock);
2223+ hash_init(esw->fdb_table.offloads.vports.table);
22222224
22232225 err = esw_create_uplink_offloads_acl_tables(esw);
22242226 if (err)
2225− return err;
2227+ goto create_acl_err;
22262228
22272229 err = esw_create_offloads_table(esw, total_vports);
22282230 if (err)
@@ -2240,9 +2242,6 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw) · 11 unmodified lines
22402242 if (err)
22412243 goto create_fg_err;
22422244
2243− mutex_init(&esw->fdb_table.offloads.vports.lock);
2244− hash_init(esw->fdb_table.offloads.vports.table);
2245−
22462245 return 0;
22472246
22482247 create_fg_err:
@@ -2253,18 +2252,19 @@ create_restore_err: · 4 unmodified lines
22532252 esw_destroy_offloads_table(esw);
22542253 create_offloads_err:
22552254 esw_destroy_uplink_offloads_acl_tables(esw);
2256−
2255+create_acl_err:
2256+ mutex_destroy(&esw->fdb_table.offloads.vports.lock);
22572257 return err;
22582258 }
22592259
22602260 static void esw_offloads_steering_cleanup(struct mlx5_eswitch *esw)
22612261 {
2262− mutex_destroy(&esw->fdb_table.offloads.vports.lock);
22632262 esw_destroy_vport_rx_group(esw);
22642263 esw_destroy_offloads_fdb_tables(esw);
22652264 esw_destroy_restore_table(esw);
22662265 esw_destroy_offloads_table(esw);
22672266 esw_destroy_uplink_offloads_acl_tables(esw);
2267+ mutex_destroy(&esw->fdb_table.offloads.vports.lock);
22682268 }
22692269
22702270 static void
@@ -2377,9 +2377,9 @@ int esw_offloads_enable(struct mlx5_eswitch *esw) · 106 unmodified lines
23772377 err_vports:
23782378 esw_offloads_unload_rep(esw, MLX5_VPORT_UPLINK);
23792379 err_uplink:
2380− esw_set_passing_vport_metadata(esw, false);
2381−err_steering_init:
23822380 esw_offloads_steering_cleanup(esw);
2381+err_steering_init:
2382+ esw_set_passing_vport_metadata(esw, false);
23832383 err_vport_metadata:
23842384 mlx5_rdma_disable_roce(esw->dev);
23852385 mutex_destroy(&esw->offloads.termtbl_mutex);
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c+13−1
@@ -695,6 +695,12 @@ static void dr_cq_event(struct mlx5_core_cq *mcq, · 694 unmodified lines
695695 pr_info("CQ event %u on CQ #%u\n", event, mcq->cqn);
696696 }
697697
698+static void dr_cq_complete(struct mlx5_core_cq *mcq,
699+ struct mlx5_eqe *eqe)
700+{
701+ pr_err("CQ completion CQ: #%u\n", mcq->cqn);
702+}
703+
698704 static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev,
699705 struct mlx5_uars_page *uar,
700706 size_t ncqe)
@@ -756,6 +762,7 @@ static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev, · 55 unmodified lines
756762 mlx5_fill_page_frag_array(&cq->wq_ctrl.buf, pas);
757763
758764 cq->mcq.event = dr_cq_event;
765+ cq->mcq.comp = dr_cq_complete;
759766
760767 err = mlx5_core_create_cq(mdev, &cq->mcq, in, inlen, out, sizeof(out));
761768 kvfree(in);
@@ -767,7 +774,12 @@ static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev, · 5 unmodified lines
767774 cq->mcq.set_ci_db = cq->wq_ctrl.db.db;
768775 cq->mcq.arm_db = cq->wq_ctrl.db.db + 1;
769776 *cq->mcq.set_ci_db = 0;
770− *cq->mcq.arm_db = 0;
777+
778+ /* set no-zero value, in order to avoid the HW to run db-recovery on
779+ * CQ that used in polling mode.
780+ */
781+ *cq->mcq.arm_db = cpu_to_be32(2 << 28);
782+
771783 cq->mcq.vector = 0;
772784 cq->mcq.irqn = irqn;
773785 cq->mcq.uar = uar;
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c+10−2
@@ -986,8 +986,9 @@ mlxsw_sp_acl_tcam_vchunk_create(struct mlxsw_sp *mlxsw_sp, · 985 unmodified lines
986986 unsigned int priority,
987987 struct mlxsw_afk_element_usage *elusage)
988988 {
989+ struct mlxsw_sp_acl_tcam_vchunk *vchunk, *vchunk2;
989990 struct mlxsw_sp_acl_tcam_vregion *vregion;
990− struct mlxsw_sp_acl_tcam_vchunk *vchunk;
991+ struct list_head *pos;
991992 int err;
992993
993994 if (priority == MLXSW_SP_ACL_TCAM_CATCHALL_PRIO)
@@ -1025,7 +1026,14 @@ mlxsw_sp_acl_tcam_vchunk_create(struct mlxsw_sp *mlxsw_sp, · 31 unmodified lines
10251026 }
10261027
10271028 mlxsw_sp_acl_tcam_rehash_ctx_vregion_changed(vregion);
1028− list_add_tail(&vchunk->list, &vregion->vchunk_list);
1029+
1030+ /* Position the vchunk inside the list according to priority */
1031+ list_for_each(pos, &vregion->vchunk_list) {
1032+ vchunk2 = list_entry(pos, typeof(*vchunk2), list);
1033+ if (vchunk2->priority > priority)
1034+ break;
1035+ }
1036+ list_add_tail(&vchunk->list, pos);
10291037 mutex_unlock(&vregion->lock);
10301038
10311039 return vchunk;
drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c+2−1
@@ -36,7 +36,8 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, · 35 unmodified lines
3636 err = mlxsw_sp_acl_rulei_act_count(mlxsw_sp, rulei, extack);
3737 if (err)
3838 return err;
39− } else if (act->hw_stats != FLOW_ACTION_HW_STATS_DISABLED) {
39+ } else if (act->hw_stats != FLOW_ACTION_HW_STATS_DISABLED &&
40+ act->hw_stats != FLOW_ACTION_HW_STATS_DONT_CARE) {
4041 NL_SET_ERR_MSG_MOD(extack, "Unsupported action HW stats type");
4142 return -EOPNOTSUPP;
4243 }
drivers/net/ethernet/moxa/moxart_ether.c+1−1
@@ -564,7 +564,7 @@ static int moxart_remove(struct platform_device *pdev) · 563 unmodified lines
564564 struct net_device *ndev = platform_get_drvdata(pdev);
565565
566566 unregister_netdev(ndev);
567− free_irq(ndev->irq, ndev);
567+ devm_free_irq(&pdev->dev, ndev->irq, ndev);
568568 moxart_mac_free_memory(ndev);
569569 free_netdev(ndev);
570570
drivers/net/ethernet/mscc/ocelot.c+11−6
@@ -1031,10 +1031,8 @@ int ocelot_fdb_dump(struct ocelot *ocelot, int port, · 1030 unmodified lines
10311031 {
10321032 int i, j;
10331033
1034− /* Loop through all the mac tables entries. There are 1024 rows of 4
1035− * entries.
1036− */
1037− for (i = 0; i < 1024; i++) {
1034+ /* Loop through all the mac tables entries. */
1035+ for (i = 0; i < ocelot->num_mact_rows; i++) {
10381036 for (j = 0; j < 4; j++) {
10391037 struct ocelot_mact_entry entry;
10401038 bool is_static;
@@ -1453,8 +1451,15 @@ static void ocelot_port_attr_stp_state_set(struct ocelot *ocelot, int port, · 412 unmodified lines
14531451
14541452 void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs)
14551453 {
1456− ocelot_write(ocelot, ANA_AUTOAGE_AGE_PERIOD(msecs / 2),
1457− ANA_AUTOAGE);
1454+ unsigned int age_period = ANA_AUTOAGE_AGE_PERIOD(msecs / 2000);
1455+
1456+ /* Setting AGE_PERIOD to zero effectively disables automatic aging,
1457+ * which is clearly not what our intention is. So avoid that.
1458+ */
1459+ if (!age_period)
1460+ age_period = 1;
1461+
1462+ ocelot_rmw(ocelot, age_period, ANA_AUTOAGE_AGE_PERIOD_M, ANA_AUTOAGE);
14581463 }
14591464 EXPORT_SYMBOL(ocelot_set_ageing_time);
14601465
drivers/net/ethernet/mscc/ocelot_regs.c+1−0
@@ -431,6 +431,7 @@ int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops) · 430 unmodified lines
431431 ocelot->stats_layout = ocelot_stats_layout;
432432 ocelot->num_stats = ARRAY_SIZE(ocelot_stats_layout);
433433 ocelot->shared_queue_sz = 224 * 1024;
434+ ocelot->num_mact_rows = 1024;
434435 ocelot->ops = ops;
435436
436437 ret = ocelot_regfields_init(ocelot, ocelot_regfields);
drivers/net/ethernet/natsemi/jazzsonic.c+4−2
@@ -208,11 +208,13 @@ static int jazz_sonic_probe(struct platform_device *pdev) · 207 unmodified lines
208208
209209 err = register_netdev(dev);
210210 if (err)
211− goto out1;
211+ goto undo_probe1;
212212
213213 return 0;
214214
215−out1:
215+undo_probe1:
216+ dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
217+ lp->descriptors, lp->descriptors_laddr);
216218 release_mem_region(dev->base_addr, SONIC_MEM_SIZE);
217219 out:
218220 free_netdev(dev);
drivers/net/ethernet/netronome/nfp/abm/main.c+1−0
@@ -283,6 +283,7 @@ nfp_abm_vnic_set_mac(struct nfp_pf *pf, struct nfp_abm *abm, struct nfp_net *nn, · 282 unmodified lines
283283 if (!nfp_nsp_has_hwinfo_lookup(nsp)) {
284284 nfp_warn(pf->cpp, "NSP doesn't support PF MAC generation\n");
285285 eth_hw_addr_random(nn->dp.netdev);
286+ nfp_nsp_close(nsp);
286287 return;
287288 }
288289
drivers/net/ethernet/pensando/ionic/ionic_debugfs.c+1−2
@@ -170,8 +170,7 @@ void ionic_debugfs_add_qcq(struct ionic_lif *lif, struct ionic_qcq *qcq) · 169 unmodified lines
170170 debugfs_create_x64("base_pa", 0400, cq_dentry, &cq->base_pa);
171171 debugfs_create_u32("num_descs", 0400, cq_dentry, &cq->num_descs);
172172 debugfs_create_u32("desc_size", 0400, cq_dentry, &cq->desc_size);
173− debugfs_create_u8("done_color", 0400, cq_dentry,
174− (u8 *)&cq->done_color);
173+ debugfs_create_bool("done_color", 0400, cq_dentry, &cq->done_color);
175174
176175 debugfs_create_file("tail", 0400, cq_dentry, cq, &cq_tail_fops);
177176
drivers/net/ethernet/pensando/ionic/ionic_lif.c+2−2
@@ -2101,6 +2101,7 @@ static void ionic_lif_handle_fw_down(struct ionic_lif *lif) · 2100 unmodified lines
21012101 ionic_txrx_free(lif);
21022102 }
21032103 ionic_lifs_deinit(ionic);
2104+ ionic_reset(ionic);
21042105 ionic_qcqs_free(lif);
21052106
21062107 dev_info(ionic->dev, "FW Down: LIFs stopped\n");
@@ -2116,6 +2117,7 @@ static void ionic_lif_handle_fw_up(struct ionic_lif *lif) · 9 unmodified lines
21162117
21172118 dev_info(ionic->dev, "FW Up: restarting LIFs\n");
21182119
2120+ ionic_init_devinfo(ionic);
21192121 err = ionic_qcqs_alloc(lif);
21202122 if (err)
21212123 goto err_out;
@@ -2549,8 +2551,6 @@ int ionic_lifs_register(struct ionic *ionic) · 427 unmodified lines
25492551 dev_err(ionic->dev, "Cannot register net device, aborting\n");
25502552 return err;
25512553 }
2552−
2553− ionic_link_status_check_request(ionic->master_lif);
25542554 ionic->master_lif->registered = true;
25552555
25562556 return 0;
drivers/net/ethernet/stmicro/stmmac/dwmac5.c+1−1
@@ -624,7 +624,7 @@ int dwmac5_est_configure(void __iomem *ioaddr, struct stmmac_est *cfg, · 623 unmodified lines
624624 total_offset += offset;
625625 }
626626
627− total_ctr = cfg->ctr[0] + cfg->ctr[1] * 1000000000;
627+ total_ctr = cfg->ctr[0] + cfg->ctr[1] * 1000000000ULL;
628628 total_ctr += total_offset;
629629
630630 ctr_low = do_div(total_ctr, 1000000000);
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+4−7
@@ -4060,7 +4060,7 @@ static int stmmac_set_features(struct net_device *netdev, · 4059 unmodified lines
40604060 /**
40614061 * stmmac_interrupt - main ISR
40624062 * @irq: interrupt number.
4063− * @dev_id: to pass the net device pointer.
4063+ * @dev_id: to pass the net device pointer (must be valid).
40644064 * Description: this is the main driver interrupt service routine.
40654065 * It can call:
40664066 * o DMA service routine (to manage incoming frame reception and transmission
@@ -4084,11 +4084,6 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id) · 17 unmodified lines
40844084 if (priv->irq_wake)
40854085 pm_wakeup_event(priv->device, 0);
40864086
4087− if (unlikely(!dev)) {
4088− netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__);
4089− return IRQ_NONE;
4090− }
4091−
40924087 /* Check if adapter is up */
40934088 if (test_bit(STMMAC_DOWN, &priv->state))
40944089 return IRQ_HANDLED;
@@ -4991,7 +4986,7 @@ int stmmac_dvr_probe(struct device *device, · 896 unmodified lines
49914986 priv->plat->bsp_priv);
49924987
49934988 if (ret < 0)
4994− return ret;
4989+ goto error_serdes_powerup;
49954990 }
49964991
49974992 #ifdef CONFIG_DEBUG_FS
@@ -5000,6 +4995,8 @@ int stmmac_dvr_probe(struct device *device, · 2 unmodified lines
50004995
50014996 return ret;
50024997
4998+error_serdes_powerup:
4999+ unregister_netdev(ndev);
50035000 error_netdev_register:
50045001 phylink_destroy(priv->phylink);
50055002 error_phy_setup:
drivers/net/ethernet/ti/Kconfig+1−2
@@ -90,9 +90,8 @@ config TI_CPTS · 89 unmodified lines
9090 config TI_CPTS_MOD
9191 tristate
9292 depends on TI_CPTS
93+ depends on PTP_1588_CLOCK
9394 default y if TI_CPSW=y || TI_KEYSTONE_NETCP=y || TI_CPSW_SWITCHDEV=y
94− select NET_PTP_CLASSIFY
95− imply PTP_1588_CLOCK
9695 default m
9796
9897 config TI_K3_AM65_CPSW_NUSS
drivers/net/ethernet/ti/am65-cpsw-nuss.c+3−2
@@ -1719,7 +1719,8 @@ static int am65_cpsw_nuss_ndev_add_napi_2g(struct am65_cpsw_common *common) · 1718 unmodified lines
17191719
17201720 ret = devm_request_irq(dev, tx_chn->irq,
17211721 am65_cpsw_nuss_tx_irq,
1722− 0, tx_chn->tx_chn_name, tx_chn);
1722+ IRQF_TRIGGER_HIGH,
1723+ tx_chn->tx_chn_name, tx_chn);
17231724 if (ret) {
17241725 dev_err(dev, "failure requesting tx%u irq %u, %d\n",
17251726 tx_chn->id, tx_chn->irq, ret);
@@ -1744,7 +1745,7 @@ static int am65_cpsw_nuss_ndev_reg_2g(struct am65_cpsw_common *common) · 18 unmodified lines
17441745
17451746 ret = devm_request_irq(dev, common->rx_chns.irq,
17461747 am65_cpsw_nuss_rx_irq,
1747− 0, dev_name(dev), common);
1748+ IRQF_TRIGGER_HIGH, dev_name(dev), common);
17481749 if (ret) {
17491750 dev_err(dev, "failure requesting rx irq %u, %d\n",
17501751 common->rx_chns.irq, ret);
drivers/net/ethernet/toshiba/tc35815.c+1−1
@@ -643,7 +643,7 @@ static int tc_mii_probe(struct net_device *dev) · 642 unmodified lines
643643 linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, mask);
644644 linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, mask);
645645 }
646− linkmode_and(phydev->supported, phydev->supported, mask);
646+ linkmode_andnot(phydev->supported, phydev->supported, mask);
647647 linkmode_copy(phydev->advertising, phydev->supported);
648648
649649 lp->link = 0;
drivers/net/gtp.c+5−4
@@ -1169,11 +1169,11 @@ out_unlock: · 1168 unmodified lines
11691169 static struct genl_family gtp_genl_family;
11701170
11711171 static int gtp_genl_fill_info(struct sk_buff *skb, u32 snd_portid, u32 snd_seq,
1172− u32 type, struct pdp_ctx *pctx)
1172+ int flags, u32 type, struct pdp_ctx *pctx)
11731173 {
11741174 void *genlh;
11751175
1176− genlh = genlmsg_put(skb, snd_portid, snd_seq, &gtp_genl_family, 0,
1176+ genlh = genlmsg_put(skb, snd_portid, snd_seq, &gtp_genl_family, flags,
11771177 type);
11781178 if (genlh == NULL)
11791179 goto nlmsg_failure;
@@ -1227,8 +1227,8 @@ static int gtp_genl_get_pdp(struct sk_buff *skb, struct genl_info *info) · 47 unmodified lines
12271227 goto err_unlock;
12281228 }
12291229
1230− err = gtp_genl_fill_info(skb2, NETLINK_CB(skb).portid,
1231− info->snd_seq, info->nlhdr->nlmsg_type, pctx);
1230+ err = gtp_genl_fill_info(skb2, NETLINK_CB(skb).portid, info->snd_seq,
1231+ 0, info->nlhdr->nlmsg_type, pctx);
12321232 if (err < 0)
12331233 goto err_unlock_free;
12341234
@@ -1271,6 +1271,7 @@ static int gtp_genl_dump_pdp(struct sk_buff *skb, · 36 unmodified lines
12711271 gtp_genl_fill_info(skb,
12721272 NETLINK_CB(cb->skb).portid,
12731273 cb->nlh->nlmsg_seq,
1274+ NLM_F_MULTI,
12741275 cb->nlh->nlmsg_type, pctx)) {
12751276 cb->args[0] = i;
12761277 cb->args[1] = j;
drivers/net/hyperv/netvsc_drv.c+2−1
@@ -707,7 +707,8 @@ no_memory: · 706 unmodified lines
707707 goto drop;
708708 }
709709
710−static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *ndev)
710+static netdev_tx_t netvsc_start_xmit(struct sk_buff *skb,
711+ struct net_device *ndev)
711712 {
712713 return netvsc_xmit(skb, ndev, false);
713714 }
drivers/net/ipa/gsi.c+9−2
@@ -1041,6 +1041,7 @@ static void gsi_isr_gp_int1(struct gsi *gsi) · 1040 unmodified lines
10411041
10421042 complete(&gsi->completion);
10431043 }
1044+
10441045 /* Inter-EE interrupt handler */
10451046 static void gsi_isr_glob_ee(struct gsi *gsi)
10461047 {
@@ -1493,6 +1494,12 @@ static int gsi_generic_command(struct gsi *gsi, u32 channel_id, · 446 unmodified lines
14931494 struct completion *completion = &gsi->completion;
14941495 u32 val;
14951496
1497+ /* First zero the result code field */
1498+ val = ioread32(gsi->virt + GSI_CNTXT_SCRATCH_0_OFFSET);
1499+ val &= ~GENERIC_EE_RESULT_FMASK;
1500+ iowrite32(val, gsi->virt + GSI_CNTXT_SCRATCH_0_OFFSET);
1501+
1502+ /* Now issue the command */
14961503 val = u32_encode_bits(opcode, GENERIC_OPCODE_FMASK);
14971504 val |= u32_encode_bits(channel_id, GENERIC_CHID_FMASK);
14981505 val |= u32_encode_bits(GSI_EE_MODEM, GENERIC_EE_FMASK);
@@ -1798,9 +1805,9 @@ static int gsi_channel_init_one(struct gsi *gsi, · 299 unmodified lines
17981805
17991806 /* Worst case we need an event for every outstanding TRE */
18001807 if (data->channel.tre_count > data->channel.event_count) {
1801− dev_warn(gsi->dev, "channel %u limited to %u TREs\n",
1802− data->channel_id, data->channel.tre_count);
18031808 tre_count = data->channel.event_count;
1809+ dev_warn(gsi->dev, "channel %u limited to %u TREs\n",
1810+ data->channel_id, tre_count);
18041811 } else {
18051812 tre_count = data->channel.tre_count;
18061813 }
drivers/net/ipa/gsi_reg.h+2−0
@@ -410,6 +410,8 @@ · 409 unmodified lines
410410 #define INTER_EE_RESULT_FMASK GENMASK(2, 0)
411411 #define GENERIC_EE_RESULT_FMASK GENMASK(7, 5)
412412 #define GENERIC_EE_SUCCESS_FVAL 1
413+#define GENERIC_EE_INCORRECT_DIRECTION_FVAL 3
414+#define GENERIC_EE_INCORRECT_CHANNEL_FVAL 5
413415 #define GENERIC_EE_NO_RESOURCES_FVAL 7
414416 #define USB_MAX_PACKET_FMASK GENMASK(15, 15) /* 0: HS; 1: SS */
415417 #define MHI_BASE_CHANNEL_FMASK GENMASK(31, 24)
drivers/net/ipa/ipa_endpoint.c+2−5
@@ -1283,7 +1283,7 @@ static int ipa_endpoint_stop_rx_dma(struct ipa *ipa) · 1282 unmodified lines
12831283 */
12841284 int ipa_endpoint_stop(struct ipa_endpoint *endpoint)
12851285 {
1286− u32 retries = endpoint->toward_ipa ? 0 : IPA_ENDPOINT_STOP_RX_RETRIES;
1286+ u32 retries = IPA_ENDPOINT_STOP_RX_RETRIES;
12871287 int ret;
12881288
12891289 do {
@@ -1291,12 +1291,9 @@ int ipa_endpoint_stop(struct ipa_endpoint *endpoint) · 1 unmodified line
12911291 struct gsi *gsi = &ipa->gsi;
12921292
12931293 ret = gsi_channel_stop(gsi, endpoint->channel_id);
1294− if (ret != -EAGAIN)
1294+ if (ret != -EAGAIN || endpoint->toward_ipa)
12951295 break;
12961296
1297− if (endpoint->toward_ipa)
1298− continue;
1299−
13001297 /* For IPA v3.5.1, send a DMA read task and check again */
13011298 if (ipa->version == IPA_VERSION_3_5_1) {
13021299 ret = ipa_endpoint_stop_rx_dma(ipa);
drivers/net/macsec.c+4−2
@@ -1305,7 +1305,8 @@ static struct crypto_aead *macsec_alloc_tfm(char *key, int key_len, int icv_len) · 1304 unmodified lines
13051305 struct crypto_aead *tfm;
13061306 int ret;
13071307
1308− tfm = crypto_alloc_aead("gcm(aes)", 0, 0);
1308+ /* Pick a sync gcm(aes) cipher to ensure order is preserved. */
1309+ tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
13091310
13101311 if (IS_ERR(tfm))
13111312 return tfm;
@@ -2640,11 +2641,12 @@ static int macsec_upd_offload(struct sk_buff *skb, struct genl_info *info) · 1328 unmodified lines
26402641 if (ret)
26412642 goto rollback;
26422643
2643− rtnl_unlock();
26442644 /* Force features update, since they are different for SW MACSec and
26452645 * HW offloading cases.
26462646 */
26472647 netdev_update_features(dev);
2648+
2649+ rtnl_unlock();
26482650 return 0;
26492651
26502652 rollback:
drivers/net/phy/dp83640.c+1−1
@@ -1120,7 +1120,7 @@ static struct dp83640_clock *dp83640_clock_get_bus(struct mii_bus *bus) · 1119 unmodified lines
11201120 goto out;
11211121 }
11221122 dp83640_clock_init(clock, bus);
1123− list_add_tail(&phyter_clocks, &clock->list);
1123+ list_add_tail(&clock->list, &phyter_clocks);
11241124 out:
11251125 mutex_unlock(&phyter_clocks_lock);
11261126
drivers/net/phy/dp83822.c+14−16
@@ -137,19 +137,18 @@ static int dp83822_set_wol(struct phy_device *phydev, · 136 unmodified lines
137137 value &= ~DP83822_WOL_SECURE_ON;
138138 }
139139
140− value |= (DP83822_WOL_EN | DP83822_WOL_INDICATION_SEL |
141− DP83822_WOL_CLR_INDICATION);
142− phy_write_mmd(phydev, DP83822_DEVADDR, MII_DP83822_WOL_CFG,
143− value);
140+ /* Clear any pending WoL interrupt */
141+ phy_read(phydev, MII_DP83822_MISR2);
142+
143+ value |= DP83822_WOL_EN | DP83822_WOL_INDICATION_SEL |
144+ DP83822_WOL_CLR_INDICATION;
145+
146+ return phy_write_mmd(phydev, DP83822_DEVADDR,
147+ MII_DP83822_WOL_CFG, value);
144148 } else {
145− value = phy_read_mmd(phydev, DP83822_DEVADDR,
146− MII_DP83822_WOL_CFG);
147− value &= ~DP83822_WOL_EN;
148− phy_write_mmd(phydev, DP83822_DEVADDR, MII_DP83822_WOL_CFG,
149− value);
149+ return phy_clear_bits_mmd(phydev, DP83822_DEVADDR,
150+ MII_DP83822_WOL_CFG, DP83822_WOL_EN);
150151 }
151−
152− return 0;
153152 }
154153
155154 static void dp83822_get_wol(struct phy_device *phydev,
@@ -258,12 +257,11 @@ static int dp83822_config_intr(struct phy_device *phydev) · 102 unmodified lines
258257
259258 static int dp83822_config_init(struct phy_device *phydev)
260259 {
261− int value;
262−
263− value = DP83822_WOL_MAGIC_EN | DP83822_WOL_SECURE_ON | DP83822_WOL_EN;
260+ int value = DP83822_WOL_EN | DP83822_WOL_MAGIC_EN |
261+ DP83822_WOL_SECURE_ON;
264262
265− return phy_write_mmd(phydev, DP83822_DEVADDR, MII_DP83822_WOL_CFG,
266− value);
263+ return phy_clear_bits_mmd(phydev, DP83822_DEVADDR,
264+ MII_DP83822_WOL_CFG, value);
267265 }
268266
269267 static int dp83822_phy_reset(struct phy_device *phydev)
drivers/net/phy/dp83tc811.c+12−9
@@ -139,16 +139,19 @@ static int dp83811_set_wol(struct phy_device *phydev, · 138 unmodified lines
139139 value &= ~DP83811_WOL_SECURE_ON;
140140 }
141141
142− value |= (DP83811_WOL_EN | DP83811_WOL_INDICATION_SEL |
143− DP83811_WOL_CLR_INDICATION);
144− phy_write_mmd(phydev, DP83811_DEVADDR, MII_DP83811_WOL_CFG,
145− value);
142+ /* Clear any pending WoL interrupt */
143+ phy_read(phydev, MII_DP83811_INT_STAT1);
144+
145+ value |= DP83811_WOL_EN | DP83811_WOL_INDICATION_SEL |
146+ DP83811_WOL_CLR_INDICATION;
147+
148+ return phy_write_mmd(phydev, DP83811_DEVADDR,
149+ MII_DP83811_WOL_CFG, value);
146150 } else {
147− phy_clear_bits_mmd(phydev, DP83811_DEVADDR, MII_DP83811_WOL_CFG,
148− DP83811_WOL_EN);
151+ return phy_clear_bits_mmd(phydev, DP83811_DEVADDR,
152+ MII_DP83811_WOL_CFG, DP83811_WOL_EN);
149153 }
150154
151− return 0;
152155 }
153156
154157 static void dp83811_get_wol(struct phy_device *phydev,
@@ -292,8 +295,8 @@ static int dp83811_config_init(struct phy_device *phydev) · 137 unmodified lines
292295
293296 value = DP83811_WOL_MAGIC_EN | DP83811_WOL_SECURE_ON | DP83811_WOL_EN;
294297
295− return phy_write_mmd(phydev, DP83811_DEVADDR, MII_DP83811_WOL_CFG,
296− value);
298+ return phy_clear_bits_mmd(phydev, DP83811_DEVADDR, MII_DP83811_WOL_CFG,
299+ value);
297300 }
298301
299302 static int dp83811_phy_reset(struct phy_device *phydev)
drivers/net/phy/marvell10g.c+26−1
@@ -66,6 +66,9 @@ enum { · 65 unmodified lines
6666 MV_PCS_CSSR1_SPD2_2500 = 0x0004,
6767 MV_PCS_CSSR1_SPD2_10000 = 0x0000,
6868
69+ /* Temperature read register (88E2110 only) */
70+ MV_PCS_TEMP = 0x8042,
71+
6972 /* These registers appear at 0x800X and 0xa00X - the 0xa00X control
7073 * registers appear to set themselves to the 0x800X when AN is
7174 * restarted, but status registers appear readable from either.
@@ -77,6 +80,7 @@ enum { · 5 unmodified lines
7780 MV_V2_PORT_CTRL = 0xf001,
7881 MV_V2_PORT_CTRL_SWRST = BIT(15),
7982 MV_V2_PORT_CTRL_PWRDOWN = BIT(11),
83+ /* Temperature control/read registers (88X3310 only) */
8084 MV_V2_TEMP_CTRL = 0xf08a,
8185 MV_V2_TEMP_CTRL_MASK = 0xc000,
8286 MV_V2_TEMP_CTRL_SAMPLE = 0x0000,
@@ -104,6 +108,24 @@ static umode_t mv3310_hwmon_is_visible(const void *data, · 21 unmodified lines
104108 return 0;
105109 }
106110
111+static int mv3310_hwmon_read_temp_reg(struct phy_device *phydev)
112+{
113+ return phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_TEMP);
114+}
115+
116+static int mv2110_hwmon_read_temp_reg(struct phy_device *phydev)
117+{
118+ return phy_read_mmd(phydev, MDIO_MMD_PCS, MV_PCS_TEMP);
119+}
120+
121+static int mv10g_hwmon_read_temp_reg(struct phy_device *phydev)
122+{
123+ if (phydev->drv->phy_id == MARVELL_PHY_ID_88X3310)
124+ return mv3310_hwmon_read_temp_reg(phydev);
125+ else /* MARVELL_PHY_ID_88E2110 */
126+ return mv2110_hwmon_read_temp_reg(phydev);
127+}
128+
107129 static int mv3310_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
108130 u32 attr, int channel, long *value)
109131 {
@@ -116,7 +138,7 @@ static int mv3310_hwmon_read(struct device *dev, enum hwmon_sensor_types type, · 6 unmodified lines
116138 }
117139
118140 if (type == hwmon_temp && attr == hwmon_temp_input) {
119− temp = phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_TEMP);
141+ temp = mv10g_hwmon_read_temp_reg(phydev);
120142 if (temp < 0)
121143 return temp;
122144
@@ -169,6 +191,9 @@ static int mv3310_hwmon_config(struct phy_device *phydev, bool enable) · 46 unmodified lines
169191 u16 val;
170192 int ret;
171193
194+ if (phydev->drv->phy_id != MARVELL_PHY_ID_88X3310)
195+ return 0;
196+
172197 ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, MV_V2_TEMP,
173198 MV_V2_TEMP_UNKNOWN);
174199 if (ret < 0)
drivers/net/usb/qmi_wwan.c+1−0
@@ -1359,6 +1359,7 @@ static const struct usb_device_id products[] = { · 1358 unmodified lines
13591359 {QMI_FIXED_INTF(0x413c, 0x81b3, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */
13601360 {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */
13611361 {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */
1362+ {QMI_FIXED_INTF(0x413c, 0x81cc, 8)}, /* Dell Wireless 5816e */
13621363 {QMI_FIXED_INTF(0x413c, 0x81d7, 0)}, /* Dell Wireless 5821e */
13631364 {QMI_FIXED_INTF(0x413c, 0x81d7, 1)}, /* Dell Wireless 5821e preproduction config */
13641365 {QMI_FIXED_INTF(0x413c, 0x81e0, 0)}, /* Dell Wireless 5821e with eSIM support*/
drivers/net/wireguard/queueing.c+3−1
@@ -35,8 +35,10 @@ int wg_packet_queue_init(struct crypt_queue *queue, work_func_t function, · 34 unmodified lines
3535 if (multicore) {
3636 queue->worker = wg_packet_percpu_multicore_worker_alloc(
3737 function, queue);
38− if (!queue->worker)
38+ if (!queue->worker) {
39+ ptr_ring_cleanup(&queue->ring, NULL);
3940 return -ENOMEM;
41+ }
4042 } else {
4143 INIT_WORK(&queue->work, function);
4244 }
drivers/net/wireguard/receive.c+10−11
@@ -226,21 +226,20 @@ void wg_packet_handshake_receive_worker(struct work_struct *work) · 225 unmodified lines
226226 static void keep_key_fresh(struct wg_peer *peer)
227227 {
228228 struct noise_keypair *keypair;
229− bool send = false;
229+ bool send;
230230
231231 if (peer->sent_lastminute_handshake)
232232 return;
233233
234234 rcu_read_lock_bh();
235235 keypair = rcu_dereference_bh(peer->keypairs.current_keypair);
236− if (likely(keypair && READ_ONCE(keypair->sending.is_valid)) &&
237− keypair->i_am_the_initiator &&
238− unlikely(wg_birthdate_has_expired(keypair->sending.birthdate,
239− REJECT_AFTER_TIME - KEEPALIVE_TIMEOUT - REKEY_TIMEOUT)))
240− send = true;
236+ send = keypair && READ_ONCE(keypair->sending.is_valid) &&
237+ keypair->i_am_the_initiator &&
238+ wg_birthdate_has_expired(keypair->sending.birthdate,
239+ REJECT_AFTER_TIME - KEEPALIVE_TIMEOUT - REKEY_TIMEOUT);
241240 rcu_read_unlock_bh();
242241
243− if (send) {
242+ if (unlikely(send)) {
244243 peer->sent_lastminute_handshake = true;
245244 wg_packet_send_queued_handshake_initiation(peer, false);
246245 }
@@ -393,13 +392,11 @@ static void wg_packet_consume_data_done(struct wg_peer *peer, · 146 unmodified lines
393392 len = ntohs(ip_hdr(skb)->tot_len);
394393 if (unlikely(len < sizeof(struct iphdr)))
395394 goto dishonest_packet_size;
396− if (INET_ECN_is_ce(PACKET_CB(skb)->ds))
397− IP_ECN_set_ce(ip_hdr(skb));
395+ INET_ECN_decapsulate(skb, PACKET_CB(skb)->ds, ip_hdr(skb)->tos);
398396 } else if (skb->protocol == htons(ETH_P_IPV6)) {
399397 len = ntohs(ipv6_hdr(skb)->payload_len) +
400398 sizeof(struct ipv6hdr);
401− if (INET_ECN_is_ce(PACKET_CB(skb)->ds))
402− IP6_ECN_set_ce(skb, ipv6_hdr(skb));
399+ INET_ECN_decapsulate(skb, PACKET_CB(skb)->ds, ipv6_get_dsfield(ipv6_hdr(skb)));
403400 } else {
404401 goto dishonest_packet_type;
405402 }
@@ -518,6 +515,8 @@ void wg_packet_decrypt_worker(struct work_struct *work) · 112 unmodified lines
518515 &PACKET_CB(skb)->keypair->receiving)) ?
519516 PACKET_STATE_CRYPTED : PACKET_STATE_DEAD;
520517 wg_queue_enqueue_per_peer_napi(skb, state);
518+ if (need_resched())
519+ cond_resched();
521520 }
522521 }
523522
drivers/net/wireguard/selftest/ratelimiter.c+2−2
@@ -120,9 +120,9 @@ bool __init wg_ratelimiter_selftest(void) · 119 unmodified lines
120120 enum { TRIALS_BEFORE_GIVING_UP = 5000 };
121121 bool success = false;
122122 int test = 0, trials;
123− struct sk_buff *skb4, *skb6;
123+ struct sk_buff *skb4, *skb6 = NULL;
124124 struct iphdr *hdr4;
125− struct ipv6hdr *hdr6;
125+ struct ipv6hdr *hdr6 = NULL;
126126
127127 if (IS_ENABLED(CONFIG_KASAN) || IS_ENABLED(CONFIG_UBSAN))
128128 return true;
drivers/net/wireguard/send.c+10−10
@@ -124,20 +124,17 @@ void wg_packet_send_handshake_cookie(struct wg_device *wg, · 123 unmodified lines
124124 static void keep_key_fresh(struct wg_peer *peer)
125125 {
126126 struct noise_keypair *keypair;
127− bool send = false;
127+ bool send;
128128
129129 rcu_read_lock_bh();
130130 keypair = rcu_dereference_bh(peer->keypairs.current_keypair);
131− if (likely(keypair && READ_ONCE(keypair->sending.is_valid)) &&
132− (unlikely(atomic64_read(&keypair->sending.counter.counter) >
133− REKEY_AFTER_MESSAGES) ||
134− (keypair->i_am_the_initiator &&
135− unlikely(wg_birthdate_has_expired(keypair->sending.birthdate,
136− REKEY_AFTER_TIME)))))
137− send = true;
131+ send = keypair && READ_ONCE(keypair->sending.is_valid) &&
132+ (atomic64_read(&keypair->sending.counter.counter) > REKEY_AFTER_MESSAGES ||
133+ (keypair->i_am_the_initiator &&
134+ wg_birthdate_has_expired(keypair->sending.birthdate, REKEY_AFTER_TIME)));
138135 rcu_read_unlock_bh();
139136
140− if (send)
137+ if (unlikely(send))
141138 wg_packet_send_queued_handshake_initiation(peer, false);
142139 }
143140
@@ -281,6 +278,8 @@ void wg_packet_tx_worker(struct work_struct *work) · 137 unmodified lines
281278
282279 wg_noise_keypair_put(keypair, false);
283280 wg_peer_put(peer);
281+ if (need_resched())
282+ cond_resched();
284283 }
285284 }
286285
@@ -304,7 +303,8 @@ void wg_packet_encrypt_worker(struct work_struct *work) · 17 unmodified lines
304303 }
305304 wg_queue_enqueue_per_peer(&PACKET_PEER(first)->tx_queue, first,
306305 state);
307−
306+ if (need_resched())
307+ cond_resched();
308308 }
309309 }
310310
drivers/net/wireguard/socket.c+0−12
@@ -76,12 +76,6 @@ static int send4(struct wg_device *wg, struct sk_buff *skb, · 75 unmodified lines
7676 net_dbg_ratelimited("%s: No route to %pISpfsc, error %d\n",
7777 wg->dev->name, &endpoint->addr, ret);
7878 goto err;
79− } else if (unlikely(rt->dst.dev == skb->dev)) {
80− ip_rt_put(rt);
81− ret = -ELOOP;
82− net_dbg_ratelimited("%s: Avoiding routing loop to %pISpfsc\n",
83− wg->dev->name, &endpoint->addr);
84− goto err;
8579 }
8680 if (cache)
8781 dst_cache_set_ip4(cache, &rt->dst, fl.saddr);
@@ -149,12 +143,6 @@ static int send6(struct wg_device *wg, struct sk_buff *skb, · 61 unmodified lines
149143 net_dbg_ratelimited("%s: No route to %pISpfsc, error %d\n",
150144 wg->dev->name, &endpoint->addr, ret);
151145 goto err;
152− } else if (unlikely(dst->dev == skb->dev)) {
153− dst_release(dst);
154− ret = -ELOOP;
155− net_dbg_ratelimited("%s: Avoiding routing loop to %pISpfsc\n",
156− wg->dev->name, &endpoint->addr);
157− goto err;
158146 }
159147 if (cache)
160148 dst_cache_set_ip6(cache, dst, &fl.saddr);
drivers/nvme/host/core.c+3−1
@@ -1110,7 +1110,7 @@ static int nvme_identify_ns_descs(struct nvme_ctrl *ctrl, unsigned nsid, · 1109 unmodified lines
11101110 * Don't treat an error as fatal, as we potentially already
11111111 * have a NGUID or EUI-64.
11121112 */
1113− if (status > 0)
1113+ if (status > 0 && !(status & NVME_SC_DNR))
11141114 status = 0;
11151115 goto free_data;
11161116 }
@@ -3642,6 +3642,8 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) · 2525 unmodified lines
36423642
36433643 return;
36443644 out_put_disk:
3645+ /* prevent double queue cleanup */
3646+ ns->disk->queue = NULL;
36453647 put_disk(ns->disk);
36463648 out_unlink_ns:
36473649 mutex_lock(&ctrl->subsys->lock);
drivers/nvme/host/pci.c+5−1
@@ -973,9 +973,13 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx) · 972 unmodified lines
973973
974974 static inline void nvme_update_cq_head(struct nvme_queue *nvmeq)
975975 {
976− if (++nvmeq->cq_head == nvmeq->q_depth) {
976+ u16 tmp = nvmeq->cq_head + 1;
977+
978+ if (tmp == nvmeq->q_depth) {
977979 nvmeq->cq_head = 0;
978980 nvmeq->cq_phase ^= 1;
981+ } else {
982+ nvmeq->cq_head = tmp;
979983 }
980984 }
981985
drivers/phy/qualcomm/phy-qcom-qusb2.c+7−0
@@ -815,6 +815,13 @@ static const struct of_device_id qusb2_phy_of_match_table[] = { · 814 unmodified lines
815815 }, {
816816 .compatible = "qcom,msm8998-qusb2-phy",
817817 .data = &msm8998_phy_cfg,
818+ }, {
819+ /*
820+ * Deprecated. Only here to support legacy device
821+ * trees that didn't include "qcom,qusb2-v2-phy"
822+ */
823+ .compatible = "qcom,sdm845-qusb2-phy",
824+ .data = &qusb2_v2_phy_cfg,
818825 }, {
819826 .compatible = "qcom,qusb2-v2-phy",
820827 .data = &qusb2_v2_phy_cfg,
drivers/phy/qualcomm/phy-qcom-usb-hs-28nm.c+21−11
@@ -160,18 +160,11 @@ static int qcom_snps_hsphy_power_on(struct phy *phy) · 159 unmodified lines
160160 ret = regulator_bulk_enable(VREG_NUM, priv->vregs);
161161 if (ret)
162162 return ret;
163− ret = clk_bulk_prepare_enable(priv->num_clks, priv->clks);
164− if (ret)
165− goto err_disable_regulator;
163+
166164 qcom_snps_hsphy_disable_hv_interrupts(priv);
167165 qcom_snps_hsphy_exit_retention(priv);
168166
169167 return 0;
170−
171−err_disable_regulator:
172− regulator_bulk_disable(VREG_NUM, priv->vregs);
173−
174− return ret;
175168 }
176169
177170 static int qcom_snps_hsphy_power_off(struct phy *phy)
@@ -180,7 +173,6 @@ static int qcom_snps_hsphy_power_off(struct phy *phy) · 2 unmodified lines
180173
181174 qcom_snps_hsphy_enter_retention(priv);
182175 qcom_snps_hsphy_enable_hv_interrupts(priv);
183− clk_bulk_disable_unprepare(priv->num_clks, priv->clks);
184176 regulator_bulk_disable(VREG_NUM, priv->vregs);
185177
186178 return 0;
@@ -266,21 +258,39 @@ static int qcom_snps_hsphy_init(struct phy *phy) · 79 unmodified lines
266258 struct hsphy_priv *priv = phy_get_drvdata(phy);
267259 int ret;
268260
269− ret = qcom_snps_hsphy_reset(priv);
261+ ret = clk_bulk_prepare_enable(priv->num_clks, priv->clks);
270262 if (ret)
271263 return ret;
272264
265+ ret = qcom_snps_hsphy_reset(priv);
266+ if (ret)
267+ goto disable_clocks;
268+
273269 qcom_snps_hsphy_init_sequence(priv);
274270
275271 ret = qcom_snps_hsphy_por_reset(priv);
276272 if (ret)
277− return ret;
273+ goto disable_clocks;
274+
275+ return 0;
276+
277+disable_clocks:
278+ clk_bulk_disable_unprepare(priv->num_clks, priv->clks);
279+ return ret;
280+}
281+
282+static int qcom_snps_hsphy_exit(struct phy *phy)
283+{
284+ struct hsphy_priv *priv = phy_get_drvdata(phy);
285+
286+ clk_bulk_disable_unprepare(priv->num_clks, priv->clks);
278287
279288 return 0;
280289 }
281290
282291 static const struct phy_ops qcom_snps_hsphy_ops = {
283292 .init = qcom_snps_hsphy_init,
293+ .exit = qcom_snps_hsphy_exit,
284294 .power_on = qcom_snps_hsphy_power_on,
285295 .power_off = qcom_snps_hsphy_power_off,
286296 .set_mode = qcom_snps_hsphy_set_mode,
drivers/platform/chrome/cros_ec_sensorhub.c+46−34
@@ -52,28 +52,15 @@ static int cros_ec_sensorhub_register(struct device *dev, · 51 unmodified lines
5252 int sensor_type[MOTIONSENSE_TYPE_MAX] = { 0 };
5353 struct cros_ec_command *msg = sensorhub->msg;
5454 struct cros_ec_dev *ec = sensorhub->ec;
55− int ret, i, sensor_num;
55+ int ret, i;
5656 char *name;
5757
58− sensor_num = cros_ec_get_sensor_count(ec);
59− if (sensor_num < 0) {
60− dev_err(dev,
61− "Unable to retrieve sensor information (err:%d)\n",
62− sensor_num);
63− return sensor_num;
64− }
65−
66− sensorhub->sensor_num = sensor_num;
67− if (sensor_num == 0) {
68− dev_err(dev, "Zero sensors reported.\n");
69− return -EINVAL;
70− }
7158
7259 msg->version = 1;
7360 msg->insize = sizeof(struct ec_response_motion_sense);
7461 msg->outsize = sizeof(struct ec_params_motion_sense);
7562
76− for (i = 0; i < sensor_num; i++) {
63+ for (i = 0; i < sensorhub->sensor_num; i++) {
7764 sensorhub->params->cmd = MOTIONSENSE_CMD_INFO;
7865 sensorhub->params->info.sensor_num = i;
7966
@@ -140,8 +127,7 @@ static int cros_ec_sensorhub_probe(struct platform_device *pdev) · 60 unmodified lines
140127 struct cros_ec_dev *ec = dev_get_drvdata(dev->parent);
141128 struct cros_ec_sensorhub *data;
142129 struct cros_ec_command *msg;
143− int ret;
144− int i;
130+ int ret, i, sensor_num;
145131
146132 msg = devm_kzalloc(dev, sizeof(struct cros_ec_command) +
147133 max((u16)sizeof(struct ec_params_motion_sense),
@@ -166,10 +152,52 @@ static int cros_ec_sensorhub_probe(struct platform_device *pdev) · 18 unmodified lines
166152 dev_set_drvdata(dev, data);
167153
168154 /* Check whether this EC is a sensor hub. */
169− if (cros_ec_check_features(data->ec, EC_FEATURE_MOTION_SENSE)) {
155+ if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE)) {
156+ sensor_num = cros_ec_get_sensor_count(ec);
157+ if (sensor_num < 0) {
158+ dev_err(dev,
159+ "Unable to retrieve sensor information (err:%d)\n",
160+ sensor_num);
161+ return sensor_num;
162+ }
163+ if (sensor_num == 0) {
164+ dev_err(dev, "Zero sensors reported.\n");
165+ return -EINVAL;
166+ }
167+ data->sensor_num = sensor_num;
168+
169+ /*
170+ * Prepare the ring handler before enumering the
171+ * sensors.
172+ */
173+ if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) {
174+ ret = cros_ec_sensorhub_ring_allocate(data);
175+ if (ret)
176+ return ret;
177+ }
178+
179+ /* Enumerate the sensors.*/
170180 ret = cros_ec_sensorhub_register(dev, data);
171181 if (ret)
172182 return ret;
183+
184+ /*
185+ * When the EC does not have a FIFO, the sensors will query
186+ * their data themselves via sysfs or a software trigger.
187+ */
188+ if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) {
189+ ret = cros_ec_sensorhub_ring_add(data);
190+ if (ret)
191+ return ret;
192+ /*
193+ * The msg and its data is not under the control of the
194+ * ring handler.
195+ */
196+ return devm_add_action_or_reset(dev,
197+ cros_ec_sensorhub_ring_remove,
198+ data);
199+ }
200+
173201 } else {
174202 /*
175203 * If the device has sensors but does not claim to
@@ -184,22 +212,6 @@ static int cros_ec_sensorhub_probe(struct platform_device *pdev) · 8 unmodified lines
184212 }
185213 }
186214
187− /*
188− * If the EC does not have a FIFO, the sensors will query their data
189− * themselves via sysfs or a software trigger.
190− */
191− if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) {
192− ret = cros_ec_sensorhub_ring_add(data);
193− if (ret)
194− return ret;
195− /*
196− * The msg and its data is not under the control of the ring
197− * handler.
198− */
199− return devm_add_action_or_reset(dev,
200− cros_ec_sensorhub_ring_remove,
201− data);
202− }
203215
204216 return 0;
205217 }
drivers/platform/chrome/cros_ec_sensorhub_ring.c+46−27
@@ -957,17 +957,15 @@ static int cros_ec_sensorhub_event(struct notifier_block *nb, · 956 unmodified lines
957957 }
958958
959959 /**
960− * cros_ec_sensorhub_ring_add() - Add the FIFO functionality if the EC
961− * supports it.
960+ * cros_ec_sensorhub_ring_allocate() - Prepare the FIFO functionality if the EC
961+ * supports it.
962962 *
963963 * @sensorhub : Sensor Hub object.
964964 *
965965 * Return: 0 on success.
966966 */
967−int cros_ec_sensorhub_ring_add(struct cros_ec_sensorhub *sensorhub)
967+int cros_ec_sensorhub_ring_allocate(struct cros_ec_sensorhub *sensorhub)
968968 {
969− struct cros_ec_dev *ec = sensorhub->ec;
970− int ret;
971969 int fifo_info_length =
972970 sizeof(struct ec_response_motion_sense_fifo_info) +
973971 sizeof(u16) * sensorhub->sensor_num;
@@ -978,6 +976,49 @@ int cros_ec_sensorhub_ring_add(struct cros_ec_sensorhub *sensorhub) · 4 unmodified lines
978976 if (!sensorhub->fifo_info)
979977 return -ENOMEM;
980978
979+ /*
980+ * Allocate the callback area based on the number of sensors.
981+ * Add one for the sensor ring.
982+ */
983+ sensorhub->push_data = devm_kcalloc(sensorhub->dev,
984+ sensorhub->sensor_num,
985+ sizeof(*sensorhub->push_data),
986+ GFP_KERNEL);
987+ if (!sensorhub->push_data)
988+ return -ENOMEM;
989+
990+ sensorhub->tight_timestamps = cros_ec_check_features(
991+ sensorhub->ec,
992+ EC_FEATURE_MOTION_SENSE_TIGHT_TIMESTAMPS);
993+
994+ if (sensorhub->tight_timestamps) {
995+ sensorhub->batch_state = devm_kcalloc(sensorhub->dev,
996+ sensorhub->sensor_num,
997+ sizeof(*sensorhub->batch_state),
998+ GFP_KERNEL);
999+ if (!sensorhub->batch_state)
1000+ return -ENOMEM;
1001+ }
1002+
1003+ return 0;
1004+}
1005+
1006+/**
1007+ * cros_ec_sensorhub_ring_add() - Add the FIFO functionality if the EC
1008+ * supports it.
1009+ *
1010+ * @sensorhub : Sensor Hub object.
1011+ *
1012+ * Return: 0 on success.
1013+ */
1014+int cros_ec_sensorhub_ring_add(struct cros_ec_sensorhub *sensorhub)
1015+{
1016+ struct cros_ec_dev *ec = sensorhub->ec;
1017+ int ret;
1018+ int fifo_info_length =
1019+ sizeof(struct ec_response_motion_sense_fifo_info) +
1020+ sizeof(u16) * sensorhub->sensor_num;
1021+
9811022 /* Retrieve FIFO information */
9821023 sensorhub->msg->version = 2;
9831024 sensorhub->params->cmd = MOTIONSENSE_CMD_FIFO_INFO;
@@ -998,31 +1039,9 @@ int cros_ec_sensorhub_ring_add(struct cros_ec_sensorhub *sensorhub) · 14 unmodified lines
9981039 if (!sensorhub->ring)
9991040 return -ENOMEM;
10001041
1001− /*
1002− * Allocate the callback area based on the number of sensors.
1003− */
1004− sensorhub->push_data = devm_kcalloc(
1005− sensorhub->dev, sensorhub->sensor_num,
1006− sizeof(*sensorhub->push_data),
1007− GFP_KERNEL);
1008− if (!sensorhub->push_data)
1009− return -ENOMEM;
1010−
10111042 sensorhub->fifo_timestamp[CROS_EC_SENSOR_LAST_TS] =
10121043 cros_ec_get_time_ns();
10131044
1014− sensorhub->tight_timestamps = cros_ec_check_features(
1015− ec, EC_FEATURE_MOTION_SENSE_TIGHT_TIMESTAMPS);
1016−
1017− if (sensorhub->tight_timestamps) {
1018− sensorhub->batch_state = devm_kcalloc(sensorhub->dev,
1019− sensorhub->sensor_num,
1020− sizeof(*sensorhub->batch_state),
1021− GFP_KERNEL);
1022− if (!sensorhub->batch_state)
1023− return -ENOMEM;
1024− }
1025−
10261045 /* Register the notifier that will act as a top half interrupt. */
10271046 sensorhub->notifier.notifier_call = cros_ec_sensorhub_event;
10281047 ret = blocking_notifier_chain_register(&ec->ec_dev->event_notifier,
drivers/platform/x86/asus-nb-wmi.c+24−0
@@ -515,9 +515,33 @@ static struct asus_wmi_driver asus_nb_wmi_driver = { · 514 unmodified lines
515515 .detect_quirks = asus_nb_wmi_quirks,
516516 };
517517
518+static const struct dmi_system_id asus_nb_wmi_blacklist[] __initconst = {
519+ {
520+ /*
521+ * asus-nb-wm adds no functionality. The T100TA has a detachable
522+ * USB kbd, so no hotkeys and it has no WMI rfkill; and loading
523+ * asus-nb-wm causes the camera LED to turn and _stay_ on.
524+ */
525+ .matches = {
526+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
527+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100TA"),
528+ },
529+ },
530+ {
531+ /* The Asus T200TA has the same issue as the T100TA */
532+ .matches = {
533+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
534+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T200TA"),
535+ },
536+ },
537+ {} /* Terminating entry */
538+};
518539
519540 static int __init asus_nb_wmi_init(void)
520541 {
542+ if (dmi_check_system(asus_nb_wmi_blacklist))
543+ return -ENODEV;
544+
521545 return asus_wmi_register_driver(&asus_nb_wmi_driver);
522546 }
523547
drivers/platform/x86/intel-uncore-frequency.c+1−1
@@ -53,7 +53,7 @@ static int uncore_max_entries __read_mostly; · 52 unmodified lines
5353 /* Storage for uncore data for all instances */
5454 static struct uncore_data *uncore_instances;
5555 /* Root of the all uncore sysfs kobjs */
56−struct kobject *uncore_root_kobj;
56+static struct kobject *uncore_root_kobj;
5757 /* Stores the CPU mask of the target CPUs to use during uncore read/write */
5858 static cpumask_t uncore_cpu_mask;
5959 /* CPU online callback register instance */
drivers/platform/x86/intel_pmc_core.c+5−19
@@ -255,7 +255,7 @@ static const struct pmc_bit_map *ext_cnp_pfear_map[] = { · 254 unmodified lines
255255 };
256256
257257 static const struct pmc_bit_map icl_pfear_map[] = {
258− /* Ice Lake generation onwards only */
258+ /* Ice Lake and Jasper Lake generation onwards only */
259259 {"RES_65", BIT(0)},
260260 {"RES_66", BIT(1)},
261261 {"RES_67", BIT(2)},
@@ -274,7 +274,7 @@ static const struct pmc_bit_map *ext_icl_pfear_map[] = { · 12 unmodified lines
274274 };
275275
276276 static const struct pmc_bit_map tgl_pfear_map[] = {
277− /* Tiger Lake, Elkhart Lake and Jasper Lake generation onwards only */
277+ /* Tiger Lake and Elkhart Lake generation onwards only */
278278 {"PSF9", BIT(0)},
279279 {"RES_66", BIT(1)},
280280 {"RES_67", BIT(2)},
@@ -692,7 +692,6 @@ static void pmc_core_lpm_display(struct pmc_dev *pmcdev, struct device *dev, · 411 unmodified lines
692692 kfree(lpm_regs);
693693 }
694694
695−#if IS_ENABLED(CONFIG_DEBUG_FS)
696695 static bool slps0_dbg_latch;
697696
698697 static inline u8 pmc_core_reg_read_byte(struct pmc_dev *pmcdev, int offset)
@@ -1133,15 +1132,6 @@ static void pmc_core_dbgfs_register(struct pmc_dev *pmcdev) · 434 unmodified lines
11331132 &pmc_core_substate_l_sts_regs_fops);
11341133 }
11351134 }
1136−#else
1137−static inline void pmc_core_dbgfs_register(struct pmc_dev *pmcdev)
1138−{
1139−}
1140−
1141−static inline void pmc_core_dbgfs_unregister(struct pmc_dev *pmcdev)
1142−{
1143−}
1144−#endif /* CONFIG_DEBUG_FS */
11451135
11461136 static const struct x86_cpu_id intel_pmc_core_ids[] = {
11471137 X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_L, &spt_reg_map),
@@ -1156,7 +1146,7 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = { · 8 unmodified lines
11561146 X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE_L, &tgl_reg_map),
11571147 X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE, &tgl_reg_map),
11581148 X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT, &tgl_reg_map),
1159− X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_L, &tgl_reg_map),
1149+ X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_L, &icl_reg_map),
11601150 {}
11611151 };
11621152
@@ -1260,13 +1250,11 @@ static int pmc_core_remove(struct platform_device *pdev) · 97 unmodified lines
12601250 return 0;
12611251 }
12621252
1263−#ifdef CONFIG_PM_SLEEP
1264−
12651253 static bool warn_on_s0ix_failures;
12661254 module_param(warn_on_s0ix_failures, bool, 0644);
12671255 MODULE_PARM_DESC(warn_on_s0ix_failures, "Check and warn for S0ix failures");
12681256
1269−static int pmc_core_suspend(struct device *dev)
1257+static __maybe_unused int pmc_core_suspend(struct device *dev)
12701258 {
12711259 struct pmc_dev *pmcdev = dev_get_drvdata(dev);
12721260
@@ -1318,7 +1306,7 @@ static inline bool pmc_core_is_s0ix_failed(struct pmc_dev *pmcdev) · 45 unmodified lines
13181306 return false;
13191307 }
13201308
1321−static int pmc_core_resume(struct device *dev)
1309+static __maybe_unused int pmc_core_resume(struct device *dev)
13221310 {
13231311 struct pmc_dev *pmcdev = dev_get_drvdata(dev);
13241312 const struct pmc_bit_map **maps = pmcdev->map->lpm_sts;
@@ -1348,8 +1336,6 @@ static int pmc_core_resume(struct device *dev) · 23 unmodified lines
13481336 return 0;
13491337 }
13501338
1351−#endif
1352−
13531339 static const struct dev_pm_ops pmc_core_pm_ops = {
13541340 SET_LATE_SYSTEM_SLEEP_PM_OPS(pmc_core_suspend, pmc_core_resume)
13551341 };
drivers/platform/x86/intel_pmc_core.h+0−2
@@ -282,9 +282,7 @@ struct pmc_dev { · 281 unmodified lines
282282 u32 base_addr;
283283 void __iomem *regbase;
284284 const struct pmc_reg_map *map;
285−#if IS_ENABLED(CONFIG_DEBUG_FS)
286285 struct dentry *dbgfs_dir;
287−#endif /* CONFIG_DEBUG_FS */
288286 int pmc_xram_read_bit;
289287 struct mutex lock; /* generic mutex lock for PMC Core */
290288
drivers/platform/x86/surface3_power.c+2−2
@@ -522,8 +522,8 @@ static int mshw0011_probe(struct i2c_client *client) · 521 unmodified lines
522522 strlcpy(board_info.type, "MSHW0011-bat0", I2C_NAME_SIZE);
523523
524524 bat0 = i2c_acpi_new_device(dev, 1, &board_info);
525− if (!bat0)
526− return -ENOMEM;
525+ if (IS_ERR(bat0))
526+ return PTR_ERR(bat0);
527527
528528 data->bat0 = bat0;
529529 i2c_set_clientdata(bat0, data);
drivers/platform/x86/thinkpad_acpi.c+1−1
@@ -9548,7 +9548,7 @@ static ssize_t tpacpi_battery_store(int what, · 9547 unmodified lines
95489548 if (!battery_info.batteries[battery].start_support)
95499549 return -ENODEV;
95509550 /* valid values are [0, 99] */
9551− if (value < 0 || value > 99)
9551+ if (value > 99)
95529552 return -EINVAL;
95539553 if (value > battery_info.batteries[battery].charge_stop)
95549554 return -EINVAL;
drivers/platform/x86/xiaomi-wmi.c+2−2
@@ -23,7 +23,7 @@ struct xiaomi_wmi { · 22 unmodified lines
2323 unsigned int key_code;
2424 };
2525
26−int xiaomi_wmi_probe(struct wmi_device *wdev, const void *context)
26+static int xiaomi_wmi_probe(struct wmi_device *wdev, const void *context)
2727 {
2828 struct xiaomi_wmi *data;
2929
@@ -48,7 +48,7 @@ int xiaomi_wmi_probe(struct wmi_device *wdev, const void *context) · 18 unmodified lines
4848 return input_register_device(data->input_dev);
4949 }
5050
51−void xiaomi_wmi_notify(struct wmi_device *wdev, union acpi_object *dummy)
51+static void xiaomi_wmi_notify(struct wmi_device *wdev, union acpi_object *dummy)
5252 {
5353 struct xiaomi_wmi *data;
5454
drivers/regulator/core.c+11−14
@@ -5754,10 +5754,6 @@ static DECLARE_DELAYED_WORK(regulator_init_complete_work, · 5753 unmodified lines
57545754
57555755 static int __init regulator_init_complete(void)
57565756 {
5757− int delay = driver_deferred_probe_timeout;
5758−
5759− if (delay < 0)
5760− delay = 0;
57615757 /*
57625758 * Since DT doesn't provide an idiomatic mechanism for
57635759 * enabling full constraints and since it's much more natural
@@ -5768,17 +5764,18 @@ static int __init regulator_init_complete(void) · 4 unmodified lines
57685764 has_full_constraints = true;
57695765
57705766 /*
5771− * If driver_deferred_probe_timeout is set, we punt
5772− * completion for that many seconds since systems like
5773− * distros will load many drivers from userspace so consumers
5774− * might not always be ready yet, this is particularly an
5775− * issue with laptops where this might bounce the display off
5776− * then on. Ideally we'd get a notification from userspace
5777− * when this happens but we don't so just wait a bit and hope
5778− * we waited long enough. It'd be better if we'd only do
5779− * this on systems that need it.
5767+ * We punt completion for an arbitrary amount of time since
5768+ * systems like distros will load many drivers from userspace
5769+ * so consumers might not always be ready yet, this is
5770+ * particularly an issue with laptops where this might bounce
5771+ * the display off then on. Ideally we'd get a notification
5772+ * from userspace when this happens but we don't so just wait
5773+ * a bit and hope we waited long enough. It'd be better if
5774+ * we'd only do this on systems that need it, and a kernel
5775+ * command line option might be useful.
57805776 */
5781− schedule_delayed_work(&regulator_init_complete_work, delay * HZ);
5777+ schedule_delayed_work(&regulator_init_complete_work,
5778+ msecs_to_jiffies(30000));
57825779
57835780 return 0;
57845781 }
drivers/s390/net/qeth_core_main.c+5−5
@@ -6717,17 +6717,17 @@ int qeth_stop(struct net_device *dev) · 6716 unmodified lines
67176717 unsigned int i;
67186718
67196719 /* Quiesce the NAPI instances: */
6720− qeth_for_each_output_queue(card, queue, i) {
6720+ qeth_for_each_output_queue(card, queue, i)
67216721 napi_disable(&queue->napi);
6722− del_timer_sync(&queue->timer);
6723− }
67246722
67256723 /* Stop .ndo_start_xmit, might still access queue->napi. */
67266724 netif_tx_disable(dev);
67276725
6728− /* Queues may get re-allocated, so remove the NAPIs here. */
6729− qeth_for_each_output_queue(card, queue, i)
6726+ qeth_for_each_output_queue(card, queue, i) {
6727+ del_timer_sync(&queue->timer);
6728+ /* Queues may get re-allocated, so remove the NAPIs. */
67306729 netif_napi_del(&queue->napi);
6730+ }
67316731 } else {
67326732 netif_tx_disable(dev);
67336733 }
drivers/scsi/ibmvscsi/ibmvfc.c+5−0
@@ -3640,6 +3640,11 @@ static void ibmvfc_tgt_implicit_logout_and_del(struct ibmvfc_target *tgt) · 3639 unmodified lines
36403640 struct ibmvfc_host *vhost = tgt->vhost;
36413641 struct ibmvfc_event *evt;
36423642
3643+ if (!vhost->logged_in) {
3644+ ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT);
3645+ return;
3646+ }
3647+
36433648 if (vhost->discovery_threads >= disc_threads)
36443649 return;
36453650
drivers/scsi/ibmvscsi/ibmvscsi.c+0−4
@@ -2320,16 +2320,12 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id) · 2319 unmodified lines
23202320 static int ibmvscsi_remove(struct vio_dev *vdev)
23212321 {
23222322 struct ibmvscsi_host_data *hostdata = dev_get_drvdata(&vdev->dev);
2323− unsigned long flags;
23242323
23252324 srp_remove_host(hostdata->host);
23262325 scsi_remove_host(hostdata->host);
23272326
23282327 purge_requests(hostdata, DID_ERROR);
2329−
2330− spin_lock_irqsave(hostdata->host->host_lock, flags);
23312328 release_event_pool(&hostdata->pool, hostdata);
2332− spin_unlock_irqrestore(hostdata->host->host_lock, flags);
23332329
23342330 ibmvscsi_release_crq_queue(&hostdata->queue, hostdata,
23352331 max_events);
drivers/scsi/qla2xxx/qla_attr.c+1−1
@@ -3031,11 +3031,11 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) · 3030 unmodified lines
30313031 test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags))
30323032 msleep(1000);
30333033
3034− qla_nvme_delete(vha);
30353034
30363035 qla24xx_disable_vp(vha);
30373036 qla2x00_wait_for_sess_deletion(vha);
30383037
3038+ qla_nvme_delete(vha);
30393039 vha->flags.delete_progress = 1;
30403040
30413041 qlt_remove_target(ha, vha);
drivers/scsi/qla2xxx/qla_mbx.c+1−1
@@ -3153,7 +3153,7 @@ qla24xx_abort_command(srb_t *sp) · 3152 unmodified lines
31533153 ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x108c,
31543154 "Entered %s.\n", __func__);
31553155
3156− if (vha->flags.qpairs_available && sp->qpair)
3156+ if (sp->qpair)
31573157 req = sp->qpair->req;
31583158 else
31593159 return QLA_FUNCTION_FAILED;
drivers/scsi/qla2xxx/qla_os.c+17−18
@@ -3732,6 +3732,13 @@ qla2x00_remove_one(struct pci_dev *pdev) · 3731 unmodified lines
37323732 }
37333733 qla2x00_wait_for_hba_ready(base_vha);
37343734
3735+ /*
3736+ * if UNLOADING flag is already set, then continue unload,
3737+ * where it was set first.
3738+ */
3739+ if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags))
3740+ return;
3741+
37353742 if (IS_QLA25XX(ha) || IS_QLA2031(ha) || IS_QLA27XX(ha) ||
37363743 IS_QLA28XX(ha)) {
37373744 if (ha->flags.fw_started)
@@ -3750,15 +3757,6 @@ qla2x00_remove_one(struct pci_dev *pdev) · 12 unmodified lines
37503757
37513758 qla2x00_wait_for_sess_deletion(base_vha);
37523759
3753− /*
3754− * if UNLOAD flag is already set, then continue unload,
3755− * where it was set first.
3756− */
3757− if (test_bit(UNLOADING, &base_vha->dpc_flags))
3758− return;
3759−
3760− set_bit(UNLOADING, &base_vha->dpc_flags);
3761−
37623760 qla_nvme_delete(base_vha);
37633761
37643762 dma_free_coherent(&ha->pdev->dev,
@@ -4864,6 +4862,9 @@ qla2x00_alloc_work(struct scsi_qla_host *vha, enum qla_work_type type) · 1099 unmodified lines
48644862 struct qla_work_evt *e;
48654863 uint8_t bail;
48664864
4865+ if (test_bit(UNLOADING, &vha->dpc_flags))
4866+ return NULL;
4867+
48674868 QLA_VHA_MARK_BUSY(vha, bail);
48684869 if (bail)
48694870 return NULL;
@@ -6628,13 +6629,6 @@ qla2x00_disable_board_on_pci_error(struct work_struct *work) · 1758 unmodified lines
66286629 struct pci_dev *pdev = ha->pdev;
66296630 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
66306631
6631− /*
6632− * if UNLOAD flag is already set, then continue unload,
6633− * where it was set first.
6634− */
6635− if (test_bit(UNLOADING, &base_vha->dpc_flags))
6636− return;
6637−
66386632 ql_log(ql_log_warn, base_vha, 0x015b,
66396633 "Disabling adapter.\n");
66406634
@@ -6645,9 +6639,14 @@ qla2x00_disable_board_on_pci_error(struct work_struct *work) · 4 unmodified lines
66456639 return;
66466640 }
66476641
6648− qla2x00_wait_for_sess_deletion(base_vha);
6642+ /*
6643+ * if UNLOADING flag is already set, then continue unload,
6644+ * where it was set first.
6645+ */
6646+ if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags))
6647+ return;
66496648
6650− set_bit(UNLOADING, &base_vha->dpc_flags);
6649+ qla2x00_wait_for_sess_deletion(base_vha);
66516650
66526651 qla2x00_delete_all_vps(ha, base_vha);
66536652
drivers/scsi/scsi_lib.c+1−0
@@ -2284,6 +2284,7 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state) · 2283 unmodified lines
22842284 switch (oldstate) {
22852285 case SDEV_RUNNING:
22862286 case SDEV_CREATED_BLOCK:
2287+ case SDEV_QUIESCE:
22872288 case SDEV_OFFLINE:
22882289 break;
22892290 default:
drivers/staging/gasket/gasket_core.c+4−0
@@ -925,6 +925,10 @@ do_map_region(const struct gasket_dev *gasket_dev, struct vm_area_struct *vma, · 924 unmodified lines
925925 gasket_get_bar_index(gasket_dev,
926926 (vma->vm_pgoff << PAGE_SHIFT) +
927927 driver_desc->legacy_mmap_address_offset);
928+
929+ if (bar_index < 0)
930+ return DO_MAP_REGION_INVALID;
931+
928932 phys_base = gasket_dev->bar_data[bar_index].phys_base + phys_offset;
929933 while (mapped_bytes < map_length) {
930934 /*
drivers/staging/ks7010/TODO+0−1
@@ -30,5 +30,4 @@ Now the TODOs: · 29 unmodified lines
3030
3131 Please send any patches to:
3232 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
33−Wolfram Sang <wsa@the-dreams.de>
3433 Linux Driver Project Developer List <driverdev-devel@linuxdriverproject.org>
drivers/target/target_core_iblock.c+1−1
@@ -432,7 +432,7 @@ iblock_execute_zero_out(struct block_device *bdev, struct se_cmd *cmd) · 431 unmodified lines
432432 target_to_linux_sector(dev, cmd->t_task_lba),
433433 target_to_linux_sector(dev,
434434 sbc_get_write_same_sectors(cmd)),
435− GFP_KERNEL, false);
435+ GFP_KERNEL, BLKDEV_ZERO_NOUNMAP);
436436 if (ret)
437437 return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
438438
drivers/thunderbolt/usb4.c+3−0
@@ -182,6 +182,9 @@ static int usb4_switch_op(struct tb_switch *sw, u16 opcode, u8 *status) · 181 unmodified lines
182182 return ret;
183183
184184 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, ROUTER_CS_26, 1);
185+ if (ret)
186+ return ret;
187+
185188 if (val & ROUTER_CS_26_ONS)
186189 return -EOPNOTSUPP;
187190
drivers/tty/hvc/Kconfig+1−1
@@ -88,7 +88,7 @@ config HVC_DCC · 87 unmodified lines
8888
8989 config HVC_RISCV_SBI
9090 bool "RISC-V SBI console support"
91− depends on RISCV_SBI
91+ depends on RISCV_SBI_V01
9292 select HVC_DRIVER
9393 help
9494 This enables support for console output via RISC-V SBI calls, which
drivers/tty/serial/Kconfig+1−1
@@ -86,7 +86,7 @@ config SERIAL_EARLYCON_ARM_SEMIHOST · 85 unmodified lines
8686
8787 config SERIAL_EARLYCON_RISCV_SBI
8888 bool "Early console using RISC-V SBI"
89− depends on RISCV_SBI
89+ depends on RISCV_SBI_V01
9090 select SERIAL_CORE
9191 select SERIAL_CORE_CONSOLE
9292 select SERIAL_EARLYCON
drivers/tty/serial/bcm63xx_uart.c+1−3
@@ -843,10 +843,8 @@ static int bcm_uart_probe(struct platform_device *pdev) · 842 unmodified lines
843843 if (IS_ERR(clk) && pdev->dev.of_node)
844844 clk = of_clk_get(pdev->dev.of_node, 0);
845845
846− if (IS_ERR(clk)) {
847− clk_put(clk);
846+ if (IS_ERR(clk))
848847 return -ENODEV;
849− }
850848
851849 port->iotype = UPIO_MEM;
852850 port->irq = res_irq->start;
drivers/tty/serial/xilinx_uartps.c+1−0
@@ -1459,6 +1459,7 @@ static int cdns_uart_probe(struct platform_device *pdev) · 1458 unmodified lines
14591459 cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS;
14601460 #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
14611461 cdns_uart_uart_driver.cons = &cdns_uart_console;
1462+ cdns_uart_console.index = id;
14621463 #endif
14631464
14641465 rc = uart_register_driver(&cdns_uart_uart_driver);
drivers/tty/vt/vt.c+7−2
@@ -365,9 +365,14 @@ static struct uni_screen *vc_uniscr_alloc(unsigned int cols, unsigned int rows) · 364 unmodified lines
365365 return uniscr;
366366 }
367367
368+static void vc_uniscr_free(struct uni_screen *uniscr)
369+{
370+ vfree(uniscr);
371+}
372+
368373 static void vc_uniscr_set(struct vc_data *vc, struct uni_screen *new_uniscr)
369374 {
370− vfree(vc->vc_uni_screen);
375+ vc_uniscr_free(vc->vc_uni_screen);
371376 vc->vc_uni_screen = new_uniscr;
372377 }
373378
@@ -1230,7 +1235,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, · 856 unmodified lines
12301235 err = resize_screen(vc, new_cols, new_rows, user);
12311236 if (err) {
12321237 kfree(newscreen);
1233− kfree(new_uniscr);
1238+ vc_uniscr_free(new_uniscr);
12341239 return err;
12351240 }
12361241
drivers/usb/chipidea/ci_hdrc_msm.c+1−1
@@ -114,7 +114,7 @@ static int ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) · 113 unmodified lines
114114 hw_write_id_reg(ci, HS_PHY_GENCONFIG_2,
115115 HS_PHY_ULPI_TX_PKT_EN_CLR_FIX, 0);
116116
117− if (!IS_ERR(ci->platdata->vbus_extcon.edev)) {
117+ if (!IS_ERR(ci->platdata->vbus_extcon.edev) || ci->role_switch) {
118118 hw_write_id_reg(ci, HS_PHY_GENCONFIG_2,
119119 HS_PHY_SESS_VLD_CTRL_EN,
120120 HS_PHY_SESS_VLD_CTRL_EN);
drivers/usb/core/devio.c+2−3
@@ -217,6 +217,7 @@ static int usbdev_mmap(struct file *file, struct vm_area_struct *vma) · 216 unmodified lines
217217 {
218218 struct usb_memory *usbm = NULL;
219219 struct usb_dev_state *ps = file->private_data;
220+ struct usb_hcd *hcd = bus_to_hcd(ps->dev->bus);
220221 size_t size = vma->vm_end - vma->vm_start;
221222 void *mem;
222223 unsigned long flags;
@@ -250,9 +251,7 @@ static int usbdev_mmap(struct file *file, struct vm_area_struct *vma) · 27 unmodified lines
250251 usbm->vma_use_count = 1;
251252 INIT_LIST_HEAD(&usbm->memlist);
252253
253− if (remap_pfn_range(vma, vma->vm_start,
254− virt_to_phys(usbm->mem) >> PAGE_SHIFT,
255− size, vma->vm_page_prot) < 0) {
254+ if (dma_mmap_coherent(hcd->self.sysdev, vma, mem, dma_handle, size)) {
256255 dec_usb_memory_use_count(usbm, &usbm->vma_use_count);
257256 return -EAGAIN;
258257 }
drivers/usb/core/message.c+2−2
@@ -1144,11 +1144,11 @@ void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr, · 1143 unmodified lines
11441144
11451145 if (usb_endpoint_out(epaddr)) {
11461146 ep = dev->ep_out[epnum];
1147− if (reset_hardware)
1147+ if (reset_hardware && epnum != 0)
11481148 dev->ep_out[epnum] = NULL;
11491149 } else {
11501150 ep = dev->ep_in[epnum];
1151− if (reset_hardware)
1151+ if (reset_hardware && epnum != 0)
11521152 dev->ep_in[epnum] = NULL;
11531153 }
11541154 if (ep) {
drivers/usb/serial/garmin_gps.c+2−2
@@ -1138,8 +1138,8 @@ static void garmin_read_process(struct garmin_data *garmin_data_p, · 1137 unmodified lines
11381138 send it directly to the tty port */
11391139 if (garmin_data_p->flags & FLAGS_QUEUING) {
11401140 pkt_add(garmin_data_p, data, data_length);
1141− } else if (bulk_data ||
1142− getLayerId(data) == GARMIN_LAYERID_APPL) {
1141+ } else if (bulk_data || (data_length >= sizeof(u32) &&
1142+ getLayerId(data) == GARMIN_LAYERID_APPL)) {
11431143
11441144 spin_lock_irqsave(&garmin_data_p->lock, flags);
11451145 garmin_data_p->flags |= APP_RESP_SEEN;
drivers/usb/serial/qcserial.c+1−0
@@ -173,6 +173,7 @@ static const struct usb_device_id id_table[] = { · 172 unmodified lines
173173 {DEVICE_SWI(0x413c, 0x81b3)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */
174174 {DEVICE_SWI(0x413c, 0x81b5)}, /* Dell Wireless 5811e QDL */
175175 {DEVICE_SWI(0x413c, 0x81b6)}, /* Dell Wireless 5811e QDL */
176+ {DEVICE_SWI(0x413c, 0x81cc)}, /* Dell Wireless 5816e */
176177 {DEVICE_SWI(0x413c, 0x81cf)}, /* Dell Wireless 5819 */
177178 {DEVICE_SWI(0x413c, 0x81d0)}, /* Dell Wireless 5819 */
178179 {DEVICE_SWI(0x413c, 0x81d1)}, /* Dell Wireless 5818 */
drivers/usb/storage/unusual_uas.h+7−0
@@ -28,6 +28,13 @@ · 27 unmodified lines
2828 * and don't forget to CC: the USB development list <linux-usb@vger.kernel.org>
2929 */
3030
31+/* Reported-by: Julian Groß <julian.g@posteo.de> */
32+UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999,
33+ "LaCie",
34+ "2Big Quadra USB3",
35+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
36+ US_FL_NO_REPORT_OPCODES),
37+
3138 /*
3239 * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI
3340 * commands in UAS mode. Observed with the 1.28 firmware; are there others?
drivers/usb/typec/mux/intel_pmc_mux.c+6−2
@@ -157,6 +157,10 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state) · 156 unmodified lines
157157 req.mode_data |= (state->mode - TYPEC_STATE_MODAL) <<
158158 PMC_USB_ALTMODE_DP_MODE_SHIFT;
159159
160+ if (data->status & DP_STATUS_HPD_STATE)
161+ req.mode_data |= PMC_USB_DP_HPD_LVL <<
162+ PMC_USB_ALTMODE_DP_MODE_SHIFT;
163+
160164 return pmc_usb_command(port, (void *)&req, sizeof(req));
161165 }
162166
@@ -298,11 +302,11 @@ static int pmc_usb_register_port(struct pmc_usb *pmc, int index, · 135 unmodified lines
298302 struct typec_mux_desc mux_desc = { };
299303 int ret;
300304
301− ret = fwnode_property_read_u8(fwnode, "usb2-port", &port->usb2_port);
305+ ret = fwnode_property_read_u8(fwnode, "usb2-port-number", &port->usb2_port);
302306 if (ret)
303307 return ret;
304308
305− ret = fwnode_property_read_u8(fwnode, "usb3-port", &port->usb3_port);
309+ ret = fwnode_property_read_u8(fwnode, "usb3-port-number", &port->usb3_port);
306310 if (ret)
307311 return ret;
308312
drivers/vfio/vfio_iommu_type1.c+5−5
@@ -342,8 +342,8 @@ static int vaddr_get_pfn(struct mm_struct *mm, unsigned long vaddr, · 341 unmodified lines
342342 vma = find_vma_intersection(mm, vaddr, vaddr + 1);
343343
344344 if (vma && vma->vm_flags & VM_PFNMAP) {
345− *pfn = ((vaddr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
346− if (is_invalid_reserved_pfn(*pfn))
345+ if (!follow_pfn(vma, vaddr, pfn) &&
346+ is_invalid_reserved_pfn(*pfn))
347347 ret = 0;
348348 }
349349 done:
@@ -555,7 +555,7 @@ static int vfio_iommu_type1_pin_pages(void *iommu_data, · 205 unmodified lines
555555 continue;
556556 }
557557
558− remote_vaddr = dma->vaddr + iova - dma->iova;
558+ remote_vaddr = dma->vaddr + (iova - dma->iova);
559559 ret = vfio_pin_page_external(dma, remote_vaddr, &phys_pfn[i],
560560 do_accounting);
561561 if (ret)
@@ -2345,10 +2345,10 @@ static int vfio_iommu_type1_dma_rw_chunk(struct vfio_iommu *iommu, · 1783 unmodified lines
23452345 vaddr = dma->vaddr + offset;
23462346
23472347 if (write)
2348− *copied = __copy_to_user((void __user *)vaddr, data,
2348+ *copied = copy_to_user((void __user *)vaddr, data,
23492349 count) ? 0 : count;
23502350 else
2351− *copied = __copy_from_user(data, (void __user *)vaddr,
2351+ *copied = copy_from_user(data, (void __user *)vaddr,
23522352 count) ? 0 : count;
23532353 if (kthread)
23542354 unuse_mm(mm);
drivers/vhost/vsock.c+16−5
@@ -181,14 +181,14 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock, · 180 unmodified lines
181181 break;
182182 }
183183
184− vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len);
185− added = true;
186−
187− /* Deliver to monitoring devices all correctly transmitted
188− * packets.
184+ /* Deliver to monitoring devices all packets that we
185+ * will transmit.
189186 */
190187 virtio_transport_deliver_tap_pkt(pkt);
191188
189+ vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len);
190+ added = true;
191+
192192 pkt->off += payload_len;
193193 total_len += payload_len;
194194
@@ -196,6 +196,12 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock, · 1 unmodified line
196196 * to send it with the next available buffer.
197197 */
198198 if (pkt->off < pkt->len) {
199+ /* We are queueing the same virtio_vsock_pkt to handle
200+ * the remaining bytes, and we want to deliver it
201+ * to monitoring devices in the next iteration.
202+ */
203+ pkt->tap_delivered = false;
204+
199205 spin_lock_bh(&vsock->send_pkt_list_lock);
200206 list_add(&pkt->list, &vsock->send_pkt_list);
201207 spin_unlock_bh(&vsock->send_pkt_list_lock);
@@ -543,6 +549,11 @@ static int vhost_vsock_start(struct vhost_vsock *vsock) · 341 unmodified lines
543549 mutex_unlock(&vq->mutex);
544550 }
545551
552+ /* Some packets may have been queued before the device was started,
553+ * let's kick the send worker to send them.
554+ */
555+ vhost_work_queue(&vsock->dev, &vsock->send_pkt_work);
556+
546557 mutex_unlock(&vsock->dev.mutex);
547558 return 0;
548559
fs/btrfs/backref.c+1−1
@@ -391,7 +391,7 @@ static int is_shared_data_backref(struct preftrees *preftrees, u64 bytenr) · 390 unmodified lines
391391 struct rb_node **p = &preftrees->direct.root.rb_root.rb_node;
392392 struct rb_node *parent = NULL;
393393 struct prelim_ref *ref = NULL;
394− struct prelim_ref target = {0};
394+ struct prelim_ref target = {};
395395 int result;
396396
397397 target.parent = bytenr;
fs/btrfs/block-group.c+14−6
@@ -916,7 +916,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, · 915 unmodified lines
916916 path = btrfs_alloc_path();
917917 if (!path) {
918918 ret = -ENOMEM;
919− goto out;
919+ goto out_put_group;
920920 }
921921
922922 /*
@@ -954,7 +954,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, · 31 unmodified lines
954954 ret = btrfs_orphan_add(trans, BTRFS_I(inode));
955955 if (ret) {
956956 btrfs_add_delayed_iput(inode);
957− goto out;
957+ goto out_put_group;
958958 }
959959 clear_nlink(inode);
960960 /* One for the block groups ref */
@@ -977,13 +977,13 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, · 16 unmodified lines
977977
978978 ret = btrfs_search_slot(trans, tree_root, &key, path, -1, 1);
979979 if (ret < 0)
980− goto out;
980+ goto out_put_group;
981981 if (ret > 0)
982982 btrfs_release_path(path);
983983 if (ret == 0) {
984984 ret = btrfs_del_item(trans, tree_root, path);
985985 if (ret)
986− goto out;
986+ goto out_put_group;
987987 btrfs_release_path(path);
988988 }
989989
@@ -1102,9 +1102,9 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, · 112 unmodified lines
11021102
11031103 ret = remove_block_group_free_space(trans, block_group);
11041104 if (ret)
1105− goto out;
1105+ goto out_put_group;
11061106
1107− btrfs_put_block_group(block_group);
1107+ /* Once for the block groups rbtree */
11081108 btrfs_put_block_group(block_group);
11091109
11101110 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
@@ -1127,6 +1127,10 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, · 16 unmodified lines
11271127 /* once for the tree */
11281128 free_extent_map(em);
11291129 }
1130+
1131+out_put_group:
1132+ /* Once for the lookup reference */
1133+ btrfs_put_block_group(block_group);
11301134 out:
11311135 if (remove_rsv)
11321136 btrfs_delayed_refs_rsv_release(fs_info, 1);
@@ -1288,11 +1292,15 @@ static bool clean_pinned_extents(struct btrfs_trans_handle *trans, · 155 unmodified lines
12881292 if (ret)
12891293 goto err;
12901294 mutex_unlock(&fs_info->unused_bg_unpin_mutex);
1295+ if (prev_trans)
1296+ btrfs_put_transaction(prev_trans);
12911297
12921298 return true;
12931299
12941300 err:
12951301 mutex_unlock(&fs_info->unused_bg_unpin_mutex);
1302+ if (prev_trans)
1303+ btrfs_put_transaction(prev_trans);
12961304 btrfs_dec_block_group_ro(bg);
12971305 return false;
12981306 }
fs/btrfs/discard.h+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0
1+/* SPDX-License-Identifier: GPL-2.0 */
22
33 #ifndef BTRFS_DISCARD_H
44 #define BTRFS_DISCARD_H
fs/btrfs/disk-io.c+32−4
@@ -2036,9 +2036,6 @@ void btrfs_free_fs_roots(struct btrfs_fs_info *fs_info) · 2035 unmodified lines
20362036 for (i = 0; i < ret; i++)
20372037 btrfs_drop_and_free_fs_root(fs_info, gang[i]);
20382038 }
2039−
2040− if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state))
2041− btrfs_free_log_root_tree(NULL, fs_info);
20422039 }
20432040
20442041 static void btrfs_init_scrub(struct btrfs_fs_info *fs_info)
@@ -3888,7 +3885,7 @@ void btrfs_drop_and_free_fs_root(struct btrfs_fs_info *fs_info, · 1843 unmodified lines
38883885 spin_unlock(&fs_info->fs_roots_radix_lock);
38893886
38903887 if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) {
3891− btrfs_free_log(NULL, root);
3888+ ASSERT(root->log_root == NULL);
38923889 if (root->reloc_root) {
38933890 btrfs_put_root(root->reloc_root);
38943891 root->reloc_root = NULL;
@@ -4211,6 +4208,36 @@ static void btrfs_error_commit_super(struct btrfs_fs_info *fs_info) · 316 unmodified lines
42114208 up_write(&fs_info->cleanup_work_sem);
42124209 }
42134210
4211+static void btrfs_drop_all_logs(struct btrfs_fs_info *fs_info)
4212+{
4213+ struct btrfs_root *gang[8];
4214+ u64 root_objectid = 0;
4215+ int ret;
4216+
4217+ spin_lock(&fs_info->fs_roots_radix_lock);
4218+ while ((ret = radix_tree_gang_lookup(&fs_info->fs_roots_radix,
4219+ (void **)gang, root_objectid,
4220+ ARRAY_SIZE(gang))) != 0) {
4221+ int i;
4222+
4223+ for (i = 0; i < ret; i++)
4224+ gang[i] = btrfs_grab_root(gang[i]);
4225+ spin_unlock(&fs_info->fs_roots_radix_lock);
4226+
4227+ for (i = 0; i < ret; i++) {
4228+ if (!gang[i])
4229+ continue;
4230+ root_objectid = gang[i]->root_key.objectid;
4231+ btrfs_free_log(NULL, gang[i]);
4232+ btrfs_put_root(gang[i]);
4233+ }
4234+ root_objectid++;
4235+ spin_lock(&fs_info->fs_roots_radix_lock);
4236+ }
4237+ spin_unlock(&fs_info->fs_roots_radix_lock);
4238+ btrfs_free_log_root_tree(NULL, fs_info);
4239+}
4240+
42144241 static void btrfs_destroy_ordered_extents(struct btrfs_root *root)
42154242 {
42164243 struct btrfs_ordered_extent *ordered;
@@ -4603,6 +4630,7 @@ static int btrfs_cleanup_transaction(struct btrfs_fs_info *fs_info) · 386 unmodified lines
46034630 btrfs_destroy_delayed_inodes(fs_info);
46044631 btrfs_assert_delayed_root_empty(fs_info);
46054632 btrfs_destroy_all_delalloc_inodes(fs_info);
4633+ btrfs_drop_all_logs(fs_info);
46064634 mutex_unlock(&fs_info->transaction_kthread_mutex);
46074635
46084636 return 0;
fs/btrfs/relocation.c+1−0
@@ -4559,6 +4559,7 @@ int btrfs_recover_relocation(struct btrfs_root *root) · 4558 unmodified lines
45594559 if (IS_ERR(fs_root)) {
45604560 err = PTR_ERR(fs_root);
45614561 list_add_tail(&reloc_root->root_list, &reloc_roots);
4562+ btrfs_end_transaction(trans);
45624563 goto out_unset;
45634564 }
45644565
fs/btrfs/transaction.c+11−2
@@ -662,10 +662,19 @@ again: · 661 unmodified lines
662662 }
663663
664664 got_it:
665− btrfs_record_root_in_trans(h, root);
666−
667665 if (!current->journal_info)
668666 current->journal_info = h;
667+
668+ /*
669+ * btrfs_record_root_in_trans() needs to alloc new extents, and may
670+ * call btrfs_join_transaction() while we're also starting a
671+ * transaction.
672+ *
673+ * Thus it need to be called after current->journal_info initialized,
674+ * or we can deadlock.
675+ */
676+ btrfs_record_root_in_trans(h, root);
677+
669678 return h;
670679
671680 join_fail:
fs/btrfs/tree-log.c+40−3
@@ -4226,6 +4226,9 @@ static int btrfs_log_prealloc_extents(struct btrfs_trans_handle *trans, · 4225 unmodified lines
42264226 const u64 ino = btrfs_ino(inode);
42274227 struct btrfs_path *dst_path = NULL;
42284228 bool dropped_extents = false;
4229+ u64 truncate_offset = i_size;
4230+ struct extent_buffer *leaf;
4231+ int slot;
42294232 int ins_nr = 0;
42304233 int start_slot;
42314234 int ret;
@@ -4240,9 +4243,43 @@ static int btrfs_log_prealloc_extents(struct btrfs_trans_handle *trans, · 8 unmodified lines
42404243 if (ret < 0)
42414244 goto out;
42424245
4246+ /*
4247+ * We must check if there is a prealloc extent that starts before the
4248+ * i_size and crosses the i_size boundary. This is to ensure later we
4249+ * truncate down to the end of that extent and not to the i_size, as
4250+ * otherwise we end up losing part of the prealloc extent after a log
4251+ * replay and with an implicit hole if there is another prealloc extent
4252+ * that starts at an offset beyond i_size.
4253+ */
4254+ ret = btrfs_previous_item(root, path, ino, BTRFS_EXTENT_DATA_KEY);
4255+ if (ret < 0)
4256+ goto out;
4257+
4258+ if (ret == 0) {
4259+ struct btrfs_file_extent_item *ei;
4260+
4261+ leaf = path->nodes[0];
4262+ slot = path->slots[0];
4263+ ei = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item);
4264+
4265+ if (btrfs_file_extent_type(leaf, ei) ==
4266+ BTRFS_FILE_EXTENT_PREALLOC) {
4267+ u64 extent_end;
4268+
4269+ btrfs_item_key_to_cpu(leaf, &key, slot);
4270+ extent_end = key.offset +
4271+ btrfs_file_extent_num_bytes(leaf, ei);
4272+
4273+ if (extent_end > i_size)
4274+ truncate_offset = extent_end;
4275+ }
4276+ } else {
4277+ ret = 0;
4278+ }
4279+
42434280 while (true) {
4244− struct extent_buffer *leaf = path->nodes[0];
4245− int slot = path->slots[0];
4281+ leaf = path->nodes[0];
4282+ slot = path->slots[0];
42464283
42474284 if (slot >= btrfs_header_nritems(leaf)) {
42484285 if (ins_nr > 0) {
@@ -4280,7 +4317,7 @@ static int btrfs_log_prealloc_extents(struct btrfs_trans_handle *trans, · 31 unmodified lines
42804317 ret = btrfs_truncate_inode_items(trans,
42814318 root->log_root,
42824319 &inode->vfs_inode,
4283− i_size,
4320+ truncate_offset,
42844321 BTRFS_EXTENT_DATA_KEY);
42854322 } while (ret == -EAGAIN);
42864323 if (ret)
fs/ceph/caps.c+2−1
@@ -2749,7 +2749,7 @@ int ceph_try_get_caps(struct inode *inode, int need, int want, · 2748 unmodified lines
27492749
27502750 ret = try_get_cap_refs(inode, need, want, 0, flags, got);
27512751 /* three special error codes */
2752− if (ret == -EAGAIN || ret == -EFBIG || ret == -EAGAIN)
2752+ if (ret == -EAGAIN || ret == -EFBIG || ret == -ESTALE)
27532753 ret = 0;
27542754 return ret;
27552755 }
@@ -3746,6 +3746,7 @@ retry: · 990 unmodified lines
37463746 WARN_ON(1);
37473747 tsession = NULL;
37483748 target = -1;
3749+ mutex_lock(&session->s_mutex);
37493750 }
37503751 goto retry;
37513752
fs/ceph/debugfs.c+1−1
@@ -271,7 +271,7 @@ void ceph_fs_debugfs_init(struct ceph_fs_client *fsc) · 270 unmodified lines
271271 &congestion_kb_fops);
272272
273273 snprintf(name, sizeof(name), "../../bdi/%s",
274− dev_name(fsc->sb->s_bdi->dev));
274+ bdi_dev_name(fsc->sb->s_bdi));
275275 fsc->debugfs_bdi =
276276 debugfs_create_symlink("bdi",
277277 fsc->client->debugfs_dir,
fs/ceph/mds_client.c+3−5
@@ -3251,8 +3251,7 @@ static void handle_session(struct ceph_mds_session *session, · 3250 unmodified lines
32513251 void *end = p + msg->front.iov_len;
32523252 struct ceph_mds_session_head *h;
32533253 u32 op;
3254− u64 seq;
3255− unsigned long features = 0;
3254+ u64 seq, features = 0;
32563255 int wake = 0;
32573256 bool blacklisted = false;
32583257
@@ -3271,9 +3270,8 @@ static void handle_session(struct ceph_mds_session *session, · 12 unmodified lines
32713270 goto bad;
32723271 /* version >= 3, feature bits */
32733272 ceph_decode_32_safe(&p, end, len, bad);
3274− ceph_decode_need(&p, end, len, bad);
3275− memcpy(&features, p, min_t(size_t, len, sizeof(features)));
3276− p += len;
3273+ ceph_decode_64_safe(&p, end, features, bad);
3274+ p += len - sizeof(features);
32773275 }
32783276
32793277 mutex_lock(&mdsc->mutex);
fs/ceph/quota.c+2−2
@@ -159,8 +159,8 @@ static struct inode *lookup_quotarealm_inode(struct ceph_mds_client *mdsc, · 158 unmodified lines
159159 }
160160
161161 if (IS_ERR(in)) {
162− pr_warn("Can't lookup inode %llx (err: %ld)\n",
163− realm->ino, PTR_ERR(in));
162+ dout("Can't lookup inode %llx (err: %ld)\n",
163+ realm->ino, PTR_ERR(in));
164164 qri->timeout = jiffies + msecs_to_jiffies(60 * 1000); /* XXX */
165165 } else {
166166 qri->timeout = 0;
fs/configfs/dir.c+1−0
@@ -1519,6 +1519,7 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry) · 1518 unmodified lines
15191519 spin_lock(&configfs_dirent_lock);
15201520 configfs_detach_rollback(dentry);
15211521 spin_unlock(&configfs_dirent_lock);
1522+ config_item_put(parent_item);
15221523 return -EINTR;
15231524 }
15241525 frag->frag_dead = true;
fs/coredump.c+8−0
@@ -788,6 +788,14 @@ void do_coredump(const kernel_siginfo_t *siginfo) · 787 unmodified lines
788788 if (displaced)
789789 put_files_struct(displaced);
790790 if (!dump_interrupted()) {
791+ /*
792+ * umh disabled with CONFIG_STATIC_USERMODEHELPER_PATH="" would
793+ * have this set to NULL.
794+ */
795+ if (!cprm.file) {
796+ pr_info("Core dump to |%s disabled\n", cn.corename);
797+ goto close_fail;
798+ }
791799 file_start_write(cprm.file);
792800 core_dumped = binfmt->core_dump(&cprm);
793801 file_end_write(cprm.file);
fs/eventpoll.c+33−28
@@ -1171,6 +1171,10 @@ static inline bool chain_epi_lockless(struct epitem *epi) · 1170 unmodified lines
11711171 {
11721172 struct eventpoll *ep = epi->ep;
11731173
1174+ /* Fast preliminary check */
1175+ if (epi->next != EP_UNACTIVE_PTR)
1176+ return false;
1177+
11741178 /* Check that the same epi has not been just chained from another CPU */
11751179 if (cmpxchg(&epi->next, EP_UNACTIVE_PTR, NULL) != EP_UNACTIVE_PTR)
11761180 return false;
@@ -1237,16 +1241,12 @@ static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, v · 60 unmodified lines
12371241 * chained in ep->ovflist and requeued later on.
12381242 */
12391243 if (READ_ONCE(ep->ovflist) != EP_UNACTIVE_PTR) {
1240− if (epi->next == EP_UNACTIVE_PTR &&
1241− chain_epi_lockless(epi))
1244+ if (chain_epi_lockless(epi))
1245+ ep_pm_stay_awake_rcu(epi);
1246+ } else if (!ep_is_linked(epi)) {
1247+ /* In the usual case, add event to ready list. */
1248+ if (list_add_tail_lockless(&epi->rdllink, &ep->rdllist))
12421249 ep_pm_stay_awake_rcu(epi);
1243− goto out_unlock;
1244− }
1245−
1246− /* If this file is already in the ready list we exit soon */
1247− if (!ep_is_linked(epi) &&
1248− list_add_tail_lockless(&epi->rdllink, &ep->rdllist)) {
1249− ep_pm_stay_awake_rcu(epi);
12501250 }
12511251
12521252 /*
@@ -1822,7 +1822,6 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, · 569 unmodified lines
18221822 {
18231823 int res = 0, eavail, timed_out = 0;
18241824 u64 slack = 0;
1825− bool waiter = false;
18261825 wait_queue_entry_t wait;
18271826 ktime_t expires, *to = NULL;
18281827
@@ -1867,21 +1866,23 @@ fetch_events: · 38 unmodified lines
18671866 */
18681867 ep_reset_busy_poll_napi_id(ep);
18691868
1870− /*
1871− * We don't have any available event to return to the caller. We need
1872− * to sleep here, and we will be woken by ep_poll_callback() when events
1873− * become available.
1874− */
1875− if (!waiter) {
1876− waiter = true;
1877− init_waitqueue_entry(&wait, current);
1878−
1869+ do {
1870+ /*
1871+ * Internally init_wait() uses autoremove_wake_function(),
1872+ * thus wait entry is removed from the wait queue on each
1873+ * wakeup. Why it is important? In case of several waiters
1874+ * each new wakeup will hit the next waiter, giving it the
1875+ * chance to harvest new event. Otherwise wakeup can be
1876+ * lost. This is also good performance-wise, because on
1877+ * normal wakeup path no need to call __remove_wait_queue()
1878+ * explicitly, thus ep->lock is not taken, which halts the
1879+ * event delivery.
1880+ */
1881+ init_wait(&wait);
18791882 write_lock_irq(&ep->lock);
18801883 __add_wait_queue_exclusive(&ep->wq, &wait);
18811884 write_unlock_irq(&ep->lock);
1882− }
18831885
1884− for (;;) {
18851886 /*
18861887 * We don't want to sleep if the ep_poll_callback() sends us
18871888 * a wakeup in between. That's why we set the task state
@@ -1911,10 +1912,20 @@ fetch_events: · 23 unmodified lines
19111912 timed_out = 1;
19121913 break;
19131914 }
1914− }
1915+
1916+ /* We were woken up, thus go and try to harvest some events */
1917+ eavail = 1;
1918+
1919+ } while (0);
19151920
19161921 __set_current_state(TASK_RUNNING);
19171922
1923+ if (!list_empty_careful(&wait.entry)) {
1924+ write_lock_irq(&ep->lock);
1925+ __remove_wait_queue(&ep->wq, &wait);
1926+ write_unlock_irq(&ep->lock);
1927+ }
1928+
19181929 send_events:
19191930 /*
19201931 * Try to transfer events to user space. In case we get 0 events and
@@ -1925,12 +1936,6 @@ send_events: · 4 unmodified lines
19251936 !(res = ep_send_events(ep, events, maxevents)) && !timed_out)
19261937 goto fetch_events;
19271938
1928− if (waiter) {
1929− write_lock_irq(&ep->lock);
1930− __remove_wait_queue(&ep->wq, &wait);
1931− write_unlock_irq(&ep->lock);
1932− }
1933−
19341939 return res;
19351940 }
19361941
fs/io_uring.c+53−70
@@ -524,6 +524,7 @@ enum { · 523 unmodified lines
524524 REQ_F_OVERFLOW_BIT,
525525 REQ_F_POLLED_BIT,
526526 REQ_F_BUFFER_SELECTED_BIT,
527+ REQ_F_NO_FILE_TABLE_BIT,
527528
528529 /* not a real bit, just to check we're not overflowing the space */
529530 __REQ_F_LAST_BIT,
@@ -577,6 +578,8 @@ enum { · 47 unmodified lines
577578 REQ_F_POLLED = BIT(REQ_F_POLLED_BIT),
578579 /* buffer already selected */
579580 REQ_F_BUFFER_SELECTED = BIT(REQ_F_BUFFER_SELECTED_BIT),
581+ /* doesn't need file table for this request */
582+ REQ_F_NO_FILE_TABLE = BIT(REQ_F_NO_FILE_TABLE_BIT),
580583 };
581584
582585 struct async_poll {
@@ -677,8 +680,6 @@ struct io_op_def { · 94 unmodified lines
677680 unsigned needs_mm : 1;
678681 /* needs req->file assigned */
679682 unsigned needs_file : 1;
680− /* needs req->file assigned IFF fd is >= 0 */
681− unsigned fd_non_neg : 1;
682683 /* hash wq insertion if file is a regular file */
683684 unsigned hash_reg_file : 1;
684685 /* unbound wq insertion if file is a non-regular file */
@@ -781,8 +782,6 @@ static const struct io_op_def io_op_defs[] = { · 96 unmodified lines
781782 .needs_file = 1,
782783 },
783784 [IORING_OP_OPENAT] = {
784− .needs_file = 1,
785− .fd_non_neg = 1,
786785 .file_table = 1,
787786 .needs_fs = 1,
788787 },
@@ -796,9 +795,8 @@ static const struct io_op_def io_op_defs[] = { · 7 unmodified lines
796795 },
797796 [IORING_OP_STATX] = {
798797 .needs_mm = 1,
799− .needs_file = 1,
800− .fd_non_neg = 1,
801798 .needs_fs = 1,
799+ .file_table = 1,
802800 },
803801 [IORING_OP_READ] = {
804802 .needs_mm = 1,
@@ -833,8 +831,6 @@ static const struct io_op_def io_op_defs[] = { · 28 unmodified lines
833831 .buffer_select = 1,
834832 },
835833 [IORING_OP_OPENAT2] = {
836− .needs_file = 1,
837− .fd_non_neg = 1,
838834 .file_table = 1,
839835 .needs_fs = 1,
840836 },
@@ -1291,7 +1287,7 @@ static struct io_kiocb *io_get_fallback_req(struct io_ring_ctx *ctx) · 450 unmodified lines
12911287 struct io_kiocb *req;
12921288
12931289 req = ctx->fallback_req;
1294− if (!test_and_set_bit_lock(0, (unsigned long *) ctx->fallback_req))
1290+ if (!test_and_set_bit_lock(0, (unsigned long *) &ctx->fallback_req))
12951291 return req;
12961292
12971293 return NULL;
@@ -1378,7 +1374,7 @@ static void __io_free_req(struct io_kiocb *req) · 80 unmodified lines
13781374 if (likely(!io_is_fallback_req(req)))
13791375 kmem_cache_free(req_cachep, req);
13801376 else
1381− clear_bit_unlock(0, (unsigned long *) req->ctx->fallback_req);
1377+ clear_bit_unlock(0, (unsigned long *) &req->ctx->fallback_req);
13821378 }
13831379
13841380 struct req_batch {
@@ -2034,7 +2030,7 @@ static struct file *__io_file_get(struct io_submit_state *state, int fd) · 649 unmodified lines
20342030 * any file. For now, just ensure that anything potentially problematic is done
20352031 * inline.
20362032 */
2037−static bool io_file_supports_async(struct file *file)
2033+static bool io_file_supports_async(struct file *file, int rw)
20382034 {
20392035 umode_t mode = file_inode(file)->i_mode;
20402036
@@ -2043,7 +2039,13 @@ static bool io_file_supports_async(struct file *file) · 2 unmodified lines
20432039 if (S_ISREG(mode) && file->f_op != &io_uring_fops)
20442040 return true;
20452041
2046− return false;
2042+ if (!(file->f_mode & FMODE_NOWAIT))
2043+ return false;
2044+
2045+ if (rw == READ)
2046+ return file->f_op->read_iter != NULL;
2047+
2048+ return file->f_op->write_iter != NULL;
20472049 }
20482050
20492051 static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
@@ -2571,7 +2573,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock) · 521 unmodified lines
25712573 * If the file doesn't support async, mark it as REQ_F_MUST_PUNT so
25722574 * we know to async punt it even if it was opened O_NONBLOCK
25732575 */
2574− if (force_nonblock && !io_file_supports_async(req->file))
2576+ if (force_nonblock && !io_file_supports_async(req->file, READ))
25752577 goto copy_iov;
25762578
25772579 iov_count = iov_iter_count(&iter);
@@ -2594,7 +2596,8 @@ copy_iov: · 16 unmodified lines
25942596 if (ret)
25952597 goto out_free;
25962598 /* any defer here is final, must blocking retry */
2597− if (!(req->flags & REQ_F_NOWAIT))
2599+ if (!(req->flags & REQ_F_NOWAIT) &&
2600+ !file_can_poll(req->file))
25982601 req->flags |= REQ_F_MUST_PUNT;
25992602 return -EAGAIN;
26002603 }
@@ -2662,7 +2665,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock) · 61 unmodified lines
26622665 * If the file doesn't support async, mark it as REQ_F_MUST_PUNT so
26632666 * we know to async punt it even if it was opened O_NONBLOCK
26642667 */
2665− if (force_nonblock && !io_file_supports_async(req->file))
2668+ if (force_nonblock && !io_file_supports_async(req->file, WRITE))
26662669 goto copy_iov;
26672670
26682671 /* file path doesn't support NOWAIT for non-direct_IO */
@@ -2716,7 +2719,8 @@ copy_iov: · 47 unmodified lines
27162719 if (ret)
27172720 goto out_free;
27182721 /* any defer here is final, must blocking retry */
2719− req->flags |= REQ_F_MUST_PUNT;
2722+ if (!file_can_poll(req->file))
2723+ req->flags |= REQ_F_MUST_PUNT;
27202724 return -EAGAIN;
27212725 }
27222726 }
@@ -2756,15 +2760,6 @@ static int io_splice_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 33 unmodified lines
27562760 return 0;
27572761 }
27582762
2759−static bool io_splice_punt(struct file *file)
2760−{
2761− if (get_pipe_info(file))
2762− return false;
2763− if (!io_file_supports_async(file))
2764− return true;
2765− return !(file->f_flags & O_NONBLOCK);
2766−}
2767−
27682763 static int io_splice(struct io_kiocb *req, bool force_nonblock)
27692764 {
27702765 struct io_splice *sp = &req->splice;
@@ -2774,11 +2769,8 @@ static int io_splice(struct io_kiocb *req, bool force_nonblock) · 3 unmodified lines
27742769 loff_t *poff_in, *poff_out;
27752770 long ret;
27762771
2777− if (force_nonblock) {
2778− if (io_splice_punt(in) || io_splice_punt(out))
2779− return -EAGAIN;
2780− flags |= SPLICE_F_NONBLOCK;
2781− }
2772+ if (force_nonblock)
2773+ return -EAGAIN;
27822774
27832775 poff_in = (sp->off_in == -1) ? NULL : &sp->off_in;
27842776 poff_out = (sp->off_out == -1) ? NULL : &sp->off_out;
@@ -3355,8 +3347,12 @@ static int io_statx(struct io_kiocb *req, bool force_nonblock) · 570 unmodified lines
33553347 struct kstat stat;
33563348 int ret;
33573349
3358− if (force_nonblock)
3350+ if (force_nonblock) {
3351+ /* only need file table for an actual valid fd */
3352+ if (ctx->dfd == -1 || ctx->dfd == AT_FDCWD)
3353+ req->flags |= REQ_F_NO_FILE_TABLE;
33593354 return -EAGAIN;
3355+ }
33603356
33613357 if (vfs_stat_set_lookup_flags(&lookup_flags, ctx->how.flags))
33623358 return -EINVAL;
@@ -3502,7 +3498,7 @@ static void io_sync_file_range_finish(struct io_wq_work **workptr) · 139 unmodified lines
35023498 if (io_req_cancelled(req))
35033499 return;
35043500 __io_sync_file_range(req);
3505− io_put_req(req); /* put submission ref */
3501+ io_steal_work(req, workptr);
35063502 }
35073503
35083504 static int io_sync_file_range(struct io_kiocb *req, bool force_nonblock)
@@ -5015,7 +5011,7 @@ static int io_req_defer(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 1506 unmodified lines
50155011 int ret;
50165012
50175013 /* Still need defer if there is pending req in defer list. */
5018− if (!req_need_defer(req) && list_empty(&ctx->defer_list))
5014+ if (!req_need_defer(req) && list_empty_careful(&ctx->defer_list))
50195015 return 0;
50205016
50215017 if (!req->io && io_alloc_async_ctx(req))
@@ -5364,15 +5360,6 @@ static void io_wq_submit_work(struct io_wq_work **workptr) · 342 unmodified lines
53645360 io_steal_work(req, workptr);
53655361 }
53665362
5367−static int io_req_needs_file(struct io_kiocb *req, int fd)
5368−{
5369− if (!io_op_defs[req->opcode].needs_file)
5370− return 0;
5371− if ((fd == -1 || fd == AT_FDCWD) && io_op_defs[req->opcode].fd_non_neg)
5372− return 0;
5373− return 1;
5374−}
5375−
53765363 static inline struct file *io_file_from_index(struct io_ring_ctx *ctx,
53775364 int index)
53785365 {
@@ -5410,14 +5397,11 @@ static int io_file_get(struct io_submit_state *state, struct io_kiocb *req, · 31 unmodified lines
54105397 }
54115398
54125399 static int io_req_set_file(struct io_submit_state *state, struct io_kiocb *req,
5413− int fd, unsigned int flags)
5400+ int fd)
54145401 {
54155402 bool fixed;
54165403
5417− if (!io_req_needs_file(req, fd))
5418− return 0;
5419−
5420− fixed = (flags & IOSQE_FIXED_FILE);
5404+ fixed = (req->flags & REQ_F_FIXED_FILE) != 0;
54215405 if (unlikely(!fixed && req->needs_fixed_file))
54225406 return -EBADF;
54235407
@@ -5429,7 +5413,7 @@ static int io_grab_files(struct io_kiocb *req) · 5 unmodified lines
54295413 int ret = -EBADF;
54305414 struct io_ring_ctx *ctx = req->ctx;
54315415
5432− if (req->work.files)
5416+ if (req->work.files || (req->flags & REQ_F_NO_FILE_TABLE))
54335417 return 0;
54345418 if (!ctx->ring_file)
54355419 return -EBADF;
@@ -5794,7 +5778,7 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, · 358 unmodified lines
57945778 struct io_submit_state *state, bool async)
57955779 {
57965780 unsigned int sqe_flags;
5797− int id, fd;
5781+ int id;
57985782
57995783 /*
58005784 * All io need record the previous position, if LINK vs DARIN,
@@ -5846,8 +5830,10 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, · 45 unmodified lines
58465830 IOSQE_ASYNC | IOSQE_FIXED_FILE |
58475831 IOSQE_BUFFER_SELECT | IOSQE_IO_LINK);
58485832
5849− fd = READ_ONCE(sqe->fd);
5850− return io_req_set_file(state, req, fd, sqe_flags);
5833+ if (!io_op_defs[req->opcode].needs_file)
5834+ return 0;
5835+
5836+ return io_req_set_file(state, req, READ_ONCE(sqe->fd));
58515837 }
58525838
58535839 static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr,
@@ -7327,7 +7313,7 @@ static void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx) · 1473 unmodified lines
73277313 * it could cause shutdown to hang.
73287314 */
73297315 while (ctx->sqo_thread && !wq_has_sleeper(&ctx->sqo_wait))
7330− cpu_relax();
7316+ cond_resched();
73317317
73327318 io_kill_timeouts(ctx);
73337319 io_poll_remove_all(ctx);
@@ -7356,11 +7342,9 @@ static int io_uring_release(struct inode *inode, struct file *file) · 22 unmodified lines
73567342 static void io_uring_cancel_files(struct io_ring_ctx *ctx,
73577343 struct files_struct *files)
73587344 {
7359− struct io_kiocb *req;
7360− DEFINE_WAIT(wait);
7361−
73627345 while (!list_empty_careful(&ctx->inflight_list)) {
7363− struct io_kiocb *cancel_req = NULL;
7346+ struct io_kiocb *cancel_req = NULL, *req;
7347+ DEFINE_WAIT(wait);
73647348
73657349 spin_lock_irq(&ctx->inflight_lock);
73667350 list_for_each_entry(req, &ctx->inflight_list, inflight_entry) {
@@ -7400,6 +7384,7 @@ static void io_uring_cancel_files(struct io_ring_ctx *ctx, · 33 unmodified lines
74007384 */
74017385 if (refcount_sub_and_test(2, &cancel_req->refs)) {
74027386 io_put_req(cancel_req);
7387+ finish_wait(&ctx->inflight_wait, &wait);
74037388 continue;
74047389 }
74057390 }
@@ -7407,8 +7392,8 @@ static void io_uring_cancel_files(struct io_ring_ctx *ctx, · 1 unmodified line
74077392 io_wq_cancel_work(ctx->io_wq, &cancel_req->work);
74087393 io_put_req(cancel_req);
74097394 schedule();
7395+ finish_wait(&ctx->inflight_wait, &wait);
74107396 }
7411− finish_wait(&ctx->inflight_wait, &wait);
74127397 }
74137398
74147399 static int io_uring_flush(struct file *file, void *data)
@@ -7757,7 +7742,8 @@ err: · 342 unmodified lines
77577742 return ret;
77587743 }
77597744
7760−static int io_uring_create(unsigned entries, struct io_uring_params *p)
7745+static int io_uring_create(unsigned entries, struct io_uring_params *p,
7746+ struct io_uring_params __user *params)
77617747 {
77627748 struct user_struct *user = NULL;
77637749 struct io_ring_ctx *ctx;
@@ -7849,6 +7835,14 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p) · 85 unmodified lines
78497835 p->cq_off.overflow = offsetof(struct io_rings, cq_overflow);
78507836 p->cq_off.cqes = offsetof(struct io_rings, cqes);
78517837
7838+ p->features = IORING_FEAT_SINGLE_MMAP | IORING_FEAT_NODROP |
7839+ IORING_FEAT_SUBMIT_STABLE | IORING_FEAT_RW_CUR_POS |
7840+ IORING_FEAT_CUR_PERSONALITY | IORING_FEAT_FAST_POLL;
7841+
7842+ if (copy_to_user(params, p, sizeof(*p))) {
7843+ ret = -EFAULT;
7844+ goto err;
7845+ }
78527846 /*
78537847 * Install ring fd as the very last thing, so we don't risk someone
78547848 * having closed it before we finish setup
@@ -7857,9 +7851,6 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p) · 2 unmodified lines
78577851 if (ret < 0)
78587852 goto err;
78597853
7860− p->features = IORING_FEAT_SINGLE_MMAP | IORING_FEAT_NODROP |
7861− IORING_FEAT_SUBMIT_STABLE | IORING_FEAT_RW_CUR_POS |
7862− IORING_FEAT_CUR_PERSONALITY | IORING_FEAT_FAST_POLL;
78637854 trace_io_uring_create(ret, ctx, p->sq_entries, p->cq_entries, p->flags);
78647855 return ret;
78657856 err:
@@ -7875,7 +7866,6 @@ err: · 9 unmodified lines
78757866 static long io_uring_setup(u32 entries, struct io_uring_params __user *params)
78767867 {
78777868 struct io_uring_params p;
7878− long ret;
78797869 int i;
78807870
78817871 if (copy_from_user(&p, params, sizeof(p)))
@@ -7890,14 +7880,7 @@ static long io_uring_setup(u32 entries, struct io_uring_params __user *params) · 8 unmodified lines
78907880 IORING_SETUP_CLAMP | IORING_SETUP_ATTACH_WQ))
78917881 return -EINVAL;
78927882
7893− ret = io_uring_create(entries, &p);
7894− if (ret < 0)
7895− return ret;
7896−
7897− if (copy_to_user(params, &p, sizeof(p)))
7898− return -EFAULT;
7899−
7900− return ret;
7883+ return io_uring_create(entries, &p, params);
79017884 }
79027885
79037886 SYSCALL_DEFINE2(io_uring_setup, u32, entries,
fs/ioctl.c+8−0
@@ -55,6 +55,7 @@ EXPORT_SYMBOL(vfs_ioctl); · 54 unmodified lines
5555 static int ioctl_fibmap(struct file *filp, int __user *p)
5656 {
5757 struct inode *inode = file_inode(filp);
58+ struct super_block *sb = inode->i_sb;
5859 int error, ur_block;
5960 sector_t block;
6061
@@ -71,6 +72,13 @@ static int ioctl_fibmap(struct file *filp, int __user *p) · 10 unmodified lines
7172 block = ur_block;
7273 error = bmap(inode, &block);
7374
75+ if (block > INT_MAX) {
76+ error = -ERANGE;
77+ pr_warn_ratelimited("[%s/%d] FS: %s File: %pD4 would truncate fibmap result\n",
78+ current->comm, task_pid_nr(current),
79+ sb->s_id, filp);
80+ }
81+
7482 if (error)
7583 ur_block = 0;
7684 else
fs/iomap/fiemap.c+1−4
@@ -117,10 +117,7 @@ iomap_bmap_actor(struct inode *inode, loff_t pos, loff_t length, · 116 unmodified lines
117117
118118 if (iomap->type == IOMAP_MAPPED) {
119119 addr = (pos - iomap->offset + iomap->addr) >> inode->i_blkbits;
120− if (addr > INT_MAX)
121− WARN(1, "would truncate bmap result\n");
122− else
123− *bno = addr;
120+ *bno = addr;
124121 }
125122 return 0;
126123 }
fs/nfs/nfs3acl.c+15−7
@@ -253,37 +253,45 @@ int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl, · 252 unmodified lines
253253
254254 int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type)
255255 {
256− struct posix_acl *alloc = NULL, *dfacl = NULL;
256+ struct posix_acl *orig = acl, *dfacl = NULL, *alloc;
257257 int status;
258258
259259 if (S_ISDIR(inode->i_mode)) {
260260 switch(type) {
261261 case ACL_TYPE_ACCESS:
262− alloc = dfacl = get_acl(inode, ACL_TYPE_DEFAULT);
262+ alloc = get_acl(inode, ACL_TYPE_DEFAULT);
263263 if (IS_ERR(alloc))
264264 goto fail;
265+ dfacl = alloc;
265266 break;
266267
267268 case ACL_TYPE_DEFAULT:
268− dfacl = acl;
269− alloc = acl = get_acl(inode, ACL_TYPE_ACCESS);
269+ alloc = get_acl(inode, ACL_TYPE_ACCESS);
270270 if (IS_ERR(alloc))
271271 goto fail;
272+ dfacl = acl;
273+ acl = alloc;
272274 break;
273275 }
274276 }
275277
276278 if (acl == NULL) {
277− alloc = acl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL);
279+ alloc = posix_acl_from_mode(inode->i_mode, GFP_KERNEL);
278280 if (IS_ERR(alloc))
279281 goto fail;
282+ acl = alloc;
280283 }
281284 status = __nfs3_proc_setacls(inode, acl, dfacl);
282− posix_acl_release(alloc);
285+out:
286+ if (acl != orig)
287+ posix_acl_release(acl);
288+ if (dfacl != orig)
289+ posix_acl_release(dfacl);
283290 return status;
284291
285292 fail:
286− return PTR_ERR(alloc);
293+ status = PTR_ERR(alloc);
294+ goto out;
287295 }
288296
289297 const struct xattr_handler *nfs3_xattr_handlers[] = {
fs/nfs/nfs4proc.c+9−2
@@ -7891,6 +7891,7 @@ static void · 7890 unmodified lines
78917891 nfs4_bind_one_conn_to_session_done(struct rpc_task *task, void *calldata)
78927892 {
78937893 struct nfs41_bind_conn_to_session_args *args = task->tk_msg.rpc_argp;
7894+ struct nfs41_bind_conn_to_session_res *res = task->tk_msg.rpc_resp;
78947895 struct nfs_client *clp = args->client;
78957896
78967897 switch (task->tk_status) {
@@ -7899,6 +7900,12 @@ nfs4_bind_one_conn_to_session_done(struct rpc_task *task, void *calldata) · 2 unmodified lines
78997900 nfs4_schedule_session_recovery(clp->cl_session,
79007901 task->tk_status);
79017902 }
7903+ if (args->dir == NFS4_CDFC4_FORE_OR_BOTH &&
7904+ res->dir != NFS4_CDFS4_BOTH) {
7905+ rpc_task_close_connection(task);
7906+ if (args->retries++ < MAX_BIND_CONN_TO_SESSION_RETRIES)
7907+ rpc_restart_call(task);
7908+ }
79027909 }
79037910
79047911 static const struct rpc_call_ops nfs4_bind_one_conn_to_session_ops = {
@@ -7921,6 +7928,7 @@ int nfs4_proc_bind_one_conn_to_session(struct rpc_clnt *clnt, · 16 unmodified lines
79217928 struct nfs41_bind_conn_to_session_args args = {
79227929 .client = clp,
79237930 .dir = NFS4_CDFC4_FORE_OR_BOTH,
7931+ .retries = 0,
79247932 };
79257933 struct nfs41_bind_conn_to_session_res res;
79267934 struct rpc_message msg = {
@@ -9191,8 +9199,7 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, long *timeout) · 1264 unmodified lines
91919199 nfs4_init_sequence(&lgp->args.seq_args, &lgp->res.seq_res, 0, 0);
91929200
91939201 task = rpc_run_task(&task_setup_data);
9194− if (IS_ERR(task))
9195− return ERR_CAST(task);
9202+
91969203 status = rpc_wait_for_completion_task(task);
91979204 if (status != 0)
91989205 goto out;
fs/nfs/pnfs.c+5−6
@@ -1332,13 +1332,15 @@ _pnfs_return_layout(struct inode *ino) · 1331 unmodified lines
13321332 !valid_layout) {
13331333 spin_unlock(&ino->i_lock);
13341334 dprintk("NFS: %s no layout segments to return\n", __func__);
1335− goto out_put_layout_hdr;
1335+ goto out_wait_layoutreturn;
13361336 }
13371337
13381338 send = pnfs_prepare_layoutreturn(lo, &stateid, &cred, NULL);
13391339 spin_unlock(&ino->i_lock);
13401340 if (send)
13411341 status = pnfs_send_layoutreturn(lo, &stateid, &cred, IOMODE_ANY, true);
1342+out_wait_layoutreturn:
1343+ wait_on_bit(&lo->plh_flags, NFS_LAYOUT_RETURN, TASK_UNINTERRUPTIBLE);
13421344 out_put_layout_hdr:
13431345 pnfs_free_lseg_list(&tmp_list);
13441346 pnfs_put_layout_hdr(lo);
@@ -1456,18 +1458,15 @@ retry: · 111 unmodified lines
14561458 /* lo ref dropped in pnfs_roc_release() */
14571459 layoutreturn = pnfs_prepare_layoutreturn(lo, &stateid, &lc_cred, &iomode);
14581460 /* If the creds don't match, we can't compound the layoutreturn */
1459− if (!layoutreturn)
1461+ if (!layoutreturn || cred_fscmp(cred, lc_cred) != 0)
14601462 goto out_noroc;
1461− if (cred_fscmp(cred, lc_cred) != 0)
1462− goto out_noroc_put_cred;
14631463
14641464 roc = layoutreturn;
14651465 pnfs_init_layoutreturn_args(args, lo, &stateid, iomode);
14661466 res->lrs_present = 0;
14671467 layoutreturn = false;
1468−
1469−out_noroc_put_cred:
14701468 put_cred(lc_cred);
1469+
14711470 out_noroc:
14721471 spin_unlock(&ino->i_lock);
14731472 rcu_read_unlock();
fs/nfs/super.c+1−1
@@ -185,7 +185,7 @@ static int __nfs_list_for_each_server(struct list_head *head, · 184 unmodified lines
185185
186186 rcu_read_lock();
187187 list_for_each_entry_rcu(server, head, client_link) {
188− if (!nfs_sb_active(server->super))
188+ if (!(server->super && nfs_sb_active(server->super)))
189189 continue;
190190 rcu_read_unlock();
191191 if (last)
fs/ocfs2/dlmfs/dlmfs.c+12−15
@@ -275,7 +275,6 @@ static ssize_t dlmfs_file_write(struct file *filp, · 274 unmodified lines
275275 loff_t *ppos)
276276 {
277277 int bytes_left;
278− ssize_t writelen;
279278 char *lvb_buf;
280279 struct inode *inode = file_inode(filp);
281280
@@ -285,32 +284,30 @@ static ssize_t dlmfs_file_write(struct file *filp, · 3 unmodified lines
285284 if (*ppos >= i_size_read(inode))
286285 return -ENOSPC;
287286
287+ /* don't write past the lvb */
288+ if (count > i_size_read(inode) - *ppos)
289+ count = i_size_read(inode) - *ppos;
290+
288291 if (!count)
289292 return 0;
290293
291294 if (!access_ok(buf, count))
292295 return -EFAULT;
293296
294− /* don't write past the lvb */
295− if ((count + *ppos) > i_size_read(inode))
296− writelen = i_size_read(inode) - *ppos;
297− else
298− writelen = count - *ppos;
299−
300− lvb_buf = kmalloc(writelen, GFP_NOFS);
297+ lvb_buf = kmalloc(count, GFP_NOFS);
301298 if (!lvb_buf)
302299 return -ENOMEM;
303300
304− bytes_left = copy_from_user(lvb_buf, buf, writelen);
305− writelen -= bytes_left;
306− if (writelen)
307− user_dlm_write_lvb(inode, lvb_buf, writelen);
301+ bytes_left = copy_from_user(lvb_buf, buf, count);
302+ count -= bytes_left;
303+ if (count)
304+ user_dlm_write_lvb(inode, lvb_buf, count);
308305
309306 kfree(lvb_buf);
310307
311− *ppos = *ppos + writelen;
312− mlog(0, "wrote %zd bytes\n", writelen);
313− return writelen;
308+ *ppos = *ppos + count;
309+ mlog(0, "wrote %zu bytes\n", count);
310+ return count;
314311 }
315312
316313 static void dlmfs_init_once(void *foo)
fs/pnode.c+4−5
@@ -261,14 +261,13 @@ static int propagate_one(struct mount *m) · 260 unmodified lines
261261 child = copy_tree(last_source, last_source->mnt.mnt_root, type);
262262 if (IS_ERR(child))
263263 return PTR_ERR(child);
264+ read_seqlock_excl(&mount_lock);
264265 mnt_set_mountpoint(m, mp, child);
266+ if (m->mnt_master != dest_master)
267+ SET_MNT_MARK(m->mnt_master);
268+ read_sequnlock_excl(&mount_lock);
265269 last_dest = m;
266270 last_source = child;
267− if (m->mnt_master != dest_master) {
268− read_seqlock_excl(&mount_lock);
269− SET_MNT_MARK(m->mnt_master);
270− read_sequnlock_excl(&mount_lock);
271− }
272271 hlist_add_head(&child->mnt_hash, list);
273272 return count_mounts(m->mnt_ns, child);
274273 }
fs/splice.c+18−27
@@ -1118,6 +1118,10 @@ long do_splice(struct file *in, loff_t __user *off_in, · 1117 unmodified lines
11181118 loff_t offset;
11191119 long ret;
11201120
1121+ if (unlikely(!(in->f_mode & FMODE_READ) ||
1122+ !(out->f_mode & FMODE_WRITE)))
1123+ return -EBADF;
1124+
11211125 ipipe = get_pipe_info(in);
11221126 opipe = get_pipe_info(out);
11231127
@@ -1125,12 +1129,6 @@ long do_splice(struct file *in, loff_t __user *off_in, · 1 unmodified line
11251129 if (off_in || off_out)
11261130 return -ESPIPE;
11271131
1128− if (!(in->f_mode & FMODE_READ))
1129− return -EBADF;
1130−
1131− if (!(out->f_mode & FMODE_WRITE))
1132− return -EBADF;
1133−
11341132 /* Splicing to self would be fun, but... */
11351133 if (ipipe == opipe)
11361134 return -EINVAL;
@@ -1153,9 +1151,6 @@ long do_splice(struct file *in, loff_t __user *off_in, · 16 unmodified lines
11531151 offset = out->f_pos;
11541152 }
11551153
1156− if (unlikely(!(out->f_mode & FMODE_WRITE)))
1157− return -EBADF;
1158−
11591154 if (unlikely(out->f_flags & O_APPEND))
11601155 return -EINVAL;
11611156
@@ -1440,15 +1435,11 @@ SYSCALL_DEFINE6(splice, int, fd_in, loff_t __user *, off_in, · 278 unmodified lines
14401435 error = -EBADF;
14411436 in = fdget(fd_in);
14421437 if (in.file) {
1443− if (in.file->f_mode & FMODE_READ) {
1444− out = fdget(fd_out);
1445− if (out.file) {
1446− if (out.file->f_mode & FMODE_WRITE)
1447− error = do_splice(in.file, off_in,
1448− out.file, off_out,
1449− len, flags);
1450− fdput(out);
1451− }
1438+ out = fdget(fd_out);
1439+ if (out.file) {
1440+ error = do_splice(in.file, off_in, out.file, off_out,
1441+ len, flags);
1442+ fdput(out);
14521443 }
14531444 fdput(in);
14541445 }
@@ -1770,6 +1761,10 @@ static long do_tee(struct file *in, struct file *out, size_t len, · 315 unmodified lines
17701761 struct pipe_inode_info *opipe = get_pipe_info(out);
17711762 int ret = -EINVAL;
17721763
1764+ if (unlikely(!(in->f_mode & FMODE_READ) ||
1765+ !(out->f_mode & FMODE_WRITE)))
1766+ return -EBADF;
1767+
17731768 /*
17741769 * Duplicate the contents of ipipe to opipe without actually
17751770 * copying the data.
@@ -1795,7 +1790,7 @@ static long do_tee(struct file *in, struct file *out, size_t len, · 19 unmodified lines
17951790
17961791 SYSCALL_DEFINE4(tee, int, fdin, int, fdout, size_t, len, unsigned int, flags)
17971792 {
1798− struct fd in;
1793+ struct fd in, out;
17991794 int error;
18001795
18011796 if (unlikely(flags & ~SPLICE_F_ALL))
@@ -1807,14 +1802,10 @@ SYSCALL_DEFINE4(tee, int, fdin, int, fdout, size_t, len, unsigned int, flags) · 5 unmodified lines
18071802 error = -EBADF;
18081803 in = fdget(fdin);
18091804 if (in.file) {
1810− if (in.file->f_mode & FMODE_READ) {
1811− struct fd out = fdget(fdout);
1812− if (out.file) {
1813− if (out.file->f_mode & FMODE_WRITE)
1814− error = do_tee(in.file, out.file,
1815− len, flags);
1816− fdput(out);
1817− }
1805+ out = fdget(fdout);
1806+ if (out.file) {
1807+ error = do_tee(in.file, out.file, len, flags);
1808+ fdput(out);
18181809 }
18191810 fdput(in);
18201811 }
fs/super.c+1−1
@@ -1302,8 +1302,8 @@ int get_tree_bdev(struct fs_context *fc, · 1301 unmodified lines
13021302 mutex_lock(&bdev->bd_fsfreeze_mutex);
13031303 if (bdev->bd_fsfreeze_count > 0) {
13041304 mutex_unlock(&bdev->bd_fsfreeze_mutex);
1305− blkdev_put(bdev, mode);
13061305 warnf(fc, "%pg: Can't mount, blockdev is frozen", bdev);
1306+ blkdev_put(bdev, mode);
13071307 return -EBUSY;
13081308 }
13091309
fs/vboxsf/super.c+1−1
@@ -164,7 +164,7 @@ static int vboxsf_fill_super(struct super_block *sb, struct fs_context *fc) · 163 unmodified lines
164164 goto fail_free;
165165 }
166166
167− err = super_setup_bdi_name(sb, "vboxsf-%s.%d", fc->source, sbi->bdi_id);
167+ err = super_setup_bdi_name(sb, "vboxsf-%d", sbi->bdi_id);
168168 if (err)
169169 goto fail_free;
170170
include/linux/amba/bus.h+1−0
@@ -65,6 +65,7 @@ struct amba_device { · 64 unmodified lines
6565 struct device dev;
6666 struct resource res;
6767 struct clk *pclk;
68+ struct device_dma_parameters dma_parms;
6869 unsigned int periphid;
6970 unsigned int cid;
7071 struct amba_cs_uci_id uci;
include/linux/backing-dev-defs.h+1−0
@@ -219,6 +219,7 @@ struct backing_dev_info { · 218 unmodified lines
219219 wait_queue_head_t wb_waitq;
220220
221221 struct device *dev;
222+ char dev_name[64];
222223 struct device *owner;
223224
224225 struct timer_list laptop_mode_wb_timer;
include/linux/backing-dev.h+1−8
@@ -505,13 +505,6 @@ static inline int bdi_rw_congested(struct backing_dev_info *bdi) · 504 unmodified lines
505505 (1 << WB_async_congested));
506506 }
507507
508−extern const char *bdi_unknown_name;
509−
510−static inline const char *bdi_dev_name(struct backing_dev_info *bdi)
511−{
512− if (!bdi || !bdi->dev)
513− return bdi_unknown_name;
514− return dev_name(bdi->dev);
515−}
508+const char *bdi_dev_name(struct backing_dev_info *bdi);
516509
517510 #endif /* _LINUX_BACKING_DEV_H */
include/linux/dma-buf.h+1−2
@@ -329,13 +329,12 @@ struct dma_buf { · 328 unmodified lines
329329
330330 /**
331331 * struct dma_buf_attach_ops - importer operations for an attachment
332− * @move_notify: [optional] notification that the DMA-buf is moving
333332 *
334333 * Attachment operations implemented by the importer.
335334 */
336335 struct dma_buf_attach_ops {
337336 /**
338− * @move_notify
337+ * @move_notify: [optional] notification that the DMA-buf is moving
339338 *
340339 * If this callback is provided the framework can avoid pinning the
341340 * backing store while mappings exists.
include/linux/dmaengine.h+6−6
@@ -83,9 +83,9 @@ enum dma_transfer_direction { · 82 unmodified lines
8383 /**
8484 * Interleaved Transfer Request
8585 * ----------------------------
86− * A chunk is collection of contiguous bytes to be transfered.
86+ * A chunk is collection of contiguous bytes to be transferred.
8787 * The gap(in bytes) between two chunks is called inter-chunk-gap(ICG).
88− * ICGs may or maynot change between chunks.
88+ * ICGs may or may not change between chunks.
8989 * A FRAME is the smallest series of contiguous {chunk,icg} pairs,
9090 * that when repeated an integral number of times, specifies the transfer.
9191 * A transfer template is specification of a Frame, the number of times
@@ -341,13 +341,11 @@ struct dma_chan { · 249 unmodified lines
341341 * @chan: driver channel device
342342 * @device: sysfs device
343343 * @dev_id: parent dma_device dev_id
344− * @idr_ref: reference count to gate release of dma_device dev_id
345344 */
346345 struct dma_chan_dev {
347346 struct dma_chan *chan;
348347 struct device device;
349348 int dev_id;
350− atomic_t *idr_ref;
351349 };
352350
353351 /**
@@ -835,6 +833,8 @@ struct dma_device { · 481 unmodified lines
835833 int dev_id;
836834 struct device *dev;
837835 struct module *owner;
836+ struct ida chan_ida;
837+ struct mutex chan_mutex; /* to protect chan_ida */
838838
839839 u32 src_addr_widths;
840840 u32 dst_addr_widths;
@@ -1069,7 +1069,7 @@ static inline int dmaengine_terminate_all(struct dma_chan *chan) · 228 unmodified lines
10691069 * dmaengine_synchronize() needs to be called before it is safe to free
10701070 * any memory that is accessed by previously submitted descriptors or before
10711071 * freeing any resources accessed from within the completion callback of any
1072− * perviously submitted descriptors.
1072+ * previously submitted descriptors.
10731073 *
10741074 * This function can be called from atomic context as well as from within a
10751075 * complete callback of a descriptor submitted on the same channel.
@@ -1091,7 +1091,7 @@ static inline int dmaengine_terminate_async(struct dma_chan *chan) · 15 unmodified lines
10911091 *
10921092 * Synchronizes to the DMA channel termination to the current context. When this
10931093 * function returns it is guaranteed that all transfers for previously issued
1094− * descriptors have stopped and and it is safe to free the memory assoicated
1094+ * descriptors have stopped and it is safe to free the memory associated
10951095 * with them. Furthermore it is guaranteed that all complete callback functions
10961096 * for a previously submitted descriptor have finished running and it is safe to
10971097 * free resources accessed from within the complete callbacks.
include/linux/fs.h+1−1
@@ -983,7 +983,7 @@ struct file_handle { · 982 unmodified lines
983983 __u32 handle_bytes;
984984 int handle_type;
985985 /* file identifier */
986− unsigned char f_handle[0];
986+ unsigned char f_handle[];
987987 };
988988
989989 static inline struct file *get_file(struct file *f)
include/linux/lsm_hook_defs.h+1−1
@@ -55,7 +55,7 @@ LSM_HOOK(void, LSM_RET_VOID, bprm_committing_creds, struct linux_binprm *bprm) · 54 unmodified lines
5555 LSM_HOOK(void, LSM_RET_VOID, bprm_committed_creds, struct linux_binprm *bprm)
5656 LSM_HOOK(int, 0, fs_context_dup, struct fs_context *fc,
5757 struct fs_context *src_sc)
58−LSM_HOOK(int, 0, fs_context_parse_param, struct fs_context *fc,
58+LSM_HOOK(int, -ENOPARAM, fs_context_parse_param, struct fs_context *fc,
5959 struct fs_parameter *param)
6060 LSM_HOOK(int, 0, sb_alloc_security, struct super_block *sb)
6161 LSM_HOOK(void, LSM_RET_VOID, sb_free_security, struct super_block *sb)
include/linux/mhi.h+10−6
@@ -53,9 +53,9 @@ enum mhi_callback { · 52 unmodified lines
5353 * @MHI_CHAIN: Linked transfer
5454 */
5555 enum mhi_flags {
56− MHI_EOB,
57− MHI_EOT,
58− MHI_CHAIN,
56+ MHI_EOB = BIT(0),
57+ MHI_EOT = BIT(1),
58+ MHI_CHAIN = BIT(2),
5959 };
6060
6161 /**
@@ -335,14 +335,15 @@ struct mhi_controller_config { · 273 unmodified lines
335335 * @syserr_worker: System error worker
336336 * @state_event: State change event
337337 * @status_cb: CB function to notify power states of the device (required)
338− * @link_status: CB function to query link status of the device (required)
339338 * @wake_get: CB function to assert device wake (optional)
340339 * @wake_put: CB function to de-assert device wake (optional)
341340 * @wake_toggle: CB function to assert and de-assert device wake (optional)
342341 * @runtime_get: CB function to controller runtime resume (required)
343− * @runtimet_put: CB function to decrement pm usage (required)
342+ * @runtime_put: CB function to decrement pm usage (required)
344343 * @map_single: CB function to create TRE buffer
345344 * @unmap_single: CB function to destroy TRE buffer
345+ * @read_reg: Read a MHI register via the physical link (required)
346+ * @write_reg: Write a MHI register via the physical link (required)
346347 * @buffer_len: Bounce buffer length
347348 * @bounce_buf: Use of bounce buffer
348349 * @fbc_download: MHI host needs to do complete image transfer (optional)
@@ -417,7 +418,6 @@ struct mhi_controller { · 68 unmodified lines
417418
418419 void (*status_cb)(struct mhi_controller *mhi_cntrl,
419420 enum mhi_callback cb);
420− int (*link_status)(struct mhi_controller *mhi_cntrl);
421421 void (*wake_get)(struct mhi_controller *mhi_cntrl, bool override);
422422 void (*wake_put)(struct mhi_controller *mhi_cntrl, bool override);
423423 void (*wake_toggle)(struct mhi_controller *mhi_cntrl);
@@ -427,6 +427,10 @@ struct mhi_controller { · 3 unmodified lines
427427 struct mhi_buf_info *buf);
428428 void (*unmap_single)(struct mhi_controller *mhi_cntrl,
429429 struct mhi_buf_info *buf);
430+ int (*read_reg)(struct mhi_controller *mhi_cntrl, void __iomem *addr,
431+ u32 *out);
432+ void (*write_reg)(struct mhi_controller *mhi_cntrl, void __iomem *addr,
433+ u32 val);
430434
431435 size_t buffer_len;
432436 bool bounce_buf;
include/linux/nfs_xdr.h+2−0
@@ -1317,11 +1317,13 @@ struct nfs41_impl_id { · 1316 unmodified lines
13171317 struct nfstime4 date;
13181318 };
13191319
1320+#define MAX_BIND_CONN_TO_SESSION_RETRIES 3
13201321 struct nfs41_bind_conn_to_session_args {
13211322 struct nfs_client *client;
13221323 struct nfs4_sessionid sessionid;
13231324 u32 dir;
13241325 bool use_conn_in_rdma_mode;
1326+ int retries;
13251327 };
13261328
13271329 struct nfs41_bind_conn_to_session_res {
include/linux/platform_data/cros_ec_sensorhub.h+1−0
@@ -185,6 +185,7 @@ int cros_ec_sensorhub_register_push_data(struct cros_ec_sensorhub *sensorhub, · 184 unmodified lines
185185 void cros_ec_sensorhub_unregister_push_data(struct cros_ec_sensorhub *sensorhub,
186186 u8 sensor_num);
187187
188+int cros_ec_sensorhub_ring_allocate(struct cros_ec_sensorhub *sensorhub);
188189 int cros_ec_sensorhub_ring_add(struct cros_ec_sensorhub *sensorhub);
189190 void cros_ec_sensorhub_ring_remove(void *arg);
190191 int cros_ec_sensorhub_ring_fifo_enable(struct cros_ec_sensorhub *sensorhub,
include/linux/platform_device.h+1−0
@@ -25,6 +25,7 @@ struct platform_device { · 24 unmodified lines
2525 bool id_auto;
2626 struct device dev;
2727 u64 platform_dma_mask;
28+ struct device_dma_parameters dma_parms;
2829 u32 num_resources;
2930 struct resource *resource;
3031
include/linux/sunrpc/clnt.h+12−1
@@ -71,7 +71,13 @@ struct rpc_clnt { · 70 unmodified lines
7171 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
7272 struct dentry *cl_debugfs; /* debugfs directory */
7373 #endif
74− struct rpc_xprt_iter cl_xpi;
74+ /* cl_work is only needed after cl_xpi is no longer used,
75+ * and that are of similar size
76+ */
77+ union {
78+ struct rpc_xprt_iter cl_xpi;
79+ struct work_struct cl_work;
80+ };
7581 const struct cred *cl_cred;
7682 };
7783
@@ -236,4 +242,9 @@ static inline int rpc_reply_expected(struct rpc_task *task) · 158 unmodified lines
236242 (task->tk_msg.rpc_proc->p_decode != NULL);
237243 }
238244
245+static inline void rpc_task_close_connection(struct rpc_task *task)
246+{
247+ if (task->tk_xprt)
248+ xprt_force_disconnect(task->tk_xprt);
249+}
239250 #endif /* _LINUX_SUNRPC_CLNT_H */
include/linux/tcp.h+0−51
@@ -78,47 +78,6 @@ struct tcp_sack_block { · 77 unmodified lines
7878 #define TCP_SACK_SEEN (1 << 0) /*1 = peer is SACK capable, */
7979 #define TCP_DSACK_SEEN (1 << 2) /*1 = DSACK was received from peer*/
8080
81−#if IS_ENABLED(CONFIG_MPTCP)
82−struct mptcp_options_received {
83− u64 sndr_key;
84− u64 rcvr_key;
85− u64 data_ack;
86− u64 data_seq;
87− u32 subflow_seq;
88− u16 data_len;
89− u16 mp_capable : 1,
90− mp_join : 1,
91− dss : 1,
92− add_addr : 1,
93− rm_addr : 1,
94− family : 4,
95− echo : 1,
96− backup : 1;
97− u32 token;
98− u32 nonce;
99− u64 thmac;
100− u8 hmac[20];
101− u8 join_id;
102− u8 use_map:1,
103− dsn64:1,
104− data_fin:1,
105− use_ack:1,
106− ack64:1,
107− mpc_map:1,
108− __unused:2;
109− u8 addr_id;
110− u8 rm_id;
111− union {
112− struct in_addr addr;
113−#if IS_ENABLED(CONFIG_MPTCP_IPV6)
114− struct in6_addr addr6;
115−#endif
116− };
117− u64 ahmac;
118− u16 port;
119−};
120−#endif
121−
12281 struct tcp_options_received {
12382 /* PAWS/RTTM data */
12483 int ts_recent_stamp;/* Time we stored ts_recent (for aging) */
@@ -136,9 +95,6 @@ struct tcp_options_received { · 11 unmodified lines
13695 u8 num_sacks; /* Number of SACK blocks */
13796 u16 user_mss; /* mss requested by user in ioctl */
13897 u16 mss_clamp; /* Maximal mss, negotiated at connection setup */
139−#if IS_ENABLED(CONFIG_MPTCP)
140− struct mptcp_options_received mptcp;
141−#endif
14298 };
14399
144100 static inline void tcp_clear_options(struct tcp_options_received *rx_opt)
@@ -148,13 +104,6 @@ static inline void tcp_clear_options(struct tcp_options_received *rx_opt) · 3 unmodified lines
148104 #if IS_ENABLED(CONFIG_SMC)
149105 rx_opt->smc_ok = 0;
150106 #endif
151−#if IS_ENABLED(CONFIG_MPTCP)
152− rx_opt->mptcp.mp_capable = 0;
153− rx_opt->mptcp.mp_join = 0;
154− rx_opt->mptcp.add_addr = 0;
155− rx_opt->mptcp.rm_addr = 0;
156− rx_opt->mptcp.dss = 0;
157−#endif
158107 }
159108
160109 /* This is the max number of SACKS that we'll generate and process. It's safe
include/linux/tty.h+1−1
@@ -66,7 +66,7 @@ struct tty_buffer { · 65 unmodified lines
6666 int read;
6767 int flags;
6868 /* Data points here */
69− unsigned long data[0];
69+ unsigned long data[];
7070 };
7171
7272 /* Values for .flags field of tty_buffer */
include/linux/virtio_net.h+24−2
@@ -3,6 +3,8 @@ · 2 unmodified lines
33 #define _LINUX_VIRTIO_NET_H
44
55 #include <linux/if_vlan.h>
6+#include <uapi/linux/tcp.h>
7+#include <uapi/linux/udp.h>
68 #include <uapi/linux/virtio_net.h>
79
810 static inline int virtio_net_hdr_set_proto(struct sk_buff *skb,
@@ -28,17 +30,25 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, · 19 unmodified lines
2830 bool little_endian)
2931 {
3032 unsigned int gso_type = 0;
33+ unsigned int thlen = 0;
34+ unsigned int ip_proto;
3135
3236 if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) {
3337 switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {
3438 case VIRTIO_NET_HDR_GSO_TCPV4:
3539 gso_type = SKB_GSO_TCPV4;
40+ ip_proto = IPPROTO_TCP;
41+ thlen = sizeof(struct tcphdr);
3642 break;
3743 case VIRTIO_NET_HDR_GSO_TCPV6:
3844 gso_type = SKB_GSO_TCPV6;
45+ ip_proto = IPPROTO_TCP;
46+ thlen = sizeof(struct tcphdr);
3947 break;
4048 case VIRTIO_NET_HDR_GSO_UDP:
4149 gso_type = SKB_GSO_UDP;
50+ ip_proto = IPPROTO_UDP;
51+ thlen = sizeof(struct udphdr);
4252 break;
4353 default:
4454 return -EINVAL;
@@ -57,16 +67,22 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, · 12 unmodified lines
5767
5868 if (!skb_partial_csum_set(skb, start, off))
5969 return -EINVAL;
70+
71+ if (skb_transport_offset(skb) + thlen > skb_headlen(skb))
72+ return -EINVAL;
6073 } else {
6174 /* gso packets without NEEDS_CSUM do not set transport_offset.
6275 * probe and drop if does not match one of the above types.
6376 */
6477 if (gso_type && skb->network_header) {
78+ struct flow_keys_basic keys;
79+
6580 if (!skb->protocol)
6681 virtio_net_hdr_set_proto(skb, hdr);
6782 retry:
68− skb_probe_transport_header(skb);
69− if (!skb_transport_header_was_set(skb)) {
83+ if (!skb_flow_dissect_flow_keys_basic(NULL, skb, &keys,
84+ NULL, 0, 0, 0,
85+ 0)) {
7086 /* UFO does not specify ipv4 or 6: try both */
7187 if (gso_type & SKB_GSO_UDP &&
7288 skb->protocol == htons(ETH_P_IP)) {
@@ -75,6 +91,12 @@ retry: · 2 unmodified lines
7591 }
7692 return -EINVAL;
7793 }
94+
95+ if (keys.control.thoff + thlen > skb_headlen(skb) ||
96+ keys.basic.ip_proto != ip_proto)
97+ return -EINVAL;
98+
99+ skb_set_transport_header(skb, keys.control.thoff);
78100 }
79101 }
80102
include/linux/virtio_vsock.h+1−0
@@ -48,6 +48,7 @@ struct virtio_vsock_pkt { · 47 unmodified lines
4848 u32 len;
4949 u32 off;
5050 bool reply;
51+ bool tap_delivered;
5152 };
5253
5354 struct virtio_vsock_pkt_info {
include/net/flow_offload.h+8−1
@@ -166,15 +166,18 @@ enum flow_action_mangle_base { · 165 unmodified lines
166166 enum flow_action_hw_stats_bit {
167167 FLOW_ACTION_HW_STATS_IMMEDIATE_BIT,
168168 FLOW_ACTION_HW_STATS_DELAYED_BIT,
169+ FLOW_ACTION_HW_STATS_DISABLED_BIT,
169170 };
170171
171172 enum flow_action_hw_stats {
172− FLOW_ACTION_HW_STATS_DISABLED = 0,
173+ FLOW_ACTION_HW_STATS_DONT_CARE = 0,
173174 FLOW_ACTION_HW_STATS_IMMEDIATE =
174175 BIT(FLOW_ACTION_HW_STATS_IMMEDIATE_BIT),
175176 FLOW_ACTION_HW_STATS_DELAYED = BIT(FLOW_ACTION_HW_STATS_DELAYED_BIT),
176177 FLOW_ACTION_HW_STATS_ANY = FLOW_ACTION_HW_STATS_IMMEDIATE |
177178 FLOW_ACTION_HW_STATS_DELAYED,
179+ FLOW_ACTION_HW_STATS_DISABLED =
180+ BIT(FLOW_ACTION_HW_STATS_DISABLED_BIT),
178181 };
179182
180183 typedef void (*action_destr)(void *priv);
@@ -325,7 +328,11 @@ __flow_action_hw_stats_check(const struct flow_action *action, · 144 unmodified lines
325328 return true;
326329 if (!flow_action_mixed_hw_stats_check(action, extack))
327330 return false;
331+
328332 action_entry = flow_action_first_entry_get(action);
333+ if (action_entry->hw_stats == FLOW_ACTION_HW_STATS_DONT_CARE)
334+ return true;
335+
329336 if (!check_allow_bit &&
330337 action_entry->hw_stats != FLOW_ACTION_HW_STATS_ANY) {
331338 NL_SET_ERR_MSG_MOD(extack, "Driver supports only default HW stats type \"any\"");
include/net/inet_ecn.h+55−2
@@ -99,6 +99,20 @@ static inline int IP_ECN_set_ce(struct iphdr *iph) · 98 unmodified lines
9999 return 1;
100100 }
101101
102+static inline int IP_ECN_set_ect1(struct iphdr *iph)
103+{
104+ u32 check = (__force u32)iph->check;
105+
106+ if ((iph->tos & INET_ECN_MASK) != INET_ECN_ECT_0)
107+ return 0;
108+
109+ check += (__force u16)htons(0x100);
110+
111+ iph->check = (__force __sum16)(check + (check>=0xFFFF));
112+ iph->tos ^= INET_ECN_MASK;
113+ return 1;
114+}
115+
102116 static inline void IP_ECN_clear(struct iphdr *iph)
103117 {
104118 iph->tos &= ~INET_ECN_MASK;
@@ -134,6 +148,22 @@ static inline int IP6_ECN_set_ce(struct sk_buff *skb, struct ipv6hdr *iph) · 29 unmodified lines
134148 return 1;
135149 }
136150
151+static inline int IP6_ECN_set_ect1(struct sk_buff *skb, struct ipv6hdr *iph)
152+{
153+ __be32 from, to;
154+
155+ if ((ipv6_get_dsfield(iph) & INET_ECN_MASK) != INET_ECN_ECT_0)
156+ return 0;
157+
158+ from = *(__be32 *)iph;
159+ to = from ^ htonl(INET_ECN_MASK << 20);
160+ *(__be32 *)iph = to;
161+ if (skb->ip_summed == CHECKSUM_COMPLETE)
162+ skb->csum = csum_add(csum_sub(skb->csum, (__force __wsum)from),
163+ (__force __wsum)to);
164+ return 1;
165+}
166+
137167 static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner)
138168 {
139169 dscp &= ~INET_ECN_MASK;
@@ -159,6 +189,25 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb) · 19 unmodified lines
159189 return 0;
160190 }
161191
192+static inline int INET_ECN_set_ect1(struct sk_buff *skb)
193+{
194+ switch (skb->protocol) {
195+ case cpu_to_be16(ETH_P_IP):
196+ if (skb_network_header(skb) + sizeof(struct iphdr) <=
197+ skb_tail_pointer(skb))
198+ return IP_ECN_set_ect1(ip_hdr(skb));
199+ break;
200+
201+ case cpu_to_be16(ETH_P_IPV6):
202+ if (skb_network_header(skb) + sizeof(struct ipv6hdr) <=
203+ skb_tail_pointer(skb))
204+ return IP6_ECN_set_ect1(skb, ipv6_hdr(skb));
205+ break;
206+ }
207+
208+ return 0;
209+}
210+
162211 /*
163212 * RFC 6040 4.2
164213 * To decapsulate the inner header at the tunnel egress, a compliant
@@ -208,8 +257,12 @@ static inline int INET_ECN_decapsulate(struct sk_buff *skb, · 43 unmodified lines
208257 int rc;
209258
210259 rc = __INET_ECN_decapsulate(outer, inner, &set_ce);
211− if (!rc && set_ce)
212− INET_ECN_set_ce(skb);
260+ if (!rc) {
261+ if (set_ce)
262+ INET_ECN_set_ce(skb);
263+ else if ((outer & INET_ECN_MASK) == INET_ECN_ECT_1)
264+ INET_ECN_set_ect1(skb);
265+ }
213266
214267 return rc;
215268 }
include/net/ip6_fib.h+4−0
@@ -203,6 +203,7 @@ struct fib6_info { · 202 unmodified lines
203203 struct rt6_info {
204204 struct dst_entry dst;
205205 struct fib6_info __rcu *from;
206+ int sernum;
206207
207208 struct rt6key rt6i_dst;
208209 struct rt6key rt6i_src;
@@ -291,6 +292,9 @@ static inline u32 rt6_get_cookie(const struct rt6_info *rt) · 82 unmodified lines
291292 struct fib6_info *from;
292293 u32 cookie = 0;
293294
295+ if (rt->sernum)
296+ return rt->sernum;
297+
294298 rcu_read_lock();
295299
296300 from = rcu_dereference(rt->from);
include/net/mptcp.h+0−3
@@ -68,11 +68,8 @@ static inline bool rsk_is_mptcp(const struct request_sock *req) · 67 unmodified lines
6868 return tcp_rsk(req)->is_mptcp;
6969 }
7070
71−void mptcp_parse_option(const struct sk_buff *skb, const unsigned char *ptr,
72− int opsize, struct tcp_options_received *opt_rx);
7371 bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb,
7472 unsigned int *size, struct mptcp_out_options *opts);
75−void mptcp_rcv_synsent(struct sock *sk);
7673 bool mptcp_synack_options(const struct request_sock *req, unsigned int *size,
7774 struct mptcp_out_options *opts);
7875 bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
include/net/net_namespace.h+7−0
@@ -437,6 +437,13 @@ static inline int rt_genid_ipv4(const struct net *net) · 436 unmodified lines
437437 return atomic_read(&net->ipv4.rt_genid);
438438 }
439439
440+#if IS_ENABLED(CONFIG_IPV6)
441+static inline int rt_genid_ipv6(const struct net *net)
442+{
443+ return atomic_read(&net->ipv6.fib6_sernum);
444+}
445+#endif
446+
440447 static inline void rt_genid_bump_ipv4(struct net *net)
441448 {
442449 atomic_inc(&net->ipv4.rt_genid);
include/net/sch_generic.h+1−0
@@ -407,6 +407,7 @@ struct tcf_block { · 406 unmodified lines
407407 struct mutex lock;
408408 struct list_head chain_list;
409409 u32 index; /* block index for shared blocks */
410+ u32 classid; /* which class this block belongs to */
410411 refcount_t refcnt;
411412 struct net *net;
412413 struct Qdisc *q;
include/soc/mscc/ocelot.h+1−0
@@ -502,6 +502,7 @@ struct ocelot { · 501 unmodified lines
502502 unsigned int num_stats;
503503
504504 int shared_queue_sz;
505+ int num_mact_rows;
505506
506507 struct net_device *hw_bridge_dev;
507508 u16 bridge_mask;
include/trace/events/gpu_mem.h+1−1
@@ -24,7 +24,7 @@ · 23 unmodified lines
2424 *
2525 * @pid: Put 0 for global total, while positive pid for process total.
2626 *
27− * @size: Virtual size of the allocation in bytes.
27+ * @size: Size of the allocation in bytes.
2828 *
2929 */
3030 TRACE_EVENT(gpu_mem_total,
include/trace/events/rpcrdma.h+4−8
@@ -692,11 +692,10 @@ TRACE_EVENT(xprtrdma_prepsend_failed, · 691 unmodified lines
692692
693693 TRACE_EVENT(xprtrdma_post_send,
694694 TP_PROTO(
695− const struct rpcrdma_req *req,
696− int status
695+ const struct rpcrdma_req *req
697696 ),
698697
699− TP_ARGS(req, status),
698+ TP_ARGS(req),
700699
701700 TP_STRUCT__entry(
702701 __field(const void *, req)
@@ -705,7 +704,6 @@ TRACE_EVENT(xprtrdma_post_send, · 2 unmodified lines
705704 __field(unsigned int, client_id)
706705 __field(int, num_sge)
707706 __field(int, signaled)
708− __field(int, status)
709707 ),
710708
711709 TP_fast_assign(
@@ -718,15 +716,13 @@ TRACE_EVENT(xprtrdma_post_send, · 6 unmodified lines
718716 __entry->sc = req->rl_sendctx;
719717 __entry->num_sge = req->rl_wr.num_sge;
720718 __entry->signaled = req->rl_wr.send_flags & IB_SEND_SIGNALED;
721− __entry->status = status;
722719 ),
723720
724− TP_printk("task:%u@%u req=%p sc=%p (%d SGE%s) %sstatus=%d",
721+ TP_printk("task:%u@%u req=%p sc=%p (%d SGE%s) %s",
725722 __entry->task_id, __entry->client_id,
726723 __entry->req, __entry->sc, __entry->num_sge,
727724 (__entry->num_sge == 1 ? "" : "s"),
728− (__entry->signaled ? "signaled " : ""),
729− __entry->status
725+ (__entry->signaled ? "signaled" : "")
730726 )
731727 );
732728
include/trace/events/wbt.h+4−4
@@ -33,7 +33,7 @@ TRACE_EVENT(wbt_stat, · 32 unmodified lines
3333 ),
3434
3535 TP_fast_assign(
36− strlcpy(__entry->name, dev_name(bdi->dev),
36+ strlcpy(__entry->name, bdi_dev_name(bdi),
3737 ARRAY_SIZE(__entry->name));
3838 __entry->rmean = stat[0].mean;
3939 __entry->rmin = stat[0].min;
@@ -68,7 +68,7 @@ TRACE_EVENT(wbt_lat, · 28 unmodified lines
6868 ),
6969
7070 TP_fast_assign(
71− strlcpy(__entry->name, dev_name(bdi->dev),
71+ strlcpy(__entry->name, bdi_dev_name(bdi),
7272 ARRAY_SIZE(__entry->name));
7373 __entry->lat = div_u64(lat, 1000);
7474 ),
@@ -105,7 +105,7 @@ TRACE_EVENT(wbt_step, · 30 unmodified lines
105105 ),
106106
107107 TP_fast_assign(
108− strlcpy(__entry->name, dev_name(bdi->dev),
108+ strlcpy(__entry->name, bdi_dev_name(bdi),
109109 ARRAY_SIZE(__entry->name));
110110 __entry->msg = msg;
111111 __entry->step = step;
@@ -141,7 +141,7 @@ TRACE_EVENT(wbt_timer, · 29 unmodified lines
141141 ),
142142
143143 TP_fast_assign(
144− strlcpy(__entry->name, dev_name(bdi->dev),
144+ strlcpy(__entry->name, bdi_dev_name(bdi),
145145 ARRAY_SIZE(__entry->name));
146146 __entry->status = status;
147147 __entry->step = step;
include/uapi/drm/amdgpu_drm.h+4−0
@@ -346,6 +346,10 @@ struct drm_amdgpu_gem_userptr { · 345 unmodified lines
346346 #define AMDGPU_TILING_DCC_PITCH_MAX_MASK 0x3FFF
347347 #define AMDGPU_TILING_DCC_INDEPENDENT_64B_SHIFT 43
348348 #define AMDGPU_TILING_DCC_INDEPENDENT_64B_MASK 0x1
349+#define AMDGPU_TILING_DCC_INDEPENDENT_128B_SHIFT 44
350+#define AMDGPU_TILING_DCC_INDEPENDENT_128B_MASK 0x1
351+#define AMDGPU_TILING_SCANOUT_SHIFT 63
352+#define AMDGPU_TILING_SCANOUT_MASK 0x1
349353
350354 /* Set/Get helpers for tiling flags. */
351355 #define AMDGPU_TILING_SET(field, value) \
include/uapi/linux/bpf.h+1−1
@@ -73,7 +73,7 @@ struct bpf_insn { · 72 unmodified lines
7373 /* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
7474 struct bpf_lpm_trie_key {
7575 __u32 prefixlen; /* up to 32 for AF_INET, 128 for AF_INET6 */
76− __u8 data[]; /* Arbitrary size */
76+ __u8 data[0]; /* Arbitrary size */
7777 };
7878
7979 struct bpf_cgroup_storage_key {
include/uapi/linux/dlm_device.h+2−2
@@ -45,13 +45,13 @@ struct dlm_lock_params { · 44 unmodified lines
4545 void __user *bastaddr;
4646 struct dlm_lksb __user *lksb;
4747 char lvb[DLM_USER_LVB_LEN];
48− char name[];
48+ char name[0];
4949 };
5050
5151 struct dlm_lspace_params {
5252 __u32 flags;
5353 __u32 minor;
54− char name[];
54+ char name[0];
5555 };
5656
5757 struct dlm_purge_params {
include/uapi/linux/dma-buf.h+6−0
@@ -39,6 +39,12 @@ struct dma_buf_sync { · 38 unmodified lines
3939
4040 #define DMA_BUF_BASE 'b'
4141 #define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync)
42+
43+/* 32/64bitness of this uapi was botched in android, there's no difference
44+ * between them in actual uapi, they're just different numbers.
45+ */
4246 #define DMA_BUF_SET_NAME _IOW(DMA_BUF_BASE, 1, const char *)
47+#define DMA_BUF_SET_NAME_A _IOW(DMA_BUF_BASE, 1, u32)
48+#define DMA_BUF_SET_NAME_B _IOW(DMA_BUF_BASE, 1, u64)
4349
4450 #endif
include/uapi/linux/fiemap.h+1−1
@@ -34,7 +34,7 @@ struct fiemap { · 33 unmodified lines
3434 __u32 fm_mapped_extents;/* number of extents that were mapped (out) */
3535 __u32 fm_extent_count; /* size of fm_extents array (in) */
3636 __u32 fm_reserved;
37− struct fiemap_extent fm_extents[]; /* array of mapped extents (out) */
37+ struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */
3838 };
3939
4040 #define FIEMAP_MAX_OFFSET (~0ULL)
include/uapi/linux/hyperv.h+2−2
@@ -119,8 +119,8 @@ enum hv_fcopy_op { · 118 unmodified lines
119119
120120 struct hv_fcopy_hdr {
121121 __u32 operation;
122− uuid_le service_id0; /* currently unused */
123− uuid_le service_id1; /* currently unused */
122+ __u8 service_id0[16]; /* currently unused */
123+ __u8 service_id1[16]; /* currently unused */
124124 } __attribute__((packed));
125125
126126 #define OVER_WRITE 0x1
include/uapi/linux/if_arcnet.h+3−3
@@ -60,7 +60,7 @@ struct arc_rfc1201 { · 59 unmodified lines
6060 __u8 proto; /* protocol ID field - varies */
6161 __u8 split_flag; /* for use with split packets */
6262 __be16 sequence; /* sequence number */
63− __u8 payload[]; /* space remaining in packet (504 bytes)*/
63+ __u8 payload[0]; /* space remaining in packet (504 bytes)*/
6464 };
6565 #define RFC1201_HDR_SIZE 4
6666
@@ -69,7 +69,7 @@ struct arc_rfc1201 { · 2 unmodified lines
6969 */
7070 struct arc_rfc1051 {
7171 __u8 proto; /* ARC_P_RFC1051_ARP/RFC1051_IP */
72− __u8 payload[]; /* 507 bytes */
72+ __u8 payload[0]; /* 507 bytes */
7373 };
7474 #define RFC1051_HDR_SIZE 1
7575
@@ -80,7 +80,7 @@ struct arc_rfc1051 { · 4 unmodified lines
8080 struct arc_eth_encap {
8181 __u8 proto; /* Always ARC_P_ETHER */
8282 struct ethhdr eth; /* standard ethernet header (yuck!) */
83− __u8 payload[]; /* 493 bytes */
83+ __u8 payload[0]; /* 493 bytes */
8484 };
8585 #define ETH_ENCAP_HDR_SIZE 14
8686
include/uapi/linux/mmc/ioctl.h+1−1
@@ -57,7 +57,7 @@ struct mmc_ioc_cmd { · 56 unmodified lines
5757 */
5858 struct mmc_ioc_multi_cmd {
5959 __u64 num_of_cmds;
60− struct mmc_ioc_cmd cmds[];
60+ struct mmc_ioc_cmd cmds[0];
6161 };
6262
6363 #define MMC_IOC_CMD _IOWR(MMC_BLOCK_MAJOR, 0, struct mmc_ioc_cmd)
include/uapi/linux/net_dropmon.h+2−2
@@ -29,12 +29,12 @@ struct net_dm_config_entry { · 28 unmodified lines
2929
3030 struct net_dm_config_msg {
3131 __u32 entries;
32− struct net_dm_config_entry options[];
32+ struct net_dm_config_entry options[0];
3333 };
3434
3535 struct net_dm_alert_msg {
3636 __u32 entries;
37− struct net_dm_drop_point points[];
37+ struct net_dm_drop_point points[0];
3838 };
3939
4040 struct net_dm_user_msg {
include/uapi/linux/netfilter_bridge/ebt_among.h+1−1
@@ -40,7 +40,7 @@ struct ebt_mac_wormhash_tuple { · 39 unmodified lines
4040 struct ebt_mac_wormhash {
4141 int table[257];
4242 int poolsize;
43− struct ebt_mac_wormhash_tuple pool[];
43+ struct ebt_mac_wormhash_tuple pool[0];
4444 };
4545
4646 #define ebt_mac_wormhash_size(x) ((x) ? sizeof(struct ebt_mac_wormhash) \
include/uapi/scsi/scsi_bsg_fc.h+1−1
@@ -209,7 +209,7 @@ struct fc_bsg_host_vendor { · 208 unmodified lines
209209 __u64 vendor_id;
210210
211211 /* start of vendor command area */
212− __u32 vendor_cmd[];
212+ __u32 vendor_cmd[0];
213213 };
214214
215215 /* Response:
init/Kconfig+0−18
@@ -39,22 +39,6 @@ config TOOLS_SUPPORT_RELR · 38 unmodified lines
3939 config CC_HAS_ASM_INLINE
4040 def_bool $(success,echo 'void foo(void) { asm inline (""); }' | $(CC) -x c - -c -o /dev/null)
4141
42−config CC_HAS_WARN_MAYBE_UNINITIALIZED
43− def_bool $(cc-option,-Wmaybe-uninitialized)
44− help
45− GCC >= 4.7 supports this option.
46−
47−config CC_DISABLE_WARN_MAYBE_UNINITIALIZED
48− bool
49− depends on CC_HAS_WARN_MAYBE_UNINITIALIZED
50− default CC_IS_GCC && GCC_VERSION < 40900 # unreliable for GCC < 4.9
51− help
52− GCC's -Wmaybe-uninitialized is not reliable by definition.
53− Lots of false positive warnings are produced in some cases.
54−
55− If this option is enabled, -Wno-maybe-uninitialzed is passed
56− to the compiler to suppress maybe-uninitialized warnings.
57−
5842 config CONSTRUCTORS
5943 bool
6044 depends on !UML
@@ -1257,14 +1241,12 @@ config CC_OPTIMIZE_FOR_PERFORMANCE · 1196 unmodified lines
12571241 config CC_OPTIMIZE_FOR_PERFORMANCE_O3
12581242 bool "Optimize more for performance (-O3)"
12591243 depends on ARC
1260− imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives
12611244 help
12621245 Choosing this option will pass "-O3" to your compiler to optimize
12631246 the kernel yet more for performance.
12641247
12651248 config CC_OPTIMIZE_FOR_SIZE
12661249 bool "Optimize for size (-Os)"
1267− imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives
12681250 help
12691251 Choosing this option will pass "-Os" to your compiler resulting
12701252 in a smaller kernel.
init/initramfs.c+1−1
@@ -542,7 +542,7 @@ void __weak free_initrd_mem(unsigned long start, unsigned long end) · 541 unmodified lines
542542 }
543543
544544 #ifdef CONFIG_KEXEC_CORE
545−static bool kexec_free_initrd(void)
545+static bool __init kexec_free_initrd(void)
546546 {
547547 unsigned long crashk_start = (unsigned long)__va(crashk_res.start);
548548 unsigned long crashk_end = (unsigned long)__va(crashk_res.end);
init/main.c+52−17
@@ -257,6 +257,47 @@ static int __init loglevel(char *str) · 256 unmodified lines
257257
258258 early_param("loglevel", loglevel);
259259
260+#ifdef CONFIG_BLK_DEV_INITRD
261+static void * __init get_boot_config_from_initrd(u32 *_size, u32 *_csum)
262+{
263+ u32 size, csum;
264+ char *data;
265+ u32 *hdr;
266+
267+ if (!initrd_end)
268+ return NULL;
269+
270+ data = (char *)initrd_end - BOOTCONFIG_MAGIC_LEN;
271+ if (memcmp(data, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN))
272+ return NULL;
273+
274+ hdr = (u32 *)(data - 8);
275+ size = hdr[0];
276+ csum = hdr[1];
277+
278+ data = ((void *)hdr) - size;
279+ if ((unsigned long)data < initrd_start) {
280+ pr_err("bootconfig size %d is greater than initrd size %ld\n",
281+ size, initrd_end - initrd_start);
282+ return NULL;
283+ }
284+
285+ /* Remove bootconfig from initramfs/initrd */
286+ initrd_end = (unsigned long)data;
287+ if (_size)
288+ *_size = size;
289+ if (_csum)
290+ *_csum = csum;
291+
292+ return data;
293+}
294+#else
295+static void * __init get_boot_config_from_initrd(u32 *_size, u32 *_csum)
296+{
297+ return NULL;
298+}
299+#endif
300+
260301 #ifdef CONFIG_BOOT_CONFIG
261302
262303 char xbc_namebuf[XBC_KEYLEN_MAX] __initdata;
@@ -357,9 +398,12 @@ static void __init setup_boot_config(const char *cmdline) · 94 unmodified lines
357398 int pos;
358399 u32 size, csum;
359400 char *data, *copy;
360− u32 *hdr;
361401 int ret;
362402
403+ data = get_boot_config_from_initrd(&size, &csum);
404+ if (!data)
405+ goto not_found;
406+
363407 strlcpy(tmp_cmdline, boot_command_line, COMMAND_LINE_SIZE);
364408 parse_args("bootconfig", tmp_cmdline, NULL, 0, 0, 0, NULL,
365409 bootconfig_params);
@@ -367,27 +411,12 @@ static void __init setup_boot_config(const char *cmdline) · 1 unmodified line
367411 if (!bootconfig_found)
368412 return;
369413
370− if (!initrd_end)
371− goto not_found;
372−
373− data = (char *)initrd_end - BOOTCONFIG_MAGIC_LEN;
374− if (memcmp(data, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN))
375− goto not_found;
376−
377− hdr = (u32 *)(data - 8);
378− size = hdr[0];
379− csum = hdr[1];
380−
381414 if (size >= XBC_DATA_MAX) {
382415 pr_err("bootconfig size %d greater than max size %d\n",
383416 size, XBC_DATA_MAX);
384417 return;
385418 }
386419
387− data = ((void *)hdr) - size;
388− if ((unsigned long)data < initrd_start)
389− goto not_found;
390−
391420 if (boot_config_checksum((unsigned char *)data, size) != csum) {
392421 pr_err("bootconfig checksum failed\n");
393422 return;
@@ -420,8 +449,14 @@ static void __init setup_boot_config(const char *cmdline) · 26 unmodified lines
420449 not_found:
421450 pr_err("'bootconfig' found on command line, but no bootconfig found\n");
422451 }
452+
423453 #else
424−#define setup_boot_config(cmdline) do { } while (0)
454+
455+static void __init setup_boot_config(const char *cmdline)
456+{
457+ /* Remove bootconfig data from initrd */
458+ get_boot_config_from_initrd(NULL, NULL);
459+}
425460
426461 static int __init warn_bootconfig(char *str)
427462 {
ipc/mqueue.c+26−8
@@ -142,6 +142,7 @@ struct mqueue_inode_info { · 141 unmodified lines
142142
143143 struct sigevent notify;
144144 struct pid *notify_owner;
145+ u32 notify_self_exec_id;
145146 struct user_namespace *notify_user_ns;
146147 struct user_struct *user; /* user who created, for accounting */
147148 struct sock *notify_sock;
@@ -773,28 +774,44 @@ static void __do_notify(struct mqueue_inode_info *info) · 625 unmodified lines
773774 * synchronously. */
774775 if (info->notify_owner &&
775776 info->attr.mq_curmsgs == 1) {
776− struct kernel_siginfo sig_i;
777777 switch (info->notify.sigev_notify) {
778778 case SIGEV_NONE:
779779 break;
780− case SIGEV_SIGNAL:
781− /* sends signal */
780+ case SIGEV_SIGNAL: {
781+ struct kernel_siginfo sig_i;
782+ struct task_struct *task;
783+
784+ /* do_mq_notify() accepts sigev_signo == 0, why?? */
785+ if (!info->notify.sigev_signo)
786+ break;
782787
783788 clear_siginfo(&sig_i);
784789 sig_i.si_signo = info->notify.sigev_signo;
785790 sig_i.si_errno = 0;
786791 sig_i.si_code = SI_MESGQ;
787792 sig_i.si_value = info->notify.sigev_value;
788− /* map current pid/uid into info->owner's namespaces */
789793 rcu_read_lock();
794+ /* map current pid/uid into info->owner's namespaces */
790795 sig_i.si_pid = task_tgid_nr_ns(current,
791796 ns_of_pid(info->notify_owner));
792− sig_i.si_uid = from_kuid_munged(info->notify_user_ns, current_uid());
797+ sig_i.si_uid = from_kuid_munged(info->notify_user_ns,
798+ current_uid());
799+ /*
800+ * We can't use kill_pid_info(), this signal should
801+ * bypass check_kill_permission(). It is from kernel
802+ * but si_fromuser() can't know this.
803+ * We do check the self_exec_id, to avoid sending
804+ * signals to programs that don't expect them.
805+ */
806+ task = pid_task(info->notify_owner, PIDTYPE_TGID);
807+ if (task && task->self_exec_id ==
808+ info->notify_self_exec_id) {
809+ do_send_sig_info(info->notify.sigev_signo,
810+ &sig_i, task, PIDTYPE_TGID);
811+ }
793812 rcu_read_unlock();
794−
795− kill_pid_info(info->notify.sigev_signo,
796− &sig_i, info->notify_owner);
797813 break;
814+ }
798815 case SIGEV_THREAD:
799816 set_cookie(info->notify_cookie, NOTIFY_WOKENUP);
800817 netlink_sendskb(info->notify_sock, info->notify_cookie);
@@ -1383,6 +1400,7 @@ retry: · 582 unmodified lines
13831400 info->notify.sigev_signo = notification->sigev_signo;
13841401 info->notify.sigev_value = notification->sigev_value;
13851402 info->notify.sigev_notify = SIGEV_SIGNAL;
1403+ info->notify_self_exec_id = current->self_exec_id;
13861404 break;
13871405 }
13881406
kernel/kcov.c+2−2
@@ -740,8 +740,8 @@ static const struct file_operations kcov_fops = { · 739 unmodified lines
740740 * kcov_remote_handle() with KCOV_SUBSYSTEM_COMMON as the subsystem id and an
741741 * arbitrary 4-byte non-zero number as the instance id). This common handle
742742 * then gets saved into the task_struct of the process that issued the
743− * KCOV_REMOTE_ENABLE ioctl. When this proccess issues system calls that spawn
744− * kernel threads, the common handle must be retrived via kcov_common_handle()
743+ * KCOV_REMOTE_ENABLE ioctl. When this process issues system calls that spawn
744+ * kernel threads, the common handle must be retrieved via kcov_common_handle()
745745 * and passed to the spawned threads via custom annotations. Those kernel
746746 * threads must in turn be annotated with kcov_remote_start(common_handle) and
747747 * kcov_remote_stop(). All of the threads that are spawned by the same process
kernel/power/hibernate.c+7−0
@@ -898,6 +898,13 @@ static int software_resume(void) · 897 unmodified lines
898898 error = freeze_processes();
899899 if (error)
900900 goto Close_Finish;
901+
902+ error = freeze_kernel_threads();
903+ if (error) {
904+ thaw_processes();
905+ goto Close_Finish;
906+ }
907+
901908 error = load_image_and_restore();
902909 thaw_processes();
903910 Finish:
kernel/trace/Kconfig+0−1
@@ -466,7 +466,6 @@ config PROFILE_ANNOTATED_BRANCHES · 465 unmodified lines
466466 config PROFILE_ALL_BRANCHES
467467 bool "Profile all if conditionals" if !FORTIFY_SOURCE
468468 select TRACE_BRANCH_PROFILING
469− imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives
470469 help
471470 This tracer profiles all branch conditions. Every if ()
472471 taken in the kernel is recorded whether it hit or miss.
kernel/trace/preemptirq_delay_test.c+24−6
@@ -113,22 +113,42 @@ static int preemptirq_delay_run(void *data) · 112 unmodified lines
113113
114114 for (i = 0; i < s; i++)
115115 (testfuncs[i])(i);
116+
117+ set_current_state(TASK_INTERRUPTIBLE);
118+ while (!kthread_should_stop()) {
119+ schedule();
120+ set_current_state(TASK_INTERRUPTIBLE);
121+ }
122+
123+ __set_current_state(TASK_RUNNING);
124+
116125 return 0;
117126 }
118127
119−static struct task_struct *preemptirq_start_test(void)
128+static int preemptirq_run_test(void)
120129 {
130+ struct task_struct *task;
131+
121132 char task_name[50];
122133
123134 snprintf(task_name, sizeof(task_name), "%s_test", test_mode);
124− return kthread_run(preemptirq_delay_run, NULL, task_name);
135+ task = kthread_run(preemptirq_delay_run, NULL, task_name);
136+ if (IS_ERR(task))
137+ return PTR_ERR(task);
138+ if (task)
139+ kthread_stop(task);
140+ return 0;
125141 }
126142
127143
128144 static ssize_t trigger_store(struct kobject *kobj, struct kobj_attribute *attr,
129145 const char *buf, size_t count)
130146 {
131− preemptirq_start_test();
147+ ssize_t ret;
148+
149+ ret = preemptirq_run_test();
150+ if (ret)
151+ return ret;
132152 return count;
133153 }
134154
@@ -148,11 +168,9 @@ static struct kobject *preemptirq_delay_kobj; · 13 unmodified lines
148168
149169 static int __init preemptirq_delay_init(void)
150170 {
151− struct task_struct *test_task;
152171 int retval;
153172
154− test_task = preemptirq_start_test();
155− retval = PTR_ERR_OR_ZERO(test_task);
173+ retval = preemptirq_run_test();
156174 if (retval != 0)
157175 return retval;
158176
kernel/trace/trace.c+15−1
@@ -947,7 +947,8 @@ int __trace_bputs(unsigned long ip, const char *str) · 946 unmodified lines
947947 EXPORT_SYMBOL_GPL(__trace_bputs);
948948
949949 #ifdef CONFIG_TRACER_SNAPSHOT
950−void tracing_snapshot_instance_cond(struct trace_array *tr, void *cond_data)
950+static void tracing_snapshot_instance_cond(struct trace_array *tr,
951+ void *cond_data)
951952 {
952953 struct tracer *tracer = tr->current_trace;
953954 unsigned long flags;
@@ -8525,6 +8526,19 @@ static int allocate_trace_buffers(struct trace_array *tr, int size) · 7571 unmodified lines
85258526 */
85268527 allocate_snapshot = false;
85278528 #endif
8529+
8530+ /*
8531+ * Because of some magic with the way alloc_percpu() works on
8532+ * x86_64, we need to synchronize the pgd of all the tables,
8533+ * otherwise the trace events that happen in x86_64 page fault
8534+ * handlers can't cope with accessing the chance that a
8535+ * alloc_percpu()'d memory might be touched in the page fault trace
8536+ * event. Oh, and we need to audit all other alloc_percpu() and vmalloc()
8537+ * calls in tracing, because something might get triggered within a
8538+ * page fault trace event!
8539+ */
8540+ vmalloc_sync_mappings();
8541+
85288542 return 0;
85298543 }
85308544
kernel/trace/trace_boot.c+8−12
@@ -95,24 +95,20 @@ trace_boot_add_kprobe_event(struct xbc_node *node, const char *event) · 94 unmodified lines
9595 struct xbc_node *anode;
9696 char buf[MAX_BUF_LEN];
9797 const char *val;
98− int ret;
98+ int ret = 0;
9999
100− kprobe_event_cmd_init(&cmd, buf, MAX_BUF_LEN);
100+ xbc_node_for_each_array_value(node, "probes", anode, val) {
101+ kprobe_event_cmd_init(&cmd, buf, MAX_BUF_LEN);
101102
102− ret = kprobe_event_gen_cmd_start(&cmd, event, NULL);
103− if (ret)
104− return ret;
103+ ret = kprobe_event_gen_cmd_start(&cmd, event, val);
104+ if (ret)
105+ break;
105106
106− xbc_node_for_each_array_value(node, "probes", anode, val) {
107− ret = kprobe_event_add_field(&cmd, val);
107+ ret = kprobe_event_gen_cmd_end(&cmd);
108108 if (ret)
109− return ret;
109+ pr_err("Failed to add probe: %s\n", buf);
110110 }
111111
112− ret = kprobe_event_gen_cmd_end(&cmd);
113− if (ret)
114− pr_err("Failed to add probe: %s\n", buf);
115−
116112 return ret;
117113 }
118114 #else
kernel/trace/trace_kprobe.c+7−1
@@ -453,7 +453,7 @@ static bool __within_notrace_func(unsigned long addr) · 452 unmodified lines
453453
454454 static bool within_notrace_func(struct trace_kprobe *tk)
455455 {
456− unsigned long addr = addr = trace_kprobe_address(tk);
456+ unsigned long addr = trace_kprobe_address(tk);
457457 char symname[KSYM_NAME_LEN], *p;
458458
459459 if (!__within_notrace_func(addr))
@@ -940,6 +940,9 @@ EXPORT_SYMBOL_GPL(kprobe_event_cmd_init); · 480 unmodified lines
940940 * complete command or only the first part of it; in the latter case,
941941 * kprobe_event_add_fields() can be used to add more fields following this.
942942 *
943+ * Unlikely the synth_event_gen_cmd_start(), @loc must be specified. This
944+ * returns -EINVAL if @loc == NULL.
945+ *
943946 * Return: 0 if successful, error otherwise.
944947 */
945948 int __kprobe_event_gen_cmd_start(struct dynevent_cmd *cmd, bool kretprobe,
@@ -953,6 +956,9 @@ int __kprobe_event_gen_cmd_start(struct dynevent_cmd *cmd, bool kretprobe, · 7 unmodified lines
953956 if (cmd->type != DYNEVENT_TYPE_KPROBE)
954957 return -EINVAL;
955958
959+ if (!loc)
960+ return -EINVAL;
961+
956962 if (kretprobe)
957963 snprintf(buf, MAX_EVENT_NAME_LEN, "r:kprobes/%s", name);
958964 else
kernel/umh.c+5−0
@@ -544,6 +544,11 @@ EXPORT_SYMBOL_GPL(fork_usermode_blob); · 543 unmodified lines
544544 * Runs a user-space application. The application is started
545545 * asynchronously if wait is not set, and runs as a child of system workqueues.
546546 * (ie. it runs with full root capabilities and optimized affinity).
547+ *
548+ * Note: successful return value does not guarantee the helper was called at
549+ * all. You can't rely on sub_info->{init,cleanup} being called even for
550+ * UMH_WAIT_* wait modes as STATIC_USERMODEHELPER_PATH="" turns all helpers
551+ * into a successful no-op.
547552 */
548553 int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
549554 {
lib/Kconfig.ubsan+6−9
@@ -60,18 +60,15 @@ config UBSAN_SANITIZE_ALL · 59 unmodified lines
6060 Enabling this option will get kernel image size increased
6161 significantly.
6262
63−config UBSAN_NO_ALIGNMENT
64− bool "Disable checking of pointers alignment"
65− default y if HAVE_EFFICIENT_UNALIGNED_ACCESS
63+config UBSAN_ALIGNMENT
64+ bool "Enable checks for pointers alignment"
65+ default !HAVE_EFFICIENT_UNALIGNED_ACCESS
66+ depends on !X86 || !COMPILE_TEST
6667 help
67− This option disables the check of unaligned memory accesses.
68− This option should be used when building allmodconfig.
69− Disabling this option on architectures that support unaligned
68+ This option enables the check of unaligned memory accesses.
69+ Enabling this option on architectures that support unaligned
7070 accesses may produce a lot of false positives.
7171
72−config UBSAN_ALIGNMENT
73− def_bool !UBSAN_NO_ALIGNMENT
74−
7572 config TEST_UBSAN
7673 tristate "Module for testing for undefined behavior detection"
7774 depends on m
lib/kunit/test.c+1−1
@@ -93,7 +93,7 @@ static void kunit_print_ok_not_ok(void *test_or_suite, · 92 unmodified lines
9393 * representation.
9494 */
9595 if (suite)
96− pr_info("%s %zd - %s",
96+ pr_info("%s %zd - %s\n",
9797 kunit_status_to_string(is_ok),
9898 test_number, description);
9999 else
mm/backing-dev.c+11−2
@@ -21,7 +21,7 @@ struct backing_dev_info noop_backing_dev_info = { · 20 unmodified lines
2121 EXPORT_SYMBOL_GPL(noop_backing_dev_info);
2222
2323 static struct class *bdi_class;
24−const char *bdi_unknown_name = "(unknown)";
24+static const char *bdi_unknown_name = "(unknown)";
2525
2626 /*
2727 * bdi_lock protects bdi_tree and updates to bdi_list. bdi_list has RCU
@@ -938,7 +938,8 @@ int bdi_register_va(struct backing_dev_info *bdi, const char *fmt, va_list args) · 910 unmodified lines
938938 if (bdi->dev) /* The driver needs to use separate queues per device */
939939 return 0;
940940
941− dev = device_create_vargs(bdi_class, NULL, MKDEV(0, 0), bdi, fmt, args);
941+ vsnprintf(bdi->dev_name, sizeof(bdi->dev_name), fmt, args);
942+ dev = device_create(bdi_class, NULL, MKDEV(0, 0), bdi, bdi->dev_name);
942943 if (IS_ERR(dev))
943944 return PTR_ERR(dev);
944945
@@ -1043,6 +1044,14 @@ void bdi_put(struct backing_dev_info *bdi) · 98 unmodified lines
10431044 }
10441045 EXPORT_SYMBOL(bdi_put);
10451046
1047+const char *bdi_dev_name(struct backing_dev_info *bdi)
1048+{
1049+ if (!bdi || !bdi->dev)
1050+ return bdi_unknown_name;
1051+ return bdi->dev_name;
1052+}
1053+EXPORT_SYMBOL_GPL(bdi_dev_name);
1054+
10461055 static wait_queue_head_t congestion_wqh[2] = {
10471056 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]),
10481057 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1])
mm/memcontrol.c+9−6
@@ -4990,19 +4990,22 @@ static struct mem_cgroup *mem_cgroup_alloc(void) · 4989 unmodified lines
49904990 unsigned int size;
49914991 int node;
49924992 int __maybe_unused i;
4993+ long error = -ENOMEM;
49934994
49944995 size = sizeof(struct mem_cgroup);
49954996 size += nr_node_ids * sizeof(struct mem_cgroup_per_node *);
49964997
49974998 memcg = kzalloc(size, GFP_KERNEL);
49984999 if (!memcg)
4999− return NULL;
5000+ return ERR_PTR(error);
50005001
50015002 memcg->id.id = idr_alloc(&mem_cgroup_idr, NULL,
50025003 1, MEM_CGROUP_ID_MAX,
50035004 GFP_KERNEL);
5004− if (memcg->id.id < 0)
5005+ if (memcg->id.id < 0) {
5006+ error = memcg->id.id;
50055007 goto fail;
5008+ }
50065009
50075010 memcg->vmstats_local = alloc_percpu(struct memcg_vmstats_percpu);
50085011 if (!memcg->vmstats_local)
@@ -5046,7 +5049,7 @@ static struct mem_cgroup *mem_cgroup_alloc(void) · 37 unmodified lines
50465049 fail:
50475050 mem_cgroup_id_remove(memcg);
50485051 __mem_cgroup_free(memcg);
5049− return NULL;
5052+ return ERR_PTR(error);
50505053 }
50515054
50525055 static struct cgroup_subsys_state * __ref
@@ -5057,8 +5060,8 @@ mem_cgroup_css_alloc(struct cgroup_subsys_state *parent_css) · 4 unmodified lines
50575060 long error = -ENOMEM;
50585061
50595062 memcg = mem_cgroup_alloc();
5060− if (!memcg)
5061− return ERR_PTR(error);
5063+ if (IS_ERR(memcg))
5064+ return ERR_CAST(memcg);
50625065
50635066 WRITE_ONCE(memcg->high, PAGE_COUNTER_MAX);
50645067 memcg->soft_limit = PAGE_COUNTER_MAX;
@@ -5108,7 +5111,7 @@ mem_cgroup_css_alloc(struct cgroup_subsys_state *parent_css) · 43 unmodified lines
51085111 fail:
51095112 mem_cgroup_id_remove(memcg);
51105113 mem_cgroup_free(memcg);
5111− return ERR_PTR(-ENOMEM);
5114+ return ERR_PTR(error);
51125115 }
51135116
51145117 static int mem_cgroup_css_online(struct cgroup_subsys_state *css)
mm/page_alloc.c+9−0
@@ -1607,6 +1607,7 @@ void set_zone_contiguous(struct zone *zone) · 1606 unmodified lines
16071607 if (!__pageblock_pfn_to_page(block_start_pfn,
16081608 block_end_pfn, zone))
16091609 return;
1610+ cond_resched();
16101611 }
16111612
16121613 /* We confirm that there is no hole */
@@ -2400,6 +2401,14 @@ static inline void boost_watermark(struct zone *zone) · 787 unmodified lines
24002401
24012402 if (!watermark_boost_factor)
24022403 return;
2404+ /*
2405+ * Don't bother in zones that are unlikely to produce results.
2406+ * On small machines, including kdump capture kernels running
2407+ * in a small area, boosting the watermark can cause an out of
2408+ * memory situation immediately.
2409+ */
2410+ if ((pageblock_nr_pages * 4) > zone_managed_pages(zone))
2411+ return;
24032412
24042413 max_boost = mult_frac(zone->_watermark[WMARK_HIGH],
24052414 watermark_boost_factor, 10000);
mm/percpu.c+10−4
@@ -80,6 +80,7 @@ · 79 unmodified lines
8080 #include <linux/workqueue.h>
8181 #include <linux/kmemleak.h>
8282 #include <linux/sched.h>
83+#include <linux/sched/mm.h>
8384
8485 #include <asm/cacheflush.h>
8586 #include <asm/sections.h>
@@ -1557,10 +1558,9 @@ static struct pcpu_chunk *pcpu_chunk_addr_search(void *addr) · 1471 unmodified lines
15571558 static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved,
15581559 gfp_t gfp)
15591560 {
1560− /* whitelisted flags that can be passed to the backing allocators */
1561− gfp_t pcpu_gfp = gfp & (GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN);
1562− bool is_atomic = (gfp & GFP_KERNEL) != GFP_KERNEL;
1563− bool do_warn = !(gfp & __GFP_NOWARN);
1561+ gfp_t pcpu_gfp;
1562+ bool is_atomic;
1563+ bool do_warn;
15641564 static int warn_limit = 10;
15651565 struct pcpu_chunk *chunk, *next;
15661566 const char *err;
@@ -1569,6 +1569,12 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved, · 2 unmodified lines
15691569 void __percpu *ptr;
15701570 size_t bits, bit_align;
15711571
1572+ gfp = current_gfp_context(gfp);
1573+ /* whitelisted flags that can be passed to the backing allocators */
1574+ pcpu_gfp = gfp & (GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN);
1575+ is_atomic = (gfp & GFP_KERNEL) != GFP_KERNEL;
1576+ do_warn = !(gfp & __GFP_NOWARN);
1577+
15721578 /*
15731579 * There is now a minimum allocation size of PCPU_MIN_ALLOC_SIZE,
15741580 * therefore alignment must be a minimum of that many bytes.
mm/slub.c+30−15
@@ -551,15 +551,32 @@ static void print_section(char *level, char *text, u8 *addr, · 550 unmodified lines
551551 metadata_access_disable();
552552 }
553553
554+/*
555+ * See comment in calculate_sizes().
556+ */
557+static inline bool freeptr_outside_object(struct kmem_cache *s)
558+{
559+ return s->offset >= s->inuse;
560+}
561+
562+/*
563+ * Return offset of the end of info block which is inuse + free pointer if
564+ * not overlapping with object.
565+ */
566+static inline unsigned int get_info_end(struct kmem_cache *s)
567+{
568+ if (freeptr_outside_object(s))
569+ return s->inuse + sizeof(void *);
570+ else
571+ return s->inuse;
572+}
573+
554574 static struct track *get_track(struct kmem_cache *s, void *object,
555575 enum track_item alloc)
556576 {
557577 struct track *p;
558578
559− if (s->offset)
560− p = object + s->offset + sizeof(void *);
561− else
562− p = object + s->inuse;
579+ p = object + get_info_end(s);
563580
564581 return p + alloc;
565582 }
@@ -686,10 +703,7 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p) · 120 unmodified lines
686703 print_section(KERN_ERR, "Redzone ", p + s->object_size,
687704 s->inuse - s->object_size);
688705
689− if (s->offset)
690− off = s->offset + sizeof(void *);
691− else
692− off = s->inuse;
706+ off = get_info_end(s);
693707
694708 if (s->flags & SLAB_STORE_USER)
695709 off += 2 * sizeof(struct track);
@@ -782,7 +796,7 @@ static int check_bytes_and_report(struct kmem_cache *s, struct page *page, · 86 unmodified lines
782796 * object address
783797 * Bytes of the object to be managed.
784798 * If the freepointer may overlay the object then the free
785− * pointer is the first word of the object.
799+ * pointer is at the middle of the object.
786800 *
787801 * Poisoning uses 0x6b (POISON_FREE) and the last byte is
788802 * 0xa5 (POISON_END)
@@ -816,11 +830,7 @@ static int check_bytes_and_report(struct kmem_cache *s, struct page *page, · 27 unmodified lines
816830
817831 static int check_pad_bytes(struct kmem_cache *s, struct page *page, u8 *p)
818832 {
819− unsigned long off = s->inuse; /* The end of info */
820−
821− if (s->offset)
822− /* Freepointer is placed after the object. */
823− off += sizeof(void *);
833+ unsigned long off = get_info_end(s); /* The end of info */
824834
825835 if (s->flags & SLAB_STORE_USER)
826836 /* We also have user information there */
@@ -907,7 +917,7 @@ static int check_object(struct kmem_cache *s, struct page *page, · 80 unmodified lines
907917 check_pad_bytes(s, page, p);
908918 }
909919
910− if (!s->offset && val == SLUB_RED_ACTIVE)
920+ if (!freeptr_outside_object(s) && val == SLUB_RED_ACTIVE)
911921 /*
912922 * Object and freepointer overlap. Cannot check
913923 * freepointer while object is allocated.
@@ -3587,6 +3597,11 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order) · 2673 unmodified lines
35873597 *
35883598 * This is the case if we do RCU, have a constructor or
35893599 * destructor or are poisoning the objects.
3600+ *
3601+ * The assumption that s->offset >= s->inuse means free
3602+ * pointer is outside of the object is used in the
3603+ * freeptr_outside_object() function. If that is no
3604+ * longer true, the function needs to be modified.
35903605 */
35913606 s->offset = size;
35923607 size += sizeof(void *);
mm/vmscan.c+0−1
@@ -1625,7 +1625,6 @@ static __always_inline void update_lru_sizes(struct lruvec *lruvec, · 1624 unmodified lines
16251625 * @dst: The temp list to put pages on to.
16261626 * @nr_scanned: The number of pages that were scanned.
16271627 * @sc: The scan_control struct for this reclaim session
1628− * @mode: One of the LRU isolation modes
16291628 * @lru: LRU list id for isolating
16301629 *
16311630 * returns how many pages were moved onto *@dst.
net/atm/common.c+11−11
@@ -177,18 +177,18 @@ static void vcc_destroy_socket(struct sock *sk) · 176 unmodified lines
177177
178178 set_bit(ATM_VF_CLOSE, &vcc->flags);
179179 clear_bit(ATM_VF_READY, &vcc->flags);
180− if (vcc->dev) {
181− if (vcc->dev->ops->close)
182− vcc->dev->ops->close(vcc);
183− if (vcc->push)
184− vcc->push(vcc, NULL); /* atmarpd has no push */
185− module_put(vcc->owner);
186−
187− while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {
188− atm_return(vcc, skb->truesize);
189− kfree_skb(skb);
190− }
180+ if (vcc->dev && vcc->dev->ops->close)
181+ vcc->dev->ops->close(vcc);
182+ if (vcc->push)
183+ vcc->push(vcc, NULL); /* atmarpd has no push */
184+ module_put(vcc->owner);
185+
186+ while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {
187+ atm_return(vcc, skb->truesize);
188+ kfree_skb(skb);
189+ }
191190
191+ if (vcc->dev && vcc->dev->ops->owner) {
192192 module_put(vcc->dev->ops->owner);
193193 atm_dev_put(vcc->dev);
194194 }
net/atm/lec.c+6−0
@@ -1264,6 +1264,12 @@ static void lec_arp_clear_vccs(struct lec_arp_table *entry) · 1263 unmodified lines
12641264 entry->vcc = NULL;
12651265 }
12661266 if (entry->recv_vcc) {
1267+ struct atm_vcc *vcc = entry->recv_vcc;
1268+ struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc);
1269+
1270+ kfree(vpriv);
1271+ vcc->user_back = NULL;
1272+
12671273 entry->recv_vcc->push = entry->old_recv_push;
12681274 vcc_release_async(entry->recv_vcc, -EPIPE);
12691275 entry->recv_vcc = NULL;
net/batman-adv/bat_v_ogm.c+1−1
@@ -893,7 +893,7 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset, · 892 unmodified lines
893893
894894 orig_node = batadv_v_ogm_orig_get(bat_priv, ogm_packet->orig);
895895 if (!orig_node)
896− return;
896+ goto out;
897897
898898 neigh_node = batadv_neigh_node_get_or_create(orig_node, if_incoming,
899899 ethhdr->h_source);
net/batman-adv/network-coding.c+1−8
@@ -1009,15 +1009,8 @@ static struct batadv_nc_path *batadv_nc_get_path(struct batadv_priv *bat_priv, · 1008 unmodified lines
10091009 */
10101010 static u8 batadv_nc_random_weight_tq(u8 tq)
10111011 {
1012− u8 rand_val, rand_tq;
1013−
1014− get_random_bytes(&rand_val, sizeof(rand_val));
1015−
10161012 /* randomize the estimated packet loss (max TQ - estimated TQ) */
1017− rand_tq = rand_val * (BATADV_TQ_MAX_VALUE - tq);
1018−
1019− /* normalize the randomized packet loss */
1020− rand_tq /= BATADV_TQ_MAX_VALUE;
1013+ u8 rand_tq = prandom_u32_max(BATADV_TQ_MAX_VALUE + 1 - tq);
10211014
10221015 /* convert to (randomized) estimated tq again */
10231016 return BATADV_TQ_MAX_VALUE - rand_tq;
net/batman-adv/sysfs.c+2−1
@@ -1150,7 +1150,7 @@ static ssize_t batadv_store_throughput_override(struct kobject *kobj, · 1149 unmodified lines
11501150 ret = batadv_parse_throughput(net_dev, buff, "throughput_override",
11511151 &tp_override);
11521152 if (!ret)
1153− return count;
1153+ goto out;
11541154
11551155 old_tp_override = atomic_read(&hard_iface->bat_v.throughput_override);
11561156 if (old_tp_override == tp_override)
@@ -1190,6 +1190,7 @@ static ssize_t batadv_show_throughput_override(struct kobject *kobj, · 33 unmodified lines
11901190
11911191 tp_override = atomic_read(&hard_iface->bat_v.throughput_override);
11921192
1193+ batadv_hardif_put(hard_iface);
11931194 return sprintf(buff, "%u.%u MBit\n", tp_override / 10,
11941195 tp_override % 10);
11951196 }
net/bridge/br_netlink.c+1−0
@@ -612,6 +612,7 @@ int br_process_vlan_info(struct net_bridge *br, · 611 unmodified lines
612612 v - 1, rtm_cmd);
613613 v_change_start = 0;
614614 }
615+ cond_resched();
615616 }
616617 /* v_change_start is set only if the last/whole range changed */
617618 if (v_change_start)
net/core/devlink.c+10−2
@@ -4283,6 +4283,11 @@ static int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb, · 4282 unmodified lines
42834283 end_offset = nla_get_u64(attrs[DEVLINK_ATTR_REGION_CHUNK_ADDR]);
42844284 end_offset += nla_get_u64(attrs[DEVLINK_ATTR_REGION_CHUNK_LEN]);
42854285 dump = false;
4286+
4287+ if (start_offset == end_offset) {
4288+ err = 0;
4289+ goto nla_put_failure;
4290+ }
42864291 }
42874292
42884293 err = devlink_nl_region_read_snapshot_fill(skb, devlink,
@@ -5363,6 +5368,7 @@ int devlink_health_report(struct devlink_health_reporter *reporter, · 1074 unmodified lines
53635368 {
53645369 enum devlink_health_reporter_state prev_health_state;
53655370 struct devlink *devlink = reporter->devlink;
5371+ unsigned long recover_ts_threshold;
53665372
53675373 /* write a log message of the current error */
53685374 WARN_ON(!msg);
@@ -5373,10 +5379,12 @@ int devlink_health_report(struct devlink_health_reporter *reporter, · 4 unmodified lines
53735379 devlink_recover_notify(reporter, DEVLINK_CMD_HEALTH_REPORTER_RECOVER);
53745380
53755381 /* abort if the previous error wasn't recovered */
5382+ recover_ts_threshold = reporter->last_recovery_ts +
5383+ msecs_to_jiffies(reporter->graceful_period);
53765384 if (reporter->auto_recover &&
53775385 (prev_health_state != DEVLINK_HEALTH_REPORTER_STATE_HEALTHY ||
5378− jiffies - reporter->last_recovery_ts <
5379− msecs_to_jiffies(reporter->graceful_period))) {
5386+ (reporter->last_recovery_ts && reporter->recovery_count &&
5387+ time_is_after_jiffies(recover_ts_threshold)))) {
53805388 trace_devlink_health_recover_aborted(devlink,
53815389 reporter->ops->name,
53825390 reporter->health_state,
net/core/drop_monitor.c+7−4
@@ -213,6 +213,7 @@ static void sched_send_work(struct timer_list *t) · 212 unmodified lines
213213 static void trace_drop_common(struct sk_buff *skb, void *location)
214214 {
215215 struct net_dm_alert_msg *msg;
216+ struct net_dm_drop_point *point;
216217 struct nlmsghdr *nlh;
217218 struct nlattr *nla;
218219 int i;
@@ -231,11 +232,13 @@ static void trace_drop_common(struct sk_buff *skb, void *location) · 12 unmodified lines
231232 nlh = (struct nlmsghdr *)dskb->data;
232233 nla = genlmsg_data(nlmsg_data(nlh));
233234 msg = nla_data(nla);
235+ point = msg->points;
234236 for (i = 0; i < msg->entries; i++) {
235− if (!memcmp(&location, msg->points[i].pc, sizeof(void *))) {
236− msg->points[i].count++;
237+ if (!memcmp(&location, &point->pc, sizeof(void *))) {
238+ point->count++;
237239 goto out;
238240 }
241+ point++;
239242 }
240243 if (msg->entries == dm_hit_limit)
241244 goto out;
@@ -244,8 +247,8 @@ static void trace_drop_common(struct sk_buff *skb, void *location) · 2 unmodified lines
244247 */
245248 __nla_reserve_nohdr(dskb, sizeof(struct net_dm_drop_point));
246249 nla->nla_len += NLA_ALIGN(sizeof(struct net_dm_drop_point));
247− memcpy(msg->points[msg->entries].pc, &location, sizeof(void *));
248− msg->points[msg->entries].count = 1;
250+ memcpy(point->pc, &location, sizeof(void *));
251+ point->count = 1;
249252 msg->entries++;
250253
251254 if (!timer_pending(&data->send_timer)) {
net/core/neighbour.c+3−3
@@ -1956,6 +1956,9 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, · 1955 unmodified lines
19561956 NEIGH_UPDATE_F_OVERRIDE_ISROUTER);
19571957 }
19581958
1959+ if (protocol)
1960+ neigh->protocol = protocol;
1961+
19591962 if (ndm->ndm_flags & NTF_EXT_LEARNED)
19601963 flags |= NEIGH_UPDATE_F_EXT_LEARNED;
19611964
@@ -1969,9 +1972,6 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, · 7 unmodified lines
19691972 err = __neigh_update(neigh, lladdr, ndm->ndm_state, flags,
19701973 NETLINK_CB(skb).portid, extack);
19711974
1972− if (protocol)
1973− neigh->protocol = protocol;
1974−
19751975 neigh_release(neigh);
19761976
19771977 out:
net/core/sock.c+0−1
@@ -2364,7 +2364,6 @@ static void sk_leave_memory_pressure(struct sock *sk) · 2363 unmodified lines
23642364 }
23652365 }
23662366
2367−/* On 32bit arches, an skb frag is limited to 2^15 */
23682367 #define SKB_FRAG_PAGE_ORDER get_order(32768)
23692368 DEFINE_STATIC_KEY_FALSE(net_high_order_alloc_disable_key);
23702369
net/dsa/dsa2.c+1−1
@@ -459,7 +459,7 @@ static int dsa_tree_setup_switches(struct dsa_switch_tree *dst) · 458 unmodified lines
459459 list_for_each_entry(dp, &dst->ports, list) {
460460 err = dsa_port_setup(dp);
461461 if (err)
462− goto teardown;
462+ continue;
463463 }
464464
465465 return 0;
net/dsa/master.c+2−1
@@ -289,7 +289,8 @@ static void dsa_master_ndo_teardown(struct net_device *dev) · 288 unmodified lines
289289 {
290290 struct dsa_port *cpu_dp = dev->dsa_ptr;
291291
292− dev->netdev_ops = cpu_dp->orig_ndo_ops;
292+ if (cpu_dp->orig_ndo_ops)
293+ dev->netdev_ops = cpu_dp->orig_ndo_ops;
293294 cpu_dp->orig_ndo_ops = NULL;
294295 }
295296
net/dsa/slave.c+3−5
@@ -856,20 +856,18 @@ dsa_slave_add_cls_matchall_mirred(struct net_device *dev, · 855 unmodified lines
856856 struct dsa_port *to_dp;
857857 int err;
858858
859− act = &cls->rule->action.entries[0];
860−
861859 if (!ds->ops->port_mirror_add)
862860 return -EOPNOTSUPP;
863861
864− if (!act->dev)
865− return -EINVAL;
866−
867862 if (!flow_action_basic_hw_stats_check(&cls->rule->action,
868863 cls->common.extack))
869864 return -EOPNOTSUPP;
870865
871866 act = &cls->rule->action.entries[0];
872867
868+ if (!act->dev)
869+ return -EINVAL;
870+
873871 if (!dsa_slave_dev_check(act->dev))
874872 return -EOPNOTSUPP;
875873
net/hsr/hsr_slave.c+1−1
@@ -18,7 +18,7 @@ static rx_handler_result_t hsr_handle_frame(struct sk_buff **pskb) · 17 unmodified lines
1818 {
1919 struct sk_buff *skb = *pskb;
2020 struct hsr_port *port;
21− u16 protocol;
21+ __be16 protocol;
2222
2323 if (!skb_mac_header_was_set(skb)) {
2424 WARN_ONCE(1, "%s: skb invalid", __func__);
net/ipv4/tcp_input.c+0−7
@@ -3926,10 +3926,6 @@ void tcp_parse_options(const struct net *net, · 3925 unmodified lines
39263926 */
39273927 break;
39283928 #endif
3929− case TCPOPT_MPTCP:
3930− mptcp_parse_option(skb, ptr, opsize, opt_rx);
3931− break;
3932−
39333929 case TCPOPT_FASTOPEN:
39343930 tcp_parse_fastopen_option(
39353931 opsize - TCPOLEN_FASTOPEN_BASE,
@@ -5990,9 +5986,6 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, · 2054 unmodified lines
59905986 tcp_sync_mss(sk, icsk->icsk_pmtu_cookie);
59915987 tcp_initialize_rcv_mss(sk);
59925988
5993− if (sk_is_mptcp(sk))
5994− mptcp_rcv_synsent(sk);
5995−
59965989 /* Remember, tcp_poll() does not lock socket!
59975990 * Change state from SYN-SENT only after copied_seq
59985991 * is initialized. */
net/ipv6/route.c+25−0
@@ -1385,9 +1385,18 @@ static struct rt6_info *ip6_rt_pcpu_alloc(const struct fib6_result *res) · 1384 unmodified lines
13851385 }
13861386 ip6_rt_copy_init(pcpu_rt, res);
13871387 pcpu_rt->rt6i_flags |= RTF_PCPU;
1388+
1389+ if (f6i->nh)
1390+ pcpu_rt->sernum = rt_genid_ipv6(dev_net(dev));
1391+
13881392 return pcpu_rt;
13891393 }
13901394
1395+static bool rt6_is_valid(const struct rt6_info *rt6)
1396+{
1397+ return rt6->sernum == rt_genid_ipv6(dev_net(rt6->dst.dev));
1398+}
1399+
13911400 /* It should be called with rcu_read_lock() acquired */
13921401 static struct rt6_info *rt6_get_pcpu_route(const struct fib6_result *res)
13931402 {
@@ -1395,6 +1404,19 @@ static struct rt6_info *rt6_get_pcpu_route(const struct fib6_result *res) · 1 unmodified line
13951404
13961405 pcpu_rt = this_cpu_read(*res->nh->rt6i_pcpu);
13971406
1407+ if (pcpu_rt && pcpu_rt->sernum && !rt6_is_valid(pcpu_rt)) {
1408+ struct rt6_info *prev, **p;
1409+
1410+ p = this_cpu_ptr(res->nh->rt6i_pcpu);
1411+ prev = xchg(p, NULL);
1412+ if (prev) {
1413+ dst_dev_put(&prev->dst);
1414+ dst_release(&prev->dst);
1415+ }
1416+
1417+ pcpu_rt = NULL;
1418+ }
1419+
13981420 return pcpu_rt;
13991421 }
14001422
@@ -2593,6 +2615,9 @@ static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie) · 1192 unmodified lines
25932615
25942616 rt = container_of(dst, struct rt6_info, dst);
25952617
2618+ if (rt->sernum)
2619+ return rt6_is_valid(rt) ? dst : NULL;
2620+
25962621 rcu_read_lock();
25972622
25982623 /* All IPV6 dsts are created with ->obsolete set to the value
net/ipv6/seg6.c+8−2
@@ -27,8 +27,9 @@ · 26 unmodified lines
2727
2828 bool seg6_validate_srh(struct ipv6_sr_hdr *srh, int len)
2929 {
30− int trailing;
3130 unsigned int tlv_offset;
31+ int max_last_entry;
32+ int trailing;
3233
3334 if (srh->type != IPV6_SRCRT_TYPE_4)
3435 return false;
@@ -36,7 +37,12 @@ bool seg6_validate_srh(struct ipv6_sr_hdr *srh, int len) · 1 unmodified line
3637 if (((srh->hdrlen + 1) << 3) != len)
3738 return false;
3839
39− if (srh->segments_left > srh->first_segment)
40+ max_last_entry = (srh->hdrlen / 2) - 1;
41+
42+ if (srh->first_segment > max_last_entry)
43+ return false;
44+
45+ if (srh->segments_left > srh->first_segment + 1)
4046 return false;
4147
4248 tlv_offset = sizeof(*srh) + ((srh->first_segment + 1) << 4);
net/mptcp/options.c+41−54
@@ -16,10 +16,10 @@ static bool mptcp_cap_flag_sha256(u8 flags) · 15 unmodified lines
1616 return (flags & MPTCP_CAP_FLAG_MASK) == MPTCP_CAP_HMAC_SHA256;
1717 }
1818
19−void mptcp_parse_option(const struct sk_buff *skb, const unsigned char *ptr,
20− int opsize, struct tcp_options_received *opt_rx)
19+static void mptcp_parse_option(const struct sk_buff *skb,
20+ const unsigned char *ptr, int opsize,
21+ struct mptcp_options_received *mp_opt)
2122 {
22− struct mptcp_options_received *mp_opt = &opt_rx->mptcp;
2323 u8 subtype = *ptr >> 4;
2424 int expected_opsize;
2525 u8 version;
@@ -283,12 +283,20 @@ void mptcp_parse_option(const struct sk_buff *skb, const unsigned char *ptr, · 257 unmodified lines
283283 }
284284
285285 void mptcp_get_options(const struct sk_buff *skb,
286− struct tcp_options_received *opt_rx)
286+ struct mptcp_options_received *mp_opt)
287287 {
288− const unsigned char *ptr;
289288 const struct tcphdr *th = tcp_hdr(skb);
290− int length = (th->doff * 4) - sizeof(struct tcphdr);
289+ const unsigned char *ptr;
290+ int length;
291+
292+ /* initialize option status */
293+ mp_opt->mp_capable = 0;
294+ mp_opt->mp_join = 0;
295+ mp_opt->add_addr = 0;
296+ mp_opt->rm_addr = 0;
297+ mp_opt->dss = 0;
291298
299+ length = (th->doff * 4) - sizeof(struct tcphdr);
292300 ptr = (const unsigned char *)(th + 1);
293301
294302 while (length > 0) {
@@ -308,7 +316,7 @@ void mptcp_get_options(const struct sk_buff *skb, · 13 unmodified lines
308316 if (opsize > length)
309317 return; /* don't parse partial options */
310318 if (opcode == TCPOPT_MPTCP)
311− mptcp_parse_option(skb, ptr, opsize, opt_rx);
319+ mptcp_parse_option(skb, ptr, opsize, mp_opt);
312320 ptr += opsize - 2;
313321 length -= opsize;
314322 }
@@ -344,28 +352,6 @@ bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb, · 29 unmodified lines
344352 return false;
345353 }
346354
347−void mptcp_rcv_synsent(struct sock *sk)
348−{
349− struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
350− struct tcp_sock *tp = tcp_sk(sk);
351−
352− if (subflow->request_mptcp && tp->rx_opt.mptcp.mp_capable) {
353− subflow->mp_capable = 1;
354− subflow->can_ack = 1;
355− subflow->remote_key = tp->rx_opt.mptcp.sndr_key;
356− pr_debug("subflow=%p, remote_key=%llu", subflow,
357− subflow->remote_key);
358− } else if (subflow->request_join && tp->rx_opt.mptcp.mp_join) {
359− subflow->mp_join = 1;
360− subflow->thmac = tp->rx_opt.mptcp.thmac;
361− subflow->remote_nonce = tp->rx_opt.mptcp.nonce;
362− pr_debug("subflow=%p, thmac=%llu, remote_nonce=%u", subflow,
363− subflow->thmac, subflow->remote_nonce);
364− } else if (subflow->request_mptcp) {
365− tcp_sk(sk)->is_mptcp = 0;
366− }
367−}
368−
369355 /* MP_JOIN client subflow must wait for 4th ack before sending any data:
370356 * TCP can't schedule delack timer before the subflow is fully established.
371357 * MPTCP uses the delack timer to do 3rd ack retransmissions
@@ -709,7 +695,7 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *sk, · 337 unmodified lines
709695 if (TCP_SKB_CB(skb)->seq != subflow->ssn_offset + 1)
710696 return subflow->mp_capable;
711697
712− if (mp_opt->use_ack) {
698+ if (mp_opt->dss && mp_opt->use_ack) {
713699 /* subflows are fully established as soon as we get any
714700 * additional ack.
715701 */
@@ -717,8 +703,6 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *sk, · 1 unmodified line
717703 goto fully_established;
718704 }
719705
720− WARN_ON_ONCE(subflow->can_ack);
721−
722706 /* If the first established packet does not contain MP_CAPABLE + data
723707 * then fallback to TCP
724708 */
@@ -728,6 +712,8 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *sk, · 3 unmodified lines
728712 return false;
729713 }
730714
715+ if (unlikely(!READ_ONCE(msk->pm.server_side)))
716+ pr_warn_once("bogus mpc option on established client sk");
731717 subflow->fully_established = 1;
732718 subflow->remote_key = mp_opt->sndr_key;
733719 subflow->can_ack = 1;
@@ -819,41 +805,41 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb, · 85 unmodified lines
819805 {
820806 struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
821807 struct mptcp_sock *msk = mptcp_sk(subflow->conn);
822− struct mptcp_options_received *mp_opt;
808+ struct mptcp_options_received mp_opt;
823809 struct mptcp_ext *mpext;
824810
825− mp_opt = &opt_rx->mptcp;
826− if (!check_fully_established(msk, sk, subflow, skb, mp_opt))
811+ mptcp_get_options(skb, &mp_opt);
812+ if (!check_fully_established(msk, sk, subflow, skb, &mp_opt))
827813 return;
828814
829− if (mp_opt->add_addr && add_addr_hmac_valid(msk, mp_opt)) {
815+ if (mp_opt.add_addr && add_addr_hmac_valid(msk, &mp_opt)) {
830816 struct mptcp_addr_info addr;
831817
832− addr.port = htons(mp_opt->port);
833− addr.id = mp_opt->addr_id;
834− if (mp_opt->family == MPTCP_ADDR_IPVERSION_4) {
818+ addr.port = htons(mp_opt.port);
819+ addr.id = mp_opt.addr_id;
820+ if (mp_opt.family == MPTCP_ADDR_IPVERSION_4) {
835821 addr.family = AF_INET;
836− addr.addr = mp_opt->addr;
822+ addr.addr = mp_opt.addr;
837823 }
838824 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
839− else if (mp_opt->family == MPTCP_ADDR_IPVERSION_6) {
825+ else if (mp_opt.family == MPTCP_ADDR_IPVERSION_6) {
840826 addr.family = AF_INET6;
841− addr.addr6 = mp_opt->addr6;
827+ addr.addr6 = mp_opt.addr6;
842828 }
843829 #endif
844− if (!mp_opt->echo)
830+ if (!mp_opt.echo)
845831 mptcp_pm_add_addr_received(msk, &addr);
846− mp_opt->add_addr = 0;
832+ mp_opt.add_addr = 0;
847833 }
848834
849− if (!mp_opt->dss)
835+ if (!mp_opt.dss)
850836 return;
851837
852838 /* we can't wait for recvmsg() to update the ack_seq, otherwise
853839 * monodirectional flows will stuck
854840 */
855− if (mp_opt->use_ack)
856− update_una(msk, mp_opt);
841+ if (mp_opt.use_ack)
842+ update_una(msk, &mp_opt);
857843
858844 mpext = skb_ext_add(skb, SKB_EXT_MPTCP);
859845 if (!mpext)
@@ -861,8 +847,8 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb, · 1 unmodified line
861847
862848 memset(mpext, 0, sizeof(*mpext));
863849
864− if (mp_opt->use_map) {
865− if (mp_opt->mpc_map) {
850+ if (mp_opt.use_map) {
851+ if (mp_opt.mpc_map) {
866852 /* this is an MP_CAPABLE carrying MPTCP data
867853 * we know this map the first chunk of data
868854 */
@@ -872,13 +858,14 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb, · 3 unmodified lines
872858 mpext->subflow_seq = 1;
873859 mpext->dsn64 = 1;
874860 mpext->mpc_map = 1;
861+ mpext->data_fin = 0;
875862 } else {
876− mpext->data_seq = mp_opt->data_seq;
877− mpext->subflow_seq = mp_opt->subflow_seq;
878− mpext->dsn64 = mp_opt->dsn64;
879− mpext->data_fin = mp_opt->data_fin;
863+ mpext->data_seq = mp_opt.data_seq;
864+ mpext->subflow_seq = mp_opt.subflow_seq;
865+ mpext->dsn64 = mp_opt.dsn64;
866+ mpext->data_fin = mp_opt.data_fin;
880867 }
881− mpext->data_len = mp_opt->data_len;
868+ mpext->data_len = mp_opt.data_len;
882869 mpext->use_map = 1;
883870 }
884871 }
net/mptcp/protocol.c+9−8
@@ -1316,11 +1316,12 @@ static void mptcp_copy_inaddrs(struct sock *msk, const struct sock *ssk) · 1315 unmodified lines
13161316
13171317 static int mptcp_disconnect(struct sock *sk, int flags)
13181318 {
1319− lock_sock(sk);
1320− __mptcp_clear_xmit(sk);
1321− release_sock(sk);
1322− mptcp_cancel_work(sk);
1323− return tcp_disconnect(sk, flags);
1319+ /* Should never be called.
1320+ * inet_stream_connect() calls ->disconnect, but that
1321+ * refers to the subflow socket, not the mptcp one.
1322+ */
1323+ WARN_ON_ONCE(1);
1324+ return 0;
13241325 }
13251326
13261327 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
@@ -1333,7 +1334,7 @@ static struct ipv6_pinfo *mptcp_inet6_sk(const struct sock *sk) · 6 unmodified lines
13331334 #endif
13341335
13351336 struct sock *mptcp_sk_clone(const struct sock *sk,
1336− const struct tcp_options_received *opt_rx,
1337+ const struct mptcp_options_received *mp_opt,
13371338 struct request_sock *req)
13381339 {
13391340 struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
@@ -1372,9 +1373,9 @@ struct sock *mptcp_sk_clone(const struct sock *sk, · 32 unmodified lines
13721373
13731374 msk->write_seq = subflow_req->idsn + 1;
13741375 atomic64_set(&msk->snd_una, msk->write_seq);
1375− if (opt_rx->mptcp.mp_capable) {
1376+ if (mp_opt->mp_capable) {
13761377 msk->can_ack = true;
1377− msk->remote_key = opt_rx->mptcp.sndr_key;
1378+ msk->remote_key = mp_opt->sndr_key;
13781379 mptcp_crypto_key_sha(msk->remote_key, NULL, &ack_seq);
13791380 ack_seq++;
13801381 msk->ack_seq = ack_seq;
net/mptcp/protocol.h+41−2
@@ -91,6 +91,45 @@ · 90 unmodified lines
9191 #define MPTCP_WORK_RTX 2
9292 #define MPTCP_WORK_EOF 3
9393
94+struct mptcp_options_received {
95+ u64 sndr_key;
96+ u64 rcvr_key;
97+ u64 data_ack;
98+ u64 data_seq;
99+ u32 subflow_seq;
100+ u16 data_len;
101+ u16 mp_capable : 1,
102+ mp_join : 1,
103+ dss : 1,
104+ add_addr : 1,
105+ rm_addr : 1,
106+ family : 4,
107+ echo : 1,
108+ backup : 1;
109+ u32 token;
110+ u32 nonce;
111+ u64 thmac;
112+ u8 hmac[20];
113+ u8 join_id;
114+ u8 use_map:1,
115+ dsn64:1,
116+ data_fin:1,
117+ use_ack:1,
118+ ack64:1,
119+ mpc_map:1,
120+ __unused:2;
121+ u8 addr_id;
122+ u8 rm_id;
123+ union {
124+ struct in_addr addr;
125+#if IS_ENABLED(CONFIG_MPTCP_IPV6)
126+ struct in6_addr addr6;
127+#endif
128+ };
129+ u64 ahmac;
130+ u16 port;
131+};
132+
94133 static inline __be32 mptcp_option(u8 subopt, u8 len, u8 nib, u8 field)
95134 {
96135 return htonl((TCPOPT_MPTCP << 24) | (len << 16) | (subopt << 12) |
@@ -331,10 +370,10 @@ int mptcp_proto_v6_init(void); · 234 unmodified lines
331370 #endif
332371
333372 struct sock *mptcp_sk_clone(const struct sock *sk,
334− const struct tcp_options_received *opt_rx,
373+ const struct mptcp_options_received *mp_opt,
335374 struct request_sock *req);
336375 void mptcp_get_options(const struct sk_buff *skb,
337− struct tcp_options_received *opt_rx);
376+ struct mptcp_options_received *mp_opt);
338377
339378 void mptcp_finish_connect(struct sock *sk);
340379 void mptcp_data_ready(struct sock *sk, struct sock *ssk);
net/mptcp/subflow.c+55−31
@@ -124,12 +124,11 @@ static void subflow_init_req(struct request_sock *req, · 123 unmodified lines
124124 {
125125 struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk_listener);
126126 struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
127− struct tcp_options_received rx_opt;
127+ struct mptcp_options_received mp_opt;
128128
129129 pr_debug("subflow_req=%p, listener=%p", subflow_req, listener);
130130
131− memset(&rx_opt.mptcp, 0, sizeof(rx_opt.mptcp));
132− mptcp_get_options(skb, &rx_opt);
131+ mptcp_get_options(skb, &mp_opt);
133132
134133 subflow_req->mp_capable = 0;
135134 subflow_req->mp_join = 0;
@@ -142,16 +141,16 @@ static void subflow_init_req(struct request_sock *req, · 6 unmodified lines
142141 return;
143142 #endif
144143
145− if (rx_opt.mptcp.mp_capable) {
144+ if (mp_opt.mp_capable) {
146145 SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_MPCAPABLEPASSIVE);
147146
148− if (rx_opt.mptcp.mp_join)
147+ if (mp_opt.mp_join)
149148 return;
150− } else if (rx_opt.mptcp.mp_join) {
149+ } else if (mp_opt.mp_join) {
151150 SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINSYNRX);
152151 }
153152
154− if (rx_opt.mptcp.mp_capable && listener->request_mptcp) {
153+ if (mp_opt.mp_capable && listener->request_mptcp) {
155154 int err;
156155
157156 err = mptcp_token_new_request(req);
@@ -159,13 +158,13 @@ static void subflow_init_req(struct request_sock *req, · 1 unmodified line
159158 subflow_req->mp_capable = 1;
160159
161160 subflow_req->ssn_offset = TCP_SKB_CB(skb)->seq;
162− } else if (rx_opt.mptcp.mp_join && listener->request_mptcp) {
161+ } else if (mp_opt.mp_join && listener->request_mptcp) {
163162 subflow_req->ssn_offset = TCP_SKB_CB(skb)->seq;
164163 subflow_req->mp_join = 1;
165− subflow_req->backup = rx_opt.mptcp.backup;
166− subflow_req->remote_id = rx_opt.mptcp.join_id;
167− subflow_req->token = rx_opt.mptcp.token;
168− subflow_req->remote_nonce = rx_opt.mptcp.nonce;
164+ subflow_req->backup = mp_opt.backup;
165+ subflow_req->remote_id = mp_opt.join_id;
166+ subflow_req->token = mp_opt.token;
167+ subflow_req->remote_nonce = mp_opt.nonce;
169168 pr_debug("token=%u, remote_nonce=%u", subflow_req->token,
170169 subflow_req->remote_nonce);
171170 if (!subflow_token_join_request(req, skb)) {
@@ -221,23 +220,47 @@ static bool subflow_thmac_valid(struct mptcp_subflow_context *subflow) · 49 unmodified lines
221220 static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
222221 {
223222 struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
223+ struct mptcp_options_received mp_opt;
224224 struct sock *parent = subflow->conn;
225+ struct tcp_sock *tp = tcp_sk(sk);
225226
226227 subflow->icsk_af_ops->sk_rx_dst_set(sk, skb);
227228
228− if (inet_sk_state_load(parent) != TCP_ESTABLISHED) {
229+ if (inet_sk_state_load(parent) == TCP_SYN_SENT) {
229230 inet_sk_state_store(parent, TCP_ESTABLISHED);
230231 parent->sk_state_change(parent);
231232 }
232233
233− if (subflow->conn_finished || !tcp_sk(sk)->is_mptcp)
234+ /* be sure no special action on any packet other than syn-ack */
235+ if (subflow->conn_finished)
236+ return;
237+
238+ subflow->conn_finished = 1;
239+
240+ mptcp_get_options(skb, &mp_opt);
241+ if (subflow->request_mptcp && mp_opt.mp_capable) {
242+ subflow->mp_capable = 1;
243+ subflow->can_ack = 1;
244+ subflow->remote_key = mp_opt.sndr_key;
245+ pr_debug("subflow=%p, remote_key=%llu", subflow,
246+ subflow->remote_key);
247+ } else if (subflow->request_join && mp_opt.mp_join) {
248+ subflow->mp_join = 1;
249+ subflow->thmac = mp_opt.thmac;
250+ subflow->remote_nonce = mp_opt.nonce;
251+ pr_debug("subflow=%p, thmac=%llu, remote_nonce=%u", subflow,
252+ subflow->thmac, subflow->remote_nonce);
253+ } else if (subflow->request_mptcp) {
254+ tp->is_mptcp = 0;
255+ }
256+
257+ if (!tp->is_mptcp)
234258 return;
235259
236260 if (subflow->mp_capable) {
237261 pr_debug("subflow=%p, remote_key=%llu", mptcp_subflow_ctx(sk),
238262 subflow->remote_key);
239263 mptcp_finish_connect(sk);
240− subflow->conn_finished = 1;
241264
242265 if (skb) {
243266 pr_debug("synack seq=%u", TCP_SKB_CB(skb)->seq);
@@ -264,7 +287,6 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) · 20 unmodified lines
264287 if (!mptcp_finish_join(sk))
265288 goto do_reset;
266289
267− subflow->conn_finished = 1;
268290 MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKRX);
269291 } else {
270292 do_reset:
@@ -322,7 +344,7 @@ drop: · 51 unmodified lines
322344
323345 /* validate hmac received in third ACK */
324346 static bool subflow_hmac_valid(const struct request_sock *req,
325− const struct tcp_options_received *rx_opt)
347+ const struct mptcp_options_received *mp_opt)
326348 {
327349 const struct mptcp_subflow_request_sock *subflow_req;
328350 u8 hmac[MPTCPOPT_HMAC_LEN];
@@ -339,7 +361,7 @@ static bool subflow_hmac_valid(const struct request_sock *req, · 10 unmodified lines
339361 subflow_req->local_nonce, hmac);
340362
341363 ret = true;
342− if (crypto_memneq(hmac, rx_opt->mptcp.hmac, sizeof(hmac)))
364+ if (crypto_memneq(hmac, mp_opt->hmac, sizeof(hmac)))
343365 ret = false;
344366
345367 sock_put((struct sock *)msk);
@@ -395,7 +417,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, · 49 unmodified lines
395417 {
396418 struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk);
397419 struct mptcp_subflow_request_sock *subflow_req;
398− struct tcp_options_received opt_rx;
420+ struct mptcp_options_received mp_opt;
399421 bool fallback_is_fatal = false;
400422 struct sock *new_msk = NULL;
401423 bool fallback = false;
@@ -403,7 +425,10 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, · 1 unmodified line
403425
404426 pr_debug("listener=%p, req=%p, conn=%p", listener, req, listener->conn);
405427
406− opt_rx.mptcp.mp_capable = 0;
428+ /* we need later a valid 'mp_capable' value even when options are not
429+ * parsed
430+ */
431+ mp_opt.mp_capable = 0;
407432 if (tcp_rsk(req)->is_mptcp == 0)
408433 goto create_child;
409434
@@ -418,22 +443,21 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, · 8 unmodified lines
418443 goto create_msk;
419444 }
420445
421− mptcp_get_options(skb, &opt_rx);
422− if (!opt_rx.mptcp.mp_capable) {
446+ mptcp_get_options(skb, &mp_opt);
447+ if (!mp_opt.mp_capable) {
423448 fallback = true;
424449 goto create_child;
425450 }
426451
427452 create_msk:
428− new_msk = mptcp_sk_clone(listener->conn, &opt_rx, req);
453+ new_msk = mptcp_sk_clone(listener->conn, &mp_opt, req);
429454 if (!new_msk)
430455 fallback = true;
431456 } else if (subflow_req->mp_join) {
432457 fallback_is_fatal = true;
433− opt_rx.mptcp.mp_join = 0;
434− mptcp_get_options(skb, &opt_rx);
435− if (!opt_rx.mptcp.mp_join ||
436− !subflow_hmac_valid(req, &opt_rx)) {
458+ mptcp_get_options(skb, &mp_opt);
459+ if (!mp_opt.mp_join ||
460+ !subflow_hmac_valid(req, &mp_opt)) {
437461 SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC);
438462 return NULL;
439463 }
@@ -473,9 +497,9 @@ create_child: · 33 unmodified lines
473497 /* with OoO packets we can reach here without ingress
474498 * mpc option
475499 */
476− ctx->remote_key = opt_rx.mptcp.sndr_key;
477− ctx->fully_established = opt_rx.mptcp.mp_capable;
478− ctx->can_ack = opt_rx.mptcp.mp_capable;
500+ ctx->remote_key = mp_opt.sndr_key;
501+ ctx->fully_established = mp_opt.mp_capable;
502+ ctx->can_ack = mp_opt.mp_capable;
479503 } else if (ctx->mp_join) {
480504 struct mptcp_sock *owner;
481505
@@ -499,7 +523,7 @@ out: · 17 unmodified lines
499523 /* check for expected invariant - should never trigger, just help
500524 * catching eariler subtle bugs
501525 */
502− WARN_ON_ONCE(*own_req && child && tcp_sk(child)->is_mptcp &&
526+ WARN_ON_ONCE(child && *own_req && tcp_sk(child)->is_mptcp &&
503527 (!mptcp_subflow_ctx(child) ||
504528 !mptcp_subflow_ctx(child)->conn));
505529 return child;
net/netfilter/nf_nat_proto.c+1−3
@@ -68,15 +68,13 @@ static bool udp_manip_pkt(struct sk_buff *skb, · 67 unmodified lines
6868 enum nf_nat_manip_type maniptype)
6969 {
7070 struct udphdr *hdr;
71− bool do_csum;
7271
7372 if (skb_ensure_writable(skb, hdroff + sizeof(*hdr)))
7473 return false;
7574
7675 hdr = (struct udphdr *)(skb->data + hdroff);
77− do_csum = hdr->check || skb->ip_summed == CHECKSUM_PARTIAL;
76+ __udp_manip_pkt(skb, iphdroff, hdr, tuple, maniptype, !!hdr->check);
7877
79− __udp_manip_pkt(skb, iphdroff, hdr, tuple, maniptype, do_csum);
8078 return true;
8179 }
8280
net/netfilter/nfnetlink_osf.c+7−5
@@ -165,12 +165,12 @@ static bool nf_osf_match_one(const struct sk_buff *skb, · 164 unmodified lines
165165 static const struct tcphdr *nf_osf_hdr_ctx_init(struct nf_osf_hdr_ctx *ctx,
166166 const struct sk_buff *skb,
167167 const struct iphdr *ip,
168− unsigned char *opts)
168+ unsigned char *opts,
169+ struct tcphdr *_tcph)
169170 {
170171 const struct tcphdr *tcp;
171− struct tcphdr _tcph;
172172
173− tcp = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(struct tcphdr), &_tcph);
173+ tcp = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(struct tcphdr), _tcph);
174174 if (!tcp)
175175 return NULL;
176176
@@ -205,10 +205,11 @@ nf_osf_match(const struct sk_buff *skb, u_int8_t family, · 28 unmodified lines
205205 int fmatch = FMATCH_WRONG;
206206 struct nf_osf_hdr_ctx ctx;
207207 const struct tcphdr *tcp;
208+ struct tcphdr _tcph;
208209
209210 memset(&ctx, 0, sizeof(ctx));
210211
211− tcp = nf_osf_hdr_ctx_init(&ctx, skb, ip, opts);
212+ tcp = nf_osf_hdr_ctx_init(&ctx, skb, ip, opts, &_tcph);
212213 if (!tcp)
213214 return false;
214215
@@ -265,10 +266,11 @@ bool nf_osf_find(const struct sk_buff *skb, · 50 unmodified lines
265266 const struct nf_osf_finger *kf;
266267 struct nf_osf_hdr_ctx ctx;
267268 const struct tcphdr *tcp;
269+ struct tcphdr _tcph;
268270
269271 memset(&ctx, 0, sizeof(ctx));
270272
271− tcp = nf_osf_hdr_ctx_init(&ctx, skb, ip, opts);
273+ tcp = nf_osf_hdr_ctx_init(&ctx, skb, ip, opts, &_tcph);
272274 if (!tcp)
273275 return false;
274276
net/sched/cls_api.c+16−6
@@ -2070,6 +2070,7 @@ replay: · 2069 unmodified lines
20702070 err = PTR_ERR(block);
20712071 goto errout;
20722072 }
2073+ block->classid = parent;
20732074
20742075 chain_index = tca[TCA_CHAIN] ? nla_get_u32(tca[TCA_CHAIN]) : 0;
20752076 if (chain_index > TC_ACT_EXT_VAL_MASK) {
@@ -2612,12 +2613,10 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) · 536 unmodified lines
26122613 return skb->len;
26132614
26142615 parent = tcm->tcm_parent;
2615− if (!parent) {
2616+ if (!parent)
26162617 q = dev->qdisc;
2617− parent = q->handle;
2618− } else {
2618+ else
26192619 q = qdisc_lookup(dev, TC_H_MAJ(tcm->tcm_parent));
2620− }
26212620 if (!q)
26222621 goto out;
26232622 cops = q->ops->cl_ops;
@@ -2633,6 +2632,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) · 9 unmodified lines
26332632 block = cops->tcf_block(q, cl, NULL);
26342633 if (!block)
26352634 goto out;
2635+ parent = block->classid;
26362636 if (tcf_block_shared(block))
26372637 q = NULL;
26382638 }
@@ -3523,6 +3523,16 @@ static void tcf_sample_get_group(struct flow_action_entry *entry, · 884 unmodified lines
35233523 #endif
35243524 }
35253525
3526+static enum flow_action_hw_stats tc_act_hw_stats(u8 hw_stats)
3527+{
3528+ if (WARN_ON_ONCE(hw_stats > TCA_ACT_HW_STATS_ANY))
3529+ return FLOW_ACTION_HW_STATS_DONT_CARE;
3530+ else if (!hw_stats)
3531+ return FLOW_ACTION_HW_STATS_DISABLED;
3532+
3533+ return hw_stats;
3534+}
3535+
35263536 int tc_setup_flow_action(struct flow_action *flow_action,
35273537 const struct tcf_exts *exts)
35283538 {
@@ -3546,7 +3556,7 @@ int tc_setup_flow_action(struct flow_action *flow_action, · 17 unmodified lines
35463556 if (err)
35473557 goto err_out_locked;
35483558
3549− entry->hw_stats = act->hw_stats;
3559+ entry->hw_stats = tc_act_hw_stats(act->hw_stats);
35503560
35513561 if (is_tcf_gact_ok(act)) {
35523562 entry->id = FLOW_ACTION_ACCEPT;
@@ -3614,7 +3624,7 @@ int tc_setup_flow_action(struct flow_action *flow_action, · 61 unmodified lines
36143624 entry->mangle.mask = tcf_pedit_mask(act, k);
36153625 entry->mangle.val = tcf_pedit_val(act, k);
36163626 entry->mangle.offset = tcf_pedit_offset(act, k);
3617− entry->hw_stats = act->hw_stats;
3627+ entry->hw_stats = tc_act_hw_stats(act->hw_stats);
36183628 entry = &flow_action->entries[++j];
36193629 }
36203630 } else if (is_tcf_csum(act)) {
net/sched/sch_choke.c+2−1
@@ -323,7 +323,8 @@ static void choke_reset(struct Qdisc *sch) · 322 unmodified lines
323323
324324 sch->q.qlen = 0;
325325 sch->qstats.backlog = 0;
326− memset(q->tab, 0, (q->tab_mask + 1) * sizeof(struct sk_buff *));
326+ if (q->tab)
327+ memset(q->tab, 0, (q->tab_mask + 1) * sizeof(struct sk_buff *));
327328 q->head = q->tail = 0;
328329 red_restart(&q->vars);
329330 }
net/sched/sch_fq_codel.c+1−1
@@ -416,7 +416,7 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt, · 415 unmodified lines
416416 q->quantum = max(256U, nla_get_u32(tb[TCA_FQ_CODEL_QUANTUM]));
417417
418418 if (tb[TCA_FQ_CODEL_DROP_BATCH_SIZE])
419− q->drop_batch_size = min(1U, nla_get_u32(tb[TCA_FQ_CODEL_DROP_BATCH_SIZE]));
419+ q->drop_batch_size = max(1U, nla_get_u32(tb[TCA_FQ_CODEL_DROP_BATCH_SIZE]));
420420
421421 if (tb[TCA_FQ_CODEL_MEMORY_LIMIT])
422422 q->memory_limit = min(1U << 31, nla_get_u32(tb[TCA_FQ_CODEL_MEMORY_LIMIT]));
net/sched/sch_sfq.c+9−0
@@ -637,6 +637,15 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt) · 636 unmodified lines
637637 if (ctl->divisor &&
638638 (!is_power_of_2(ctl->divisor) || ctl->divisor > 65536))
639639 return -EINVAL;
640+
641+ /* slot->allot is a short, make sure quantum is not too big. */
642+ if (ctl->quantum) {
643+ unsigned int scaled = SFQ_ALLOT_SIZE(ctl->quantum);
644+
645+ if (scaled <= 0 || scaled > SHRT_MAX)
646+ return -EINVAL;
647+ }
648+
640649 if (ctl_v1 && !red_check_params(ctl_v1->qth_min, ctl_v1->qth_max,
641650 ctl_v1->Wlog))
642651 return -EINVAL;
net/sched/sch_skbprio.c+3−0
@@ -169,6 +169,9 @@ static int skbprio_change(struct Qdisc *sch, struct nlattr *opt, · 168 unmodified lines
169169 {
170170 struct tc_skbprio_qopt *ctl = nla_data(opt);
171171
172+ if (opt->nla_len != nla_attr_size(sizeof(*ctl)))
173+ return -EINVAL;
174+
172175 sch->limit = ctl->limit;
173176 return 0;
174177 }
net/sunrpc/clnt.c+18−6
@@ -880,6 +880,20 @@ EXPORT_SYMBOL_GPL(rpc_shutdown_client); · 879 unmodified lines
880880 /*
881881 * Free an RPC client
882882 */
883+static void rpc_free_client_work(struct work_struct *work)
884+{
885+ struct rpc_clnt *clnt = container_of(work, struct rpc_clnt, cl_work);
886+
887+ /* These might block on processes that might allocate memory,
888+ * so they cannot be called in rpciod, so they are handled separately
889+ * here.
890+ */
891+ rpc_clnt_debugfs_unregister(clnt);
892+ rpc_clnt_remove_pipedir(clnt);
893+
894+ kfree(clnt);
895+ rpciod_down();
896+}
883897 static struct rpc_clnt *
884898 rpc_free_client(struct rpc_clnt *clnt)
885899 {
@@ -890,17 +904,16 @@ rpc_free_client(struct rpc_clnt *clnt) · 4 unmodified lines
890904 rcu_dereference(clnt->cl_xprt)->servername);
891905 if (clnt->cl_parent != clnt)
892906 parent = clnt->cl_parent;
893− rpc_clnt_debugfs_unregister(clnt);
894− rpc_clnt_remove_pipedir(clnt);
895907 rpc_unregister_client(clnt);
896908 rpc_free_iostats(clnt->cl_metrics);
897909 clnt->cl_metrics = NULL;
898910 xprt_put(rcu_dereference_raw(clnt->cl_xprt));
899911 xprt_iter_destroy(&clnt->cl_xpi);
900− rpciod_down();
901912 put_cred(clnt->cl_cred);
902913 rpc_free_clid(clnt);
903− kfree(clnt);
914+
915+ INIT_WORK(&clnt->cl_work, rpc_free_client_work);
916+ schedule_work(&clnt->cl_work);
904917 return parent;
905918 }
906919
@@ -2808,8 +2821,7 @@ int rpc_clnt_test_and_add_xprt(struct rpc_clnt *clnt, · 1901 unmodified lines
28082821 task = rpc_call_null_helper(clnt, xprt, NULL,
28092822 RPC_TASK_SOFT|RPC_TASK_SOFTCONN|RPC_TASK_ASYNC|RPC_TASK_NULLCREDS,
28102823 &rpc_cb_add_xprt_call_ops, data);
2811− if (IS_ERR(task))
2812− return PTR_ERR(task);
2824+
28132825 rpc_put_task(task);
28142826 success:
28152827 return 1;
net/sunrpc/xprtrdma/rpc_rdma.c+11−4
@@ -388,7 +388,9 @@ static int rpcrdma_encode_read_list(struct rpcrdma_xprt *r_xprt, · 387 unmodified lines
388388 } while (nsegs);
389389
390390 done:
391− return xdr_stream_encode_item_absent(xdr);
391+ if (xdr_stream_encode_item_absent(xdr) < 0)
392+ return -EMSGSIZE;
393+ return 0;
392394 }
393395
394396 /* Register and XDR encode the Write list. Supports encoding a list
@@ -454,7 +456,9 @@ static int rpcrdma_encode_write_list(struct rpcrdma_xprt *r_xprt, · 59 unmodified lines
454456 *segcount = cpu_to_be32(nchunks);
455457
456458 done:
457− return xdr_stream_encode_item_absent(xdr);
459+ if (xdr_stream_encode_item_absent(xdr) < 0)
460+ return -EMSGSIZE;
461+ return 0;
458462 }
459463
460464 /* Register and XDR encode the Reply chunk. Supports encoding an array
@@ -480,8 +484,11 @@ static int rpcrdma_encode_reply_chunk(struct rpcrdma_xprt *r_xprt, · 19 unmodified lines
480484 int nsegs, nchunks;
481485 __be32 *segcount;
482486
483− if (wtype != rpcrdma_replych)
484− return xdr_stream_encode_item_absent(xdr);
487+ if (wtype != rpcrdma_replych) {
488+ if (xdr_stream_encode_item_absent(xdr) < 0)
489+ return -EMSGSIZE;
490+ return 0;
491+ }
485492
486493 seg = req->rl_segments;
487494 nsegs = rpcrdma_convert_iovs(r_xprt, &rqst->rq_rcv_buf, 0, wtype, seg);
net/sunrpc/xprtrdma/verbs.c+2−1
@@ -289,6 +289,7 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) · 288 unmodified lines
289289 case RDMA_CM_EVENT_DISCONNECTED:
290290 ep->re_connect_status = -ECONNABORTED;
291291 disconnected:
292+ xprt_force_disconnect(xprt);
292293 return rpcrdma_ep_destroy(ep);
293294 default:
294295 break;
@@ -1355,8 +1356,8 @@ int rpcrdma_post_sends(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) · 1060 unmodified lines
13551356 --ep->re_send_count;
13561357 }
13571358
1359+ trace_xprtrdma_post_send(req);
13581360 rc = frwr_send(r_xprt, req);
1359− trace_xprtrdma_post_send(req, rc);
13601361 if (rc)
13611362 return -ENOTCONN;
13621363 return 0;
net/tipc/topsrv.c+3−2
@@ -402,10 +402,11 @@ static int tipc_conn_rcv_from_sock(struct tipc_conn *con) · 401 unmodified lines
402402 read_lock_bh(&sk->sk_callback_lock);
403403 ret = tipc_conn_rcv_sub(srv, con, &s);
404404 read_unlock_bh(&sk->sk_callback_lock);
405+ if (!ret)
406+ return 0;
405407 }
406− if (ret < 0)
407− tipc_conn_close(con);
408408
409+ tipc_conn_close(con);
409410 return ret;
410411 }
411412
net/tls/tls_sw.c+5−2
@@ -800,6 +800,8 @@ static int bpf_exec_tx_verdict(struct sk_msg *msg, struct sock *sk, · 799 unmodified lines
800800 *copied -= sk_msg_free(sk, msg);
801801 tls_free_open_rec(sk);
802802 }
803+ if (psock)
804+ sk_psock_put(sk, psock);
803805 return err;
804806 }
805807 more_data:
@@ -2081,8 +2083,9 @@ static void tls_data_ready(struct sock *sk) · 1275 unmodified lines
20812083 strp_data_ready(&ctx->strp);
20822084
20832085 psock = sk_psock_get(sk);
2084− if (psock && !list_empty(&psock->ingress_msg)) {
2085− ctx->saved_data_ready(sk);
2086+ if (psock) {
2087+ if (!list_empty(&psock->ingress_msg))
2088+ ctx->saved_data_ready(sk);
20862089 sk_psock_put(sk, psock);
20872090 }
20882091 }
net/vmw_vsock/virtio_transport_common.c+4−0
@@ -157,7 +157,11 @@ static struct sk_buff *virtio_transport_build_skb(void *opaque) · 156 unmodified lines
157157
158158 void virtio_transport_deliver_tap_pkt(struct virtio_vsock_pkt *pkt)
159159 {
160+ if (pkt->tap_delivered)
161+ return;
162+
160163 vsock_deliver_tap(virtio_transport_build_skb, pkt);
164+ pkt->tap_delivered = true;
161165 }
162166 EXPORT_SYMBOL_GPL(virtio_transport_deliver_tap_pkt);
163167
net/x25/x25_subr.c+6−0
@@ -357,6 +357,12 @@ void x25_disconnect(struct sock *sk, int reason, unsigned char cause, · 356 unmodified lines
357357 sk->sk_state_change(sk);
358358 sock_set_flag(sk, SOCK_DEAD);
359359 }
360+ if (x25->neighbour) {
361+ read_lock_bh(&x25_list_lock);
362+ x25_neigh_put(x25->neighbour);
363+ x25->neighbour = NULL;
364+ read_unlock_bh(&x25_list_lock);
365+ }
360366 }
361367
362368 /*
samples/trace_events/trace-events-sample.h+1−1
@@ -416,7 +416,7 @@ TRACE_EVENT_FN(foo_bar_with_fn, · 415 unmodified lines
416416 * Note, TRACE_EVENT() itself is simply defined as:
417417 *
418418 * #define TRACE_EVENT(name, proto, args, tstruct, assign, printk) \
419− * DEFINE_EVENT_CLASS(name, proto, args, tstruct, assign, printk); \
419+ * DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, printk); \
420420 * DEFINE_EVENT(name, name, proto, args)
421421 *
422422 * The DEFINE_EVENT() also can be declared with conditions and reg functions:
scripts/decodecode+1−1
@@ -126,7 +126,7 @@ faultlinenum=$(( $(wc -l $T.oo | cut -d" " -f1) - \ · 125 unmodified lines
126126 faultline=`cat $T.dis | head -1 | cut -d":" -f2-`
127127 faultline=`echo "$faultline" | sed -e 's/\[/\\\[/g; s/\]/\\\]/g'`
128128
129−cat $T.oo | sed -e "${faultlinenum}s/^\(.*:\)\(.*\)/\1\*\2\t\t<-- trapping instruction/"
129+cat $T.oo | sed -e "${faultlinenum}s/^\([^:]*:\)\(.*\)/\1\*\2\t\t<-- trapping instruction/"
130130 echo
131131 cat $T.aa
132132 cleanup
scripts/gcc-plugins/Makefile+1−0
@@ -4,6 +4,7 @@ GCC_PLUGINS_DIR := $(shell $(CC) -print-file-name=plugin) · 3 unmodified lines
44 HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti
55 HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb
66 HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable -Wno-c++11-compat
7+HOST_EXTRACXXFLAGS += -Wno-format-diag
78
89 $(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h
910 quiet_cmd_create_randomize_layout_seed = GENSEED $@
scripts/gcc-plugins/gcc-common.h+4−0
@@ -35,7 +35,9 @@ · 34 unmodified lines
3535 #include "ggc.h"
3636 #include "timevar.h"
3737
38+#if BUILDING_GCC_VERSION < 10000
3839 #include "params.h"
40+#endif
3941
4042 #if BUILDING_GCC_VERSION <= 4009
4143 #include "pointer-set.h"
@@ -847,6 +849,7 @@ static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree l · 805 unmodified lines
847849 return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT);
848850 }
849851
852+#if BUILDING_GCC_VERSION < 10000
850853 template <>
851854 template <>
852855 inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
@@ -860,6 +863,7 @@ inline bool is_a_helper<const greturn *>::test(const_gimple gs) · 7 unmodified lines
860863 {
861864 return gs->code == GIMPLE_RETURN;
862865 }
866+#endif
863867
864868 static inline gasm *as_a_gasm(gimple stmt)
865869 {
scripts/gcc-plugins/stackleak_plugin.c+2−3
@@ -51,7 +51,6 @@ static void stackleak_add_track_stack(gimple_stmt_iterator *gsi, bool after) · 50 unmodified lines
5151 gimple stmt;
5252 gcall *stackleak_track_stack;
5353 cgraph_node_ptr node;
54− int frequency;
5554 basic_block bb;
5655
5756 /* Insert call to void stackleak_track_stack(void) */
@@ -68,9 +67,9 @@ static void stackleak_add_track_stack(gimple_stmt_iterator *gsi, bool after) · 10 unmodified lines
6867 bb = gimple_bb(stackleak_track_stack);
6968 node = cgraph_get_create_node(track_function_decl);
7069 gcc_assert(node);
71− frequency = compute_call_stmt_bb_frequency(current_function_decl, bb);
7270 cgraph_create_edge(cgraph_get_node(current_function_decl), node,
73− stackleak_track_stack, bb->count, frequency);
71+ stackleak_track_stack, bb->count,
72+ compute_call_stmt_bb_frequency(current_function_decl, bb));
7473 }
7574
7675 static bool is_alloca(gimple stmt)
scripts/gdb/linux/rbtree.py+2−2
@@ -12,7 +12,7 @@ rb_node_type = utils.CachedType("struct rb_node") · 11 unmodified lines
1212
1313 def rb_first(root):
1414 if root.type == rb_root_type.get_type():
15− node = node.address.cast(rb_root_type.get_type().pointer())
15+ node = root.address.cast(rb_root_type.get_type().pointer())
1616 elif root.type != rb_root_type.get_type().pointer():
1717 raise gdb.GdbError("Must be struct rb_root not {}".format(root.type))
1818
@@ -28,7 +28,7 @@ def rb_first(root): · 9 unmodified lines
2828
2929 def rb_last(root):
3030 if root.type == rb_root_type.get_type():
31− node = node.address.cast(rb_root_type.get_type().pointer())
31+ node = root.address.cast(rb_root_type.get_type().pointer())
3232 elif root.type != rb_root_type.get_type().pointer():
3333 raise gdb.GdbError("Must be struct rb_root not {}".format(root.type))
3434
scripts/kallsyms.c+1−1
@@ -34,7 +34,7 @@ struct sym_entry { · 33 unmodified lines
3434 unsigned int len;
3535 unsigned int start_pos;
3636 unsigned int percpu_absolute;
37− unsigned char sym[0];
37+ unsigned char sym[];
3838 };
3939
4040 struct addr_range {
security/selinux/hooks.c+45−25
@@ -5842,40 +5842,60 @@ static unsigned int selinux_ipv6_postroute(void *priv, · 5841 unmodified lines
58425842
58435843 static int selinux_netlink_send(struct sock *sk, struct sk_buff *skb)
58445844 {
5845− int err = 0;
5846− u32 perm;
5845+ int rc = 0;
5846+ unsigned int msg_len;
5847+ unsigned int data_len = skb->len;
5848+ unsigned char *data = skb->data;
58475849 struct nlmsghdr *nlh;
58485850 struct sk_security_struct *sksec = sk->sk_security;
5851+ u16 sclass = sksec->sclass;
5852+ u32 perm;
58495853
5850− if (skb->len < NLMSG_HDRLEN) {
5851− err = -EINVAL;
5852− goto out;
5853− }
5854− nlh = nlmsg_hdr(skb);
5854+ while (data_len >= nlmsg_total_size(0)) {
5855+ nlh = (struct nlmsghdr *)data;
5856+
5857+ /* NOTE: the nlmsg_len field isn't reliably set by some netlink
5858+ * users which means we can't reject skb's with bogus
5859+ * length fields; our solution is to follow what
5860+ * netlink_rcv_skb() does and simply skip processing at
5861+ * messages with length fields that are clearly junk
5862+ */
5863+ if (nlh->nlmsg_len < NLMSG_HDRLEN || nlh->nlmsg_len > data_len)
5864+ return 0;
58555865
5856− err = selinux_nlmsg_lookup(sksec->sclass, nlh->nlmsg_type, &perm);
5857− if (err) {
5858− if (err == -EINVAL) {
5866+ rc = selinux_nlmsg_lookup(sclass, nlh->nlmsg_type, &perm);
5867+ if (rc == 0) {
5868+ rc = sock_has_perm(sk, perm);
5869+ if (rc)
5870+ return rc;
5871+ } else if (rc == -EINVAL) {
5872+ /* -EINVAL is a missing msg/perm mapping */
58595873 pr_warn_ratelimited("SELinux: unrecognized netlink"
5860− " message: protocol=%hu nlmsg_type=%hu sclass=%s"
5861− " pid=%d comm=%s\n",
5862− sk->sk_protocol, nlh->nlmsg_type,
5863− secclass_map[sksec->sclass - 1].name,
5864− task_pid_nr(current), current->comm);
5865− if (!enforcing_enabled(&selinux_state) ||
5866− security_get_allow_unknown(&selinux_state))
5867− err = 0;
5874+ " message: protocol=%hu nlmsg_type=%hu sclass=%s"
5875+ " pid=%d comm=%s\n",
5876+ sk->sk_protocol, nlh->nlmsg_type,
5877+ secclass_map[sclass - 1].name,
5878+ task_pid_nr(current), current->comm);
5879+ if (enforcing_enabled(&selinux_state) &&
5880+ !security_get_allow_unknown(&selinux_state))
5881+ return rc;
5882+ rc = 0;
5883+ } else if (rc == -ENOENT) {
5884+ /* -ENOENT is a missing socket/class mapping, ignore */
5885+ rc = 0;
5886+ } else {
5887+ return rc;
58685888 }
58695889
5870− /* Ignore */
5871− if (err == -ENOENT)
5872− err = 0;
5873− goto out;
5890+ /* move to the next message after applying netlink padding */
5891+ msg_len = NLMSG_ALIGN(nlh->nlmsg_len);
5892+ if (msg_len >= data_len)
5893+ return 0;
5894+ data_len -= msg_len;
5895+ data += msg_len;
58745896 }
58755897
5876− err = sock_has_perm(sk, perm);
5877−out:
5878− return err;
5898+ return rc;
58795899 }
58805900
58815901 static void ipc_init_security(struct ipc_security_struct *isec, u16 sclass)
security/selinux/ss/conditional.c+1−1
@@ -429,7 +429,7 @@ int cond_read_list(struct policydb *p, void *fp) · 428 unmodified lines
429429
430430 p->cond_list = kcalloc(len, sizeof(*p->cond_list), GFP_KERNEL);
431431 if (!p->cond_list)
432− return rc;
432+ return -ENOMEM;
433433
434434 rc = avtab_alloc(&(p->te_cond_avtab), p->te_avtab.nel);
435435 if (rc)
sound/core/oss/pcm_plugin.c+6−4
@@ -205,13 +205,14 @@ static snd_pcm_sframes_t calc_dst_frames(struct snd_pcm_substream *plug, · 204 unmodified lines
205205 plugin = snd_pcm_plug_first(plug);
206206 while (plugin && frames > 0) {
207207 plugin_next = plugin->next;
208+ if (check_size && plugin->buf_frames &&
209+ frames > plugin->buf_frames)
210+ frames = plugin->buf_frames;
208211 if (plugin->dst_frames) {
209212 frames = plugin->dst_frames(plugin, frames);
210213 if (frames < 0)
211214 return frames;
212215 }
213− if (check_size && frames > plugin->buf_frames)
214− frames = plugin->buf_frames;
215216 plugin = plugin_next;
216217 }
217218 return frames;
@@ -225,14 +226,15 @@ static snd_pcm_sframes_t calc_src_frames(struct snd_pcm_substream *plug, · 7 unmodified lines
225226
226227 plugin = snd_pcm_plug_last(plug);
227228 while (plugin && frames > 0) {
228− if (check_size && frames > plugin->buf_frames)
229− frames = plugin->buf_frames;
230229 plugin_prev = plugin->prev;
231230 if (plugin->src_frames) {
232231 frames = plugin->src_frames(plugin, frames);
233232 if (frames < 0)
234233 return frames;
235234 }
235+ if (check_size && plugin->buf_frames &&
236+ frames > plugin->buf_frames)
237+ frames = plugin->buf_frames;
236238 plugin = plugin_prev;
237239 }
238240 return frames;
sound/isa/opti9xx/miro.c+6−3
@@ -867,10 +867,13 @@ static void snd_miro_write(struct snd_miro *chip, unsigned char reg, · 866 unmodified lines
867867 spin_unlock_irqrestore(&chip->lock, flags);
868868 }
869869
870+static inline void snd_miro_write_mask(struct snd_miro *chip,
871+ unsigned char reg, unsigned char value, unsigned char mask)
872+{
873+ unsigned char oldval = snd_miro_read(chip, reg);
870874
871−#define snd_miro_write_mask(chip, reg, value, mask) \
872− snd_miro_write(chip, reg, \
873− (snd_miro_read(chip, reg) & ~(mask)) | ((value) & (mask)))
875+ snd_miro_write(chip, reg, (oldval & ~mask) | (value & mask));
876+}
874877
875878 /*
876879 * Proc Interface
sound/isa/opti9xx/opti92x-ad1848.c+6−3
@@ -317,10 +317,13 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, · 316 unmodified lines
317317 }
318318
319319
320−#define snd_opti9xx_write_mask(chip, reg, value, mask) \
321− snd_opti9xx_write(chip, reg, \
322− (snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask)))
320+static inline void snd_opti9xx_write_mask(struct snd_opti9xx *chip,
321+ unsigned char reg, unsigned char value, unsigned char mask)
322+{
323+ unsigned char oldval = snd_opti9xx_read(chip, reg);
323324
325+ snd_opti9xx_write(chip, reg, (oldval & ~mask) | (value & mask));
326+}
324327
325328 static int snd_opti9xx_configure(struct snd_opti9xx *chip,
326329 long port,
sound/pci/hda/hda_intel.c+5−4
@@ -2078,9 +2078,10 @@ static void pcm_mmap_prepare(struct snd_pcm_substream *substream, · 2077 unmodified lines
20782078 * some HD-audio PCI entries are exposed without any codecs, and such devices
20792079 * should be ignored from the beginning.
20802080 */
2081−static const struct snd_pci_quirk driver_blacklist[] = {
2082− SND_PCI_QUIRK(0x1462, 0xcb59, "MSI TRX40 Creator", 0),
2083− SND_PCI_QUIRK(0x1462, 0xcb60, "MSI TRX40", 0),
2081+static const struct pci_device_id driver_blacklist[] = {
2082+ { PCI_DEVICE_SUB(0x1022, 0x1487, 0x1043, 0x874f) }, /* ASUS ROG Zenith II / Strix */
2083+ { PCI_DEVICE_SUB(0x1022, 0x1487, 0x1462, 0xcb59) }, /* MSI TRX40 Creator */
2084+ { PCI_DEVICE_SUB(0x1022, 0x1487, 0x1462, 0xcb60) }, /* MSI TRX40 */
20842085 {}
20852086 };
20862087
@@ -2100,7 +2101,7 @@ static int azx_probe(struct pci_dev *pci, · 13 unmodified lines
21002101 bool schedule_probe;
21012102 int err;
21022103
2103− if (snd_pci_quirk_lookup(pci, driver_blacklist)) {
2104+ if (pci_match_id(driver_blacklist, pci)) {
21042105 dev_info(&pci->dev, "Skipping the blacklisted device\n");
21052106 return -ENODEV;
21062107 }
sound/pci/hda/patch_hdmi.c+5−1
@@ -1848,8 +1848,10 @@ static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) · 1847 unmodified lines
18481848 /* Add sanity check to pass klockwork check.
18491849 * This should never happen.
18501850 */
1851− if (WARN_ON(spdif == NULL))
1851+ if (WARN_ON(spdif == NULL)) {
1852+ mutex_unlock(&codec->spdif_mutex);
18521853 return true;
1854+ }
18531855 non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO);
18541856 mutex_unlock(&codec->spdif_mutex);
18551857 return non_pcm;
@@ -2198,7 +2200,9 @@ static int generic_hdmi_build_controls(struct hda_codec *codec) · 342 unmodified lines
21982200
21992201 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
22002202 struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
2203+ struct hdmi_eld *pin_eld = &per_pin->sink_eld;
22012204
2205+ pin_eld->eld_valid = false;
22022206 hdmi_present_sense(per_pin, 0);
22032207 }
22042208
sound/pci/hda/patch_realtek.c+1−0
@@ -7420,6 +7420,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 7419 unmodified lines
74207420 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
74217421 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
74227422 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
7423+ SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
74237424 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
74247425 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
74257426 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
sound/usb/line6/podhd.c+5−17
@@ -21,8 +21,7 @@ · 20 unmodified lines
2121 enum {
2222 LINE6_PODHD300,
2323 LINE6_PODHD400,
24− LINE6_PODHD500_0,
25− LINE6_PODHD500_1,
24+ LINE6_PODHD500,
2625 LINE6_PODX3,
2726 LINE6_PODX3LIVE,
2827 LINE6_PODHD500X,
@@ -318,8 +317,7 @@ static const struct usb_device_id podhd_id_table[] = { · 289 unmodified lines
318317 /* TODO: no need to alloc data interfaces when only audio is used */
319318 { LINE6_DEVICE(0x5057), .driver_info = LINE6_PODHD300 },
320319 { LINE6_DEVICE(0x5058), .driver_info = LINE6_PODHD400 },
321− { LINE6_IF_NUM(0x414D, 0), .driver_info = LINE6_PODHD500_0 },
322− { LINE6_IF_NUM(0x414D, 1), .driver_info = LINE6_PODHD500_1 },
320+ { LINE6_IF_NUM(0x414D, 0), .driver_info = LINE6_PODHD500 },
323321 { LINE6_IF_NUM(0x414A, 0), .driver_info = LINE6_PODX3 },
324322 { LINE6_IF_NUM(0x414B, 0), .driver_info = LINE6_PODX3LIVE },
325323 { LINE6_IF_NUM(0x4159, 0), .driver_info = LINE6_PODHD500X },
@@ -352,23 +350,13 @@ static const struct line6_properties podhd_properties_table[] = { · 26 unmodified lines
352350 .ep_audio_r = 0x82,
353351 .ep_audio_w = 0x01,
354352 },
355− [LINE6_PODHD500_0] = {
353+ [LINE6_PODHD500] = {
356354 .id = "PODHD500",
357355 .name = "POD HD500",
358− .capabilities = LINE6_CAP_PCM
356+ .capabilities = LINE6_CAP_PCM | LINE6_CAP_CONTROL
359357 | LINE6_CAP_HWMON,
360358 .altsetting = 1,
361− .ep_ctrl_r = 0x81,
362− .ep_ctrl_w = 0x01,
363− .ep_audio_r = 0x86,
364− .ep_audio_w = 0x02,
365− },
366− [LINE6_PODHD500_1] = {
367− .id = "PODHD500",
368− .name = "POD HD500",
369− .capabilities = LINE6_CAP_PCM
370− | LINE6_CAP_HWMON,
371− .altsetting = 0,
359+ .ctrl_if = 1,
372360 .ep_ctrl_r = 0x81,
373361 .ep_ctrl_w = 0x01,
374362 .ep_audio_r = 0x86,
sound/usb/quirks.c+1−1
@@ -1687,7 +1687,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, · 1686 unmodified lines
16871687
16881688 case USB_ID(0x0d8c, 0x0316): /* Hegel HD12 DSD */
16891689 case USB_ID(0x10cb, 0x0103): /* The Bit Opus #3; with fp->dsd_raw */
1690− case USB_ID(0x16b0, 0x06b2): /* NuPrime DAC-10 */
1690+ case USB_ID(0x16d0, 0x06b2): /* NuPrime DAC-10 */
16911691 case USB_ID(0x16d0, 0x09dd): /* Encore mDSD */
16921692 case USB_ID(0x16d0, 0x0733): /* Furutech ADL Stratos */
16931693 case USB_ID(0x16d0, 0x09db): /* NuPrime Audio DAC-9 */
tools/bootconfig/main.c+6−3
@@ -314,6 +314,7 @@ int apply_xbc(const char *path, const char *xbc_path) · 313 unmodified lines
314314 ret = delete_xbc(path);
315315 if (ret < 0) {
316316 pr_err("Failed to delete previous boot config: %d\n", ret);
317+ free(data);
317318 return ret;
318319 }
319320
@@ -321,24 +322,26 @@ int apply_xbc(const char *path, const char *xbc_path) · 1 unmodified line
321322 fd = open(path, O_RDWR | O_APPEND);
322323 if (fd < 0) {
323324 pr_err("Failed to open %s: %d\n", path, fd);
325+ free(data);
324326 return fd;
325327 }
326328 /* TODO: Ensure the @path is initramfs/initrd image */
327329 ret = write(fd, data, size + 8);
328330 if (ret < 0) {
329331 pr_err("Failed to apply a boot config: %d\n", ret);
330− return ret;
332+ goto out;
331333 }
332334 /* Write a magic word of the bootconfig */
333335 ret = write(fd, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN);
334336 if (ret < 0) {
335337 pr_err("Failed to apply a boot config magic: %d\n", ret);
336− return ret;
338+ goto out;
337339 }
340+out:
338341 close(fd);
339342 free(data);
340343
341− return 0;
344+ return ret;
342345 }
343346
344347 int usage(void)
tools/cgroup/iocost_monitor.py+6−1
@@ -159,7 +159,12 @@ class IocgStat: · 158 unmodified lines
159159 else:
160160 self.inflight_pct = 0
161161
162− self.debt_ms = iocg.abs_vdebt.counter.value_() / VTIME_PER_USEC / 1000
162+ # vdebt used to be an atomic64_t and is now u64, support both
163+ try:
164+ self.debt_ms = iocg.abs_vdebt.counter.value_() / VTIME_PER_USEC / 1000
165+ except:
166+ self.debt_ms = iocg.abs_vdebt.value_() / VTIME_PER_USEC / 1000
167+
163168 self.use_delay = blkg.use_delay.counter.value_()
164169 self.delay_ms = blkg.delay_nsec.counter.value_() / 1_000_000
165170
tools/objtool/check.c+14−3
@@ -72,6 +72,17 @@ static struct instruction *next_insn_same_func(struct objtool_file *file, · 71 unmodified lines
7272 return find_insn(file, func->cfunc->sec, func->cfunc->offset);
7373 }
7474
75+static struct instruction *prev_insn_same_sym(struct objtool_file *file,
76+ struct instruction *insn)
77+{
78+ struct instruction *prev = list_prev_entry(insn, list);
79+
80+ if (&prev->list != &file->insn_list && prev->func == insn->func)
81+ return prev;
82+
83+ return NULL;
84+}
85+
7586 #define func_for_each_insn(file, func, insn) \
7687 for (insn = find_insn(file, func->sec, func->offset); \
7788 insn; \
@@ -1050,8 +1061,8 @@ static struct rela *find_jump_table(struct objtool_file *file, · 972 unmodified lines
10501061 * it.
10511062 */
10521063 for (;
1053− &insn->list != &file->insn_list && insn->func && insn->func->pfunc == func;
1054− insn = insn->first_jump_src ?: list_prev_entry(insn, list)) {
1064+ insn && insn->func && insn->func->pfunc == func;
1065+ insn = insn->first_jump_src ?: prev_insn_same_sym(file, insn)) {
10551066
10561067 if (insn != orig_insn && insn->type == INSN_JUMP_DYNAMIC)
10571068 break;
@@ -1449,7 +1460,7 @@ static int update_insn_state_regs(struct instruction *insn, struct insn_state *s · 391 unmodified lines
14491460 struct cfi_reg *cfa = &state->cfa;
14501461 struct stack_op *op = &insn->stack_op;
14511462
1452− if (cfa->base != CFI_SP)
1463+ if (cfa->base != CFI_SP && cfa->base != CFI_SP_INDIRECT)
14531464 return 0;
14541465
14551466 /* push */
tools/objtool/elf.h+4−3
@@ -87,9 +87,10 @@ struct elf { · 86 unmodified lines
8787 #define OFFSET_STRIDE (1UL << OFFSET_STRIDE_BITS)
8888 #define OFFSET_STRIDE_MASK (~(OFFSET_STRIDE - 1))
8989
90−#define for_offset_range(_offset, _start, _end) \
91− for (_offset = ((_start) & OFFSET_STRIDE_MASK); \
92− _offset <= ((_end) & OFFSET_STRIDE_MASK); \
90+#define for_offset_range(_offset, _start, _end) \
91+ for (_offset = ((_start) & OFFSET_STRIDE_MASK); \
92+ _offset >= ((_start) & OFFSET_STRIDE_MASK) && \
93+ _offset <= ((_end) & OFFSET_STRIDE_MASK); \
9394 _offset += OFFSET_STRIDE)
9495
9596 static inline u32 sec_offset_hash(struct section *sec, unsigned long offset)
tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c+146−0
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 #define _GNU_SOURCE
44 #include <poll.h>
55 #include <unistd.h>
6+#include <assert.h>
67 #include <signal.h>
78 #include <pthread.h>
89 #include <sys/epoll.h>
@@ -3136,4 +3137,149 @@ TEST(epoll59) · 3127 unmodified lines
31363137 close(ctx.sfd[0]);
31373138 }
31383139
3140+enum {
3141+ EPOLL60_EVENTS_NR = 10,
3142+};
3143+
3144+struct epoll60_ctx {
3145+ volatile int stopped;
3146+ int ready;
3147+ int waiters;
3148+ int epfd;
3149+ int evfd[EPOLL60_EVENTS_NR];
3150+};
3151+
3152+static void *epoll60_wait_thread(void *ctx_)
3153+{
3154+ struct epoll60_ctx *ctx = ctx_;
3155+ struct epoll_event e;
3156+ sigset_t sigmask;
3157+ uint64_t v;
3158+ int ret;
3159+
3160+ /* Block SIGUSR1 */
3161+ sigemptyset(&sigmask);
3162+ sigaddset(&sigmask, SIGUSR1);
3163+ sigprocmask(SIG_SETMASK, &sigmask, NULL);
3164+
3165+ /* Prepare empty mask for epoll_pwait() */
3166+ sigemptyset(&sigmask);
3167+
3168+ while (!ctx->stopped) {
3169+ /* Mark we are ready */
3170+ __atomic_fetch_add(&ctx->ready, 1, __ATOMIC_ACQUIRE);
3171+
3172+ /* Start when all are ready */
3173+ while (__atomic_load_n(&ctx->ready, __ATOMIC_ACQUIRE) &&
3174+ !ctx->stopped);
3175+
3176+ /* Account this waiter */
3177+ __atomic_fetch_add(&ctx->waiters, 1, __ATOMIC_ACQUIRE);
3178+
3179+ ret = epoll_pwait(ctx->epfd, &e, 1, 2000, &sigmask);
3180+ if (ret != 1) {
3181+ /* We expect only signal delivery on stop */
3182+ assert(ret < 0 && errno == EINTR && "Lost wakeup!\n");
3183+ assert(ctx->stopped);
3184+ break;
3185+ }
3186+
3187+ ret = read(e.data.fd, &v, sizeof(v));
3188+ /* Since we are on ET mode, thus each thread gets its own fd. */
3189+ assert(ret == sizeof(v));
3190+
3191+ __atomic_fetch_sub(&ctx->waiters, 1, __ATOMIC_RELEASE);
3192+ }
3193+
3194+ return NULL;
3195+}
3196+
3197+static inline unsigned long long msecs(void)
3198+{
3199+ struct timespec ts;
3200+ unsigned long long msecs;
3201+
3202+ clock_gettime(CLOCK_REALTIME, &ts);
3203+ msecs = ts.tv_sec * 1000ull;
3204+ msecs += ts.tv_nsec / 1000000ull;
3205+
3206+ return msecs;
3207+}
3208+
3209+static inline int count_waiters(struct epoll60_ctx *ctx)
3210+{
3211+ return __atomic_load_n(&ctx->waiters, __ATOMIC_ACQUIRE);
3212+}
3213+
3214+TEST(epoll60)
3215+{
3216+ struct epoll60_ctx ctx = { 0 };
3217+ pthread_t waiters[ARRAY_SIZE(ctx.evfd)];
3218+ struct epoll_event e;
3219+ int i, n, ret;
3220+
3221+ signal(SIGUSR1, signal_handler);
3222+
3223+ ctx.epfd = epoll_create1(0);
3224+ ASSERT_GE(ctx.epfd, 0);
3225+
3226+ /* Create event fds */
3227+ for (i = 0; i < ARRAY_SIZE(ctx.evfd); i++) {
3228+ ctx.evfd[i] = eventfd(0, EFD_NONBLOCK);
3229+ ASSERT_GE(ctx.evfd[i], 0);
3230+
3231+ e.events = EPOLLIN | EPOLLET;
3232+ e.data.fd = ctx.evfd[i];
3233+ ASSERT_EQ(epoll_ctl(ctx.epfd, EPOLL_CTL_ADD, ctx.evfd[i], &e), 0);
3234+ }
3235+
3236+ /* Create waiter threads */
3237+ for (i = 0; i < ARRAY_SIZE(waiters); i++)
3238+ ASSERT_EQ(pthread_create(&waiters[i], NULL,
3239+ epoll60_wait_thread, &ctx), 0);
3240+
3241+ for (i = 0; i < 300; i++) {
3242+ uint64_t v = 1, ms;
3243+
3244+ /* Wait for all to be ready */
3245+ while (__atomic_load_n(&ctx.ready, __ATOMIC_ACQUIRE) !=
3246+ ARRAY_SIZE(ctx.evfd))
3247+ ;
3248+
3249+ /* Steady, go */
3250+ __atomic_fetch_sub(&ctx.ready, ARRAY_SIZE(ctx.evfd),
3251+ __ATOMIC_ACQUIRE);
3252+
3253+ /* Wait all have gone to kernel */
3254+ while (count_waiters(&ctx) != ARRAY_SIZE(ctx.evfd))
3255+ ;
3256+
3257+ /* 1ms should be enough to schedule away */
3258+ usleep(1000);
3259+
3260+ /* Quickly signal all handles at once */
3261+ for (n = 0; n < ARRAY_SIZE(ctx.evfd); n++) {
3262+ ret = write(ctx.evfd[n], &v, sizeof(v));
3263+ ASSERT_EQ(ret, sizeof(v));
3264+ }
3265+
3266+ /* Busy loop for 1s and wait for all waiters to wake up */
3267+ ms = msecs();
3268+ while (count_waiters(&ctx) && msecs() < ms + 1000)
3269+ ;
3270+
3271+ ASSERT_EQ(count_waiters(&ctx), 0);
3272+ }
3273+ ctx.stopped = 1;
3274+ /* Stop waiters */
3275+ for (i = 0; i < ARRAY_SIZE(waiters); i++)
3276+ ret = pthread_kill(waiters[i], SIGUSR1);
3277+ for (i = 0; i < ARRAY_SIZE(waiters); i++)
3278+ pthread_join(waiters[i], NULL);
3279+
3280+ for (i = 0; i < ARRAY_SIZE(waiters); i++)
3281+ close(ctx.evfd[i]);
3282+ close(ctx.epfd);
3283+}
3284+
31393285 TEST_HARNESS_MAIN
tools/testing/selftests/ftrace/ftracetest+30−2
@@ -17,6 +17,7 @@ echo " -v|--verbose Increase verbosity of test messages" · 16 unmodified lines
1717 echo " -vv Alias of -v -v (Show all results in stdout)"
1818 echo " -vvv Alias of -v -v -v (Show all commands immediately)"
1919 echo " --fail-unsupported Treat UNSUPPORTED as a failure"
20+echo " --fail-unresolved Treat UNRESOLVED as a failure"
2021 echo " -d|--debug Debug mode (trace all shell commands)"
2122 echo " -l|--logdir <dir> Save logs on the <dir>"
2223 echo " If <dir> is -, all logs output in console only"
@@ -29,8 +30,25 @@ err_ret=1 · 6 unmodified lines
2930 # kselftest skip code is 4
3031 err_skip=4
3132
33+# cgroup RT scheduling prevents chrt commands from succeeding, which
34+# induces failures in test wakeup tests. Disable for the duration of
35+# the tests.
36+
37+readonly sched_rt_runtime=/proc/sys/kernel/sched_rt_runtime_us
38+
39+sched_rt_runtime_orig=$(cat $sched_rt_runtime)
40+
41+setup() {
42+ echo -1 > $sched_rt_runtime
43+}
44+
45+cleanup() {
46+ echo $sched_rt_runtime_orig > $sched_rt_runtime
47+}
48+
3249 errexit() { # message
3350 echo "Error: $1" 1>&2
51+ cleanup
3452 exit $err_ret
3553 }
3654
@@ -39,6 +57,8 @@ if [ `id -u` -ne 0 ]; then · 2 unmodified lines
3957 errexit "this must be run by root user"
4058 fi
4159
60+setup
61+
4262 # Utilities
4363 absdir() { # file_path
4464 (cd `dirname $1`; pwd)
@@ -93,6 +113,10 @@ parse_opts() { # opts · 48 unmodified lines
93113 UNSUPPORTED_RESULT=1
94114 shift 1
95115 ;;
116+ --fail-unresolved)
117+ UNRESOLVED_RESULT=1
118+ shift 1
119+ ;;
96120 --logdir|-l)
97121 LOG_DIR=$2
98122 shift 2
@@ -157,6 +181,7 @@ KEEP_LOG=0 · 58 unmodified lines
157181 DEBUG=0
158182 VERBOSE=0
159183 UNSUPPORTED_RESULT=0
184+UNRESOLVED_RESULT=0
160185 STOP_FAILURE=0
161186 # Parse command-line options
162187 parse_opts $*
@@ -235,6 +260,7 @@ TOTAL_RESULT=0 · 72 unmodified lines
235260
236261 INSTANCE=
237262 CASENO=0
263+
238264 testcase() { # testfile
239265 CASENO=$((CASENO+1))
240266 desc=`grep "^#[ \t]*description:" $1 | cut -f2 -d:`
@@ -260,7 +286,7 @@ eval_result() { # sigval · 19 unmodified lines
260286 $UNRESOLVED)
261287 prlog " [${color_blue}UNRESOLVED${color_reset}]"
262288 UNRESOLVED_CASES="$UNRESOLVED_CASES $CASENO"
263− return 1 # this is a kind of bug.. something happened.
289+ return $UNRESOLVED_RESULT # depends on use case
264290 ;;
265291 $UNTESTED)
266292 prlog " [${color_blue}UNTESTED${color_reset}]"
@@ -273,7 +299,7 @@ eval_result() { # sigval · 6 unmodified lines
273299 return $UNSUPPORTED_RESULT # depends on use case
274300 ;;
275301 $XFAIL)
276− prlog " [${color_red}XFAIL${color_reset}]"
302+ prlog " [${color_green}XFAIL${color_reset}]"
277303 XFAILED_CASES="$XFAILED_CASES $CASENO"
278304 return 0
279305 ;;
@@ -406,5 +432,7 @@ prlog "# of unsupported: " `echo $UNSUPPORTED_CASES | wc -w` · 126 unmodified lines
406432 prlog "# of xfailed: " `echo $XFAILED_CASES | wc -w`
407433 prlog "# of undefined(test bug): " `echo $UNDEFINED_CASES | wc -w`
408434
435+cleanup
436+
409437 # if no error, return 0
410438 exit $TOTAL_RESULT
tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc+1−4
@@ -10,10 +10,7 @@ if ! grep -q function_graph available_tracers; then · 9 unmodified lines
1010 exit_unsupported
1111 fi
1212
13−if [ ! -f set_ftrace_filter ]; then
14− echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
15− exit_unsupported
16−fi
13+check_filter_file set_ftrace_filter
1714
1815 do_reset() {
1916 if [ -e /proc/sys/kernel/stack_tracer_enabled ]; then
tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter.tc+2−0
@@ -9,6 +9,8 @@ if ! grep -q function_graph available_tracers; then · 8 unmodified lines
99 exit_unsupported
1010 fi
1111
12+check_filter_file set_ftrace_filter
13+
1214 fail() { # msg
1315 echo $1
1416 exit_fail
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc+2−0
@@ -9,6 +9,8 @@ if ! grep -q function available_tracers; then · 8 unmodified lines
99 exit_unsupported
1010 fi
1111
12+check_filter_file set_ftrace_filter
13+
1214 disable_tracing
1315 clear_trace
1416
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-notrace-pid.tc+1−4
@@ -15,10 +15,7 @@ if [ ! -f set_ftrace_notrace_pid ]; then · 14 unmodified lines
1515 exit_unsupported
1616 fi
1717
18−if [ ! -f set_ftrace_filter ]; then
19− echo "set_ftrace_filter not found? Is function tracer not set?"
20− exit_unsupported
21−fi
18+check_filter_file set_ftrace_filter
2219
2320 do_function_fork=1
2421
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc+1−4
@@ -16,10 +16,7 @@ if [ ! -f set_ftrace_pid ]; then · 15 unmodified lines
1616 exit_unsupported
1717 fi
1818
19−if [ ! -f set_ftrace_filter ]; then
20− echo "set_ftrace_filter not found? Is function tracer not set?"
21− exit_unsupported
22−fi
19+check_filter_file set_ftrace_filter
2320
2421 do_function_fork=1
2522
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-stacktrace.tc+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 # description: ftrace - stacktrace filter command
44 # flags: instance
55
6−[ ! -f set_ftrace_filter ] && exit_unsupported
6+check_filter_file set_ftrace_filter
77
88 echo _do_fork:stacktrace >> set_ftrace_filter
99
tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc+1−4
@@ -11,10 +11,7 @@ · 10 unmodified lines
1111 #
1212
1313 # The triggers are set within the set_ftrace_filter file
14−if [ ! -f set_ftrace_filter ]; then
15− echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
16− exit_unsupported
17−fi
14+check_filter_file set_ftrace_filter
1815
1916 do_reset() {
2017 reset_ftrace_filter
tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 # SPDX-License-Identifier: GPL-2.0
33 # description: ftrace - function trace on module
44
5−[ ! -f set_ftrace_filter ] && exit_unsupported
5+check_filter_file set_ftrace_filter
66
77 : "mod: allows to filter a non exist function"
88 echo 'non_exist_func:mod:non_exist_module' > set_ftrace_filter
tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc+1−4
@@ -18,10 +18,7 @@ if ! grep -q function_graph available_tracers; then · 17 unmodified lines
1818 exit_unsupported;
1919 fi
2020
21−if [ ! -f set_ftrace_filter ]; then
22− echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
23− exit_unsupported
24−fi
21+check_filter_file set_ftrace_filter
2522
2623 if [ ! -f function_profile_enabled ]; then
2724 echo "function_profile_enabled not found, function profiling enabled?"
tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc+1−4
@@ -10,10 +10,7 @@ · 9 unmodified lines
1010 #
1111
1212 # The triggers are set within the set_ftrace_filter file
13−if [ ! -f set_ftrace_filter ]; then
14− echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
15− exit_unsupported
16−fi
13+check_filter_file set_ftrace_filter
1714
1815 fail() { # mesg
1916 echo $1
tools/testing/selftests/ftrace/test.d/ftrace/func_stack_tracer.tc+2−0
@@ -8,6 +8,8 @@ if [ ! -f stack_trace ]; then · 7 unmodified lines
88 exit_unsupported
99 fi
1010
11+check_filter_file stack_trace_filter
12+
1113 echo > stack_trace_filter
1214 echo 0 > stack_max_size
1315 echo 1 > /proc/sys/kernel/stack_tracer_enabled
tools/testing/selftests/ftrace/test.d/ftrace/func_traceonoff_triggers.tc+1−4
@@ -11,10 +11,7 @@ · 10 unmodified lines
1111 #
1212
1313 # The triggers are set within the set_ftrace_filter file
14−if [ ! -f set_ftrace_filter ]; then
15− echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
16− exit_unsupported
17−fi
14+check_filter_file set_ftrace_filter
1815
1916 fail() { # mesg
2017 echo $1
tools/testing/selftests/ftrace/test.d/functions+6−0
@@ -1,3 +1,9 @@
1+check_filter_file() { # check filter file introduced by dynamic ftrace
2+ if [ ! -f "$1" ]; then
3+ echo "$1 not found? Is dynamic ftrace not set?"
4+ exit_unsupported
5+ fi
6+}
17
28 clear_trace() { # reset trace output
39 echo > trace
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc+1−1
@@ -38,7 +38,7 @@ for width in 64 32 16 8; do · 37 unmodified lines
3838 echo 0 > events/kprobes/testprobe/enable
3939
4040 : "Confirm the arguments is recorded in given types correctly"
41− ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
41+ ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
4242 check_types $ARGS $width
4343
4444 : "Clear event for next loop"
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc+2−0
@@ -5,6 +5,8 @@ · 4 unmodified lines
55 [ -f kprobe_events ] || exit_unsupported # this is configurable
66 grep "function" available_tracers || exit_unsupported # this is configurable
77
8+check_filter_file set_ftrace_filter
9+
810 # prepare
911 echo nop > current_tracer
1012 echo _do_fork > set_ftrace_filter
tools/testing/selftests/gpio/Makefile+6−6
@@ -1,13 +1,13 @@
11 # SPDX-License-Identifier: GPL-2.0
22
3−MOUNT_CFLAGS := $(shell pkg-config --cflags mount 2>/dev/null)
4−MOUNT_LDLIBS := $(shell pkg-config --libs mount 2>/dev/null)
5−ifeq ($(MOUNT_LDLIBS),)
6−MOUNT_LDLIBS := -lmount -I/usr/include/libmount
3+VAR_CFLAGS := $(shell pkg-config --cflags mount 2>/dev/null)
4+VAR_LDLIBS := $(shell pkg-config --libs mount 2>/dev/null)
5+ifeq ($(VAR_LDLIBS),)
6+VAR_LDLIBS := -lmount -I/usr/include/libmount
77 endif
88
9−CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ $(MOUNT_CFLAGS)
10−LDLIBS += $(MOUNT_LDLIBS)
9+CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ $(VAR_CFLAGS)
10+LDLIBS += $(VAR_LDLIBS)
1111
1212 TEST_PROGS := gpio-mockup.sh
1313 TEST_FILES := gpio-mockup-sysfs.sh
tools/testing/selftests/intel_pstate/Makefile+1−1
@@ -1,6 +1,6 @@
11 # SPDX-License-Identifier: GPL-2.0
22 CFLAGS := $(CFLAGS) -Wall -D_GNU_SOURCE
3−LDLIBS := $(LDLIBS) -lm
3+LDLIBS += -lm
44
55 uname_M := $(shell uname -m 2>/dev/null || echo not)
66 ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
tools/testing/selftests/kselftest_deps.sh+272−0
@@ -0,0 +1,272 @@
1+#!/bin/bash
2+# SPDX-License-Identifier: GPL-2.0
3+# kselftest_deps.sh
4+#
5+# Checks for kselftest build dependencies on the build system.
6+# Copyright (c) 2020 Shuah Khan <skhan@linuxfoundation.org>
7+#
8+#
9+
10+usage()
11+{
12+
13+echo -e "Usage: $0 -[p] <compiler> [test_name]\n"
14+echo -e "\tkselftest_deps.sh [-p] gcc"
15+echo -e "\tkselftest_deps.sh [-p] gcc vm"
16+echo -e "\tkselftest_deps.sh [-p] aarch64-linux-gnu-gcc"
17+echo -e "\tkselftest_deps.sh [-p] aarch64-linux-gnu-gcc vm\n"
18+echo "- Should be run in selftests directory in the kernel repo."
19+echo "- Checks if Kselftests can be built/cross-built on a system."
20+echo "- Parses all test/sub-test Makefile to find library dependencies."
21+echo "- Runs compile test on a trivial C file with LDLIBS specified"
22+echo " in the test Makefiles to identify missing library dependencies."
23+echo "- Prints suggested target list for a system filtering out tests"
24+echo " failed the build dependency check from the TARGETS in Selftests"
25+echo " main Makefile when optional -p is specified."
26+echo "- Prints pass/fail dependency check for each tests/sub-test."
27+echo "- Prints pass/fail targets and libraries."
28+echo "- Default: runs dependency checks on all tests."
29+echo "- Optional test name can be specified to check dependencies for it."
30+exit 1
31+
32+}
33+
34+# Start main()
35+main()
36+{
37+
38+base_dir=`pwd`
39+# Make sure we're in the selftests top-level directory.
40+if [ $(basename "$base_dir") != "selftests" ]; then
41+ echo -e "\tPlease run $0 in"
42+ echo -e "\ttools/testing/selftests directory ..."
43+ exit 1
44+fi
45+
46+print_targets=0
47+
48+while getopts "p" arg; do
49+ case $arg in
50+ p)
51+ print_targets=1
52+ shift;;
53+ esac
54+done
55+
56+if [ $# -eq 0 ]
57+then
58+ usage
59+fi
60+
61+# Compiler
62+CC=$1
63+
64+tmp_file=$(mktemp).c
65+trap "rm -f $tmp_file.o $tmp_file $tmp_file.bin" EXIT
66+#echo $tmp_file
67+
68+pass=$(mktemp).out
69+trap "rm -f $pass" EXIT
70+#echo $pass
71+
72+fail=$(mktemp).out
73+trap "rm -f $fail" EXIT
74+#echo $fail
75+
76+# Generate tmp source fire for compile test
77+cat << "EOF" > $tmp_file
78+int main()
79+{
80+}
81+EOF
82+
83+# Save results
84+total_cnt=0
85+fail_trgts=()
86+fail_libs=()
87+fail_cnt=0
88+pass_trgts=()
89+pass_libs=()
90+pass_cnt=0
91+
92+# Get all TARGETS from selftests Makefile
93+targets=$(egrep "^TARGETS +|^TARGETS =" Makefile | cut -d "=" -f2)
94+
95+# Single test case
96+if [ $# -eq 2 ]
97+then
98+ test=$2/Makefile
99+
100+ l1_test $test
101+ l2_test $test
102+ l3_test $test
103+
104+ print_results $1 $2
105+ exit $?
106+fi
107+
108+# Level 1: LDLIBS set static.
109+#
110+# Find all LDLIBS set statically for all executables built by a Makefile
111+# and filter out VAR_LDLIBS to discard the following:
112+# gpio/Makefile:LDLIBS += $(VAR_LDLIBS)
113+# Append space at the end of the list to append more tests.
114+
115+l1_tests=$(grep -r --include=Makefile "^LDLIBS" | \
116+ grep -v "VAR_LDLIBS" | awk -F: '{print $1}')
117+
118+# Level 2: LDLIBS set dynamically.
119+#
120+# Level 2
121+# Some tests have multiple valid LDLIBS lines for individual sub-tests
122+# that need dependency checks. Find them and append them to the tests
123+# e.g: vm/Makefile:$(OUTPUT)/userfaultfd: LDLIBS += -lpthread
124+# Filter out VAR_LDLIBS to discard the following:
125+# memfd/Makefile:$(OUTPUT)/fuse_mnt: LDLIBS += $(VAR_LDLIBS)
126+# Append space at the end of the list to append more tests.
127+
128+l2_tests=$(grep -r --include=Makefile ": LDLIBS" | \
129+ grep -v "VAR_LDLIBS" | awk -F: '{print $1}')
130+
131+# Level 3
132+# gpio, memfd and others use pkg-config to find mount and fuse libs
133+# respectively and save it in VAR_LDLIBS. If pkg-config doesn't find
134+# any, VAR_LDLIBS set to default.
135+# Use the default value and filter out pkg-config for dependency check.
136+# e.g:
137+# gpio/Makefile
138+# VAR_LDLIBS := $(shell pkg-config --libs mount) 2>/dev/null)
139+# memfd/Makefile
140+# VAR_LDLIBS := $(shell pkg-config fuse --libs 2>/dev/null)
141+
142+l3_tests=$(grep -r --include=Makefile "^VAR_LDLIBS" | \
143+ grep -v "pkg-config" | awk -F: '{print $1}')
144+
145+#echo $l1_tests
146+#echo $l2_1_tests
147+#echo $l3_tests
148+
149+all_tests
150+print_results $1 $2
151+
152+exit $?
153+}
154+# end main()
155+
156+all_tests()
157+{
158+ for test in $l1_tests; do
159+ l1_test $test
160+ done
161+
162+ for test in $l2_tests; do
163+ l2_test $test
164+ done
165+
166+ for test in $l3_tests; do
167+ l3_test $test
168+ done
169+}
170+
171+# Use same parsing used for l1_tests and pick libraries this time.
172+l1_test()
173+{
174+ test_libs=$(grep --include=Makefile "^LDLIBS" $test | \
175+ grep -v "VAR_LDLIBS" | \
176+ sed -e 's/\:/ /' | \
177+ sed -e 's/+/ /' | cut -d "=" -f 2)
178+
179+ check_libs $test $test_libs
180+}
181+
182+# Use same parsing used for l2__tests and pick libraries this time.
183+l2_test()
184+{
185+ test_libs=$(grep --include=Makefile ": LDLIBS" $test | \
186+ grep -v "VAR_LDLIBS" | \
187+ sed -e 's/\:/ /' | sed -e 's/+/ /' | \
188+ cut -d "=" -f 2)
189+
190+ check_libs $test $test_libs
191+}
192+
193+l3_test()
194+{
195+ test_libs=$(grep --include=Makefile "^VAR_LDLIBS" $test | \
196+ grep -v "pkg-config" | sed -e 's/\:/ /' |
197+ sed -e 's/+/ /' | cut -d "=" -f 2)
198+
199+ check_libs $test $test_libs
200+}
201+
202+check_libs()
203+{
204+
205+if [[ ! -z "${test_libs// }" ]]
206+then
207+
208+ #echo $test_libs
209+
210+ for lib in $test_libs; do
211+
212+ let total_cnt+=1
213+ $CC -o $tmp_file.bin $lib $tmp_file > /dev/null 2>&1
214+ if [ $? -ne 0 ]; then
215+ echo "FAIL: $test dependency check: $lib" >> $fail
216+ let fail_cnt+=1
217+ fail_libs+="$lib "
218+ fail_target=$(echo "$test" | cut -d "/" -f1)
219+ fail_trgts+="$fail_target "
220+ targets=$(echo "$targets" | grep -v "$fail_target")
221+ else
222+ echo "PASS: $test dependency check passed $lib" >> $pass
223+ let pass_cnt+=1
224+ pass_libs+="$lib "
225+ pass_trgts+="$(echo "$test" | cut -d "/" -f1) "
226+ fi
227+
228+ done
229+fi
230+}
231+
232+print_results()
233+{
234+ echo -e "========================================================";
235+ echo -e "Kselftest Dependency Check for [$0 $1 $2] results..."
236+
237+ if [ $print_targets -ne 0 ]
238+ then
239+ echo -e "Suggested Selftest Targets for your configuration:"
240+ echo -e "$targets";
241+ fi
242+
243+ echo -e "========================================================";
244+ echo -e "Checked tests defining LDLIBS dependencies"
245+ echo -e "--------------------------------------------------------";
246+ echo -e "Total tests with Dependencies:"
247+ echo -e "$total_cnt Pass: $pass_cnt Fail: $fail_cnt";
248+
249+ if [ $pass_cnt -ne 0 ]; then
250+ echo -e "--------------------------------------------------------";
251+ cat $pass
252+ echo -e "--------------------------------------------------------";
253+ echo -e "Targets passed build dependency check on system:"
254+ echo -e "$(echo "$pass_trgts" | xargs -n1 | sort -u | xargs)"
255+ fi
256+
257+ if [ $fail_cnt -ne 0 ]; then
258+ echo -e "--------------------------------------------------------";
259+ cat $fail
260+ echo -e "--------------------------------------------------------";
261+ echo -e "Targets failed build dependency check on system:"
262+ echo -e "$(echo "$fail_trgts" | xargs -n1 | sort -u | xargs)"
263+ echo -e "--------------------------------------------------------";
264+ echo -e "Missing libraries system"
265+ echo -e "$(echo "$fail_libs" | xargs -n1 | sort -u | xargs)"
266+ fi
267+
268+ echo -e "--------------------------------------------------------";
269+ echo -e "========================================================";
270+}
271+
272+main "$@"
tools/testing/selftests/kvm/Makefile+28−1
@@ -5,8 +5,34 @@ all: · 4 unmodified lines
55
66 top_srcdir = ../../../..
77 KSFT_KHDR_INSTALL := 1
8+
9+# For cross-builds to work, UNAME_M has to map to ARCH and arch specific
10+# directories and targets in this Makefile. "uname -m" doesn't map to
11+# arch specific sub-directory names.
12+#
13+# UNAME_M variable to used to run the compiles pointing to the right arch
14+# directories and build the right targets for these supported architectures.
15+#
16+# TEST_GEN_PROGS and LIBKVM are set using UNAME_M variable.
17+# LINUX_TOOL_ARCH_INCLUDE is set using ARCH variable.
18+#
19+# x86_64 targets are named to include x86_64 as a suffix and directories
20+# for includes are in x86_64 sub-directory. s390x and aarch64 follow the
21+# same convention. "uname -m" doesn't result in the correct mapping for
22+# s390x and aarch64.
23+#
24+# No change necessary for x86_64
825 UNAME_M := $(shell uname -m)
926
27+# Set UNAME_M for arm64 compile/install to work
28+ifeq ($(ARCH),arm64)
29+ UNAME_M := aarch64
30+endif
31+# Set UNAME_M s390x compile/install to work
32+ifeq ($(ARCH),s390)
33+ UNAME_M := s390x
34+endif
35+
1036 LIBKVM = lib/assert.c lib/elf.c lib/io.c lib/kvm_util.c lib/sparsebit.c lib/test_util.c
1137 LIBKVM_x86_64 = lib/x86_64/processor.c lib/x86_64/vmx.c lib/x86_64/svm.c lib/x86_64/ucall.c
1238 LIBKVM_aarch64 = lib/aarch64/processor.c lib/aarch64/ucall.c
@@ -53,7 +79,7 @@ LIBKVM += $(LIBKVM_$(UNAME_M)) · 40 unmodified lines
5379 INSTALL_HDR_PATH = $(top_srcdir)/usr
5480 LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/
5581 LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include
56−LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/x86/include
82+LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include
5783 CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \
5884 -fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \
5985 -I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \
@@ -84,6 +110,7 @@ $(LIBKVM_OBJ): $(OUTPUT)/%.o: %.c · 24 unmodified lines
84110 $(OUTPUT)/libkvm.a: $(LIBKVM_OBJ)
85111 $(AR) crs $@ $^
86112
113+x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
87114 all: $(STATIC_LIBS)
88115 $(TEST_GEN_PROGS): $(STATIC_LIBS)
89116
tools/testing/selftests/kvm/include/evmcs.h+2−2
@@ -219,8 +219,8 @@ struct hv_enlightened_vmcs { · 218 unmodified lines
219219 #define HV_X64_MSR_VP_ASSIST_PAGE_ADDRESS_MASK \
220220 (~((1ull << HV_X64_MSR_VP_ASSIST_PAGE_ADDRESS_SHIFT) - 1))
221221
222−struct hv_enlightened_vmcs *current_evmcs;
223−struct hv_vp_assist_page *current_vp_assist;
222+extern struct hv_enlightened_vmcs *current_evmcs;
223+extern struct hv_vp_assist_page *current_vp_assist;
224224
225225 int vcpu_enable_evmcs(struct kvm_vm *vm, int vcpu_id);
226226
tools/testing/selftests/kvm/lib/x86_64/vmx.c+3−0
@@ -17,6 +17,9 @@ · 16 unmodified lines
1717
1818 bool enable_evmcs;
1919
20+struct hv_enlightened_vmcs *current_evmcs;
21+struct hv_vp_assist_page *current_vp_assist;
22+
2023 struct eptPageTableEntry {
2124 uint64_t readable:1;
2225 uint64_t writable:1;
tools/testing/selftests/memfd/Makefile+12−2
@@ -8,11 +8,21 @@ TEST_GEN_PROGS := memfd_test · 7 unmodified lines
88 TEST_PROGS := run_fuse_test.sh run_hugetlbfs_test.sh
99 TEST_GEN_FILES := fuse_test fuse_mnt
1010
11−fuse_mnt.o: CFLAGS += $(shell pkg-config fuse --cflags)
11+VAR_CFLAGS := $(shell pkg-config fuse --cflags 2>/dev/null)
12+ifeq ($(VAR_CFLAGS),)
13+VAR_CFLAGS := -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse
14+endif
15+
16+VAR_LDLIBS := $(shell pkg-config fuse --libs 2>/dev/null)
17+ifeq ($(VAR_LDLIBS),)
18+VAR_LDLIBS := -lfuse -pthread
19+endif
20+
21+fuse_mnt.o: CFLAGS += $(VAR_CFLAGS)
1222
1323 include ../lib.mk
1424
15−$(OUTPUT)/fuse_mnt: LDLIBS += $(shell pkg-config fuse --libs)
25+$(OUTPUT)/fuse_mnt: LDLIBS += $(VAR_LDLIBS)
1626
1727 $(OUTPUT)/memfd_test: memfd_test.c common.c
1828 $(OUTPUT)/fuse_test: fuse_test.c common.c
tools/testing/selftests/net/tcp_mmap.c+5−2
@@ -165,9 +165,10 @@ void *child_thread(void *arg) · 164 unmodified lines
165165 socklen_t zc_len = sizeof(zc);
166166 int res;
167167
168+ memset(&zc, 0, sizeof(zc));
168169 zc.address = (__u64)((unsigned long)addr);
169170 zc.length = chunk_size;
170− zc.recv_skip_hint = 0;
171+
171172 res = getsockopt(fd, IPPROTO_TCP, TCP_ZEROCOPY_RECEIVE,
172173 &zc, &zc_len);
173174 if (res == -1)
@@ -281,12 +282,14 @@ static void setup_sockaddr(int domain, const char *str_addr, · 107 unmodified lines
281282 static void do_accept(int fdlisten)
282283 {
283284 pthread_attr_t attr;
285+ int rcvlowat;
284286
285287 pthread_attr_init(&attr);
286288 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
287289
290+ rcvlowat = chunk_size;
288291 if (setsockopt(fdlisten, SOL_SOCKET, SO_RCVLOWAT,
289− &chunk_size, sizeof(chunk_size)) == -1) {
292+ &rcvlowat, sizeof(rcvlowat)) == -1) {
290293 perror("setsockopt SO_RCVLOWAT");
291294 }
292295
tools/testing/selftests/wireguard/netns.sh+51−3
@@ -48,8 +48,11 @@ cleanup() { · 47 unmodified lines
4848 exec 2>/dev/null
4949 printf "$orig_message_cost" > /proc/sys/net/core/message_cost
5050 ip0 link del dev wg0
51+ ip0 link del dev wg1
5152 ip1 link del dev wg0
53+ ip1 link del dev wg1
5254 ip2 link del dev wg0
55+ ip2 link del dev wg1
5356 local to_kill="$(ip netns pids $netns0) $(ip netns pids $netns1) $(ip netns pids $netns2)"
5457 [[ -n $to_kill ]] && kill $to_kill
5558 pp ip netns del $netns1
@@ -77,18 +80,20 @@ ip0 link set wg0 netns $netns2 · 21 unmodified lines
7780 key1="$(pp wg genkey)"
7881 key2="$(pp wg genkey)"
7982 key3="$(pp wg genkey)"
83+key4="$(pp wg genkey)"
8084 pub1="$(pp wg pubkey <<<"$key1")"
8185 pub2="$(pp wg pubkey <<<"$key2")"
8286 pub3="$(pp wg pubkey <<<"$key3")"
87+pub4="$(pp wg pubkey <<<"$key4")"
8388 psk="$(pp wg genpsk)"
8489 [[ -n $key1 && -n $key2 && -n $psk ]]
8590
8691 configure_peers() {
8792 ip1 addr add 192.168.241.1/24 dev wg0
88− ip1 addr add fd00::1/24 dev wg0
93+ ip1 addr add fd00::1/112 dev wg0
8994
9095 ip2 addr add 192.168.241.2/24 dev wg0
91− ip2 addr add fd00::2/24 dev wg0
96+ ip2 addr add fd00::2/112 dev wg0
9297
9398 n1 wg set wg0 \
9499 private-key <(echo "$key1") \
@@ -230,9 +235,38 @@ n1 ping -W 1 -c 1 192.168.241.2 · 135 unmodified lines
230235 n1 wg set wg0 private-key <(echo "$key3")
231236 n2 wg set wg0 peer "$pub3" preshared-key <(echo "$psk") allowed-ips 192.168.241.1/32 peer "$pub1" remove
232237 n1 ping -W 1 -c 1 192.168.241.2
238+n2 wg set wg0 peer "$pub3" remove
239+
240+# Test that we can route wg through wg
241+ip1 addr flush dev wg0
242+ip2 addr flush dev wg0
243+ip1 addr add fd00::5:1/112 dev wg0
244+ip2 addr add fd00::5:2/112 dev wg0
245+n1 wg set wg0 private-key <(echo "$key1") peer "$pub2" preshared-key <(echo "$psk") allowed-ips fd00::5:2/128 endpoint 127.0.0.1:2
246+n2 wg set wg0 private-key <(echo "$key2") listen-port 2 peer "$pub1" preshared-key <(echo "$psk") allowed-ips fd00::5:1/128 endpoint 127.212.121.99:9998
247+ip1 link add wg1 type wireguard
248+ip2 link add wg1 type wireguard
249+ip1 addr add 192.168.241.1/24 dev wg1
250+ip1 addr add fd00::1/112 dev wg1
251+ip2 addr add 192.168.241.2/24 dev wg1
252+ip2 addr add fd00::2/112 dev wg1
253+ip1 link set mtu 1340 up dev wg1
254+ip2 link set mtu 1340 up dev wg1
255+n1 wg set wg1 listen-port 5 private-key <(echo "$key3") peer "$pub4" allowed-ips 192.168.241.2/32,fd00::2/128 endpoint [fd00::5:2]:5
256+n2 wg set wg1 listen-port 5 private-key <(echo "$key4") peer "$pub3" allowed-ips 192.168.241.1/32,fd00::1/128 endpoint [fd00::5:1]:5
257+tests
258+# Try to set up a routing loop between the two namespaces
259+ip1 link set netns $netns0 dev wg1
260+ip0 addr add 192.168.241.1/24 dev wg1
261+ip0 link set up dev wg1
262+n0 ping -W 1 -c 1 192.168.241.2
263+n1 wg set wg0 peer "$pub2" endpoint 192.168.241.2:7
264+ip2 link del wg0
265+ip2 link del wg1
266+! n0 ping -W 1 -c 10 -f 192.168.241.2 || false # Should not crash kernel
233267
268+ip0 link del wg1
234269 ip1 link del wg0
235−ip2 link del wg0
236270
237271 # Test using NAT. We now change the topology to this:
238272 # ┌────────────────────────────────────────┐ ┌────────────────────────────────────────────────┐ ┌────────────────────────────────────────┐
@@ -282,6 +316,20 @@ pp sleep 3 · 43 unmodified lines
282316 n2 ping -W 1 -c 1 192.168.241.1
283317 n1 wg set wg0 peer "$pub2" persistent-keepalive 0
284318
319+# Test that onion routing works, even when it loops
320+n1 wg set wg0 peer "$pub3" allowed-ips 192.168.242.2/32 endpoint 192.168.241.2:5
321+ip1 addr add 192.168.242.1/24 dev wg0
322+ip2 link add wg1 type wireguard
323+ip2 addr add 192.168.242.2/24 dev wg1
324+n2 wg set wg1 private-key <(echo "$key3") listen-port 5 peer "$pub1" allowed-ips 192.168.242.1/32
325+ip2 link set wg1 up
326+n1 ping -W 1 -c 1 192.168.242.2
327+ip2 link del wg1
328+n1 wg set wg0 peer "$pub3" endpoint 192.168.242.2:5
329+! n1 ping -W 1 -c 1 192.168.242.2 || false # Should not crash kernel
330+n1 wg set wg0 peer "$pub3" remove
331+ip1 addr del 192.168.242.1/24 dev wg0
332+
285333 # Do a wg-quick(8)-style policy routing for the default route, making sure vethc has a v6 address to tease out bugs.
286334 ip1 -6 addr add fc00::9/96 dev vethc
287335 ip1 -6 route add default via fc00::1
tools/testing/selftests/wireguard/qemu/arch/powerpc64le.config+1−0
@@ -10,3 +10,4 @@ CONFIG_CMDLINE_BOOL=y · 9 unmodified lines
1010 CONFIG_CMDLINE="console=hvc0 wg.success=hvc1"
1111 CONFIG_SECTION_MISMATCH_WARN_ONLY=y
1212 CONFIG_FRAME_WARN=1280
13+CONFIG_THREAD_SHIFT=14
tools/testing/selftests/wireguard/qemu/debug.config+0−1
@@ -25,7 +25,6 @@ CONFIG_KASAN=y · 24 unmodified lines
2525 CONFIG_KASAN_INLINE=y
2626 CONFIG_UBSAN=y
2727 CONFIG_UBSAN_SANITIZE_ALL=y
28−CONFIG_UBSAN_NO_ALIGNMENT=y
2928 CONFIG_UBSAN_NULL=y
3029 CONFIG_DEBUG_KMEMLEAK=y
3130 CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=8192
virt/kvm/arm/hyp/aarch32.c+6−2
@@ -125,12 +125,16 @@ static void __hyp_text kvm_adjust_itstate(struct kvm_vcpu *vcpu) · 124 unmodified lines
125125 */
126126 void __hyp_text kvm_skip_instr32(struct kvm_vcpu *vcpu, bool is_wide_instr)
127127 {
128+ u32 pc = *vcpu_pc(vcpu);
128129 bool is_thumb;
129130
130131 is_thumb = !!(*vcpu_cpsr(vcpu) & PSR_AA32_T_BIT);
131132 if (is_thumb && !is_wide_instr)
132− *vcpu_pc(vcpu) += 2;
133+ pc += 2;
133134 else
134− *vcpu_pc(vcpu) += 4;
135+ pc += 4;
136+
137+ *vcpu_pc(vcpu) = pc;
138+
135139 kvm_adjust_itstate(vcpu);
136140 }
virt/kvm/arm/psci.c+40−0
@@ -186,6 +186,33 @@ static void kvm_psci_system_reset(struct kvm_vcpu *vcpu) · 185 unmodified lines
186186 kvm_prepare_system_event(vcpu, KVM_SYSTEM_EVENT_RESET);
187187 }
188188
189+static void kvm_psci_narrow_to_32bit(struct kvm_vcpu *vcpu)
190+{
191+ int i;
192+
193+ /*
194+ * Zero the input registers' upper 32 bits. They will be fully
195+ * zeroed on exit, so we're fine changing them in place.
196+ */
197+ for (i = 1; i < 4; i++)
198+ vcpu_set_reg(vcpu, i, lower_32_bits(vcpu_get_reg(vcpu, i)));
199+}
200+
201+static unsigned long kvm_psci_check_allowed_function(struct kvm_vcpu *vcpu, u32 fn)
202+{
203+ switch(fn) {
204+ case PSCI_0_2_FN64_CPU_SUSPEND:
205+ case PSCI_0_2_FN64_CPU_ON:
206+ case PSCI_0_2_FN64_AFFINITY_INFO:
207+ /* Disallow these functions for 32bit guests */
208+ if (vcpu_mode_is_32bit(vcpu))
209+ return PSCI_RET_NOT_SUPPORTED;
210+ break;
211+ }
212+
213+ return 0;
214+}
215+
189216 static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)
190217 {
191218 struct kvm *kvm = vcpu->kvm;
@@ -193,6 +220,10 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu) · 1 unmodified line
193220 unsigned long val;
194221 int ret = 1;
195222
223+ val = kvm_psci_check_allowed_function(vcpu, psci_fn);
224+ if (val)
225+ goto out;
226+
196227 switch (psci_fn) {
197228 case PSCI_0_2_FN_PSCI_VERSION:
198229 /*
@@ -210,12 +241,16 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu) · 11 unmodified lines
210241 val = PSCI_RET_SUCCESS;
211242 break;
212243 case PSCI_0_2_FN_CPU_ON:
244+ kvm_psci_narrow_to_32bit(vcpu);
245+ fallthrough;
213246 case PSCI_0_2_FN64_CPU_ON:
214247 mutex_lock(&kvm->lock);
215248 val = kvm_psci_vcpu_on(vcpu);
216249 mutex_unlock(&kvm->lock);
217250 break;
218251 case PSCI_0_2_FN_AFFINITY_INFO:
252+ kvm_psci_narrow_to_32bit(vcpu);
253+ fallthrough;
219254 case PSCI_0_2_FN64_AFFINITY_INFO:
220255 val = kvm_psci_vcpu_affinity_info(vcpu);
221256 break;
@@ -256,6 +291,7 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu) · 34 unmodified lines
256291 break;
257292 }
258293
294+out:
259295 smccc_set_retval(vcpu, val, 0, 0, 0);
260296 return ret;
261297 }
@@ -273,6 +309,10 @@ static int kvm_psci_1_0_call(struct kvm_vcpu *vcpu) · 11 unmodified lines
273309 break;
274310 case PSCI_1_0_FN_PSCI_FEATURES:
275311 feature = smccc_get_arg1(vcpu);
312+ val = kvm_psci_check_allowed_function(vcpu, feature);
313+ if (val)
314+ break;
315+
276316 switch(feature) {
277317 case PSCI_0_2_FN_PSCI_VERSION:
278318 case PSCI_0_2_FN_CPU_SUSPEND:
virt/kvm/arm/vgic/vgic-init.c+16−3
@@ -294,8 +294,15 @@ int vgic_init(struct kvm *kvm) · 293 unmodified lines
294294 }
295295 }
296296
297− if (vgic_has_its(kvm)) {
297+ if (vgic_has_its(kvm))
298298 vgic_lpi_translation_cache_init(kvm);
299+
300+ /*
301+ * If we have GICv4.1 enabled, unconditionnaly request enable the
302+ * v4 support so that we get HW-accelerated vSGIs. Otherwise, only
303+ * enable it if we present a virtual ITS to the guest.
304+ */
305+ if (vgic_supports_direct_msis(kvm)) {
299306 ret = vgic_v4_init(kvm);
300307 if (ret)
301308 goto out;
@@ -348,6 +355,12 @@ void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu) · 46 unmodified lines
348355 {
349356 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
350357
358+ /*
359+ * Retire all pending LPIs on this vcpu anyway as we're
360+ * going to destroy it.
361+ */
362+ vgic_flush_pending_lpis(vcpu);
363+
351364 INIT_LIST_HEAD(&vgic_cpu->ap_list_head);
352365 }
353366
@@ -359,10 +372,10 @@ static void __kvm_vgic_destroy(struct kvm *kvm) · 5 unmodified lines
359372
360373 vgic_debug_destroy(kvm);
361374
362− kvm_vgic_dist_destroy(kvm);
363−
364375 kvm_for_each_vcpu(i, vcpu, kvm)
365376 kvm_vgic_vcpu_destroy(vcpu);
377+
378+ kvm_vgic_dist_destroy(kvm);
366379 }
367380
368381 void kvm_vgic_destroy(struct kvm *kvm)
virt/kvm/arm/vgic/vgic-its.c+9−2
@@ -96,14 +96,21 @@ out_unlock: · 95 unmodified lines
9696 * We "cache" the configuration table entries in our struct vgic_irq's.
9797 * However we only have those structs for mapped IRQs, so we read in
9898 * the respective config data from memory here upon mapping the LPI.
99+ *
100+ * Should any of these fail, behave as if we couldn't create the LPI
101+ * by dropping the refcount and returning the error.
99102 */
100103 ret = update_lpi_config(kvm, irq, NULL, false);
101− if (ret)
104+ if (ret) {
105+ vgic_put_irq(kvm, irq);
102106 return ERR_PTR(ret);
107+ }
103108
104109 ret = vgic_v3_lpi_sync_pending_status(kvm, irq);
105− if (ret)
110+ if (ret) {
111+ vgic_put_irq(kvm, irq);
106112 return ERR_PTR(ret);
113+ }
107114
108115 return irq;
109116 }
virt/kvm/arm/vgic/vgic-mmio-v2.c+10−6
@@ -409,24 +409,28 @@ static const struct vgic_register_region vgic_v2_dist_registers[] = { · 408 unmodified lines
409409 NULL, vgic_mmio_uaccess_write_v2_group, 1,
410410 VGIC_ACCESS_32bit),
411411 REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_ENABLE_SET,
412− vgic_mmio_read_enable, vgic_mmio_write_senable, NULL, NULL, 1,
412+ vgic_mmio_read_enable, vgic_mmio_write_senable,
413+ NULL, vgic_uaccess_write_senable, 1,
413414 VGIC_ACCESS_32bit),
414415 REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_ENABLE_CLEAR,
415− vgic_mmio_read_enable, vgic_mmio_write_cenable, NULL, NULL, 1,
416+ vgic_mmio_read_enable, vgic_mmio_write_cenable,
417+ NULL, vgic_uaccess_write_cenable, 1,
416418 VGIC_ACCESS_32bit),
417419 REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_PENDING_SET,
418− vgic_mmio_read_pending, vgic_mmio_write_spending, NULL, NULL, 1,
420+ vgic_mmio_read_pending, vgic_mmio_write_spending,
421+ NULL, vgic_uaccess_write_spending, 1,
419422 VGIC_ACCESS_32bit),
420423 REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_PENDING_CLEAR,
421− vgic_mmio_read_pending, vgic_mmio_write_cpending, NULL, NULL, 1,
424+ vgic_mmio_read_pending, vgic_mmio_write_cpending,
425+ NULL, vgic_uaccess_write_cpending, 1,
422426 VGIC_ACCESS_32bit),
423427 REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_ACTIVE_SET,
424428 vgic_mmio_read_active, vgic_mmio_write_sactive,
425− NULL, vgic_mmio_uaccess_write_sactive, 1,
429+ vgic_uaccess_read_active, vgic_mmio_uaccess_write_sactive, 1,
426430 VGIC_ACCESS_32bit),
427431 REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_ACTIVE_CLEAR,
428432 vgic_mmio_read_active, vgic_mmio_write_cactive,
429− NULL, vgic_mmio_uaccess_write_cactive, 1,
433+ vgic_uaccess_read_active, vgic_mmio_uaccess_write_cactive, 1,
430434 VGIC_ACCESS_32bit),
431435 REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_PRI,
432436 vgic_mmio_read_priority, vgic_mmio_write_priority, NULL, NULL,
virt/kvm/arm/vgic/vgic-mmio-v3.c+18−13
@@ -50,7 +50,8 @@ bool vgic_has_its(struct kvm *kvm) · 49 unmodified lines
5050
5151 bool vgic_supports_direct_msis(struct kvm *kvm)
5252 {
53− return kvm_vgic_global_state.has_gicv4 && vgic_has_its(kvm);
53+ return (kvm_vgic_global_state.has_gicv4_1 ||
54+ (kvm_vgic_global_state.has_gicv4 && vgic_has_its(kvm)));
5455 }
5556
5657 /*
@@ -538,10 +539,12 @@ static const struct vgic_register_region vgic_v3_dist_registers[] = { · 481 unmodified lines
538539 vgic_mmio_read_group, vgic_mmio_write_group, NULL, NULL, 1,
539540 VGIC_ACCESS_32bit),
540541 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_ISENABLER,
541− vgic_mmio_read_enable, vgic_mmio_write_senable, NULL, NULL, 1,
542+ vgic_mmio_read_enable, vgic_mmio_write_senable,
543+ NULL, vgic_uaccess_write_senable, 1,
542544 VGIC_ACCESS_32bit),
543545 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_ICENABLER,
544− vgic_mmio_read_enable, vgic_mmio_write_cenable, NULL, NULL, 1,
546+ vgic_mmio_read_enable, vgic_mmio_write_cenable,
547+ NULL, vgic_uaccess_write_cenable, 1,
545548 VGIC_ACCESS_32bit),
546549 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_ISPENDR,
547550 vgic_mmio_read_pending, vgic_mmio_write_spending,
@@ -553,11 +556,11 @@ static const struct vgic_register_region vgic_v3_dist_registers[] = { · 5 unmodified lines
553556 VGIC_ACCESS_32bit),
554557 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_ISACTIVER,
555558 vgic_mmio_read_active, vgic_mmio_write_sactive,
556− NULL, vgic_mmio_uaccess_write_sactive, 1,
559+ vgic_uaccess_read_active, vgic_mmio_uaccess_write_sactive, 1,
557560 VGIC_ACCESS_32bit),
558561 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_ICACTIVER,
559562 vgic_mmio_read_active, vgic_mmio_write_cactive,
560− NULL, vgic_mmio_uaccess_write_cactive,
563+ vgic_uaccess_read_active, vgic_mmio_uaccess_write_cactive,
561564 1, VGIC_ACCESS_32bit),
562565 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_IPRIORITYR,
563566 vgic_mmio_read_priority, vgic_mmio_write_priority, NULL, NULL,
@@ -609,11 +612,13 @@ static const struct vgic_register_region vgic_v3_rd_registers[] = { · 45 unmodified lines
609612 REGISTER_DESC_WITH_LENGTH(SZ_64K + GICR_IGROUPR0,
610613 vgic_mmio_read_group, vgic_mmio_write_group, 4,
611614 VGIC_ACCESS_32bit),
612− REGISTER_DESC_WITH_LENGTH(SZ_64K + GICR_ISENABLER0,
613− vgic_mmio_read_enable, vgic_mmio_write_senable, 4,
615+ REGISTER_DESC_WITH_LENGTH_UACCESS(SZ_64K + GICR_ISENABLER0,
616+ vgic_mmio_read_enable, vgic_mmio_write_senable,
617+ NULL, vgic_uaccess_write_senable, 4,
614618 VGIC_ACCESS_32bit),
615− REGISTER_DESC_WITH_LENGTH(SZ_64K + GICR_ICENABLER0,
616− vgic_mmio_read_enable, vgic_mmio_write_cenable, 4,
619+ REGISTER_DESC_WITH_LENGTH_UACCESS(SZ_64K + GICR_ICENABLER0,
620+ vgic_mmio_read_enable, vgic_mmio_write_cenable,
621+ NULL, vgic_uaccess_write_cenable, 4,
617622 VGIC_ACCESS_32bit),
618623 REGISTER_DESC_WITH_LENGTH_UACCESS(SZ_64K + GICR_ISPENDR0,
619624 vgic_mmio_read_pending, vgic_mmio_write_spending,
@@ -625,12 +630,12 @@ static const struct vgic_register_region vgic_v3_rd_registers[] = { · 5 unmodified lines
625630 VGIC_ACCESS_32bit),
626631 REGISTER_DESC_WITH_LENGTH_UACCESS(SZ_64K + GICR_ISACTIVER0,
627632 vgic_mmio_read_active, vgic_mmio_write_sactive,
628− NULL, vgic_mmio_uaccess_write_sactive,
629− 4, VGIC_ACCESS_32bit),
633+ vgic_uaccess_read_active, vgic_mmio_uaccess_write_sactive, 4,
634+ VGIC_ACCESS_32bit),
630635 REGISTER_DESC_WITH_LENGTH_UACCESS(SZ_64K + GICR_ICACTIVER0,
631636 vgic_mmio_read_active, vgic_mmio_write_cactive,
632− NULL, vgic_mmio_uaccess_write_cactive,
633− 4, VGIC_ACCESS_32bit),
637+ vgic_uaccess_read_active, vgic_mmio_uaccess_write_cactive, 4,
638+ VGIC_ACCESS_32bit),
634639 REGISTER_DESC_WITH_LENGTH(SZ_64K + GICR_IPRIORITYR0,
635640 vgic_mmio_read_priority, vgic_mmio_write_priority, 32,
636641 VGIC_ACCESS_32bit | VGIC_ACCESS_8bit),
virt/kvm/arm/vgic/vgic-mmio.c+170−58
@@ -184,6 +184,48 @@ void vgic_mmio_write_cenable(struct kvm_vcpu *vcpu, · 183 unmodified lines
184184 }
185185 }
186186
187+int vgic_uaccess_write_senable(struct kvm_vcpu *vcpu,
188+ gpa_t addr, unsigned int len,
189+ unsigned long val)
190+{
191+ u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
192+ int i;
193+ unsigned long flags;
194+
195+ for_each_set_bit(i, &val, len * 8) {
196+ struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i);
197+
198+ raw_spin_lock_irqsave(&irq->irq_lock, flags);
199+ irq->enabled = true;
200+ vgic_queue_irq_unlock(vcpu->kvm, irq, flags);
201+
202+ vgic_put_irq(vcpu->kvm, irq);
203+ }
204+
205+ return 0;
206+}
207+
208+int vgic_uaccess_write_cenable(struct kvm_vcpu *vcpu,
209+ gpa_t addr, unsigned int len,
210+ unsigned long val)
211+{
212+ u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
213+ int i;
214+ unsigned long flags;
215+
216+ for_each_set_bit(i, &val, len * 8) {
217+ struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i);
218+
219+ raw_spin_lock_irqsave(&irq->irq_lock, flags);
220+ irq->enabled = false;
221+ raw_spin_unlock_irqrestore(&irq->irq_lock, flags);
222+
223+ vgic_put_irq(vcpu->kvm, irq);
224+ }
225+
226+ return 0;
227+}
228+
187229 unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu,
188230 gpa_t addr, unsigned int len)
189231 {
@@ -219,17 +261,6 @@ unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu, · 29 unmodified lines
219261 return value;
220262 }
221263
222−/* Must be called with irq->irq_lock held */
223−static void vgic_hw_irq_spending(struct kvm_vcpu *vcpu, struct vgic_irq *irq,
224− bool is_uaccess)
225−{
226− if (is_uaccess)
227− return;
228−
229− irq->pending_latch = true;
230− vgic_irq_set_phys_active(irq, true);
231−}
232−
233264 static bool is_vgic_v2_sgi(struct kvm_vcpu *vcpu, struct vgic_irq *irq)
234265 {
235266 return (vgic_irq_is_sgi(irq->intid) &&
@@ -240,7 +271,6 @@ void vgic_mmio_write_spending(struct kvm_vcpu *vcpu, · 4 unmodified lines
240271 gpa_t addr, unsigned int len,
241272 unsigned long val)
242273 {
243− bool is_uaccess = !kvm_get_running_vcpu();
244274 u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
245275 int i;
246276 unsigned long flags;
@@ -270,22 +300,48 @@ void vgic_mmio_write_spending(struct kvm_vcpu *vcpu, · 23 unmodified lines
270300 continue;
271301 }
272302
303+ irq->pending_latch = true;
273304 if (irq->hw)
274− vgic_hw_irq_spending(vcpu, irq, is_uaccess);
275− else
276− irq->pending_latch = true;
305+ vgic_irq_set_phys_active(irq, true);
306+
277307 vgic_queue_irq_unlock(vcpu->kvm, irq, flags);
278308 vgic_put_irq(vcpu->kvm, irq);
279309 }
280310 }
281311
282−/* Must be called with irq->irq_lock held */
283−static void vgic_hw_irq_cpending(struct kvm_vcpu *vcpu, struct vgic_irq *irq,
284− bool is_uaccess)
312+int vgic_uaccess_write_spending(struct kvm_vcpu *vcpu,
313+ gpa_t addr, unsigned int len,
314+ unsigned long val)
285315 {
286− if (is_uaccess)
287− return;
316+ u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
317+ int i;
318+ unsigned long flags;
319+
320+ for_each_set_bit(i, &val, len * 8) {
321+ struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i);
322+
323+ raw_spin_lock_irqsave(&irq->irq_lock, flags);
324+ irq->pending_latch = true;
288325
326+ /*
327+ * GICv2 SGIs are terribly broken. We can't restore
328+ * the source of the interrupt, so just pick the vcpu
329+ * itself as the source...
330+ */
331+ if (is_vgic_v2_sgi(vcpu, irq))
332+ irq->source |= BIT(vcpu->vcpu_id);
333+
334+ vgic_queue_irq_unlock(vcpu->kvm, irq, flags);
335+
336+ vgic_put_irq(vcpu->kvm, irq);
337+ }
338+
339+ return 0;
340+}
341+
342+/* Must be called with irq->irq_lock held */
343+static void vgic_hw_irq_cpending(struct kvm_vcpu *vcpu, struct vgic_irq *irq)
344+{
289345 irq->pending_latch = false;
290346
291347 /*
@@ -308,7 +364,6 @@ void vgic_mmio_write_cpending(struct kvm_vcpu *vcpu, · 16 unmodified lines
308364 gpa_t addr, unsigned int len,
309365 unsigned long val)
310366 {
311− bool is_uaccess = !kvm_get_running_vcpu();
312367 u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
313368 int i;
314369 unsigned long flags;
@@ -339,7 +394,7 @@ void vgic_mmio_write_cpending(struct kvm_vcpu *vcpu, · 24 unmodified lines
339394 }
340395
341396 if (irq->hw)
342− vgic_hw_irq_cpending(vcpu, irq, is_uaccess);
397+ vgic_hw_irq_cpending(vcpu, irq);
343398 else
344399 irq->pending_latch = false;
345400
@@ -348,8 +403,68 @@ void vgic_mmio_write_cpending(struct kvm_vcpu *vcpu, · 2 unmodified lines
348403 }
349404 }
350405
351−unsigned long vgic_mmio_read_active(struct kvm_vcpu *vcpu,
352− gpa_t addr, unsigned int len)
406+int vgic_uaccess_write_cpending(struct kvm_vcpu *vcpu,
407+ gpa_t addr, unsigned int len,
408+ unsigned long val)
409+{
410+ u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
411+ int i;
412+ unsigned long flags;
413+
414+ for_each_set_bit(i, &val, len * 8) {
415+ struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i);
416+
417+ raw_spin_lock_irqsave(&irq->irq_lock, flags);
418+ /*
419+ * More fun with GICv2 SGIs! If we're clearing one of them
420+ * from userspace, which source vcpu to clear? Let's not
421+ * even think of it, and blow the whole set.
422+ */
423+ if (is_vgic_v2_sgi(vcpu, irq))
424+ irq->source = 0;
425+
426+ irq->pending_latch = false;
427+
428+ raw_spin_unlock_irqrestore(&irq->irq_lock, flags);
429+
430+ vgic_put_irq(vcpu->kvm, irq);
431+ }
432+
433+ return 0;
434+}
435+
436+/*
437+ * If we are fiddling with an IRQ's active state, we have to make sure the IRQ
438+ * is not queued on some running VCPU's LRs, because then the change to the
439+ * active state can be overwritten when the VCPU's state is synced coming back
440+ * from the guest.
441+ *
442+ * For shared interrupts as well as GICv3 private interrupts, we have to
443+ * stop all the VCPUs because interrupts can be migrated while we don't hold
444+ * the IRQ locks and we don't want to be chasing moving targets.
445+ *
446+ * For GICv2 private interrupts we don't have to do anything because
447+ * userspace accesses to the VGIC state already require all VCPUs to be
448+ * stopped, and only the VCPU itself can modify its private interrupts
449+ * active state, which guarantees that the VCPU is not running.
450+ */
451+static void vgic_access_active_prepare(struct kvm_vcpu *vcpu, u32 intid)
452+{
453+ if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3 ||
454+ intid >= VGIC_NR_PRIVATE_IRQS)
455+ kvm_arm_halt_guest(vcpu->kvm);
456+}
457+
458+/* See vgic_access_active_prepare */
459+static void vgic_access_active_finish(struct kvm_vcpu *vcpu, u32 intid)
460+{
461+ if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3 ||
462+ intid >= VGIC_NR_PRIVATE_IRQS)
463+ kvm_arm_resume_guest(vcpu->kvm);
464+}
465+
466+static unsigned long __vgic_mmio_read_active(struct kvm_vcpu *vcpu,
467+ gpa_t addr, unsigned int len)
353468 {
354469 u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
355470 u32 value = 0;
@@ -359,6 +474,10 @@ unsigned long vgic_mmio_read_active(struct kvm_vcpu *vcpu, · 3 unmodified lines
359474 for (i = 0; i < len * 8; i++) {
360475 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i);
361476
477+ /*
478+ * Even for HW interrupts, don't evaluate the HW state as
479+ * all the guest is interested in is the virtual state.
480+ */
362481 if (irq->active)
363482 value |= (1U << i);
364483
@@ -368,6 +487,29 @@ unsigned long vgic_mmio_read_active(struct kvm_vcpu *vcpu, · 3 unmodified lines
368487 return value;
369488 }
370489
490+unsigned long vgic_mmio_read_active(struct kvm_vcpu *vcpu,
491+ gpa_t addr, unsigned int len)
492+{
493+ u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
494+ u32 val;
495+
496+ mutex_lock(&vcpu->kvm->lock);
497+ vgic_access_active_prepare(vcpu, intid);
498+
499+ val = __vgic_mmio_read_active(vcpu, addr, len);
500+
501+ vgic_access_active_finish(vcpu, intid);
502+ mutex_unlock(&vcpu->kvm->lock);
503+
504+ return val;
505+}
506+
507+unsigned long vgic_uaccess_read_active(struct kvm_vcpu *vcpu,
508+ gpa_t addr, unsigned int len)
509+{
510+ return __vgic_mmio_read_active(vcpu, addr, len);
511+}
512+
371513 /* Must be called with irq->irq_lock held */
372514 static void vgic_hw_irq_change_active(struct kvm_vcpu *vcpu, struct vgic_irq *irq,
373515 bool active, bool is_uaccess)
@@ -426,36 +568,6 @@ static void vgic_mmio_change_active(struct kvm_vcpu *vcpu, struct vgic_irq *irq, · 52 unmodified lines
426568 raw_spin_unlock_irqrestore(&irq->irq_lock, flags);
427569 }
428570
429−/*
430− * If we are fiddling with an IRQ's active state, we have to make sure the IRQ
431− * is not queued on some running VCPU's LRs, because then the change to the
432− * active state can be overwritten when the VCPU's state is synced coming back
433− * from the guest.
434− *
435− * For shared interrupts, we have to stop all the VCPUs because interrupts can
436− * be migrated while we don't hold the IRQ locks and we don't want to be
437− * chasing moving targets.
438− *
439− * For private interrupts we don't have to do anything because userspace
440− * accesses to the VGIC state already require all VCPUs to be stopped, and
441− * only the VCPU itself can modify its private interrupts active state, which
442− * guarantees that the VCPU is not running.
443− */
444−static void vgic_change_active_prepare(struct kvm_vcpu *vcpu, u32 intid)
445−{
446− if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3 ||
447− intid > VGIC_NR_PRIVATE_IRQS)
448− kvm_arm_halt_guest(vcpu->kvm);
449−}
450−
451−/* See vgic_change_active_prepare */
452−static void vgic_change_active_finish(struct kvm_vcpu *vcpu, u32 intid)
453−{
454− if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3 ||
455− intid > VGIC_NR_PRIVATE_IRQS)
456− kvm_arm_resume_guest(vcpu->kvm);
457−}
458−
459571 static void __vgic_mmio_write_cactive(struct kvm_vcpu *vcpu,
460572 gpa_t addr, unsigned int len,
461573 unsigned long val)
@@ -477,11 +589,11 @@ void vgic_mmio_write_cactive(struct kvm_vcpu *vcpu, · 15 unmodified lines
477589 u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
478590
479591 mutex_lock(&vcpu->kvm->lock);
480− vgic_change_active_prepare(vcpu, intid);
592+ vgic_access_active_prepare(vcpu, intid);
481593
482594 __vgic_mmio_write_cactive(vcpu, addr, len, val);
483595
484− vgic_change_active_finish(vcpu, intid);
596+ vgic_access_active_finish(vcpu, intid);
485597 mutex_unlock(&vcpu->kvm->lock);
486598 }
487599
@@ -514,11 +626,11 @@ void vgic_mmio_write_sactive(struct kvm_vcpu *vcpu, · 26 unmodified lines
514626 u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
515627
516628 mutex_lock(&vcpu->kvm->lock);
517− vgic_change_active_prepare(vcpu, intid);
629+ vgic_access_active_prepare(vcpu, intid);
518630
519631 __vgic_mmio_write_sactive(vcpu, addr, len, val);
520632
521− vgic_change_active_finish(vcpu, intid);
633+ vgic_access_active_finish(vcpu, intid);
522634 mutex_unlock(&vcpu->kvm->lock);
523635 }
524636
virt/kvm/arm/vgic/vgic-mmio.h+19−0
@@ -138,6 +138,14 @@ void vgic_mmio_write_cenable(struct kvm_vcpu *vcpu, · 137 unmodified lines
138138 gpa_t addr, unsigned int len,
139139 unsigned long val);
140140
141+int vgic_uaccess_write_senable(struct kvm_vcpu *vcpu,
142+ gpa_t addr, unsigned int len,
143+ unsigned long val);
144+
145+int vgic_uaccess_write_cenable(struct kvm_vcpu *vcpu,
146+ gpa_t addr, unsigned int len,
147+ unsigned long val);
148+
141149 unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu,
142150 gpa_t addr, unsigned int len);
143151
@@ -149,9 +157,20 @@ void vgic_mmio_write_cpending(struct kvm_vcpu *vcpu, · 5 unmodified lines
149157 gpa_t addr, unsigned int len,
150158 unsigned long val);
151159
160+int vgic_uaccess_write_spending(struct kvm_vcpu *vcpu,
161+ gpa_t addr, unsigned int len,
162+ unsigned long val);
163+
164+int vgic_uaccess_write_cpending(struct kvm_vcpu *vcpu,
165+ gpa_t addr, unsigned int len,
166+ unsigned long val);
167+
152168 unsigned long vgic_mmio_read_active(struct kvm_vcpu *vcpu,
153169 gpa_t addr, unsigned int len);
154170
171+unsigned long vgic_uaccess_read_active(struct kvm_vcpu *vcpu,
172+ gpa_t addr, unsigned int len);
173+
155174 void vgic_mmio_write_cactive(struct kvm_vcpu *vcpu,
156175 gpa_t addr, unsigned int len,
157176 unsigned long val);